1 /* 2 * Copyright 2021-2023 NXP 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 7 #ifndef CANEXCEL_IP_H_ 8 #define CANEXCEL_IP_H_ 9 10 /** 11 * @file CanEXCEL_Ip.h 12 * 13 * @addtogroup CanEXCEL 14 * @{ 15 */ 16 17 #ifdef __cplusplus 18 extern "C"{ 19 #endif 20 /*================================================================================================== 21 * INCLUDE FILES 22 * 1) system and project includes 23 * 2) needed interfaces from external units 24 * 3) internal and external interfaces from this unit 25 ==================================================================================================*/ 26 #include "CanEXCEL_Ip_DevReg.h" 27 #include "CanEXCEL_Ip_Types.h" 28 29 /*================================================================================================== 30 * SOURCE FILE VERSION INFORMATION 31 ==================================================================================================*/ 32 #define CANEXCEL_IP_VENDOR_ID_H 43 33 #define CANEXCEL_IP_AR_RELEASE_MAJOR_VERSION_H 4 34 #define CANEXCEL_IP_AR_RELEASE_MINOR_VERSION_H 7 35 #define CANEXCEL_IP_AR_RELEASE_REVISION_VERSION_H 0 36 #define CANEXCEL_IP_SW_MAJOR_VERSION_H 1 37 #define CANEXCEL_IP_SW_MINOR_VERSION_H 0 38 #define CANEXCEL_IP_SW_PATCH_VERSION_H 0 39 40 /*================================================================================================== 41 * FILE VERSION CHECKS 42 ==================================================================================================*/ 43 /* Check if current file and CanEXCEL_Ip_Types.h are of the same vendor */ 44 #if (CANEXCEL_IP_VENDOR_ID_H != CANEXCEL_IP_TYPES_VENDOR_ID_H) 45 #error "CanEXCEL_Ip.h and CanEXCEL_Ip_Types.h have different vendor ids" 46 #endif 47 /* Check if current file and CanEXCEL_Ip_Types.h are of the same Autosar version */ 48 #if ((CANEXCEL_IP_AR_RELEASE_MAJOR_VERSION_H != CANEXCEL_IP_TYPES_AR_RELEASE_MAJOR_VERSION_H) || \ 49 (CANEXCEL_IP_AR_RELEASE_MINOR_VERSION_H != CANEXCEL_IP_TYPES_AR_RELEASE_MINOR_VERSION_H) || \ 50 (CANEXCEL_IP_AR_RELEASE_REVISION_VERSION_H != CANEXCEL_IP_TYPES_AR_RELEASE_REVISION_VERSION_H) \ 51 ) 52 #error "AutoSar Version Numbers of CanEXCEL_Ip.h and CanEXCEL_Ip_Types.h are different" 53 #endif 54 /* Check if current file and CanEXCEL_Ip_Types.h are of the same Software version */ 55 #if ((CANEXCEL_IP_SW_MAJOR_VERSION_H != CANEXCEL_IP_TYPES_SW_MAJOR_VERSION_H) || \ 56 (CANEXCEL_IP_SW_MINOR_VERSION_H != CANEXCEL_IP_TYPES_SW_MINOR_VERSION_H) || \ 57 (CANEXCEL_IP_SW_PATCH_VERSION_H != CANEXCEL_IP_TYPES_SW_PATCH_VERSION_H) \ 58 ) 59 #error "Software Version Numbers of CanEXCEL_Ip.h and CanEXCEL_Ip_Types.h are different" 60 #endif 61 /*================================================================================================== 62 * CONSTANTS 63 ==================================================================================================*/ 64 65 /*================================================================================================== 66 * DEFINES AND MACROS 67 ==================================================================================================*/ 68 #define CANEXCEL_IP_MB_RXFIFO 255U 69 /*================================================================================================== 70 * GLOBAL VARIABLE DECLARATIONS 71 ==================================================================================================*/ 72 #define CAN_43_CANEXCEL_START_SEC_CONFIG_DATA_UNSPECIFIED 73 #include "Can_43_CANEXCEL_MemMap.h" 74 /* Calling the external Configuration symbols defined by CanExcel_Ip_Cfg.h */ 75 CANEXCEL_IP_CONFIG_EXT 76 #define CAN_43_CANEXCEL_STOP_SEC_CONFIG_DATA_UNSPECIFIED 77 #include "Can_43_CANEXCEL_MemMap.h" 78 79 #define CAN_43_CANEXCEL_START_SEC_VAR_CLEARED_UNSPECIFIED 80 #include "Can_43_CANEXCEL_MemMap.h" 81 CANEXCEL_IP_STATE_EXT 82 #define CAN_43_CANEXCEL_STOP_SEC_VAR_CLEARED_UNSPECIFIED 83 #include "Can_43_CANEXCEL_MemMap.h" 84 /*================================================================================================== 85 * FUNCTION PROTOTYPES 86 ==================================================================================================*/ 87 #define CAN_43_CANEXCEL_START_SEC_CODE 88 #include "Can_43_CANEXCEL_MemMap.h" 89 /** 90 * @brief Initializes the CanEXCEL peripheral. 91 * @details This function will config CanEXCEL module and will leave the module in freeze mode. 92 * @param[in] instance A CanEXCEL instance number 93 * @param[in\out] pState Pointer to the CanEXCEL driver state structure. 94 * @param[in] Config The CanEXCEL platform configuration data 95 * @return CANEXCEL_STATUS_SUCCESS if successfull;<br> 96 * CANEXCEL_STATUS_ERROR if other error occurred;<br> 97 * CANEXCEL_STATUS_TIMEOUT if fail to configure in configured timeout value.<br> 98 */ 99 Canexcel_Ip_StatusType Canexcel_Ip_Init(uint8 instance, const Canexcel_Ip_ConfigType * Config, Canexcel_Ip_StateType * pState); 100 /** 101 * @brief Sets the CanEXCEL Rx individual mask for descriptor 102 * @details This function will set directly the mask value as is provided. 103 * @param[in] instance A CanEXCEL instance number 104 * @param[in] descNo Index of the message descriptor 105 * @param[in] frameType Message format type 106 * @param[in] mask Mask value 107 * @note This function should be called from StopMode or FreezeMode. 108 * @return CANEXCEL_STATUS_SUCCESS if successful;<br> 109 * CANEXCEL_STATUS_ERROR if the instance is not in Freeze Mode. 110 */ 111 Canexcel_Ip_StatusType Canexcel_Ip_SetRxIndividualMask(uint8 instance, uint8 descNo, Canexcel_Ip_FrameType frameType, uint32 mask); 112 /** 113 * @brief CanEXCEL config XL Message for Tx with Id, SDT, VCAN, length 114 * @details This function will config transmit parameters form Canexcel_DataInfoType and 115 * the message Id 116 * @param[in] instance A CanEXCEL instance number 117 * @param[in] mbIdx Index of the message descriptor 118 * @param[in] id ID of the message to transmit 119 * @param[in] info Data info 120 * @param[in\out] TxMsg The CanEXCEL transmit message buffer pointer. 121 * @return none 122 */ 123 void Canexcel_Ip_ConfigXlTx(uint8 instance, uint8 mbIdx, uint32 id,const Canexcel_Ip_DataInfoType * info, Canexcel_TxXlMsgType * TxMsg); 124 /** 125 * @brief CanEXCEL receive message descriptor field configuration 126 * @details This function will config receive parameters form Canexcel_DataInfoType and 127 * the message Id, and can overwritte another MB status. 128 * @param[in] instance A CanEXCEL instance number 129 * @param[in] descNo Index of the message descriptor 130 * @param[in] info Data info 131 * @param[in] msg_id ID of the message to transmit 132 * @return CANEXCEL_STATUS_SUCCESS if successful;<br> 133 * CANEXCEL_STATUS_TIMEOUT if fail to configure in configured timeout value.<br> 134 * CANEXCEL_STATUS_BUSY if the descriptor is full. 135 */ 136 Canexcel_Ip_StatusType Canexcel_Ip_ConfigRx(uint8 instance, uint8 descNo, uint32 msgId,const Canexcel_Ip_DataInfoType * info); 137 /** 138 * @brief Set the CanEXCEL message buffer storage pointer for the descriptor 139 * @details This function will config receive message address for the descriptor where the CanEXCEL to store the received data. 140 * @param[in] instance A CanEXCEL instance number 141 * @param[in] descNo Index of the message descriptor 142 * @param[in] rxPtrList Pointer to the message buffer 143 * @return CANEXCEL_STATUS_SUCCESS if successful;<br> 144 * CANEXCEL_STATUS_TIMEOUT if fail to configure in configured timeout value.<br> 145 * CANEXCEL_STATUS_ERROR if the descriptor is not empty or inactive. 146 */ 147 Canexcel_Ip_StatusType Canexcel_Ip_RxDescriptor(uint8 instance, uint8 descNo, uint32 rxPtrList); 148 149 /** 150 * @brief Set the CanEXCEL message buffer storage pointer for the descriptor 151 * @details This function will config transmit message address for the descriptor where the CanEXCEL data to be sent are stored. 152 * @param[in] instance A CanEXCEL instance number 153 * @param[in] descNo Index of the message descriptor 154 * @param[in] txPtrList Pointer to the message buffer in ram 155 * @return CANEXCEL_STATUS_SUCCESS if successful;<br> 156 * CANEXCEL_STATUS_TIMEOUT if fail to configure in configured timeout value.<br> 157 * CANEXCEL_STATUS_ERROR if the descriptor is not empty or inactive. 158 */ 159 Canexcel_Ip_StatusType Canexcel_Ip_TxDescriptor(uint8 instance, uint8 descNo, uint32 txPtrList); 160 /** 161 * @brief Receives a CAN Classic or FD frame using the specified message buffer. 162 * @details This function receives a CAN frame using a configured message descriptor. The function 163 * returns immediately. 164 * @param[in] instance A CanEXCEL instance number 165 * @param[in] descNo Index of the message descriptor 166 * @param[out] RxMsg The CanEXCEL receive message buffer pointer. 167 * @param[in] isPolling If the message will be received using pooling(true) or interrupt(false). 168 * @return CANEXCEL_STATUS_SUCCESS if successful;<br> 169 * CANEXCEL_STATUS_TIMEOUT if fail to configure in configured timeout value.<br> 170 * CANEXCEL_STATUS_ERROR if the descriptor is not empty or inactive. 171 */ 172 Canexcel_Ip_StatusType Canexcel_Ip_ReceiveFD(uint8 instance, uint8 descNo, const Canexcel_RxFdMsg * RxMsg, boolean isPolling); 173 /** 174 * @brief Receives a CAN XL frame using the specified message buffer. 175 * @details This function receives a CAN frame using a configured message descriptor. The function 176 * returns immediately. 177 * @param[in] instance A CanEXCEL instance number 178 * @param[in] descNo Index of the message descriptor 179 * @param[out] RxMsg The CanEXCEL receive message buffer pointer. 180 * @param[in] isPolling If the message will be received using pooling(true) or interrupt(false). 181 * @return CANEXCEL_STATUS_SUCCESS if successful;<br> 182 * CANEXCEL_STATUS_TIMEOUT if fail to configure in configured timeout value.<br> 183 * CANEXCEL_STATUS_ERROR if the descriptor is not empty or inactive. 184 */ 185 Canexcel_Ip_StatusType Canexcel_Ip_ReceiveXL(uint8 instance, uint8 descNo, const Canexcel_RxXlMsg * RxMsg, boolean isPolling); 186 /** 187 * @brief Sends a CAN Classic or FD frame using the specified message buffer. 188 * @details This function configure parameters form Canexcel_DataInfoType, ID and sends data as CAN frame using a specified message buffer. 189 * @note This function doesn't support to work with Transceiver mode PWM. 190 * @param[in] instance A CanEXCEL instance number 191 * @param[in] mbIdx Index of the message descriptor 192 * @param[in] info Data info 193 * @param[in] id ID of the message to transmit 194 * @param[in] dataPtr Data Bytes of the CAN message . 195 * @param[in] TxMsg Pointer of the FD Tx Message. 196 * @return CANEXCEL_STATUS_SUCCESS if successful;<br> 197 * CANEXCEL_STATUS_TIMEOUT if fail to configure in configured timeout value.<br> 198 * CANEXCEL_STATUS_ERROR if listen only mode or PWM transceiver mode is active. 199 */ 200 Canexcel_Ip_StatusType Canexcel_Ip_SendFDMsg(uint8 instance, uint8 mbIdx,const Canexcel_Ip_DataInfoType * info, uint32 id,const uint8 * dataPtr, Canexcel_TxFdMsgType * TxMsg); 201 /** 202 * @brief Sends a CAN XL frame using the specified message buffer. 203 * @details This function configure parameters form Canexcel_DataInfoType, ID and sends data as CAN frame using a specified message buffer. 204 * @param[in] instance A CanEXCEL instance number 205 * @param[in] mbIdx Index of the message descriptor 206 * @param[in] info Data info 207 * @param[in] id ID of the message to transmit 208 * @param[in] dataPtr Data Bytes of the CAN message . 209 * @param[in] TxMsg Pointer of the XL Tx Message. 210 * @return CANEXCEL_STATUS_SUCCESS if successful;<br> 211 * CANEXCEL_STATUS_TIMEOUT if fail to configure in configured timeout value.<br> 212 * CANEXCEL_STATUS_ERROR if listen only mode is active. 213 */ 214 Canexcel_Ip_StatusType Canexcel_Ip_SendXLMsg(uint8 instance, uint8 mbIdx,const Canexcel_Ip_DataInfoType * info, uint32 id,const uint8 * dataPtr, Canexcel_TxXlMsgType * TxMsg); 215 /** 216 * @brief Returns whether the previous CanEXCEL transfer has finished. 217 * 218 * When performing an async transfer, call this function to ascertain the state of the 219 * current transfer: in progress (or busy) or complete (success). 220 * 221 * @param[in] instance The CanEXCEL instance number. 222 * @param[in] descIdx The index of the message descriptor. 223 * @return CANEXCEL_STATUS_NO_TRANSFER_IN_PROGRESS if no transfer initiated; 224 * CANEXCEL_STATUS_BUSY if a resource is busy; 225 * CANEXCEL_STATUS_ERROR in case of a OverRun error transfer; 226 * CANEXCEL_STATUS_SUCCESS if a successful transfer finished. 227 */ 228 Canexcel_Ip_StatusType Canexcel_Ip_GetTransferStatus(uint8 instance, uint8 descIdx); 229 /** 230 * @brief Enter CanEXCEL Module in Freeze Mode. 231 * @details This function will suspend bus activity of CanEXCEL module and 232 * set it to Freeze Mode to allow module configuration. 233 * @param[in] instance A CanEXCEL instance number 234 * @return CANEXCEL_STATUS_SUCCESS if successful;<br> 235 * CANEXCEL_STATUS_TIMEOUT if fail to configure in the configured timeout value.<br> 236 * 237 */ 238 Canexcel_Ip_StatusType Canexcel_Ip_EnterFreezeMode(uint8 instance); 239 /** 240 * @brief Exit CanEXCEL Module from Freeze Mode. 241 * @details This function will allow CanEXCEL module to participate to the BUS activity and 242 * restore normal opertaion of the driver. 243 * @param[in] instance A CanEXCEL instance number 244 * @note This function should be called from FreezeMode. 245 * @return CANEXCEL_STATUS_SUCCESS if successful;<br> 246 * CANEXCEL_STATUS_TIMEOUT if fail to configure in the configured timeout value.<br> 247 * 248 */ 249 Canexcel_Ip_StatusType Canexcel_Ip_ExitFreezeMode(uint8 instance); 250 /** 251 * @brief Check a receive event. 252 * @details This will check if message is received and read the message buffer or RxFifo. 253 * @param[in] instance A CanEXCEL instance number 254 * @param[in] mb_idx Index of the message buffer 255 */ 256 void Canexcel_Ip_MainFunctionRead(uint8 instance, uint8 mb_idx); 257 /** 258 * @brief Check a Transmission event. 259 * @details This function will check a specific Message Descriptor have been sent of CanEXCEL module and 260 * if was sent will reset the status of Mb and clear the status flag. 261 * @param[in] instance A CanEXCEL instance number 262 * @param[in] mb_idx message buffer number 263 * 264 */ 265 void Canexcel_Ip_MainFunctionWrite(uint8 instance, uint8 mb_idx); 266 /** 267 * @brief CanEXCEL Rx FIFO field configuration 268 * @note This function requires the module to be in Stop or Freeze Mode. 269 * @param[in] instance A CanEXCEL instance number 270 * @param[in] filterConfig Pointer to the filter configuration structure. 271 * @return CANEXCEL_STATUS_ERROR if the RxFifo wasn't activated by CanExcel_Init, or the CanExcel instance is not in freeze mode; 272 * CANEXCEL_STATUS_SUCCESS if successful. 273 */ 274 Canexcel_Ip_StatusType Canexcel_Ip_ConfigRxFifo(uint8 instance,const Canexcel_Ip_RxFifoFilter * filterConfig); 275 /** 276 * @brief Set the CanEXCEL instance in STOP mode 277 * @details Set the CanEXCEL instance in STOP mode, this will prevent instance to participate to 278 * bus transactions and allow configuration of the module. 279 * @param[in] instance A CanEXCEL instance number 280 * @return CANEXCEL_STATUS_SUCCESS if successful;<br> 281 * CANEXCEL_STATUS_TIMEOUT if fail to configure in configured timeout value.<br> 282 */ 283 Canexcel_Ip_StatusType Canexcel_Ip_SetStopMode(uint8 instance); 284 /** 285 * @brief Get Stop Mode Status 286 * @details Return if the instance is in Stop Mode 287 * @param[in] instance A CanEXCEL instance number 288 * @return True instance is in STOP Mode 289 * False instance is not in STOP Mode 290 */ 291 boolean Canexcel_Ip_GetStopMode(uint8 instance); 292 /** 293 * @brief Get Start Mode Status 294 * @details Return if the instance is in Start Mode 295 * @param[in] instance A CanEXCEL instance number 296 * @return True instance is in START Mode 297 * False instance is not in START Mode 298 * 299 */ 300 boolean Canexcel_Ip_GetStartMode(uint8 instance); 301 /** 302 * @brief Enable all interrupts configured. 303 * @details Enable all interrupts configured. 304 * @param[in] u8Instance A CanEXCEL instance number 305 * @return CANEXCEL_STATUS_SUCCESS if successful operation;<br> 306 * CANEXCEL_STATUS_ERROR if the module is not in freeze Mode;<br> 307 */ 308 Canexcel_Ip_StatusType Canexcel_Ip_EnableInterrupts(uint8 u8Instance); 309 /** 310 * @brief Disable all interrupts. 311 * @details Disable all interrupts. 312 * @param[in] u8Instance A CanEXCEL instance number 313 * @return CANEXCEL_STATUS_SUCCESS if successful operation;<br> 314 * CANEXCEL_STATUS_ERROR if the module is not in freeze Mode;<br> 315 */ 316 Canexcel_Ip_StatusType Canexcel_Ip_DisableInterrupts(uint8 u8Instance); 317 #if (CANEXCEL_IP_HAS_TS_ENABLE == STD_ON) 318 /*! 319 * @brief This function configure the timestamp settings. 320 * 321 * This function will allow to set the timestamp timer source and config the 322 * timer selected capture point for timestamp. 323 * @note Need enable clock counter for the source selected before use Time Stamp. 324 * 325 * @param[in] instance A CanEXCEL instance number 326 * @param[in] time_stamp A timestamp configuration structure 327 * @return CANEXCEL_STATUS_SUCCESS if successful operation;<br> 328 * CANEXCEL_STATUS_ERROR if the module is not in freeze Mode;<br> 329 */ 330 Canexcel_Ip_StatusType Canexcel_Ip_ConfigTimeStamp(uint8 instance, const Canexcel_Ip_TimeStampConf_Type * time_stamp); 331 #endif 332 /** 333 * @brief Check if the descriptor is configured for reception of XL frame or not. 334 * 335 * @param[in] u8Instance A CanEXCEL instance number 336 * @param[in] descNo A CanEXCEL decriptor number 337 */ 338 boolean Canexcel_Ip_IsXLFrameType(uint8 instance, uint8 descNo); 339 /** 340 * @brief Enable\Disable an Error Interrupt 341 * @note This function need to be call after the CANXL Instance is in FreezeMode 342 * 343 * @param[in] u8Instance A CanEXCEL instance number 344 * @param[in] type Error type for wich to cofig the Interrupt 345 * @param[in] enable TRUE will Enable the interrupt\FALSE will disable the interrupt 346 * 347 * @return CANEXCEL_STATUS_SUCCESS Configured successfully.<br> 348 * CANEXCEL_STATUS_ERROR Either interface is not in Freeze mode or not a valid error type.<br> 349 */ 350 Canexcel_Ip_StatusType Canexcel_Ip_SetErrorInt(uint8 u8Instance, Canexcel_Ip_ErrorIntType type, boolean enable); 351 /** 352 * @brief Get the TxError Counter 353 * 354 * @param[in] instance A CanEXCEL instance number 355 * @param[out] pValue Pointer to a variable to return the TxError Counter Value 356 * @return CANEXCEL_STATUS_ERROR It can not update and get the TxError Status 357 * CANEXCEL_STATUS_TIMEOUT The device fail to react in configured time 358 * CANEXCEL_STATUS_SUCCESS Successfully get the TxError counter value 359 */ 360 Canexcel_Ip_StatusType Canexcel_Ip_GetControllerTxErrorCounter(uint8 instance, uint8 * pValue); 361 /** 362 * @brief Get the RxError Counter. 363 * 364 * @param[in] instance A CanEXCEL instance number 365 * @param[out] pValue Pointer to a variable to return the RxError Counter Value 366 * @return CANEXCEL_STATUS_ERROR It can not update and get the RxError Status 367 * CANEXCEL_STATUS_TIMEOUT The device fail to react in configured time 368 * CANEXCEL_STATUS_SUCCESS Successfully get the RxError counter value 369 */ 370 Canexcel_Ip_StatusType Canexcel_Ip_GetControllerRxErrorCounter(uint8 instance, uint8 * pValue); 371 /** 372 * @brief Get the CanEXCEL Controller Status. 373 * 374 * @param[in] instance A CanEXCEL instance number 375 * @param[out] pValue Pointer to a variable to return the Controller Status 376 * @return CANEXCEL_STATUS_ERROR It can not update and get the Status 377 * CANEXCEL_STATUS_TIMEOUT The device fail to react in configured time 378 * CANEXCEL_STATUS_SUCCESS Successfully update and get the Controller Status 379 */ 380 Canexcel_Ip_StatusType Canexcel_Ip_GetControllerStatus(uint8 instance, uint8 * pValue); 381 /** 382 * @brief Clear Error Status of CanEXCEL 383 * @details This function will clear the error status from SYSS register in SIC module. 384 * For exact mapping of errors please refere to RM(Reference Manual) 385 * on CanEXCEL SIC->SYSS register description. 386 * @param[in] instance: A CanEXCEL instance number 387 * @param[in] error: errors flags to be cleared 388 */ 389 void Canexcel_Ip_ClearErrorStatus(uint8 instance, uint32 error); 390 /** 391 * @brief Check a bus-off event. 392 * @details This function will update the CanEXCEL Status and check bus activity of CanEXCEL module and 393 * if a bus off event is detected will report it through callback CANEXCEL_EVENT_BUSOFF. 394 * @param[in] instance A CanEXCEL instance number 395 * @return CANEXCEL_STATUS_SUCCESS if successful busoff and sucessfully update the status<br> 396 * CANEXCEL_STATUS_ERROR if no busoff event detected;<br> 397 * CANEXCEL_STATUS_TIMEOUT if fail to get the status in configured time<br> 398 * 399 */ 400 Canexcel_Ip_StatusType Canexcel_Ip_MainFunctionBusOff(uint8 instance); 401 /*! 402 * @brief Recover manually from bus-off if possible. 403 * @note This function should be used when bus-off auto recovery disabled and controller is in START mode. 404 * The function Canexcel_Ip_GetErrorStatus can be used to check FLTCONF bits to check if bus-off state is exited or not. 405 * 406 * @param[in] instance A CanEXCEL instance number 407 * @return CANEXCEL_STATUS_SUCCESS if successful operation or the controller wasn't in bus-off.<br> 408 * CANEXCEL_STATUS_ERROR if bus-off auto recovery enabled.<br> 409 * CANEXCEL_STATUS_TIMEOUT if fail to recover in configured time<br> 410 */ 411 Canexcel_Ip_StatusType Canexcel_Ip_ManualBusOffRecovery(uint8 instance); 412 /** 413 * @brief Sets the bit rate for the data phase of FD frames. 414 * @details This function requests the CanExcel module to be Freeze Mode and FD mode enabled. 415 * @param[in] Instance CanExcel instance number. 416 * @param[in] TimeSeg Pointer to the bit rate settings. 417 * @param[in] BitRateSwitch Enable/disable bit rate switching. 418 * @return CANEXCEL_STATUS_SUCCESS if successful;<br> 419 * CANEXCEL_STATUS_ERROR if fail to set;<br> 420 */ 421 Canexcel_Ip_StatusType Canexcel_Ip_SetFDBaudRate(uint8 Instance, const Canexcel_Ip_TimeSegmentType * TimeSeg, boolean BitRateSwitch); 422 /** 423 * @brief Sets the bit rate for the data phase of XL frames. 424 * @details This function requests the CanExcel module to be Freeze Mode and XL mode enabled. 425 * @param[in] Instance CanExcel instance number. 426 * @param[in] TimeSeg Pointer to the bit rate settings. 427 * @return CANEXCEL_STATUS_SUCCESS if successful;<br> 428 * CANEXCEL_STATUS_ERROR if fail to set;<br> 429 */ 430 Canexcel_Ip_StatusType Canexcel_Ip_SetXLBaudRate(uint8 Instance, const Canexcel_Ip_TimeSegmentType * TimeSeg); 431 /** 432 * @brief Sets the bit rate for the nomimal phase of classical frame and in the arbitration phase of a FD or XL frame. 433 * @details This function requests the CanExcel module to be Freeze Mode. 434 * @param[in] Instance CanExcel instance number. 435 * @param[in] TimeSeg Pointer to the bit rate settings. 436 * @return CANEXCEL_STATUS_SUCCESS if successful;<br> 437 * CANEXCEL_STATUS_ERROR if fail to set;<br> 438 */ 439 Canexcel_Ip_StatusType Canexcel_Ip_SetBaudRate(uint8 Instance, const Canexcel_Ip_TimeSegmentType * TimeSeg); 440 /** 441 * @brief Gets the bit rate for the data phase of FD frames. 442 * @details Gets the bit rate for the data phase of FD frames. 443 * @param[in] Instance CanExcel instance number. 444 * @param[out] TimeSeg Pointer to the bit rate settings. 445 */ 446 void Canexcel_Ip_GetFDBaudRate(uint8 Instance, Canexcel_Ip_TimeSegmentType * TimeSeg); 447 /** 448 * @brief Gets the bit rate for the data phase of XL frames. 449 * @details Gets the bit rate for the data phase of XL frames. 450 * @param[in] Instance CanExcel instance number. 451 * @param[out] TimeSeg Pointer to the bit rate settings. 452 */ 453 void Canexcel_Ip_GetXLBaudRate(uint8 Instance, Canexcel_Ip_TimeSegmentType * TimeSeg); 454 /** 455 * @brief Gets the bit rate for the nomimal phase of classical frame and in the arbitration phase of a FD or XL frame. 456 * @details Gets the bit rate for the nomimal phase of classical frame and in the arbitration phase of a FD or XL frame. 457 * @param[in] Instance CanExcel instance number. 458 * @param[out] TimeSeg Pointer to the bit rate settings. 459 */ 460 void Canexcel_Ip_GetBaudRate(uint8 Instance, Canexcel_Ip_TimeSegmentType * TimeSeg); 461 /** 462 * @brief Enable\Disable listen Only Mode 463 * @details This function will Enable or Disable listen Only Mode. 464 * @note This function should be called from FreezeMode. 465 * @param[in] Instance Instance number 466 * @param[in] Enable Enable\Disable Listen Only mode 467 * @return CANEXCEL_STATUS_SUCCESS if successful;<br> 468 * CANEXCEL_STATUS_ERROR if fail to set;<br> 469 * 470 */ 471 Canexcel_Ip_StatusType Canexcel_Ip_SetListenOnlyMode(uint8 Instance, boolean Enable); 472 /** 473 * @brief Get the Status of Listen Only Mode 474 * @details This function will return True if Listen Only Mode 475 * is Enable or False if is Disable. 476 * @param[in] Instance instance number 477 * @return True if Listen Only Mode is Enabled 478 * False if Listen Only Mode is Disabled. 479 * 480 */ 481 boolean Canexcel_Ip_GetListenOnlyMode(uint8 Instance); 482 /** 483 * @brief Enables/Disables the FD Transceiver Delay Compensation feature and sets 484 * the FD Transceiver Delay Compensation Offset. 485 * @details This function request the CanExcel module to be in Freeze Mode. 486 * When the transceiver delay measurement is enabled, the secondary sample point position is determined by the sum of the transceiver delay measurement plus the CAN XL TDC offset. 487 * When the transceiver delay measurement is disabled, the secondary sample point position is determined CAN XL TDC offset only. 488 * @param[in] Instance A CanExcel instance number 489 * @param[in] TDCEnable Enable/Disable Transceiver Delay Compensation 490 * @param[in] TDCMEnable Enable/Disable Transceiver Delay Compensation Measurement 491 * @param[in] Offset Transceiver Delay Compensation Offset 492 * @return CANEXCEL_STATUS_SUCCESS if successful;<br> 493 * CANEXCEL_STATUS_ERROR if fail to set;<br> 494 */ 495 Canexcel_Ip_StatusType Canexcel_Ip_SetTDCOffsetFD(uint8 Instance, boolean TDCEnable, boolean TDCMEnable, uint8 Offset); 496 /** 497 * @brief Enables/Disables the XL Transceiver Delay Compensation feature and sets 498 * the XL Transceiver Delay Compensation Offset. 499 * @details This function request the CanExcel module to be in Freeze Mode. 500 * When the transceiver delay measurement is enabled, the secondary sample point position is determined by the sum of the transceiver delay measurement plus the CAN XL TDC offset. 501 * When the transceiver delay measurement is disabled, the secondary sample point position is determined CAN XL TDC offset only. 502 * @param[in] Instance A CanExcel instance number 503 * @param[in] TDCEnable Enable/Disable Transceiver Delay Compensation 504 * @param[in] TDCMEnable Enable/Disable Transceiver Delay Compensation Measurement 505 * @param[in] Offset Transceiver Delay Compensation Offset 506 * @return CANEXCEL_STATUS_SUCCESS if successful;<br> 507 * CANEXCEL_STATUS_ERROR if fail to set;<br> 508 */ 509 Canexcel_Ip_StatusType Canexcel_Ip_SetTDCOffsetXL(uint8 Instance, boolean TDCEnable, boolean TDCMEnable, uint8 Offset); 510 /** 511 * @brief Configures Pwm phases for Pwm symbol. 512 * @details This function request the CanExcel module to be in Freeze Mode. 513 * @note When PWM mode enabled: 514 * - protocol exception must be enabled also 515 * - PWMS must be in range [1:63] 516 * - PWML must be in range [1:63] 517 * - PWMO must be in range [0:63] 518 * 519 * @param[in] Instance A CanExcel instance number 520 * @param[in] Config Transceiver configuration data 521 * @return CANEXCEL_STATUS_SUCCESS if successful;<br> 522 * CANEXCEL_STATUS_ERROR if fail to set;<br> 523 */ 524 Canexcel_Ip_StatusType Canexcel_Ip_ConfigTransceiverMode(uint8 Instance, const Canexcel_Ip_TransceiverModeType * Config); 525 /** 526 * @brief Configures Acceptance Filters for MDs on FiltersBank0. 527 * @details This function request the CanExcel module to be in Freeze Mode. 528 * @note The filters are for every bank individualy set. 529 * 530 * @param[in] Instance A CanExcel instance number 531 * @param[in] Config Filter configurations for AFs, SDUs and VCANs 532 * @return CANEXCEL_STATUS_SUCCESS if successful;<br> 533 * CANEXCEL_STATUS_ERROR if fail to set;<br> 534 */ 535 Canexcel_Ip_StatusType Canexcel_Ip_ConfigAccFltBank0(uint8 Instance, const Canexcel_Ip_BankFilter * Config); 536 /** 537 * @brief Configures Acceptance Filters for MDs on FiltersBank1. 538 * @details This function request the CanExcel module to be in Freeze Mode. 539 * @note The filters are for every bank individualy set. 540 * 541 * @param[in] Instance A CanExcel instance number 542 * @param[in] Config Filter configurations for AFs, SDUs and VCANs 543 * @return CANEXCEL_STATUS_SUCCESS if successful;<br> 544 * CANEXCEL_STATUS_ERROR if fail to set;<br> 545 */ 546 Canexcel_Ip_StatusType Canexcel_Ip_ConfigAccFltBank1(uint8 Instance, const Canexcel_Ip_BankFilter * Config); 547 /** 548 * @brief Configures Rejection Filters for MDs on FiltersBank0. 549 * @details This function request the CanExcel module to be in Freeze Mode. 550 * @note The filters are for every bank individualy set. 551 * 552 * @param[in] Instance A CanExcel instance number 553 * @param[in] Config Filter configurations for AFs, SDUs and VCANs 554 * @return CANEXCEL_STATUS_SUCCESS if successful;<br> 555 * CANEXCEL_STATUS_ERROR if fail to set;<br> 556 */ 557 Canexcel_Ip_StatusType Canexcel_Ip_ConfigRejFltBank0(uint8 Instance, const Canexcel_Ip_BankFilter * Config); 558 /** 559 * @brief Configures Rejection Filters for MDs on FiltersBank1. 560 * @details This function request the CanExcel module to be in Freeze Mode. 561 * @note The filters are for every bank individualy set. 562 * 563 * @param[in] Instance A CanExcel instance number 564 * @param[in] Config Filter configurations for AFs, SDUs and VCANs 565 * @return CANEXCEL_STATUS_SUCCESS if successful;<br> 566 * CANEXCEL_STATUS_ERROR if fail to set;<br> 567 */ 568 Canexcel_Ip_StatusType Canexcel_Ip_ConfigRejFltBank1(uint8 Instance, const Canexcel_Ip_BankFilter * Config); 569 /** 570 * @brief Configures Acceptance Address filter for a desired filter number 571 * @details This function request the CanExcel module to be in Freeze Mode. 572 * @note If the filter position is higher than the 31 it measn it is alocated in filter bank1 and is position 573 * in the filter bank is (filterNo - 32). If is lower than 32 represents the filter position from bank0. 574 * This function requires CanEXCEL instance to be set in FreezeMode. 575 * @param[in] Instance A CanExcel instance number 576 * @param[in] filterValue Filter configurations for AFs 577 * @param[in\out] filterNo The filer position allocated from memory filter bank 578 * @return CANEXCEL_STATUS_SUCCESS if successful;<br> 579 * CANEXCEL_STATUS_BUFF_OUT_OF_RANGE no available filter postion to set the filter.<br> 580 * CANEXCEL_STATUS_ERROR if fail to set; Because is not in freezeMode;<br> 581 */ 582 Canexcel_Ip_StatusType Canexcel_Ip_ConfigAccAddrFilter(uint8 Instance,const Canexcel_Ip_RxFifoFilterID_ADDR * filterValue, uint8 * filterNo); 583 /** 584 * @brief This function return the HardWare status of a specific Message Descriptor 585 * @param[in] Instance A CanExcel instance number 586 * @param[in] descNo A descriptor Number 587 * @param[in/out] sysPoint Pointer where to return the number of the Pushed Messages in the descriptor 588 * @param[in/out] hwPoint Pointer where to return the number of the HW processed Messages already pushed. 589 * @return CANEXCEL_DESC_STATE_INACTIVE the descriptor is not used. 590 CANEXCEL_DESC_STATE_EMPTY No pushed Messages in descriptor. 591 CANEXCEL_DESC_STATE_NOTFULL Can be push more messages in descriptor 592 CANEXCEL_DESC_STATE_FULL The descriptor is full no more Messages can't be push 593 CANEXCEL_DESC_STATE_OVERRUN Have been pushed more messages than the Depth of the Descriptor. 594 */ 595 Canexcel_Ip_DescState Canexcel_Ip_GetDescriptorStatus(uint8 Instance, uint8 descNo, uint8 * sysPoint, uint8 * hwPoint); 596 /** 597 * @brief This function Enable\Disable Interrput for a specific Message Descriptor 598 * @param[in] Instance A CanExcel instance number 599 * @param[in] descNo A descriptor Number to activate\deactivate interrupt 600 * @param[in] enable TRUE Enables Interrupt 601 * FALSE Disables Interrupt 602 */ 603 void Canexcel_Ip_SetMsgBuffInterrupt(uint8 instance, uint8 descNo, boolean enable); 604 /** 605 * @brief Return the Interrupt Status Flag of a Message Descriptor 606 * @param[in] instance A CanExcel instance number 607 * @param[in] descNo A descriptor Number to activate\deactivate interrupt 608 * @return The Interrupt Status Flag Value. 609 */ 610 uint8 Canexcel_Ip_GetMsgDescIntStatusFlag(uint8 instance, uint8 descNo); 611 /** 612 * @brief De-activates the given Message Descriptor. 613 * @details This function shall de-activate given Message descriptor and it can't participate in the message Tx or Rx process. 614 * @note The system pointer and hardware pointer of the Message descriptor equal to zero after de-activation. 615 * 616 * @param[in] instance A CanExcel instance number 617 * @param[in] descNo the Message Descriptor index 618 * @return CANEXCEL_STATUS_SUCCESS if successful;<br> 619 * CANEXCEL_STATUS_TIMEOUT if fail to set;<br> 620 */ 621 Canexcel_Ip_StatusType Canexcel_Ip_DeactivateMD(uint8 instance, uint8 descNo); 622 /** 623 * @brief DeInitializes the CanEXCEL peripheral. 624 * @details This function will reset CanEXCEL module at reset Values. 625 * @param[in] u8Instance A CanEXCEL instance number 626 * @return CANEXCEL_STATUS_SUCCESS if successfull;<br> 627 * CANEXCEL_STATUS_ERROR if other error occurred;<br> 628 * CANEXCEL_STATUS_TIMEOUT if fail to configure in configured timeout value.<br> 629 */ 630 Canexcel_Ip_StatusType Canexcel_Ip_Deinit(uint8 u8Instance); 631 632 #define CAN_43_CANEXCEL_STOP_SEC_CODE 633 #include "Can_43_CANEXCEL_MemMap.h" 634 #ifdef __cplusplus 635 } 636 #endif /* __cplusplus */ 637 638 /** @} */ 639 640 #endif /* CANEXCEL_IP_H_ */ 641