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

📄 uart.h

📁 S3C44B0 串口驱动程序
💻 H
字号:
/** @file	uart.h* @brief	串口部分API程序* @Author	Mars.zhu 2007-11-19 10:10* @欢迎测试使用, 如有问题请发邮件至 Mars.zhu@hotmail.com , 谢谢!*/#ifndef	__UART_H#define	__UART_H#define	Uart_Monitor_NO		0/** @func open_uart* @brief 打开串口, 主要是扩展串口硬件初始化操作* @Retval	D_OK	 成功*			D_ERR	 失败*/D_Result	open_uart(void);/** @func open_port* @brief 打开串口* @Retval	D_OK	 成功*			D_ERR	 失败*/D_Result	open_port(uint8 fd, uint8 comport);/** @func close_port* @brief 关闭串口* @Retval	D_OK	 成功*			D_ERR	 失败*/D_Result	close_port(uint8 fd, uint8 comport);/** @func set_opt* @brief 设置串口属性函数* @Retval	D_OK	 成功*			D_ERR	 失败*/D_Result	set_opt(uint8 fd, speed_t nSpeed, uint8 nBits, char nEvent, uint8 nStop);/** @func	uart_write* @brief	向串口写入数据* @param	fd			打开的串口描述符*			data_buf	发送数据缓冲区*			NByte		发送字节数* @Retval	writen		成功發送字節數*/uint16		uart_write(uint8 fd, const uint8 *data_buf, uint16 NByte);/** @func	uart_read* @brief	中斷方式接收多字节数据* @param	n, 0-UART0	1-UART1*			data_buf	接收数据缓冲区首地址*			NByte			接收字节数* @Retval	實際接收的字節數*/uint16		uart_read(uint8 fd, uint8 *data_buf, uint16 NByte);/** @func	uart_putch* @brief	向串口缓冲区写1字节数据* @param	fd	打开的串口描述符*			ch	写入的字符* @Retval	0	成功*/D_Result	uart_putch(uint8 fd, uint8 ch);/** @func	uart_getch* @brief	从串口缓冲区读1字节数据* @param	fd	打开的串口描述符*			ch	读取的字符* @Retval	0	成功*/D_Result	uart_getch(uint8 fd, uint8 *ch);/** @func	uart_print* @brief	输出字符串* @param	fd	打开的串口描述符*			str	字符串指针, 字符串只输出MaxLenStr以内部分* @Retval	void*/void		uart_print(uint8 fd, char *str);void		uart_print_hex(uint8 fd, uint8 hex);void		uart_print_dec(uint8 fd, uint8 dec);#ifdef D_MONITOR#define	D_Print(x)		uart_print(Uart_Monitor_NO, x)#define	D_PutCh(x)		uart_putch(Uart_Monitor_NO, x)#define	D_GetCh(x)		uart_getch(Uart_Monitor_NO, x)#define	D_PutHex(x)		uart_print_hex(Uart_Monitor_NO, x)#define	D_PutDec(x)		uart_print_dec(Uart_Monitor_NO, x)#else#define	D_Print(x)#define	D_PutCh(x)#define	D_GetCh(x)#define	D_PutHex(x)#define	D_PutDec(x)#endif#endif	/** __UART_H*/

⌨️ 快捷键说明

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