DSO138_SourceCodes_v037.rar
[DSO138] / Libraries / STM32F10x_StdPeriph_Driver / inc / stm32f10x_can.h
1 /**\r
2   ******************************************************************************\r
3   * @file    stm32f10x_can.h\r
4   * @author  MCD Application Team\r
5   * @version V3.3.0\r
6   * @date    04/16/2010\r
7   * @brief   This file contains all the functions prototypes for the CAN firmware \r
8   *          library.\r
9   ******************************************************************************\r
10   * @copy\r
11   *\r
12   * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS\r
13   * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE\r
14   * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY\r
15   * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING\r
16   * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE\r
17   * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.\r
18   *\r
19   * <h2><center>&copy; COPYRIGHT 2010 STMicroelectronics</center></h2>\r
20   */ \r
21 \r
22 /* Define to prevent recursive inclusion -------------------------------------*/\r
23 #ifndef __STM32F10x_CAN_H\r
24 #define __STM32F10x_CAN_H\r
25 \r
26 #ifdef __cplusplus\r
27  extern "C" {\r
28 #endif\r
29 \r
30 /* Includes ------------------------------------------------------------------*/\r
31 #include "stm32f10x.h"\r
32 \r
33 /** @addtogroup STM32F10x_StdPeriph_Driver\r
34   * @{\r
35   */\r
36 \r
37 /** @addtogroup CAN\r
38   * @{\r
39   */\r
40 \r
41 /** @defgroup CAN_Exported_Types\r
42   * @{\r
43   */\r
44 \r
45 #define IS_CAN_ALL_PERIPH(PERIPH) (((PERIPH) == CAN1) || \\r
46                                    ((PERIPH) == CAN2))\r
47 \r
48 /** \r
49   * @brief  CAN init structure definition\r
50   */\r
51 \r
52 typedef struct\r
53 {\r
54   uint16_t CAN_Prescaler;   /*!< Specifies the length of a time quantum. It ranges from 1 to 1024. */\r
55   \r
56   uint8_t CAN_Mode;         /*!< Specifies the CAN operating mode.\r
57                                  This parameter can be a value of @ref CAN_operating_mode */\r
58 \r
59   uint8_t CAN_SJW;          /*!< Specifies the maximum number of time quanta the CAN hardware\r
60                                  is allowed to lengthen or shorten a bit to perform resynchronization.\r
61                                  This parameter can be a value of @ref CAN_synchronisation_jump_width */\r
62 \r
63   uint8_t CAN_BS1;          /*!< Specifies the number of time quanta in Bit Segment 1.\r
64                                  This parameter can be a value of @ref CAN_time_quantum_in_bit_segment_1 */\r
65 \r
66   uint8_t CAN_BS2;          /*!< Specifies the number of time quanta in Bit Segment 2.\r
67                                  This parameter can be a value of @ref CAN_time_quantum_in_bit_segment_2 */\r
68   \r
69   FunctionalState CAN_TTCM; /*!< Enable or disable the time triggered communication mode.\r
70                                  This parameter can be set either to ENABLE or DISABLE. */\r
71   \r
72   FunctionalState CAN_ABOM;  /*!< Enable or disable the automatic bus-off management.\r
73                                  This parameter can be set either to ENABLE or DISABLE. */\r
74 \r
75   FunctionalState CAN_AWUM;  /*!< Enable or disable the automatic wake-up mode. \r
76                                  This parameter can be set either to ENABLE or DISABLE. */\r
77 \r
78   FunctionalState CAN_NART;  /*!< Enable or disable the no-automatic retransmission mode.\r
79                                  This parameter can be set either to ENABLE or DISABLE. */\r
80 \r
81   FunctionalState CAN_RFLM;  /*!< Enable or disable the Receive FIFO Locked mode.\r
82                                  This parameter can be set either to ENABLE or DISABLE. */\r
83 \r
84   FunctionalState CAN_TXFP;  /*!< Enable or disable the transmit FIFO priority.\r
85                                  This parameter can be set either to ENABLE or DISABLE. */\r
86 } CAN_InitTypeDef;\r
87 \r
88 /** \r
89   * @brief  CAN filter init structure definition\r
90   */\r
91 \r
92 typedef struct\r
93 {\r
94   uint16_t CAN_FilterIdHigh;             /*!< Specifies the filter identification number (MSBs for a 32-bit\r
95                                               configuration, first one for a 16-bit configuration).\r
96                                               This parameter can be a value between 0x0000 and 0xFFFF */\r
97 \r
98   uint16_t CAN_FilterIdLow;              /*!< Specifies the filter identification number (LSBs for a 32-bit\r
99                                               configuration, second one for a 16-bit configuration).\r
100                                               This parameter can be a value between 0x0000 and 0xFFFF */\r
101 \r
102   uint16_t CAN_FilterMaskIdHigh;         /*!< Specifies the filter mask number or identification number,\r
103                                               according to the mode (MSBs for a 32-bit configuration,\r
104                                               first one for a 16-bit configuration).\r
105                                               This parameter can be a value between 0x0000 and 0xFFFF */\r
106 \r
107   uint16_t CAN_FilterMaskIdLow;          /*!< Specifies the filter mask number or identification number,\r
108                                               according to the mode (LSBs for a 32-bit configuration,\r
109                                               second one for a 16-bit configuration).\r
110                                               This parameter can be a value between 0x0000 and 0xFFFF */\r
111 \r
112   uint16_t CAN_FilterFIFOAssignment;     /*!< Specifies the FIFO (0 or 1) which will be assigned to the filter.\r
113                                               This parameter can be a value of @ref CAN_filter_FIFO */\r
114   \r
115   uint8_t CAN_FilterNumber;              /*!< Specifies the filter which will be initialized. It ranges from 0 to 13. */\r
116 \r
117   uint8_t CAN_FilterMode;                /*!< Specifies the filter mode to be initialized.\r
118                                               This parameter can be a value of @ref CAN_filter_mode */\r
119 \r
120   uint8_t CAN_FilterScale;               /*!< Specifies the filter scale.\r
121                                               This parameter can be a value of @ref CAN_filter_scale */\r
122 \r
123   FunctionalState CAN_FilterActivation;  /*!< Enable or disable the filter.\r
124                                               This parameter can be set either to ENABLE or DISABLE. */\r
125 } CAN_FilterInitTypeDef;\r
126 \r
127 /** \r
128   * @brief  CAN Tx message structure definition  \r
129   */\r
130 \r
131 typedef struct\r
132 {\r
133   uint32_t StdId;  /*!< Specifies the standard identifier.\r
134                         This parameter can be a value between 0 to 0x7FF. */\r
135 \r
136   uint32_t ExtId;  /*!< Specifies the extended identifier.\r
137                         This parameter can be a value between 0 to 0x1FFFFFFF. */\r
138 \r
139   uint8_t IDE;     /*!< Specifies the type of identifier for the message that will be transmitted.\r
140                         This parameter can be a value of @ref CAN_identifier_type */\r
141 \r
142   uint8_t RTR;     /*!< Specifies the type of frame for the message that will be transmitted.\r
143                         This parameter can be a value of @ref CAN_remote_transmission_request */\r
144 \r
145   uint8_t DLC;     /*!< Specifies the length of the frame that will be transmitted.\r
146                         This parameter can be a value between 0 to 8 */\r
147 \r
148   uint8_t Data[8]; /*!< Contains the data to be transmitted. It ranges from 0 to 0xFF. */\r
149 } CanTxMsg;\r
150 \r
151 /** \r
152   * @brief  CAN Rx message structure definition  \r
153   */\r
154 \r
155 typedef struct\r
156 {\r
157   uint32_t StdId;  /*!< Specifies the standard identifier.\r
158                         This parameter can be a value between 0 to 0x7FF. */\r
159 \r
160   uint32_t ExtId;  /*!< Specifies the extended identifier.\r
161                         This parameter can be a value between 0 to 0x1FFFFFFF. */\r
162 \r
163   uint8_t IDE;     /*!< Specifies the type of identifier for the message that will be received.\r
164                         This parameter can be a value of @ref CAN_identifier_type */\r
165 \r
166   uint8_t RTR;     /*!< Specifies the type of frame for the received message.\r
167                         This parameter can be a value of @ref CAN_remote_transmission_request */\r
168 \r
169   uint8_t DLC;     /*!< Specifies the length of the frame that will be received.\r
170                         This parameter can be a value between 0 to 8 */\r
171 \r
172   uint8_t Data[8]; /*!< Contains the data to be received. It ranges from 0 to 0xFF. */\r
173 \r
174   uint8_t FMI;     /*!< Specifies the index of the filter the message stored in the mailbox passes through.\r
175                         This parameter can be a value between 0 to 0xFF */\r
176 } CanRxMsg;\r
177 \r
178 /**\r
179   * @}\r
180   */\r
181 \r
182 /** @defgroup CAN_Exported_Constants\r
183   * @{\r
184   */\r
185 \r
186 /** @defgroup CAN_sleep_constants \r
187   * @{\r
188   */\r
189 \r
190 #define CANINITFAILED              ((uint8_t)0x00) /*!< CAN initialization failed */\r
191 #define CANINITOK                  ((uint8_t)0x01) /*!< CAN initialization failed */\r
192 \r
193 /**\r
194   * @}\r
195   */\r
196 \r
197 /** @defgroup CAN_operating_mode \r
198   * @{\r
199   */\r
200 \r
201 #define CAN_Mode_Normal             ((uint8_t)0x00)  /*!< normal mode */\r
202 #define CAN_Mode_LoopBack           ((uint8_t)0x01)  /*!< loopback mode */\r
203 #define CAN_Mode_Silent             ((uint8_t)0x02)  /*!< silent mode */\r
204 #define CAN_Mode_Silent_LoopBack    ((uint8_t)0x03)  /*!< loopback combined with silent mode */\r
205 \r
206 #define IS_CAN_MODE(MODE) (((MODE) == CAN_Mode_Normal) || ((MODE) == CAN_Mode_LoopBack)|| \\r
207                            ((MODE) == CAN_Mode_Silent) || ((MODE) == CAN_Mode_Silent_LoopBack))\r
208 /**\r
209   * @}\r
210   */\r
211 \r
212 /** @defgroup CAN_synchronisation_jump_width \r
213   * @{\r
214   */\r
215 \r
216 #define CAN_SJW_1tq                 ((uint8_t)0x00)  /*!< 1 time quantum */\r
217 #define CAN_SJW_2tq                 ((uint8_t)0x01)  /*!< 2 time quantum */\r
218 #define CAN_SJW_3tq                 ((uint8_t)0x02)  /*!< 3 time quantum */\r
219 #define CAN_SJW_4tq                 ((uint8_t)0x03)  /*!< 4 time quantum */\r
220 \r
221 #define IS_CAN_SJW(SJW) (((SJW) == CAN_SJW_1tq) || ((SJW) == CAN_SJW_2tq)|| \\r
222                          ((SJW) == CAN_SJW_3tq) || ((SJW) == CAN_SJW_4tq))\r
223 /**\r
224   * @}\r
225   */\r
226 \r
227 /** @defgroup CAN_time_quantum_in_bit_segment_1 \r
228   * @{\r
229   */\r
230 \r
231 #define CAN_BS1_1tq                 ((uint8_t)0x00)  /*!< 1 time quantum */\r
232 #define CAN_BS1_2tq                 ((uint8_t)0x01)  /*!< 2 time quantum */\r
233 #define CAN_BS1_3tq                 ((uint8_t)0x02)  /*!< 3 time quantum */\r
234 #define CAN_BS1_4tq                 ((uint8_t)0x03)  /*!< 4 time quantum */\r
235 #define CAN_BS1_5tq                 ((uint8_t)0x04)  /*!< 5 time quantum */\r
236 #define CAN_BS1_6tq                 ((uint8_t)0x05)  /*!< 6 time quantum */\r
237 #define CAN_BS1_7tq                 ((uint8_t)0x06)  /*!< 7 time quantum */\r
238 #define CAN_BS1_8tq                 ((uint8_t)0x07)  /*!< 8 time quantum */\r
239 #define CAN_BS1_9tq                 ((uint8_t)0x08)  /*!< 9 time quantum */\r
240 #define CAN_BS1_10tq                ((uint8_t)0x09)  /*!< 10 time quantum */\r
241 #define CAN_BS1_11tq                ((uint8_t)0x0A)  /*!< 11 time quantum */\r
242 #define CAN_BS1_12tq                ((uint8_t)0x0B)  /*!< 12 time quantum */\r
243 #define CAN_BS1_13tq                ((uint8_t)0x0C)  /*!< 13 time quantum */\r
244 #define CAN_BS1_14tq                ((uint8_t)0x0D)  /*!< 14 time quantum */\r
245 #define CAN_BS1_15tq                ((uint8_t)0x0E)  /*!< 15 time quantum */\r
246 #define CAN_BS1_16tq                ((uint8_t)0x0F)  /*!< 16 time quantum */\r
247 \r
248 #define IS_CAN_BS1(BS1) ((BS1) <= CAN_BS1_16tq)\r
249 /**\r
250   * @}\r
251   */\r
252 \r
253 /** @defgroup CAN_time_quantum_in_bit_segment_2 \r
254   * @{\r
255   */\r
256 \r
257 #define CAN_BS2_1tq                 ((uint8_t)0x00)  /*!< 1 time quantum */\r
258 #define CAN_BS2_2tq                 ((uint8_t)0x01)  /*!< 2 time quantum */\r
259 #define CAN_BS2_3tq                 ((uint8_t)0x02)  /*!< 3 time quantum */\r
260 #define CAN_BS2_4tq                 ((uint8_t)0x03)  /*!< 4 time quantum */\r
261 #define CAN_BS2_5tq                 ((uint8_t)0x04)  /*!< 5 time quantum */\r
262 #define CAN_BS2_6tq                 ((uint8_t)0x05)  /*!< 6 time quantum */\r
263 #define CAN_BS2_7tq                 ((uint8_t)0x06)  /*!< 7 time quantum */\r
264 #define CAN_BS2_8tq                 ((uint8_t)0x07)  /*!< 8 time quantum */\r
265 \r
266 #define IS_CAN_BS2(BS2) ((BS2) <= CAN_BS2_8tq)\r
267 \r
268 /**\r
269   * @}\r
270   */\r
271 \r
272 /** @defgroup CAN_clock_prescaler \r
273   * @{\r
274   */\r
275 \r
276 #define IS_CAN_PRESCALER(PRESCALER) (((PRESCALER) >= 1) && ((PRESCALER) <= 1024))\r
277 \r
278 /**\r
279   * @}\r
280   */\r
281 \r
282 /** @defgroup CAN_filter_number \r
283   * @{\r
284   */\r
285 #ifndef STM32F10X_CL\r
286   #define IS_CAN_FILTER_NUMBER(NUMBER) ((NUMBER) <= 13)\r
287 #else\r
288   #define IS_CAN_FILTER_NUMBER(NUMBER) ((NUMBER) <= 27)\r
289 #endif /* STM32F10X_CL */ \r
290 /**\r
291   * @}\r
292   */\r
293 \r
294 /** @defgroup CAN_filter_mode \r
295   * @{\r
296   */\r
297 \r
298 #define CAN_FilterMode_IdMask       ((uint8_t)0x00)  /*!< id/mask mode */\r
299 #define CAN_FilterMode_IdList       ((uint8_t)0x01)  /*!< identifier list mode */\r
300 \r
301 #define IS_CAN_FILTER_MODE(MODE) (((MODE) == CAN_FilterMode_IdMask) || \\r
302                                   ((MODE) == CAN_FilterMode_IdList))\r
303 /**\r
304   * @}\r
305   */\r
306 \r
307 /** @defgroup CAN_filter_scale \r
308   * @{\r
309   */\r
310 \r
311 #define CAN_FilterScale_16bit       ((uint8_t)0x00) /*!< Two 16-bit filters */\r
312 #define CAN_FilterScale_32bit       ((uint8_t)0x01) /*!< One 32-bit filter */\r
313 \r
314 #define IS_CAN_FILTER_SCALE(SCALE) (((SCALE) == CAN_FilterScale_16bit) || \\r
315                                     ((SCALE) == CAN_FilterScale_32bit))\r
316 \r
317 /**\r
318   * @}\r
319   */\r
320 \r
321 /** @defgroup CAN_filter_FIFO\r
322   * @{\r
323   */\r
324 \r
325 #define CAN_FilterFIFO0             ((uint8_t)0x00)  /*!< Filter FIFO 0 assignment for filter x */\r
326 #define CAN_FilterFIFO1             ((uint8_t)0x01)  /*!< Filter FIFO 1 assignment for filter x */\r
327 #define IS_CAN_FILTER_FIFO(FIFO) (((FIFO) == CAN_FilterFIFO0) || \\r
328                                   ((FIFO) == CAN_FilterFIFO1))\r
329 \r
330 /**\r
331   * @}\r
332   */\r
333 \r
334 /** @defgroup Start_bank_filter_for_slave_CAN \r
335   * @{\r
336   */\r
337 #define IS_CAN_BANKNUMBER(BANKNUMBER) (((BANKNUMBER) >= 1) && ((BANKNUMBER) <= 27))\r
338 /**\r
339   * @}\r
340   */\r
341 \r
342 /** @defgroup CAN_Tx \r
343   * @{\r
344   */\r
345 \r
346 #define IS_CAN_TRANSMITMAILBOX(TRANSMITMAILBOX) ((TRANSMITMAILBOX) <= ((uint8_t)0x02))\r
347 #define IS_CAN_STDID(STDID)   ((STDID) <= ((uint32_t)0x7FF))\r
348 #define IS_CAN_EXTID(EXTID)   ((EXTID) <= ((uint32_t)0x1FFFFFFF))\r
349 #define IS_CAN_DLC(DLC)       ((DLC) <= ((uint8_t)0x08))\r
350 \r
351 /**\r
352   * @}\r
353   */\r
354 \r
355 /** @defgroup CAN_identifier_type \r
356   * @{\r
357   */\r
358 \r
359 #define CAN_ID_STD                 ((uint32_t)0x00000000)  /*!< Standard Id */\r
360 #define CAN_ID_EXT                 ((uint32_t)0x00000004)  /*!< Extended Id */\r
361 #define IS_CAN_IDTYPE(IDTYPE) (((IDTYPE) == CAN_ID_STD) || ((IDTYPE) == CAN_ID_EXT))\r
362 \r
363 /**\r
364   * @}\r
365   */\r
366 \r
367 /** @defgroup CAN_remote_transmission_request \r
368   * @{\r
369   */\r
370 \r
371 #define CAN_RTR_DATA                ((uint32_t)0x00000000)  /*!< Data frame */\r
372 #define CAN_RTR_REMOTE              ((uint32_t)0x00000002)  /*!< Remote frame */\r
373 #define IS_CAN_RTR(RTR) (((RTR) == CAN_RTR_DATA) || ((RTR) == CAN_RTR_REMOTE))\r
374 \r
375 /**\r
376   * @}\r
377   */\r
378 \r
379 /** @defgroup CAN_transmit_constants \r
380   * @{\r
381   */\r
382 \r
383 #define CANTXFAILED                 ((uint8_t)0x00) /*!< CAN transmission failed */\r
384 #define CANTXOK                     ((uint8_t)0x01) /*!< CAN transmission succeeded */\r
385 #define CANTXPENDING                ((uint8_t)0x02) /*!< CAN transmission pending */\r
386 #define CAN_NO_MB                   ((uint8_t)0x04) /*!< CAN cell did not provide an empty mailbox */\r
387 \r
388 /**\r
389   * @}\r
390   */\r
391 \r
392 /** @defgroup CAN_receive_FIFO_number_constants \r
393   * @{\r
394   */\r
395 \r
396 #define CAN_FIFO0                 ((uint8_t)0x00) /*!< CAN FIFO0 used to receive */\r
397 #define CAN_FIFO1                 ((uint8_t)0x01) /*!< CAN FIFO1 used to receive */\r
398 \r
399 #define IS_CAN_FIFO(FIFO) (((FIFO) == CAN_FIFO0) || ((FIFO) == CAN_FIFO1))\r
400 \r
401 /**\r
402   * @}\r
403   */\r
404 \r
405 /** @defgroup CAN_sleep_constants \r
406   * @{\r
407   */\r
408 \r
409 #define CANSLEEPFAILED              ((uint8_t)0x00) /*!< CAN did not enter the sleep mode */\r
410 #define CANSLEEPOK                  ((uint8_t)0x01) /*!< CAN entered the sleep mode */\r
411 \r
412 /**\r
413   * @}\r
414   */\r
415 \r
416 /** @defgroup CAN_wake_up_constants \r
417   * @{\r
418   */\r
419 \r
420 #define CANWAKEUPFAILED             ((uint8_t)0x00) /*!< CAN did not leave the sleep mode */\r
421 #define CANWAKEUPOK                 ((uint8_t)0x01) /*!< CAN leaved the sleep mode */\r
422 \r
423 /**\r
424   * @}\r
425   */\r
426 \r
427 /** @defgroup CAN_flags \r
428   * @{\r
429   */\r
430 \r
431 #define CAN_FLAG_EWG                ((uint32_t)0x00000001) /*!< Error Warning Flag */\r
432 #define CAN_FLAG_EPV                ((uint32_t)0x00000002) /*!< Error Passive Flag */\r
433 #define CAN_FLAG_BOF                ((uint32_t)0x00000004) /*!< Bus-Off Flag */\r
434 \r
435 #define IS_CAN_FLAG(FLAG) (((FLAG) == CAN_FLAG_EWG) || ((FLAG) == CAN_FLAG_EPV) ||\\r
436                            ((FLAG) == CAN_FLAG_BOF))\r
437 \r
438 /**\r
439   * @}\r
440   */\r
441 \r
442 /** @defgroup CAN_interrupts \r
443   * @{\r
444   */\r
445 \r
446 #define CAN_IT_RQCP0                ((uint32_t)0x00000005) /*!< Request completed mailbox 0 */\r
447 #define CAN_IT_RQCP1                ((uint32_t)0x00000006) /*!< Request completed mailbox 1 */\r
448 #define CAN_IT_RQCP2                ((uint32_t)0x00000007) /*!< Request completed mailbox 2 */\r
449 #define CAN_IT_TME                  ((uint32_t)0x00000001) /*!< Transmit mailbox empty */\r
450 #define CAN_IT_FMP0                 ((uint32_t)0x00000002) /*!< FIFO 0 message pending */\r
451 #define CAN_IT_FF0                  ((uint32_t)0x00000004) /*!< FIFO 0 full */\r
452 #define CAN_IT_FOV0                 ((uint32_t)0x00000008) /*!< FIFO 0 overrun */\r
453 #define CAN_IT_FMP1                 ((uint32_t)0x00000010) /*!< FIFO 1 message pending */\r
454 #define CAN_IT_FF1                  ((uint32_t)0x00000020) /*!< FIFO 1 full */\r
455 #define CAN_IT_FOV1                 ((uint32_t)0x00000040) /*!< FIFO 1 overrun */\r
456 #define CAN_IT_EWG                  ((uint32_t)0x00000100) /*!< Error warning */\r
457 #define CAN_IT_EPV                  ((uint32_t)0x00000200) /*!< Error passive */\r
458 #define CAN_IT_BOF                  ((uint32_t)0x00000400) /*!< Bus-off */\r
459 #define CAN_IT_LEC                  ((uint32_t)0x00000800) /*!< Last error code */\r
460 #define CAN_IT_ERR                  ((uint32_t)0x00008000) /*!< Error */\r
461 #define CAN_IT_WKU                  ((uint32_t)0x00010000) /*!< Wake-up */\r
462 #define CAN_IT_SLK                  ((uint32_t)0x00020000) /*!< Sleep */\r
463 \r
464 #define IS_CAN_ITConfig(IT) (((IT) == CAN_IT_TME)   || ((IT) == CAN_IT_FMP0)  ||\\r
465                              ((IT) == CAN_IT_FF0)   || ((IT) == CAN_IT_FOV0)  ||\\r
466                              ((IT) == CAN_IT_FMP1)  || ((IT) == CAN_IT_FF1)   ||\\r
467                              ((IT) == CAN_IT_FOV1)  || ((IT) == CAN_IT_EWG)   ||\\r
468                              ((IT) == CAN_IT_EPV)   || ((IT) == CAN_IT_BOF)   ||\\r
469                              ((IT) == CAN_IT_LEC)   || ((IT) == CAN_IT_ERR)   ||\\r
470                              ((IT) == CAN_IT_WKU)   || ((IT) == CAN_IT_SLK))\r
471 \r
472 #define IS_CAN_ITStatus(IT) (((IT) == CAN_IT_RQCP0)  || ((IT) == CAN_IT_RQCP1)  ||\\r
473                              ((IT) == CAN_IT_RQCP2)  || ((IT) == CAN_IT_FF0)    ||\\r
474                              ((IT) == CAN_IT_FOV0)   || ((IT) == CAN_IT_FF1)    ||\\r
475                              ((IT) == CAN_IT_FOV1)   || ((IT) == CAN_IT_EWG)    ||\\r
476                              ((IT) == CAN_IT_EPV)    || ((IT) == CAN_IT_BOF)    ||\\r
477                              ((IT) == CAN_IT_WKU)    || ((IT) == CAN_IT_SLK))\r
478 /**\r
479   * @}\r
480   */\r
481 \r
482 /**\r
483   * @}\r
484   */\r
485 \r
486 /** @defgroup CAN_Exported_Macros\r
487   * @{\r
488   */\r
489 \r
490 /**\r
491   * @}\r
492   */\r
493 \r
494 /** @defgroup CAN_Exported_Functions\r
495   * @{\r
496   */\r
497 \r
498 void CAN_DeInit(CAN_TypeDef* CANx);\r
499 uint8_t CAN_Init(CAN_TypeDef* CANx, CAN_InitTypeDef* CAN_InitStruct);\r
500 void CAN_FilterInit(CAN_FilterInitTypeDef* CAN_FilterInitStruct);\r
501 void CAN_StructInit(CAN_InitTypeDef* CAN_InitStruct);\r
502 void CAN_SlaveStartBank(uint8_t CAN_BankNumber); \r
503 void CAN_ITConfig(CAN_TypeDef* CANx, uint32_t CAN_IT, FunctionalState NewState);\r
504 uint8_t CAN_Transmit(CAN_TypeDef* CANx, CanTxMsg* TxMessage);\r
505 uint8_t CAN_TransmitStatus(CAN_TypeDef* CANx, uint8_t TransmitMailbox);\r
506 void CAN_CancelTransmit(CAN_TypeDef* CANx, uint8_t Mailbox);\r
507 void CAN_FIFORelease(CAN_TypeDef* CANx, uint8_t FIFONumber);\r
508 uint8_t CAN_MessagePending(CAN_TypeDef* CANx, uint8_t FIFONumber);\r
509 void CAN_Receive(CAN_TypeDef* CANx, uint8_t FIFONumber, CanRxMsg* RxMessage);\r
510 void CAN_DBGFreeze(CAN_TypeDef* CANx, FunctionalState NewState);\r
511 uint8_t CAN_Sleep(CAN_TypeDef* CANx);\r
512 uint8_t CAN_WakeUp(CAN_TypeDef* CANx);\r
513 FlagStatus CAN_GetFlagStatus(CAN_TypeDef* CANx, uint32_t CAN_FLAG);\r
514 void CAN_ClearFlag(CAN_TypeDef* CANx, uint32_t CAN_FLAG);\r
515 ITStatus CAN_GetITStatus(CAN_TypeDef* CANx, uint32_t CAN_IT);\r
516 void CAN_ClearITPendingBit(CAN_TypeDef* CANx, uint32_t CAN_IT);\r
517 \r
518 #ifdef __cplusplus\r
519 }\r
520 #endif\r
521 \r
522 #endif /* __STM32F10x_CAN_H */\r
523 /**\r
524   * @}\r
525   */\r
526 \r
527 /**\r
528   * @}\r
529   */\r
530 \r
531 /**\r
532   * @}\r
533   */\r
534 \r
535 /******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****/\r