Functions

Functions

void ble_stack_init (ble_evt_handler_t evt_handler, stack_heaps_table_t *p_heaps_table)
 Initialize BLE Stack. More...
 
void ble_stack_controller_init (stack_heaps_table_t *p_heaps_table)
 Initialize BLE Stack controller. More...
 
void ble_common_env_init_for_controller (void)
 Initialize common patch function in BLE Stack controller. More...
 
sdk_err_t ble_hci_init (ble_hci_rx_channel_t *p_rx_channel, ble_hci_host_recv_cb_t host_recv_cb)
 Initialize ble hci adapter module. More...
 
sdk_err_t ble_hci_host_packet_send (uint8_t *p_data, uint16_t length)
 BLE HCI adapter host send packet. More...
 
uint16_t ble_hci_rx_channel_surplus_space_get (void)
 Get surplus space of controller receive channel. More...
 
void ble_idle_time_notify_cb_register (void(*callback)(uint32_t hs))
 Register BLE idle time notification callback function. More...
 
void ble_activity_start_notify_cb_register (void(*callback)(ble_gap_actv_role_t e_role, uint8_t index))
 Register BLE activity start notification callback function. More...
 
void ble_activity_end_notify_cb_register (void(*callback)(ble_gap_actv_role_t e_role, uint8_t index))
 Register BLE activity end notification callback function. More...
 
void ble_rf_tx_mode_set (ble_rf_tx_mode_t rf_tx_mode)
 Change the RF TX mode of LP or HP. More...
 
ble_rf_tx_mode_t ble_rf_tx_mode_get (void)
 Get the RF TX mode of LP or ULP. More...
 
sdk_err_t adv_rf_phy_freq_modify (uint16_t ch37_mhz, uint16_t ch38_mhz, uint16_t ch39_mhz)
 custom the advertising frequency More...
 
uint8_t ble_ext_llcp_send (uint16_t conn_idx, uint8_t *param, uint8_t ext_opcode)
 Start a extended llcp procedure. More...
 
uint8_t ble_ext_llcp_cb_reg (struct ble_ext_llcp_cb_func_t *func)
 Registered the extended llcp procedure callback. More...
 
void ble_aes_encrypt (const uint8_t *key, const uint8_t *val, aes_result_cb res_cb, uint32_t src_info)
 Perform an AES encryption - result within callback. More...
 
void ble_aes_decrypt (const uint8_t *key, const uint8_t *val, aes_result_cb res_cb, uint32_t src_info)
 Perform an AES dencryption - result within callback. More...
 
void ble_aes_ecb_encrypt (const uint8_t *key, const uint8_t *val, aes_result_cb res_cb, uint32_t src_info)
 Perform an AES ecb encryption - result within callback. More...
 
void ble_aes_ecb_decrypt (const uint8_t *key, const uint8_t *val, aes_result_cb res_cb, uint32_t src_info)
 Perform an AES ecb dencryption - result within callback. More...
 
void ble_aes_cbc_encrypt (const uint8_t *key, const uint8_t *iv, const uint8_t *val, aes_result_cb res_cb, uint32_t src_info)
 Perform an AES cbc encryption - result within callback. More...
 
void ble_aes_cbc_decrypt (const uint8_t *key, const uint8_t *iv, const uint8_t *val, aes_result_cb res_cb, uint32_t src_info)
 Perform an AES cbc dencryption - result within callback. More...
 
void ble_dtm_tx_test_start (uint8_t tx_channel, uint8_t data_len, uint8_t pkt_type, uint8_t tx_phy, uint8_t test_type, int8_t tx_power)
 Start dtm tx test. More...
 
void ble_dtm_rx_test_start (uint8_t rx_channel, uint8_t rx_phy)
 Start dtm rx test. More...
 
void ble_dtm_tx_test_end (uint8_t test_type)
 End dtm tx test. More...
 
void ble_dtm_rx_test_end (void)
 End dtm rx test. More...
 
uint8_t dbg_ble_stack_llcp_info_buf_register (uint8_t conidx, dbg_ble_llcp_info_entry_t *p_entry_buf, uint8_t entry_num)
 register llcp debug info buffer More...
 

Detailed Description

Function Documentation

◆ adv_rf_phy_freq_modify()

sdk_err_t adv_rf_phy_freq_modify ( uint16_t  ch37_mhz,
uint16_t  ch38_mhz,
uint16_t  ch39_mhz 
)

custom the advertising frequency

Parameters
[in]ch37_mhzchannel 37 frequency[2360, 2520]MHz
[in]ch38_mhzchannel 38 frequency[2360, 2520]MHz
[in]ch39_mhzchannel 39 frequency[2360, 2520]MHz Others: invalid.
Returns
SDK_SUCCESS: success. Others: fail

◆ ble_activity_end_notify_cb_register()

void ble_activity_end_notify_cb_register ( void(*)(ble_gap_actv_role_t e_role, uint8_t index)  callback)

Register BLE activity end notification callback function.

Parameters
[in]callbackfunction pointer of BLE activity end notification function.
Note
e_role: the role of activity, refer to ble_gap_actv_role_t for possible roles. index: The index parameter is interpreted by role. If role is BLE_GAP_ACTIVITY_ROLE_ADV, it's the index of Advertising. If role is BLE_GAP_ACTIVITY_ROLE_CON, it's the index of Connection. For all other roles, it should be ignored. Callback will be called by BLE ISR when the BLE activity ends every time. It should be realized as simlpe as you can. You'd better to define it in the RAM space It's not suitable for ISO activities.

◆ ble_activity_start_notify_cb_register()

void ble_activity_start_notify_cb_register ( void(*)(ble_gap_actv_role_t e_role, uint8_t index)  callback)

Register BLE activity start notification callback function.

Parameters
[in]callbackfunction pointer of BLE activity start notification function.
Note
e_role: the role of activity, ble_gap_actv_role_t for possible roles. index: The index parameter is interpreted by role. If role is BLE_GAP_ACTIVITY_ROLE_ADV, it's the index of Advertising. If role is BLE_GAP_ACTIVITY_ROLE_CON, it's the index of Connection. For all other roles, it should be ignored. Callback will be called by BLE ISR when the BLE activity starts every time. It should be realized as simlpe as you can. You'd better to define it in the RAM space It's not suitable for ISO activities.

◆ ble_aes_cbc_decrypt()

void ble_aes_cbc_decrypt ( const uint8_t *  key,
const uint8_t *  iv,
const uint8_t *  val,
aes_result_cb  res_cb,
uint32_t  src_info 
)

Perform an AES cbc dencryption - result within callback.

Parameters
[in]keyKey used for the decryption
[in]ivIV used for the cbc decryption.only first block need to be present, continue block shall be null.
[in]valValue to decrypt using AES
[in]res_cbFunction that will handle the AES based result (16 bytes)
[in]src_infoInformation used retrieve requester
Returns
void.

◆ ble_aes_cbc_encrypt()

void ble_aes_cbc_encrypt ( const uint8_t *  key,
const uint8_t *  iv,
const uint8_t *  val,
aes_result_cb  res_cb,
uint32_t  src_info 
)

Perform an AES cbc encryption - result within callback.

Parameters
[in]keyKey used for the encryption
[in]ivIV used for the cbc encryption.only first block need to be present, continue block shall be null.
[in]valValue to encrypt using AES
[in]res_cbFunction that will handle the AES based result (16 bytes)
[in]src_infoInformation used retrieve requester
Returns
void.

◆ ble_aes_decrypt()

void ble_aes_decrypt ( const uint8_t *  key,
const uint8_t *  val,
aes_result_cb  res_cb,
uint32_t  src_info 
)

Perform an AES dencryption - result within callback.

Parameters
[in]keyKey used for the dencryption
[in]valValue to decrypt using AES
[in]res_cbFunction that will handle the AES based result (16 bytes)
[in]src_infoInformation used retrieve requester
Returns
void.

◆ ble_aes_ecb_decrypt()

void ble_aes_ecb_decrypt ( const uint8_t *  key,
const uint8_t *  val,
aes_result_cb  res_cb,
uint32_t  src_info 
)

Perform an AES ecb dencryption - result within callback.

Parameters
[in]keyKey used for the dencryption
[in]valValue to decrypt using AES
[in]res_cbFunction that will handle the AES based result (16 bytes)
[in]src_infoInformation used retrieve requester
Returns
void.

◆ ble_aes_ecb_encrypt()

void ble_aes_ecb_encrypt ( const uint8_t *  key,
const uint8_t *  val,
aes_result_cb  res_cb,
uint32_t  src_info 
)

Perform an AES ecb encryption - result within callback.

Parameters
[in]keyKey used for the encryption
[in]valValue to encrypt using AES
[in]res_cbFunction that will handle the AES based result (16 bytes)
[in]src_infoInformation used retrieve requester
Returns
void.

◆ ble_aes_encrypt()

void ble_aes_encrypt ( const uint8_t *  key,
const uint8_t *  val,
aes_result_cb  res_cb,
uint32_t  src_info 
)

Perform an AES encryption - result within callback.

Parameters
[in]keyKey used for the encryption
[in]valValue to encrypt using AES
[in]res_cbFunction that will handle the AES based result (16 bytes)
[in]src_infoInformation used retrieve requester
Returns
void.

◆ ble_common_env_init_for_controller()

void ble_common_env_init_for_controller ( void  )

Initialize common patch function in BLE Stack controller.

Note
: This function should be called if only as a controller.

◆ ble_dtm_rx_test_end()

void ble_dtm_rx_test_end ( void  )

End dtm rx test.

Returns
void.

◆ ble_dtm_rx_test_start()

void ble_dtm_rx_test_start ( uint8_t  rx_channel,
uint8_t  rx_phy 
)

Start dtm rx test.

Note
RX test need to enable macro DTM_TEST_V2_CMD_ENABLE
Parameters
[in]rx_channelRX channel, range: 0x00 to 0x27.
[in]rx_phyRX phy, ble_gap_phy_type_t.
Returns
void.

◆ ble_dtm_tx_test_end()

void ble_dtm_tx_test_end ( uint8_t  test_type)

End dtm tx test.

Parameters
[in]test_typeTest type, ble_rf_test_type_t.
Returns
void.

◆ ble_dtm_tx_test_start()

void ble_dtm_tx_test_start ( uint8_t  tx_channel,
uint8_t  data_len,
uint8_t  pkt_type,
uint8_t  tx_phy,
uint8_t  test_type,
int8_t  tx_power 
)

Start dtm tx test.

Note
TX modem test need to enable macro DTM_TEST_V4_CMD_ENABLE TX single carrier test need to enable macro DTM_TEST_PRIVATE_CMD_ENABLE
Parameters
[in]tx_channelTX channel, range: 0x00 to 0x27.
[in]data_lenPacket payload length.
[in]pkt_typePacket payload type, range: 0x00 to 0x07. 0x00: Repeated "11111111100000111101" 0x01: Repeated "11110000" 0x02: Repeated "10101010" 0x03: PRBS15 sequence 0x04: Repeated "11111111" 0x05: Repeated "00000000" 0x06: Repeated "00001111" 0x07: Repeated "01010101"
[in]tx_phyTX phy, ble_gap_phy_type_t.
[in]test_typeTest type, ble_rf_test_type_t.
[in]tx_powerTx power, unit(dBm). BLE_RF_TX_MODE_SPA_MODE support value:[-20, -16, -10, -8, -5, 0, 1, 2, 3, 4, 5] BLE_RF_TX_MODE_HPA_MODE support value:[-10, -5, 0, 1, 3, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]
Returns
void.

◆ ble_ext_llcp_cb_reg()

uint8_t ble_ext_llcp_cb_reg ( struct ble_ext_llcp_cb_func_t func)

Registered the extended llcp procedure callback.

Parameters
[in]funcble_ext_llcp_cb_func_t.
Returns
The result of this function.

◆ ble_ext_llcp_send()

uint8_t ble_ext_llcp_send ( uint16_t  conn_idx,
uint8_t *  param,
uint8_t  ext_opcode 
)

Start a extended llcp procedure.

Parameters
[in]conn_idxfunction pointer of BLE activity end notification function.
[in]paramPointer to a param which intializer supply.
[in]ext_opcodeExtended llcp opcode.
Returns
The result of this function.

◆ ble_hci_host_packet_send()

sdk_err_t ble_hci_host_packet_send ( uint8_t *  p_data,
uint16_t  length 
)

BLE HCI adapter host send packet.

Parameters
[in]p_dataPointer to packet data.
[in]lengthLength of packet data.
Returns
Result of send.

◆ ble_hci_init()

sdk_err_t ble_hci_init ( ble_hci_rx_channel_t p_rx_channel,
ble_hci_host_recv_cb_t  host_recv_cb 
)

Initialize ble hci adapter module.

Parameters
[in]p_rx_channelPointer to hci adapter rx channel
[in]host_recv_cbCallback to receive controller packet.
Returns
Result of initializing.

◆ ble_hci_rx_channel_surplus_space_get()

uint16_t ble_hci_rx_channel_surplus_space_get ( void  )

Get surplus space of controller receive channel.

Returns
Result of get.

◆ ble_idle_time_notify_cb_register()

void ble_idle_time_notify_cb_register ( void(*)(uint32_t hs)  callback)

Register BLE idle time notification callback function.

Parameters
[in]callbackfunction pointer of BLE idle time notification function.
Note
hs: the idle time of BLE in half slot (312.5us). Callback will be called by BLE ISR to notify the rest idle time if there are some BLE activities. It should be realized as simlpe as you can. It's not suitable for ISO activities.

◆ ble_rf_tx_mode_get()

ble_rf_tx_mode_t ble_rf_tx_mode_get ( void  )

Get the RF TX mode of LP or ULP.

Returns
Refer to ble_rf_tx_mode_t.

◆ ble_rf_tx_mode_set()

void ble_rf_tx_mode_set ( ble_rf_tx_mode_t  rf_tx_mode)

Change the RF TX mode of LP or HP.

Parameters
[in]rf_tx_modeRefer to ble_rf_tx_mode_t.
Note
This function should be called before BLE stack init.
Returns
SDK_SUCCESS: Successfully set tx mode. SDK_ERR_DISALLOWED: Failed to set tx mode.

◆ ble_stack_controller_init()

void ble_stack_controller_init ( stack_heaps_table_t p_heaps_table)

Initialize BLE Stack controller.

Parameters
[in]p_heaps_tablePointer to the BLE stack heaps table.
Note
: This function should be called if only as a controller.

◆ ble_stack_init()

void ble_stack_init ( ble_evt_handler_t  evt_handler,
stack_heaps_table_t p_heaps_table 
)

Initialize BLE Stack.

Parameters
[in]evt_handlerPointer to the ble event handler.
[in]p_heaps_tablePointer to the BLE stack heaps table.

◆ dbg_ble_stack_llcp_info_buf_register()

uint8_t dbg_ble_stack_llcp_info_buf_register ( uint8_t  conidx,
dbg_ble_llcp_info_entry_t p_entry_buf,
uint8_t  entry_num 
)

register llcp debug info buffer

Parameters
[in]conidxconnection index
[in]p_entry_bufthe buffer used to store the llcp infomation
[in]entry_numentry number in the buffer
Returns
The result of this function.