|  | Dual Active Bridge Development Board (Part-No. ) |
Content |  |  |  |  |  |

Loading...
Searching...
No Matches
can1.h
Go to the documentation of this file.
1
17/*
18© [2024] Microchip Technology Inc. and its subsidiaries.
19
20 Subject to your compliance with these terms, you may use Microchip
21 software and any derivatives exclusively with Microchip products.
22 You are responsible for complying with 3rd party license terms
23 applicable to your use of 3rd party software (including open source
24 software) that may accompany Microchip software. SOFTWARE IS ?AS IS.?
25 NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS
26 SOFTWARE, INCLUDING ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT,
27 MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
28 WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
29 INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY
30 KIND WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF
31 MICROCHIP HAS BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE
32 FORESEEABLE. TO THE FULLEST EXTENT ALLOWED BY LAW, MICROCHIP?S
33 TOTAL LIABILITY ON ALL CLAIMS RELATED TO THE SOFTWARE WILL NOT
34 EXCEED AMOUNT OF FEES, IF ANY, YOU PAID DIRECTLY TO MICROCHIP FOR
35 THIS SOFTWARE.
36*/
37
38#ifndef CAN1_H
39#define CAN1_H
40
41// Section: Included Files
42
43#include <xc.h>
44#include <stdbool.h>
45#include <stdint.h>
46#include "can_types.h"
47#include "can_interface.h"
48
49// Section: Data Type Definitions
50
59extern const struct CAN_INTERFACE CAN_FD1;
64#define CAN_FD1_Initialize CAN1_Initialize
69#define CAN_FD1_Deinitialize CAN1_Deinitialize
74#define CAN_FD1_OperationModeSet CAN1_OperationModeSet
79#define CAN_FD1_OperationModeGet CAN1_OperationModeGet
84#define CAN_FD1_Receive CAN1_Receive
89#define CAN_FD1_ReceiveMessageGet CAN1_ReceiveMessageGet
94#define CAN_FD1_RX_FIFO_StatusGet CAN1_RX_FIFO_StatusGet
99#define CAN_FD1_Transmit CAN1_Transmit
104#define CAN_FD1_TransmitFIFOStatusGet CAN1_TransmitFIFOStatusGet
109#define CAN_FD1_IsBusOff CAN1_IsBusOff
114#define CAN_FD1_IsTxErrorPassive CAN1_IsTxErrorPassive
119#define CAN_FD1_IsTxErrorWarning CAN1_IsTxErrorWarning
124#define CAN_FD1_IsTxErrorActive CAN1_IsTxErrorActive
129#define CAN_FD1_IsRxErrorPassive CAN1_IsRxErrorPassive
134#define CAN_FD1_IsRxErrorWarning CAN1_IsRxErrorWarning
139#define CAN_FD1_IsRxErrorActive CAN1_IsRxErrorActive
144#define CAN_FD1_Sleep CAN1_Sleep
149#define CAN_FD1_ReceivedMessageCountGet CAN1_ReceivedMessageCountGet
154#define CAN_FD1_Tasks CAN1_Tasks
159#define CAN_FD1_InvalidMessageCallbackRegister CAN1_InvalidMessageCallbackRegister
164#define CAN_FD1_BusWakeUpActivityCallbackRegister CAN1_BusWakeUpActivityCallbackRegister
169#define CAN_FD1_BusErrorCallbackRegister CAN1_BusErrorCallbackRegister
174#define CAN_FD1_ModeChangeCallbackRegister CAN1_ModeChangeCallbackRegister
179#define CAN_FD1_SystemErrorCallbackRegister CAN1_SystemErrorCallbackRegister
184#define CAN_FD1_TxAttemptCallbackRegister CAN1_TxAttemptCallbackRegister
189#define CAN_FD1_RxBufferOverFlowCallbackRegister CAN1_RxBufferOverFlowCallbackRegister
190
191
196#define CAN1_TX_TXQ CAN1_TXQ
202#define CAN1_RX_FIFO1 CAN1_FIFO_1
207#define CAN1_RX_FIFO2 CAN1_FIFO_2
215 enum CAN1_TX_FIFO_CHANNELS
216{
217 CAN1_TXQ = 0,
218};
219
225 enum CAN1_RX_FIFO_CHANNELS
226{
227 CAN1_FIFO_1 = 1,
228 CAN1_FIFO_2 = 2,
229};
230
231// Section: CAN1 Module APIs
232
239void CAN1_Initialize(void);
240
247void CAN1_Deinitialize(void);
248
257enum CAN_OP_MODE_STATUS CAN1_OperationModeSet(const enum CAN_OP_MODES requestMode);
258
267enum CAN_OP_MODES CAN1_OperationModeGet(void);
268
279bool CAN1_Receive(struct CAN_MSG_OBJ *rxCanMsg);
280
292bool CAN1_ReceiveMessageGet(const enum CAN1_RX_FIFO_CHANNELS fifoChannel, struct CAN_MSG_OBJ *rxCanMsg);
293
304enum CAN_TX_MSG_REQUEST_STATUS CAN1_Transmit(const enum CAN1_TX_FIFO_CHANNELS fifoChannel, struct CAN_MSG_OBJ *txCanMsg);
305
314enum CAN_TX_FIFO_STATUS CAN1_TransmitFIFOStatusGet(const enum CAN1_TX_FIFO_CHANNELS fifoChannel);
315
324bool CAN1_IsBusOff(void);
325
335bool CAN1_IsTxErrorPassive(void);
336
348bool CAN1_IsTxErrorWarning(void);
349
359bool CAN1_IsTxErrorActive(void);
360
370bool CAN1_IsRxErrorPassive(void);
371
383bool CAN1_IsRxErrorWarning(void);
384
394bool CAN1_IsRxErrorActive(void);
395
404void CAN1_Sleep(void);
405
414uint8_t CAN1_ReceivedMessageCountGet(void);
415
425uint8_t CAN1_RX_FIFO_StatusGet(const enum CAN1_RX_FIFO_CHANNELS fifoNum);
426
435void CAN1_Tasks(void);
436
444void CAN1_InvalidMessageCallbackRegister(void (*handler)(void));
445
454 void CAN1_InvalidMessageCallback(void);
455
463void CAN1_BusWakeUpActivityCallbackRegister(void (*handler)(void));
464
473 void CAN1_BusWakeUpActivityCallback(void);
474
482void CAN1_BusErrorCallbackRegister(void (*handler)(void));
483
492 void CAN1_BusErrorCallback(void);
493
501void CAN1_ModeChangeCallbackRegister(void (*handler)(void));
502
511 void CAN1_ModeChangeCallback(void);
512
520void CAN1_SystemErrorCallbackRegister(void (*handler)(void));
521
530 void CAN1_SystemErrorCallback(void);
531
539void CAN1_TxAttemptCallbackRegister(void (*handler)(void));
540
549 void CAN1_TxAttemptCallback(void);
550
558void CAN1_RxBufferOverFlowCallbackRegister(void (*handler)(void));
559
568 void CAN1_RxBufferOverFlowCallback(void);
569#endif //_CAN1_H
CAN1_TX_FIFO_CHANNELS
CAN1_TX_FIFO_CHANNELS
Definition can1.h:216
CAN1_TXQ
@ CAN1_TXQ
Definition can1.h:217
CAN1_RX_FIFO_CHANNELS
CAN1_RX_FIFO_CHANNELS
Definition can1.h:226
CAN1_FIFO_2
@ CAN1_FIFO_2
Definition can1.h:228
CAN1_FIFO_1
@ CAN1_FIFO_1
Definition can1.h:227
can_types.h
This is the generated driver types header file for the CAN driver using CCL.
CAN_TX_FIFO_STATUS
CAN_TX_FIFO_STATUS
Definition can_types.h:166
CAN_OP_MODE_STATUS
CAN_OP_MODE_STATUS
Definition can_types.h:154
CAN_TX_MSG_REQUEST_STATUS
CAN_TX_MSG_REQUEST_STATUS
Definition can_types.h:124
CAN_OP_MODES
CAN_OP_MODES
Definition can_types.h:137
CAN1_ModeChangeCallbackRegister
void CAN1_ModeChangeCallbackRegister(void(*handler)(void))
This function can be used to override default callback and to define custom callback for CAN1_ModeCha...
Definition can1.c:1024
CAN1_RxBufferOverFlowCallbackRegister
void CAN1_RxBufferOverFlowCallbackRegister(void(*handler)(void))
This function can be used to override default callback and to define custom callback for CAN1_RxBuffe...
Definition can1.c:1063
CAN1_TransmitFIFOStatusGet
enum CAN_TX_FIFO_STATUS CAN1_TransmitFIFOStatusGet(const enum CAN1_TX_FIFO_CHANNELS fifoChannel)
Returns the CAN1 transmitter FIFO status.
Definition can1.c:836
CAN1_ReceiveMessageGet
bool CAN1_ReceiveMessageGet(const enum CAN1_RX_FIFO_CHANNELS fifoChannel, struct CAN_MSG_OBJ *rxCanMsg)
Reads the received single message object from the CAN1 receive FIFO.
Definition can1.c:749
CAN1_IsTxErrorActive
bool CAN1_IsTxErrorActive(void)
Returns the transmit error active state.
Definition can1.c:962
CAN1_IsRxErrorWarning
bool CAN1_IsRxErrorWarning(void)
Returns the receive error warning state. If Receiver error counter is above 95 to below 128,...
Definition can1.c:936
CAN1_TxAttemptCallback
void CAN1_TxAttemptCallback(void)
This is the default callback with weak attribute. The user can override and implement the default cal...
CAN_FD1
const struct CAN_INTERFACE CAN_FD1
Structure object of type CAN_INTERFACE with the custom name given by the user in the Melody Driver Us...
Definition can1.c:83
CAN1_Sleep
void CAN1_Sleep(void)
Sets the CAN node in sleep mode.
Definition can1.c:973
CAN1_RX_FIFO_StatusGet
uint8_t CAN1_RX_FIFO_StatusGet(const enum CAN1_RX_FIFO_CHANNELS fifoNum)
This returns the CAN1 receive FIFO status.
Definition can1.c:904
CAN1_Receive
bool CAN1_Receive(struct CAN_MSG_OBJ *rxCanMsg)
Reads the received single message object.
Definition can1.c:703
CAN1_BusErrorCallbackRegister
void CAN1_BusErrorCallbackRegister(void(*handler)(void))
This function can be used to override default callback and to define custom callback for CAN1_BusErro...
Definition can1.c:1011
CAN1_SystemErrorCallbackRegister
void CAN1_SystemErrorCallbackRegister(void(*handler)(void))
This function can be used to override default callback and to define custom callback for CAN1_SystemE...
Definition can1.c:1037
CAN1_BusWakeUpActivityCallback
void CAN1_BusWakeUpActivityCallback(void)
This is the default callback with weak attribute. The user can override and implement the default cal...
CAN1_IsRxErrorActive
bool CAN1_IsRxErrorActive(void)
Returns the receive error active state.
Definition can1.c:941
CAN1_Tasks
void CAN1_Tasks(void)
This routine is used to implement the tasks for polled implementations.
Definition can1.c:1092
CAN1_SystemErrorCallback
void CAN1_SystemErrorCallback(void)
This is the default callback with weak attribute. The user can override and implement the default cal...
CAN1_IsRxErrorPassive
bool CAN1_IsRxErrorPassive(void)
Returns the receive error passive state.
Definition can1.c:931
CAN1_ModeChangeCallback
void CAN1_ModeChangeCallback(void)
This is the default callback with weak attribute. The user can override and implement the default cal...
CAN1_InvalidMessageCallback
void CAN1_InvalidMessageCallback(void)
This is the default callback with weak attribute. The user can override and implement the default cal...
CAN1_IsTxErrorWarning
bool CAN1_IsTxErrorWarning(void)
Returns the transmit error warning state. If Transmitter error counter is above 95 to below 128,...
Definition can1.c:957
CAN1_IsTxErrorPassive
bool CAN1_IsTxErrorPassive(void)
Returns the transmit error passive state.
Definition can1.c:952
CAN1_ReceivedMessageCountGet
uint8_t CAN1_ReceivedMessageCountGet(void)
Returns the number of CAN messages received in all the FIFO.
Definition can1.c:854
CAN1_IsBusOff
bool CAN1_IsBusOff(void)
Returns the bus off status.
Definition can1.c:926
CAN1_BusErrorCallback
void CAN1_BusErrorCallback(void)
This is the default callback with weak attribute. The user can override and implement the default cal...
CAN1_RxBufferOverFlowCallback
void CAN1_RxBufferOverFlowCallback(void)
This is the default callback with weak attribute. The user can override and implement the default cal...
CAN1_Transmit
enum CAN_TX_MSG_REQUEST_STATUS CAN1_Transmit(const enum CAN1_TX_FIFO_CHANNELS fifoChannel, struct CAN_MSG_OBJ *txCanMsg)
Writes the CAN message object to specified transmit FIFO channel.
Definition can1.c:788
CAN1_Initialize
void CAN1_Initialize(void)
Initializes CAN1 module.
Definition can1.c:581
CAN1_InvalidMessageCallbackRegister
void CAN1_InvalidMessageCallbackRegister(void(*handler)(void))
This function can be used to override default callback and to define custom callback for CAN1_Invalid...
Definition can1.c:985
CAN1_BusWakeUpActivityCallbackRegister
void CAN1_BusWakeUpActivityCallbackRegister(void(*handler)(void))
This function can be used to override default callback and to define custom callback for CAN1_BusWake...
Definition can1.c:998
CAN1_Deinitialize
void CAN1_Deinitialize(void)
Deinitializes CAN1 to POR values.
Definition can1.c:624
CAN1_OperationModeGet
enum CAN_OP_MODES CAN1_OperationModeGet(void)
Get the CAN1 operation mode.
Definition can1.c:698
CAN1_TxAttemptCallbackRegister
void CAN1_TxAttemptCallbackRegister(void(*handler)(void))
This function can be used to override default callback and to define custom callback for CAN1_TxAttem...
Definition can1.c:1050
CAN1_OperationModeSet
enum CAN_OP_MODE_STATUS CAN1_OperationModeSet(const enum CAN_OP_MODES requestMode)
Sets the CAN1 operation mode.
Definition can1.c:671
CAN_INTERFACE
Structure containing the function pointers of CAN driver.
Definition can_interface.h:55
CAN_MSG_OBJ
This data structure used to configure the CAN FD message object.
Definition can_types.h:68