Microchip® Advanced Software Framework

hci_transport_h4.c File Reference
#include <inttypes.h>
#include "btstack_config.h"
#include "btstack_debug.h"
#include "hci.h"
#include "hci_transport.h"
#include "bluetooth_company_id.h"
#include "btstack_uart_block.h"

Macros

#define __BTSTACK_FILE__   "hci_transport_h4.c"
 
#define ENABLE_LOG_EHCILL
 

Enumerations

enum  H4_STATE {
  H4_W4_PACKET_TYPE,
  H4_W4_EVENT_HEADER,
  H4_W4_ACL_HEADER,
  H4_W4_SCO_HEADER,
  H4_W4_PAYLOAD
}
 
enum  TX_STATE {
  TX_IDLE = 1,
  TX_W4_PACKET_SENT
}
 

Functions

static void dummy_handler (uint8_t packet_type, uint8_t *packet, uint16_t size)
 
static void hci_transport_h4_block_read (void)
 
static void hci_transport_h4_block_sent (void)
 
static int hci_transport_h4_can_send_now (uint8_t packet_type)
 
static int hci_transport_h4_close (void)
 
static void hci_transport_h4_init (const void *transport_config)
 
const hci_transport_thci_transport_h4_instance (const btstack_uart_block_t *uart_driver)
 
static int hci_transport_h4_open (void)
 
static void hci_transport_h4_register_packet_handler (void(*handler)(uint8_t packet_type, uint8_t *packet, uint16_t size))
 
static void hci_transport_h4_reset_statemachine (void)
 
static int hci_transport_h4_send_packet (uint8_t packet_type, uint8_t *packet, int size)
 
static int hci_transport_h4_set_baudrate (uint32_t baudrate)
 
static void hci_transport_h4_trigger_next_read (void)
 

Variables

static const btstack_uart_block_tbtstack_uart
 
static int bytes_to_read
 
static H4_STATE h4_state
 
static uint8_t * hci_packet = &hci_packet_with_pre_buffer[HCI_INCOMING_PRE_BUFFER_SIZE]
 
static uint8_t hci_packet_with_pre_buffer [HCI_INCOMING_PRE_BUFFER_SIZE+1+HCI_PACKET_BUFFER_SIZE]
 
static const hci_transport_t hci_transport_h4
 
static void(* packet_handler )(uint8_t packet_type, uint8_t *packet, uint16_t size) = dummy_handler
 
static uint8_t packet_sent_event [] = { HCI_EVENT_TRANSPORT_PACKET_SENT, 0}
 
static int read_pos
 
static TX_STATE tx_state
 
static btstack_uart_config_t uart_config
 

#define __BTSTACK_FILE__   "hci_transport_h4.c"
#define ENABLE_LOG_EHCILL

enum H4_STATE
Enumerator
H4_W4_PACKET_TYPE 
H4_W4_EVENT_HEADER 
H4_W4_ACL_HEADER 
H4_W4_SCO_HEADER 
H4_W4_PAYLOAD 
enum TX_STATE
Enumerator
TX_IDLE 
TX_W4_PACKET_SENT 

static void dummy_handler ( uint8_t  packet_type,
uint8_t *  packet,
uint16_t  size 
)
static
static void hci_transport_h4_block_sent ( void  )
static
static int hci_transport_h4_can_send_now ( uint8_t  packet_type)
static

References TX_IDLE, and tx_state.

static int hci_transport_h4_close ( void  )
static
const hci_transport_t* hci_transport_h4_instance ( const btstack_uart_block_t uart_driver)

References hci_transport_h4, and uart_driver.

Referenced by bt_app_init().

static int hci_transport_h4_open ( void  )
static
static void hci_transport_h4_register_packet_handler ( void(*)(uint8_t packet_type, uint8_t *packet, uint16_t size)  handler)
static

References packet_handler.

static void hci_transport_h4_reset_statemachine ( void  )
static
static int hci_transport_h4_send_packet ( uint8_t  packet_type,
uint8_t *  packet,
int  size 
)
static
static int hci_transport_h4_set_baudrate ( uint32_t  baudrate)
static
static void hci_transport_h4_trigger_next_read ( void  )
static

const btstack_uart_block_t* btstack_uart
static
uint8_t hci_packet_with_pre_buffer[HCI_INCOMING_PRE_BUFFER_SIZE+1+HCI_PACKET_BUFFER_SIZE]
static
const hci_transport_t hci_transport_h4
static
Initial value:
= {
"H4",
NULL,
}
#define NULL
Definition: src/include/lwip/def.h:47
static void hci_transport_h4_register_packet_handler(void(*handler)(uint8_t packet_type, uint8_t *packet, uint16_t size))
Definition: hci_transport_h4.c:380
static int hci_transport_h4_close(void)
Definition: hci_transport_h4.c:376
static int hci_transport_h4_open(void)
Definition: hci_transport_h4.c:360
static int hci_transport_h4_can_send_now(uint8_t packet_type)
Definition: hci_transport_h4.c:296
static int hci_transport_h4_set_baudrate(uint32_t baudrate)
Definition: hci_transport_h4.c:161
static int hci_transport_h4_send_packet(uint8_t packet_type, uint8_t *packet, int size)
Definition: hci_transport_h4.c:300
static void hci_transport_h4_init(const void *transport_config)
Definition: hci_transport_h4.c:337

Referenced by hci_transport_h4_instance().

void(* packet_handler)(uint8_t packet_type, uint8_t *packet, uint16_t size) = dummy_handler
static
uint8_t packet_sent_event[] = { HCI_EVENT_TRANSPORT_PACKET_SENT, 0}
static
btstack_uart_config_t uart_config
static