mbed library sources
Dependents: frdm_kl05z_gpio_test
Fork of mbed-src by
targets/cmsis/TARGET_STM/TARGET_NUCLEO_F103RB/stm32f10x_can.h@52:a51c77007319, 2013-12-02 (annotated)
- Committer:
- mbed_official
- Date:
- Mon Dec 02 11:30:05 2013 +0000
- Revision:
- 52:a51c77007319
- Child:
- 70:c1fbde68b492
Synchronized with git revision 49df530ae72ce97ccc773d1f2c13b38e868e6abd
Full URL: https://github.com/mbedmicro/mbed/commit/49df530ae72ce97ccc773d1f2c13b38e868e6abd/
Add STMicroelectronics NUCLEO_F103RB target
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbed_official | 52:a51c77007319 | 1 | /** |
mbed_official | 52:a51c77007319 | 2 | ****************************************************************************** |
mbed_official | 52:a51c77007319 | 3 | * @file stm32f10x_can.h |
mbed_official | 52:a51c77007319 | 4 | * @author MCD Application Team |
mbed_official | 52:a51c77007319 | 5 | * @version V3.5.0 |
mbed_official | 52:a51c77007319 | 6 | * @date 11-March-2011 |
mbed_official | 52:a51c77007319 | 7 | * @brief This file contains all the functions prototypes for the CAN firmware |
mbed_official | 52:a51c77007319 | 8 | * library. |
mbed_official | 52:a51c77007319 | 9 | ****************************************************************************** |
mbed_official | 52:a51c77007319 | 10 | * @attention |
mbed_official | 52:a51c77007319 | 11 | * |
mbed_official | 52:a51c77007319 | 12 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS |
mbed_official | 52:a51c77007319 | 13 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE |
mbed_official | 52:a51c77007319 | 14 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY |
mbed_official | 52:a51c77007319 | 15 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING |
mbed_official | 52:a51c77007319 | 16 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE |
mbed_official | 52:a51c77007319 | 17 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. |
mbed_official | 52:a51c77007319 | 18 | * |
mbed_official | 52:a51c77007319 | 19 | * <h2><center>© COPYRIGHT 2011 STMicroelectronics</center></h2> |
mbed_official | 52:a51c77007319 | 20 | ****************************************************************************** |
mbed_official | 52:a51c77007319 | 21 | */ |
mbed_official | 52:a51c77007319 | 22 | |
mbed_official | 52:a51c77007319 | 23 | /* Define to prevent recursive inclusion -------------------------------------*/ |
mbed_official | 52:a51c77007319 | 24 | #ifndef __STM32F10x_CAN_H |
mbed_official | 52:a51c77007319 | 25 | #define __STM32F10x_CAN_H |
mbed_official | 52:a51c77007319 | 26 | |
mbed_official | 52:a51c77007319 | 27 | #ifdef __cplusplus |
mbed_official | 52:a51c77007319 | 28 | extern "C" { |
mbed_official | 52:a51c77007319 | 29 | #endif |
mbed_official | 52:a51c77007319 | 30 | |
mbed_official | 52:a51c77007319 | 31 | /* Includes ------------------------------------------------------------------*/ |
mbed_official | 52:a51c77007319 | 32 | #include "stm32f10x.h" |
mbed_official | 52:a51c77007319 | 33 | |
mbed_official | 52:a51c77007319 | 34 | /** @addtogroup STM32F10x_StdPeriph_Driver |
mbed_official | 52:a51c77007319 | 35 | * @{ |
mbed_official | 52:a51c77007319 | 36 | */ |
mbed_official | 52:a51c77007319 | 37 | |
mbed_official | 52:a51c77007319 | 38 | /** @addtogroup CAN |
mbed_official | 52:a51c77007319 | 39 | * @{ |
mbed_official | 52:a51c77007319 | 40 | */ |
mbed_official | 52:a51c77007319 | 41 | |
mbed_official | 52:a51c77007319 | 42 | /** @defgroup CAN_Exported_Types |
mbed_official | 52:a51c77007319 | 43 | * @{ |
mbed_official | 52:a51c77007319 | 44 | */ |
mbed_official | 52:a51c77007319 | 45 | |
mbed_official | 52:a51c77007319 | 46 | #define IS_CAN_ALL_PERIPH(PERIPH) (((PERIPH) == CAN1) || \ |
mbed_official | 52:a51c77007319 | 47 | ((PERIPH) == CAN2)) |
mbed_official | 52:a51c77007319 | 48 | |
mbed_official | 52:a51c77007319 | 49 | /** |
mbed_official | 52:a51c77007319 | 50 | * @brief CAN init structure definition |
mbed_official | 52:a51c77007319 | 51 | */ |
mbed_official | 52:a51c77007319 | 52 | |
mbed_official | 52:a51c77007319 | 53 | typedef struct |
mbed_official | 52:a51c77007319 | 54 | { |
mbed_official | 52:a51c77007319 | 55 | uint16_t CAN_Prescaler; /*!< Specifies the length of a time quantum. |
mbed_official | 52:a51c77007319 | 56 | It ranges from 1 to 1024. */ |
mbed_official | 52:a51c77007319 | 57 | |
mbed_official | 52:a51c77007319 | 58 | uint8_t CAN_Mode; /*!< Specifies the CAN operating mode. |
mbed_official | 52:a51c77007319 | 59 | This parameter can be a value of |
mbed_official | 52:a51c77007319 | 60 | @ref CAN_operating_mode */ |
mbed_official | 52:a51c77007319 | 61 | |
mbed_official | 52:a51c77007319 | 62 | uint8_t CAN_SJW; /*!< Specifies the maximum number of time quanta |
mbed_official | 52:a51c77007319 | 63 | the CAN hardware is allowed to lengthen or |
mbed_official | 52:a51c77007319 | 64 | shorten a bit to perform resynchronization. |
mbed_official | 52:a51c77007319 | 65 | This parameter can be a value of |
mbed_official | 52:a51c77007319 | 66 | @ref CAN_synchronisation_jump_width */ |
mbed_official | 52:a51c77007319 | 67 | |
mbed_official | 52:a51c77007319 | 68 | uint8_t CAN_BS1; /*!< Specifies the number of time quanta in Bit |
mbed_official | 52:a51c77007319 | 69 | Segment 1. This parameter can be a value of |
mbed_official | 52:a51c77007319 | 70 | @ref CAN_time_quantum_in_bit_segment_1 */ |
mbed_official | 52:a51c77007319 | 71 | |
mbed_official | 52:a51c77007319 | 72 | uint8_t CAN_BS2; /*!< Specifies the number of time quanta in Bit |
mbed_official | 52:a51c77007319 | 73 | Segment 2. |
mbed_official | 52:a51c77007319 | 74 | This parameter can be a value of |
mbed_official | 52:a51c77007319 | 75 | @ref CAN_time_quantum_in_bit_segment_2 */ |
mbed_official | 52:a51c77007319 | 76 | |
mbed_official | 52:a51c77007319 | 77 | FunctionalState CAN_TTCM; /*!< Enable or disable the time triggered |
mbed_official | 52:a51c77007319 | 78 | communication mode. This parameter can be set |
mbed_official | 52:a51c77007319 | 79 | either to ENABLE or DISABLE. */ |
mbed_official | 52:a51c77007319 | 80 | |
mbed_official | 52:a51c77007319 | 81 | FunctionalState CAN_ABOM; /*!< Enable or disable the automatic bus-off |
mbed_official | 52:a51c77007319 | 82 | management. This parameter can be set either |
mbed_official | 52:a51c77007319 | 83 | to ENABLE or DISABLE. */ |
mbed_official | 52:a51c77007319 | 84 | |
mbed_official | 52:a51c77007319 | 85 | FunctionalState CAN_AWUM; /*!< Enable or disable the automatic wake-up mode. |
mbed_official | 52:a51c77007319 | 86 | This parameter can be set either to ENABLE or |
mbed_official | 52:a51c77007319 | 87 | DISABLE. */ |
mbed_official | 52:a51c77007319 | 88 | |
mbed_official | 52:a51c77007319 | 89 | FunctionalState CAN_NART; /*!< Enable or disable the no-automatic |
mbed_official | 52:a51c77007319 | 90 | retransmission mode. This parameter can be |
mbed_official | 52:a51c77007319 | 91 | set either to ENABLE or DISABLE. */ |
mbed_official | 52:a51c77007319 | 92 | |
mbed_official | 52:a51c77007319 | 93 | FunctionalState CAN_RFLM; /*!< Enable or disable the Receive FIFO Locked mode. |
mbed_official | 52:a51c77007319 | 94 | This parameter can be set either to ENABLE |
mbed_official | 52:a51c77007319 | 95 | or DISABLE. */ |
mbed_official | 52:a51c77007319 | 96 | |
mbed_official | 52:a51c77007319 | 97 | FunctionalState CAN_TXFP; /*!< Enable or disable the transmit FIFO priority. |
mbed_official | 52:a51c77007319 | 98 | This parameter can be set either to ENABLE |
mbed_official | 52:a51c77007319 | 99 | or DISABLE. */ |
mbed_official | 52:a51c77007319 | 100 | } CAN_InitTypeDef; |
mbed_official | 52:a51c77007319 | 101 | |
mbed_official | 52:a51c77007319 | 102 | /** |
mbed_official | 52:a51c77007319 | 103 | * @brief CAN filter init structure definition |
mbed_official | 52:a51c77007319 | 104 | */ |
mbed_official | 52:a51c77007319 | 105 | |
mbed_official | 52:a51c77007319 | 106 | typedef struct |
mbed_official | 52:a51c77007319 | 107 | { |
mbed_official | 52:a51c77007319 | 108 | uint16_t CAN_FilterIdHigh; /*!< Specifies the filter identification number (MSBs for a 32-bit |
mbed_official | 52:a51c77007319 | 109 | configuration, first one for a 16-bit configuration). |
mbed_official | 52:a51c77007319 | 110 | This parameter can be a value between 0x0000 and 0xFFFF */ |
mbed_official | 52:a51c77007319 | 111 | |
mbed_official | 52:a51c77007319 | 112 | uint16_t CAN_FilterIdLow; /*!< Specifies the filter identification number (LSBs for a 32-bit |
mbed_official | 52:a51c77007319 | 113 | configuration, second one for a 16-bit configuration). |
mbed_official | 52:a51c77007319 | 114 | This parameter can be a value between 0x0000 and 0xFFFF */ |
mbed_official | 52:a51c77007319 | 115 | |
mbed_official | 52:a51c77007319 | 116 | uint16_t CAN_FilterMaskIdHigh; /*!< Specifies the filter mask number or identification number, |
mbed_official | 52:a51c77007319 | 117 | according to the mode (MSBs for a 32-bit configuration, |
mbed_official | 52:a51c77007319 | 118 | first one for a 16-bit configuration). |
mbed_official | 52:a51c77007319 | 119 | This parameter can be a value between 0x0000 and 0xFFFF */ |
mbed_official | 52:a51c77007319 | 120 | |
mbed_official | 52:a51c77007319 | 121 | uint16_t CAN_FilterMaskIdLow; /*!< Specifies the filter mask number or identification number, |
mbed_official | 52:a51c77007319 | 122 | according to the mode (LSBs for a 32-bit configuration, |
mbed_official | 52:a51c77007319 | 123 | second one for a 16-bit configuration). |
mbed_official | 52:a51c77007319 | 124 | This parameter can be a value between 0x0000 and 0xFFFF */ |
mbed_official | 52:a51c77007319 | 125 | |
mbed_official | 52:a51c77007319 | 126 | uint16_t CAN_FilterFIFOAssignment; /*!< Specifies the FIFO (0 or 1) which will be assigned to the filter. |
mbed_official | 52:a51c77007319 | 127 | This parameter can be a value of @ref CAN_filter_FIFO */ |
mbed_official | 52:a51c77007319 | 128 | |
mbed_official | 52:a51c77007319 | 129 | uint8_t CAN_FilterNumber; /*!< Specifies the filter which will be initialized. It ranges from 0 to 13. */ |
mbed_official | 52:a51c77007319 | 130 | |
mbed_official | 52:a51c77007319 | 131 | uint8_t CAN_FilterMode; /*!< Specifies the filter mode to be initialized. |
mbed_official | 52:a51c77007319 | 132 | This parameter can be a value of @ref CAN_filter_mode */ |
mbed_official | 52:a51c77007319 | 133 | |
mbed_official | 52:a51c77007319 | 134 | uint8_t CAN_FilterScale; /*!< Specifies the filter scale. |
mbed_official | 52:a51c77007319 | 135 | This parameter can be a value of @ref CAN_filter_scale */ |
mbed_official | 52:a51c77007319 | 136 | |
mbed_official | 52:a51c77007319 | 137 | FunctionalState CAN_FilterActivation; /*!< Enable or disable the filter. |
mbed_official | 52:a51c77007319 | 138 | This parameter can be set either to ENABLE or DISABLE. */ |
mbed_official | 52:a51c77007319 | 139 | } CAN_FilterInitTypeDef; |
mbed_official | 52:a51c77007319 | 140 | |
mbed_official | 52:a51c77007319 | 141 | /** |
mbed_official | 52:a51c77007319 | 142 | * @brief CAN Tx message structure definition |
mbed_official | 52:a51c77007319 | 143 | */ |
mbed_official | 52:a51c77007319 | 144 | |
mbed_official | 52:a51c77007319 | 145 | typedef struct |
mbed_official | 52:a51c77007319 | 146 | { |
mbed_official | 52:a51c77007319 | 147 | uint32_t StdId; /*!< Specifies the standard identifier. |
mbed_official | 52:a51c77007319 | 148 | This parameter can be a value between 0 to 0x7FF. */ |
mbed_official | 52:a51c77007319 | 149 | |
mbed_official | 52:a51c77007319 | 150 | uint32_t ExtId; /*!< Specifies the extended identifier. |
mbed_official | 52:a51c77007319 | 151 | This parameter can be a value between 0 to 0x1FFFFFFF. */ |
mbed_official | 52:a51c77007319 | 152 | |
mbed_official | 52:a51c77007319 | 153 | uint8_t IDE; /*!< Specifies the type of identifier for the message that |
mbed_official | 52:a51c77007319 | 154 | will be transmitted. This parameter can be a value |
mbed_official | 52:a51c77007319 | 155 | of @ref CAN_identifier_type */ |
mbed_official | 52:a51c77007319 | 156 | |
mbed_official | 52:a51c77007319 | 157 | uint8_t RTR; /*!< Specifies the type of frame for the message that will |
mbed_official | 52:a51c77007319 | 158 | be transmitted. This parameter can be a value of |
mbed_official | 52:a51c77007319 | 159 | @ref CAN_remote_transmission_request */ |
mbed_official | 52:a51c77007319 | 160 | |
mbed_official | 52:a51c77007319 | 161 | uint8_t DLC; /*!< Specifies the length of the frame that will be |
mbed_official | 52:a51c77007319 | 162 | transmitted. This parameter can be a value between |
mbed_official | 52:a51c77007319 | 163 | 0 to 8 */ |
mbed_official | 52:a51c77007319 | 164 | |
mbed_official | 52:a51c77007319 | 165 | uint8_t Data[8]; /*!< Contains the data to be transmitted. It ranges from 0 |
mbed_official | 52:a51c77007319 | 166 | to 0xFF. */ |
mbed_official | 52:a51c77007319 | 167 | } CanTxMsg; |
mbed_official | 52:a51c77007319 | 168 | |
mbed_official | 52:a51c77007319 | 169 | /** |
mbed_official | 52:a51c77007319 | 170 | * @brief CAN Rx message structure definition |
mbed_official | 52:a51c77007319 | 171 | */ |
mbed_official | 52:a51c77007319 | 172 | |
mbed_official | 52:a51c77007319 | 173 | typedef struct |
mbed_official | 52:a51c77007319 | 174 | { |
mbed_official | 52:a51c77007319 | 175 | uint32_t StdId; /*!< Specifies the standard identifier. |
mbed_official | 52:a51c77007319 | 176 | This parameter can be a value between 0 to 0x7FF. */ |
mbed_official | 52:a51c77007319 | 177 | |
mbed_official | 52:a51c77007319 | 178 | uint32_t ExtId; /*!< Specifies the extended identifier. |
mbed_official | 52:a51c77007319 | 179 | This parameter can be a value between 0 to 0x1FFFFFFF. */ |
mbed_official | 52:a51c77007319 | 180 | |
mbed_official | 52:a51c77007319 | 181 | uint8_t IDE; /*!< Specifies the type of identifier for the message that |
mbed_official | 52:a51c77007319 | 182 | will be received. This parameter can be a value of |
mbed_official | 52:a51c77007319 | 183 | @ref CAN_identifier_type */ |
mbed_official | 52:a51c77007319 | 184 | |
mbed_official | 52:a51c77007319 | 185 | uint8_t RTR; /*!< Specifies the type of frame for the received message. |
mbed_official | 52:a51c77007319 | 186 | This parameter can be a value of |
mbed_official | 52:a51c77007319 | 187 | @ref CAN_remote_transmission_request */ |
mbed_official | 52:a51c77007319 | 188 | |
mbed_official | 52:a51c77007319 | 189 | uint8_t DLC; /*!< Specifies the length of the frame that will be received. |
mbed_official | 52:a51c77007319 | 190 | This parameter can be a value between 0 to 8 */ |
mbed_official | 52:a51c77007319 | 191 | |
mbed_official | 52:a51c77007319 | 192 | uint8_t Data[8]; /*!< Contains the data to be received. It ranges from 0 to |
mbed_official | 52:a51c77007319 | 193 | 0xFF. */ |
mbed_official | 52:a51c77007319 | 194 | |
mbed_official | 52:a51c77007319 | 195 | uint8_t FMI; /*!< Specifies the index of the filter the message stored in |
mbed_official | 52:a51c77007319 | 196 | the mailbox passes through. This parameter can be a |
mbed_official | 52:a51c77007319 | 197 | value between 0 to 0xFF */ |
mbed_official | 52:a51c77007319 | 198 | } CanRxMsg; |
mbed_official | 52:a51c77007319 | 199 | |
mbed_official | 52:a51c77007319 | 200 | /** |
mbed_official | 52:a51c77007319 | 201 | * @} |
mbed_official | 52:a51c77007319 | 202 | */ |
mbed_official | 52:a51c77007319 | 203 | |
mbed_official | 52:a51c77007319 | 204 | /** @defgroup CAN_Exported_Constants |
mbed_official | 52:a51c77007319 | 205 | * @{ |
mbed_official | 52:a51c77007319 | 206 | */ |
mbed_official | 52:a51c77007319 | 207 | |
mbed_official | 52:a51c77007319 | 208 | /** @defgroup CAN_sleep_constants |
mbed_official | 52:a51c77007319 | 209 | * @{ |
mbed_official | 52:a51c77007319 | 210 | */ |
mbed_official | 52:a51c77007319 | 211 | |
mbed_official | 52:a51c77007319 | 212 | #define CAN_InitStatus_Failed ((uint8_t)0x00) /*!< CAN initialization failed */ |
mbed_official | 52:a51c77007319 | 213 | #define CAN_InitStatus_Success ((uint8_t)0x01) /*!< CAN initialization OK */ |
mbed_official | 52:a51c77007319 | 214 | |
mbed_official | 52:a51c77007319 | 215 | /** |
mbed_official | 52:a51c77007319 | 216 | * @} |
mbed_official | 52:a51c77007319 | 217 | */ |
mbed_official | 52:a51c77007319 | 218 | |
mbed_official | 52:a51c77007319 | 219 | /** @defgroup CAN_Mode |
mbed_official | 52:a51c77007319 | 220 | * @{ |
mbed_official | 52:a51c77007319 | 221 | */ |
mbed_official | 52:a51c77007319 | 222 | |
mbed_official | 52:a51c77007319 | 223 | #define CAN_Mode_Normal ((uint8_t)0x00) /*!< normal mode */ |
mbed_official | 52:a51c77007319 | 224 | #define CAN_Mode_LoopBack ((uint8_t)0x01) /*!< loopback mode */ |
mbed_official | 52:a51c77007319 | 225 | #define CAN_Mode_Silent ((uint8_t)0x02) /*!< silent mode */ |
mbed_official | 52:a51c77007319 | 226 | #define CAN_Mode_Silent_LoopBack ((uint8_t)0x03) /*!< loopback combined with silent mode */ |
mbed_official | 52:a51c77007319 | 227 | |
mbed_official | 52:a51c77007319 | 228 | #define IS_CAN_MODE(MODE) (((MODE) == CAN_Mode_Normal) || \ |
mbed_official | 52:a51c77007319 | 229 | ((MODE) == CAN_Mode_LoopBack)|| \ |
mbed_official | 52:a51c77007319 | 230 | ((MODE) == CAN_Mode_Silent) || \ |
mbed_official | 52:a51c77007319 | 231 | ((MODE) == CAN_Mode_Silent_LoopBack)) |
mbed_official | 52:a51c77007319 | 232 | /** |
mbed_official | 52:a51c77007319 | 233 | * @} |
mbed_official | 52:a51c77007319 | 234 | */ |
mbed_official | 52:a51c77007319 | 235 | |
mbed_official | 52:a51c77007319 | 236 | |
mbed_official | 52:a51c77007319 | 237 | /** |
mbed_official | 52:a51c77007319 | 238 | * @defgroup CAN_Operating_Mode |
mbed_official | 52:a51c77007319 | 239 | * @{ |
mbed_official | 52:a51c77007319 | 240 | */ |
mbed_official | 52:a51c77007319 | 241 | #define CAN_OperatingMode_Initialization ((uint8_t)0x00) /*!< Initialization mode */ |
mbed_official | 52:a51c77007319 | 242 | #define CAN_OperatingMode_Normal ((uint8_t)0x01) /*!< Normal mode */ |
mbed_official | 52:a51c77007319 | 243 | #define CAN_OperatingMode_Sleep ((uint8_t)0x02) /*!< sleep mode */ |
mbed_official | 52:a51c77007319 | 244 | |
mbed_official | 52:a51c77007319 | 245 | |
mbed_official | 52:a51c77007319 | 246 | #define IS_CAN_OPERATING_MODE(MODE) (((MODE) == CAN_OperatingMode_Initialization) ||\ |
mbed_official | 52:a51c77007319 | 247 | ((MODE) == CAN_OperatingMode_Normal)|| \ |
mbed_official | 52:a51c77007319 | 248 | ((MODE) == CAN_OperatingMode_Sleep)) |
mbed_official | 52:a51c77007319 | 249 | /** |
mbed_official | 52:a51c77007319 | 250 | * @} |
mbed_official | 52:a51c77007319 | 251 | */ |
mbed_official | 52:a51c77007319 | 252 | |
mbed_official | 52:a51c77007319 | 253 | /** |
mbed_official | 52:a51c77007319 | 254 | * @defgroup CAN_Mode_Status |
mbed_official | 52:a51c77007319 | 255 | * @{ |
mbed_official | 52:a51c77007319 | 256 | */ |
mbed_official | 52:a51c77007319 | 257 | |
mbed_official | 52:a51c77007319 | 258 | #define CAN_ModeStatus_Failed ((uint8_t)0x00) /*!< CAN entering the specific mode failed */ |
mbed_official | 52:a51c77007319 | 259 | #define CAN_ModeStatus_Success ((uint8_t)!CAN_ModeStatus_Failed) /*!< CAN entering the specific mode Succeed */ |
mbed_official | 52:a51c77007319 | 260 | |
mbed_official | 52:a51c77007319 | 261 | |
mbed_official | 52:a51c77007319 | 262 | /** |
mbed_official | 52:a51c77007319 | 263 | * @} |
mbed_official | 52:a51c77007319 | 264 | */ |
mbed_official | 52:a51c77007319 | 265 | |
mbed_official | 52:a51c77007319 | 266 | /** @defgroup CAN_synchronisation_jump_width |
mbed_official | 52:a51c77007319 | 267 | * @{ |
mbed_official | 52:a51c77007319 | 268 | */ |
mbed_official | 52:a51c77007319 | 269 | |
mbed_official | 52:a51c77007319 | 270 | #define CAN_SJW_1tq ((uint8_t)0x00) /*!< 1 time quantum */ |
mbed_official | 52:a51c77007319 | 271 | #define CAN_SJW_2tq ((uint8_t)0x01) /*!< 2 time quantum */ |
mbed_official | 52:a51c77007319 | 272 | #define CAN_SJW_3tq ((uint8_t)0x02) /*!< 3 time quantum */ |
mbed_official | 52:a51c77007319 | 273 | #define CAN_SJW_4tq ((uint8_t)0x03) /*!< 4 time quantum */ |
mbed_official | 52:a51c77007319 | 274 | |
mbed_official | 52:a51c77007319 | 275 | #define IS_CAN_SJW(SJW) (((SJW) == CAN_SJW_1tq) || ((SJW) == CAN_SJW_2tq)|| \ |
mbed_official | 52:a51c77007319 | 276 | ((SJW) == CAN_SJW_3tq) || ((SJW) == CAN_SJW_4tq)) |
mbed_official | 52:a51c77007319 | 277 | /** |
mbed_official | 52:a51c77007319 | 278 | * @} |
mbed_official | 52:a51c77007319 | 279 | */ |
mbed_official | 52:a51c77007319 | 280 | |
mbed_official | 52:a51c77007319 | 281 | /** @defgroup CAN_time_quantum_in_bit_segment_1 |
mbed_official | 52:a51c77007319 | 282 | * @{ |
mbed_official | 52:a51c77007319 | 283 | */ |
mbed_official | 52:a51c77007319 | 284 | |
mbed_official | 52:a51c77007319 | 285 | #define CAN_BS1_1tq ((uint8_t)0x00) /*!< 1 time quantum */ |
mbed_official | 52:a51c77007319 | 286 | #define CAN_BS1_2tq ((uint8_t)0x01) /*!< 2 time quantum */ |
mbed_official | 52:a51c77007319 | 287 | #define CAN_BS1_3tq ((uint8_t)0x02) /*!< 3 time quantum */ |
mbed_official | 52:a51c77007319 | 288 | #define CAN_BS1_4tq ((uint8_t)0x03) /*!< 4 time quantum */ |
mbed_official | 52:a51c77007319 | 289 | #define CAN_BS1_5tq ((uint8_t)0x04) /*!< 5 time quantum */ |
mbed_official | 52:a51c77007319 | 290 | #define CAN_BS1_6tq ((uint8_t)0x05) /*!< 6 time quantum */ |
mbed_official | 52:a51c77007319 | 291 | #define CAN_BS1_7tq ((uint8_t)0x06) /*!< 7 time quantum */ |
mbed_official | 52:a51c77007319 | 292 | #define CAN_BS1_8tq ((uint8_t)0x07) /*!< 8 time quantum */ |
mbed_official | 52:a51c77007319 | 293 | #define CAN_BS1_9tq ((uint8_t)0x08) /*!< 9 time quantum */ |
mbed_official | 52:a51c77007319 | 294 | #define CAN_BS1_10tq ((uint8_t)0x09) /*!< 10 time quantum */ |
mbed_official | 52:a51c77007319 | 295 | #define CAN_BS1_11tq ((uint8_t)0x0A) /*!< 11 time quantum */ |
mbed_official | 52:a51c77007319 | 296 | #define CAN_BS1_12tq ((uint8_t)0x0B) /*!< 12 time quantum */ |
mbed_official | 52:a51c77007319 | 297 | #define CAN_BS1_13tq ((uint8_t)0x0C) /*!< 13 time quantum */ |
mbed_official | 52:a51c77007319 | 298 | #define CAN_BS1_14tq ((uint8_t)0x0D) /*!< 14 time quantum */ |
mbed_official | 52:a51c77007319 | 299 | #define CAN_BS1_15tq ((uint8_t)0x0E) /*!< 15 time quantum */ |
mbed_official | 52:a51c77007319 | 300 | #define CAN_BS1_16tq ((uint8_t)0x0F) /*!< 16 time quantum */ |
mbed_official | 52:a51c77007319 | 301 | |
mbed_official | 52:a51c77007319 | 302 | #define IS_CAN_BS1(BS1) ((BS1) <= CAN_BS1_16tq) |
mbed_official | 52:a51c77007319 | 303 | /** |
mbed_official | 52:a51c77007319 | 304 | * @} |
mbed_official | 52:a51c77007319 | 305 | */ |
mbed_official | 52:a51c77007319 | 306 | |
mbed_official | 52:a51c77007319 | 307 | /** @defgroup CAN_time_quantum_in_bit_segment_2 |
mbed_official | 52:a51c77007319 | 308 | * @{ |
mbed_official | 52:a51c77007319 | 309 | */ |
mbed_official | 52:a51c77007319 | 310 | |
mbed_official | 52:a51c77007319 | 311 | #define CAN_BS2_1tq ((uint8_t)0x00) /*!< 1 time quantum */ |
mbed_official | 52:a51c77007319 | 312 | #define CAN_BS2_2tq ((uint8_t)0x01) /*!< 2 time quantum */ |
mbed_official | 52:a51c77007319 | 313 | #define CAN_BS2_3tq ((uint8_t)0x02) /*!< 3 time quantum */ |
mbed_official | 52:a51c77007319 | 314 | #define CAN_BS2_4tq ((uint8_t)0x03) /*!< 4 time quantum */ |
mbed_official | 52:a51c77007319 | 315 | #define CAN_BS2_5tq ((uint8_t)0x04) /*!< 5 time quantum */ |
mbed_official | 52:a51c77007319 | 316 | #define CAN_BS2_6tq ((uint8_t)0x05) /*!< 6 time quantum */ |
mbed_official | 52:a51c77007319 | 317 | #define CAN_BS2_7tq ((uint8_t)0x06) /*!< 7 time quantum */ |
mbed_official | 52:a51c77007319 | 318 | #define CAN_BS2_8tq ((uint8_t)0x07) /*!< 8 time quantum */ |
mbed_official | 52:a51c77007319 | 319 | |
mbed_official | 52:a51c77007319 | 320 | #define IS_CAN_BS2(BS2) ((BS2) <= CAN_BS2_8tq) |
mbed_official | 52:a51c77007319 | 321 | |
mbed_official | 52:a51c77007319 | 322 | /** |
mbed_official | 52:a51c77007319 | 323 | * @} |
mbed_official | 52:a51c77007319 | 324 | */ |
mbed_official | 52:a51c77007319 | 325 | |
mbed_official | 52:a51c77007319 | 326 | /** @defgroup CAN_clock_prescaler |
mbed_official | 52:a51c77007319 | 327 | * @{ |
mbed_official | 52:a51c77007319 | 328 | */ |
mbed_official | 52:a51c77007319 | 329 | |
mbed_official | 52:a51c77007319 | 330 | #define IS_CAN_PRESCALER(PRESCALER) (((PRESCALER) >= 1) && ((PRESCALER) <= 1024)) |
mbed_official | 52:a51c77007319 | 331 | |
mbed_official | 52:a51c77007319 | 332 | /** |
mbed_official | 52:a51c77007319 | 333 | * @} |
mbed_official | 52:a51c77007319 | 334 | */ |
mbed_official | 52:a51c77007319 | 335 | |
mbed_official | 52:a51c77007319 | 336 | /** @defgroup CAN_filter_number |
mbed_official | 52:a51c77007319 | 337 | * @{ |
mbed_official | 52:a51c77007319 | 338 | */ |
mbed_official | 52:a51c77007319 | 339 | #ifndef STM32F10X_CL |
mbed_official | 52:a51c77007319 | 340 | #define IS_CAN_FILTER_NUMBER(NUMBER) ((NUMBER) <= 13) |
mbed_official | 52:a51c77007319 | 341 | #else |
mbed_official | 52:a51c77007319 | 342 | #define IS_CAN_FILTER_NUMBER(NUMBER) ((NUMBER) <= 27) |
mbed_official | 52:a51c77007319 | 343 | #endif /* STM32F10X_CL */ |
mbed_official | 52:a51c77007319 | 344 | /** |
mbed_official | 52:a51c77007319 | 345 | * @} |
mbed_official | 52:a51c77007319 | 346 | */ |
mbed_official | 52:a51c77007319 | 347 | |
mbed_official | 52:a51c77007319 | 348 | /** @defgroup CAN_filter_mode |
mbed_official | 52:a51c77007319 | 349 | * @{ |
mbed_official | 52:a51c77007319 | 350 | */ |
mbed_official | 52:a51c77007319 | 351 | |
mbed_official | 52:a51c77007319 | 352 | #define CAN_FilterMode_IdMask ((uint8_t)0x00) /*!< identifier/mask mode */ |
mbed_official | 52:a51c77007319 | 353 | #define CAN_FilterMode_IdList ((uint8_t)0x01) /*!< identifier list mode */ |
mbed_official | 52:a51c77007319 | 354 | |
mbed_official | 52:a51c77007319 | 355 | #define IS_CAN_FILTER_MODE(MODE) (((MODE) == CAN_FilterMode_IdMask) || \ |
mbed_official | 52:a51c77007319 | 356 | ((MODE) == CAN_FilterMode_IdList)) |
mbed_official | 52:a51c77007319 | 357 | /** |
mbed_official | 52:a51c77007319 | 358 | * @} |
mbed_official | 52:a51c77007319 | 359 | */ |
mbed_official | 52:a51c77007319 | 360 | |
mbed_official | 52:a51c77007319 | 361 | /** @defgroup CAN_filter_scale |
mbed_official | 52:a51c77007319 | 362 | * @{ |
mbed_official | 52:a51c77007319 | 363 | */ |
mbed_official | 52:a51c77007319 | 364 | |
mbed_official | 52:a51c77007319 | 365 | #define CAN_FilterScale_16bit ((uint8_t)0x00) /*!< Two 16-bit filters */ |
mbed_official | 52:a51c77007319 | 366 | #define CAN_FilterScale_32bit ((uint8_t)0x01) /*!< One 32-bit filter */ |
mbed_official | 52:a51c77007319 | 367 | |
mbed_official | 52:a51c77007319 | 368 | #define IS_CAN_FILTER_SCALE(SCALE) (((SCALE) == CAN_FilterScale_16bit) || \ |
mbed_official | 52:a51c77007319 | 369 | ((SCALE) == CAN_FilterScale_32bit)) |
mbed_official | 52:a51c77007319 | 370 | |
mbed_official | 52:a51c77007319 | 371 | /** |
mbed_official | 52:a51c77007319 | 372 | * @} |
mbed_official | 52:a51c77007319 | 373 | */ |
mbed_official | 52:a51c77007319 | 374 | |
mbed_official | 52:a51c77007319 | 375 | /** @defgroup CAN_filter_FIFO |
mbed_official | 52:a51c77007319 | 376 | * @{ |
mbed_official | 52:a51c77007319 | 377 | */ |
mbed_official | 52:a51c77007319 | 378 | |
mbed_official | 52:a51c77007319 | 379 | #define CAN_Filter_FIFO0 ((uint8_t)0x00) /*!< Filter FIFO 0 assignment for filter x */ |
mbed_official | 52:a51c77007319 | 380 | #define CAN_Filter_FIFO1 ((uint8_t)0x01) /*!< Filter FIFO 1 assignment for filter x */ |
mbed_official | 52:a51c77007319 | 381 | #define IS_CAN_FILTER_FIFO(FIFO) (((FIFO) == CAN_FilterFIFO0) || \ |
mbed_official | 52:a51c77007319 | 382 | ((FIFO) == CAN_FilterFIFO1)) |
mbed_official | 52:a51c77007319 | 383 | /** |
mbed_official | 52:a51c77007319 | 384 | * @} |
mbed_official | 52:a51c77007319 | 385 | */ |
mbed_official | 52:a51c77007319 | 386 | |
mbed_official | 52:a51c77007319 | 387 | /** @defgroup Start_bank_filter_for_slave_CAN |
mbed_official | 52:a51c77007319 | 388 | * @{ |
mbed_official | 52:a51c77007319 | 389 | */ |
mbed_official | 52:a51c77007319 | 390 | #define IS_CAN_BANKNUMBER(BANKNUMBER) (((BANKNUMBER) >= 1) && ((BANKNUMBER) <= 27)) |
mbed_official | 52:a51c77007319 | 391 | /** |
mbed_official | 52:a51c77007319 | 392 | * @} |
mbed_official | 52:a51c77007319 | 393 | */ |
mbed_official | 52:a51c77007319 | 394 | |
mbed_official | 52:a51c77007319 | 395 | /** @defgroup CAN_Tx |
mbed_official | 52:a51c77007319 | 396 | * @{ |
mbed_official | 52:a51c77007319 | 397 | */ |
mbed_official | 52:a51c77007319 | 398 | |
mbed_official | 52:a51c77007319 | 399 | #define IS_CAN_TRANSMITMAILBOX(TRANSMITMAILBOX) ((TRANSMITMAILBOX) <= ((uint8_t)0x02)) |
mbed_official | 52:a51c77007319 | 400 | #define IS_CAN_STDID(STDID) ((STDID) <= ((uint32_t)0x7FF)) |
mbed_official | 52:a51c77007319 | 401 | #define IS_CAN_EXTID(EXTID) ((EXTID) <= ((uint32_t)0x1FFFFFFF)) |
mbed_official | 52:a51c77007319 | 402 | #define IS_CAN_DLC(DLC) ((DLC) <= ((uint8_t)0x08)) |
mbed_official | 52:a51c77007319 | 403 | |
mbed_official | 52:a51c77007319 | 404 | /** |
mbed_official | 52:a51c77007319 | 405 | * @} |
mbed_official | 52:a51c77007319 | 406 | */ |
mbed_official | 52:a51c77007319 | 407 | |
mbed_official | 52:a51c77007319 | 408 | /** @defgroup CAN_identifier_type |
mbed_official | 52:a51c77007319 | 409 | * @{ |
mbed_official | 52:a51c77007319 | 410 | */ |
mbed_official | 52:a51c77007319 | 411 | |
mbed_official | 52:a51c77007319 | 412 | #define CAN_Id_Standard ((uint32_t)0x00000000) /*!< Standard Id */ |
mbed_official | 52:a51c77007319 | 413 | #define CAN_Id_Extended ((uint32_t)0x00000004) /*!< Extended Id */ |
mbed_official | 52:a51c77007319 | 414 | #define IS_CAN_IDTYPE(IDTYPE) (((IDTYPE) == CAN_Id_Standard) || \ |
mbed_official | 52:a51c77007319 | 415 | ((IDTYPE) == CAN_Id_Extended)) |
mbed_official | 52:a51c77007319 | 416 | /** |
mbed_official | 52:a51c77007319 | 417 | * @} |
mbed_official | 52:a51c77007319 | 418 | */ |
mbed_official | 52:a51c77007319 | 419 | |
mbed_official | 52:a51c77007319 | 420 | /** @defgroup CAN_remote_transmission_request |
mbed_official | 52:a51c77007319 | 421 | * @{ |
mbed_official | 52:a51c77007319 | 422 | */ |
mbed_official | 52:a51c77007319 | 423 | |
mbed_official | 52:a51c77007319 | 424 | #define CAN_RTR_Data ((uint32_t)0x00000000) /*!< Data frame */ |
mbed_official | 52:a51c77007319 | 425 | #define CAN_RTR_Remote ((uint32_t)0x00000002) /*!< Remote frame */ |
mbed_official | 52:a51c77007319 | 426 | #define IS_CAN_RTR(RTR) (((RTR) == CAN_RTR_Data) || ((RTR) == CAN_RTR_Remote)) |
mbed_official | 52:a51c77007319 | 427 | |
mbed_official | 52:a51c77007319 | 428 | /** |
mbed_official | 52:a51c77007319 | 429 | * @} |
mbed_official | 52:a51c77007319 | 430 | */ |
mbed_official | 52:a51c77007319 | 431 | |
mbed_official | 52:a51c77007319 | 432 | /** @defgroup CAN_transmit_constants |
mbed_official | 52:a51c77007319 | 433 | * @{ |
mbed_official | 52:a51c77007319 | 434 | */ |
mbed_official | 52:a51c77007319 | 435 | |
mbed_official | 52:a51c77007319 | 436 | #define CAN_TxStatus_Failed ((uint8_t)0x00)/*!< CAN transmission failed */ |
mbed_official | 52:a51c77007319 | 437 | #define CAN_TxStatus_Ok ((uint8_t)0x01) /*!< CAN transmission succeeded */ |
mbed_official | 52:a51c77007319 | 438 | #define CAN_TxStatus_Pending ((uint8_t)0x02) /*!< CAN transmission pending */ |
mbed_official | 52:a51c77007319 | 439 | #define CAN_TxStatus_NoMailBox ((uint8_t)0x04) /*!< CAN cell did not provide an empty mailbox */ |
mbed_official | 52:a51c77007319 | 440 | |
mbed_official | 52:a51c77007319 | 441 | /** |
mbed_official | 52:a51c77007319 | 442 | * @} |
mbed_official | 52:a51c77007319 | 443 | */ |
mbed_official | 52:a51c77007319 | 444 | |
mbed_official | 52:a51c77007319 | 445 | /** @defgroup CAN_receive_FIFO_number_constants |
mbed_official | 52:a51c77007319 | 446 | * @{ |
mbed_official | 52:a51c77007319 | 447 | */ |
mbed_official | 52:a51c77007319 | 448 | |
mbed_official | 52:a51c77007319 | 449 | #define CAN_FIFO0 ((uint8_t)0x00) /*!< CAN FIFO 0 used to receive */ |
mbed_official | 52:a51c77007319 | 450 | #define CAN_FIFO1 ((uint8_t)0x01) /*!< CAN FIFO 1 used to receive */ |
mbed_official | 52:a51c77007319 | 451 | |
mbed_official | 52:a51c77007319 | 452 | #define IS_CAN_FIFO(FIFO) (((FIFO) == CAN_FIFO0) || ((FIFO) == CAN_FIFO1)) |
mbed_official | 52:a51c77007319 | 453 | |
mbed_official | 52:a51c77007319 | 454 | /** |
mbed_official | 52:a51c77007319 | 455 | * @} |
mbed_official | 52:a51c77007319 | 456 | */ |
mbed_official | 52:a51c77007319 | 457 | |
mbed_official | 52:a51c77007319 | 458 | /** @defgroup CAN_sleep_constants |
mbed_official | 52:a51c77007319 | 459 | * @{ |
mbed_official | 52:a51c77007319 | 460 | */ |
mbed_official | 52:a51c77007319 | 461 | |
mbed_official | 52:a51c77007319 | 462 | #define CAN_Sleep_Failed ((uint8_t)0x00) /*!< CAN did not enter the sleep mode */ |
mbed_official | 52:a51c77007319 | 463 | #define CAN_Sleep_Ok ((uint8_t)0x01) /*!< CAN entered the sleep mode */ |
mbed_official | 52:a51c77007319 | 464 | |
mbed_official | 52:a51c77007319 | 465 | /** |
mbed_official | 52:a51c77007319 | 466 | * @} |
mbed_official | 52:a51c77007319 | 467 | */ |
mbed_official | 52:a51c77007319 | 468 | |
mbed_official | 52:a51c77007319 | 469 | /** @defgroup CAN_wake_up_constants |
mbed_official | 52:a51c77007319 | 470 | * @{ |
mbed_official | 52:a51c77007319 | 471 | */ |
mbed_official | 52:a51c77007319 | 472 | |
mbed_official | 52:a51c77007319 | 473 | #define CAN_WakeUp_Failed ((uint8_t)0x00) /*!< CAN did not leave the sleep mode */ |
mbed_official | 52:a51c77007319 | 474 | #define CAN_WakeUp_Ok ((uint8_t)0x01) /*!< CAN leaved the sleep mode */ |
mbed_official | 52:a51c77007319 | 475 | |
mbed_official | 52:a51c77007319 | 476 | /** |
mbed_official | 52:a51c77007319 | 477 | * @} |
mbed_official | 52:a51c77007319 | 478 | */ |
mbed_official | 52:a51c77007319 | 479 | |
mbed_official | 52:a51c77007319 | 480 | /** |
mbed_official | 52:a51c77007319 | 481 | * @defgroup CAN_Error_Code_constants |
mbed_official | 52:a51c77007319 | 482 | * @{ |
mbed_official | 52:a51c77007319 | 483 | */ |
mbed_official | 52:a51c77007319 | 484 | |
mbed_official | 52:a51c77007319 | 485 | #define CAN_ErrorCode_NoErr ((uint8_t)0x00) /*!< No Error */ |
mbed_official | 52:a51c77007319 | 486 | #define CAN_ErrorCode_StuffErr ((uint8_t)0x10) /*!< Stuff Error */ |
mbed_official | 52:a51c77007319 | 487 | #define CAN_ErrorCode_FormErr ((uint8_t)0x20) /*!< Form Error */ |
mbed_official | 52:a51c77007319 | 488 | #define CAN_ErrorCode_ACKErr ((uint8_t)0x30) /*!< Acknowledgment Error */ |
mbed_official | 52:a51c77007319 | 489 | #define CAN_ErrorCode_BitRecessiveErr ((uint8_t)0x40) /*!< Bit Recessive Error */ |
mbed_official | 52:a51c77007319 | 490 | #define CAN_ErrorCode_BitDominantErr ((uint8_t)0x50) /*!< Bit Dominant Error */ |
mbed_official | 52:a51c77007319 | 491 | #define CAN_ErrorCode_CRCErr ((uint8_t)0x60) /*!< CRC Error */ |
mbed_official | 52:a51c77007319 | 492 | #define CAN_ErrorCode_SoftwareSetErr ((uint8_t)0x70) /*!< Software Set Error */ |
mbed_official | 52:a51c77007319 | 493 | |
mbed_official | 52:a51c77007319 | 494 | |
mbed_official | 52:a51c77007319 | 495 | /** |
mbed_official | 52:a51c77007319 | 496 | * @} |
mbed_official | 52:a51c77007319 | 497 | */ |
mbed_official | 52:a51c77007319 | 498 | |
mbed_official | 52:a51c77007319 | 499 | /** @defgroup CAN_flags |
mbed_official | 52:a51c77007319 | 500 | * @{ |
mbed_official | 52:a51c77007319 | 501 | */ |
mbed_official | 52:a51c77007319 | 502 | /* If the flag is 0x3XXXXXXX, it means that it can be used with CAN_GetFlagStatus() |
mbed_official | 52:a51c77007319 | 503 | and CAN_ClearFlag() functions. */ |
mbed_official | 52:a51c77007319 | 504 | /* If the flag is 0x1XXXXXXX, it means that it can only be used with CAN_GetFlagStatus() function. */ |
mbed_official | 52:a51c77007319 | 505 | |
mbed_official | 52:a51c77007319 | 506 | /* Transmit Flags */ |
mbed_official | 52:a51c77007319 | 507 | #define CAN_FLAG_RQCP0 ((uint32_t)0x38000001) /*!< Request MailBox0 Flag */ |
mbed_official | 52:a51c77007319 | 508 | #define CAN_FLAG_RQCP1 ((uint32_t)0x38000100) /*!< Request MailBox1 Flag */ |
mbed_official | 52:a51c77007319 | 509 | #define CAN_FLAG_RQCP2 ((uint32_t)0x38010000) /*!< Request MailBox2 Flag */ |
mbed_official | 52:a51c77007319 | 510 | |
mbed_official | 52:a51c77007319 | 511 | /* Receive Flags */ |
mbed_official | 52:a51c77007319 | 512 | #define CAN_FLAG_FMP0 ((uint32_t)0x12000003) /*!< FIFO 0 Message Pending Flag */ |
mbed_official | 52:a51c77007319 | 513 | #define CAN_FLAG_FF0 ((uint32_t)0x32000008) /*!< FIFO 0 Full Flag */ |
mbed_official | 52:a51c77007319 | 514 | #define CAN_FLAG_FOV0 ((uint32_t)0x32000010) /*!< FIFO 0 Overrun Flag */ |
mbed_official | 52:a51c77007319 | 515 | #define CAN_FLAG_FMP1 ((uint32_t)0x14000003) /*!< FIFO 1 Message Pending Flag */ |
mbed_official | 52:a51c77007319 | 516 | #define CAN_FLAG_FF1 ((uint32_t)0x34000008) /*!< FIFO 1 Full Flag */ |
mbed_official | 52:a51c77007319 | 517 | #define CAN_FLAG_FOV1 ((uint32_t)0x34000010) /*!< FIFO 1 Overrun Flag */ |
mbed_official | 52:a51c77007319 | 518 | |
mbed_official | 52:a51c77007319 | 519 | /* Operating Mode Flags */ |
mbed_official | 52:a51c77007319 | 520 | #define CAN_FLAG_WKU ((uint32_t)0x31000008) /*!< Wake up Flag */ |
mbed_official | 52:a51c77007319 | 521 | #define CAN_FLAG_SLAK ((uint32_t)0x31000012) /*!< Sleep acknowledge Flag */ |
mbed_official | 52:a51c77007319 | 522 | /* Note: When SLAK intterupt is disabled (SLKIE=0), no polling on SLAKI is possible. |
mbed_official | 52:a51c77007319 | 523 | In this case the SLAK bit can be polled.*/ |
mbed_official | 52:a51c77007319 | 524 | |
mbed_official | 52:a51c77007319 | 525 | /* Error Flags */ |
mbed_official | 52:a51c77007319 | 526 | #define CAN_FLAG_EWG ((uint32_t)0x10F00001) /*!< Error Warning Flag */ |
mbed_official | 52:a51c77007319 | 527 | #define CAN_FLAG_EPV ((uint32_t)0x10F00002) /*!< Error Passive Flag */ |
mbed_official | 52:a51c77007319 | 528 | #define CAN_FLAG_BOF ((uint32_t)0x10F00004) /*!< Bus-Off Flag */ |
mbed_official | 52:a51c77007319 | 529 | #define CAN_FLAG_LEC ((uint32_t)0x30F00070) /*!< Last error code Flag */ |
mbed_official | 52:a51c77007319 | 530 | |
mbed_official | 52:a51c77007319 | 531 | #define IS_CAN_GET_FLAG(FLAG) (((FLAG) == CAN_FLAG_LEC) || ((FLAG) == CAN_FLAG_BOF) || \ |
mbed_official | 52:a51c77007319 | 532 | ((FLAG) == CAN_FLAG_EPV) || ((FLAG) == CAN_FLAG_EWG) || \ |
mbed_official | 52:a51c77007319 | 533 | ((FLAG) == CAN_FLAG_WKU) || ((FLAG) == CAN_FLAG_FOV0) || \ |
mbed_official | 52:a51c77007319 | 534 | ((FLAG) == CAN_FLAG_FF0) || ((FLAG) == CAN_FLAG_FMP0) || \ |
mbed_official | 52:a51c77007319 | 535 | ((FLAG) == CAN_FLAG_FOV1) || ((FLAG) == CAN_FLAG_FF1) || \ |
mbed_official | 52:a51c77007319 | 536 | ((FLAG) == CAN_FLAG_FMP1) || ((FLAG) == CAN_FLAG_RQCP2) || \ |
mbed_official | 52:a51c77007319 | 537 | ((FLAG) == CAN_FLAG_RQCP1)|| ((FLAG) == CAN_FLAG_RQCP0) || \ |
mbed_official | 52:a51c77007319 | 538 | ((FLAG) == CAN_FLAG_SLAK )) |
mbed_official | 52:a51c77007319 | 539 | |
mbed_official | 52:a51c77007319 | 540 | #define IS_CAN_CLEAR_FLAG(FLAG)(((FLAG) == CAN_FLAG_LEC) || ((FLAG) == CAN_FLAG_RQCP2) || \ |
mbed_official | 52:a51c77007319 | 541 | ((FLAG) == CAN_FLAG_RQCP1) || ((FLAG) == CAN_FLAG_RQCP0) || \ |
mbed_official | 52:a51c77007319 | 542 | ((FLAG) == CAN_FLAG_FF0) || ((FLAG) == CAN_FLAG_FOV0) ||\ |
mbed_official | 52:a51c77007319 | 543 | ((FLAG) == CAN_FLAG_FF1) || ((FLAG) == CAN_FLAG_FOV1) || \ |
mbed_official | 52:a51c77007319 | 544 | ((FLAG) == CAN_FLAG_WKU) || ((FLAG) == CAN_FLAG_SLAK)) |
mbed_official | 52:a51c77007319 | 545 | /** |
mbed_official | 52:a51c77007319 | 546 | * @} |
mbed_official | 52:a51c77007319 | 547 | */ |
mbed_official | 52:a51c77007319 | 548 | |
mbed_official | 52:a51c77007319 | 549 | |
mbed_official | 52:a51c77007319 | 550 | /** @defgroup CAN_interrupts |
mbed_official | 52:a51c77007319 | 551 | * @{ |
mbed_official | 52:a51c77007319 | 552 | */ |
mbed_official | 52:a51c77007319 | 553 | |
mbed_official | 52:a51c77007319 | 554 | |
mbed_official | 52:a51c77007319 | 555 | |
mbed_official | 52:a51c77007319 | 556 | #define CAN_IT_TME ((uint32_t)0x00000001) /*!< Transmit mailbox empty Interrupt*/ |
mbed_official | 52:a51c77007319 | 557 | |
mbed_official | 52:a51c77007319 | 558 | /* Receive Interrupts */ |
mbed_official | 52:a51c77007319 | 559 | #define CAN_IT_FMP0 ((uint32_t)0x00000002) /*!< FIFO 0 message pending Interrupt*/ |
mbed_official | 52:a51c77007319 | 560 | #define CAN_IT_FF0 ((uint32_t)0x00000004) /*!< FIFO 0 full Interrupt*/ |
mbed_official | 52:a51c77007319 | 561 | #define CAN_IT_FOV0 ((uint32_t)0x00000008) /*!< FIFO 0 overrun Interrupt*/ |
mbed_official | 52:a51c77007319 | 562 | #define CAN_IT_FMP1 ((uint32_t)0x00000010) /*!< FIFO 1 message pending Interrupt*/ |
mbed_official | 52:a51c77007319 | 563 | #define CAN_IT_FF1 ((uint32_t)0x00000020) /*!< FIFO 1 full Interrupt*/ |
mbed_official | 52:a51c77007319 | 564 | #define CAN_IT_FOV1 ((uint32_t)0x00000040) /*!< FIFO 1 overrun Interrupt*/ |
mbed_official | 52:a51c77007319 | 565 | |
mbed_official | 52:a51c77007319 | 566 | /* Operating Mode Interrupts */ |
mbed_official | 52:a51c77007319 | 567 | #define CAN_IT_WKU ((uint32_t)0x00010000) /*!< Wake-up Interrupt*/ |
mbed_official | 52:a51c77007319 | 568 | #define CAN_IT_SLK ((uint32_t)0x00020000) /*!< Sleep acknowledge Interrupt*/ |
mbed_official | 52:a51c77007319 | 569 | |
mbed_official | 52:a51c77007319 | 570 | /* Error Interrupts */ |
mbed_official | 52:a51c77007319 | 571 | #define CAN_IT_EWG ((uint32_t)0x00000100) /*!< Error warning Interrupt*/ |
mbed_official | 52:a51c77007319 | 572 | #define CAN_IT_EPV ((uint32_t)0x00000200) /*!< Error passive Interrupt*/ |
mbed_official | 52:a51c77007319 | 573 | #define CAN_IT_BOF ((uint32_t)0x00000400) /*!< Bus-off Interrupt*/ |
mbed_official | 52:a51c77007319 | 574 | #define CAN_IT_LEC ((uint32_t)0x00000800) /*!< Last error code Interrupt*/ |
mbed_official | 52:a51c77007319 | 575 | #define CAN_IT_ERR ((uint32_t)0x00008000) /*!< Error Interrupt*/ |
mbed_official | 52:a51c77007319 | 576 | |
mbed_official | 52:a51c77007319 | 577 | /* Flags named as Interrupts : kept only for FW compatibility */ |
mbed_official | 52:a51c77007319 | 578 | #define CAN_IT_RQCP0 CAN_IT_TME |
mbed_official | 52:a51c77007319 | 579 | #define CAN_IT_RQCP1 CAN_IT_TME |
mbed_official | 52:a51c77007319 | 580 | #define CAN_IT_RQCP2 CAN_IT_TME |
mbed_official | 52:a51c77007319 | 581 | |
mbed_official | 52:a51c77007319 | 582 | |
mbed_official | 52:a51c77007319 | 583 | #define IS_CAN_IT(IT) (((IT) == CAN_IT_TME) || ((IT) == CAN_IT_FMP0) ||\ |
mbed_official | 52:a51c77007319 | 584 | ((IT) == CAN_IT_FF0) || ((IT) == CAN_IT_FOV0) ||\ |
mbed_official | 52:a51c77007319 | 585 | ((IT) == CAN_IT_FMP1) || ((IT) == CAN_IT_FF1) ||\ |
mbed_official | 52:a51c77007319 | 586 | ((IT) == CAN_IT_FOV1) || ((IT) == CAN_IT_EWG) ||\ |
mbed_official | 52:a51c77007319 | 587 | ((IT) == CAN_IT_EPV) || ((IT) == CAN_IT_BOF) ||\ |
mbed_official | 52:a51c77007319 | 588 | ((IT) == CAN_IT_LEC) || ((IT) == CAN_IT_ERR) ||\ |
mbed_official | 52:a51c77007319 | 589 | ((IT) == CAN_IT_WKU) || ((IT) == CAN_IT_SLK)) |
mbed_official | 52:a51c77007319 | 590 | |
mbed_official | 52:a51c77007319 | 591 | #define IS_CAN_CLEAR_IT(IT) (((IT) == CAN_IT_TME) || ((IT) == CAN_IT_FF0) ||\ |
mbed_official | 52:a51c77007319 | 592 | ((IT) == CAN_IT_FOV0)|| ((IT) == CAN_IT_FF1) ||\ |
mbed_official | 52:a51c77007319 | 593 | ((IT) == CAN_IT_FOV1)|| ((IT) == CAN_IT_EWG) ||\ |
mbed_official | 52:a51c77007319 | 594 | ((IT) == CAN_IT_EPV) || ((IT) == CAN_IT_BOF) ||\ |
mbed_official | 52:a51c77007319 | 595 | ((IT) == CAN_IT_LEC) || ((IT) == CAN_IT_ERR) ||\ |
mbed_official | 52:a51c77007319 | 596 | ((IT) == CAN_IT_WKU) || ((IT) == CAN_IT_SLK)) |
mbed_official | 52:a51c77007319 | 597 | |
mbed_official | 52:a51c77007319 | 598 | /** |
mbed_official | 52:a51c77007319 | 599 | * @} |
mbed_official | 52:a51c77007319 | 600 | */ |
mbed_official | 52:a51c77007319 | 601 | |
mbed_official | 52:a51c77007319 | 602 | /** @defgroup CAN_Legacy |
mbed_official | 52:a51c77007319 | 603 | * @{ |
mbed_official | 52:a51c77007319 | 604 | */ |
mbed_official | 52:a51c77007319 | 605 | #define CANINITFAILED CAN_InitStatus_Failed |
mbed_official | 52:a51c77007319 | 606 | #define CANINITOK CAN_InitStatus_Success |
mbed_official | 52:a51c77007319 | 607 | #define CAN_FilterFIFO0 CAN_Filter_FIFO0 |
mbed_official | 52:a51c77007319 | 608 | #define CAN_FilterFIFO1 CAN_Filter_FIFO1 |
mbed_official | 52:a51c77007319 | 609 | #define CAN_ID_STD CAN_Id_Standard |
mbed_official | 52:a51c77007319 | 610 | #define CAN_ID_EXT CAN_Id_Extended |
mbed_official | 52:a51c77007319 | 611 | #define CAN_RTR_DATA CAN_RTR_Data |
mbed_official | 52:a51c77007319 | 612 | #define CAN_RTR_REMOTE CAN_RTR_Remote |
mbed_official | 52:a51c77007319 | 613 | #define CANTXFAILE CAN_TxStatus_Failed |
mbed_official | 52:a51c77007319 | 614 | #define CANTXOK CAN_TxStatus_Ok |
mbed_official | 52:a51c77007319 | 615 | #define CANTXPENDING CAN_TxStatus_Pending |
mbed_official | 52:a51c77007319 | 616 | #define CAN_NO_MB CAN_TxStatus_NoMailBox |
mbed_official | 52:a51c77007319 | 617 | #define CANSLEEPFAILED CAN_Sleep_Failed |
mbed_official | 52:a51c77007319 | 618 | #define CANSLEEPOK CAN_Sleep_Ok |
mbed_official | 52:a51c77007319 | 619 | #define CANWAKEUPFAILED CAN_WakeUp_Failed |
mbed_official | 52:a51c77007319 | 620 | #define CANWAKEUPOK CAN_WakeUp_Ok |
mbed_official | 52:a51c77007319 | 621 | |
mbed_official | 52:a51c77007319 | 622 | /** |
mbed_official | 52:a51c77007319 | 623 | * @} |
mbed_official | 52:a51c77007319 | 624 | */ |
mbed_official | 52:a51c77007319 | 625 | |
mbed_official | 52:a51c77007319 | 626 | /** |
mbed_official | 52:a51c77007319 | 627 | * @} |
mbed_official | 52:a51c77007319 | 628 | */ |
mbed_official | 52:a51c77007319 | 629 | |
mbed_official | 52:a51c77007319 | 630 | /** @defgroup CAN_Exported_Macros |
mbed_official | 52:a51c77007319 | 631 | * @{ |
mbed_official | 52:a51c77007319 | 632 | */ |
mbed_official | 52:a51c77007319 | 633 | |
mbed_official | 52:a51c77007319 | 634 | /** |
mbed_official | 52:a51c77007319 | 635 | * @} |
mbed_official | 52:a51c77007319 | 636 | */ |
mbed_official | 52:a51c77007319 | 637 | |
mbed_official | 52:a51c77007319 | 638 | /** @defgroup CAN_Exported_Functions |
mbed_official | 52:a51c77007319 | 639 | * @{ |
mbed_official | 52:a51c77007319 | 640 | */ |
mbed_official | 52:a51c77007319 | 641 | /* Function used to set the CAN configuration to the default reset state *****/ |
mbed_official | 52:a51c77007319 | 642 | void CAN_DeInit(CAN_TypeDef* CANx); |
mbed_official | 52:a51c77007319 | 643 | |
mbed_official | 52:a51c77007319 | 644 | /* Initialization and Configuration functions *********************************/ |
mbed_official | 52:a51c77007319 | 645 | uint8_t CAN_Init(CAN_TypeDef* CANx, CAN_InitTypeDef* CAN_InitStruct); |
mbed_official | 52:a51c77007319 | 646 | void CAN_FilterInit(CAN_FilterInitTypeDef* CAN_FilterInitStruct); |
mbed_official | 52:a51c77007319 | 647 | void CAN_StructInit(CAN_InitTypeDef* CAN_InitStruct); |
mbed_official | 52:a51c77007319 | 648 | void CAN_SlaveStartBank(uint8_t CAN_BankNumber); |
mbed_official | 52:a51c77007319 | 649 | void CAN_DBGFreeze(CAN_TypeDef* CANx, FunctionalState NewState); |
mbed_official | 52:a51c77007319 | 650 | void CAN_TTComModeCmd(CAN_TypeDef* CANx, FunctionalState NewState); |
mbed_official | 52:a51c77007319 | 651 | |
mbed_official | 52:a51c77007319 | 652 | /* Transmit functions *********************************************************/ |
mbed_official | 52:a51c77007319 | 653 | uint8_t CAN_Transmit(CAN_TypeDef* CANx, CanTxMsg* TxMessage); |
mbed_official | 52:a51c77007319 | 654 | uint8_t CAN_TransmitStatus(CAN_TypeDef* CANx, uint8_t TransmitMailbox); |
mbed_official | 52:a51c77007319 | 655 | void CAN_CancelTransmit(CAN_TypeDef* CANx, uint8_t Mailbox); |
mbed_official | 52:a51c77007319 | 656 | |
mbed_official | 52:a51c77007319 | 657 | /* Receive functions **********************************************************/ |
mbed_official | 52:a51c77007319 | 658 | void CAN_Receive(CAN_TypeDef* CANx, uint8_t FIFONumber, CanRxMsg* RxMessage); |
mbed_official | 52:a51c77007319 | 659 | void CAN_FIFORelease(CAN_TypeDef* CANx, uint8_t FIFONumber); |
mbed_official | 52:a51c77007319 | 660 | uint8_t CAN_MessagePending(CAN_TypeDef* CANx, uint8_t FIFONumber); |
mbed_official | 52:a51c77007319 | 661 | |
mbed_official | 52:a51c77007319 | 662 | |
mbed_official | 52:a51c77007319 | 663 | /* Operation modes functions **************************************************/ |
mbed_official | 52:a51c77007319 | 664 | uint8_t CAN_OperatingModeRequest(CAN_TypeDef* CANx, uint8_t CAN_OperatingMode); |
mbed_official | 52:a51c77007319 | 665 | uint8_t CAN_Sleep(CAN_TypeDef* CANx); |
mbed_official | 52:a51c77007319 | 666 | uint8_t CAN_WakeUp(CAN_TypeDef* CANx); |
mbed_official | 52:a51c77007319 | 667 | |
mbed_official | 52:a51c77007319 | 668 | /* Error management functions *************************************************/ |
mbed_official | 52:a51c77007319 | 669 | uint8_t CAN_GetLastErrorCode(CAN_TypeDef* CANx); |
mbed_official | 52:a51c77007319 | 670 | uint8_t CAN_GetReceiveErrorCounter(CAN_TypeDef* CANx); |
mbed_official | 52:a51c77007319 | 671 | uint8_t CAN_GetLSBTransmitErrorCounter(CAN_TypeDef* CANx); |
mbed_official | 52:a51c77007319 | 672 | |
mbed_official | 52:a51c77007319 | 673 | /* Interrupts and flags management functions **********************************/ |
mbed_official | 52:a51c77007319 | 674 | void CAN_ITConfig(CAN_TypeDef* CANx, uint32_t CAN_IT, FunctionalState NewState); |
mbed_official | 52:a51c77007319 | 675 | FlagStatus CAN_GetFlagStatus(CAN_TypeDef* CANx, uint32_t CAN_FLAG); |
mbed_official | 52:a51c77007319 | 676 | void CAN_ClearFlag(CAN_TypeDef* CANx, uint32_t CAN_FLAG); |
mbed_official | 52:a51c77007319 | 677 | ITStatus CAN_GetITStatus(CAN_TypeDef* CANx, uint32_t CAN_IT); |
mbed_official | 52:a51c77007319 | 678 | void CAN_ClearITPendingBit(CAN_TypeDef* CANx, uint32_t CAN_IT); |
mbed_official | 52:a51c77007319 | 679 | |
mbed_official | 52:a51c77007319 | 680 | #ifdef __cplusplus |
mbed_official | 52:a51c77007319 | 681 | } |
mbed_official | 52:a51c77007319 | 682 | #endif |
mbed_official | 52:a51c77007319 | 683 | |
mbed_official | 52:a51c77007319 | 684 | #endif /* __STM32F10x_CAN_H */ |
mbed_official | 52:a51c77007319 | 685 | /** |
mbed_official | 52:a51c77007319 | 686 | * @} |
mbed_official | 52:a51c77007319 | 687 | */ |
mbed_official | 52:a51c77007319 | 688 | |
mbed_official | 52:a51c77007319 | 689 | /** |
mbed_official | 52:a51c77007319 | 690 | * @} |
mbed_official | 52:a51c77007319 | 691 | */ |
mbed_official | 52:a51c77007319 | 692 | |
mbed_official | 52:a51c77007319 | 693 | /** |
mbed_official | 52:a51c77007319 | 694 | * @} |
mbed_official | 52:a51c77007319 | 695 | */ |
mbed_official | 52:a51c77007319 | 696 | |
mbed_official | 52:a51c77007319 | 697 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ |