思澈科技软件开发工具包  2.20
BLE common interface

BLE Common interface. More...

Data Structures

struct  ble_register_callback_t
 .Structure of store register information. More...
 
struct  bt_register_callback_t
 
struct  bd_addr_t
 BD Address structure. More...
 
struct  ble_power_on_t
 
struct  ble_dut_mode_t
 
struct  ble_dut_end_ind_t
 Indicate end of test mode event. More...
 
struct  ble_status_t
 
struct  bt_ns_test_mode_tx_para_t
 Structure of parameter for tx command in non-signaling test mode. More...
 
struct  bt_ns_test_mode_rx_para_t
 Structure of parameter for rx command in non-signaling test mode. More...
 
struct  bt_ns_test_mode_stop_test_para_t
 Structure of parameter for stop response in non-signaling test mode. More...
 
union  bt_ns_test_mode_cmd_para_t
 
union  bt_ns_test_mode_rsp_para_t
 
struct  bt_ns_test_mode_ctrl_cmd_t
 
struct  bt_ns_test_mode_ctrl_rsp_t
 

Macros

#define BD_ADDR_LEN   6
 Macro that define BD Address length(values in bytes). | 3B | 1B | 2B | | LAP | UAP | NAP |.
 
#define SPACE1(x)   __attribute__((section(x)))
 Macro that declare variable in a specified section.
 
#define SIFLI_BLE_REGISTER(func, context, n)
 Macro of sifli event register. More...
 
#define SIFLI_BT_REGISTER(func, context, n)
 
#define BLE_EVENT_REGISTER(func, context)   SIFLI_BLE_REGISTER(func, context, "2")
 Macro of siflie ble event handler register. More...
 
#define BLE_EVENT_REGISTER_HIGH(func, context)   SIFLI_BLE_REGISTER(func, context, "1")
 
#define BLE_EVENT_REGISTER_LOW(func, context)   SIFLI_BLE_REGISTER(func, context, "3")
 
#define BT_EVENT_REGISTER(func, context)   SIFLI_BT_REGISTER(func, context, "2")
 
#define BT_EVENT_REGISTER_HIGH(func, context)   SIFLI_BT_REGISTER(func, context, "1")
 
#define BT_EVENT_REGISTER_LOW(func, context)   SIFLI_BT_REGISTER(func, context, "3")
 
#define BT_RESET_MASK_BLE   (1 << 0)
 
#define BT_RESET_MASK_BT   (1 << 1)
 

Typedefs

typedef int(* register_func_t) (uint16_t event_id, uint8_t *data, uint16_t len, uint32_t context)
 Register function proto type of BLE_EVENT_REGISTER.
 
typedef int(* register_bt_func_t) (uint16_t type, uint16_t event_id, uint8_t *data, uint32_t context)
 
typedef ble_status_t ble_test_rx_start_cnf_t
 
typedef ble_status_t ble_test_tx_start_cnf_t
 

Enumerations

enum  ble_common_event_type_t {
  BLE_COMMON_TYPE = 0x0,
  BLE_HCI_TYPE = 0x10,
  BLE_GAP_TYPE = 0x20,
  BLE_SIBLE_TYPE = 0x60,
  BLE_NVDS_TYPE = 0x80,
  BLE_ANCS_TYPE = 0x90,
  BLE_TIP_TYPE = 0xA0,
  BLE_CONNECTION_MANAGER_TYPE = 0xB0,
  BLE_AMS_TYPE = 0xD0
}
 
enum  ble_common_event_t {
  BLE_POWER_ON_IND = BLE_COMMON_TYPE,
  BLE_POWER_ON_CNF,
  BLE_POWER_OFF_CNF,
  BLE_DUT_TX_START_CNF,
  BLE_DUT_RX_START_CNF,
  BLE_DUT_END_IND,
  BLE_TX_CONFIG_CNF,
  BT_NS_DUT_RSP
}
 Common ble event that notify user. More...
 
enum  ble_power_off_type {
  BLE_OFF,
  BLE_SYSTEM_OFF
}
 BLE power off type. More...
 
enum  bt_ns_test_operation_t {
  BT_TEST_OP_ENTER_TEST,
  BT_TEST_OP_EXIT_TEST,
  BT_TEST_OP_TX_TEST,
  BT_TEST_OP_RX_TEST,
  BT_TEST_OP_STOP_TEST
}
 BT test operation for non-signaling mode. More...
 
enum  ble_common_update_type_t {
  BLE_UPDATE_NO_UPDATE,
  BLE_UPDATE_ONCE,
  BLE_UPDATE_ALWAYS
}
 BLE update type. More...
 

Functions

uint8_t ble_power_on (void)
 Power on BLE module. More...
 
uint8_t ble_power_off (uint8_t pwroff_type)
 Power off BLE module. More...
 
uint8_t ble_enter_dut_mode (ble_dut_mode_t *dut_ctrl)
 Enter device firmware update mode. More...
 
void ble_event_publish (uint16_t event_id, void *data, uint16_t len)
 Publish events to user that registered via BLE_EVENT_REGISTER. More...
 
void bt_event_publish (uint16_t type, uint16_t event_id, void *data)
 Publish events to user that registered via #BT_EVENT_REGISTER. More...
 
uint8_t ble_get_public_address (bd_addr_t *addr)
 Get public address. More...
 
ble_common_update_type_t ble_request_public_address (bd_addr_t *addr)
 User implmentation function. Stack will call this function to update public address. More...
 
int bt_mac_addr_generate_via_uid (bd_addr_t *addr)
 Get BT mac address from chip UID. More...
 
uint8_t bt_enter_no_signal_dut_mode (bt_ns_test_mode_ctrl_cmd_t *dut_ctrl)
 
uint8_t bt_system_reset (void)
 
void bt_system_mask_clear (uint8_t mask)
 
void bt_stack_nvds_update (void)
 

Detailed Description

BLE Common interface.

Macro Definition Documentation

◆ BLE_EVENT_REGISTER

#define BLE_EVENT_REGISTER (   func,
  context 
)    SIFLI_BLE_REGISTER(func, context, "2")

Macro of siflie ble event handler register.

Parameters
[in]funcregister function.
[in]contextuser data.

◆ SIFLI_BLE_REGISTER

#define SIFLI_BLE_REGISTER (   func,
  context,
 
)
Value:
RT_USED const ble_register_callback_t __ble_callback_##func SPACE1(".sifli_reg."n) = \
{ \
.function = func, \
.context_p = (uint32_t)context, \
}

Macro of sifli event register.

Parameters
[in]funcregister function.
[in]contextuser data.
[in]npriority.

◆ SIFLI_BT_REGISTER

#define SIFLI_BT_REGISTER (   func,
  context,
 
)
Value:
RT_USED const bt_register_callback_t __bt_callback_##func SPACE1(".bt_sifli_reg."n) = \
{ \
.function = func, \
.context_p = (uint32_t)context, \
}

Typedef Documentation

◆ ble_test_rx_start_cnf_t

◆ ble_test_tx_start_cnf_t

Enumeration Type Documentation

◆ ble_common_event_t

Common ble event that notify user.

Enumerator
BLE_POWER_ON_IND 

BLE power on indication.

BLE_POWER_ON_CNF 

BLE power on confirm.

BLE_POWER_OFF_CNF 

BLE power off confirm.

BLE_DUT_TX_START_CNF 

DUT TX start confirm.

BLE_DUT_RX_START_CNF 

DUT RX start confirm.

BLE_DUT_END_IND 

DUT end indication.

BLE_TX_CONFIG_CNF 

DUT TX configure confirm.

BT_NS_DUT_RSP 

Non-signaling DUT reponse

◆ ble_common_update_type_t

BLE update type.

Enumerator
BLE_UPDATE_NO_UPDATE 

No need to update.

BLE_UPDATE_ONCE 

Only update if item doesn't exist.

BLE_UPDATE_ALWAYS 

Always update the item.

◆ ble_power_off_type

BLE power off type.

Enumerator
BLE_OFF 

BLE stack power off.

BLE_SYSTEM_OFF 

BLE core power off.

◆ bt_ns_test_operation_t

BT test operation for non-signaling mode.

Enumerator
BT_TEST_OP_ENTER_TEST 

Enter test mode.

BT_TEST_OP_EXIT_TEST 

Exit test mode.

BT_TEST_OP_TX_TEST 

TX test command.

BT_TEST_OP_RX_TEST 

RX test command.

BT_TEST_OP_STOP_TEST 

Stop TX/RX test command.

Function Documentation

◆ ble_enter_dut_mode()

uint8_t ble_enter_dut_mode ( ble_dut_mode_t dut_ctrl)

Enter device firmware update mode.

Parameters
[in]dut_ctrlDevice firmware update configuration.
Return values
0if success, otherwise failed.

◆ ble_event_publish()

void ble_event_publish ( uint16_t  event_id,
void *  data,
uint16_t  len 
)

Publish events to user that registered via BLE_EVENT_REGISTER.

Parameters
[in]event_idid to notify user.
[in]dataData asscoaited with event id.
[in]lenData len

◆ ble_get_public_address()

uint8_t ble_get_public_address ( bd_addr_t addr)

Get public address.

Parameters
[out]addrPublic address.
Return values
0if public address could get.

◆ ble_power_off()

uint8_t ble_power_off ( uint8_t  pwroff_type)

Power off BLE module.

Parameters
[in]pwroff_typePower off type, 0:turn off BLE MAC/BB only, 1: Turn off whole CPU.
Return values
0if success, otherwise failed.

◆ ble_power_on()

uint8_t ble_power_on ( void  )

Power on BLE module.

Return values
0if success, otherwise failed.

◆ ble_request_public_address()

ble_common_update_type_t ble_request_public_address ( bd_addr_t addr)

User implmentation function. Stack will call this function to update public address.

Parameters
[out]addrPublic address
Return values
BLE_UPDATE_NO_UPDATENo need to update. BLE_UPDATE_ONCE Only update if public address not existed. BLE_UPDATE_ALWAYS Always use this public address.

◆ bt_event_publish()

void bt_event_publish ( uint16_t  type,
uint16_t  event_id,
void *  data 
)

Publish events to user that registered via #BT_EVENT_REGISTER.

Parameters
[in]event_idid to notify user.
[in]dataData asscoaited with event id.
[in]lenData len

◆ bt_mac_addr_generate_via_uid()

int bt_mac_addr_generate_via_uid ( bd_addr_t addr)

Get BT mac address from chip UID.

Parameters
[out]generatemac address
Return values
0Get mac address successful. -1 Parameter is null pointer. -2 read UID failed. -3 UID is 0.
ble_register_callback_t
.Structure of store register information.
Definition: bf0_ble_common.h:109
SPACE1
#define SPACE1(x)
Macro that declare variable in a specified section.
Definition: bf0_ble_common.h:88
bt_register_callback_t
Definition: bf0_ble_common.h:116