初始提交
This commit is contained in:
90
dtest/gpio_mtx_test/gpio_mtx_test.c
Normal file
90
dtest/gpio_mtx_test/gpio_mtx_test.c
Normal file
@@ -0,0 +1,90 @@
|
||||
/****************************************************************************
|
||||
|
||||
Copyright(c) 2019 by Aerospace C.Power (Chongqing) Microelectronics. ALL RIGHTS RESERVED.
|
||||
|
||||
This Information is proprietary to Aerospace C.Power (Chongqing) Microelectronics and MAY NOT
|
||||
be copied by any method or incorporated into another program without
|
||||
the express written consent of Aerospace C.Power. This Information or any portion
|
||||
thereof remains the property of Aerospace C.Power. The Information contained herein
|
||||
is believed to be accurate and Aerospace C.Power assumes no responsibility or
|
||||
liability for its use in any way and conveys no license or title under
|
||||
any patent or copyright and makes no representation or warranty that this
|
||||
Information is free from patent or copyright infringement.
|
||||
|
||||
****************************************************************************/
|
||||
#include "os_types.h"
|
||||
#include "dbg_io.h"
|
||||
#include "iot_diag.h"
|
||||
#include "iot_io.h"
|
||||
|
||||
#include "uart.h"
|
||||
#include "gpio_mtx.h"
|
||||
|
||||
#define TEST_UART_PORT 1
|
||||
|
||||
int32_t test_uart1_getc(void)
|
||||
{
|
||||
int32_t c;
|
||||
c = g_uart_ctrl.getc(TEST_UART_PORT);
|
||||
if (c == -6) {
|
||||
return -1;
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
int32_t test_uart0_getc(void)
|
||||
{
|
||||
int32_t c;
|
||||
c = g_uart_ctrl.getc(0);
|
||||
if (c == -6) {
|
||||
return -1;
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
void test_uart1_putc(const char c)
|
||||
{
|
||||
g_uart_ctrl.try_putc(TEST_UART_PORT, c);
|
||||
}
|
||||
|
||||
void test_uart1_init()
|
||||
{
|
||||
g_uart_ctrl.init(TEST_UART_PORT);
|
||||
//g_uart_ctrl.config(1, 2400, 8, 1, 0);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
dbg_uart_init();
|
||||
test_uart1_init();
|
||||
|
||||
iot_printf("hello world.\n");
|
||||
iot_printf("hello world.\n");
|
||||
iot_printf("hello world.\n");
|
||||
iot_printf("hello world.\n");
|
||||
uint32_t c;
|
||||
char buf[10] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'};
|
||||
int i;
|
||||
int j = 0;
|
||||
char get;
|
||||
while(1) {
|
||||
for (i=0; i< 10; i++) {
|
||||
test_uart1_putc(buf[i]);
|
||||
c = test_uart1_getc();
|
||||
if (c != -1) {
|
||||
for(j=0;j<10000;j++);
|
||||
get = (char)c;
|
||||
iot_printf("get data: %c\n", get);
|
||||
}
|
||||
c = test_uart0_getc();
|
||||
if (c != -1) {
|
||||
for(j=0;j<10000;j++);
|
||||
get = (char)c;
|
||||
iot_printf("get0 data: %c\n", get);
|
||||
}
|
||||
for(j=0;j<1000000;j++);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user