4
4
* SPDX-License-Identifier: Apache-2.0
5
5
*/
6
6
7
- #include <zephyr/irq.h>
8
7
#include <zephyr/kernel.h>
9
- #include <zephyr/arch/cpu.h>
10
- #include <zephyr/sys/util.h>
11
8
#include <zephyr/drivers/entropy.h>
12
9
#include <zephyr/logging/log.h>
13
- #include <cmsis_core.h>
14
-
15
- #include <linklayer_plat_local.h>
16
-
17
- #include <stm32_ll_pwr.h>
18
10
19
11
#include "scm.h"
20
12
21
13
#define LOG_LEVEL CONFIG_SOC_LOG_LEVEL
22
- LOG_MODULE_REGISTER (linklayer_plat );
14
+ LOG_MODULE_REGISTER (linklayer_plat_adapt );
23
15
24
16
#define RADIO_INTR_PRIO_HIGH_Z (RADIO_INTR_PRIO_HIGH + _IRQ_PRIO_OFFSET)
25
17
#define RADIO_INTR_PRIO_LOW_Z (RADIO_INTR_PRIO_LOW + _IRQ_PRIO_OFFSET)
@@ -36,52 +28,17 @@ extern const struct device *rng_dev;
36
28
volatile int32_t prio_high_isr_counter ;
37
29
volatile int32_t prio_low_isr_counter ;
38
30
volatile int32_t prio_sys_isr_counter ;
39
- volatile int32_t irq_counter ;
40
31
volatile uint32_t local_basepri_value ;
41
32
42
33
/* Radio SW low ISR global variable */
43
34
volatile uint8_t radio_sw_low_isr_is_running_high_prio ;
44
35
45
- void LINKLAYER_PLAT_ClockInit (void )
46
- {
47
- LL_PWR_EnableBkUpAccess ();
48
-
49
- /* Select LSE as Sleep CLK */
50
- __HAL_RCC_RADIOSLPTIM_CONFIG (RCC_RADIOSTCLKSOURCE_LSE );
51
-
52
- LL_PWR_DisableBkUpAccess ();
53
-
54
- /* Enable AHB5ENR peripheral clock (bus CLK) */
55
- __HAL_RCC_RADIO_CLK_ENABLE ();
56
- }
57
36
58
37
void LINKLAYER_PLAT_DelayUs (uint32_t delay )
59
38
{
60
39
k_busy_wait (delay );
61
40
}
62
41
63
- void LINKLAYER_PLAT_WaitHclkRdy (void )
64
- {
65
- while (HAL_RCCEx_GetRadioBusClockReadiness () != RCC_RADIO_BUS_CLOCK_READY ) {
66
- }
67
- }
68
-
69
- void LINKLAYER_PLAT_AclkCtrl (uint8_t enable )
70
- {
71
- LOG_DBG ("enable: %d" , enable );
72
- if (enable ) {
73
- /* Enable RADIO baseband clock (active CLK) */
74
- HAL_RCCEx_EnableRadioBBClock ();
75
-
76
- /* Polling on HSE32 activation */
77
- while (LL_RCC_HSE_IsReady () == 0 ) {
78
- }
79
- } else {
80
- /* Disable RADIO baseband clock (active CLK) */
81
- HAL_RCCEx_DisableRadioBBClock ();
82
- }
83
- }
84
-
85
42
void LINKLAYER_PLAT_GetRNG (uint8_t * ptr_rnd , uint32_t len )
86
43
{
87
44
int ret ;
@@ -191,22 +148,6 @@ void LINKLAYER_PLAT_TriggerSwLowIT(uint8_t priority)
191
148
NVIC_SetPendingIRQ ((IRQn_Type )RADIO_SW_LOW_INTR_NUM );
192
149
}
193
150
194
- void LINKLAYER_PLAT_EnableIRQ (void )
195
- {
196
- irq_counter = MAX (0 , irq_counter - 1 );
197
-
198
- if (irq_counter == 0 ) {
199
- __enable_irq ();
200
- }
201
- }
202
-
203
- void LINKLAYER_PLAT_DisableIRQ (void )
204
- {
205
- __disable_irq ();
206
-
207
- irq_counter ++ ;
208
- }
209
-
210
151
void LINKLAYER_PLAT_Assert (uint8_t condition )
211
152
{
212
153
__ASSERT_NO_MSG (condition );
@@ -267,16 +208,6 @@ void LINKLAYER_PLAT_DisableSpecificIRQ(uint8_t isr_type)
267
208
}
268
209
}
269
210
270
- void LINKLAYER_PLAT_EnableRadioIT (void )
271
- {
272
- irq_enable ((IRQn_Type )RADIO_INTR_NUM );
273
- }
274
-
275
- void LINKLAYER_PLAT_DisableRadioIT (void )
276
- {
277
- irq_disable ((IRQn_Type )RADIO_INTR_NUM );
278
- }
279
-
280
211
void LINKLAYER_PLAT_StartRadioEvt (void )
281
212
{
282
213
__HAL_RCC_RADIO_CLK_SLEEP_ENABLE ();
0 commit comments