1 /** 2 ****************************************************************************** 3 * @file hw_radio.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 Active wait on bus clock readiness. 55 * @param None 56 * @retval None 57 */ 58 extern void LINKLAYER_PLAT_WaitHclkRdy(void); 59 60 /** 61 * @brief Link Layer RNG request. 62 * @param ptr_rnd: pointer to the variable that hosts the number. 63 * @param len: number of byte of anthropy to get. 64 * @retval None 65 */ 66 extern void LINKLAYER_PLAT_GetRNG(uint8_t *ptr_rnd, uint32_t len); 67 68 /** 69 * @brief Initialize Link Layer radio high priority interrupt. 70 * @param intr_cb: function pointer to assign for the radio high priority ISR routine. 71 * @retval None 72 */ 73 extern void LINKLAYER_PLAT_SetupRadioIT(void (*intr_cb)()); 74 75 /** 76 * @brief Initialize Link Layer SW low priority interrupt. 77 * @param intr_cb: function pointer to assign for the SW low priority ISR routine. 78 * @retval None 79 */ 80 extern void LINKLAYER_PLAT_SetupSwLowIT(void (*intr_cb)()); 81 82 /** 83 * @brief Trigger the link layer SW low interrupt. 84 * @param None 85 * @retval None 86 */ 87 extern void LINKLAYER_PLAT_TriggerSwLowIT(uint8_t priority); 88 89 /** 90 * @brief Enable interrupts. 91 * @param None 92 * @retval None 93 */ 94 extern void LINKLAYER_PLAT_EnableIRQ(void); 95 96 /** 97 * @brief Disable interrupts. 98 * @param None 99 * @retval None 100 */ 101 extern void LINKLAYER_PLAT_DisableIRQ(void); 102 103 /** 104 * @brief Enable specific interrupt group. 105 * @param isr_type: mask for interrupt group to enable. 106 * This parameter can be one of the following: 107 * @arg LL_HIGH_ISR_ONLY: enable link layer high priority ISR. 108 * @arg LL_LOW_ISR_ONLY: enable link layer SW low priority ISR. 109 * @arg SYS_LOW_ISR: unmask interrupts for all the other system ISR with 110 * lower priority that link layer SW low interrupt. 111 * @retval None 112 */ 113 extern void LINKLAYER_PLAT_EnableSpecificIRQ(uint8_t isr_type); 114 115 /** 116 * @brief Disable specific interrupt group. 117 * @param isr_type: mask for interrupt group to disable. 118 * This parameter can be one of the following: 119 * @arg LL_HIGH_ISR_ONLY: disable link layer high priority ISR. 120 * @arg LL_LOW_ISR_ONLY: disable link layer SW low priority ISR. 121 * @arg SYS_LOW_ISR: mask interrupts for all the other system ISR with 122 * lower priority that link layer SW low interrupt. 123 * @retval None 124 */ 125 extern void LINKLAYER_PLAT_DisableSpecificIRQ(uint8_t isr_type); 126 127 /** 128 * @brief Enable link layer high priority ISR only. 129 * @param None 130 * @retval None 131 */ 132 extern void LINKLAYER_PLAT_EnableRadioIT(void); 133 134 /** 135 * @brief Disable link layer high priority ISR only. 136 * @param None 137 * @retval None 138 */ 139 extern void LINKLAYER_PLAT_DisableRadioIT(void); 140 141 /** 142 * @brief Link Layer notification for radio activity start. 143 * @param None 144 * @retval None 145 */ 146 extern void LINKLAYER_PLAT_StartRadioEvt(void); 147 148 /** 149 * @brief Link Layer notification for radio activity end. 150 * @param None 151 * @retval None 152 */ 153 extern void LINKLAYER_PLAT_StopRadioEvt(void); 154 155 /** 156 * @brief Link Layer notification for RCO calibration start. 157 * @param None 158 * @retval None 159 */ 160 extern void LINKLAYER_PLAT_RCOStartClbr(void); 161 162 /** 163 * @brief Link Layer notification for RCO calibration end. 164 * @param None 165 * @retval None 166 */ 167 extern void LINKLAYER_PLAT_RCOStopClbr(void); 168 169 /** 170 * @brief Link Layer requests temperature. 171 * @param None 172 * @retval None 173 */ 174 extern void LINKLAYER_PLAT_RequestTemperature(void); 175 176 /** 177 * @brief Enable RTOS context switch. 178 * @param None 179 * @retval None 180 */ 181 extern void LINKLAYER_PLAT_EnableOSContextSwitch(void); 182 183 /** 184 * @brief Disable RTOS context switch. 185 * @param None 186 * @retval None 187 */ 188 extern void LINKLAYER_PLAT_DisableOSContextSwitch(void); 189 190 /** 191 * @brief Notify the upper layer that new Link Layer timings have been applied. 192 * @param evnt_timing[in]: Evnt_timing_t pointer to structure contains drift time , execution time and scheduling time 193 * @retval None. 194 */ 195 extern void LINKLAYER_PLAT_SCHLDR_TIMING_UPDATE_NOT(Evnt_timing_t * p_evnt_timing); 196 197 #endif /* LINKLAYER_PLAT_H */ 198