add libs
This commit is contained in:
5
lib_uart/tests/app_uart_test_stopbits/src/debug_conf.h
Normal file
5
lib_uart/tests/app_uart_test_stopbits/src/debug_conf.h
Normal file
@@ -0,0 +1,5 @@
|
||||
// Copyright (c) 2014-2016, XMOS Ltd, All rights reserved
|
||||
#define DEBUG_PRINT_ENABLE 1
|
||||
#define XASSERT_ENABLE_ASSERTIONS 1
|
||||
#define XASSERT_ENABLE_DEBUG 1
|
||||
#define XASSERT_ENABLE_LINE_NUMBERS 1
|
||||
51
lib_uart/tests/app_uart_test_stopbits/src/uart_test.xc
Normal file
51
lib_uart/tests/app_uart_test_stopbits/src/uart_test.xc
Normal file
@@ -0,0 +1,51 @@
|
||||
// Copyright (c) 2015-2016, XMOS Ltd, All rights reserved
|
||||
|
||||
#include <xs1.h>
|
||||
#include <platform.h>
|
||||
#include <stdlib.h>
|
||||
#include "debug_print.h"
|
||||
#include "xassert.h"
|
||||
#include "uart.h"
|
||||
|
||||
#define BITTIME(x) (100000000 / (x))
|
||||
|
||||
#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
|
||||
|
||||
#define CHECK_EVENTS 1
|
||||
#define CHECK_BUFFERING 1
|
||||
#define CHECK_RUNTIME_PARAMETER_CHANGE 1
|
||||
#define CHECK_PARITY_ERRORS 1
|
||||
|
||||
static void uart_test(client uart_tx_if i_uart_tx,
|
||||
client uart_config_if i_tx_config,
|
||||
unsigned baud_rate)
|
||||
{
|
||||
debug_printf("TEST CONFIG:{'baud rate':%d}\n",baud_rate);
|
||||
debug_printf("Performing tx test.\n");
|
||||
i_uart_tx.write(0x7F);
|
||||
i_uart_tx.write(0x00);
|
||||
i_uart_tx.write(0x2F);
|
||||
i_uart_tx.write(0xFF);
|
||||
_Exit(0);
|
||||
}
|
||||
|
||||
port p_rx = on tile[0] : XS1_PORT_1A;
|
||||
port p_tx = on tile[0] : XS1_PORT_1B;
|
||||
|
||||
|
||||
#define BUFFER_SIZE 64
|
||||
int main() {
|
||||
uart_tx_if i_tx;
|
||||
uart_config_if i_tx_config;
|
||||
output_gpio_if i_gpio_tx[1];
|
||||
par {
|
||||
|
||||
on tile[0] : output_gpio(i_gpio_tx, 1, p_tx, null);
|
||||
on tile[0] : uart_tx(i_tx, i_tx_config, BAUD, UART_PARITY_NONE, 8, STOPBITS, i_gpio_tx[0]);
|
||||
on tile[0] : {
|
||||
uart_test(i_tx, i_tx_config, BAUD);
|
||||
// _Exit(0);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user