📄 uarttest.c
字号:
/*
* Copyright 2005 by SEED.
* All rights reserved. Property of SEED.
* Restricted rights to use, duplicate or disclose this code are
* granted through contract.
*
*/
/*
* ======== uarttest.c ========
*/
#include <std.h>
#include <log.h>
#include <gio.h>
#include <iom.h>
#ifdef _6x_
extern far LOG_Obj trace;
#else
extern LOG_Obj trace;
#endif
Char buf[32] = "Hello World ";
Char buf1[32] = "Hello World ";
/*
* ======== main ========
*/
Void main()
{
LOG_printf(&trace, "UART Test started!");
}
/*
* ======== echo =========
*/
Void echo()
{
GIO_Handle inChan, outChan;
Uns size = 16;
Int status;
inChan = GIO_create("/uart", IOM_INPUT, NULL, NULL, NULL);
outChan = GIO_create("/uart", IOM_OUTPUT, NULL, NULL, NULL);
if (inChan == NULL || outChan == NULL) {
LOG_printf(&trace, "GIO_create failed");
SYS_abort("GIO_create");
}
for (;;)
{
status = GIO_read(inChan, buf, &size);
if (status < 0)
{
LOG_printf(&trace, "GIO_write error");
SYS_abort("GIO_read");
}
// for(;;){}
// for(;;)
// {
status = GIO_write(outChan, buf, &size);
if (status < 0)
{
LOG_printf(&trace, "GIO_write error");
SYS_abort("GIO_write");
}
// }
}
}
Void e1()
{
GIO_Handle inChan1, outChan1;
Uns size = 16;
Int status;
inChan1 = GIO_create("/uart1", IOM_INPUT, NULL, NULL, NULL);
outChan1 = GIO_create("/uart1", IOM_OUTPUT, NULL, NULL, NULL);
if (inChan1 == NULL || outChan1 == NULL)
{
LOG_printf(&trace, "GIO_create failed");
SYS_abort("GIO_create");
}
for (;;)
{
status = GIO_read(inChan1, buf1, &size);
if (status < 0)
{
LOG_printf(&trace, "GIO_write error");
SYS_abort("GIO_read");
}
// for(;;){}
// for(;;)
// {
status = GIO_write(outChan1, buf1, &size);
if (status < 0)
{
LOG_printf(&trace, "GIO_write error");
SYS_abort("GIO_write");
}
// }
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -