Skip to content

Commit 92c7d93

Browse files
andy-liu-telinkandriy-bilynskyy
authored andcommitted
hal: telink: b95: Update HAL for B95 SOC
- update B95 drivers - update B95 BLE library Co-authored-by: pulin1103 <zhenghuan.zhang1103@gmail.com> Co-authored-by: Alex Tsitsiura <s07641069@gmail.com> Co-authored-by: Haiwen Xia <haiwen.xia@telink-semi.com> Co-authored-by: Lingzhi Chen <lingzhi.chen@telink-semi.com> Signed-off-by: Andy Liu <jie.liu@telink-semi.com>
1 parent 0f03ecc commit 92c7d93

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

109 files changed

+34527
-27972
lines changed

CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ zephyr_link_libraries(${CMAKE_CURRENT_SOURCE_DIR}/zephyr/blobs/liblt_9518_zephyr
1313
elseif (CONFIG_SOC_RISCV_TELINK_B92)
1414
zephyr_link_libraries(${CMAKE_CURRENT_SOURCE_DIR}/zephyr/blobs/liblt_9528_zephyr.a)
1515
elseif (CONFIG_SOC_RISCV_TELINK_B95)
16-
zephyr_link_libraries(${CMAKE_CURRENT_SOURCE_DIR}/zephyr/blobs/liblt_9528_zephyr.a)
16+
zephyr_link_libraries(${CMAKE_CURRENT_SOURCE_DIR}/zephyr/blobs/liblt_9258_zephyr.a)
1717
else()
1818
message( FATAL_ERROR "Not supported SOC" )
1919
endif()

tlsr9/ble/vendor/controller/b9x_bt.c

+15-10
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ static int b9x_bt_hci_rx_handler(void)
153153
if (p) {
154154
/* Send data to the controller */
155155
blc_hci_handler(&p[0], 0);
156-
#if CONFIG_SOC_RISCV_TELINK_B92||CONFIG_SOC_RISCV_TELINK_B95
156+
#if CONFIG_SOC_RISCV_TELINK_B92 || CONFIG_SOC_RISCV_TELINK_B95
157157
if (p[0] == HCI_TYPE_ACL_DATA) {
158158
k_sem_give(&controller_sem);
159159
}
@@ -181,21 +181,26 @@ static void b9x_bt_controller_thread()
181181
*/
182182
static void b9x_bt_irq_init()
183183
{
184-
#if CONFIG_SOC_RISCV_TELINK_B92||CONFIG_SOC_RISCV_TELINK_B95
184+
#if CONFIG_SOC_RISCV_TELINK_B92 || CONFIG_SOC_RISCV_TELINK_B95
185185
plic_preempt_feature_dis();
186186
flash_plic_preempt_config(0,1);
187187
#endif
188188

189+
#if CONFIG_SOC_RISCV_TELINK_B91 || CONFIG_SOC_RISCV_TELINK_B92
190+
#define IRQ_SYSTIMER IRQ1_SYSTIMER
191+
#define IRQ_ZB_RT IRQ15_ZB_RT
192+
#endif
193+
189194
/* Init STimer IRQ */
190-
IRQ_CONNECT(IRQ1_SYSTIMER + CONFIG_2ND_LVL_ISR_TBL_OFFSET, 2, stimer_irq_handler, 0, 0);
195+
IRQ_CONNECT(IRQ_SYSTIMER + CONFIG_2ND_LVL_ISR_TBL_OFFSET, 2, stimer_irq_handler, 0, 0);
191196
/* Init RF IRQ */
192197
#if CONFIG_DYNAMIC_INTERRUPTS
193-
irq_connect_dynamic(IRQ15_ZB_RT + CONFIG_2ND_LVL_ISR_TBL_OFFSET, 2, rf_irq_handler, 0, 0);
198+
irq_connect_dynamic(IRQ_ZB_RT + CONFIG_2ND_LVL_ISR_TBL_OFFSET, 2, rf_irq_handler, 0, 0);
194199
#else
195-
IRQ_CONNECT(IRQ15_ZB_RT + CONFIG_2ND_LVL_ISR_TBL_OFFSET, 2, rf_irq_handler, 0, 0);
200+
IRQ_CONNECT(IRQ_ZB_RT + CONFIG_2ND_LVL_ISR_TBL_OFFSET, 2, rf_irq_handler, 0, 0);
196201
#endif
197-
riscv_plic_set_priority(IRQ1_SYSTIMER, 2);
198-
riscv_plic_set_priority(IRQ15_ZB_RT, 2);
202+
riscv_plic_set_priority(IRQ_SYSTIMER, 2);
203+
riscv_plic_set_priority(IRQ_ZB_RT, 2);
199204
}
200205

201206
/**
@@ -230,7 +235,7 @@ int b9x_bt_controller_init()
230235
/* Register callback to controller. */
231236
#if CONFIG_SOC_RISCV_TELINK_B91
232237
blc_ll_registerGiveSemCb(os_give_sem_cb);
233-
#elif CONFIG_SOC_RISCV_TELINK_B92||CONFIG_SOC_RISCV_TELINK_B95
238+
#elif CONFIG_SOC_RISCV_TELINK_B92 || CONFIG_SOC_RISCV_TELINK_B95
234239
blc_ll_registerGiveSemCb(os_give_sem_cb, os_give_sem_cb);
235240
blc_setOsSupEnable(true);
236241
#endif
@@ -274,8 +279,8 @@ void b9x_bt_controller_deinit()
274279
(void)k_thread_join(&b9x_bt_controller_thread_data, K_FOREVER);
275280

276281
/* disable interrupts */
277-
plic_interrupt_disable(IRQ1_SYSTIMER);
278-
plic_interrupt_disable(IRQ15_ZB_RT);
282+
plic_interrupt_disable(IRQ_SYSTIMER);
283+
plic_interrupt_disable(IRQ_ZB_RT);
279284

280285
/* Reset Radio */
281286
rf_radio_reset();

tlsr9/ble/vendor/controller/b9x_bt_flash.c

+2
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ static const struct device *flash_device =
3636
DEVICE_DT_GET(DT_CHOSEN(zephyr_flash_controller));
3737
#endif
3838

39+
#if CONFIG_B9X_BLE_CTRL_MAC_TYPE_PUBLIC
3940
static int get_bytes_from_str(uint8_t *buf, int buf_len, const char *src)
4041
{
4142
unsigned int i;
@@ -63,6 +64,7 @@ static int get_bytes_from_str(uint8_t *buf, int buf_len, const char *src)
6364

6465
return 0;
6566
}
67+
#endif
6668

6769
/**
6870
* @brief This function is used to initialize the MAC address

tlsr9/ble/vendor/controller/b9x_bt_init.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ int b9x_bt_blc_init(void *prx, void *ptx)
154154
}
155155
#endif /* CONFIG_BT_PERIPHERAL */
156156

157-
#if CONFIG_SOC_RISCV_TELINK_B92||CONFIG_SOC_RISCV_TELINK_B95
157+
#if CONFIG_SOC_RISCV_TELINK_B92 || CONFIG_SOC_RISCV_TELINK_B95
158158
blc_ll_configLegacyAdvEnableStrategy(LEG_ADV_EN_STRATEGY_3);
159159
blc_ll_configScanEnableStrategy(SCAN_STRATEGY_1);
160160
#endif

tlsr9/common/compiler.h

+2
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
#define _attribute_noinline_ __attribute__((noinline))
3131
#define _attribute_ram_code_sec_ __attribute__((section(".ram_code")))
3232
#define _attribute_ram_code_sec_noinline_ __attribute__((section(".ram_code"))) __attribute__((noinline))
33+
#define _attribute_ram_code_sec_optimize_o2_ __attribute__((section(".ram_code"))) __attribute__((optimize("O2")))
34+
#define _attribute_ram_code_sec_optimize_o2_noinline_ __attribute__((noinline)) __attribute__((section(".ram_code"))) __attribute__((optimize("O2")))
3335
#define _attribute_ram_code_ _attribute_ram_code_sec_noinline_
3436
#define _attribute_text_sec_ __attribute__((section(".text")))
3537
#define _attribute_text_code_ _attribute_text_sec_

0 commit comments

Comments
 (0)