mbed library sources modified for open wear
Dependents: openwear-lifelogger-example
Fork of mbed-src by
targets/cmsis/TARGET_STM/TARGET_NUCLEO_F411RE/stm32f4xx_hal_can.h@310:6188e0254baa, 2014-09-16 (annotated)
- Committer:
- janekm
- Date:
- Tue Sep 16 22:42:01 2014 +0000
- Revision:
- 310:6188e0254baa
- Parent:
- 235:685d5f11838f
N/A
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbed_official | 235:685d5f11838f | 1 | /** |
mbed_official | 235:685d5f11838f | 2 | ****************************************************************************** |
mbed_official | 235:685d5f11838f | 3 | * @file stm32f4xx_hal_can.h |
mbed_official | 235:685d5f11838f | 4 | * @author MCD Application Team |
mbed_official | 235:685d5f11838f | 5 | * @version V1.1.0 |
mbed_official | 235:685d5f11838f | 6 | * @date 19-June-2014 |
mbed_official | 235:685d5f11838f | 7 | * @brief Header file of CAN HAL module. |
mbed_official | 235:685d5f11838f | 8 | ****************************************************************************** |
mbed_official | 235:685d5f11838f | 9 | * @attention |
mbed_official | 235:685d5f11838f | 10 | * |
mbed_official | 235:685d5f11838f | 11 | * <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2> |
mbed_official | 235:685d5f11838f | 12 | * |
mbed_official | 235:685d5f11838f | 13 | * Redistribution and use in source and binary forms, with or without modification, |
mbed_official | 235:685d5f11838f | 14 | * are permitted provided that the following conditions are met: |
mbed_official | 235:685d5f11838f | 15 | * 1. Redistributions of source code must retain the above copyright notice, |
mbed_official | 235:685d5f11838f | 16 | * this list of conditions and the following disclaimer. |
mbed_official | 235:685d5f11838f | 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
mbed_official | 235:685d5f11838f | 18 | * this list of conditions and the following disclaimer in the documentation |
mbed_official | 235:685d5f11838f | 19 | * and/or other materials provided with the distribution. |
mbed_official | 235:685d5f11838f | 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
mbed_official | 235:685d5f11838f | 21 | * may be used to endorse or promote products derived from this software |
mbed_official | 235:685d5f11838f | 22 | * without specific prior written permission. |
mbed_official | 235:685d5f11838f | 23 | * |
mbed_official | 235:685d5f11838f | 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
mbed_official | 235:685d5f11838f | 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
mbed_official | 235:685d5f11838f | 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
mbed_official | 235:685d5f11838f | 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
mbed_official | 235:685d5f11838f | 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
mbed_official | 235:685d5f11838f | 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
mbed_official | 235:685d5f11838f | 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
mbed_official | 235:685d5f11838f | 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
mbed_official | 235:685d5f11838f | 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
mbed_official | 235:685d5f11838f | 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
mbed_official | 235:685d5f11838f | 34 | * |
mbed_official | 235:685d5f11838f | 35 | ****************************************************************************** |
mbed_official | 235:685d5f11838f | 36 | */ |
mbed_official | 235:685d5f11838f | 37 | |
mbed_official | 235:685d5f11838f | 38 | /* Define to prevent recursive inclusion -------------------------------------*/ |
mbed_official | 235:685d5f11838f | 39 | #ifndef __STM32F4xx_HAL_CAN_H |
mbed_official | 235:685d5f11838f | 40 | #define __STM32F4xx_HAL_CAN_H |
mbed_official | 235:685d5f11838f | 41 | |
mbed_official | 235:685d5f11838f | 42 | #ifdef __cplusplus |
mbed_official | 235:685d5f11838f | 43 | extern "C" { |
mbed_official | 235:685d5f11838f | 44 | #endif |
mbed_official | 235:685d5f11838f | 45 | |
mbed_official | 235:685d5f11838f | 46 | #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) || defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) |
mbed_official | 235:685d5f11838f | 47 | /* Includes ------------------------------------------------------------------*/ |
mbed_official | 235:685d5f11838f | 48 | #include "stm32f4xx_hal_def.h" |
mbed_official | 235:685d5f11838f | 49 | |
mbed_official | 235:685d5f11838f | 50 | /** @addtogroup STM32F4xx_HAL_Driver |
mbed_official | 235:685d5f11838f | 51 | * @{ |
mbed_official | 235:685d5f11838f | 52 | */ |
mbed_official | 235:685d5f11838f | 53 | |
mbed_official | 235:685d5f11838f | 54 | /** @addtogroup CAN |
mbed_official | 235:685d5f11838f | 55 | * @{ |
mbed_official | 235:685d5f11838f | 56 | */ |
mbed_official | 235:685d5f11838f | 57 | |
mbed_official | 235:685d5f11838f | 58 | /* Exported types ------------------------------------------------------------*/ |
mbed_official | 235:685d5f11838f | 59 | |
mbed_official | 235:685d5f11838f | 60 | /** |
mbed_official | 235:685d5f11838f | 61 | * @brief HAL State structures definition |
mbed_official | 235:685d5f11838f | 62 | */ |
mbed_official | 235:685d5f11838f | 63 | typedef enum |
mbed_official | 235:685d5f11838f | 64 | { |
mbed_official | 235:685d5f11838f | 65 | HAL_CAN_STATE_RESET = 0x00, /*!< CAN not yet initialized or disabled */ |
mbed_official | 235:685d5f11838f | 66 | HAL_CAN_STATE_READY = 0x01, /*!< CAN initialized and ready for use */ |
mbed_official | 235:685d5f11838f | 67 | HAL_CAN_STATE_BUSY = 0x02, /*!< CAN process is ongoing */ |
mbed_official | 235:685d5f11838f | 68 | HAL_CAN_STATE_BUSY_TX = 0x12, /*!< CAN process is ongoing */ |
mbed_official | 235:685d5f11838f | 69 | HAL_CAN_STATE_BUSY_RX = 0x22, /*!< CAN process is ongoing */ |
mbed_official | 235:685d5f11838f | 70 | HAL_CAN_STATE_BUSY_TX_RX = 0x32, /*!< CAN process is ongoing */ |
mbed_official | 235:685d5f11838f | 71 | HAL_CAN_STATE_TIMEOUT = 0x03, /*!< Timeout state */ |
mbed_official | 235:685d5f11838f | 72 | HAL_CAN_STATE_ERROR = 0x04 /*!< CAN error state */ |
mbed_official | 235:685d5f11838f | 73 | |
mbed_official | 235:685d5f11838f | 74 | }HAL_CAN_StateTypeDef; |
mbed_official | 235:685d5f11838f | 75 | |
mbed_official | 235:685d5f11838f | 76 | /** |
mbed_official | 235:685d5f11838f | 77 | * @brief CAN init structure definition |
mbed_official | 235:685d5f11838f | 78 | */ |
mbed_official | 235:685d5f11838f | 79 | typedef struct |
mbed_official | 235:685d5f11838f | 80 | { |
mbed_official | 235:685d5f11838f | 81 | uint32_t Prescaler; /*!< Specifies the length of a time quantum. |
mbed_official | 235:685d5f11838f | 82 | This parameter must be a number between Min_Data = 1 and Max_Data = 1024 */ |
mbed_official | 235:685d5f11838f | 83 | |
mbed_official | 235:685d5f11838f | 84 | uint32_t Mode; /*!< Specifies the CAN operating mode. |
mbed_official | 235:685d5f11838f | 85 | This parameter can be a value of @ref CAN_operating_mode */ |
mbed_official | 235:685d5f11838f | 86 | |
mbed_official | 235:685d5f11838f | 87 | uint32_t SJW; /*!< Specifies the maximum number of time quanta |
mbed_official | 235:685d5f11838f | 88 | the CAN hardware is allowed to lengthen or |
mbed_official | 235:685d5f11838f | 89 | shorten a bit to perform resynchronization. |
mbed_official | 235:685d5f11838f | 90 | This parameter can be a value of @ref CAN_synchronisation_jump_width */ |
mbed_official | 235:685d5f11838f | 91 | |
mbed_official | 235:685d5f11838f | 92 | uint32_t BS1; /*!< Specifies the number of time quanta in Bit Segment 1. |
mbed_official | 235:685d5f11838f | 93 | This parameter can be a value of @ref CAN_time_quantum_in_bit_segment_1 */ |
mbed_official | 235:685d5f11838f | 94 | |
mbed_official | 235:685d5f11838f | 95 | uint32_t BS2; /*!< Specifies the number of time quanta in Bit Segment 2. |
mbed_official | 235:685d5f11838f | 96 | This parameter can be a value of @ref CAN_time_quantum_in_bit_segment_2 */ |
mbed_official | 235:685d5f11838f | 97 | |
mbed_official | 235:685d5f11838f | 98 | uint32_t TTCM; /*!< Enable or disable the time triggered communication mode. |
mbed_official | 235:685d5f11838f | 99 | This parameter can be set to ENABLE or DISABLE. */ |
mbed_official | 235:685d5f11838f | 100 | |
mbed_official | 235:685d5f11838f | 101 | uint32_t ABOM; /*!< Enable or disable the automatic bus-off management. |
mbed_official | 235:685d5f11838f | 102 | This parameter can be set to ENABLE or DISABLE */ |
mbed_official | 235:685d5f11838f | 103 | |
mbed_official | 235:685d5f11838f | 104 | uint32_t AWUM; /*!< Enable or disable the automatic wake-up mode. |
mbed_official | 235:685d5f11838f | 105 | This parameter can be set to ENABLE or DISABLE */ |
mbed_official | 235:685d5f11838f | 106 | |
mbed_official | 235:685d5f11838f | 107 | uint32_t NART; /*!< Enable or disable the non-automatic retransmission mode. |
mbed_official | 235:685d5f11838f | 108 | This parameter can be set to ENABLE or DISABLE */ |
mbed_official | 235:685d5f11838f | 109 | |
mbed_official | 235:685d5f11838f | 110 | uint32_t RFLM; /*!< Enable or disable the receive FIFO Locked mode. |
mbed_official | 235:685d5f11838f | 111 | This parameter can be set to ENABLE or DISABLE */ |
mbed_official | 235:685d5f11838f | 112 | |
mbed_official | 235:685d5f11838f | 113 | uint32_t TXFP; /*!< Enable or disable the transmit FIFO priority. |
mbed_official | 235:685d5f11838f | 114 | This parameter can be set to ENABLE or DISABLE */ |
mbed_official | 235:685d5f11838f | 115 | }CAN_InitTypeDef; |
mbed_official | 235:685d5f11838f | 116 | |
mbed_official | 235:685d5f11838f | 117 | /** |
mbed_official | 235:685d5f11838f | 118 | * @brief CAN filter configuration structure definition |
mbed_official | 235:685d5f11838f | 119 | */ |
mbed_official | 235:685d5f11838f | 120 | typedef struct |
mbed_official | 235:685d5f11838f | 121 | { |
mbed_official | 235:685d5f11838f | 122 | uint32_t FilterIdHigh; /*!< Specifies the filter identification number (MSBs for a 32-bit |
mbed_official | 235:685d5f11838f | 123 | configuration, first one for a 16-bit configuration). |
mbed_official | 235:685d5f11838f | 124 | This parameter must be a number between Min_Data = 0x0000 and Max_Data = 0xFFFF */ |
mbed_official | 235:685d5f11838f | 125 | |
mbed_official | 235:685d5f11838f | 126 | uint32_t FilterIdLow; /*!< Specifies the filter identification number (LSBs for a 32-bit |
mbed_official | 235:685d5f11838f | 127 | configuration, second one for a 16-bit configuration). |
mbed_official | 235:685d5f11838f | 128 | This parameter must be a number between Min_Data = 0x0000 and Max_Data = 0xFFFF */ |
mbed_official | 235:685d5f11838f | 129 | |
mbed_official | 235:685d5f11838f | 130 | uint32_t FilterMaskIdHigh; /*!< Specifies the filter mask number or identification number, |
mbed_official | 235:685d5f11838f | 131 | according to the mode (MSBs for a 32-bit configuration, |
mbed_official | 235:685d5f11838f | 132 | first one for a 16-bit configuration). |
mbed_official | 235:685d5f11838f | 133 | This parameter must be a number between Min_Data = 0x0000 and Max_Data = 0xFFFF */ |
mbed_official | 235:685d5f11838f | 134 | |
mbed_official | 235:685d5f11838f | 135 | uint32_t FilterMaskIdLow; /*!< Specifies the filter mask number or identification number, |
mbed_official | 235:685d5f11838f | 136 | according to the mode (LSBs for a 32-bit configuration, |
mbed_official | 235:685d5f11838f | 137 | second one for a 16-bit configuration). |
mbed_official | 235:685d5f11838f | 138 | This parameter must be a number between Min_Data = 0x0000 and Max_Data = 0xFFFF */ |
mbed_official | 235:685d5f11838f | 139 | |
mbed_official | 235:685d5f11838f | 140 | uint32_t FilterFIFOAssignment; /*!< Specifies the FIFO (0 or 1) which will be assigned to the filter. |
mbed_official | 235:685d5f11838f | 141 | This parameter can be a value of @ref CAN_filter_FIFO */ |
mbed_official | 235:685d5f11838f | 142 | |
mbed_official | 235:685d5f11838f | 143 | uint32_t FilterNumber; /*!< Specifies the filter which will be initialized. |
mbed_official | 235:685d5f11838f | 144 | This parameter must be a number between Min_Data = 0 and Max_Data = 27 */ |
mbed_official | 235:685d5f11838f | 145 | |
mbed_official | 235:685d5f11838f | 146 | uint32_t FilterMode; /*!< Specifies the filter mode to be initialized. |
mbed_official | 235:685d5f11838f | 147 | This parameter can be a value of @ref CAN_filter_mode */ |
mbed_official | 235:685d5f11838f | 148 | |
mbed_official | 235:685d5f11838f | 149 | uint32_t FilterScale; /*!< Specifies the filter scale. |
mbed_official | 235:685d5f11838f | 150 | This parameter can be a value of @ref CAN_filter_scale */ |
mbed_official | 235:685d5f11838f | 151 | |
mbed_official | 235:685d5f11838f | 152 | uint32_t FilterActivation; /*!< Enable or disable the filter. |
mbed_official | 235:685d5f11838f | 153 | This parameter can be set to ENABLE or DISABLE. */ |
mbed_official | 235:685d5f11838f | 154 | |
mbed_official | 235:685d5f11838f | 155 | uint32_t BankNumber; /*!< Select the start slave bank filter. |
mbed_official | 235:685d5f11838f | 156 | This parameter must be a number between Min_Data = 0 and Max_Data = 28 */ |
mbed_official | 235:685d5f11838f | 157 | |
mbed_official | 235:685d5f11838f | 158 | }CAN_FilterConfTypeDef; |
mbed_official | 235:685d5f11838f | 159 | |
mbed_official | 235:685d5f11838f | 160 | /** |
mbed_official | 235:685d5f11838f | 161 | * @brief CAN Tx message structure definition |
mbed_official | 235:685d5f11838f | 162 | */ |
mbed_official | 235:685d5f11838f | 163 | typedef struct |
mbed_official | 235:685d5f11838f | 164 | { |
mbed_official | 235:685d5f11838f | 165 | uint32_t StdId; /*!< Specifies the standard identifier. |
mbed_official | 235:685d5f11838f | 166 | This parameter must be a number between Min_Data = 0 and Max_Data = 0x7FF */ |
mbed_official | 235:685d5f11838f | 167 | |
mbed_official | 235:685d5f11838f | 168 | uint32_t ExtId; /*!< Specifies the extended identifier. |
mbed_official | 235:685d5f11838f | 169 | This parameter must be a number between Min_Data = 0 and Max_Data = 0x1FFFFFFF */ |
mbed_official | 235:685d5f11838f | 170 | |
mbed_official | 235:685d5f11838f | 171 | uint32_t IDE; /*!< Specifies the type of identifier for the message that will be transmitted. |
mbed_official | 235:685d5f11838f | 172 | This parameter can be a value of @ref CAN_identifier_type */ |
mbed_official | 235:685d5f11838f | 173 | |
mbed_official | 235:685d5f11838f | 174 | uint32_t RTR; /*!< Specifies the type of frame for the message that will be transmitted. |
mbed_official | 235:685d5f11838f | 175 | This parameter can be a value of @ref CAN_remote_transmission_request */ |
mbed_official | 235:685d5f11838f | 176 | |
mbed_official | 235:685d5f11838f | 177 | uint32_t DLC; /*!< Specifies the length of the frame that will be transmitted. |
mbed_official | 235:685d5f11838f | 178 | This parameter must be a number between Min_Data = 0 and Max_Data = 8 */ |
mbed_official | 235:685d5f11838f | 179 | |
mbed_official | 235:685d5f11838f | 180 | uint32_t Data[8]; /*!< Contains the data to be transmitted. |
mbed_official | 235:685d5f11838f | 181 | This parameter must be a number between Min_Data = 0 and Max_Data = 0xFF */ |
mbed_official | 235:685d5f11838f | 182 | |
mbed_official | 235:685d5f11838f | 183 | }CanTxMsgTypeDef; |
mbed_official | 235:685d5f11838f | 184 | |
mbed_official | 235:685d5f11838f | 185 | /** |
mbed_official | 235:685d5f11838f | 186 | * @brief CAN Rx message structure definition |
mbed_official | 235:685d5f11838f | 187 | */ |
mbed_official | 235:685d5f11838f | 188 | typedef struct |
mbed_official | 235:685d5f11838f | 189 | { |
mbed_official | 235:685d5f11838f | 190 | uint32_t StdId; /*!< Specifies the standard identifier. |
mbed_official | 235:685d5f11838f | 191 | This parameter must be a number between Min_Data = 0 and Max_Data = 0x7FF */ |
mbed_official | 235:685d5f11838f | 192 | |
mbed_official | 235:685d5f11838f | 193 | uint32_t ExtId; /*!< Specifies the extended identifier. |
mbed_official | 235:685d5f11838f | 194 | This parameter must be a number between Min_Data = 0 and Max_Data = 0x1FFFFFFF */ |
mbed_official | 235:685d5f11838f | 195 | |
mbed_official | 235:685d5f11838f | 196 | uint32_t IDE; /*!< Specifies the type of identifier for the message that will be received. |
mbed_official | 235:685d5f11838f | 197 | This parameter can be a value of @ref CAN_identifier_type */ |
mbed_official | 235:685d5f11838f | 198 | |
mbed_official | 235:685d5f11838f | 199 | uint32_t RTR; /*!< Specifies the type of frame for the received message. |
mbed_official | 235:685d5f11838f | 200 | This parameter can be a value of @ref CAN_remote_transmission_request */ |
mbed_official | 235:685d5f11838f | 201 | |
mbed_official | 235:685d5f11838f | 202 | uint32_t DLC; /*!< Specifies the length of the frame that will be received. |
mbed_official | 235:685d5f11838f | 203 | This parameter must be a number between Min_Data = 0 and Max_Data = 8 */ |
mbed_official | 235:685d5f11838f | 204 | |
mbed_official | 235:685d5f11838f | 205 | uint32_t Data[8]; /*!< Contains the data to be received. |
mbed_official | 235:685d5f11838f | 206 | This parameter must be a number between Min_Data = 0 and Max_Data = 0xFF */ |
mbed_official | 235:685d5f11838f | 207 | |
mbed_official | 235:685d5f11838f | 208 | uint32_t FMI; /*!< Specifies the index of the filter the message stored in the mailbox passes through. |
mbed_official | 235:685d5f11838f | 209 | This parameter must be a number between Min_Data = 0 and Max_Data = 0xFF */ |
mbed_official | 235:685d5f11838f | 210 | |
mbed_official | 235:685d5f11838f | 211 | uint32_t FIFONumber; /*!< Specifies the receive FIFO number. |
mbed_official | 235:685d5f11838f | 212 | This parameter can be CAN_FIFO0 or CAN_FIFO1 */ |
mbed_official | 235:685d5f11838f | 213 | |
mbed_official | 235:685d5f11838f | 214 | }CanRxMsgTypeDef; |
mbed_official | 235:685d5f11838f | 215 | |
mbed_official | 235:685d5f11838f | 216 | /** |
mbed_official | 235:685d5f11838f | 217 | * @brief CAN handle Structure definition |
mbed_official | 235:685d5f11838f | 218 | */ |
mbed_official | 235:685d5f11838f | 219 | typedef struct |
mbed_official | 235:685d5f11838f | 220 | { |
mbed_official | 235:685d5f11838f | 221 | CAN_TypeDef *Instance; /*!< Register base address */ |
mbed_official | 235:685d5f11838f | 222 | |
mbed_official | 235:685d5f11838f | 223 | CAN_InitTypeDef Init; /*!< CAN required parameters */ |
mbed_official | 235:685d5f11838f | 224 | |
mbed_official | 235:685d5f11838f | 225 | CanTxMsgTypeDef* pTxMsg; /*!< Pointer to transmit structure */ |
mbed_official | 235:685d5f11838f | 226 | |
mbed_official | 235:685d5f11838f | 227 | CanRxMsgTypeDef* pRxMsg; /*!< Pointer to reception structure */ |
mbed_official | 235:685d5f11838f | 228 | |
mbed_official | 235:685d5f11838f | 229 | __IO HAL_CAN_StateTypeDef State; /*!< CAN communication state */ |
mbed_official | 235:685d5f11838f | 230 | |
mbed_official | 235:685d5f11838f | 231 | HAL_LockTypeDef Lock; /*!< CAN locking object */ |
mbed_official | 235:685d5f11838f | 232 | |
mbed_official | 235:685d5f11838f | 233 | __IO uint32_t ErrorCode; /*!< CAN Error code */ |
mbed_official | 235:685d5f11838f | 234 | |
mbed_official | 235:685d5f11838f | 235 | }CAN_HandleTypeDef; |
mbed_official | 235:685d5f11838f | 236 | |
mbed_official | 235:685d5f11838f | 237 | /* Exported constants --------------------------------------------------------*/ |
mbed_official | 235:685d5f11838f | 238 | |
mbed_official | 235:685d5f11838f | 239 | /** @defgroup CAN_Exported_Constants |
mbed_official | 235:685d5f11838f | 240 | * @{ |
mbed_official | 235:685d5f11838f | 241 | */ |
mbed_official | 235:685d5f11838f | 242 | |
mbed_official | 235:685d5f11838f | 243 | /** @defgroup HAL CAN Error Code |
mbed_official | 235:685d5f11838f | 244 | * @{ |
mbed_official | 235:685d5f11838f | 245 | */ |
mbed_official | 235:685d5f11838f | 246 | #define HAL_CAN_ERROR_NONE 0x00 /*!< No error */ |
mbed_official | 235:685d5f11838f | 247 | #define HAL_CAN_ERROR_EWG 0x01 /*!< EWG error */ |
mbed_official | 235:685d5f11838f | 248 | #define HAL_CAN_ERROR_EPV 0x02 /*!< EPV error */ |
mbed_official | 235:685d5f11838f | 249 | #define HAL_CAN_ERROR_BOF 0x04 /*!< BOF error */ |
mbed_official | 235:685d5f11838f | 250 | #define HAL_CAN_ERROR_STF 0x08 /*!< Stuff error */ |
mbed_official | 235:685d5f11838f | 251 | #define HAL_CAN_ERROR_FOR 0x10 /*!< Form error */ |
mbed_official | 235:685d5f11838f | 252 | #define HAL_CAN_ERROR_ACK 0x20 /*!< Acknowledgment error */ |
mbed_official | 235:685d5f11838f | 253 | #define HAL_CAN_ERROR_BR 0x40 /*!< Bit recessive */ |
mbed_official | 235:685d5f11838f | 254 | #define HAL_CAN_ERROR_BD 0x80 /*!< LEC dominant */ |
mbed_official | 235:685d5f11838f | 255 | #define HAL_CAN_ERROR_CRC 0x100 /*!< LEC transfer error */ |
mbed_official | 235:685d5f11838f | 256 | /** |
mbed_official | 235:685d5f11838f | 257 | * @} |
mbed_official | 235:685d5f11838f | 258 | */ |
mbed_official | 235:685d5f11838f | 259 | |
mbed_official | 235:685d5f11838f | 260 | |
mbed_official | 235:685d5f11838f | 261 | /** @defgroup CAN_InitStatus |
mbed_official | 235:685d5f11838f | 262 | * @{ |
mbed_official | 235:685d5f11838f | 263 | */ |
mbed_official | 235:685d5f11838f | 264 | #define CAN_INITSTATUS_FAILED ((uint8_t)0x00) /*!< CAN initialization failed */ |
mbed_official | 235:685d5f11838f | 265 | #define CAN_INITSTATUS_SUCCESS ((uint8_t)0x01) /*!< CAN initialization OK */ |
mbed_official | 235:685d5f11838f | 266 | /** |
mbed_official | 235:685d5f11838f | 267 | * @} |
mbed_official | 235:685d5f11838f | 268 | */ |
mbed_official | 235:685d5f11838f | 269 | |
mbed_official | 235:685d5f11838f | 270 | /** @defgroup CAN_operating_mode |
mbed_official | 235:685d5f11838f | 271 | * @{ |
mbed_official | 235:685d5f11838f | 272 | */ |
mbed_official | 235:685d5f11838f | 273 | #define CAN_MODE_NORMAL ((uint32_t)0x00000000) /*!< Normal mode */ |
mbed_official | 235:685d5f11838f | 274 | #define CAN_MODE_LOOPBACK ((uint32_t)CAN_BTR_LBKM) /*!< Loopback mode */ |
mbed_official | 235:685d5f11838f | 275 | #define CAN_MODE_SILENT ((uint32_t)CAN_BTR_SILM) /*!< Silent mode */ |
mbed_official | 235:685d5f11838f | 276 | #define CAN_MODE_SILENT_LOOPBACK ((uint32_t)(CAN_BTR_LBKM | CAN_BTR_SILM)) /*!< Loopback combined with silent mode */ |
mbed_official | 235:685d5f11838f | 277 | |
mbed_official | 235:685d5f11838f | 278 | #define IS_CAN_MODE(MODE) (((MODE) == CAN_MODE_NORMAL) || \ |
mbed_official | 235:685d5f11838f | 279 | ((MODE) == CAN_MODE_LOOPBACK)|| \ |
mbed_official | 235:685d5f11838f | 280 | ((MODE) == CAN_MODE_SILENT) || \ |
mbed_official | 235:685d5f11838f | 281 | ((MODE) == CAN_MODE_SILENT_LOOPBACK)) |
mbed_official | 235:685d5f11838f | 282 | /** |
mbed_official | 235:685d5f11838f | 283 | * @} |
mbed_official | 235:685d5f11838f | 284 | */ |
mbed_official | 235:685d5f11838f | 285 | |
mbed_official | 235:685d5f11838f | 286 | |
mbed_official | 235:685d5f11838f | 287 | /** @defgroup CAN_synchronisation_jump_width |
mbed_official | 235:685d5f11838f | 288 | * @{ |
mbed_official | 235:685d5f11838f | 289 | */ |
mbed_official | 235:685d5f11838f | 290 | #define CAN_SJW_1TQ ((uint32_t)0x00000000) /*!< 1 time quantum */ |
mbed_official | 235:685d5f11838f | 291 | #define CAN_SJW_2TQ ((uint32_t)CAN_BTR_SJW_0) /*!< 2 time quantum */ |
mbed_official | 235:685d5f11838f | 292 | #define CAN_SJW_3TQ ((uint32_t)CAN_BTR_SJW_1) /*!< 3 time quantum */ |
mbed_official | 235:685d5f11838f | 293 | #define CAN_SJW_4TQ ((uint32_t)CAN_BTR_SJW) /*!< 4 time quantum */ |
mbed_official | 235:685d5f11838f | 294 | |
mbed_official | 235:685d5f11838f | 295 | #define IS_CAN_SJW(SJW) (((SJW) == CAN_SJW_1TQ) || ((SJW) == CAN_SJW_2TQ)|| \ |
mbed_official | 235:685d5f11838f | 296 | ((SJW) == CAN_SJW_3TQ) || ((SJW) == CAN_SJW_4TQ)) |
mbed_official | 235:685d5f11838f | 297 | /** |
mbed_official | 235:685d5f11838f | 298 | * @} |
mbed_official | 235:685d5f11838f | 299 | */ |
mbed_official | 235:685d5f11838f | 300 | |
mbed_official | 235:685d5f11838f | 301 | /** @defgroup CAN_time_quantum_in_bit_segment_1 |
mbed_official | 235:685d5f11838f | 302 | * @{ |
mbed_official | 235:685d5f11838f | 303 | */ |
mbed_official | 235:685d5f11838f | 304 | #define CAN_BS1_1TQ ((uint32_t)0x00000000) /*!< 1 time quantum */ |
mbed_official | 235:685d5f11838f | 305 | #define CAN_BS1_2TQ ((uint32_t)CAN_BTR_TS1_0) /*!< 2 time quantum */ |
mbed_official | 235:685d5f11838f | 306 | #define CAN_BS1_3TQ ((uint32_t)CAN_BTR_TS1_1) /*!< 3 time quantum */ |
mbed_official | 235:685d5f11838f | 307 | #define CAN_BS1_4TQ ((uint32_t)(CAN_BTR_TS1_1 | CAN_BTR_TS1_0)) /*!< 4 time quantum */ |
mbed_official | 235:685d5f11838f | 308 | #define CAN_BS1_5TQ ((uint32_t)CAN_BTR_TS1_2) /*!< 5 time quantum */ |
mbed_official | 235:685d5f11838f | 309 | #define CAN_BS1_6TQ ((uint32_t)(CAN_BTR_TS1_2 | CAN_BTR_TS1_0)) /*!< 6 time quantum */ |
mbed_official | 235:685d5f11838f | 310 | #define CAN_BS1_7TQ ((uint32_t)(CAN_BTR_TS1_2 | CAN_BTR_TS1_1)) /*!< 7 time quantum */ |
mbed_official | 235:685d5f11838f | 311 | #define CAN_BS1_8TQ ((uint32_t)(CAN_BTR_TS1_2 | CAN_BTR_TS1_1 | CAN_BTR_TS1_0)) /*!< 8 time quantum */ |
mbed_official | 235:685d5f11838f | 312 | #define CAN_BS1_9TQ ((uint32_t)CAN_BTR_TS1_3) /*!< 9 time quantum */ |
mbed_official | 235:685d5f11838f | 313 | #define CAN_BS1_10TQ ((uint32_t)(CAN_BTR_TS1_3 | CAN_BTR_TS1_0)) /*!< 10 time quantum */ |
mbed_official | 235:685d5f11838f | 314 | #define CAN_BS1_11TQ ((uint32_t)(CAN_BTR_TS1_3 | CAN_BTR_TS1_1)) /*!< 11 time quantum */ |
mbed_official | 235:685d5f11838f | 315 | #define CAN_BS1_12TQ ((uint32_t)(CAN_BTR_TS1_3 | CAN_BTR_TS1_1 | CAN_BTR_TS1_0)) /*!< 12 time quantum */ |
mbed_official | 235:685d5f11838f | 316 | #define CAN_BS1_13TQ ((uint32_t)(CAN_BTR_TS1_3 | CAN_BTR_TS1_2)) /*!< 13 time quantum */ |
mbed_official | 235:685d5f11838f | 317 | #define CAN_BS1_14TQ ((uint32_t)(CAN_BTR_TS1_3 | CAN_BTR_TS1_2 | CAN_BTR_TS1_0)) /*!< 14 time quantum */ |
mbed_official | 235:685d5f11838f | 318 | #define CAN_BS1_15TQ ((uint32_t)(CAN_BTR_TS1_3 | CAN_BTR_TS1_2 | CAN_BTR_TS1_1)) /*!< 15 time quantum */ |
mbed_official | 235:685d5f11838f | 319 | #define CAN_BS1_16TQ ((uint32_t)CAN_BTR_TS1) /*!< 16 time quantum */ |
mbed_official | 235:685d5f11838f | 320 | |
mbed_official | 235:685d5f11838f | 321 | #define IS_CAN_BS1(BS1) ((BS1) <= CAN_BS1_16TQ) |
mbed_official | 235:685d5f11838f | 322 | /** |
mbed_official | 235:685d5f11838f | 323 | * @} |
mbed_official | 235:685d5f11838f | 324 | */ |
mbed_official | 235:685d5f11838f | 325 | |
mbed_official | 235:685d5f11838f | 326 | /** @defgroup CAN_time_quantum_in_bit_segment_2 |
mbed_official | 235:685d5f11838f | 327 | * @{ |
mbed_official | 235:685d5f11838f | 328 | */ |
mbed_official | 235:685d5f11838f | 329 | #define CAN_BS2_1TQ ((uint32_t)0x00000000) /*!< 1 time quantum */ |
mbed_official | 235:685d5f11838f | 330 | #define CAN_BS2_2TQ ((uint32_t)CAN_BTR_TS2_0) /*!< 2 time quantum */ |
mbed_official | 235:685d5f11838f | 331 | #define CAN_BS2_3TQ ((uint32_t)CAN_BTR_TS2_1) /*!< 3 time quantum */ |
mbed_official | 235:685d5f11838f | 332 | #define CAN_BS2_4TQ ((uint32_t)(CAN_BTR_TS2_1 | CAN_BTR_TS2_0)) /*!< 4 time quantum */ |
mbed_official | 235:685d5f11838f | 333 | #define CAN_BS2_5TQ ((uint32_t)CAN_BTR_TS2_2) /*!< 5 time quantum */ |
mbed_official | 235:685d5f11838f | 334 | #define CAN_BS2_6TQ ((uint32_t)(CAN_BTR_TS2_2 | CAN_BTR_TS2_0)) /*!< 6 time quantum */ |
mbed_official | 235:685d5f11838f | 335 | #define CAN_BS2_7TQ ((uint32_t)(CAN_BTR_TS2_2 | CAN_BTR_TS2_1)) /*!< 7 time quantum */ |
mbed_official | 235:685d5f11838f | 336 | #define CAN_BS2_8TQ ((uint32_t)CAN_BTR_TS2) /*!< 8 time quantum */ |
mbed_official | 235:685d5f11838f | 337 | |
mbed_official | 235:685d5f11838f | 338 | #define IS_CAN_BS2(BS2) ((BS2) <= CAN_BS2_8TQ) |
mbed_official | 235:685d5f11838f | 339 | /** |
mbed_official | 235:685d5f11838f | 340 | * @} |
mbed_official | 235:685d5f11838f | 341 | */ |
mbed_official | 235:685d5f11838f | 342 | |
mbed_official | 235:685d5f11838f | 343 | /** @defgroup CAN_clock_prescaler |
mbed_official | 235:685d5f11838f | 344 | * @{ |
mbed_official | 235:685d5f11838f | 345 | */ |
mbed_official | 235:685d5f11838f | 346 | #define IS_CAN_PRESCALER(PRESCALER) (((PRESCALER) >= 1) && ((PRESCALER) <= 1024)) |
mbed_official | 235:685d5f11838f | 347 | /** |
mbed_official | 235:685d5f11838f | 348 | * @} |
mbed_official | 235:685d5f11838f | 349 | */ |
mbed_official | 235:685d5f11838f | 350 | |
mbed_official | 235:685d5f11838f | 351 | /** @defgroup CAN_filter_number |
mbed_official | 235:685d5f11838f | 352 | * @{ |
mbed_official | 235:685d5f11838f | 353 | */ |
mbed_official | 235:685d5f11838f | 354 | #define IS_CAN_FILTER_NUMBER(NUMBER) ((NUMBER) <= 27) |
mbed_official | 235:685d5f11838f | 355 | /** |
mbed_official | 235:685d5f11838f | 356 | * @} |
mbed_official | 235:685d5f11838f | 357 | */ |
mbed_official | 235:685d5f11838f | 358 | |
mbed_official | 235:685d5f11838f | 359 | /** @defgroup CAN_filter_mode |
mbed_official | 235:685d5f11838f | 360 | * @{ |
mbed_official | 235:685d5f11838f | 361 | */ |
mbed_official | 235:685d5f11838f | 362 | #define CAN_FILTERMODE_IDMASK ((uint8_t)0x00) /*!< Identifier mask mode */ |
mbed_official | 235:685d5f11838f | 363 | #define CAN_FILTERMODE_IDLIST ((uint8_t)0x01) /*!< Identifier list mode */ |
mbed_official | 235:685d5f11838f | 364 | |
mbed_official | 235:685d5f11838f | 365 | #define IS_CAN_FILTER_MODE(MODE) (((MODE) == CAN_FILTERMODE_IDMASK) || \ |
mbed_official | 235:685d5f11838f | 366 | ((MODE) == CAN_FILTERMODE_IDLIST)) |
mbed_official | 235:685d5f11838f | 367 | /** |
mbed_official | 235:685d5f11838f | 368 | * @} |
mbed_official | 235:685d5f11838f | 369 | */ |
mbed_official | 235:685d5f11838f | 370 | |
mbed_official | 235:685d5f11838f | 371 | /** @defgroup CAN_filter_scale |
mbed_official | 235:685d5f11838f | 372 | * @{ |
mbed_official | 235:685d5f11838f | 373 | */ |
mbed_official | 235:685d5f11838f | 374 | #define CAN_FILTERSCALE_16BIT ((uint8_t)0x00) /*!< Two 16-bit filters */ |
mbed_official | 235:685d5f11838f | 375 | #define CAN_FILTERSCALE_32BIT ((uint8_t)0x01) /*!< One 32-bit filter */ |
mbed_official | 235:685d5f11838f | 376 | |
mbed_official | 235:685d5f11838f | 377 | #define IS_CAN_FILTER_SCALE(SCALE) (((SCALE) == CAN_FILTERSCALE_16BIT) || \ |
mbed_official | 235:685d5f11838f | 378 | ((SCALE) == CAN_FILTERSCALE_32BIT)) |
mbed_official | 235:685d5f11838f | 379 | /** |
mbed_official | 235:685d5f11838f | 380 | * @} |
mbed_official | 235:685d5f11838f | 381 | */ |
mbed_official | 235:685d5f11838f | 382 | |
mbed_official | 235:685d5f11838f | 383 | /** @defgroup CAN_filter_FIFO |
mbed_official | 235:685d5f11838f | 384 | * @{ |
mbed_official | 235:685d5f11838f | 385 | */ |
mbed_official | 235:685d5f11838f | 386 | #define CAN_FILTER_FIFO0 ((uint8_t)0x00) /*!< Filter FIFO 0 assignment for filter x */ |
mbed_official | 235:685d5f11838f | 387 | #define CAN_FILTER_FIFO1 ((uint8_t)0x01) /*!< Filter FIFO 1 assignment for filter x */ |
mbed_official | 235:685d5f11838f | 388 | |
mbed_official | 235:685d5f11838f | 389 | #define IS_CAN_FILTER_FIFO(FIFO) (((FIFO) == CAN_FILTER_FIFO0) || \ |
mbed_official | 235:685d5f11838f | 390 | ((FIFO) == CAN_FILTER_FIFO1)) |
mbed_official | 235:685d5f11838f | 391 | |
mbed_official | 235:685d5f11838f | 392 | /* Legacy defines */ |
mbed_official | 235:685d5f11838f | 393 | #define CAN_FilterFIFO0 CAN_FILTER_FIFO0 |
mbed_official | 235:685d5f11838f | 394 | #define CAN_FilterFIFO1 CAN_FILTER_FIFO1 |
mbed_official | 235:685d5f11838f | 395 | /** |
mbed_official | 235:685d5f11838f | 396 | * @} |
mbed_official | 235:685d5f11838f | 397 | */ |
mbed_official | 235:685d5f11838f | 398 | |
mbed_official | 235:685d5f11838f | 399 | /** @defgroup CAN_Start_bank_filter_for_slave_CAN |
mbed_official | 235:685d5f11838f | 400 | * @{ |
mbed_official | 235:685d5f11838f | 401 | */ |
mbed_official | 235:685d5f11838f | 402 | #define IS_CAN_BANKNUMBER(BANKNUMBER) ((BANKNUMBER) <= 28) |
mbed_official | 235:685d5f11838f | 403 | /** |
mbed_official | 235:685d5f11838f | 404 | * @} |
mbed_official | 235:685d5f11838f | 405 | */ |
mbed_official | 235:685d5f11838f | 406 | |
mbed_official | 235:685d5f11838f | 407 | /** @defgroup CAN_Tx |
mbed_official | 235:685d5f11838f | 408 | * @{ |
mbed_official | 235:685d5f11838f | 409 | */ |
mbed_official | 235:685d5f11838f | 410 | #define IS_CAN_TRANSMITMAILBOX(TRANSMITMAILBOX) ((TRANSMITMAILBOX) <= ((uint8_t)0x02)) |
mbed_official | 235:685d5f11838f | 411 | #define IS_CAN_STDID(STDID) ((STDID) <= ((uint32_t)0x7FF)) |
mbed_official | 235:685d5f11838f | 412 | #define IS_CAN_EXTID(EXTID) ((EXTID) <= ((uint32_t)0x1FFFFFFF)) |
mbed_official | 235:685d5f11838f | 413 | #define IS_CAN_DLC(DLC) ((DLC) <= ((uint8_t)0x08)) |
mbed_official | 235:685d5f11838f | 414 | /** |
mbed_official | 235:685d5f11838f | 415 | * @} |
mbed_official | 235:685d5f11838f | 416 | */ |
mbed_official | 235:685d5f11838f | 417 | |
mbed_official | 235:685d5f11838f | 418 | /** @defgroup CAN_identifier_type |
mbed_official | 235:685d5f11838f | 419 | * @{ |
mbed_official | 235:685d5f11838f | 420 | */ |
mbed_official | 235:685d5f11838f | 421 | #define CAN_ID_STD ((uint32_t)0x00000000) /*!< Standard Id */ |
mbed_official | 235:685d5f11838f | 422 | #define CAN_ID_EXT ((uint32_t)0x00000004) /*!< Extended Id */ |
mbed_official | 235:685d5f11838f | 423 | #define IS_CAN_IDTYPE(IDTYPE) (((IDTYPE) == CAN_ID_STD) || \ |
mbed_official | 235:685d5f11838f | 424 | ((IDTYPE) == CAN_ID_EXT)) |
mbed_official | 235:685d5f11838f | 425 | /** |
mbed_official | 235:685d5f11838f | 426 | * @} |
mbed_official | 235:685d5f11838f | 427 | */ |
mbed_official | 235:685d5f11838f | 428 | |
mbed_official | 235:685d5f11838f | 429 | /** @defgroup CAN_remote_transmission_request |
mbed_official | 235:685d5f11838f | 430 | * @{ |
mbed_official | 235:685d5f11838f | 431 | */ |
mbed_official | 235:685d5f11838f | 432 | #define CAN_RTR_DATA ((uint32_t)0x00000000) /*!< Data frame */ |
mbed_official | 235:685d5f11838f | 433 | #define CAN_RTR_REMOTE ((uint32_t)0x00000002) /*!< Remote frame */ |
mbed_official | 235:685d5f11838f | 434 | #define IS_CAN_RTR(RTR) (((RTR) == CAN_RTR_DATA) || ((RTR) == CAN_RTR_REMOTE)) |
mbed_official | 235:685d5f11838f | 435 | |
mbed_official | 235:685d5f11838f | 436 | /** |
mbed_official | 235:685d5f11838f | 437 | * @} |
mbed_official | 235:685d5f11838f | 438 | */ |
mbed_official | 235:685d5f11838f | 439 | |
mbed_official | 235:685d5f11838f | 440 | /** @defgroup CAN_transmit_constants |
mbed_official | 235:685d5f11838f | 441 | * @{ |
mbed_official | 235:685d5f11838f | 442 | */ |
mbed_official | 235:685d5f11838f | 443 | #define CAN_TXSTATUS_FAILED ((uint8_t)0x00) /*!< CAN transmission failed */ |
mbed_official | 235:685d5f11838f | 444 | #define CAN_TXSTATUS_OK ((uint8_t)0x01) /*!< CAN transmission succeeded */ |
mbed_official | 235:685d5f11838f | 445 | #define CAN_TXSTATUS_PENDING ((uint8_t)0x02) /*!< CAN transmission pending */ |
mbed_official | 235:685d5f11838f | 446 | #define CAN_TXSTATUS_NOMAILBOX ((uint8_t)0x04) /*!< CAN cell did not provide CAN_TxStatus_NoMailBox */ |
mbed_official | 235:685d5f11838f | 447 | |
mbed_official | 235:685d5f11838f | 448 | /** |
mbed_official | 235:685d5f11838f | 449 | * @} |
mbed_official | 235:685d5f11838f | 450 | */ |
mbed_official | 235:685d5f11838f | 451 | |
mbed_official | 235:685d5f11838f | 452 | /** @defgroup CAN_receive_FIFO_number_constants |
mbed_official | 235:685d5f11838f | 453 | * @{ |
mbed_official | 235:685d5f11838f | 454 | */ |
mbed_official | 235:685d5f11838f | 455 | #define CAN_FIFO0 ((uint8_t)0x00) /*!< CAN FIFO 0 used to receive */ |
mbed_official | 235:685d5f11838f | 456 | #define CAN_FIFO1 ((uint8_t)0x01) /*!< CAN FIFO 1 used to receive */ |
mbed_official | 235:685d5f11838f | 457 | |
mbed_official | 235:685d5f11838f | 458 | #define IS_CAN_FIFO(FIFO) (((FIFO) == CAN_FIFO0) || ((FIFO) == CAN_FIFO1)) |
mbed_official | 235:685d5f11838f | 459 | /** |
mbed_official | 235:685d5f11838f | 460 | * @} |
mbed_official | 235:685d5f11838f | 461 | */ |
mbed_official | 235:685d5f11838f | 462 | |
mbed_official | 235:685d5f11838f | 463 | /** @defgroup CAN_flags |
mbed_official | 235:685d5f11838f | 464 | * @{ |
mbed_official | 235:685d5f11838f | 465 | */ |
mbed_official | 235:685d5f11838f | 466 | /* If the flag is 0x3XXXXXXX, it means that it can be used with CAN_GetFlagStatus() |
mbed_official | 235:685d5f11838f | 467 | and CAN_ClearFlag() functions. */ |
mbed_official | 235:685d5f11838f | 468 | /* If the flag is 0x1XXXXXXX, it means that it can only be used with |
mbed_official | 235:685d5f11838f | 469 | CAN_GetFlagStatus() function. */ |
mbed_official | 235:685d5f11838f | 470 | |
mbed_official | 235:685d5f11838f | 471 | /* Transmit Flags */ |
mbed_official | 235:685d5f11838f | 472 | #define CAN_FLAG_RQCP0 ((uint32_t)0x00000500) /*!< Request MailBox0 flag */ |
mbed_official | 235:685d5f11838f | 473 | #define CAN_FLAG_RQCP1 ((uint32_t)0x00000508) /*!< Request MailBox1 flag */ |
mbed_official | 235:685d5f11838f | 474 | #define CAN_FLAG_RQCP2 ((uint32_t)0x00000510) /*!< Request MailBox2 flag */ |
mbed_official | 235:685d5f11838f | 475 | #define CAN_FLAG_TXOK0 ((uint32_t)0x00000501) /*!< Transmission OK MailBox0 flag */ |
mbed_official | 235:685d5f11838f | 476 | #define CAN_FLAG_TXOK1 ((uint32_t)0x00000509) /*!< Transmission OK MailBox1 flag */ |
mbed_official | 235:685d5f11838f | 477 | #define CAN_FLAG_TXOK2 ((uint32_t)0x00000511) /*!< Transmission OK MailBox2 flag */ |
mbed_official | 235:685d5f11838f | 478 | #define CAN_FLAG_TME0 ((uint32_t)0x0000051A) /*!< Transmit mailbox 0 empty flag */ |
mbed_official | 235:685d5f11838f | 479 | #define CAN_FLAG_TME1 ((uint32_t)0x0000051B) /*!< Transmit mailbox 0 empty flag */ |
mbed_official | 235:685d5f11838f | 480 | #define CAN_FLAG_TME2 ((uint32_t)0x0000051C) /*!< Transmit mailbox 0 empty flag */ |
mbed_official | 235:685d5f11838f | 481 | |
mbed_official | 235:685d5f11838f | 482 | /* Receive Flags */ |
mbed_official | 235:685d5f11838f | 483 | #define CAN_FLAG_FF0 ((uint32_t)0x00000203) /*!< FIFO 0 Full flag */ |
mbed_official | 235:685d5f11838f | 484 | #define CAN_FLAG_FOV0 ((uint32_t)0x00000204) /*!< FIFO 0 Overrun flag */ |
mbed_official | 235:685d5f11838f | 485 | |
mbed_official | 235:685d5f11838f | 486 | #define CAN_FLAG_FF1 ((uint32_t)0x00000403) /*!< FIFO 1 Full flag */ |
mbed_official | 235:685d5f11838f | 487 | #define CAN_FLAG_FOV1 ((uint32_t)0x00000404) /*!< FIFO 1 Overrun flag */ |
mbed_official | 235:685d5f11838f | 488 | |
mbed_official | 235:685d5f11838f | 489 | /* Operating Mode Flags */ |
mbed_official | 235:685d5f11838f | 490 | #define CAN_FLAG_WKU ((uint32_t)0x00000103) /*!< Wake up flag */ |
mbed_official | 235:685d5f11838f | 491 | #define CAN_FLAG_SLAK ((uint32_t)0x00000101) /*!< Sleep acknowledge flag */ |
mbed_official | 235:685d5f11838f | 492 | #define CAN_FLAG_SLAKI ((uint32_t)0x00000104) /*!< Sleep acknowledge flag */ |
mbed_official | 235:685d5f11838f | 493 | /* @note When SLAK interrupt is disabled (SLKIE=0), no polling on SLAKI is possible. |
mbed_official | 235:685d5f11838f | 494 | In this case the SLAK bit can be polled.*/ |
mbed_official | 235:685d5f11838f | 495 | |
mbed_official | 235:685d5f11838f | 496 | /* Error Flags */ |
mbed_official | 235:685d5f11838f | 497 | #define CAN_FLAG_EWG ((uint32_t)0x00000300) /*!< Error warning flag */ |
mbed_official | 235:685d5f11838f | 498 | #define CAN_FLAG_EPV ((uint32_t)0x00000301) /*!< Error passive flag */ |
mbed_official | 235:685d5f11838f | 499 | #define CAN_FLAG_BOF ((uint32_t)0x00000302) /*!< Bus-Off flag */ |
mbed_official | 235:685d5f11838f | 500 | |
mbed_official | 235:685d5f11838f | 501 | #define IS_CAN_GET_FLAG(FLAG) (((FLAG) == CAN_FLAG_RQCP2) || ((FLAG) == CAN_FLAG_BOF) || \ |
mbed_official | 235:685d5f11838f | 502 | ((FLAG) == CAN_FLAG_EPV) || ((FLAG) == CAN_FLAG_EWG) || \ |
mbed_official | 235:685d5f11838f | 503 | ((FLAG) == CAN_FLAG_WKU) || ((FLAG) == CAN_FLAG_FOV0) || \ |
mbed_official | 235:685d5f11838f | 504 | ((FLAG) == CAN_FLAG_FF0) || ((FLAG) == CAN_FLAG_SLAK) || \ |
mbed_official | 235:685d5f11838f | 505 | ((FLAG) == CAN_FLAG_FOV1) || ((FLAG) == CAN_FLAG_FF1) || \ |
mbed_official | 235:685d5f11838f | 506 | ((FLAG) == CAN_FLAG_RQCP1) || ((FLAG) == CAN_FLAG_RQCP0)) |
mbed_official | 235:685d5f11838f | 507 | |
mbed_official | 235:685d5f11838f | 508 | |
mbed_official | 235:685d5f11838f | 509 | #define IS_CAN_CLEAR_FLAG(FLAG)(((FLAG) == CAN_FLAG_SLAK) || ((FLAG) == CAN_FLAG_RQCP2) || \ |
mbed_official | 235:685d5f11838f | 510 | ((FLAG) == CAN_FLAG_RQCP1) || ((FLAG) == CAN_FLAG_RQCP0) || \ |
mbed_official | 235:685d5f11838f | 511 | ((FLAG) == CAN_FLAG_FF0) || ((FLAG) == CAN_FLAG_FOV0) || \ |
mbed_official | 235:685d5f11838f | 512 | ((FLAG) == CAN_FLAG_FF1) || ((FLAG) == CAN_FLAG_FOV1) || \ |
mbed_official | 235:685d5f11838f | 513 | ((FLAG) == CAN_FLAG_WKU)) |
mbed_official | 235:685d5f11838f | 514 | /** |
mbed_official | 235:685d5f11838f | 515 | * @} |
mbed_official | 235:685d5f11838f | 516 | */ |
mbed_official | 235:685d5f11838f | 517 | |
mbed_official | 235:685d5f11838f | 518 | |
mbed_official | 235:685d5f11838f | 519 | /** @defgroup CAN_interrupts |
mbed_official | 235:685d5f11838f | 520 | * @{ |
mbed_official | 235:685d5f11838f | 521 | */ |
mbed_official | 235:685d5f11838f | 522 | #define CAN_IT_TME ((uint32_t)CAN_IER_TMEIE) /*!< Transmit mailbox empty interrupt */ |
mbed_official | 235:685d5f11838f | 523 | |
mbed_official | 235:685d5f11838f | 524 | /* Receive Interrupts */ |
mbed_official | 235:685d5f11838f | 525 | #define CAN_IT_FMP0 ((uint32_t)CAN_IER_FMPIE0) /*!< FIFO 0 message pending interrupt */ |
mbed_official | 235:685d5f11838f | 526 | #define CAN_IT_FF0 ((uint32_t)CAN_IER_FFIE0) /*!< FIFO 0 full interrupt */ |
mbed_official | 235:685d5f11838f | 527 | #define CAN_IT_FOV0 ((uint32_t)CAN_IER_FOVIE0) /*!< FIFO 0 overrun interrupt */ |
mbed_official | 235:685d5f11838f | 528 | #define CAN_IT_FMP1 ((uint32_t)CAN_IER_FMPIE1) /*!< FIFO 1 message pending interrupt */ |
mbed_official | 235:685d5f11838f | 529 | #define CAN_IT_FF1 ((uint32_t)CAN_IER_FFIE1) /*!< FIFO 1 full interrupt */ |
mbed_official | 235:685d5f11838f | 530 | #define CAN_IT_FOV1 ((uint32_t)CAN_IER_FOVIE1) /*!< FIFO 1 overrun interrupt */ |
mbed_official | 235:685d5f11838f | 531 | |
mbed_official | 235:685d5f11838f | 532 | /* Operating Mode Interrupts */ |
mbed_official | 235:685d5f11838f | 533 | #define CAN_IT_WKU ((uint32_t)CAN_IER_WKUIE) /*!< Wake-up interrupt */ |
mbed_official | 235:685d5f11838f | 534 | #define CAN_IT_SLK ((uint32_t)CAN_IER_SLKIE) /*!< Sleep acknowledge interrupt */ |
mbed_official | 235:685d5f11838f | 535 | |
mbed_official | 235:685d5f11838f | 536 | /* Error Interrupts */ |
mbed_official | 235:685d5f11838f | 537 | #define CAN_IT_EWG ((uint32_t)CAN_IER_EWGIE) /*!< Error warning interrupt */ |
mbed_official | 235:685d5f11838f | 538 | #define CAN_IT_EPV ((uint32_t)CAN_IER_EPVIE) /*!< Error passive interrupt */ |
mbed_official | 235:685d5f11838f | 539 | #define CAN_IT_BOF ((uint32_t)CAN_IER_BOFIE) /*!< Bus-off interrupt */ |
mbed_official | 235:685d5f11838f | 540 | #define CAN_IT_LEC ((uint32_t)CAN_IER_LECIE) /*!< Last error code interrupt */ |
mbed_official | 235:685d5f11838f | 541 | #define CAN_IT_ERR ((uint32_t)CAN_IER_ERRIE) /*!< Error Interrupt */ |
mbed_official | 235:685d5f11838f | 542 | |
mbed_official | 235:685d5f11838f | 543 | /* Flags named as Interrupts : kept only for FW compatibility */ |
mbed_official | 235:685d5f11838f | 544 | #define CAN_IT_RQCP0 CAN_IT_TME |
mbed_official | 235:685d5f11838f | 545 | #define CAN_IT_RQCP1 CAN_IT_TME |
mbed_official | 235:685d5f11838f | 546 | #define CAN_IT_RQCP2 CAN_IT_TME |
mbed_official | 235:685d5f11838f | 547 | |
mbed_official | 235:685d5f11838f | 548 | #define IS_CAN_IT(IT) (((IT) == CAN_IT_TME) || ((IT) == CAN_IT_FMP0) ||\ |
mbed_official | 235:685d5f11838f | 549 | ((IT) == CAN_IT_FF0) || ((IT) == CAN_IT_FOV0) ||\ |
mbed_official | 235:685d5f11838f | 550 | ((IT) == CAN_IT_FMP1) || ((IT) == CAN_IT_FF1) ||\ |
mbed_official | 235:685d5f11838f | 551 | ((IT) == CAN_IT_FOV1) || ((IT) == CAN_IT_EWG) ||\ |
mbed_official | 235:685d5f11838f | 552 | ((IT) == CAN_IT_EPV) || ((IT) == CAN_IT_BOF) ||\ |
mbed_official | 235:685d5f11838f | 553 | ((IT) == CAN_IT_LEC) || ((IT) == CAN_IT_ERR) ||\ |
mbed_official | 235:685d5f11838f | 554 | ((IT) == CAN_IT_WKU) || ((IT) == CAN_IT_SLK)) |
mbed_official | 235:685d5f11838f | 555 | |
mbed_official | 235:685d5f11838f | 556 | #define IS_CAN_CLEAR_IT(IT) (((IT) == CAN_IT_TME) || ((IT) == CAN_IT_FF0) ||\ |
mbed_official | 235:685d5f11838f | 557 | ((IT) == CAN_IT_FOV0)|| ((IT) == CAN_IT_FF1) ||\ |
mbed_official | 235:685d5f11838f | 558 | ((IT) == CAN_IT_FOV1)|| ((IT) == CAN_IT_EWG) ||\ |
mbed_official | 235:685d5f11838f | 559 | ((IT) == CAN_IT_EPV) || ((IT) == CAN_IT_BOF) ||\ |
mbed_official | 235:685d5f11838f | 560 | ((IT) == CAN_IT_LEC) || ((IT) == CAN_IT_ERR) ||\ |
mbed_official | 235:685d5f11838f | 561 | ((IT) == CAN_IT_WKU) || ((IT) == CAN_IT_SLK)) |
mbed_official | 235:685d5f11838f | 562 | /** |
mbed_official | 235:685d5f11838f | 563 | * @} |
mbed_official | 235:685d5f11838f | 564 | */ |
mbed_official | 235:685d5f11838f | 565 | |
mbed_official | 235:685d5f11838f | 566 | /* Time out for INAK bit */ |
mbed_official | 235:685d5f11838f | 567 | #define INAK_TIMEOUT ((uint32_t)0x0000FFFF) |
mbed_official | 235:685d5f11838f | 568 | /* Time out for SLAK bit */ |
mbed_official | 235:685d5f11838f | 569 | #define SLAK_TIMEOUT ((uint32_t)0x0000FFFF) |
mbed_official | 235:685d5f11838f | 570 | |
mbed_official | 235:685d5f11838f | 571 | /* Mailboxes definition */ |
mbed_official | 235:685d5f11838f | 572 | #define CAN_TXMAILBOX_0 ((uint8_t)0x00) |
mbed_official | 235:685d5f11838f | 573 | #define CAN_TXMAILBOX_1 ((uint8_t)0x01) |
mbed_official | 235:685d5f11838f | 574 | #define CAN_TXMAILBOX_2 ((uint8_t)0x02) |
mbed_official | 235:685d5f11838f | 575 | |
mbed_official | 235:685d5f11838f | 576 | /** |
mbed_official | 235:685d5f11838f | 577 | * @} |
mbed_official | 235:685d5f11838f | 578 | */ |
mbed_official | 235:685d5f11838f | 579 | |
mbed_official | 235:685d5f11838f | 580 | /* Exported macro ------------------------------------------------------------*/ |
mbed_official | 235:685d5f11838f | 581 | |
mbed_official | 235:685d5f11838f | 582 | /** @brief Reset CAN handle state |
mbed_official | 235:685d5f11838f | 583 | * @param __HANDLE__: specifies the CAN Handle. |
mbed_official | 235:685d5f11838f | 584 | * @retval None |
mbed_official | 235:685d5f11838f | 585 | */ |
mbed_official | 235:685d5f11838f | 586 | #define __HAL_CAN_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_CAN_STATE_RESET) |
mbed_official | 235:685d5f11838f | 587 | |
mbed_official | 235:685d5f11838f | 588 | /** |
mbed_official | 235:685d5f11838f | 589 | * @brief Enable the specified CAN interrupts. |
mbed_official | 235:685d5f11838f | 590 | * @param __HANDLE__: CAN handle |
mbed_official | 235:685d5f11838f | 591 | * @param __INTERRUPT__: CAN Interrupt |
mbed_official | 235:685d5f11838f | 592 | * @retval None |
mbed_official | 235:685d5f11838f | 593 | */ |
mbed_official | 235:685d5f11838f | 594 | #define __HAL_CAN_ENABLE_IT(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->IER) |= (__INTERRUPT__)) |
mbed_official | 235:685d5f11838f | 595 | |
mbed_official | 235:685d5f11838f | 596 | /** |
mbed_official | 235:685d5f11838f | 597 | * @brief Disable the specified CAN interrupts. |
mbed_official | 235:685d5f11838f | 598 | * @param __HANDLE__: CAN handle |
mbed_official | 235:685d5f11838f | 599 | * @param __INTERRUPT__: CAN Interrupt |
mbed_official | 235:685d5f11838f | 600 | * @retval None |
mbed_official | 235:685d5f11838f | 601 | */ |
mbed_official | 235:685d5f11838f | 602 | #define __HAL_CAN_DISABLE_IT(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->IER) &= ~(__INTERRUPT__)) |
mbed_official | 235:685d5f11838f | 603 | |
mbed_official | 235:685d5f11838f | 604 | /** |
mbed_official | 235:685d5f11838f | 605 | * @brief Return the number of pending received messages. |
mbed_official | 235:685d5f11838f | 606 | * @param __HANDLE__: CAN handle |
mbed_official | 235:685d5f11838f | 607 | * @param __FIFONUMBER__: Receive FIFO number, CAN_FIFO0 or CAN_FIFO1. |
mbed_official | 235:685d5f11838f | 608 | * @retval The number of pending message. |
mbed_official | 235:685d5f11838f | 609 | */ |
mbed_official | 235:685d5f11838f | 610 | #define __HAL_CAN_MSG_PENDING(__HANDLE__, __FIFONUMBER__) (((__FIFONUMBER__) == CAN_FIFO0)? \ |
mbed_official | 235:685d5f11838f | 611 | ((uint8_t)((__HANDLE__)->Instance->RF0R&(uint32_t)0x03)) : ((uint8_t)((__HANDLE__)->Instance->RF1R&(uint32_t)0x03))) |
mbed_official | 235:685d5f11838f | 612 | |
mbed_official | 235:685d5f11838f | 613 | /** @brief Check whether the specified CAN flag is set or not. |
mbed_official | 235:685d5f11838f | 614 | * @param __HANDLE__: CAN Handle |
mbed_official | 235:685d5f11838f | 615 | * @param __FLAG__: specifies the flag to check. |
mbed_official | 235:685d5f11838f | 616 | * This parameter can be one of the following values: |
mbed_official | 235:685d5f11838f | 617 | * @arg CAN_TSR_RQCP0: Request MailBox0 Flag |
mbed_official | 235:685d5f11838f | 618 | * @arg CAN_TSR_RQCP1: Request MailBox1 Flag |
mbed_official | 235:685d5f11838f | 619 | * @arg CAN_TSR_RQCP2: Request MailBox2 Flag |
mbed_official | 235:685d5f11838f | 620 | * @arg CAN_FLAG_TXOK0: Transmission OK MailBox0 Flag |
mbed_official | 235:685d5f11838f | 621 | * @arg CAN_FLAG_TXOK1: Transmission OK MailBox1 Flag |
mbed_official | 235:685d5f11838f | 622 | * @arg CAN_FLAG_TXOK2: Transmission OK MailBox2 Flag |
mbed_official | 235:685d5f11838f | 623 | * @arg CAN_FLAG_TME0: Transmit mailbox 0 empty Flag |
mbed_official | 235:685d5f11838f | 624 | * @arg CAN_FLAG_TME1: Transmit mailbox 1 empty Flag |
mbed_official | 235:685d5f11838f | 625 | * @arg CAN_FLAG_TME2: Transmit mailbox 2 empty Flag |
mbed_official | 235:685d5f11838f | 626 | * @arg CAN_FLAG_FMP0: FIFO 0 Message Pending Flag |
mbed_official | 235:685d5f11838f | 627 | * @arg CAN_FLAG_FF0: FIFO 0 Full Flag |
mbed_official | 235:685d5f11838f | 628 | * @arg CAN_FLAG_FOV0: FIFO 0 Overrun Flag |
mbed_official | 235:685d5f11838f | 629 | * @arg CAN_FLAG_FMP1: FIFO 1 Message Pending Flag |
mbed_official | 235:685d5f11838f | 630 | * @arg CAN_FLAG_FF1: FIFO 1 Full Flag |
mbed_official | 235:685d5f11838f | 631 | * @arg CAN_FLAG_FOV1: FIFO 1 Overrun Flag |
mbed_official | 235:685d5f11838f | 632 | * @arg CAN_FLAG_WKU: Wake up Flag |
mbed_official | 235:685d5f11838f | 633 | * @arg CAN_FLAG_SLAK: Sleep acknowledge Flag |
mbed_official | 235:685d5f11838f | 634 | * @arg CAN_FLAG_SLAKI: Sleep acknowledge Flag |
mbed_official | 235:685d5f11838f | 635 | * @arg CAN_FLAG_EWG: Error Warning Flag |
mbed_official | 235:685d5f11838f | 636 | * @arg CAN_FLAG_EPV: Error Passive Flag |
mbed_official | 235:685d5f11838f | 637 | * @arg CAN_FLAG_BOF: Bus-Off Flag |
mbed_official | 235:685d5f11838f | 638 | * @retval The new state of __FLAG__ (TRUE or FALSE). |
mbed_official | 235:685d5f11838f | 639 | */ |
mbed_official | 235:685d5f11838f | 640 | #define CAN_FLAG_MASK ((uint32_t)0x000000FF) |
mbed_official | 235:685d5f11838f | 641 | #define __HAL_CAN_GET_FLAG(__HANDLE__, __FLAG__) \ |
mbed_official | 235:685d5f11838f | 642 | ((((__FLAG__) >> 8) == 5)? ((((__HANDLE__)->Instance->TSR) & (1 << ((__FLAG__) & CAN_FLAG_MASK))) == (1 << ((__FLAG__) & CAN_FLAG_MASK))): \ |
mbed_official | 235:685d5f11838f | 643 | (((__FLAG__) >> 8) == 2)? ((((__HANDLE__)->Instance->RF0R) & (1 << ((__FLAG__) & CAN_FLAG_MASK))) == (1 << ((__FLAG__) & CAN_FLAG_MASK))): \ |
mbed_official | 235:685d5f11838f | 644 | (((__FLAG__) >> 8) == 4)? ((((__HANDLE__)->Instance->RF1R) & (1 << ((__FLAG__) & CAN_FLAG_MASK))) == (1 << ((__FLAG__) & CAN_FLAG_MASK))): \ |
mbed_official | 235:685d5f11838f | 645 | (((__FLAG__) >> 8) == 1)? ((((__HANDLE__)->Instance->MSR) & (1 << ((__FLAG__) & CAN_FLAG_MASK))) == (1 << ((__FLAG__) & CAN_FLAG_MASK))): \ |
mbed_official | 235:685d5f11838f | 646 | ((((__HANDLE__)->Instance->ESR) & (1 << ((__FLAG__) & CAN_FLAG_MASK))) == (1 << ((__FLAG__) & CAN_FLAG_MASK)))) |
mbed_official | 235:685d5f11838f | 647 | |
mbed_official | 235:685d5f11838f | 648 | /** @brief Clear the specified CAN pending flag. |
mbed_official | 235:685d5f11838f | 649 | * @param __HANDLE__: CAN Handle. |
mbed_official | 235:685d5f11838f | 650 | * @param __FLAG__: specifies the flag to check. |
mbed_official | 235:685d5f11838f | 651 | * This parameter can be one of the following values: |
mbed_official | 235:685d5f11838f | 652 | * @arg CAN_TSR_RQCP0: Request MailBox0 Flag |
mbed_official | 235:685d5f11838f | 653 | * @arg CAN_TSR_RQCP1: Request MailBox1 Flag |
mbed_official | 235:685d5f11838f | 654 | * @arg CAN_TSR_RQCP2: Request MailBox2 Flag |
mbed_official | 235:685d5f11838f | 655 | * @arg CAN_FLAG_TXOK0: Transmission OK MailBox0 Flag |
mbed_official | 235:685d5f11838f | 656 | * @arg CAN_FLAG_TXOK1: Transmission OK MailBox1 Flag |
mbed_official | 235:685d5f11838f | 657 | * @arg CAN_FLAG_TXOK2: Transmission OK MailBox2 Flag |
mbed_official | 235:685d5f11838f | 658 | * @arg CAN_FLAG_TME0: Transmit mailbox 0 empty Flag |
mbed_official | 235:685d5f11838f | 659 | * @arg CAN_FLAG_TME1: Transmit mailbox 1 empty Flag |
mbed_official | 235:685d5f11838f | 660 | * @arg CAN_FLAG_TME2: Transmit mailbox 2 empty Flag |
mbed_official | 235:685d5f11838f | 661 | * @arg CAN_FLAG_FMP0: FIFO 0 Message Pending Flag |
mbed_official | 235:685d5f11838f | 662 | * @arg CAN_FLAG_FF0: FIFO 0 Full Flag |
mbed_official | 235:685d5f11838f | 663 | * @arg CAN_FLAG_FOV0: FIFO 0 Overrun Flag |
mbed_official | 235:685d5f11838f | 664 | * @arg CAN_FLAG_FMP1: FIFO 1 Message Pending Flag |
mbed_official | 235:685d5f11838f | 665 | * @arg CAN_FLAG_FF1: FIFO 1 Full Flag |
mbed_official | 235:685d5f11838f | 666 | * @arg CAN_FLAG_FOV1: FIFO 1 Overrun Flag |
mbed_official | 235:685d5f11838f | 667 | * @arg CAN_FLAG_WKU: Wake up Flag |
mbed_official | 235:685d5f11838f | 668 | * @arg CAN_FLAG_SLAK: Sleep acknowledge Flag |
mbed_official | 235:685d5f11838f | 669 | * @arg CAN_FLAG_SLAKI: Sleep acknowledge Flag |
mbed_official | 235:685d5f11838f | 670 | * @arg CAN_FLAG_EWG: Error Warning Flag |
mbed_official | 235:685d5f11838f | 671 | * @arg CAN_FLAG_EPV: Error Passive Flag |
mbed_official | 235:685d5f11838f | 672 | * @arg CAN_FLAG_BOF: Bus-Off Flag |
mbed_official | 235:685d5f11838f | 673 | * @retval The new state of __FLAG__ (TRUE or FALSE). |
mbed_official | 235:685d5f11838f | 674 | */ |
mbed_official | 235:685d5f11838f | 675 | #define __HAL_CAN_CLEAR_FLAG(__HANDLE__, __FLAG__) \ |
mbed_official | 235:685d5f11838f | 676 | ((((__FLAG__) >> 8) == 5)? (((__HANDLE__)->Instance->TSR) = ~((uint32_t)1 << ((__FLAG__) & CAN_FLAG_MASK))): \ |
mbed_official | 235:685d5f11838f | 677 | (((__FLAG__) >> 8) == 2)? (((__HANDLE__)->Instance->RF0R) = ~((uint32_t)1 << ((__FLAG__) & CAN_FLAG_MASK))): \ |
mbed_official | 235:685d5f11838f | 678 | (((__FLAG__) >> 8) == 4)? (((__HANDLE__)->Instance->RF1R) = ~((uint32_t)1 << ((__FLAG__) & CAN_FLAG_MASK))): \ |
mbed_official | 235:685d5f11838f | 679 | (((__FLAG__) >> 8) == 1)? (((__HANDLE__)->Instance->MSR) = ~((uint32_t)1 << ((__FLAG__) & CAN_FLAG_MASK))): \ |
mbed_official | 235:685d5f11838f | 680 | (((__HANDLE__)->Instance->ESR) = ~((uint32_t)1 << ((__FLAG__) & CAN_FLAG_MASK)))) |
mbed_official | 235:685d5f11838f | 681 | |
mbed_official | 235:685d5f11838f | 682 | /** @brief Check if the specified CAN interrupt source is enabled or disabled. |
mbed_official | 235:685d5f11838f | 683 | * @param __HANDLE__: CAN Handle |
mbed_official | 235:685d5f11838f | 684 | * @param __INTERRUPT__: specifies the CAN interrupt source to check. |
mbed_official | 235:685d5f11838f | 685 | * This parameter can be one of the following values: |
mbed_official | 235:685d5f11838f | 686 | * @arg CAN_IT_TME: Transmit mailbox empty interrupt enable |
mbed_official | 235:685d5f11838f | 687 | * @arg CAN_IT_FMP0: FIFO0 message pending interrupt enablev |
mbed_official | 235:685d5f11838f | 688 | * @arg CAN_IT_FMP1: FIFO1 message pending interrupt enable |
mbed_official | 235:685d5f11838f | 689 | * @retval The new state of __IT__ (TRUE or FALSE). |
mbed_official | 235:685d5f11838f | 690 | */ |
mbed_official | 235:685d5f11838f | 691 | #define __HAL_CAN_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((__HANDLE__)->Instance->IER & (__INTERRUPT__)) == (__INTERRUPT__)) ? SET : RESET) |
mbed_official | 235:685d5f11838f | 692 | |
mbed_official | 235:685d5f11838f | 693 | /** |
mbed_official | 235:685d5f11838f | 694 | * @brief Check the transmission status of a CAN Frame. |
mbed_official | 235:685d5f11838f | 695 | * @param __HANDLE__: CAN Handle |
mbed_official | 235:685d5f11838f | 696 | * @param __TRANSMITMAILBOX__: the number of the mailbox that is used for transmission. |
mbed_official | 235:685d5f11838f | 697 | * @retval The new status of transmission (TRUE or FALSE). |
mbed_official | 235:685d5f11838f | 698 | */ |
mbed_official | 235:685d5f11838f | 699 | #define __HAL_CAN_TRANSMIT_STATUS(__HANDLE__, __TRANSMITMAILBOX__)\ |
mbed_official | 235:685d5f11838f | 700 | (((__TRANSMITMAILBOX__) == CAN_TXMAILBOX_0)? ((((__HANDLE__)->Instance->TSR) & (CAN_TSR_RQCP0 | CAN_TSR_TXOK0 | CAN_TSR_TME0)) == (CAN_TSR_RQCP0 | CAN_TSR_TXOK0 | CAN_TSR_TME0)) :\ |
mbed_official | 235:685d5f11838f | 701 | ((__TRANSMITMAILBOX__) == CAN_TXMAILBOX_1)? ((((__HANDLE__)->Instance->TSR) & (CAN_TSR_RQCP1 | CAN_TSR_TXOK1 | CAN_TSR_TME1)) == (CAN_TSR_RQCP1 | CAN_TSR_TXOK1 | CAN_TSR_TME1)) :\ |
mbed_official | 235:685d5f11838f | 702 | ((((__HANDLE__)->Instance->TSR) & (CAN_TSR_RQCP2 | CAN_TSR_TXOK2 | CAN_TSR_TME2)) == (CAN_TSR_RQCP2 | CAN_TSR_TXOK2 | CAN_TSR_TME2))) |
mbed_official | 235:685d5f11838f | 703 | |
mbed_official | 235:685d5f11838f | 704 | |
mbed_official | 235:685d5f11838f | 705 | |
mbed_official | 235:685d5f11838f | 706 | /** |
mbed_official | 235:685d5f11838f | 707 | * @brief Release the specified receive FIFO. |
mbed_official | 235:685d5f11838f | 708 | * @param __HANDLE__: CAN handle |
mbed_official | 235:685d5f11838f | 709 | * @param __FIFONUMBER__: Receive FIFO number, CAN_FIFO0 or CAN_FIFO1. |
mbed_official | 235:685d5f11838f | 710 | * @retval None |
mbed_official | 235:685d5f11838f | 711 | */ |
mbed_official | 235:685d5f11838f | 712 | #define __HAL_CAN_FIFO_RELEASE(__HANDLE__, __FIFONUMBER__) (((__FIFONUMBER__) == CAN_FIFO0)? \ |
mbed_official | 235:685d5f11838f | 713 | ((__HANDLE__)->Instance->RF0R |= CAN_RF0R_RFOM0) : ((__HANDLE__)->Instance->RF1R |= CAN_RF1R_RFOM1)) |
mbed_official | 235:685d5f11838f | 714 | |
mbed_official | 235:685d5f11838f | 715 | /** |
mbed_official | 235:685d5f11838f | 716 | * @brief Cancel a transmit request. |
mbed_official | 235:685d5f11838f | 717 | * @param __HANDLE__: CAN Handle |
mbed_official | 235:685d5f11838f | 718 | * @param __TRANSMITMAILBOX__: the number of the mailbox that is used for transmission. |
mbed_official | 235:685d5f11838f | 719 | * @retval None |
mbed_official | 235:685d5f11838f | 720 | */ |
mbed_official | 235:685d5f11838f | 721 | #define __HAL_CAN_CANCEL_TRANSMIT(__HANDLE__, __TRANSMITMAILBOX__)\ |
mbed_official | 235:685d5f11838f | 722 | (((__TRANSMITMAILBOX__) == CAN_TXMAILBOX_0)? ((__HANDLE__)->Instance->TSR |= CAN_TSR_ABRQ0) :\ |
mbed_official | 235:685d5f11838f | 723 | ((__TRANSMITMAILBOX__) == CAN_TXMAILBOX_1)? ((__HANDLE__)->Instance->TSR |= CAN_TSR_ABRQ1) :\ |
mbed_official | 235:685d5f11838f | 724 | ((__HANDLE__)->Instance->TSR |= CAN_TSR_ABRQ2)) |
mbed_official | 235:685d5f11838f | 725 | |
mbed_official | 235:685d5f11838f | 726 | /** |
mbed_official | 235:685d5f11838f | 727 | * @brief Enable or disable the DBG Freeze for CAN. |
mbed_official | 235:685d5f11838f | 728 | * @param __HANDLE__: CAN Handle |
mbed_official | 235:685d5f11838f | 729 | * @param __NEWSTATE__: new state of the CAN peripheral. |
mbed_official | 235:685d5f11838f | 730 | * This parameter can be: ENABLE (CAN reception/transmission is frozen |
mbed_official | 235:685d5f11838f | 731 | * during debug. Reception FIFOs can still be accessed/controlled normally) |
mbed_official | 235:685d5f11838f | 732 | * or DISABLE (CAN is working during debug). |
mbed_official | 235:685d5f11838f | 733 | * @retval None |
mbed_official | 235:685d5f11838f | 734 | */ |
mbed_official | 235:685d5f11838f | 735 | #define __HAL_CAN_DBG_FREEZE(__HANDLE__, __NEWSTATE__) (((__NEWSTATE__) == ENABLE)? \ |
mbed_official | 235:685d5f11838f | 736 | ((__HANDLE__)->Instance->MCR |= CAN_MCR_DBF) : ((__HANDLE__)->Instance->MCR &= ~CAN_MCR_DBF)) |
mbed_official | 235:685d5f11838f | 737 | |
mbed_official | 235:685d5f11838f | 738 | /* Exported functions --------------------------------------------------------*/ |
mbed_official | 235:685d5f11838f | 739 | |
mbed_official | 235:685d5f11838f | 740 | /* Initialization/de-initialization functions ***********************************/ |
mbed_official | 235:685d5f11838f | 741 | HAL_StatusTypeDef HAL_CAN_Init(CAN_HandleTypeDef* hcan); |
mbed_official | 235:685d5f11838f | 742 | HAL_StatusTypeDef HAL_CAN_ConfigFilter(CAN_HandleTypeDef* hcan, CAN_FilterConfTypeDef* sFilterConfig); |
mbed_official | 235:685d5f11838f | 743 | HAL_StatusTypeDef HAL_CAN_DeInit(CAN_HandleTypeDef* hcan); |
mbed_official | 235:685d5f11838f | 744 | void HAL_CAN_MspInit(CAN_HandleTypeDef* hcan); |
mbed_official | 235:685d5f11838f | 745 | void HAL_CAN_MspDeInit(CAN_HandleTypeDef* hcan); |
mbed_official | 235:685d5f11838f | 746 | |
mbed_official | 235:685d5f11838f | 747 | /* I/O operation functions ******************************************************/ |
mbed_official | 235:685d5f11838f | 748 | HAL_StatusTypeDef HAL_CAN_Transmit(CAN_HandleTypeDef *hcan, uint32_t Timeout); |
mbed_official | 235:685d5f11838f | 749 | HAL_StatusTypeDef HAL_CAN_Transmit_IT(CAN_HandleTypeDef *hcan); |
mbed_official | 235:685d5f11838f | 750 | HAL_StatusTypeDef HAL_CAN_Receive(CAN_HandleTypeDef *hcan, uint8_t FIFONumber, uint32_t Timeout); |
mbed_official | 235:685d5f11838f | 751 | HAL_StatusTypeDef HAL_CAN_Receive_IT(CAN_HandleTypeDef *hcan, uint8_t FIFONumber); |
mbed_official | 235:685d5f11838f | 752 | HAL_StatusTypeDef HAL_CAN_Sleep(CAN_HandleTypeDef *hcan); |
mbed_official | 235:685d5f11838f | 753 | HAL_StatusTypeDef HAL_CAN_WakeUp(CAN_HandleTypeDef *hcan); |
mbed_official | 235:685d5f11838f | 754 | |
mbed_official | 235:685d5f11838f | 755 | /* Peripheral State functions ***************************************************/ |
mbed_official | 235:685d5f11838f | 756 | void HAL_CAN_IRQHandler(CAN_HandleTypeDef* hcan); |
mbed_official | 235:685d5f11838f | 757 | uint32_t HAL_CAN_GetError(CAN_HandleTypeDef *hcan); |
mbed_official | 235:685d5f11838f | 758 | HAL_CAN_StateTypeDef HAL_CAN_GetState(CAN_HandleTypeDef* hcan); |
mbed_official | 235:685d5f11838f | 759 | |
mbed_official | 235:685d5f11838f | 760 | void HAL_CAN_TxCpltCallback(CAN_HandleTypeDef* hcan); |
mbed_official | 235:685d5f11838f | 761 | void HAL_CAN_RxCpltCallback(CAN_HandleTypeDef* hcan); |
mbed_official | 235:685d5f11838f | 762 | void HAL_CAN_ErrorCallback(CAN_HandleTypeDef *hcan); |
mbed_official | 235:685d5f11838f | 763 | |
mbed_official | 235:685d5f11838f | 764 | #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx */ |
mbed_official | 235:685d5f11838f | 765 | |
mbed_official | 235:685d5f11838f | 766 | /** |
mbed_official | 235:685d5f11838f | 767 | * @} |
mbed_official | 235:685d5f11838f | 768 | */ |
mbed_official | 235:685d5f11838f | 769 | |
mbed_official | 235:685d5f11838f | 770 | /** |
mbed_official | 235:685d5f11838f | 771 | * @} |
mbed_official | 235:685d5f11838f | 772 | */ |
mbed_official | 235:685d5f11838f | 773 | |
mbed_official | 235:685d5f11838f | 774 | #ifdef __cplusplus |
mbed_official | 235:685d5f11838f | 775 | } |
mbed_official | 235:685d5f11838f | 776 | #endif |
mbed_official | 235:685d5f11838f | 777 | |
mbed_official | 235:685d5f11838f | 778 | #endif /* __STM32F4xx_CAN_H */ |
mbed_official | 235:685d5f11838f | 779 | |
mbed_official | 235:685d5f11838f | 780 | |
mbed_official | 235:685d5f11838f | 781 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |