diff --git a/src/hci_transport_h4_dma.c b/src/hci_transport_h4_dma.c index 61b9dea34..76f91015d 100644 --- a/src/hci_transport_h4_dma.c +++ b/src/hci_transport_h4_dma.c @@ -81,6 +81,10 @@ static const char * h4_get_transport_name(); static int h4_set_baudrate(uint32_t baudrate); static int h4_can_send_packet_now(uint8_t packet_type); +// externa prototyps, support for foo +void foo_handle(uint8_t action); +void foo_prepare_for_send(void); + // packet reader state machine static H4_STATE h4_state; static int read_pos; @@ -160,10 +164,14 @@ static void h4_block_received(void){ h4_state = H4_W4_EVENT_HEADER; bytes_to_read = HCI_EVENT_HEADER_SIZE; break; + default: +#ifdef HAVE_FOO: + foo_handle(hci_packet[0]); +#else log_error("h4_process: invalid packet type 0x%02x\r\n", hci_packet[0]); +#endif read_pos = 0; - h4_state = H4_W4_PACKET_TYPE; bytes_to_read = 1; break; } @@ -226,7 +234,7 @@ static void h4_register_packet_handler(void (*handler)(uint8_t packet_type, uint packet_handler = handler; } -// #define DUMP +#define DUMP #ifdef DUMP static void dump(uint8_t *data, uint16_t len){ @@ -275,6 +283,10 @@ static int h4_send_packet(uint8_t packet_type, uint8_t *packet, int size){ printf("TX: %02x ", packet_type); dump(packet, size); #endif + +#ifdef HAVE_FOO: + foo_prepare_for_send(); +#endif tx_data = packet; tx_len = size;