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

📄 uart.h

📁 RTOS系统
💻 H
字号:
/* $Id: //depot/software/SDK/Triscend/a7hal/include/uart.h#17 $ */#ifndef _UART_H#define    _UART_H/* ********************************************************** *  uart.h *  Copyright(C) 2001-2004 Triscend Corporation. All Rights Reserved. *  This file is licensed under the terms of Triscend SDK License Agreement. ********************************************************** */#if defined(_PROJECT_HEADER)#include _PROJECT_HEADER#endif/** * \file * Contains #defines, structures and function prototypes used by the UART driver. *//* * Line Control Bit Definitions */#define A7HAL_DLAB              0x80#define A7HAL_BITS5_STOPS1      0x00#define A7HAL_BITS6_STOPS1      0x01#define A7HAL_BITS7_STOPS1      0x02#define A7HAL_BITS8_STOPS1      0x03#define A7HAL_BITS5_STOPS1_5    0x04#define A7HAL_BITS6_STOPS2      0x05#define A7HAL_BITS7_STOPS2      0x06#define A7HAL_BITS8_STOPS2      0x07#define A7HAL_PARITY_ENABLE     0x08#define A7HAL_PARITY_NONE       0x00#define A7HAL_PARITY_EVEN       0x10#define A7HAL_PARITY_ODD        0x00/* * Line Status Bit Definitions */#define A7HAL_DATA_READY        0x01#define A7HAL_OVERRUN_ERR       0x02#define A7HAL_PARITY_ERR        0x04#define A7HAL_FRAMING_ERR       0x08#define A7HAL_BREAK             0x10#define A7HAL_THRE              0x20#define A7HAL_TE                0x40#define A7HAL_ERROR             0x80/* * Modem Control Bit Definitions */#define A7HAL_RTS                0x02#define A7HAL_DTR                0x01/* * Interrupt Enable Bit Definitions */#define A7HAL_THRE_INT           0x02#define A7HAL_RX_INT             0x01/* * Used For Baud Rate Calculations */#define A7HAL_CLOCK_DIVISOR      0x10/* * FIFO Control Bit Definitions */#define A7HAL_FIFO_ENABLE        0x01#define A7HAL_FIFO_RX_CLEAR      0x02#define A7HAL_FIFO_TX_CLEAR      0x04#define A7HAL_MAX_PORTS          0x02   /* No Of Serial Ports   */#define A7HAL_DEFAULT_BAUD       115200 /* Default Baud Rate    */#define A7HAL_DEFAULT_PORT       0x00   /* Default Port For Std in/out  *//** * \brief Generic UART control values * * \see a7hal_uart_setRTS, a7hal_uart_setDTR, a7hal_uart_setRxInt, a7hal_uart_setTxInt */typedef enum{    /**     * Turn the UART property off.     */    OFF = 0x00,    /**     * Turn the UART property on.     */    ON = 0x01}a7hal_uart_onOff;/** * FIFO depth definitions. * * \see a7hal_uart_fifoDepth */typedef enum{    /**     * FIFO is 1 byte deep.     */    A7HAL_FIFO_1_BYTE = 0x00,    /**     * FIFO is 4 bytes deep.     */    A7HAL_FIFO_4_BYTES = 0x40,    /**     * FIFO is 8 bytes deep.     */    A7HAL_FIFO_8_BYTES = 0x80,    /**     * FIFO is 14 bytes deep.     */    A7HAL_FIFO_14_BYTES = 0xc0}a7hal_uart_fifoDepth;/* * UART register definition structure. * */typedef struct{    unsigned long control;      /* Offset 0x00      */    unsigned long reserved[7];  /* Offset 0x04  */    unsigned long rxtx;         /* Offset 0x20      */    unsigned long intEnable;    unsigned long intId;    unsigned long lineControl;    unsigned long modemControl;    unsigned long lineStatus;    unsigned long modemStatus;    unsigned long scratchPad;}a7hal_uart;#ifdef __cplusplusextern "C"{#endif    void a7hal_uart_init( void );    int a7hal_uart_getChar( int port );    int a7hal_uart_putChar( int port, int c );    void a7hal_uart_setBaud( int port, int baudRate );    int a7hal_uart_getBaud( int port );    void a7hal_uart_putString( char *string );    void a7hal_uart_reset( int port );    int a7hal_uart_setStdio( int port );    int a7hal_uart_getStdio( void );    int a7hal_uart_getCount( void );    void a7hal_uart_modemControlEnable( int port );    void a7hal_uart_setRTS( a7hal_uart_onOff onOff );    void a7hal_uart_setDTR( a7hal_uart_onOff onOff );    int a7hal_uart_getIntStatus( int port );    int a7hal_uart_getLineStatus( int port );    void a7hal_uart_setRxInt( int port, a7hal_uart_onOff onOff );    void a7hal_uart_setTxInt( int port, a7hal_uart_onOff onOff );    void a7hal_uart_setFIFO( int port, a7hal_uart_fifoDepth depth );    void a7hal_uart_flush( int port );    unsigned long a7hal_uart_getDeviceAddress( void );    void a7hal_uart_setLineControl( int port,                                    int dataBits, int stopBits, int parity );#ifdef __cplusplus}#endif#endif

⌨️ 快捷键说明

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