]> rtime.felk.cvut.cz Git - arc.git/blob - include/CanIf_Types.h
Merge with 3ecb6845e742978827406b7da6f77dc350e6b55b
[arc.git] / include / CanIf_Types.h
1 /* -------------------------------- Arctic Core ------------------------------\r
2  * Arctic Core - the open source AUTOSAR platform http://arccore.com\r
3  *\r
4  * Copyright (C) 2009  ArcCore AB <contact@arccore.com>\r
5  *\r
6  * This source code is free software; you can redistribute it and/or modify it\r
7  * under the terms of the GNU General Public License version 2 as published by the\r
8  * Free Software Foundation; See <http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt>.\r
9  *\r
10  * This program is distributed in the hope that it will be useful, but\r
11  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY\r
12  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License\r
13  * for more details.\r
14  * -------------------------------- Arctic Core ------------------------------*/\r
15 \r
16 /** @addtogroup CanIf CAN Interface\r
17  *  @{ */\r
18 \r
19 /** @file CanIf_Types.h\r
20  *  Definitions of configuration parameters for CAN Interface.\r
21  */\r
22 \r
23 #ifndef CANIF_TYPES_H_\r
24 #define CANIF_TYPES_H_\r
25 \r
26 #include "ComStack_Types.h"\r
27 \r
28 // API service with wrong parameter\r
29 /** @name Error Codes */\r
30 //@{\r
31 #define CANIF_E_PARAM_CANID                   10 \r
32 #define CANIF_E_PARAM_DLC                             11  \r
33 #define CANIF_E_PARAM_HRH                             12 \r
34 #define CANIF_E_PARAM_CHANNEL               13  \r
35 #define CANIF_E_PARAM_CONTROLLER          14  \r
36 #define CANIF_E_PARAM_WAKEUPSOURCE      15  \r
37 \r
38 #define CANIF_E_PARAM_HTH             17 \r
39 #define CANIF_E_PARAM_LPDU            18\r
40 #define CANIF_E_PARAM_CONTROLLER_MODE 19\r
41 \r
42 #define CANIF_E_PARAM_POINTER                     20\r
43 #define CANIF_E_UNINIT                                  30\r
44 #define CANIF_E_NOK_NOSUPPORT                       40\r
45 #define CANIF_TRCV_E_TRCV_NOT_STANDBY   60\r
46 #define CANIF_TRCV_E_TRCV_NOT_NORMAL    70\r
47 #define CANIF_E_INVALID_TXPDUID             80\r
48 #define CANIF_E_INVALID_RXPDUID                   90\r
49 //@}\r
50 \r
51 typedef enum {\r
52         /** UNINIT mode. Default mode of the CAN driver and all\r
53          *  CAN controllers connected to one CAN network after\r
54          *  power on. */\r
55         CANIF_CS_UNINIT = 0,\r
56                                    \r
57         /**  STOPPED mode. At least one of all CAN controllers\r
58          *   connected to one CAN network are halted and does\r
59          *   not operate on the bus. */\r
60         CANIF_CS_STOPPED,                                  \r
61                                    \r
62         /** STARTED mode. All CAN controllers connected to\r
63          *  one CAN network are started by the CAN driver and\r
64          *  in full-operational mode. */\r
65         CANIF_CS_STARTED,\r
66         \r
67         /** SLEEP mode. At least one of all CAN controllers\r
68          *  connected to one CAN network are set into the\r
69          *  SLEEP mode and can be woken up by request of the\r
70          *  CAN driver or by a network event (must be supported\r
71          *  by CAN hardware) */\r
72         CANIF_CS_SLEEP\r
73 } CanIf_ControllerModeType;\r
74 \r
75 /** Status of the PDU channel group. Current mode of the channel defines its\r
76  *  transmit or receive activity. Communication direction (transmission and/or\r
77  *  reception) of the channel can be controlled separately or together by upper\r
78  *  layers. */\r
79 typedef enum {\r
80         /** Channel shall be set to the offline mode\r
81          *  => no transmission and reception */\r
82         CANIF_SET_OFFLINE = 0,\r
83         \r
84         /** Receive path of the corresponding channel\r
85          *  shall be disabled */\r
86         CANIF_SET_RX_OFFLINE,\r
87 \r
88         /** Receive path of the corresponding channel\r
89          *  shall be enabled */\r
90         CANIF_SET_RX_ONLINE,\r
91         \r
92         /** Transmit path of the corresponding channel\r
93          *  shall be disabled */\r
94         CANIF_SET_TX_OFFLINE,\r
95         \r
96         /** Transmit path of the corresponding channel\r
97          *  shall be enabled */\r
98         CANIF_SET_TX_ONLINE,\r
99         \r
100         /** Channel shall be set to online mode\r
101          *  => full operation mode */\r
102         CANIF_SET_ONLINE,\r
103         \r
104         /** Transmit path of the corresponding channel\r
105          *  shall be set to the offline active mode\r
106          *  => notifications are processed but transmit\r
107          *  requests are blocked. */\r
108         CANIF_SET_TX_OFFLINE_ACTIVE\r
109 } CanIf_ChannelSetModeType;\r
110 \r
111 \r
112 typedef enum {\r
113         /** Channel is in the offline mode ==> no transmission or reception */\r
114   CANIF_GET_OFFLINE = 0,\r
115   /** Receive path of the corresponding channel is enabled and\r
116    *  transmit path is disabled */\r
117   CANIF_GET_RX_ONLINE,\r
118   /** Transmit path of the corresponding channel is enabled and\r
119    *  receive path is disabled */\r
120   CANIF_GET_TX_ONLINE,\r
121   /** Channel is in the online mode ==> full operation mode */\r
122   CANIF_GET_ONLINE,\r
123   /** Transmit path of the corresponding channel is in\r
124    *  the offline mode ==> transmit notifications are processed but\r
125    *  transmit requests are blocked. The receiver path is disabled. */\r
126   CANIF_GET_OFFLINE_ACTIVE,\r
127   /** Transmit path of the corresponding channel is in the offline\r
128    *  active mode ==> transmit notifications are processed but transmit\r
129    *  requests are blocked. The receive path is enabled. */\r
130   CANIF_GET_OFFLINE_ACTIVE_RX_ONLINE\r
131         \r
132 } CanIf_ChannelGetModeType;\r
133 \r
134 typedef enum {\r
135         /** No transmit or receive event occurred for\r
136          *  the requested L-PDU. */\r
137         CANIF_NO_NOTIFICATION = 0,      \r
138         /** The requested Rx/Tx CAN L-PDU was\r
139          *  successfully transmitted or received. */\r
140         CANIF_TX_RX_NOTIFICATION\r
141         \r
142 } CanIf_NotifStatusType;\r
143 \r
144 typedef enum {\r
145         /** Transceiver mode NORMAL */\r
146   CANIF_TRCV_MODE_NORMAL = 0,\r
147   /** Transceiver mode STANDBY */\r
148   CANIF_TRCV_MODE_STANDBY,\r
149   /** Transceiver mode SLEEP */\r
150   CANIF_TRCV_MODE_SLEEP\r
151 } CanIf_TransceiverModeType;\r
152 \r
153 typedef enum {\r
154   /** Due to an error wake up reason was not detected.\r
155    *  This value may only be reported when error was\r
156    *  reported to DEM before. */\r
157         CANIF_TRCV_WU_ERROR = 0,\r
158         /** The transceiver does not support any information\r
159          *  for the wakeup reason. */\r
160         CANIF_TRCV_WU_NOT_SUPPORTED,\r
161         /** The transceiver has detected, that the network has\r
162          *  caused the wake up of the ECU */\r
163         CANIF_TRCV_WU_BY_BUS,\r
164         /** The transceiver detected, that the network has woken\r
165          *  the ECU via a request to NORMAL mode */\r
166         CANIF_TRCV_WU_INTERNALLY,\r
167         /** The transceiver has detected, that the "wake up"\r
168          *  is due to an ECU reset */\r
169         CANIF_TRCV_WU_RESET,\r
170         /** The transceiver has detected, that the "wake up"\r
171          *  is due to an ECU reset after power on. */\r
172         CANIF_TRCV_WU_POWER_ON\r
173 } CanIf_TrcvWakeupReasonType;\r
174 \r
175 typedef enum {\r
176   /** The notification for wakeup events is enabled\r
177    *  on the addressed network. */\r
178         CANIF_TRCV_WU_ENABLE = 0,\r
179         /** The notification for wakeup events is disabled\r
180          *  on the addressed network. */\r
181         CANIF_TRCV_WU_DISABLE,\r
182         /** A stored wakeup event is cleared on the addressed network */\r
183         CANIF_TRCV_WU_CLEAR\r
184 } CanIf_TrcvWakeupModeType;\r
185 \r
186 #endif /*CANIF_TYPES_H_*/\r
187 /** @} */\r