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