1 /*$Id: //dwh/bluetooth/DWC_ble154combo/firmware/rel/1.30a-SOW05Patchv6_2/firmware/public_inc/bsp.h#1 $*/
2 
3 /**
4  ********************************************************************************
5  * @file    bsp.h
6  * @brief   board support package interface wrapper file.
7  ******************************************************************************
8  * @copy
9  * This Synopsys DWC Bluetooth Low Energy Combo Link Layer/MAC software and
10  * associated documentation ( hereinafter the "Software") is an unsupported
11  * proprietary work of Synopsys, Inc. unless otherwise expressly agreed to in
12  * writing between Synopsys and you. The Software IS NOT an item of Licensed
13  * Software or a Licensed Product under any End User Software License Agreement
14  * or Agreement for Licensed Products with Synopsys or any supplement thereto.
15  * Synopsys is a registered trademark of Synopsys, Inc. Other names included in
16  * the SOFTWARE may be the trademarks of their respective owners.
17  *
18  * Synopsys MIT License:
19  * Copyright (c) 2020-Present Synopsys, Inc
20  *
21  * Permission is hereby granted, free of charge, to any person obtaining a copy of
22  * the Software), to deal in the Software without restriction, including without
23  * limitation the rights to use, copy, modify, merge, publish, distribute,
24  * sublicense, and/or sell copies of the Software, and to permit persons to whom
25  * the Software is furnished to do so, subject to the following conditions:
26  *
27  * The above copyright notice and this permission notice shall be included in all
28  * copies or substantial portions of the Software.
29  *
30  * THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
31  * IMPLIED, INCLUDING, BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
32  * FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT. IN NO EVENT SHALL THE
33  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
34  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE ARISING FROM,
35  * OUT OF, OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
36  *
37  * */
38 
39 /* Define to prevent recursive inclusion -------------------------------------*/
40 #ifndef LL_BSP_H_
41 #define LL_BSP_H_
42 
43 #include <stdint.h>
44 #include "_40nm_reg_files/DWC_ble154combo.h"
45 #define INTERRUPT_ENABLE	(1<<4)
46 #define SET_PRIORITY_LEVEL	2
47 #define PRIORITY_LEVEL_MASK 0x0F
48 
49 /**
50  * This macros specify the different combinations that can be used to enable or disable
51  * a specific ISR
52  */
53 
54 #define LL_HIGH_ISR_ONLY  		0x01	// Specify only LL high ISR to be enabled or disabled
55 #define LL_LOW_ISR_ONLY  		0x02	// Specify only LL LOW ISR to be enabled or disabled
56 #define SYS_LOW_ISR		 		0x04 	// Specify only system low ISR to be enabled or disabled
57 
58 /**
59  * @brief InterruptPriorities Enum.
60  * it is used to define the different ISR priorities in the controller
61  */
62 typedef enum InterruptPriorities {
63 	INT_PRIO_HIGHEST = 0,
64 	INT_PRIO_HIGH,
65 	INT_PRIO_LOW,
66 	INT_PRIO_LOWEST,
67 	INT_PRIO_MAX
68 }InterruptPriorities;
69 
70 /**
71  * @brief Event notification state  Enum.
72  * it is used to the state of radio activity ,being started or ended
73  */
74 typedef enum EvntNotiState {
75 	EVNT_START,
76 	EVNT_END,
77 	EVNT_NOT_SPECIIFED
78 }EvntNotiState;
79 
80 /**
81  * @brief periodic calibration state  Enum.
82  * it is used to the state of Periodic calibration
83  */
84 typedef enum _PhyClbrState {
85 	PHY_CLBR_NOT_RUNNING,
86 	PHY_CLBR_PNDING_OR_RUNNING,
87 	PHY_CLBR_NOT_KNOWN
88 }PhyClbrState;
89 
90 /* MACRO to explicitly disable unused parameter warning */
91 #define LL_UNUSED(x) (void)(x)
92 
93 /**
94  * @brief link layer bus structure.
95  * it defines the callback functions that will be be called by the transport bus driver
96  * after the requested operation is done.
97  */
98 typedef struct _ble_ll_bus {
99 	/** Bus read callback that will be called after the requested number of bytes is read from the bus */
100 	void (*read)(uint8_t *buffer);
101 	/** Bus Write callback that will be called after the requested is written to the bus */
102 	void (*write)(uint8_t *buffer);
103 } ble_ll_bus;
104 
105 /* Structure holding the Event timing */
106 typedef struct Evnt_timing_s{
107 	uint32_t drift_time; /* The total drift time between the software timer value and the start execution of the function evnt_schdlr_timer_callback */
108 	uint32_t exec_time;  /* The time to get the event ready for air transmission */
109 	uint32_t schdling_time; /* The total time to server the completed event and start new cycle of it, the time from longest time of the state machine done isr to till the debug dio DBG_IO_PROFILE_END_DRIFT_TIME is raised */
110 }Evnt_timing_t;
111 /**
112  * @brief enum holding all debugging gpio
113  *
114  *
115  *
116  */
117 typedef enum Debug_GPIO_e{
118 
119 
120 	DBG_IO_HCI_READ_DONE                                        ,
121 	DBG_IO_HCI_RCVD_CMD                                         ,
122 	DBG_IO_HCI_WRITE_DONE                                       ,
123 	DBG_IO_SCHDLR_EVNT_UPDATE                                   ,
124 	DBG_IO_SCHDLR_TIMER_SET                                     ,
125 	DBG_IO_SCHDLR_PHY_CLBR_TIMER                                ,
126 	DBG_IO_SCHDLR_EVNT_SKIPPED                                  ,
127 	DBG_IO_SCHDLR_HNDL_NXT_TRACE                                ,
128 	DBG_IO_ACTIVE_SCHDLR_NEAR_DETEDTED                          ,
129 	DBG_IO_ACTIVE_SCHDLR_NEAR_GAP_CHECK                         ,
130 	DBG_IO_ACTIVE_SCHDLR_NEAR_TIME_CHECK                        ,
131 	DBG_IO_ACTIVE_SCHDLR_NEAR_TRACE                             ,
132 	DBG_IO_SCHDLR_EVNT_RGSTR                                    ,
133 	DBG_IO_SCHDLR_ADD_CONFLICT_Q                                ,
134 	DBG_IO_SCHDLR_HNDL_MISSED_EVNT                              ,
135 	DBG_IO_SCHDLR_UNRGSTR_EVNT                                  ,
136 	DBG_IO_SCHDLR_EXEC_EVNT_TRACE                               ,
137 	DBG_IO_SCHDLR_EXEC_EVNT_PROFILE								,
138 	DBG_IO_SCHDLR_EXEC_EVNT_ERROR                               ,
139 	DBG_IO_SCHDLR_EXEC_EVNT_WINDOW_WIDENING                     ,
140 	DBG_IO_LLHWC_CMN_CLR_ISR                                    ,
141 	DBG_IO_LLWCC_CMN_HG_ISR                                     ,
142 	DBG_IO_LLHWC_CMN_LW_ISR                                     ,
143 	DBG_IO_LLHWC_CMN_CLR_TIMER_ERROR                            ,
144 	DBG_IO_LLHWC_LL_ISR                                         ,
145 	DBG_IO_LLHWC_SPLTMR_SET                                     ,
146 	DBG_IO_LLHWC_SPLTMR_GET                                     ,
147 	DBG_IO_LLHWC_LOW_ISR                                        ,
148 	DBG_IO_LLHWC_STOP_SCN                                       ,
149 	DBG_IO_LLHWC_WAIT_ENVT_ON_AIR                               ,
150 	DBG_IO_LLHWC_SET_CONN_EVNT_PARAM                            ,
151 	DBG_IO_POST_EVNT                                            ,
152 	DBG_IO_HNDL_ALL_EVNTS                                       ,
153 	DBG_IO_PROCESS_EVNT                                         ,
154 	DBG_IO_PROCESS_ISO_DATA                                     ,
155 	DBG_IO_ALLOC_TX_ISO_EMPTY_PKT                               ,
156 	DBG_IO_BIG_FREE_EMPTY_PKTS                                  ,
157 	DBG_IO_RECOMBINE_UNFRMD_DATA_OK                             ,
158 	DBG_IO_RECOMBINE_UNFRMD_DATA_CRC                            ,
159 	DBG_IO_RECOMBINE_UNFRMD_DATA_NoRX                           ,
160 	DBG_IO_RECOMBINE_UNFRMD_DATA_TRACE                          ,
161 	DBG_IO_ISO_HNDL_SDU                                         ,
162 	DBG_IO_LL_INTF_INIT                                         ,
163 	DBG_IO_DATA_TO_CNTRLR                                       ,
164 	DBG_IO_FREE_LL_PKT_HNDLR                                    ,
165 	DBG_IO_PHY_INIT_CLBR_TRACE                                  ,
166 	DBG_IO_PHY_RUNTIME_CLBR_TRACE                               ,
167 	DBG_IO_PHY_CLBR_ISR											,
168 	DBG_IO_PHY_INIT_CLBR_SINGLE_CH                              ,
169 	DBG_IO_PHY_CLBR_STRTD                                       ,
170 	DBG_IO_PHY_CLBR_EXEC                                        ,
171 	DBG_IO_RCO_STRT_STOP_RUNTIME_CLBR_ACTV                      ,
172 	DBG_IO_RCO_STRT_STOP_RUNTIME_RCO_CLBR                       ,
173 	DBG_IO_STRT_STOP_RUNTIME_RCO_CLBR_SWT                       ,
174 	DBG_IO_STRT_STOP_RUNTIME_RCO_CLBR_TRACE                     ,
175 	DBG_IO_RCO_ISR_TRACE                                        ,
176 	DBG_IO_RCO_ISR_COMPENDATE                                   ,
177 	DBG_IO_RAL_STRT_TX                                          ,
178 	DBG_IO_RAL_ISR_TIMER_ERROR                                  ,
179 	DBG_IO_RAL_ISR_TRACE                                        ,
180 	DBG_IO_RAL_STOP_OPRTN                                       ,
181 	DBG_IO_RAL_STRT_RX                                          ,
182 	DBG_IO_RAL_DONE_CLBK_TX                                     ,
183 	DBG_IO_RAL_DONE_CLBK_RX                                     ,
184 	DBG_IO_RAL_DONE_CLBK_ED                                     ,
185 	DBG_IO_RAL_ED_SCAN                                          ,
186 	DBG_IO_ERROR_MEM_CAP_EXCED                                  ,
187 	DBG_IO_ERROR_COMMAND_DISALLOWED                             ,
188 	DBG_IO_PTA_INIT                                             ,
189 	DBG_IO_PTA_EN                                               ,
190 	DBG_IO_LLHWC_PTA_SET_EN                                     ,
191 	DBG_IO_LLHWC_PTA_SET_PARAMS                                 ,
192 	DBG_IO_COEX_STRT_ON_IDLE                                    ,
193 	DBG_IO_COEX_ASK_FOR_AIR                                     ,
194 	DBG_IO_COEX_TIMER_EVNT_CLBK                                 ,
195 	DBG_IO_COEX_STRT_ONE_SHOT                                   ,
196 	DBG_IO_COEX_FORCE_STOP_RX                                   ,
197 
198 
199 	DBG_IO_LLHWC_ADV_DONE                                       ,
200 	DBG_IO_LLHWC_SCN_DONE                                       ,
201     DBG_IO_LLHWC_INIT_DONE                                      ,
202     DBG_IO_LLHWC_CONN_DONE                                      ,
203 
204 	DBG_IO_LLHWC_CIG_DONE                                       ,
205 	DBG_IO_LLHWC_BIG_DONE                                       ,
206 	DBG_IO_OS_TMR_CREATE                                        ,
207 	DBG_IO_ADV_EXT_TIMEOUT_CBK                                  ,
208 	DBG_IO_ADV_EXT_SCN_DUR_CBK                                  ,
209 	DBG_IO_ADV_EXT_SCN_PERIOD_CBK                               ,
210 	DBG_IO_ADV_EXT_PRDC_SCN_TIMEOUT_CBK                         ,
211 	DBG_IO_BIS_SYNC_TIMEOUT_TMR_CBK                             ,
212 	DBG_IO_BIS_TERM_TMR_CBK                                     ,
213 	DBG_IO_BIS_TST_MODE_CBK                                     ,
214 	DBG_IO_BIS_TST_MODE_TMR_CBK                                 ,
215 	DBG_IO_ISO_POST_TMR_CBK                                     ,
216 	DBG_IO_ISO_TST_MODE_TMR_CBK                                 ,
217 	DBG_IO_CONN_POST_TMR_CBK                                    ,
218 	DBG_IO_EVNT_SCHDLR_TMR_CBK                                  ,
219 	DBG_IO_HCI_POST_TMR_CBK                                     ,
220 	DBG_IO_LLCP_POST_TMR_CBK                                    ,
221 	DBG_IO_LLHWC_ENRGY_DETECT_CBK                               ,
222 	DBG_IO_PRVCY_POST_TMR_CBK                                   ,
223 
224 	DBG_IO_ANT_PRPR_TMR_CBK                                     ,
225 
226 	DBG_IO_COEX_TMR_FRC_STOP_AIR_GRANT_CBK                      ,
227 	DBG_IO_MLME_RX_EN_TMR_CBK                                   ,
228     DBG_IO_MLME_GNRC_TMR_CBK                                    ,
229 	DBG_IO_MIB_JOIN_LST_TMR_CBK                                 ,
230 	DBG_IO_MLME_PWR_PRES_TMR_CBK                                ,
231 	DBG_IO_PRESISTENCE_TMR_CBK                                  ,
232 	DBG_IO_RADIO_PHY_PRDC_CLBK_TMR_CBK                          ,
233 	DBG_IO_RADIO_CSMA_TMR_CBK                                   ,
234 	DBG_IO_RADIO_CSL_RCV_TMR_CBK                                ,
235 	DBG_IO_ED_TMR_CBK                                           ,
236 	DBG_IO_DIO_EXT_TMR_CBK                                      ,
237 	DBG_IO_RCO_CLBR_TMR_CBK
238 	                                                            ,
239 	DBG_IO_ADV_EXT_MNGR_ADV_CBK                                 ,
240 	DBG_IO_ADV_EXT_MNGR_SCN_CBK                                 ,
241 	DBG_IO_ADV_EXT_MNGR_SCN_ERR_CBK                             ,
242     DBG_IO_ADV_EXT_MNGR_PRDC_SCN_CBK                                ,
243 	DBG_IO_ADV_EXT_MNGR_PRDC_SCN_ERR_CBK                        ,
244 	DBG_IO_BIG_ADV_CBK                                          ,
245 	DBG_IO_BIG_ADV_ERR_CBK                                      ,
246 	DBG_IO_BIG_SYNC_CBK                   	                    ,
247 	DBG_IO_BIG_SYNC_ERR_CBK                                     ,
248 	DBG_IO_ISO_CIS_PKT_TRNSM_RECEIVED_CBK                       ,
249 	DBG_IO_ISO_CIG_ERR_CBK                                      ,
250 	DBG_IO_CONN_PKT_TRNSM_RECEIVED_CBK                          ,
251 	DBG_IO_PRDC_CLBR_EXTRL_CBK                                  ,
252 	DBG_IO_PTR_PRDC_ADV_SYNC_CBK                                ,
253 	DBG_IO_NCONN_SCN_CBK                                        ,
254 	DBG_IO_NCONN_ADV_CBK                                        ,
255 	DBG_IO_NCONN_INIT_CBK                                       ,
256 	DBG_IO_ANT_RADIO_CMPLT_EVNT_CBK                             ,
257 	DBG_IO_ANT_STACK_EVNT_CBK                                   ,
258 	DBG_IO_ADV_EXT_PROCESS_TMOUT_EVNT_CBK                       ,
259 	DBG_IO_ADV_EXT_MNGR_SCN_DUR_EVNT                            ,
260 	DBG_IO_ADV_EXT_MNGR_SCN_PERIODIC_EVNT                       ,
261 	DBG_IO_ADV_EXT_MNGR_PRDC_SCN_TMOUT_EVNT                     ,
262 	DBG_IO_ADV_EXT_MNGR_PRDC_SCN_CNCEL_EVNT                     ,
263 	DBG_IO_BIS_MNGR_BIG_TERM_CBK                                ,
264 	DBG_IO_BIS_MNGR_SYNC_TMOUT_CBK                              ,
265 	DBG_IO_ISOAL_MNGR_SDU_GEN                                   ,
266 	DBG_IO_ISO_MNGR_CIS_PROCESS_EVNT_CBK                        ,
267 
268 	DBG_IO_CONN_MNGR_PROCESS_EVNT_CLBK                          ,
269 	DBG_IO_CONN_MNGR_UPDT_CONN_PARAM_CBK                        ,
270 	DBG_IO_EVNT_SCHDLR_HW_EVNT_CMPLT                            ,
271 
272 	DBG_IO_HCI_EVENT_HNDLR                                      ,
273 
274 	DBG_IO_MLME_TMRS_CBK                                        ,
275 	DBG_IO_DIRECT_TX_EVNT_CBK                                   ,
276 	DBG_IO_INDIRECT_PKT_TOUR_CBK                                ,
277 	DBG_IO_RADIO_CSMA_TMR                                       ,
278 	DBG_IO_RAL_SM_DONE_EVNT_CBK                                 ,
279 	DBG_IO_ED_TMR_HNDL                                          ,
280 	DBG_IO_OS_TMR_EVNT_CBK                                      ,
281 	DBG_IO_PROFILE_MARKER_PHY_WAKEUP_TIME                       ,
282 	DBG_IO_PROFILE_END_DRIFT_TIME                               ,
283 	DBG_IO_PROC_RADIO_RCV										,
284 
285 	DBG_IO_EVNT_TIME_UPDT										,
286 
287 	DBG_IO_MAC_RECEIVE_DONE										,
288 	DBG_IO_MAC_TX_DONE											,
289 	DBG_IO_RADIO_APPLY_CSMA										,
290 	DBG_IO_RADIO_TRANSMIT										,
291 	DBG_IO_PROC_RADIO_TX										,
292 	DBG_IO_RAL_TX_DONE											,
293 	DBG_IO_RAL_TX_DONE_INCREMENT_BACKOFF_COUNT					,
294 	DBG_IO_RAL_TX_DONE_RST_BACKOFF_COUNT						,
295 	DBG_IO_RAL_CONTINUE_RX										,
296 	DBG_IO_RAL_PERFORM_CCA										,
297 	DBG_IO_RAL_ENABLE_TRANSMITTER								,
298 	DBG_IO_LLHWC_GET_CH_IDX_ALGO_2 ,
299 	DBG_IO_ADV_EXT_MNGR_PAWR_ADV_SE_CBK                         ,
300 	DBG_IO_ADV_EXT_MNGR_PAWR_ADV_SE_ERR_CBK                     ,
301 	DBG_IO_ADV_EXT_MNGR_PAWR_SCN_ERR_CBK                        ,
302 
303 	DBG_IO_LLHWC_SET_ADV_PAWR_SE_PARAM							,
304 	DBG_IO_LLHWC_ADV_PAWR_SE_DONE								,
305 	DBG_IO_LLHWC_SET_PAWR_RSP_PARAM								,
306 	DBG_IO_LLHWC_ADV_PAWR_RSP_DONE								,
307 	DBG_IO_LLHWC_ADV_PAWR_RSP_DONE_RCV_PCKT						,
308 	DBG_IO_LLHWC_ADV_PAWR_RSP_DONE_FREE_PCKT					,
309 	DBG_IO_LLHWC_PAWR_PING_PONG_HNDL							,
310 	DBG_IO_LLHWC_PAWR_PING_PONG_RCV_PCKT						,
311 	DBG_IO_LLHWC_PAWR_ADV_STOP_RSPS								,
312 	DBG_IO_LLHWC_PAWR_SYNC_SET_PARAM							,
313 	DBG_IO_LLHWC_PAWR_SYNC_DONE									,
314 	DBG_IO_LLHWC_PAWR_SYNC_SEND_RSP								,
315 
316 	DBG_IO_PAWR_ADV_SE_MISS_RSP									,
317 	DBG_IO_PAWR_ADV_FORCE_RP									,
318 	DBG_IO_PAWR_ADV_PUSH_STRT_TIM_FORW							,
319 	DBG_IO_PAWR_ADV_RSP_NEAR									,
320 	DBG_IO_EVNT_STRT_TIM_PUSHED									,
321 	DBG_IO_PAWR_ADV_RSP_SWITCH_SE								,
322 	DBG_IO_PAWR_ADV_QUEUE_WIN_UPDT								,
323 	DBG_IO_PAWR_SYNC_REFUSE_INST_RSP							,
324 	DBG_IO_PAWR_SYNC_ABOUT_TIMEOUT								,
325 	DBG_IO_PAWR_SYNC_INST_RSP_TOO_LATE							,
326 	DBG_IO_PAWR_SYNC_EXEC_SKIPPED								,
327 	DBG_IO_NULL_PKT_STATUS										,
328 	DBG_IO_PAWR_MULTIPLE_EVNTS_MISSED							,
329 	DBG_IO_PAWR_CHM_UPDT_END									,
330 	DBG_IO_LLHWC_CMN_INIT                                       ,
331 	Debug_GPIO_num
332 
333 }Debug_GPIO_t;
334 
335 
336 
337 /**
338 *  @ingroup BSP_APIS
339 *  @{
340 */
341 /**
342  * @brief   Bus initialization Function
343  *
344  * 	this function is used to initialize the used transport bus and link functions is @ref _ble_ll_bus to the ISRs of bus driver
345  * @param  op[in]   : pointer to @ref _ble_ll_bus structure that stores the bus callback functions
346  * @retval None
347  *
348  */
349 void bus_init(ble_ll_bus * op);
350 
351 /**
352  * @brief   Bus read Function
353  * This function is used read @ref size bytes from the Bus in the given @ref buffer
354  * @note this function is asynchronous, it is expected that Bus read callback function is called to indicate that the requested  data is available
355  * the read callback function will be set by calling @ref bus_init
356  * @param   *buffer [in]: pointer to the buffer of the data
357  * @param   size [in]: size of bytes read from the buffer
358  *
359  * @retval None
360  */
361 void bus_read(uint8_t *buffer, uint16_t size);
362 
363 /**
364  * @brief   Bus write Function
365  * This function is used read @ref size bytes from the Bus in the given @ref buffer
366  * @note this function is asynchronous, it is expected that Bus will call read callback function when wrriting data is done
367  * the Write callback function will be set by calling @ref bus_init
368  * @param   *buffer[in]: pointer to the buffer of the data
369  * @param   size[in]: size of bytes written to the buffer
370  *
371  * @retval None
372  */
373 void bus_write(uint8_t *buffer, uint16_t size);
374 
375 /**
376  * @brief   logger port initialization
377  *
378  *this function is used to initalizer the logger
379  * @param  None
380  * @retval None
381  *
382  */
383 void logger_init(void);
384 
385 /**
386  * @brief   logger write
387  * Thin function is used to log the data described by the input parameters
388  * @param   *buffer: pointer to the buffer of the data to be written to logger
389  * @param   size: size of bytes to be logged from the buffer
390  *
391  * @retval None
392  */
393 void logger_write(uint8_t *buffer, uint32_t size);
394 
395 /**
396  * @brief   enable interrupt request function
397  * This function enable the MCU interrupt ,after calling this function the LL code can be interrupted by the controller
398  * @param   None
399  *
400  * @retval None
401  */
402 extern void enable_irq(void);
403 /**
404  * @brief   disable interrupt request function
405  * This function disable the MCU interrupt ,after calling this function the LL code must not be interrupted as it is in critical section
406  * @param   None
407  *
408  * @retval None
409  */
410 extern void disable_irq(void);
411 
412 /**
413  * @brief this function is used to enable a specific ISR
414  * @param[in]  isr_type that holds specific ISR to be enabled by this function
415  * 				BIT[0] for LL_HIGH_ISR
416  * 				BIT[1] for LL_LOW_ISR
417  * 				BIT[2] for SYS_LOW_ISR
418  * @return None
419  */
420 void enable_specific_irq (uint8_t isr_type);
421 
422 
423 /**
424  * @brief this function is used to disable a specific ISR
425  * @param[in]  isr_type that holds specific ISR to be disabled by this function
426  * 				BIT[0] for LL_HIGH_ISR
427  * 				BIT[1] for LL_LOW_ISR
428  * 				BIT[2] for SYS_LOW_ISR
429  * @return None
430  */
431 void disable_specific_irq (uint8_t isr_type);
432 
433 
434 /**
435  * @brief   broad  initialization Function
436  *
437  * 	this function is used to initialize the used MCU
438  * @param  op[in]   : pointer to @ref _ble_ll_bus structure that stores the bus callback functions
439  * @retval 0 if SUCCESS
440  * otherwise Not SUCESS
441  *
442  */
443 int bsp_init(void);
444 /**
445  * @brief   dealy us  Function
446  *
447  * 	this function is  microsecond delay function
448  * @param  op[in]   : Nunmber of microseconds that function this function execution should take
449  * @retval  None
450  *
451  */
452 void bsp_delay_us(uint32_t delay);
453 
454 /**
455  * @brief   interrupt enable  Function
456  *
457  * 	this function is used to enabled and register ISR for the given interrupt line
458  * @param  intrNum[in]   : number to the interrupt line to be enabled
459  * @param  intr_cb[in]   : pionter to ISR function the will be called when this interupt is fired
460  * @retval  None
461  *
462  */
463 int bsp_intr_enable (uint32_t intrNum, void (*intr_cb)(void));
464 /**
465  * @brief   interrupt set pri  Function
466  *
467  * 	this function is used to set the interrupt priority and register ISR for the given interrupt line
468  * @param  intrNum[in]   : number to the configured interrupt line
469  * @param  intr_cb[in]   : pionter to ISR function the will be called when this interupt is fired
470  * @param  intpri[in]    : the priority oto used for the given interrupt
471  * @retval  None
472  *
473  */
474 int bsp_intr_set_pri(uint32_t intrNum, void (*intr_cb)(void), int32_t intpri);
475 
476 
477 
478 /* */
479 /**
480  *
481  * @brief  is in LL BLE memory  function
482  * it Checks whether the given pointer in BLE Memory or outside it  if the pointer points to a location in BLE memory
483  * @param   ptr [in] pointer to check if in BLE memory or not
484  *
485  * @retval 1   the given pointer is in LL BLE memory
486  * @retval 0   the given pointer is not in LL BLE memory
487  */
488 int bsp_is_ptr_in_ble_mem(void* ptr);
489 
490 
491 /**
492  * @brief  make the mcu sleep in a certain power mode according to its idle time.
493  *
494  * @param  None.
495  *
496  * @retval None.
497  */
498 void bsp_mcu_slp(void);
499 
500 /**
501  * @brief	Enables/Disables the bus clock.
502  *
503  * @param	enable: enable/disable flag
504  *
505  * @retval None.
506  */
507 void bsp_control_hclk(uint8_t enable);
508 
509 /**
510  * @brief	Enables/Disables the active clock.
511  *
512  * @param	enable: enable/disable flag
513  *
514  * @retval None.
515  */
516 void bsp_control_aclk(uint8_t enable);
517 
518 
519 /**
520  * @brief	Notification that LL FW will start or end a radio activity .
521  *
522  * @param	enable: EVNT_START , radio activity started
523  * 				  : Evnt_END     Radio event completed
524   *
525  * @retval None.
526  */
527 void bsp_evnt_not(EvntNotiState enable);
528 
529 /**
530  * @brief	Notification that LL FW will start or end RCO Calibration .
531  *
532  *@note this is an optional wrapper that used to inform the upper layer of the state of RCO calibration.
533  *@note the upper layer may ignore this wrapper
534  * @param	enable: EVNT_START , RCO calibration will be started
535  * 				  : Evnt_END     RCO calibration has  completed
536   *
537  * @retval None.
538  */
539 void bsp_rco_clbr_not(EvntNotiState enable);
540 
541 /**
542  * @brief used to assert/trigger the low priority interrupt from the SW.
543  *
544  * @param priority: if 1 then this SW ISR should be treated as if it was High priority HW ISR
545  *
546  * @retval None.
547  */
548 void bsp_switch_to_lw_isr(uint8_t priority);
549 
550 /**
551  * @brief  wait for bus clock ready signal
552  *
553  * A platform that has more accurate information about the readiness of the bus clock should implement this function to
554  * avoid redundant delay while reading sleep timer .
555  *
556  * @note this function will be called only if @ref USE_SOC_ACCURATE_BUS_CLK_READY_API is set to one otherwise LL FW will wait for a change in sleep timer reading.
557  *
558  * @param None.
559  *
560  * @retval None.
561  */
562 void bsp_wait_for_busclkrdy(void);
563 /**
564  * @brief used to start temperature calculations
565  * if the upper layer has informed the link layer by the existence of temperature sensor through @ref ll_intf_set_temperature_sensor_stat() or llhwc_cmn_set_temperature_sensor_stat()  .
566  * New temperature will be requested in the following cases:
567  * 1- at initialization when the @ref ll_intf_set_temperature_sensor_state or llhwc_cmn_set_temperature_sensor_stat is called
568  * 2- before any radio event
569  * Once temperature is ready the upper layer should call @ref ll_intf_set_temperature_value() or llhwc_cmn_set_temperature_value() to inform Link Layer with new Temperature value
570  * @retval None.
571  */
572 void bsp_request_temperature(void);
573 
574 /**
575  * @brief a function to set a certain gpio pin.
576  *
577  * @param gpio[in]: one of the gpios defined in Debug_GPIO_t enum to be set
578  *
579  * @retval None.
580  *
581  * @note : some of the signals can be mapped to physical hardware and some may not be connected to a physical GPIO based in availability.
582  */
583 void bsp_debug_gpio_set(Debug_GPIO_t gpio);
584 
585 /**
586  * @brief a function to clear a certain gpio pin.
587  *
588  * @param gpio[in]: one of the gpios defined in Debug_GPIO_t enum to be cleared
589  *
590  * @retval None.
591  *
592  * @note : some of the signals can be mapped to physical hardware and some may not be connected to a physical GPIO based in availability.
593  */
594 void bsp_debug_gpio_clear(Debug_GPIO_t gpio);
595 
596 /**
597  * @brief a function to toggle a certain gpio pin.
598  *
599  * @param gpio[in]: one of the gpios defined in Debug_GPIO_t enum to be toggled
600  *
601  * @retval None.
602  *
603  * @note : some of the signals can be mapped to physical hardware and some may not be connected to a physical GPIO based in availability.
604  */
605 void bsp_debug_gpio_toggle(Debug_GPIO_t gpio);
606 
607 /**
608  * @brief a function to inform the upper layer by state of periodic calibration state.
609  *
610  * @param state[in]: Value from @ref PhyClbrState, NO_PHY_CLBR_NEEDED  when the calibration is completed , PHY_CLBR_PNDING_OR_RUNNING when calibration is started or about to start from background task
611  *
612  * @retval None.
613  */
614 void bsp_set_phy_clbr_state(PhyClbrState state);
615 /**
616  * @brief a function to notify the upper layer to switch the clock.
617  *
618  * @param evnt_timing[in]: Evnt_timing_t pointer to structure contains drift time , execution time and scheduling time
619  *
620  * @retval None.
621  */
622 void bsp_evnt_schldr_timing_update_not(Evnt_timing_t * p_evnt_timing);
623 /**
624  * @}
625  */
626 
627 int logCons(void* devHandle, char* logStr);
628 void* logFileInit(const char * fileName);
629 int logFileClose(void* fileHandle);
630 int logFile(void* devHandle, char* logStr);
631 int logUart(void* devHandle, char* logStr);
632 
633 
634 void bsp_assert_log(uint8_t condition, uint8_t severity, const char *ptr_func_name,  const int line);
635 void bsp_assert(uint8_t condition, uint8_t severity);
636 
637 
638 
639 #endif /* LL_BSP_H_ */
640