-
Notifications
You must be signed in to change notification settings - Fork 203
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
commit the serial branch [serial & usart] #199
commit the serial branch [serial & usart] #199
Conversation
文档后续整理出来一并附上 |
之前开会讨论的? |
@@ -86,7 +91,8 @@ | |||
PARITY_NONE, /* No parity */ \ | |||
BIT_ORDER_LSB, /* LSB first sent */ \ | |||
NRZ_NORMAL, /* Normal mode */ \ | |||
RT_SERIAL_RB_BUFSZ, /* Buffer size */ \ | |||
RT_SERIAL_RB_BUFSZ, /* rxBuf size */ \ | |||
0, /* txBuf size */ \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TX Buffer size
RX Buffer size
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
是的,默认两个buffer size,这个只是默认参数,两个buffer size的值具体多少,需要根据串口注册时候的具体值决定。
Add test case (uart_testcase.c) for uart 该提交新增uart_testcase,默认开启的是uart1。 测试内容:串口设置波特率为3Mbps,随机发送[1 ,1000]个数据,判断发送数据是否和接收的数据一致。测试10万次均正常,则测试通过。 |
具体做了哪些优化,解决了哪些问题,在哪里能看到啊? |
文档还在写。稍后会更新上来 |
下面链接是关于应用层使用串口的文档说明: |
@Guozhanxin 这个是提交在分支上的,如果没有冲突,就先合了吧 |
旧版本串口框架(以及驱动)主要有以下几类问题:
新版本的串口框架(以及驱动)主要改动点:
用户使用上基本完全兼容新版本的串口使用上 基本完全兼容老版本的串口使用方式,即统一使用rt_device的设备驱动框架。 唯一的区别在于旧版本的串口打开标志是: /* 接收模式参数 */
#define RT_DEVICE_FLAG_INT_RX 0x100 /* 中断接收模式 */
#define RT_DEVICE_FLAG_DMA_RX 0x200 /* DMA 接收模式 */
/* 发送模式参数 */
#define RT_DEVICE_FLAG_INT_TX 0x400 /* 中断发送模式 */
#define RT_DEVICE_FLAG_DMA_TX 0x800 /* DMA 发送模式 */ 新版本的串口打开标志是: /* 接收模式参数 */
#define RT_DEVICE_FLAG_RX_BLOCKING 0x1000 /* 接收阻塞模式*/
#define RT_DEVICE_FLAG_RX_NON_BLOCKING 0x2000 /* 接收非阻塞模式*/
/* 发送模式参数 */
#define RT_DEVICE_FLAG_TX_BLOCKING 0x4000 /* 发送阻塞模式*/
#define RT_DEVICE_FLAG_TX_NON_BLOCKING 0x8000 /* 发送非阻塞模式*/ 其他另外新版本串口框架暂未对POSIX接口进行适配,后续将进行适配与完善。 |
@@ -145,27 +151,34 @@ struct rt_serial_device | |||
void *serial_rx; | |||
void *serial_tx; | |||
}; | |||
typedef struct rt_serial_device rt_serial_t; | |||
typedef struct rt_serial_device *rt_serial_t; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个地方为什么要改?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
系统内有个约定成俗的习惯,用 typedef
为结构体声明别名为指针类型时,一般是*xxx_t,所以这里改为 *rt_serial_t。不过暂时没有使用这个类型 ,只是防止后边使用时出现数据类型混淆误用的情况发生。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
一些接口、定义还是尽量不要动的,要不然后面往主分支上合的时候,就费劲了,还要再改回来。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我就是担心往主分支合并,这个声明的别名还没按照规范去走才改的,不希望历史遗留的问题继续保留下来。大家都是 xxx_t是指针,这个xxx_t是结构体,以后用起来肯定会混淆的,只是好在现在系统里面都没用这个。或者是干脆删掉也行。
No description provided.