1 /*$Id: //dwh/bluetooth/DWC_ble154combo/firmware/rel/1.32a-lca02/firmware/public_inc/bsp.h#2 $*/ 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 #ifndef EBQ_BUILD 59 #define EBQ_BUILD 0 60 #endif 61 62 63 #ifndef USE_HCI_TRANSPORT 64 #define USE_HCI_TRANSPORT 0 65 #endif 66 /** 67 * @brief InterruptPriorities Enum. 68 * it is used to define the different ISR priorities in the controller 69 */ 70 typedef enum InterruptPriorities { 71 INT_PRIO_HIGHEST = 0, 72 INT_PRIO_HIGH, 73 INT_PRIO_LOW, 74 INT_PRIO_LOWEST, 75 INT_PRIO_MAX 76 }InterruptPriorities; 77 78 /** 79 * @brief Event notification state Enum. 80 * it is used to the state of radio activity ,being started or ended 81 */ 82 typedef enum EvntNotiState { 83 EVNT_START, 84 EVNT_END, 85 EVNT_NOT_SPECIIFED 86 }EvntNotiState; 87 88 /** 89 * @brief periodic calibration state Enum. 90 * it is used to the state of Periodic calibration 91 */ 92 typedef enum _PhyClbrState { 93 PHY_CLBR_NOT_RUNNING, 94 PHY_CLBR_PNDING_OR_RUNNING, 95 PHY_CLBR_NOT_KNOWN 96 }PhyClbrState; 97 98 /* MACRO to explicitly disable unused parameter warning */ 99 #define LL_UNUSED(x) (void)(x) 100 101 /** 102 * @brief link layer bus structure. 103 * it defines the callback functions that will be be called by the transport bus driver 104 * after the requested operation is done. 105 */ 106 typedef struct _ble_ll_bus { 107 /** Bus read callback that will be called after the requested number of bytes is read from the bus */ 108 void (*read)(uint8_t *buffer); 109 /** Bus Write callback that will be called after the requested is written to the bus */ 110 void (*write)(uint8_t *buffer); 111 } ble_ll_bus; 112 113 /* Structure holding the Event timing */ 114 typedef struct Evnt_timing_s{ 115 uint32_t drift_time; /* The total drift time between the software timer value and the start execution of the function evnt_schdlr_timer_callback */ 116 uint32_t exec_time; /* The time to get the event ready for air transmission */ 117 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 */ 118 }Evnt_timing_t; 119 /** 120 * @brief enum holding all debugging gpio 121 * 122 * 123 * 124 */ 125 typedef enum Debug_GPIO_e{ 126 127 128 DBG_IO_HCI_READ_DONE , 129 DBG_IO_HCI_RCVD_CMD , 130 DBG_IO_HCI_WRITE_DONE , 131 DBG_IO_SCHDLR_EVNT_UPDATE , 132 DBG_IO_SCHDLR_TIMER_SET , 133 DBG_IO_SCHDLR_PHY_CLBR_TIMER , 134 DBG_IO_SCHDLR_EVNT_SKIPPED , 135 DBG_IO_SCHDLR_HNDL_NXT_TRACE , 136 DBG_IO_ACTIVE_SCHDLR_NEAR_DETEDTED , 137 DBG_IO_ACTIVE_SCHDLR_NEAR_GAP_CHECK , 138 DBG_IO_ACTIVE_SCHDLR_NEAR_TIME_CHECK , 139 DBG_IO_ACTIVE_SCHDLR_NEAR_TRACE , 140 DBG_IO_SCHDLR_EVNT_RGSTR , 141 DBG_IO_SCHDLR_ADD_CONFLICT_Q , 142 DBG_IO_SCHDLR_HNDL_MISSED_EVNT , 143 DBG_IO_SCHDLR_UNRGSTR_EVNT , 144 DBG_IO_SCHDLR_EXEC_EVNT_TRACE , 145 DBG_IO_SCHDLR_EXEC_EVNT_PROFILE , 146 DBG_IO_SCHDLR_EXEC_EVNT_ERROR , 147 DBG_IO_SCHDLR_EXEC_EVNT_WINDOW_WIDENING , 148 DBG_IO_LLHWC_CMN_CLR_ISR , 149 DBG_IO_LLWCC_CMN_HG_ISR , 150 DBG_IO_LLHWC_CMN_LW_ISR , 151 DBG_IO_LLHWC_CMN_CLR_TIMER_ERROR , 152 DBG_IO_LLHWC_LL_ISR , 153 DBG_IO_LLHWC_SPLTMR_SET , 154 DBG_IO_LLHWC_SPLTMR_GET , 155 DBG_IO_LLHWC_LOW_ISR , 156 DBG_IO_LLHWC_STOP_SCN , 157 DBG_IO_LLHWC_WAIT_ENVT_ON_AIR , 158 DBG_IO_LLHWC_SET_CONN_EVNT_PARAM , 159 DBG_IO_POST_EVNT , 160 DBG_IO_HNDL_ALL_EVNTS , 161 DBG_IO_PROCESS_EVNT , 162 DBG_IO_PROCESS_ISO_DATA , 163 DBG_IO_ALLOC_TX_ISO_EMPTY_PKT , 164 DBG_IO_BIG_FREE_EMPTY_PKTS , 165 DBG_IO_RECOMBINE_UNFRMD_DATA_OK , 166 DBG_IO_RECOMBINE_UNFRMD_DATA_CRC , 167 DBG_IO_RECOMBINE_UNFRMD_DATA_NoRX , 168 DBG_IO_RECOMBINE_UNFRMD_DATA_TRACE , 169 DBG_IO_ISO_HNDL_SDU , 170 DBG_IO_LL_INTF_INIT , 171 DBG_IO_DATA_TO_CNTRLR , 172 DBG_IO_FREE_LL_PKT_HNDLR , 173 DBG_IO_PHY_INIT_CLBR_TRACE , 174 DBG_IO_PHY_RUNTIME_CLBR_TRACE , 175 DBG_IO_PHY_CLBR_ISR , 176 DBG_IO_PHY_INIT_CLBR_SINGLE_CH , 177 DBG_IO_PHY_CLBR_STRTD , 178 DBG_IO_PHY_CLBR_EXEC , 179 DBG_IO_RCO_STRT_STOP_RUNTIME_CLBR_ACTV , 180 DBG_IO_RCO_STRT_STOP_RUNTIME_RCO_CLBR , 181 DBG_IO_STRT_STOP_RUNTIME_RCO_CLBR_SWT , 182 DBG_IO_STRT_STOP_RUNTIME_RCO_CLBR_TRACE , 183 DBG_IO_RCO_ISR_TRACE , 184 DBG_IO_RCO_ISR_COMPENDATE , 185 DBG_IO_RAL_STRT_TX , 186 DBG_IO_RAL_ISR_TIMER_ERROR , 187 DBG_IO_RAL_ISR_TRACE , 188 DBG_IO_RAL_STOP_OPRTN , 189 DBG_IO_RAL_STRT_RX , 190 DBG_IO_RAL_DONE_CLBK_TX , 191 DBG_IO_RAL_DONE_CLBK_RX , 192 DBG_IO_RAL_DONE_CLBK_ED , 193 DBG_IO_RAL_ED_SCAN , 194 DBG_IO_ERROR_MEM_CAP_EXCED , 195 DBG_IO_ERROR_COMMAND_DISALLOWED , 196 DBG_IO_PTA_INIT , 197 DBG_IO_PTA_EN , 198 DBG_IO_LLHWC_PTA_SET_EN , 199 DBG_IO_LLHWC_PTA_SET_PARAMS , 200 DBG_IO_COEX_STRT_ON_IDLE , 201 DBG_IO_COEX_ASK_FOR_AIR , 202 DBG_IO_COEX_TIMER_EVNT_CLBK , 203 DBG_IO_COEX_STRT_ONE_SHOT , 204 DBG_IO_COEX_FORCE_STOP_RX , 205 206 207 DBG_IO_LLHWC_ADV_DONE , 208 DBG_IO_LLHWC_SCN_DONE , 209 DBG_IO_LLHWC_INIT_DONE , 210 DBG_IO_LLHWC_CONN_DONE , 211 212 DBG_IO_LLHWC_CIG_DONE , 213 DBG_IO_LLHWC_BIG_DONE , 214 DBG_IO_OS_TMR_CREATE , 215 DBG_IO_ADV_EXT_TIMEOUT_CBK , 216 DBG_IO_ADV_EXT_SCN_DUR_CBK , 217 DBG_IO_ADV_EXT_SCN_PERIOD_CBK , 218 DBG_IO_ADV_EXT_PRDC_SCN_TIMEOUT_CBK , 219 DBG_IO_BIS_SYNC_TIMEOUT_TMR_CBK , 220 DBG_IO_BIS_TERM_TMR_CBK , 221 DBG_IO_BIS_TST_MODE_CBK , 222 DBG_IO_BIS_TST_MODE_TMR_CBK , 223 DBG_IO_ISO_POST_TMR_CBK , 224 DBG_IO_ISO_TST_MODE_TMR_CBK , 225 DBG_IO_CONN_POST_TMR_CBK , 226 DBG_IO_EVNT_SCHDLR_TMR_CBK , 227 DBG_IO_HCI_POST_TMR_CBK , 228 DBG_IO_LLCP_POST_TMR_CBK , 229 DBG_IO_LLHWC_ENRGY_DETECT_CBK , 230 DBG_IO_PRVCY_POST_TMR_CBK , 231 232 DBG_IO_ANT_PRPR_TMR_CBK , 233 234 DBG_IO_COEX_TMR_FRC_STOP_AIR_GRANT_CBK , 235 DBG_IO_MLME_RX_EN_TMR_CBK , 236 DBG_IO_MLME_GNRC_TMR_CBK , 237 DBG_IO_MIB_JOIN_LST_TMR_CBK , 238 DBG_IO_MLME_PWR_PRES_TMR_CBK , 239 DBG_IO_PRESISTENCE_TMR_CBK , 240 DBG_IO_RADIO_PHY_PRDC_CLBK_TMR_CBK , 241 DBG_IO_RADIO_CSMA_TMR_CBK , 242 DBG_IO_RADIO_CSL_RCV_TMR_CBK , 243 DBG_IO_ED_TMR_CBK , 244 DBG_IO_DIO_EXT_TMR_CBK , 245 DBG_IO_RCO_CLBR_TMR_CBK 246 , 247 DBG_IO_ADV_EXT_MNGR_ADV_CBK , 248 DBG_IO_ADV_EXT_MNGR_SCN_CBK , 249 DBG_IO_ADV_EXT_MNGR_SCN_ERR_CBK , 250 DBG_IO_ADV_EXT_MNGR_PRDC_SCN_CBK , 251 DBG_IO_ADV_EXT_MNGR_PRDC_SCN_ERR_CBK , 252 DBG_IO_BIG_ADV_CBK , 253 DBG_IO_BIG_ADV_ERR_CBK , 254 DBG_IO_BIG_SYNC_CBK , 255 DBG_IO_BIG_SYNC_ERR_CBK , 256 DBG_IO_ISO_CIS_PKT_TRNSM_RECEIVED_CBK , 257 DBG_IO_ISO_CIG_ERR_CBK , 258 DBG_IO_CONN_PKT_TRNSM_RECEIVED_CBK , 259 DBG_IO_PRDC_CLBR_EXTRL_CBK , 260 DBG_IO_PTR_PRDC_ADV_SYNC_CBK , 261 DBG_IO_NCONN_SCN_CBK , 262 DBG_IO_NCONN_ADV_CBK , 263 DBG_IO_NCONN_INIT_CBK , 264 DBG_IO_ANT_RADIO_CMPLT_EVNT_CBK , 265 DBG_IO_ANT_STACK_EVNT_CBK , 266 DBG_IO_ADV_EXT_PROCESS_TMOUT_EVNT_CBK , 267 DBG_IO_ADV_EXT_MNGR_SCN_DUR_EVNT , 268 DBG_IO_ADV_EXT_MNGR_SCN_PERIODIC_EVNT , 269 DBG_IO_ADV_EXT_MNGR_PRDC_SCN_TMOUT_EVNT , 270 DBG_IO_ADV_EXT_MNGR_PRDC_SCN_CNCEL_EVNT , 271 DBG_IO_BIS_MNGR_BIG_TERM_CBK , 272 DBG_IO_BIS_MNGR_SYNC_TMOUT_CBK , 273 DBG_IO_ISOAL_MNGR_SDU_GEN , 274 DBG_IO_ISO_MNGR_CIS_PROCESS_EVNT_CBK , 275 276 DBG_IO_CONN_MNGR_PROCESS_EVNT_CLBK , 277 DBG_IO_CONN_MNGR_UPDT_CONN_PARAM_CBK , 278 DBG_IO_CONN_MNGR_DATA_LEN_UPDT_CBK , 279 DBG_IO_EVNT_SCHDLR_HW_EVNT_CMPLT , 280 281 DBG_IO_HCI_EVENT_HNDLR , 282 283 DBG_IO_MLME_TMRS_CBK , 284 DBG_IO_DIRECT_TX_EVNT_CBK , 285 DBG_IO_INDIRECT_PKT_TOUR_CBK , 286 DBG_IO_RADIO_CSMA_TMR , 287 DBG_IO_RAL_SM_DONE_EVNT_CBK , 288 DBG_IO_ED_TMR_HNDL , 289 DBG_IO_OS_TMR_EVNT_CBK , 290 DBG_IO_PROFILE_MARKER_PHY_WAKEUP_TIME , 291 DBG_IO_PROFILE_END_DRIFT_TIME , 292 DBG_IO_PROC_RADIO_RCV , 293 DBG_IO_EVNT_TIME_UPDT , 294 DBG_IO_MAC_RECEIVE_DONE , 295 DBG_IO_MAC_TX_DONE , 296 DBG_IO_RADIO_APPLY_CSMA , 297 DBG_IO_RADIO_TRANSMIT , 298 DBG_IO_PROC_RADIO_TX , 299 DBG_IO_RAL_TX_DONE , 300 DBG_IO_RAL_TX_DONE_INCREMENT_BACKOFF_COUNT , 301 DBG_IO_RAL_TX_DONE_RST_BACKOFF_COUNT , 302 DBG_IO_RAL_CONTINUE_RX , 303 DBG_IO_RAL_PERFORM_CCA , 304 DBG_IO_RAL_ENABLE_TRANSMITTER , 305 DBG_IO_LLHWC_GET_CH_IDX_ALGO_2 , 306 DBG_IO_ADV_EXT_MNGR_PAWR_ADV_SE_CBK , 307 DBG_IO_ADV_EXT_MNGR_PAWR_ADV_SE_ERR_CBK , 308 DBG_IO_ADV_EXT_MNGR_PAWR_SCN_ERR_CBK , 309 310 DBG_IO_LLHWC_SET_ADV_PAWR_SE_PARAM , 311 DBG_IO_LLHWC_ADV_PAWR_SE_DONE , 312 DBG_IO_LLHWC_SET_PAWR_RSP_PARAM , 313 DBG_IO_LLHWC_ADV_PAWR_RSP_DONE , 314 DBG_IO_LLHWC_ADV_PAWR_RSP_DONE_RCV_PCKT , 315 DBG_IO_LLHWC_ADV_PAWR_RSP_DONE_FREE_PCKT , 316 DBG_IO_LLHWC_PAWR_PING_PONG_HNDL , 317 DBG_IO_LLHWC_PAWR_PING_PONG_RCV_PCKT , 318 DBG_IO_LLHWC_PAWR_ADV_STOP_RSPS , 319 DBG_IO_LLHWC_PAWR_SYNC_SET_PARAM , 320 DBG_IO_LLHWC_PAWR_SYNC_DONE , 321 DBG_IO_LLHWC_PAWR_SYNC_SEND_RSP , 322 323 DBG_IO_PAWR_ADV_SE_MISS_RSP , 324 DBG_IO_PAWR_ADV_FORCE_RP , 325 DBG_IO_PAWR_ADV_PUSH_STRT_TIM_FORW , 326 DBG_IO_PAWR_ADV_RSP_NEAR , 327 DBG_IO_EVNT_STRT_TIM_PUSHED , 328 DBG_IO_PAWR_ADV_RSP_SWITCH_SE , 329 DBG_IO_PAWR_ADV_QUEUE_WIN_UPDT , 330 DBG_IO_PAWR_SYNC_REFUSE_INST_RSP , 331 DBG_IO_PAWR_SYNC_ABOUT_TIMEOUT , 332 DBG_IO_PAWR_SYNC_INST_RSP_TOO_LATE , 333 DBG_IO_PAWR_SYNC_EXEC_SKIPPED , 334 DBG_IO_NULL_PKT_STATUS , 335 DBG_IO_PAWR_MULTIPLE_EVNTS_MISSED , 336 DBG_IO_PAWR_CHM_UPDT_END , 337 DBG_IO_LLHWC_CMN_INIT , 338 DBG_IO_RADIO_SET_PENDING_TX_FULL , 339 DBG_IO_RADIO_SET_PENDING_TX_CONTINUE , 340 DBG_IO_RADIO_HANDLE_PENDING_TX , 341 DBG_IO_RAL_AD_SET_MEASUREMENT_STATE , 342 DBG_IO_PROFILE_CS_GEN , 343 DBG_IO_PROFILE_CS_CHNL_SHUFFLING , 344 Debug_GPIO_num 345 346 }Debug_GPIO_t; 347 348 349 350 /** 351 * @ingroup BSP_APIS 352 * @{ 353 */ 354 /** 355 * @brief Bus initialization Function 356 * 357 * this function is used to initialize the used transport bus and link functions is @ref _ble_ll_bus to the ISRs of bus driver 358 * @param op[in] : pointer to @ref _ble_ll_bus structure that stores the bus callback functions 359 * @retval None 360 * 361 */ 362 void bus_init(ble_ll_bus * op); 363 364 /** 365 * @brief Bus read Function 366 * This function is used read @ref size bytes from the Bus in the given @ref buffer 367 * @note this function is asynchronous, it is expected that Bus read callback function is called to indicate that the requested data is available 368 * the read callback function will be set by calling @ref bus_init 369 * @param *buffer [in]: pointer to the buffer of the data 370 * @param size [in]: size of bytes read from the buffer 371 * 372 * @retval None 373 */ 374 void bus_read(uint8_t *buffer, uint16_t size); 375 376 /** 377 * @brief Bus write Function 378 * This function is used read @ref size bytes from the Bus in the given @ref buffer 379 * @note this function is asynchronous, it is expected that Bus will call read callback function when wrriting data is done 380 * the Write callback function will be set by calling @ref bus_init 381 * @param *buffer[in]: pointer to the buffer of the data 382 * @param size[in]: size of bytes written to the buffer 383 * 384 * @retval None 385 */ 386 void bus_write(uint8_t *buffer, uint16_t size); 387 388 /** 389 * @brief logger port initialization 390 * 391 *this function is used to initalizer the logger 392 * @param None 393 * @retval None 394 * 395 */ 396 void logger_init(void); 397 398 /** 399 * @brief logger write 400 * Thin function is used to log the data described by the input parameters 401 * @param *buffer: pointer to the buffer of the data to be written to logger 402 * @param size: size of bytes to be logged from the buffer 403 * 404 * @retval None 405 */ 406 void logger_write(uint8_t *buffer, uint32_t size); 407 408 /** 409 * @brief enable interrupt request function 410 * This function enable the MCU interrupt ,after calling this function the LL code can be interrupted by the controller 411 * @param None 412 * 413 * @retval None 414 */ 415 extern void enable_irq( 416 void 417 ); 418 /** 419 * @brief disable interrupt request function 420 * This function disable the MCU interrupt ,after calling this function the LL code must not be interrupted as it is in critical section 421 * @param None 422 * 423 * @retval None 424 */ 425 extern void disable_irq( 426 void 427 ); 428 /** 429 * @brief this function is used to enable a specific ISR 430 * @param[in] isr_type that holds specific ISR to be enabled by this function 431 * BIT[0] for LL_HIGH_ISR 432 * BIT[1] for LL_LOW_ISR 433 * BIT[2] for SYS_LOW_ISR 434 * @return None 435 */ 436 void enable_specific_irq(uint8_t isr_type ); 437 438 439 /** 440 * @brief this function is used to disable a specific ISR 441 * @param[in] isr_type that holds specific ISR to be disabled by this function 442 * BIT[0] for LL_HIGH_ISR 443 * BIT[1] for LL_LOW_ISR 444 * BIT[2] for SYS_LOW_ISR 445 * @return None 446 */ 447 void disable_specific_irq(uint8_t isr_type ); 448 449 /** 450 * @brief broad initialization Function 451 * 452 * this function is used to initialize the used MCU 453 * @param op[in] : pointer to @ref _ble_ll_bus structure that stores the bus callback functions 454 * @retval 0 if SUCCESS 455 * otherwise Not SUCESS 456 * 457 */ 458 int bsp_init(void); 459 /** 460 * @brief dealy us Function 461 * 462 * this function is microsecond delay function 463 * @param op[in] : Nunmber of microseconds that function this function execution should take 464 * @retval None 465 * 466 */ 467 void bsp_delay_us(uint32_t delay); 468 469 /** 470 * @brief interrupt enable Function 471 * 472 * this function is used to enabled and register ISR for the given interrupt line 473 * @param intrNum[in] : number to the interrupt line to be enabled 474 * @param intr_cb[in] : pionter to ISR function the will be called when this interupt is fired 475 * @retval None 476 * 477 */ 478 int bsp_intr_enable (uint32_t intrNum, void (*intr_cb)(void)); 479 /** 480 * @brief interrupt set pri Function 481 * 482 * this function is used to set the interrupt priority and register ISR for the given interrupt line 483 * @param intrNum[in] : number to the configured interrupt line 484 * @param intr_cb[in] : pionter to ISR function the will be called when this interupt is fired 485 * @param intpri[in] : the priority oto used for the given interrupt 486 * @retval None 487 * 488 */ 489 int bsp_intr_set_pri(uint32_t intrNum, void (*intr_cb)(void), int32_t intpri); 490 491 492 493 /* */ 494 /** 495 * 496 * @brief is in LL BLE memory function 497 * it Checks whether the given pointer in BLE Memory or outside it if the pointer points to a location in BLE memory 498 * @param ptr [in] pointer to check if in BLE memory or not 499 * 500 * @retval 1 the given pointer is in LL BLE memory 501 * @retval 0 the given pointer is not in LL BLE memory 502 */ 503 int bsp_is_ptr_in_ble_mem(void* ptr); 504 505 506 /** 507 * @brief make the mcu sleep in a certain power mode according to its idle time. 508 * 509 * @param None. 510 * 511 * @retval None. 512 */ 513 void bsp_mcu_slp(void); 514 515 516 /** 517 * @brief Clear GPIO pin output value 518 * 519 * @param enable: enable/disable flag 520 * 521 * @retval None. 522 */ 523 524 void bsp_gpio_clear(uint8_t gpio_num); 525 526 527 /** 528 * @brief Set GPIO pin output value 529 * 530 * @param enable: enable/disable flag 531 * 532 * @retval None. 533 */ 534 void bsp_gpio_set(uint8_t gpio_num); 535 536 537 /** 538 * @brief Enables/Disables the bus clock. 539 * 540 * @param enable: enable/disable flag 541 * 542 * @retval None. 543 */ 544 void bsp_control_hclk(uint8_t enable); 545 546 /** 547 * @brief Enables/Disables the active clock. 548 * 549 * @param enable: enable/disable flag 550 * 551 * @retval None. 552 */ 553 void bsp_control_aclk(uint8_t enable); 554 555 556 /** 557 * @brief Notification that LL FW will start or end a radio activity . 558 * 559 * @param enable: EVNT_START , radio activity started 560 * : Evnt_END Radio event completed 561 * 562 * @retval None. 563 */ 564 void bsp_evnt_not(EvntNotiState enable); 565 566 /** 567 * @brief Notification that LL FW will start or end RCO Calibration . 568 * 569 *@note this is an optional wrapper that used to inform the upper layer of the state of RCO calibration. 570 *@note the upper layer may ignore this wrapper 571 * @param enable: EVNT_START , RCO calibration will be started 572 * : Evnt_END RCO calibration has completed 573 * 574 * @retval None. 575 */ 576 void bsp_rco_clbr_not(EvntNotiState enable); 577 578 /** 579 * @brief used to assert/trigger the low priority interrupt from the SW. 580 * 581 * @param priority: if 1 then this SW ISR should be treated as if it was High priority HW ISR 582 * 583 * @retval None. 584 */ 585 void bsp_switch_to_lw_isr(uint8_t priority); 586 587 /** 588 * @brief wait for bus clock ready signal 589 * 590 * A platform that has more accurate information about the readiness of the bus clock should implement this function to 591 * avoid redundant delay while reading sleep timer . 592 * 593 * @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. 594 * 595 * @param None. 596 * 597 * @retval None. 598 */ 599 void bsp_wait_for_busclkrdy(void); 600 /** 601 * @brief used to start temperature calculations 602 * 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() . 603 * New temperature will be requested in the following cases: 604 * 1- at initialization when the @ref ll_intf_set_temperature_sensor_state or llhwc_cmn_set_temperature_sensor_stat is called 605 * 2- before any radio event 606 * 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 607 * @retval None. 608 */ 609 void bsp_request_temperature(void); 610 611 /** 612 * @brief a function to set a certain gpio pin. 613 * 614 * @param gpio[in]: one of the gpios defined in Debug_GPIO_t enum to be set 615 * 616 * @retval None. 617 * 618 * @note : some of the signals can be mapped to physical hardware and some may not be connected to a physical GPIO based in availability. 619 */ 620 void bsp_debug_gpio_set(Debug_GPIO_t gpio); 621 622 /** 623 * @brief a function to clear a certain gpio pin. 624 * 625 * @param gpio[in]: one of the gpios defined in Debug_GPIO_t enum to be cleared 626 * 627 * @retval None. 628 * 629 * @note : some of the signals can be mapped to physical hardware and some may not be connected to a physical GPIO based in availability. 630 */ 631 void bsp_debug_gpio_clear(Debug_GPIO_t gpio); 632 633 /** 634 * @brief a function to toggle a certain gpio pin. 635 * 636 * @param gpio[in]: one of the gpios defined in Debug_GPIO_t enum to be toggled 637 * 638 * @retval None. 639 * 640 * @note : some of the signals can be mapped to physical hardware and some may not be connected to a physical GPIO based in availability. 641 */ 642 void bsp_debug_gpio_toggle(Debug_GPIO_t gpio); 643 644 /** 645 * @brief a function to inform the upper layer by state of periodic calibration state. 646 * 647 * @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 648 * 649 * @retval None. 650 */ 651 void bsp_set_phy_clbr_state(PhyClbrState state); 652 653 /** 654 * @brief a function to notify the upper layer to switch the clock. 655 * 656 * @param evnt_timing[in]: Evnt_timing_t pointer to structure contains drift time , execution time and scheduling time 657 * 658 * @retval None. 659 */ 660 void bsp_evnt_schldr_timing_update_not(Evnt_timing_t * p_evnt_timing); 661 /** 662 * @} 663 */ 664 665 int logCons(void* devHandle, char* logStr); 666 void* logFileInit(const char * fileName); 667 int logFileClose(void* fileHandle); 668 int logFile(void* devHandle, char* logStr); 669 int logUart(void* devHandle, char* logStr); 670 671 672 void bsp_assert_log(uint8_t condition, uint8_t severity, const char *ptr_func_name, const int line); 673 void bsp_assert(uint8_t condition, uint8_t severity); 674 675 676 677 #endif /* LL_BSP_H_ */ 678