⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 uarttest.c

📁 基于TI-EVMDM642的UART驱动开发
💻 C
字号:
/*
 *  Copyright 2003 by Texas Instruments Incorporated.
 *  All rights reserved. Property of Texas Instruments Incorporated.
 *  Restricted rights to use, duplicate or disclose this code are
 *  granted through contract.
 *  
 */
/* "@(#) DDK 1.11.00.00 11-04-03 (ddk-b13)" */
/*
 *  ======== uarttest.c ========
 */

#include <std.h>

#include <log.h>
#include <gio.h>
#include <iom.h>
#include <uartmd.h>
#include <uarthw_evmdm642.h>

#ifdef _6x_
extern far LOG_Obj trace;
#else
extern LOG_Obj trace;
#endif


/*
 *  ======== main ========
 */
Void main()
{
    LOG_printf(&trace, "UART Test started!");
}

/*
 *  ======== echo =========
 */
Void echo()
{
    GIO_Handle  inChan, outChan;
    Char        buf[12] = "Hello World ";
    Uns         size = 12;
    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_write(outChan, buf, &size);

        if (status < 0) {
            LOG_printf(&trace, "GIO_write error");
            SYS_abort("GIO_write");
        }

        status = GIO_read(inChan, buf, &size);

        if (status < 0) {
            LOG_printf(&trace, "GIO_write error");
            SYS_abort("GIO_read");
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -