-
Notifications
You must be signed in to change notification settings - Fork 2
/
Can.h
95 lines (56 loc) · 3.14 KB
/
Can.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#ifndef CAN_H_
#define CAN_H_
#include"ComStack_Types.h"
#include"Can_GeneralTypes.h"
#include"Can_Cfg.h"
#include"Can_Reg.h"
#include "UTILES.h"
#include "Can_Definitions.h"
FUNC(void, Can_CODE) Can_Init( const Can_ConfigType* Config ); //This function initializes the module.
FUNC(void, Can_CODE) Can_DeInit( void ); //This function de-initializes the module.
#if CanSetBaudrateApi==STD_ON
FUNC(Std_ReturnType,Can_CODE) Can_SetBaudrate( uint8 Controller, uint16 BaudRateConfigID );
//This service shall set the baud rate configuration of the CAN controller.
#endif
FUNC(Std_ReturnType,Can_CODE) Can_SetControllerMode( uint8 Controller, Can_ControllerStateType Transition);
/*This function performs software triggered state
transitions of the CAN controller State machine*/
#if CanWakeupFunctionalityAPI==True
FUNC(Std_ReturnType,Can_CODE) Can_CheckWakeup( uint8 ControllerId);
#endif
//This function checks if a wakeup has occurred for the given controller.
FUNC(Std_ReturnType,Can_CODE) Can_GetControllerMode( uint8 Controller, Can_ControllerStateType*
ControllerModePtr );
/*This service reports about the current status of the requested CAN controller.*/
FUNC(Std_ReturnType,Can_CODE) Can_Write( Can_HwHandleType Hth, const Can_PduType* PduInfo );
//This function is called by CanIf to pass a CAN message to CanDrv for transmission.
FUNC(void,Can_CODE) Can_DisableControllerInterrupts( uint8 Controller );
//This function disable all Can interrupts is mainly used entering exclusive section
FUNC(void,Can_CODE) Can_EnableControllerInterrupts( uint8 Controller );
//This function Enable all Can interrupts to enable the interrupts it should be called the same number as
//Can_DisableControllerInterrupts
FUNC(Std_ReturnType,Can_CODE) Can_GetControllerErrorState( uint8 ControllerId, Can_ErrorStateType*ErrorStatePtr );
//This service obtains the error state of the CAN controller.
/***************************Scheduled functions*****************************************/
#if CanTxProcessing == POLLING
FUNC(void,Can_CODE) Can_MainFunction_Write( void );
//This function performs the polling of TX confirmation when CAN_TX_PROCESSING is set to POLLING.
#endif
#if CanRxProcessing==POLLING
FUNC(void,Can_CODE) Can_MainFunction_Read( void );
//This function performs the polling of RX indications when CAN_RX_PROCESSING is set to POLLING.
#endif
#if CanBusoffProcessing==POLLING
FUNC(void,Can_CODE) Can_MainFunction_BusOff( void );
//This function performs the polling of bus-off events that are configured statically as 'to be polled'.
#endif
#if CanWakeupProcessing == POLLING
FUNC(void,Can_CODE) Can_MainFunction_Wakeup( void );
//This function performs the polling of wake-up events that are configured statically as 'to be polled'.
#endif
FUNC(void,Can_CODE) Can_MainFunction_Mode( void );
//This function performs the polling of CAN controller mode transitions.
/*****************************************************************************************/
/*Can ISR*/
//FUNC(void, Can_CODE) CANIntHandler( void);
#endif