@@ -309,7 +309,7 @@ static int usbd_cdc_acm_request(struct usbd_class_data *const c_data,
309
309
size_t done ;
310
310
311
311
LOG_HEXDUMP_INF (buf -> data , buf -> len , "" );
312
- done = ring_buf_put (data -> rx_fifo .rb , buf -> data , buf -> len );
312
+ done = ring_buffer_write (data -> rx_fifo .rb , buf -> data , buf -> len );
313
313
if (done && data -> cb ) {
314
314
cdc_acm_work_submit (& data -> irq_cb_work );
315
315
}
@@ -326,7 +326,7 @@ static int usbd_cdc_acm_request(struct usbd_class_data *const c_data,
326
326
327
327
atomic_clear_bit (& data -> state , CDC_ACM_TX_FIFO_BUSY );
328
328
329
- if (!ring_buf_is_empty (data -> tx_fifo .rb )) {
329
+ if (!ring_buffer_empty (data -> tx_fifo .rb )) {
330
330
/* Queue pending TX data on IN endpoint */
331
331
cdc_acm_work_schedule (& data -> tx_fifo_work , K_NO_WAIT );
332
332
}
@@ -361,7 +361,7 @@ static void usbd_cdc_acm_enable(struct usbd_class_data *const c_data)
361
361
}
362
362
363
363
if (atomic_test_bit (& data -> state , CDC_ACM_IRQ_TX_ENABLED )) {
364
- if (ring_buf_space_get (data -> tx_fifo .rb )) {
364
+ if (ring_buffer_space (data -> tx_fifo .rb )) {
365
365
/* Raise TX ready interrupt */
366
366
cdc_acm_work_submit (& data -> irq_cb_work );
367
367
} else {
@@ -658,7 +658,7 @@ static void cdc_acm_tx_fifo_handler(struct k_work *work)
658
658
return ;
659
659
}
660
660
661
- len = ring_buf_get (data -> tx_fifo .rb , buf -> data , buf -> size );
661
+ len = ring_buffer_read (data -> tx_fifo .rb , buf -> data , buf -> size );
662
662
net_buf_add (buf , len );
663
663
664
664
data -> zlp_needed = len != 0 && len % cdc_acm_get_bulk_mps (c_data ) == 0 ;
@@ -697,7 +697,7 @@ static void cdc_acm_rx_fifo_handler(struct k_work *work)
697
697
return ;
698
698
}
699
699
700
- if (ring_buf_space_get (data -> rx_fifo .rb ) < cdc_acm_get_bulk_mps (c_data )) {
700
+ if (ring_buffer_space (data -> rx_fifo .rb ) < cdc_acm_get_bulk_mps (c_data )) {
701
701
LOG_INF ("RX buffer to small, throttle" );
702
702
return ;
703
703
}
@@ -729,7 +729,7 @@ static void cdc_acm_irq_tx_enable(const struct device *dev)
729
729
730
730
atomic_set_bit (& data -> state , CDC_ACM_IRQ_TX_ENABLED );
731
731
732
- if (ring_buf_space_get (data -> tx_fifo .rb )) {
732
+ if (ring_buffer_space (data -> tx_fifo .rb )) {
733
733
LOG_INF ("tx_en: trigger irq_cb_work" );
734
734
cdc_acm_work_submit (& data -> irq_cb_work );
735
735
}
@@ -749,7 +749,7 @@ static void cdc_acm_irq_rx_enable(const struct device *dev)
749
749
atomic_set_bit (& data -> state , CDC_ACM_IRQ_RX_ENABLED );
750
750
751
751
/* Permit buffer to be drained regardless of USB state */
752
- if (!ring_buf_is_empty (data -> rx_fifo .rb )) {
752
+ if (!ring_buffer_empty (data -> rx_fifo .rb )) {
753
753
LOG_INF ("rx_en: trigger irq_cb_work" );
754
754
cdc_acm_work_submit (& data -> irq_cb_work );
755
755
}
@@ -782,14 +782,14 @@ static int cdc_acm_fifo_fill(const struct device *dev,
782
782
}
783
783
784
784
key = k_spin_lock (& data -> lock );
785
- done = ring_buf_put (data -> tx_fifo .rb , tx_data , len );
785
+ done = ring_buffer_write (data -> tx_fifo .rb , tx_data , len );
786
786
k_spin_unlock (& data -> lock , key );
787
787
if (done ) {
788
788
data -> tx_fifo .altered = true;
789
789
}
790
790
791
791
LOG_INF ("UART dev %p, len %d, remaining space %u" ,
792
- dev , len , ring_buf_space_get (data -> tx_fifo .rb ));
792
+ dev , len , ring_buffer_space (data -> tx_fifo .rb ));
793
793
794
794
return done ;
795
795
}
@@ -810,7 +810,7 @@ static int cdc_acm_fifo_read(const struct device *dev,
810
810
return 0 ;
811
811
}
812
812
813
- len = ring_buf_get (data -> rx_fifo .rb , rx_data , size );
813
+ len = ring_buffer_read (data -> rx_fifo .rb , rx_data , size );
814
814
if (len ) {
815
815
data -> rx_fifo .altered = true;
816
816
}
@@ -824,7 +824,7 @@ static int cdc_acm_irq_tx_ready(const struct device *dev)
824
824
825
825
if (check_wq_ctx (dev )) {
826
826
if (data -> tx_fifo .irq ) {
827
- return ring_buf_space_get (data -> tx_fifo .rb );
827
+ return ring_buffer_space (data -> tx_fifo .rb );
828
828
}
829
829
} else {
830
830
LOG_WRN ("Invoked by inappropriate context" );
@@ -878,14 +878,14 @@ static int cdc_acm_irq_update(const struct device *dev)
878
878
}
879
879
880
880
if (atomic_test_bit (& data -> state , CDC_ACM_IRQ_RX_ENABLED ) &&
881
- !ring_buf_is_empty (data -> rx_fifo .rb )) {
881
+ !ring_buffer_empty (data -> rx_fifo .rb )) {
882
882
data -> rx_fifo .irq = true;
883
883
} else {
884
884
data -> rx_fifo .irq = false;
885
885
}
886
886
887
887
if (atomic_test_bit (& data -> state , CDC_ACM_IRQ_TX_ENABLED ) &&
888
- ring_buf_space_get (data -> tx_fifo .rb )) {
888
+ ring_buffer_space (data -> tx_fifo .rb )) {
889
889
data -> tx_fifo .irq = true;
890
890
} else {
891
891
data -> tx_fifo .irq = false;
@@ -947,13 +947,13 @@ static void cdc_acm_irq_cb_handler(struct k_work *work)
947
947
}
948
948
949
949
if (atomic_test_bit (& data -> state , CDC_ACM_IRQ_RX_ENABLED ) &&
950
- !ring_buf_is_empty (data -> rx_fifo .rb )) {
950
+ !ring_buffer_empty (data -> rx_fifo .rb )) {
951
951
LOG_DBG ("rx irq pending, submit irq_cb_work" );
952
952
cdc_acm_work_submit (& data -> irq_cb_work );
953
953
}
954
954
955
955
if (atomic_test_bit (& data -> state , CDC_ACM_IRQ_TX_ENABLED ) &&
956
- ring_buf_space_get (data -> tx_fifo .rb )) {
956
+ ring_buffer_space (data -> tx_fifo .rb )) {
957
957
LOG_DBG ("tx irq pending, submit irq_cb_work" );
958
958
cdc_acm_work_submit (& data -> irq_cb_work );
959
959
}
@@ -975,11 +975,11 @@ static int cdc_acm_poll_in(const struct device *dev, unsigned char *const c)
975
975
uint32_t len ;
976
976
int ret = -1 ;
977
977
978
- if (ring_buf_is_empty (data -> rx_fifo .rb )) {
978
+ if (ring_buffer_empty (data -> rx_fifo .rb )) {
979
979
return ret ;
980
980
}
981
981
982
- len = ring_buf_get (data -> rx_fifo .rb , c , 1 );
982
+ len = ring_buffer_read (data -> rx_fifo .rb , c , 1 );
983
983
if (len ) {
984
984
cdc_acm_work_submit (& data -> rx_fifo_work );
985
985
ret = 0 ;
@@ -996,7 +996,7 @@ static void cdc_acm_poll_out(const struct device *dev, const unsigned char c)
996
996
997
997
while (true) {
998
998
key = k_spin_lock (& data -> lock );
999
- wrote = ring_buf_put (data -> tx_fifo .rb , & c , 1 );
999
+ wrote = ring_buffer_write (data -> tx_fifo .rb , & c , 1 );
1000
1000
k_spin_unlock (& data -> lock , key );
1001
1001
1002
1002
if (wrote == 1 ) {
@@ -1119,8 +1119,8 @@ static int usbd_cdc_acm_preinit(const struct device *dev)
1119
1119
{
1120
1120
struct cdc_acm_uart_data * const data = dev -> data ;
1121
1121
1122
- ring_buf_reset (data -> tx_fifo .rb );
1123
- ring_buf_reset (data -> rx_fifo .rb );
1122
+ ring_buffer_reset (data -> tx_fifo .rb );
1123
+ ring_buffer_reset (data -> rx_fifo .rb );
1124
1124
1125
1125
k_work_init_delayable (& data -> tx_fifo_work , cdc_acm_tx_fifo_handler );
1126
1126
k_work_init (& data -> rx_fifo_work , cdc_acm_rx_fifo_handler );
0 commit comments