Microchip® Advanced Software Framework

btstack_slip.c File Reference
#include "btstack_slip.h"
#include "btstack_debug.h"

Macros

#define __BTSTACK_FILE__   "btstack_slip.c"
 

Enumerations

enum  btstack_slip_decoder_state_t {
  SLIP_DECODER_UNKNOWN = 1,
  SLIP_DECODER_ACTIVE,
  SLIP_DECODER_X_C0,
  SLIP_DECODER_X_DB,
  SLIP_DECODER_COMPLETE
}
 
enum  btstack_slip_encoder_state_t {
  SLIP_ENCODER_DEFAULT,
  SLIP_ENCODER_SEND_DC,
  SLIP_ENCODER_SEND_DD
}
 

Functions

uint16_t btstack_slip_decoder_frame_size (void)
 Get size of decoded frame. More...
 
void btstack_slip_decoder_init (uint8_t *buffer, uint16_t max_size)
 Initialise SLIP decoder with buffer. More...
 
void btstack_slip_decoder_process (uint8_t input)
 Process received byte. More...
 
static void btstack_slip_decoder_reset (void)
 
static void btstack_slip_decoder_store_byte (uint8_t input)
 
uint8_t btstack_slip_encoder_get_byte (void)
 Get next byte from encoder. More...
 
int btstack_slip_encoder_has_data (void)
 Check if encoder has data ready. More...
 
void btstack_slip_encoder_start (const uint8_t *data, uint16_t len)
 Initialise SLIP encoder with data. More...
 

Variables

static uint8_t * decoder_buffer
 
static uint16_t decoder_max_size
 
static uint16_t decoder_pos
 
static btstack_slip_decoder_state_t decoder_state
 
static const uint8_t * encoder_data
 
static uint16_t encoder_len
 
static btstack_slip_encoder_state_t encoder_state
 

#define __BTSTACK_FILE__   "btstack_slip.c"

Enumerator
SLIP_DECODER_UNKNOWN 
SLIP_DECODER_ACTIVE 
SLIP_DECODER_X_C0 
SLIP_DECODER_X_DB 
SLIP_DECODER_COMPLETE 
Enumerator
SLIP_ENCODER_DEFAULT 
SLIP_ENCODER_SEND_DC 
SLIP_ENCODER_SEND_DD 

uint16_t btstack_slip_decoder_frame_size ( void  )

Get size of decoded frame.

Returns
size of frame. Size = 0 => frame not complete

References decoder_pos, decoder_state, and SLIP_DECODER_COMPLETE.

Referenced by hci_transport_h5_block_received().

void btstack_slip_decoder_init ( uint8_t *  buffer,
uint16_t  max_size 
)

Initialise SLIP decoder with buffer.

Parameters
bufferto store received data
max_sizeof buffer

References btstack_slip_decoder_reset(), buffer, decoder_buffer, and decoder_max_size.

Referenced by hci_transport_slip_init().

static void btstack_slip_decoder_reset ( void  )
static
static void btstack_slip_decoder_store_byte ( uint8_t  input)
static
uint8_t btstack_slip_encoder_get_byte ( void  )
int btstack_slip_encoder_has_data ( void  )

Check if encoder has data ready.

Returns
True if data ready

References encoder_len, encoder_state, and SLIP_ENCODER_DEFAULT.

Referenced by hci_transport_h5_block_sent(), hci_transport_slip_encode_chunk_and_send(), and hci_transport_slip_send_frame().

void btstack_slip_encoder_start ( const uint8_t *  data,
uint16_t  len 
)

Initialise SLIP encoder with data.

Parameters
data
len

References encoder_data, encoder_len, encoder_state, and SLIP_ENCODER_DEFAULT.

Referenced by hci_transport_slip_encode_chunk_and_send(), and hci_transport_slip_send_frame().

uint8_t* decoder_buffer
static
uint16_t decoder_max_size
static
const uint8_t* encoder_data
static