uart0.h

来自「自己编写的飞利浦LPC2200的串口驱动,可以支持在OS下和非OS下,主要通过在」· C头文件 代码 · 共 43 行

H
43
字号
#ifndef _UART0_H_
#define _UART0_H_

#include "config.h"

#ifdef _UART0_C_
static uint8 UART0SendSem;
static uint8 UART0ReceiveSem;
static uint8 UART0SendQSem;
static uint8 UART0ReceiveQSem;
#endif

#ifndef NULL
#define NULL (void *)0
#endif

#define UART0_SENDQ_LENGTH					64
#define UART0_Receive_LENGTH				16

#define UART0_EnterCritical()				
#define UART0_ExitCritical()				
#define UART0_SemCreate(sem, val, pErr)		do{sem = val;*pErr = 0;}while(0)
#define UART0_SemPend(sem)					do{while(sem == 0);sem--;}while(0)
#define UART0_SemPost(sem)					do{sem++;}while(0)

enum
{
	NO_PARITY,
	ODD,
	EVEN,
	FORCE_0,
	FORCE_1
};


uint8 UART0_Init(uint32 baud, uint8 dataBits, uint8 parityCheck, uint8 stopBits);
void UART0_Setup(uint32 baud, uint8 dataBits, uint8 parityCheck, uint8 stopBits);
void UART0_Send(uint8 *buf, uint32 nBytes);
void UART0_Receive(uint8 *buf, uint32 nBytes);
void UART0_IntService(void);

#endif

⌨️ 快捷键说明

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