strong_symbol.c 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. /**********************************************************************
  2. *
  3. * strong_symbol.c
  4. * 定义库里面部分WEAK函数的Strong函数,动态关闭库代码
  5. ***********************************************************************/
  6. #include "include.h"
  7. #include "driver_uart.h"
  8. uint8_t cfg_spiflash_speed_up_en = SPIFLASH_SPEED_UP_EN;
  9. #if SYS_SLEEP_LEVEL == SLEEP_LEVEL_LV1
  10. uint8_t cfg_bt_sniff_clk_sel = CLK_31K25;
  11. #else
  12. uint8_t cfg_bt_sniff_clk_sel = CLK_RCDIV;
  13. #endif
  14. #if FUNC_USBD_EN
  15. u8 mem_heap[8*1024] AT(.mem_heap);
  16. static const struct thread_cfg_cb thread_cfg =
  17. {
  18. .bt_hw = {1, 11, 1024},
  19. .bt_stack = {1, 23, 1536},
  20. .aupcm = {1, 17, 1024},
  21. .dirver = {1, 6, 1024},
  22. .timer = {1, 16, 768},
  23. .main = {1, 25, 1024},
  24. };
  25. uint32_t mem_heap_size_get(void)
  26. {
  27. return sizeof(mem_heap);
  28. }
  29. struct thread_cfg_cb* thread_cfg_get(void)
  30. {
  31. return (struct thread_cfg_cb*)&thread_cfg;
  32. }
  33. #endif
  34. uint8_t cfg_bt_rf_def_txpwr;
  35. void ble_get_local_bd_addr(u8 *addr)
  36. {
  37. memcpy(addr, xcfg_cb.le_addr, 6);
  38. }
  39. const uint8_t *bt_rf_get_param(void)
  40. {
  41. cfg_bt_rf_def_txpwr = xcfg_cb.bt_rf_pwrdec;
  42. if(xcfg_cb.bt_rf_param_en) {
  43. cfg_bt_rf_def_txpwr = 0;
  44. return (const uint8_t *)&xcfg_cb.rf_pa_gain;
  45. } else {
  46. if (bt_get_ft_trim_value(&xcfg_cb.rf_pa_gain)) {
  47. return (const uint8_t *)&xcfg_cb.rf_pa_gain;
  48. }
  49. }
  50. return NULL;
  51. }
  52. u8 bt_rf_get_tx_pwr(void)
  53. {
  54. return xcfg_cb.rf_tx_pwr;
  55. }
  56. void xosc_get_xcfg(u8 *osci_cap, u8 *osco_cap, u8 *both_cap)
  57. {
  58. *osci_cap = xcfg_cb.osci_cap;
  59. *osco_cap = xcfg_cb.osco_cap;
  60. *both_cap = xcfg_cb.osc_both_cap;
  61. }
  62. void param_xosc_read(u8 *param)
  63. {
  64. bsp_param_read(param, PARAM_BT_XOSC_CAP, PARAM_BT_XOSC_CAP_LEN);
  65. }
  66. void param_xosc_write(u8 *param)
  67. {
  68. bsp_param_write(param, PARAM_BT_XOSC_CAP, PARAM_BT_XOSC_CAP_LEN);
  69. bsp_param_sync();
  70. }
  71. AT(.com_text.spiflash)
  72. bool spiflash_data_protect_en(void)
  73. {
  74. return false;
  75. }
  76. AT(.com_text.spiflash)
  77. bool os_spiflash_addr_check(u32 addr, uint len)
  78. {
  79. if ((addr >= CM_START) && ((addr + len) <= (CM_START + CM_SIZE))) {
  80. return true;
  81. }
  82. #if AB_FOT_EN
  83. #if (AB_FOT_TYPE == AB_FOT_TYPE_PACK)
  84. if ((addr >= FOT_PACK_START) && ((addr + len) <= (FOT_PACK_START + FOT_PACK_SIZE))) {
  85. return true;
  86. }
  87. #endif
  88. #if (AB_FOT_TYPE == AB_FOT_TYPE_NORMAL)
  89. return true;
  90. #endif
  91. #endif
  92. printf("-->os_spiflash_addr_err:0x%x\n", addr);
  93. return false;
  94. }
  95. #if (!LE_DUT_UART_EN)
  96. void hci_fcc_init(void){}
  97. #endif
  98. AT(.com_text.timer)
  99. void usr_tmr5ms_thread_callback(void)
  100. {
  101. usr_tmr5ms_thread_do();
  102. }
  103. void sys_clk_change_callback(void)
  104. {
  105. #if BSP_UART_DEBUG_EN
  106. uart_baud_config(UART, UART_DEBUG_BAUD);
  107. #endif // BSP_UART_DEBUG_EN
  108. }
  109. #if BSP_UART_DEBUG_EN
  110. void uart_debug_init_callback(void)
  111. {
  112. bsp_uart_debug_init();
  113. }
  114. #else
  115. AT(.com_text.printf)
  116. void uart_debug_putchar(char ch)
  117. {
  118. }
  119. void uart_debug_init_callback(void)
  120. {
  121. my_printf_init(uart_debug_putchar);
  122. }
  123. #endif // BSP_UART_DEBUG_EN
  124. #if !AB_FOT_EN
  125. u8 fot_checksum_cal(u8 *buf)
  126. {
  127. return 0;
  128. }
  129. #endif
  130. #if (SYS_SLEEP_LEVEL == SLEEP_LEVEL_LV1)
  131. void rc_sleep_trim_init(void) {}
  132. void rc_sleep_trim_clear(void) {}
  133. u32 rc_sleep_get_freqcnt(void) {return 1;}
  134. void rc_sleep_reset_sta(void) {}
  135. u32 rc_sleep_get_trim_freqcnt(u32 *freqcnt) {return 0;}
  136. void lowpwr_sleep_lv2_proc(void) {}
  137. #else
  138. void lowpwr_sleep_lv1_proc(void) {}
  139. #endif
  140. void ble_get_link_info(void *buf, u16 addr, u16 size)
  141. {
  142. cm_read(buf, BLE_CM_PAGE(addr), size);
  143. }
  144. void ble_put_link_info(void *buf, u16 addr, u16 size)
  145. {
  146. cm_write(buf, BLE_CM_PAGE(addr), size);
  147. cm_sync();
  148. }
  149. bool ble_mtu_exchange_enabled(void)
  150. {
  151. return false;
  152. }
  153. bool ble_rx_exit_sleep(void)
  154. {
  155. return false;
  156. }
  157. uint16_t ble_sm_send_security_req_time_get(void)
  158. {
  159. return 500; //ms
  160. }
  161. bool ble_disconnected_restart_adv(void)
  162. {
  163. return true;
  164. }