1 /** 2 ****************************************************************************** 3 * @file linklayer_plat.h 4 * @author MCD Application Team 5 * @brief Header for linklayer_plat.c interface module 6 ****************************************************************************** 7 * @attention 8 * 9 * Copyright (c) 2022 STMicroelectronics. 10 * All rights reserved. 11 * 12 * This software is licensed under terms that can be found in the LICENSE file 13 * in the root directory of this software component. 14 * If no LICENSE file comes with this software, it is provided AS-IS. 15 * 16 ****************************************************************************** 17 */ 18 19 #ifndef LINKLAYER_PLAT_H 20 #define LINKLAYER_PLAT_H 21 22 #include "bsp.h" 23 #include <stdint.h> 24 25 /** 26 * @brief Configure the necessary clock sources for the radio. 27 * @param None 28 * @retval None 29 */ 30 extern void LINKLAYER_PLAT_ClockInit(void); 31 32 /** 33 * @brief Link Layer active waiting loop. 34 * @param delay: delay in us 35 * @retval None 36 */ 37 extern void LINKLAYER_PLAT_DelayUs(uint32_t delay); 38 39 /** 40 * @brief Link Layer assertion API 41 * @param condition: conditional statement to be checked. 42 * @retval None 43 */ 44 extern void LINKLAYER_PLAT_Assert(uint8_t condition); 45 46 /** 47 * @brief Enable/disable the Link Layer active clock (baseband clock). 48 * @param enable: boolean value to enable (1) or disable (0) the clock. 49 * @retval None 50 */ 51 extern void LINKLAYER_PLAT_AclkCtrl(uint8_t enable); 52 53 /** 54 * @brief Notify the Link Layer platform layer the system will enter in WFI 55 * and AHB5 clock may be turned of regarding the 2.4Ghz radio state. 56 * @param None 57 * @retval None 58 */ 59 extern void LINKLAYER_PLAT_NotifyWFIEnter(void); 60 61 /** 62 * @brief Notify the Link Layer platform layer the system exited WFI and AHB5 63 * clock may be resynchronized as is may have been turned of during 64 * low power mode entry. 65 * @param None 66 * @retval None 67 */ 68 extern void LINKLAYER_PLAT_NotifyWFIExit(void); 69 70 71 /** 72 * @brief Active wait on bus clock readiness. 73 * @param None 74 * @retval None 75 */ 76 extern void LINKLAYER_PLAT_WaitHclkRdy(void); 77 78 /** 79 * @brief Link Layer RNG request. 80 * @param ptr_rnd: pointer to the variable that hosts the number. 81 * @param len: number of byte of anthropy to get. 82 * @retval None 83 */ 84 extern void LINKLAYER_PLAT_GetRNG(uint8_t *ptr_rnd, uint32_t len); 85 86 /** 87 * @brief Initialize Link Layer radio high priority interrupt. 88 * @param intr_cb: function pointer to assign for the radio high priority ISR routine. 89 * @retval None 90 */ 91 extern void LINKLAYER_PLAT_SetupRadioIT(void (*intr_cb)()); 92 93 /** 94 * @brief Initialize Link Layer SW low priority interrupt. 95 * @param intr_cb: function pointer to assign for the SW low priority ISR routine. 96 * @retval None 97 */ 98 extern void LINKLAYER_PLAT_SetupSwLowIT(void (*intr_cb)()); 99 100 /** 101 * @brief Trigger the link layer SW low interrupt. 102 * @param None 103 * @retval None 104 */ 105 extern void LINKLAYER_PLAT_TriggerSwLowIT(uint8_t priority); 106 107 /** 108 * @brief Enable interrupts. 109 * @param None 110 * @retval None 111 */ 112 extern void LINKLAYER_PLAT_EnableIRQ(void); 113 114 /** 115 * @brief Disable interrupts. 116 * @param None 117 * @retval None 118 */ 119 extern void LINKLAYER_PLAT_DisableIRQ(void); 120 121 /** 122 * @brief Enable specific interrupt group. 123 * @param isr_type: mask for interrupt group to enable. 124 * This parameter can be one of the following: 125 * @arg LL_HIGH_ISR_ONLY: enable link layer high priority ISR. 126 * @arg LL_LOW_ISR_ONLY: enable link layer SW low priority ISR. 127 * @arg SYS_LOW_ISR: unmask interrupts for all the other system ISR with 128 * lower priority that link layer SW low interrupt. 129 * @retval None 130 */ 131 extern void LINKLAYER_PLAT_EnableSpecificIRQ(uint8_t isr_type); 132 133 /** 134 * @brief Disable specific interrupt group. 135 * @param isr_type: mask for interrupt group to disable. 136 * This parameter can be one of the following: 137 * @arg LL_HIGH_ISR_ONLY: disable link layer high priority ISR. 138 * @arg LL_LOW_ISR_ONLY: disable link layer SW low priority ISR. 139 * @arg SYS_LOW_ISR: mask interrupts for all the other system ISR with 140 * lower priority that link layer SW low interrupt. 141 * @retval None 142 */ 143 extern void LINKLAYER_PLAT_DisableSpecificIRQ(uint8_t isr_type); 144 145 /** 146 * @brief Enable link layer high priority ISR only. 147 * @param None 148 * @retval None 149 */ 150 extern void LINKLAYER_PLAT_EnableRadioIT(void); 151 152 /** 153 * @brief Disable link layer high priority ISR only. 154 * @param None 155 * @retval None 156 */ 157 extern void LINKLAYER_PLAT_DisableRadioIT(void); 158 159 /** 160 * @brief Link Layer notification for radio activity start. 161 * @param None 162 * @retval None 163 */ 164 extern void LINKLAYER_PLAT_StartRadioEvt(void); 165 166 /** 167 * @brief Link Layer notification for radio activity end. 168 * @param None 169 * @retval None 170 */ 171 extern void LINKLAYER_PLAT_StopRadioEvt(void); 172 173 /** 174 * @brief Link Layer notification for RCO calibration start. 175 * @param None 176 * @retval None 177 */ 178 extern void LINKLAYER_PLAT_RCOStartClbr(void); 179 180 /** 181 * @brief Link Layer notification for RCO calibration end. 182 * @param None 183 * @retval None 184 */ 185 extern void LINKLAYER_PLAT_RCOStopClbr(void); 186 187 /** 188 * @brief Link Layer requests temperature. 189 * @param None 190 * @retval None 191 */ 192 extern void LINKLAYER_PLAT_RequestTemperature(void); 193 194 /** 195 * @brief Enable RTOS context switch. 196 * @param None 197 * @retval None 198 */ 199 extern void LINKLAYER_PLAT_EnableOSContextSwitch(void); 200 201 /** 202 * @brief Disable RTOS context switch. 203 * @param None 204 * @retval None 205 */ 206 extern void LINKLAYER_PLAT_DisableOSContextSwitch(void); 207 208 /** 209 * @brief Notify the upper layer that new Link Layer timings have been applied. 210 * @param evnt_timing[in]: Evnt_timing_t pointer to structure contains drift time , execution time and scheduling time 211 * @retval None. 212 */ 213 extern void LINKLAYER_PLAT_SCHLDR_TIMING_UPDATE_NOT(Evnt_timing_t * p_evnt_timing); 214 215 /** 216 * @brief Get the ST company ID. 217 * @param None 218 * @retval Company ID 219 */ 220 extern uint32_t LINKLAYER_PLAT_GetSTCompanyID(void); 221 222 /** 223 * @brief Get the Unique Device Number (UDN). 224 * @param None 225 * @retval UDN 226 */ 227 extern uint32_t LINKLAYER_PLAT_GetUDN(void); 228 229 #endif /* LINKLAYER_PLAT_H */