@@ -30,13 +30,6 @@ LOG_MODULE_REGISTER(bt_driver);
3030
3131#include "../util.h"
3232
33- #define H4_NONE 0x00
34- #define H4_CMD 0x01
35- #define H4_ACL 0x02
36- #define H4_SCO 0x03
37- #define H4_EVT 0x04
38- #define H4_ISO 0x05
39-
4033static K_KERNEL_STACK_DEFINE (rx_thread_stack , CONFIG_BT_DRV_RX_STACK_SIZE ) ;
4134static struct k_thread rx_thread_data ;
4235
@@ -78,20 +71,20 @@ static inline void h4_get_type(void)
7871 /* Get packet type */
7972 if (uart_fifo_read (h4_dev , & rx .type , 1 ) != 1 ) {
8073 LOG_WRN ("Unable to read H:4 packet type" );
81- rx .type = H4_NONE ;
74+ rx .type = BT_HCI_H4_NONE ;
8275 return ;
8376 }
8477
8578 switch (rx .type ) {
86- case H4_EVT :
79+ case BT_HCI_H4_EVT :
8780 rx .remaining = sizeof (rx .evt );
8881 rx .hdr_len = rx .remaining ;
8982 break ;
90- case H4_ACL :
83+ case BT_HCI_H4_ACL :
9184 rx .remaining = sizeof (rx .acl );
9285 rx .hdr_len = rx .remaining ;
9386 break ;
94- case H4_ISO :
87+ case BT_HCI_H4_ISO :
9588 if (IS_ENABLED (CONFIG_BT_ISO )) {
9689 rx .remaining = sizeof (rx .iso );
9790 rx .hdr_len = rx .remaining ;
@@ -100,7 +93,7 @@ static inline void h4_get_type(void)
10093 __fallthrough ;
10194 default :
10295 LOG_ERR ("Unknown H:4 type 0x%02x" , rx .type );
103- rx .type = H4_NONE ;
96+ rx .type = BT_HCI_H4_NONE ;
10497 }
10598}
10699
@@ -185,7 +178,7 @@ static inline void copy_hdr(struct net_buf *buf)
185178
186179static void reset_rx (void )
187180{
188- rx .type = H4_NONE ;
181+ rx .type = BT_HCI_H4_NONE ;
189182 rx .remaining = 0U ;
190183 rx .have_hdr = false;
191184 rx .hdr_len = 0U ;
@@ -197,11 +190,11 @@ static struct net_buf *get_rx(k_timeout_t timeout)
197190 LOG_DBG ("type 0x%02x, evt 0x%02x" , rx .type , rx .evt .evt );
198191
199192 switch (rx .type ) {
200- case H4_EVT :
193+ case BT_HCI_H4_EVT :
201194 return bt_buf_get_evt (rx .evt .evt , rx .discardable , timeout );
202- case H4_ACL :
195+ case BT_HCI_H4_ACL :
203196 return bt_buf_get_rx (BT_BUF_ACL_IN , timeout );
204- case H4_ISO :
197+ case BT_HCI_H4_ISO :
205198 if (IS_ENABLED (CONFIG_BT_ISO )) {
206199 return bt_buf_get_rx (BT_BUF_ISO_IN , timeout );
207200 }
@@ -329,7 +322,7 @@ static inline void read_payload(void)
329322 buf = rx .buf ;
330323 rx .buf = NULL ;
331324
332- if (rx .type == H4_EVT ) {
325+ if (rx .type == BT_HCI_H4_EVT ) {
333326 bt_buf_set_type (buf , BT_BUF_EVT );
334327 } else {
335328 bt_buf_set_type (buf , BT_BUF_ACL_IN );
@@ -344,16 +337,16 @@ static inline void read_payload(void)
344337static inline void read_header (void )
345338{
346339 switch (rx .type ) {
347- case H4_NONE :
340+ case BT_HCI_H4_NONE :
348341 h4_get_type ();
349342 return ;
350- case H4_EVT :
343+ case BT_HCI_H4_EVT :
351344 get_evt_hdr ();
352345 break ;
353- case H4_ACL :
346+ case BT_HCI_H4_ACL :
354347 get_acl_hdr ();
355348 break ;
356- case H4_ISO :
349+ case BT_HCI_H4_ISO :
357350 if (IS_ENABLED (CONFIG_BT_ISO )) {
358351 get_iso_hdr ();
359352 break ;
@@ -391,14 +384,14 @@ static inline void process_tx(void)
391384 if (!tx .type ) {
392385 switch (bt_buf_get_type (tx .buf )) {
393386 case BT_BUF_ACL_OUT :
394- tx .type = H4_ACL ;
387+ tx .type = BT_HCI_H4_ACL ;
395388 break ;
396389 case BT_BUF_CMD :
397- tx .type = H4_CMD ;
390+ tx .type = BT_HCI_H4_CMD ;
398391 break ;
399392 case BT_BUF_ISO_OUT :
400393 if (IS_ENABLED (CONFIG_BT_ISO )) {
401- tx .type = H4_ISO ;
394+ tx .type = BT_HCI_H4_ISO ;
402395 break ;
403396 }
404397 __fallthrough ;
@@ -410,7 +403,7 @@ static inline void process_tx(void)
410403 bytes = uart_fifo_fill (h4_dev , & tx .type , 1 );
411404 if (bytes != 1 ) {
412405 LOG_WRN ("Unable to send H:4 type" );
413- tx .type = H4_NONE ;
406+ tx .type = BT_HCI_H4_NONE ;
414407 return ;
415408 }
416409 }
@@ -427,7 +420,7 @@ static inline void process_tx(void)
427420 }
428421
429422done :
430- tx .type = H4_NONE ;
423+ tx .type = BT_HCI_H4_NONE ;
431424 net_buf_unref (tx .buf );
432425 tx .buf = net_buf_get (& tx .fifo , K_NO_WAIT );
433426 if (!tx .buf ) {
0 commit comments