strong_le.c 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. /**********************************************************************
  2. *
  3. * strong_le.c
  4. * 定义库里面le部分WEAK函数的Strong函数,动态关闭库代码
  5. ***********************************************************************/
  6. #include "include.h"
  7. void strong_le_include(void) {}
  8. #if !LE_EN && !BT_ATT_EN
  9. void ble_txpkt_init(void) {}
  10. void btstack_gatt_init(void) {}
  11. #endif
  12. #if !BT_ATT_EN
  13. void latt_establish_service_level_connection(uint8_t * bd_addr) {}
  14. void latt_release_service_level_connection(uint8_t * bd_addr) {}
  15. void latt_send_kick(void) {}
  16. int latt_tx_notify(uint16_t att_handle, const uint8_t *value, uint16_t value_len) {return -1;}
  17. void * provide_latt_connection_context_for_bd_addr(void * bd_addr) {return NULL;}
  18. void remove_latt_connection_context(void * latt_con) {}
  19. int latt_send_notify_packet(void *context, struct txbuf_tag *buf) {return -1;}
  20. void latt_event_server_send(uint16_t cid) {}
  21. void btstack_latt_send(void) {}
  22. void btstack_latt_connect(void) {}
  23. void btstack_latt_disconnect(void) {}
  24. void latt_init_do(void) {}
  25. #endif
  26. #if !LE_EN
  27. AT(.com_text.stack.ble.mtu)
  28. u16 ble_get_gatt_mtu(void) { return 0; }
  29. int ble_tx_notify_do(void *att, u8 idx, u16 handle, u8* buf, u8 len) {return 0x0c;}
  30. int ble_tx_notify(u16 handle, u8* buf, u8 len) {return 0x0c;}
  31. int ble_tx_indication(u16 handle, u8* buf, u8 len) {return 0x0c;}
  32. void ble_update_conn_param(u16 interval, u16 latency, u16 timeout) {}
  33. void ble_set_adv_interval(u16 interval) {}
  34. void *get_app_ble_att_connect(void) {return NULL;}
  35. void ble_gatt_init_att(void **cb_info_table_p, uint16_t cb_info_tb_size) {}
  36. bool ble_gatt_init_att_info(uint16_t att_handle, ble_gatt_characteristic_cb_info_t *att_cb_info) {return false;}
  37. void btstack_ble_send_req(void) {}
  38. int ble_send_notify_packet(void *context, void *buf) {return -1;}
  39. void att_event_server_send(void) {}
  40. //void hci_run_le_connection(void) {}
  41. bool ble_event_cmd_complete(uint8_t *packet, int size) { return false; }
  42. void ble_event_meta(uint8_t *packet, int size) {}
  43. void btstack_ble_init(void) {}
  44. void btstack_ble_update_conn_param(void) {}
  45. void btstack_ble_set_adv_interval(void) {}
  46. void btstack_ble_set_adv_data(void) {}
  47. void btstack_ble_set_scan_rsp_data(void) {}
  48. void btstack_ble_disconnect(void) {}
  49. void btstack_ble_send_sm_req(void) {}
  50. typedef uint8_t (*bb_msg_func_t)(uint16_t index, void const *param);
  51. typedef uint8_t (*bb_cmd_func_t)(uint16_t cmd, void const *param);
  52. typedef uint8_t (*ll_cntl_func_t)(uint8_t opcode);
  53. struct ll_cntl_pdu_info
  54. {
  55. ll_cntl_func_t func;
  56. const char* desc;
  57. uint16_t length;
  58. uint8_t flag;
  59. };
  60. struct bb_msg_info
  61. {
  62. uint16_t index;
  63. bb_msg_func_t func;
  64. };
  65. struct bb_cmd_info
  66. {
  67. uint16_t index;
  68. bb_cmd_func_t func;
  69. };
  70. AT(.rodata.le.ll_proc)
  71. const struct bb_cmd_info ll_hci_cmd_tbl[1] = {0};
  72. AT(.rodata.le.ll_proc)
  73. const struct bb_msg_info ll_msg_tbl[1] = {0};
  74. AT(.rodata.le.ll_cntl)
  75. const struct ll_cntl_pdu_info ll_cntl_pdu_tbl[1] = {0};
  76. AT(.rodata.le.ll_proc)
  77. const struct bb_msg_info mgr_hci_cmd_tbl[1] = {0};
  78. void ll_init(uint8_t init_type) {}
  79. uint8_t ll_start(uint8_t index, void *param) {return -1;}
  80. void ll_stop(uint8_t index) {}
  81. void ll_cntl_state_set(uint8_t index, uint8_t txrx, uint8_t state) {}
  82. void ll_proc_timer_set(uint8_t index, uint8_t type, bool enable) {}
  83. void ll_proc_timer_set_state(uint8_t index, uint8_t type, bool enable) {}
  84. void ll_cntl_send(uint8_t index, void *pdu, ll_cntl_func_t tx_func) {}
  85. void ll_cntl_tx_check(uint8_t index) {}
  86. bool ble_adv_end_con_ind(void const *param) { return false; }
  87. AT(.com_text.bb.ble.chs)
  88. void ble_channel_assess(uint8_t channel, bool rx_ok, uint32_t ts) {}
  89. AT(.com_text.bb.ble.end)
  90. void ble_con_rx_end(uint8_t index, bool rx_ok, uint16_t rxchass) {}
  91. AT(.com_text.bb.ble.isr)
  92. void ble_pwr_ctrl_hook(uint8_t index) {}
  93. AT(.com_text.bb.ble.adj)
  94. void ble_sched_prio_time_adj(void *item) {}
  95. void aes_init(uint8_t init_type) {};
  96. void aes_result_handler(uint8_t status, uint8_t* result) {};
  97. void ble_ecpy(uint8_t *key, uint8_t *enc_data) {}
  98. void mgr_clk_acc_set(uint8_t aid, bool clk_acc) {}
  99. void mgr_reset(void) {}
  100. void mgr_1st_reset(void) {}
  101. int ble_adv_end_ind_do(uint16_t const mid, void const *param, uint16_t const did, uint16_t const sid) {return 0;}
  102. int ble_scan_end_ind_do(uint16_t const mid, void const *param, uint16_t const did, uint16_t const sid) {return 0;}
  103. void ble_adv_rand_addr_update(uint8_t index, void *addr) {}
  104. void ble_adv_scan_rsp_data_update(uint8_t index, uint8_t len, uint16_t buffer) {}
  105. void ble_adv_adv_data_update(uint8_t index, uint8_t len, uint16_t buffer) {}
  106. void ble_adv_restart(uint8_t index, uint16_t dura, uint8_t max_ext) {}
  107. void * get_ble_link_ctrl_context_for_bd_addr(uint8_t *bd_addr) {return NULL;}
  108. void * alloc_ble_link_ctrl_context_for_bd_addr(uint8_t *bd_addr, uint16_t provide_flag) {return NULL;}
  109. void * provide_ble_link_ctrl_context_for_bd_addr(uint8_t *bd_addr, uint16_t provide_flag) {return NULL;}
  110. void remove_ble_link_ctrl_context(void * link_ctrl, uint16_t provide_flag) {}
  111. void *get_ble_link_ctrl_for_index(uint8_t index) {return NULL;}
  112. bool ble_link_provide_check(uint8_t index, uint16_t provide_flag) {return false;}
  113. void *get_ble_link_ctrl_for_handle(uint16_t con_handle) {return NULL;}
  114. #endif
  115. #if ((!BT_TWS_EN) || (!LE_EN))
  116. uint16_t tws_get_ble_service(uint8_t *data_ptr){return 0;}
  117. uint16_t tws_ble_get_adv_info(uint8_t *data_ptr){return 0;}
  118. void tws_ble_set_adv_info(uint8_t *data_ptr, uint16_t size){}
  119. void tws_set_ble_service(uint8_t *data_ptr, uint16_t size){}
  120. void tws_send_ble_service_cfm(void) {}
  121. void tws_send_ble_service_continue_cfm(void) {}
  122. uint16_t tws_get_ble_link(uint8_t *data_ptr) { return 0; }
  123. uint16_t tws_set_ble_link(uint8_t *data_ptr, uint16_t size) { return 0; }
  124. bool tws_ble_get_link_info_bb(uint16_t *ble_conhdl, uint8_t *bdaddr) {return false;}
  125. uint8_t tws_get_ble_service_bb(uint8_t *data_ptr) {return 0;}
  126. void tws_send_ble_service_cfm_bb(void) {}
  127. void tws_send_ble_service_continue_cfm_bb(void) {}
  128. void tws_ble_switch_pend(void) {}
  129. uint16_t tws_get_ble_service_continue_len(void) {return 0;}
  130. void tws_ble_restore_tx(void) {}
  131. void tws_ble_con_stop(void) {}
  132. void tws_set_ble_service_continue(uint8_t *data_ptr, uint16_t size) {}
  133. bool tws_ble_switch_save_pend(uint8_t type, uint8_t flag, uint32_t buf_ptr, uint16_t len) { return false; }
  134. uint16_t tws_get_ble_service_continue(uint8_t *data_ptr) { return 0;}
  135. int ll_ble_switch_to_func(uint16_t id, void *param, uint16_t did, uint16_t sid) {return 0;}
  136. uint8_t tws_ble_switch_is_active(void) {return 0;}
  137. void tws_le_init(bool reset) {}
  138. void tws_ble_switch(void) {}
  139. bool hci_acl_data_hook(u16 const did, void *param) {return false;}
  140. bool ble_acl_data_rx_hook(u16 const did, void const *param) {return false;}
  141. void hct_flush_le_acl_rx_pend(uint8_t index) {}
  142. AT(.com_text.bb.ble.sw_nb)
  143. uint8_t ble_get_con_nb(void) {return 0;}
  144. int lc_op_vs_le_switch_func(u16 const mid, void const *param, u16 const dest_id, u16 const sid) {return 0;}
  145. AT(.text.stk.tws.send)
  146. bool tws_ble_l2cap_send_req(void) {return false;}
  147. #endif
  148. #if !LE_PAIR_EN
  149. #if (LE_ADDRESS_TYPE == GAP_RANDOM_ADDRESS_TYPE_OFF)
  150. void le_sm_init(void) {}
  151. void gap_random_address_set(void) {}
  152. void gap_random_address_set_mode(void) {}
  153. void le_device_db_init(void){}
  154. int gap_authorization_state(uint16_t con_handle){return 3;}
  155. void sm_get_rand_addr(uint8_t * addr) {}
  156. #endif
  157. void sm_just_works_confirm(void) {}
  158. void sm_request_pairing(void) {}
  159. void sm_send_security_request(void) {}
  160. int sm_authorization_state(void) { return 0; }
  161. int sm_authenticated(void) { return 0; }
  162. int sm_encryption_key_size(void) { return 0; }
  163. void sm_add_event_handler(void) {}
  164. void sm_cmac_signed_write_start(void){ }
  165. int sm_cmac_ready(void) { return 0; }
  166. uint16_t sm_set_setup_context(uint8_t *ptr){ return 0;}
  167. uint16_t sm_get_setup_context(uint8_t *ptr){ return 0;}
  168. uint16_t tws_get_sm_db_info(uint8_t *ptr){ return 0;}
  169. uint16_t tws_set_sm_db_info(uint8_t *ptr, uint16_t len){ return 0;}
  170. #endif
  171. #if !LE_ADV0_EN
  172. void ble_adv0_init(uint8_t init_type) {}
  173. uint8_t adv0_data[1];
  174. void btstack_adv0_ctrl(uint opcode) {}
  175. bool ble_adv0_end_ind(uint8_t id) { return false;}
  176. void ble_adv0_set_en(bool adv_en) {}
  177. void ble_adv0_update_adv_data(const uint8_t *adv_ptr, u32 size) {}
  178. #endif
  179. #if !LE_PRIV_EN
  180. void btstack_priv_con_ctrl(uint parms) {}
  181. int ble_priv_tx_notify(u16 att_handle, u8* buf, u8 len) {return 0;}
  182. void ble_priv_adv_en(u16 opcode) {}
  183. bool ble_priv_is_connect(void) {return false;}
  184. void ble_priv_con_discon(void) {}
  185. uint8_t priv_adv_data[1];
  186. void ble_priv_adv_init(uint8_t init_type) {};
  187. void ble_priv_adv_set_en(bool adv_en) {}
  188. bool ble_is_priv_adv_id(u8 id)
  189. {
  190. return false;
  191. }
  192. bool ble_priv_adv_get_acc_addr(u8 act_id, u32 *acc_addr)
  193. {
  194. return false;
  195. }
  196. void ble_priv_adv_update_adv_data(const uint8_t *adv_ptr, u32 size) {}
  197. void ble_priv_adv_set_interval(u16 interval) {}
  198. #endif