@@ -41,7 +41,7 @@ static void am33xx_uart_isr(int irqno, void* param)
4141
4242 if ((iir & (0x02 << 1 )) || (iir & (0x6 << 1 )))
4343 {
44- rt_hw_serial_isr (serial );
44+ rt_hw_serial_isr (serial , RT_SERIAL_EVENT_RX_IND );
4545 }
4646}
4747
@@ -165,7 +165,6 @@ static const struct rt_uart_ops am33xx_uart_ops =
165165
166166/* UART device driver structure */
167167#ifdef RT_USING_UART0
168- struct serial_ringbuffer uart0_int_rx ;
169168struct am33xx_uart uart0 =
170169{
171170 UART0_BASE ,
@@ -175,7 +174,6 @@ struct rt_serial_device serial0;
175174#endif
176175
177176#ifdef RT_USING_UART1
178- struct serial_ringbuffer uart1_int_rx ;
179177struct am33xx_uart uart1 =
180178{
181179 UART1_BASE ,
@@ -185,7 +183,6 @@ struct rt_serial_device serial1;
185183#endif
186184
187185#ifdef RT_USING_UART2
188- struct serial_ringbuffer uart2_int_rx ;
189186struct am33xx_uart uart2 =
190187{
191188 UART2_BASE ,
@@ -195,7 +192,6 @@ struct rt_serial_device serial2;
195192#endif
196193
197194#ifdef RT_USING_UART3
198- struct serial_ringbuffer uart3_int_rx ;
199195struct am33xx_uart uart3 =
200196{
201197 UART3_BASE ,
@@ -205,7 +201,6 @@ struct rt_serial_device serial3;
205201#endif
206202
207203#ifdef RT_USING_UART4
208- struct serial_ringbuffer uart4_int_rx ;
209204struct am33xx_uart uart4 =
210205{
211206 UART4_BASE ,
@@ -215,7 +210,6 @@ struct rt_serial_device serial4;
215210#endif
216211
217212#ifdef RT_USING_UART5
218- struct serial_ringbuffer uart5_int_rx ;
219213struct am33xx_uart uart5 =
220214{
221215 UART5_BASE ,
@@ -359,8 +353,9 @@ int rt_hw_serial_init(void)
359353 config .parity = PARITY_NONE ;
360354 config .stop_bits = STOP_BITS_1 ;
361355 config .invert = NRZ_NORMAL ;
356+ config .bufsz = RT_SERIAL_RB_BUFSZ ;
357+
362358 serial0 .ops = & am33xx_uart_ops ;
363- serial0 .int_rx = & uart0_int_rx ;
364359 serial0 .config = config ;
365360 /* enable RX interrupt */
366361 UART_IER_REG (uart0 .base ) = 0x01 ;
@@ -370,7 +365,7 @@ int rt_hw_serial_init(void)
370365 rt_hw_interrupt_mask (uart0 .irq );
371366 /* register UART0 device */
372367 rt_hw_serial_register (& serial0 , "uart0" ,
373- RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX | RT_DEVICE_FLAG_STREAM ,
368+ RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX ,
374369 & uart0 );
375370#endif
376371
@@ -381,8 +376,9 @@ int rt_hw_serial_init(void)
381376 config .parity = PARITY_NONE ;
382377 config .stop_bits = STOP_BITS_1 ;
383378 config .invert = NRZ_NORMAL ;
379+ config .bufsz = RT_SERIAL_RB_BUFSZ ;
380+
384381 serial1 .ops = & am33xx_uart_ops ;
385- serial1 .int_rx = & uart1_int_rx ;
386382 serial1 .config = config ;
387383 /* enable RX interrupt */
388384 UART_IER_REG (uart1 .base ) = 0x01 ;
@@ -392,7 +388,7 @@ int rt_hw_serial_init(void)
392388 rt_hw_interrupt_mask (uart1 .irq );
393389 /* register UART0 device */
394390 rt_hw_serial_register (& serial1 , "uart1" ,
395- RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX | RT_DEVICE_FLAG_STREAM ,
391+ RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX ,
396392 & uart1 );
397393#endif
398394
@@ -403,8 +399,9 @@ int rt_hw_serial_init(void)
403399 config .parity = PARITY_NONE ;
404400 config .stop_bits = STOP_BITS_1 ;
405401 config .invert = NRZ_NORMAL ;
402+ config .bufsz = RT_SERIAL_RB_BUFSZ ;
403+
406404 serial2 .ops = & am33xx_uart_ops ;
407- serial2 .int_rx = & uart2_int_rx ;
408405 serial2 .config = config ;
409406 /* enable RX interrupt */
410407 UART_IER_REG (uart2 .base ) = 0x01 ;
@@ -414,7 +411,7 @@ int rt_hw_serial_init(void)
414411 rt_hw_interrupt_mask (uart2 .irq );
415412 /* register UART2 device */
416413 rt_hw_serial_register (& serial2 , "uart2" ,
417- RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX | RT_DEVICE_FLAG_STREAM ,
414+ RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX ,
418415 & uart2 );
419416#endif
420417
@@ -425,8 +422,9 @@ int rt_hw_serial_init(void)
425422 config .parity = PARITY_NONE ;
426423 config .stop_bits = STOP_BITS_1 ;
427424 config .invert = NRZ_NORMAL ;
425+ config .bufsz = RT_SERIAL_RB_BUFSZ ;
426+
428427 serial3 .ops = & am33xx_uart_ops ;
429- serial3 .int_rx = & uart_3_int_rx ;
430428 serial3 .config = config ;
431429 /* enable RX interrupt */
432430 UART_IER_REG (uart3 .base ) = 0x01 ;
@@ -436,7 +434,7 @@ int rt_hw_serial_init(void)
436434 rt_hw_interrupt_mask (uart3 .irq );
437435 /* register UART3 device */
438436 rt_hw_serial_register (& serial3 , "uart3" ,
439- RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX | RT_DEVICE_FLAG_STREAM ,
437+ RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX ,
440438 & uart3 );
441439#endif
442440
@@ -447,9 +445,9 @@ int rt_hw_serial_init(void)
447445 config .parity = PARITY_NONE ;
448446 config .stop_bits = STOP_BITS_1 ;
449447 config .invert = NRZ_NORMAL ;
448+ config .bufsz = RT_SERIAL_RB_BUFSZ ;
450449
451450 serial4 .ops = & am33xx_uart_ops ;
452- serial4 .int_rx = & uart4_int_rx ;
453451 serial4 .config = config ;
454452 /* enable RX interrupt */
455453 UART_IER_REG (uart4 .base ) = 0x01 ;
@@ -459,7 +457,7 @@ int rt_hw_serial_init(void)
459457 rt_hw_interrupt_mask (uart4 .irq );
460458 /* register UART4 device */
461459 rt_hw_serial_register (& serial4 , "uart4" ,
462- RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX | RT_DEVICE_FLAG_STREAM ,
460+ RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX ,
463461 & uart4 );
464462#endif
465463
@@ -470,9 +468,9 @@ int rt_hw_serial_init(void)
470468 config .parity = PARITY_NONE ;
471469 config .stop_bits = STOP_BITS_1 ;
472470 config .invert = NRZ_NORMAL ;
471+ config .bufsz = RT_SERIAL_RB_BUFSZ ;
473472
474473 serial5 .ops = & am33xx_uart_ops ;
475- serial5 .int_rx = & uart5_int_rx ;
476474 serial5 .config = config ;
477475 /* enable RX interrupt */
478476 UART_IER_REG (uart5 .base ) = 0x01 ;
@@ -482,7 +480,7 @@ int rt_hw_serial_init(void)
482480 rt_hw_interrupt_mask (uart5 .irq );
483481 /* register UART4 device */
484482 rt_hw_serial_register (& serial5 , "uart5" ,
485- RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX | RT_DEVICE_FLAG_STREAM ,
483+ RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX ,
486484 & uart5 );
487485#endif
488486
0 commit comments