uart.h

来自「一个操作系统源代码 用于嵌入式设备 在Vc++环境下仿真 成功移植到多款处理器上」· C头文件 代码 · 共 41 行

H
41
字号
#ifndef UART_H
#define UART_H

//macro and definition 
#define UART_NUM		2
#define UART0		1
#define UART1		2
#define UART_ALL	( UART0 | UART1 )

//#define  MAX_SEND_BUF		1024
#define MAX_RECEIVE_BUF		1024

//for test
#define MAX_SEND_BUF			18
//#define  MAX_RECEIVEBUF	40

//--- external variables ----------------------------------------------
extern unsigned long	UartEventFlag[UART_NUM];

extern void InitUart( void );
extern int WriteUartSendBuf( short id, unsigned char* pData, unsigned long byteCounts, long timeout );
extern int ReadUartReceiveBuf( short id, unsigned char* pData, unsigned long byteCounts, long timeout);
extern void SetUartRecvDataSize( short id, int datasize);
extern void EnableUartInt( short id );
extern void DisableUartInt( short id );
extern void FreeUart( void );
extern int CheckUartRecvBuf( short id, unsigned long *num );
//extern void PrereadUartRecvBuf( int id, int byteCounts );
extern void ChangeUartConfig( short id );

#define write_0_SendBuf( pData, byteCounts, timeout )	WriteUartSendBuf( 0, pData, byteCounts, timeout )
#define read_0_ReceiveBuf( pData, byteCounts, timeout )	ReadUartReceiveBuf( 0, pData, byteCounts, timeout )
#define SetUart0RecvDataSize( datasize )		SetUartRecvDataSize( 0, datasize, timeout )

#define write_1_SendBuf( pData, byteCounts, timeout )	WriteUartSendBuf( 1, pData, byteCounts, timeout )
#define read_1_ReceiveBuf( pData, byteCounts, timeout )	ReadUartReceiveBuf( 1, pData, byteCounts, timeout )
#define SetUart1RecvDataSize( datasize )		SetUartRecvDataSize( 1, datasize )

#endif /* UART_H */

⌨️ 快捷键说明

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