Contiki-NG
Functions
rf-ble-cmd.c File Reference

BLE commands for the TI CC26xx BLE radio. More...

#include "contiki.h"
#include "rf_ble_cmd.h"
#include "rf-core/rf-core.h"
#include "rf-core/ble-hal/rf-ble-cmd.h"
#include "sys/log.h"

Go to the source code of this file.

Functions

unsigned short rf_ble_cmd_send (uint8_t *command)
 Sends a BLE radio command to the radio. More...
 
unsigned short rf_ble_cmd_wait (uint8_t *command)
 Waits for a running BLE radio command to be finished. More...
 
unsigned short rf_ble_cmd_setup_ble_mode (void)
 Initializes the radio core to be used as a BLE radio. More...
 
void rf_ble_cmd_create_adv_cmd (uint8_t *command, uint8_t channel, uint8_t *param, uint8_t *output)
 Creates a BLE radio command structure that enables BLE advertisement when sent to the radio core. More...
 
void rf_ble_cmd_create_adv_params (uint8_t *param, dataQueue_t *rx_queue, uint8_t adv_data_len, uint8_t *adv_data, uint8_t scan_resp_data_len, uint8_t *scan_resp_data, ble_addr_type_t own_addr_type, uint8_t *own_addr)
 Creates BLE radio command parameters that are used to enable BLE advertisement on the radio core. More...
 
void rf_ble_cmd_create_initiator_cmd (uint8_t *cmd, uint8_t channel, uint8_t *params, uint8_t *output, uint32_t start_time)
 Creates a BLE radio command structure that sets up BLE initiation event when sent to the radio core. More...
 
void rf_ble_cmd_create_initiator_params (uint8_t *param, dataQueue_t *rx_queue, uint32_t initiator_time, ble_addr_type_t own_addr_type, uint8_t *own_addr, ble_addr_type_t peer_addr_type, uint8_t *peer_addr, uint32_t connect_time, uint8_t *conn_req_data)
 Creates BLE radio command parameters that are used to set up BLE initiation event on the radio core. More...
 
void rf_ble_cmd_create_slave_cmd (uint8_t *cmd, uint8_t channel, uint8_t *params, uint8_t *output, uint32_t start_time)
 Creates a BLE radio command structure that sets up a single BLE connection event when sent to the radio core. More...
 
void rf_ble_cmd_create_slave_params (uint8_t *params, dataQueue_t *rx_queue, dataQueue_t *tx_queue, uint32_t access_address, uint8_t crc_init_0, uint8_t crc_init_1, uint8_t crc_init_2, uint32_t win_size, uint32_t window_widening, uint8_t first_packet)
 Creates BLE radio command parameters that are used to setup a single BLE connection event on the radio core. More...
 
void rf_ble_cmd_create_master_cmd (uint8_t *cmd, uint8_t channel, uint8_t *params, uint8_t *output, uint32_t start_time)
 Creates a BLE radio command structure that sets up BLE connection event when sent to the radio core. More...
 
void rf_ble_cmd_create_master_params (uint8_t *params, dataQueue_t *rx_queue, dataQueue_t *tx_queue, uint32_t access_address, uint8_t crc_init_0, uint8_t crc_init_1, uint8_t crc_init_2, uint8_t first_packet)
 Creates BLE radio command parameters that are used to set up BLE connection event on the radio core. More...
 
unsigned short rf_ble_cmd_add_data_queue_entry (dataQueue_t *q, uint8_t *e)
 Adds a data buffer to a BLE transmission queue. More...
 

Detailed Description

BLE commands for the TI CC26xx BLE radio.

These functions are specific to the TI CC26xx and cannot be reused by other BLE radios.

Author
Michael Spoerk micha.nosp@m.el.s.nosp@m.poerk.nosp@m.@tug.nosp@m.raz.a.nosp@m.t Jinyan BAI onefr.nosp@m.eebj.nosp@m.y@out.nosp@m.look.nosp@m..com

Definition in file rf-ble-cmd.c.

Function Documentation

◆ rf_ble_cmd_add_data_queue_entry()

unsigned short rf_ble_cmd_add_data_queue_entry ( dataQueue_t *  q,
uint8_t *  e 
)

Adds a data buffer to a BLE transmission queue.

Parameters
qA pointer to BLE transmission queue where the buffer should be added
eA pointer to the data buffer that is added

Definition at line 514 of file rf-ble-cmd.c.

◆ rf_ble_cmd_create_adv_cmd()

void rf_ble_cmd_create_adv_cmd ( uint8_t *  command,
uint8_t  channel,
uint8_t *  param,
uint8_t *  output 
)

Creates a BLE radio command structure that enables BLE advertisement when sent to the radio core.

Parameters
commandA pointer to command that is created
channelThe BLE advertisement channel used for advertisement
paramA pointer to the radio command parameters
outputA pointer to the radio command output

Definition at line 195 of file rf-ble-cmd.c.

◆ rf_ble_cmd_create_adv_params()

void rf_ble_cmd_create_adv_params ( uint8_t *  param,
dataQueue_t *  rx_queue,
uint8_t  adv_data_len,
uint8_t *  adv_data,
uint8_t  scan_resp_data_len,
uint8_t *  scan_resp_data,
ble_addr_type_t  own_addr_type,
uint8_t *  own_addr 
)

Creates BLE radio command parameters that are used to enable BLE advertisement on the radio core.

Parameters
paramA pointer to parameter structure that is created
rx_queueA pointer to the RX queue that is used
adv_data_lenThe length of the advertisement data
adv_dataA pointer to the advertisement data that is advertised
scan_resp_data_lenThe length of the scan response data
scan_resp_dataA pointer to the scan response data
own_addr_typeEither BLE_ADDR_TYPE_PUBLIC or BLE_ADDR_TYPE_RANDOM
own_addrA pointer to the device address that is used as own address

Definition at line 222 of file rf-ble-cmd.c.

◆ rf_ble_cmd_create_initiator_cmd()

void rf_ble_cmd_create_initiator_cmd ( uint8_t *  cmd,
uint8_t  channel,
uint8_t *  params,
uint8_t *  output,
uint32_t  start_time 
)

Creates a BLE radio command structure that sets up BLE initiation event when sent to the radio core.

Parameters
cmdA pointer to command that is created
channelThe BLE data channel used for the connection event
paramsA pointer to the radio command parameters
outputA pointer to the radio command output
start_timeThe time in rf_core_ticks when the connection event will start

Definition at line 254 of file rf-ble-cmd.c.

◆ rf_ble_cmd_create_initiator_params()

void rf_ble_cmd_create_initiator_params ( uint8_t *  param,
dataQueue_t *  rx_queue,
uint32_t  initiator_window,
ble_addr_type_t  own_addr_type,
uint8_t *  own_addr,
ble_addr_type_t  peer_addr_type,
uint8_t *  peer_addr,
uint32_t  connect_time,
uint8_t *  conn_req_data 
)

Creates BLE radio command parameters that are used to set up BLE initiation event on the radio core.

Parameters
paramA pointer to parameter structure that is created
rx_queueA pointer to the RX queue that is used
initiator_windowT
own_addr_typeEither BLE_ADDR_TYPE_PUBLIC or BLE_ADDR_TYPE_RANDOM
own_addrA pointer to the device address that is used as own address
peer_addr_typeEither BLE_ADDR_TYPE_PUBLIC or BLE_ADDR_TYPE_RANDOM
peer_addrA pointer to the device address that is used as peer address
connect_timeThe first possible start time of the first connection event
conn_req_dataA pointer to the connect request data

Definition at line 290 of file rf-ble-cmd.c.

◆ rf_ble_cmd_create_master_cmd()

void rf_ble_cmd_create_master_cmd ( uint8_t *  cmd,
uint8_t  channel,
uint8_t *  params,
uint8_t *  output,
uint32_t  start_time 
)

Creates a BLE radio command structure that sets up BLE connection event when sent to the radio core.

Parameters
cmdA pointer to command that is created
channelThe BLE data channel used for the connection event
paramsA pointer to the radio command parameters
outputA pointer to the radio command output
start_timeThe time in rf_core_ticks when the connection event will start

Definition at line 429 of file rf-ble-cmd.c.

◆ rf_ble_cmd_create_master_params()

void rf_ble_cmd_create_master_params ( uint8_t *  params,
dataQueue_t *  rx_queue,
dataQueue_t *  tx_queue,
uint32_t  access_address,
uint8_t  crc_init_0,
uint8_t  crc_init_1,
uint8_t  crc_init_2,
uint8_t  first_packet 
)

Creates BLE radio command parameters that are used to set up BLE connection event on the radio core.

Parameters
paramsA pointer to parameter structure that is created
rx_queueA pointer to the RX queue that is used
tx_queueA pointer to the TX queue that is used
access_addressThe access address of the used BLE connection
crc_init_0Part of the initialization of the CRC checksum
crc_init_1Part of the initialization of the CRC checksum
crc_init_2Part of the initialization of the CRC checksum
first_packet1 for the first packet of the BLE connection so that the connection is properly initialized

Definition at line 467 of file rf-ble-cmd.c.

◆ rf_ble_cmd_create_slave_cmd()

void rf_ble_cmd_create_slave_cmd ( uint8_t *  cmd,
uint8_t  channel,
uint8_t *  param,
uint8_t *  output,
uint32_t  start_time 
)

Creates a BLE radio command structure that sets up a single BLE connection event when sent to the radio core.

Parameters
cmdA pointer to command that is created
channelThe BLE data channel used for the connection event
paramA pointer to the radio command parameters
outputA pointer to the radio command output
start_timeThe time in rf_core_ticks when the connection event will start

Definition at line 336 of file rf-ble-cmd.c.

◆ rf_ble_cmd_create_slave_params()

void rf_ble_cmd_create_slave_params ( uint8_t *  param,
dataQueue_t *  rx_queue,
dataQueue_t *  tx_queue,
uint32_t  access_address,
uint8_t  crc_init_0,
uint8_t  crc_init_1,
uint8_t  crc_init_2,
uint32_t  win_size,
uint32_t  window_widening,
uint8_t  first_packet 
)

Creates BLE radio command parameters that are used to setup a single BLE connection event on the radio core.

Parameters
paramA pointer to parameter structure that is created
rx_queueA pointer to the RX queue that is used
tx_queueA pointer to the TX queue that is used
access_addressThe access address of the used BLE connection
crc_init_0Part of the initialization of the CRC checksum
crc_init_1Part of the initialization of the CRC checksum
crc_init_2Part of the initialization of the CRC checksum
win_sizeThe window size parameter of the BLE connection event
window_wideningThe window widening parameter used for this connection event
first_packet1 for the first packet of the BLE connection so that the connection is properly initialized

Definition at line 375 of file rf-ble-cmd.c.

◆ rf_ble_cmd_send()

unsigned short rf_ble_cmd_send ( uint8_t *  cmd)

Sends a BLE radio command to the radio.

Parameters
cmdA pointer to the command to be send
Returns
RF_CORE_CMD_OK or RF_CORE_CMD_ERROR

Definition at line 131 of file rf-ble-cmd.c.

◆ rf_ble_cmd_setup_ble_mode()

unsigned short rf_ble_cmd_setup_ble_mode ( void  )

Initializes the radio core to be used as a BLE radio.

Returns
RF_CORE_CMD_OK or RF_CORE_CMD_ERROR

Definition at line 157 of file rf-ble-cmd.c.

◆ rf_ble_cmd_wait()

unsigned short rf_ble_cmd_wait ( uint8_t *  cmd)

Waits for a running BLE radio command to be finished.

Parameters
cmdA pointer to the running command
Returns
RF_CORE_CMD_OK or RF_CORE_CMD_ERROR

Definition at line 145 of file rf-ble-cmd.c.