version_2.0
Dependents: cc3000_ping_demo_try_2
Fork of mbed by
TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/can/fsl_flexcan_hal.h@82:6473597d706e, 2014-04-07 (annotated)
- Committer:
- bogdanm
- Date:
- Mon Apr 07 18:28:36 2014 +0100
- Revision:
- 82:6473597d706e
Release 82 of the mbed library
Main changes:
- support for K64F
- Revisited Nordic code structure
- Test infrastructure improvements
- various bug fixes
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
bogdanm | 82:6473597d706e | 1 | /* |
bogdanm | 82:6473597d706e | 2 | * Copyright (c) 2013 - 2014, Freescale Semiconductor, Inc. |
bogdanm | 82:6473597d706e | 3 | * All rights reserved. |
bogdanm | 82:6473597d706e | 4 | * |
bogdanm | 82:6473597d706e | 5 | * Redistribution and use in source and binary forms, with or without modification, |
bogdanm | 82:6473597d706e | 6 | * are permitted provided that the following conditions are met: |
bogdanm | 82:6473597d706e | 7 | * |
bogdanm | 82:6473597d706e | 8 | * o Redistributions of source code must retain the above copyright notice, this list |
bogdanm | 82:6473597d706e | 9 | * of conditions and the following disclaimer. |
bogdanm | 82:6473597d706e | 10 | * |
bogdanm | 82:6473597d706e | 11 | * o Redistributions in binary form must reproduce the above copyright notice, this |
bogdanm | 82:6473597d706e | 12 | * list of conditions and the following disclaimer in the documentation and/or |
bogdanm | 82:6473597d706e | 13 | * other materials provided with the distribution. |
bogdanm | 82:6473597d706e | 14 | * |
bogdanm | 82:6473597d706e | 15 | * o Neither the name of Freescale Semiconductor, Inc. nor the names of its |
bogdanm | 82:6473597d706e | 16 | * contributors may be used to endorse or promote products derived from this |
bogdanm | 82:6473597d706e | 17 | * software without specific prior written permission. |
bogdanm | 82:6473597d706e | 18 | * |
bogdanm | 82:6473597d706e | 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
bogdanm | 82:6473597d706e | 20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
bogdanm | 82:6473597d706e | 21 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
bogdanm | 82:6473597d706e | 22 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR |
bogdanm | 82:6473597d706e | 23 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
bogdanm | 82:6473597d706e | 24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
bogdanm | 82:6473597d706e | 25 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON |
bogdanm | 82:6473597d706e | 26 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
bogdanm | 82:6473597d706e | 27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
bogdanm | 82:6473597d706e | 28 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
bogdanm | 82:6473597d706e | 29 | */ |
bogdanm | 82:6473597d706e | 30 | #ifndef __FSL_FLEXCAN_HAL_H__ |
bogdanm | 82:6473597d706e | 31 | #define __FSL_FLEXCAN_HAL_H__ |
bogdanm | 82:6473597d706e | 32 | |
bogdanm | 82:6473597d706e | 33 | #include <assert.h> |
bogdanm | 82:6473597d706e | 34 | #include <stdint.h> |
bogdanm | 82:6473597d706e | 35 | #include <stdbool.h> |
bogdanm | 82:6473597d706e | 36 | #include "fsl_flexcan_features.h" |
bogdanm | 82:6473597d706e | 37 | #include "fsl_device_registers.h" |
bogdanm | 82:6473597d706e | 38 | |
bogdanm | 82:6473597d706e | 39 | /*! |
bogdanm | 82:6473597d706e | 40 | * @addtogroup flexcan_hal |
bogdanm | 82:6473597d706e | 41 | * @{ |
bogdanm | 82:6473597d706e | 42 | */ |
bogdanm | 82:6473597d706e | 43 | |
bogdanm | 82:6473597d706e | 44 | /******************************************************************************* |
bogdanm | 82:6473597d706e | 45 | * Definitions |
bogdanm | 82:6473597d706e | 46 | ******************************************************************************/ |
bogdanm | 82:6473597d706e | 47 | |
bogdanm | 82:6473597d706e | 48 | /*! @brief FlexCAN constants*/ |
bogdanm | 82:6473597d706e | 49 | enum _flexcan_constants |
bogdanm | 82:6473597d706e | 50 | { |
bogdanm | 82:6473597d706e | 51 | kFlexCanMessageSize = 8, /*!< FlexCAN message buffer data size in bytes*/ |
bogdanm | 82:6473597d706e | 52 | }; |
bogdanm | 82:6473597d706e | 53 | |
bogdanm | 82:6473597d706e | 54 | /*! @brief The Status enum is used to report current status of the FlexCAN interface.*/ |
bogdanm | 82:6473597d706e | 55 | enum _flexcan_err_status |
bogdanm | 82:6473597d706e | 56 | { |
bogdanm | 82:6473597d706e | 57 | kFlexCan_RxWrn = 0x0080, /*!< Reached warning level for RX errors*/ |
bogdanm | 82:6473597d706e | 58 | kFlexCan_TxWrn = 0x0100, /*!< Reached warning level for TX errors*/ |
bogdanm | 82:6473597d706e | 59 | kFlexCan_StfErr = 0x0200, /*!< Stuffing Error*/ |
bogdanm | 82:6473597d706e | 60 | kFlexCan_FrmErr = 0x0400, /*!< Form Error*/ |
bogdanm | 82:6473597d706e | 61 | kFlexCan_CrcErr = 0x0800, /*!< Cyclic Redundancy Check Error*/ |
bogdanm | 82:6473597d706e | 62 | kFlexCan_AckErr = 0x1000, /*!< Received no ACK on transmission*/ |
bogdanm | 82:6473597d706e | 63 | kFlexCan_Bit0Err = 0x2000, /*!< Unable to send dominant bit*/ |
bogdanm | 82:6473597d706e | 64 | kFlexCan_Bit1Err = 0x4000, /*!< Unable to send recessive bit*/ |
bogdanm | 82:6473597d706e | 65 | }; |
bogdanm | 82:6473597d706e | 66 | |
bogdanm | 82:6473597d706e | 67 | /*! @brief FlexCAN status return codes*/ |
bogdanm | 82:6473597d706e | 68 | typedef enum _flexcan_status |
bogdanm | 82:6473597d706e | 69 | { |
bogdanm | 82:6473597d706e | 70 | kStatus_FLEXCAN_Success = 0, |
bogdanm | 82:6473597d706e | 71 | kStatus_FLEXCAN_OutOfRange, |
bogdanm | 82:6473597d706e | 72 | kStatus_FLEXCAN_UnknownProperty, |
bogdanm | 82:6473597d706e | 73 | kStatus_FLEXCAN_InvalidArgument, |
bogdanm | 82:6473597d706e | 74 | kStatus_FLEXCAN_Fail, |
bogdanm | 82:6473597d706e | 75 | kStatus_FLEXCAN_TimeOut, |
bogdanm | 82:6473597d706e | 76 | } flexcan_status_t; |
bogdanm | 82:6473597d706e | 77 | |
bogdanm | 82:6473597d706e | 78 | |
bogdanm | 82:6473597d706e | 79 | /*! @brief FlexCAN operation modes*/ |
bogdanm | 82:6473597d706e | 80 | typedef enum _flexcan_operation_modes { |
bogdanm | 82:6473597d706e | 81 | kFlexCanNormalMode, /*!< Normal mode or user mode*/ |
bogdanm | 82:6473597d706e | 82 | kFlexCanListenOnlyMode, /*!< Listen-only mode*/ |
bogdanm | 82:6473597d706e | 83 | kFlexCanLoopBackMode, /*!< Loop-back mode*/ |
bogdanm | 82:6473597d706e | 84 | kFlexCanFreezeMode, /*!< Freeze mode*/ |
bogdanm | 82:6473597d706e | 85 | kFlexCanDisableMode, /*!< Module disable mode*/ |
bogdanm | 82:6473597d706e | 86 | } flexcan_operation_modes_t; |
bogdanm | 82:6473597d706e | 87 | |
bogdanm | 82:6473597d706e | 88 | /*! @brief FlexCAN message buffer CODE for Rx buffers*/ |
bogdanm | 82:6473597d706e | 89 | typedef enum _flexcan_mb_code_rx { |
bogdanm | 82:6473597d706e | 90 | kFlexCanRX_Inactive = 0x0, /*!< MB is not active.*/ |
bogdanm | 82:6473597d706e | 91 | kFlexCanRX_Full = 0x2, /*!< MB is full.*/ |
bogdanm | 82:6473597d706e | 92 | kFlexCanRX_Empty = 0x4, /*!< MB is active and empty.*/ |
bogdanm | 82:6473597d706e | 93 | kFlexCanRX_Overrun = 0x6, /*!< MB is overwritten into a full buffer.*/ |
bogdanm | 82:6473597d706e | 94 | kFlexCanRX_Busy = 0x8, /*!< FlexCAN is updating the contents of the MB.*/ |
bogdanm | 82:6473597d706e | 95 | /*! The CPU must not access the MB.*/ |
bogdanm | 82:6473597d706e | 96 | kFlexCanRX_Ranswer = 0xA, /*!< A frame was configured to recognize a Remote Request Frame*/ |
bogdanm | 82:6473597d706e | 97 | /*! and transmit a Response Frame in return.*/ |
bogdanm | 82:6473597d706e | 98 | kFlexCanRX_NotUsed = 0xF, /*!< Not used*/ |
bogdanm | 82:6473597d706e | 99 | } flexcan_mb_code_rx_t; |
bogdanm | 82:6473597d706e | 100 | |
bogdanm | 82:6473597d706e | 101 | /*! @brief FlexCAN message buffer CODE FOR Tx buffers*/ |
bogdanm | 82:6473597d706e | 102 | typedef enum _flexcan_mb_code_tx { |
bogdanm | 82:6473597d706e | 103 | kFlexCanTX_Inactive = 0x08, /*!< MB is not active.*/ |
bogdanm | 82:6473597d706e | 104 | kFlexCanTX_Abort = 0x09, /*!< MB is aborted.*/ |
bogdanm | 82:6473597d706e | 105 | kFlexCanTX_Data = 0x0C, /*!< MB is a TX Data Frame(MB RTR must be 0).*/ |
bogdanm | 82:6473597d706e | 106 | kFlexCanTX_Remote = 0x1C, /*!< MB is a TX Remote Request Frame (MB RTR must be 1).*/ |
bogdanm | 82:6473597d706e | 107 | kFlexCanTX_Tanswer = 0x0E, /*!< MB is a TX Response Request Frame from.*/ |
bogdanm | 82:6473597d706e | 108 | /*! an incoming Remote Request Frame.*/ |
bogdanm | 82:6473597d706e | 109 | kFlexCanTX_NotUsed = 0xF, /*!< Not used*/ |
bogdanm | 82:6473597d706e | 110 | } flexcan_mb_code_tx_t; |
bogdanm | 82:6473597d706e | 111 | |
bogdanm | 82:6473597d706e | 112 | /*! @brief FlexCAN message buffer transmission types*/ |
bogdanm | 82:6473597d706e | 113 | typedef enum _flexcan_mb_transmission_type { |
bogdanm | 82:6473597d706e | 114 | kFlexCanMBStatusType_TX, /*!< Transmit MB*/ |
bogdanm | 82:6473597d706e | 115 | kFlexCanMBStatusType_TXRemote, /*!< Transmit remote request MB*/ |
bogdanm | 82:6473597d706e | 116 | kFlexCanMBStatusType_RX, /*!< Receive MB*/ |
bogdanm | 82:6473597d706e | 117 | kFlexCanMBStatusType_RXRemote, /*!< Receive remote request MB*/ |
bogdanm | 82:6473597d706e | 118 | kFlexCanMBStatusType_RXTXRemote, /*!< FlexCAN remote frame receives remote request and*/ |
bogdanm | 82:6473597d706e | 119 | /*! transmits MB.*/ |
bogdanm | 82:6473597d706e | 120 | } flexcan_mb_transmission_type_t; |
bogdanm | 82:6473597d706e | 121 | |
bogdanm | 82:6473597d706e | 122 | typedef enum _flexcan_rx_fifo_id_element_format { |
bogdanm | 82:6473597d706e | 123 | kFlexCanRxFifoIdElementFormat_A, /*!< One full ID (standard and extended) per ID Filter Table*/ |
bogdanm | 82:6473597d706e | 124 | /*! element.*/ |
bogdanm | 82:6473597d706e | 125 | kFlexCanRxFifoIdElementFormat_B, /*!< Two full standard IDs or two partial 14-bit (standard and*/ |
bogdanm | 82:6473597d706e | 126 | /*! extended) IDs per ID Filter Table element.*/ |
bogdanm | 82:6473597d706e | 127 | kFlexCanRxFifoIdElementFormat_C, /*!< Four partial 8-bit Standard IDs per ID Filter Table*/ |
bogdanm | 82:6473597d706e | 128 | /*! element.*/ |
bogdanm | 82:6473597d706e | 129 | kFlexCanRxFifoIdElementFormat_D, /*!< All frames rejected.*/ |
bogdanm | 82:6473597d706e | 130 | } flexcan_rx_fifo_id_element_format_t; |
bogdanm | 82:6473597d706e | 131 | |
bogdanm | 82:6473597d706e | 132 | /*! @brief FlexCAN Rx FIFO filters number*/ |
bogdanm | 82:6473597d706e | 133 | typedef enum _flexcan_rx_fifo_id_filter_number { |
bogdanm | 82:6473597d706e | 134 | kFlexCanRxFifoIDFilters_8 = 0x0, /*!< 8 Rx FIFO Filters*/ |
bogdanm | 82:6473597d706e | 135 | kFlexCanRxFifoIDFilters_16 = 0x1, /*!< 16 Rx FIFO Filters*/ |
bogdanm | 82:6473597d706e | 136 | kFlexCanRxFifoIDFilters_24 = 0x2, /*!< 24 Rx FIFO Filters*/ |
bogdanm | 82:6473597d706e | 137 | kFlexCanRxFifoIDFilters_32 = 0x3, /*!< 32 Rx FIFO Filters*/ |
bogdanm | 82:6473597d706e | 138 | kFlexCanRxFifoIDFilters_40 = 0x4, /*!< 40 Rx FIFO Filters*/ |
bogdanm | 82:6473597d706e | 139 | kFlexCanRxFifoIDFilters_48 = 0x5, /*!< 48 Rx FIFO Filters*/ |
bogdanm | 82:6473597d706e | 140 | kFlexCanRxFifoIDFilters_56 = 0x6, /*!< 56 Rx FIFO Filters*/ |
bogdanm | 82:6473597d706e | 141 | kFlexCanRxFifoIDFilters_64 = 0x7, /*!< 64 Rx FIFO Filters*/ |
bogdanm | 82:6473597d706e | 142 | kFlexCanRxFifoIDFilters_72 = 0x8, /*!< 72 Rx FIFO Filters*/ |
bogdanm | 82:6473597d706e | 143 | kFlexCanRxFifoIDFilters_80 = 0x9, /*!< 80 Rx FIFO Filters*/ |
bogdanm | 82:6473597d706e | 144 | kFlexCanRxFifoIDFilters_88 = 0xA, /*!< 88 Rx FIFO Filters*/ |
bogdanm | 82:6473597d706e | 145 | kFlexCanRxFifoIDFilters_96 = 0xB, /*!< 96 Rx FIFO Filters*/ |
bogdanm | 82:6473597d706e | 146 | kFlexCanRxFifoIDFilters_104 = 0xC, /*!< 104 Rx FIFO Filters*/ |
bogdanm | 82:6473597d706e | 147 | kFlexCanRxFifoIDFilters_112 = 0xD, /*!< 112 Rx FIFO Filters*/ |
bogdanm | 82:6473597d706e | 148 | kFlexCanRxFifoIDFilters_120 = 0xE, /*!< 120 Rx FIFO Filters*/ |
bogdanm | 82:6473597d706e | 149 | kFlexCanRxFifoIDFilters_128 = 0xF /*!< 128 Rx FIFO Filters*/ |
bogdanm | 82:6473597d706e | 150 | } flexcan_rx_fifo_id_filter_num_t; |
bogdanm | 82:6473597d706e | 151 | |
bogdanm | 82:6473597d706e | 152 | /*! @brief FlexCAN RX FIFO ID filter table structure*/ |
bogdanm | 82:6473597d706e | 153 | typedef struct FLEXCANIdTable { |
bogdanm | 82:6473597d706e | 154 | bool is_remote_mb; /*!< Remote frame*/ |
bogdanm | 82:6473597d706e | 155 | bool is_extended_mb; /*!< Extended frame*/ |
bogdanm | 82:6473597d706e | 156 | uint32_t *id_filter; /*!< Rx FIFO ID filter elements*/ |
bogdanm | 82:6473597d706e | 157 | } flexcan_id_table_t; |
bogdanm | 82:6473597d706e | 158 | |
bogdanm | 82:6473597d706e | 159 | /*! @brief FlexCAN RX mask type.*/ |
bogdanm | 82:6473597d706e | 160 | typedef enum _flexcan_rx_mask_type { |
bogdanm | 82:6473597d706e | 161 | kFlexCanRxMask_Global, /*!< Rx global mask*/ |
bogdanm | 82:6473597d706e | 162 | kFlexCanRxMask_Individual, /*!< Rx individual mask*/ |
bogdanm | 82:6473597d706e | 163 | } flexcan_rx_mask_type_t; |
bogdanm | 82:6473597d706e | 164 | |
bogdanm | 82:6473597d706e | 165 | /*! @brief FlexCAN MB ID type*/ |
bogdanm | 82:6473597d706e | 166 | typedef enum _flexcan_mb_id_type { |
bogdanm | 82:6473597d706e | 167 | kFlexCanMbId_Std, /*!< Standard ID*/ |
bogdanm | 82:6473597d706e | 168 | kFlexCanMbId_Ext, /*!< Extended ID*/ |
bogdanm | 82:6473597d706e | 169 | } flexcan_mb_id_type_t; |
bogdanm | 82:6473597d706e | 170 | |
bogdanm | 82:6473597d706e | 171 | /*! @brief FlexCAN clock source*/ |
bogdanm | 82:6473597d706e | 172 | typedef enum _flexcan_clk_source { |
bogdanm | 82:6473597d706e | 173 | kFlexCanClkSource_Osc, /*!< Oscillator clock*/ |
bogdanm | 82:6473597d706e | 174 | kFlexCanClkSource_Ipbus, /*!< Peripheral clock*/ |
bogdanm | 82:6473597d706e | 175 | } flexcan_clk_source_t; |
bogdanm | 82:6473597d706e | 176 | |
bogdanm | 82:6473597d706e | 177 | /*! @brief FlexCAN error interrupt types*/ |
bogdanm | 82:6473597d706e | 178 | typedef enum _flexcan_int_type { |
bogdanm | 82:6473597d706e | 179 | kFlexCanInt_Buf, /*!< OR'd message buffers interrupt*/ |
bogdanm | 82:6473597d706e | 180 | kFlexCanInt_Err, /*!< Error interrupt*/ |
bogdanm | 82:6473597d706e | 181 | kFlexCanInt_Boff, /*!< Bus off interrupt*/ |
bogdanm | 82:6473597d706e | 182 | kFlexCanInt_Wakeup, /*!< Wakeup interrupt*/ |
bogdanm | 82:6473597d706e | 183 | kFlexCanInt_Txwarning, /*!< TX warning interrupt*/ |
bogdanm | 82:6473597d706e | 184 | kFlexCanInt_Rxwarning, /*!< RX warning interrupt*/ |
bogdanm | 82:6473597d706e | 185 | } flexcan_int_type_t; |
bogdanm | 82:6473597d706e | 186 | |
bogdanm | 82:6473597d706e | 187 | /*! @brief FlexCAN bus error counters*/ |
bogdanm | 82:6473597d706e | 188 | typedef struct FLEXCANBerrCounter { |
bogdanm | 82:6473597d706e | 189 | uint16_t txerr; /*!< Transmit error counter*/ |
bogdanm | 82:6473597d706e | 190 | uint16_t rxerr; /*!< Receive error counter*/ |
bogdanm | 82:6473597d706e | 191 | } flexcan_berr_counter_t; |
bogdanm | 82:6473597d706e | 192 | |
bogdanm | 82:6473597d706e | 193 | /*! @brief FlexCAN MB code and status for transmitting*/ |
bogdanm | 82:6473597d706e | 194 | typedef struct FLEXCANMbCodeStatusTx { |
bogdanm | 82:6473597d706e | 195 | flexcan_mb_code_tx_t code; /*!< MB code for Tx buffers*/ |
bogdanm | 82:6473597d706e | 196 | flexcan_mb_id_type_t msg_id_type; /*!< Type of message ID (standard or extended)*/ |
bogdanm | 82:6473597d706e | 197 | uint32_t data_length; /*!< Length of Data in Bytes*/ |
bogdanm | 82:6473597d706e | 198 | uint32_t substitute_remote; /*!< Substitute remote request (used only in*/ |
bogdanm | 82:6473597d706e | 199 | /*! extended format)*/ |
bogdanm | 82:6473597d706e | 200 | uint32_t remote_transmission; /*!< Remote transmission request*/ |
bogdanm | 82:6473597d706e | 201 | bool local_priority_enable; /*!< 1 if enable it; 0 if disable it*/ |
bogdanm | 82:6473597d706e | 202 | uint32_t local_priority_val; /*!< Local priority value [0..2]*/ |
bogdanm | 82:6473597d706e | 203 | } flexcan_mb_code_status_tx_t; |
bogdanm | 82:6473597d706e | 204 | |
bogdanm | 82:6473597d706e | 205 | /*! @brief FlexCAN MB code and status for receiving*/ |
bogdanm | 82:6473597d706e | 206 | typedef struct FLEXCANMbCodeStatusRx { |
bogdanm | 82:6473597d706e | 207 | flexcan_mb_code_rx_t code; /*!< MB code for Rx buffers*/ |
bogdanm | 82:6473597d706e | 208 | flexcan_mb_id_type_t msg_id_type; /*!< Type of message ID (standard or extended)*/ |
bogdanm | 82:6473597d706e | 209 | uint32_t data_length; /*!< Length of Data in Bytes*/ |
bogdanm | 82:6473597d706e | 210 | uint32_t substitute_remote; /*!< Substitute remote request (used only in*/ |
bogdanm | 82:6473597d706e | 211 | /*! extended format)*/ |
bogdanm | 82:6473597d706e | 212 | uint32_t remote_transmission; /*!< Remote transmission request*/ |
bogdanm | 82:6473597d706e | 213 | bool local_priority_enable; /*!< 1 if enable it; 0 if disable it*/ |
bogdanm | 82:6473597d706e | 214 | uint32_t local_priority_val; /*!< Local priority value [0..2]*/ |
bogdanm | 82:6473597d706e | 215 | } flexcan_mb_code_status_rx_t; |
bogdanm | 82:6473597d706e | 216 | |
bogdanm | 82:6473597d706e | 217 | /*! @brief FlexCAN Rx FIFO configuration*/ |
bogdanm | 82:6473597d706e | 218 | typedef struct FLEXCANRxFifoConfig { |
bogdanm | 82:6473597d706e | 219 | flexcan_mb_id_type_t msg_id_type; /*!< Type of message ID*/ |
bogdanm | 82:6473597d706e | 220 | /*! (standard or extended)*/ |
bogdanm | 82:6473597d706e | 221 | uint32_t data_length; /*!< Length of Data in Bytes*/ |
bogdanm | 82:6473597d706e | 222 | uint32_t substitute_remote; /*!< Substitute remote request (used*/ |
bogdanm | 82:6473597d706e | 223 | /*! only in extended format)*/ |
bogdanm | 82:6473597d706e | 224 | uint32_t remote_transmission; /*!< Remote transmission request*/ |
bogdanm | 82:6473597d706e | 225 | flexcan_rx_fifo_id_element_format_t id_filter_number; /*!< The number of Rx FIFO ID filters*/ |
bogdanm | 82:6473597d706e | 226 | } flexcan_rx_fifo_config_t; |
bogdanm | 82:6473597d706e | 227 | |
bogdanm | 82:6473597d706e | 228 | /*! @brief FlexCAN message buffer structure*/ |
bogdanm | 82:6473597d706e | 229 | typedef struct FLEXCANMb { |
bogdanm | 82:6473597d706e | 230 | uint32_t cs; /*!< Code and Status*/ |
bogdanm | 82:6473597d706e | 231 | uint32_t msg_id; /*!< Message Buffer ID*/ |
bogdanm | 82:6473597d706e | 232 | uint8_t data[kFlexCanMessageSize]; /*!< Bytes of the FlexCAN message*/ |
bogdanm | 82:6473597d706e | 233 | } flexcan_mb_t; |
bogdanm | 82:6473597d706e | 234 | |
bogdanm | 82:6473597d706e | 235 | /*! @brief FlexCAN configuration*/ |
bogdanm | 82:6473597d706e | 236 | typedef struct FLEXCANUserConfig { |
bogdanm | 82:6473597d706e | 237 | uint32_t num_mb; /*!< The number of Message Buffers needed*/ |
bogdanm | 82:6473597d706e | 238 | uint32_t max_num_mb; /*!< The maximum number of Message Buffers*/ |
bogdanm | 82:6473597d706e | 239 | flexcan_rx_fifo_id_filter_num_t num_id_filters; /*!< The number of Rx FIFO ID filters needed*/ |
bogdanm | 82:6473597d706e | 240 | bool is_rx_fifo_needed; /*!< 1 if needed; 0 if not*/ |
bogdanm | 82:6473597d706e | 241 | bool is_rx_mb_needed; /*!< 1 if needed; 0 if not*/ |
bogdanm | 82:6473597d706e | 242 | } flexcan_user_config_t; |
bogdanm | 82:6473597d706e | 243 | |
bogdanm | 82:6473597d706e | 244 | /*! @brief FlexCAN timing related structures*/ |
bogdanm | 82:6473597d706e | 245 | typedef struct FLEXCANTimeSegment { |
bogdanm | 82:6473597d706e | 246 | uint32_t propseg; /*!< Propagation segment*/ |
bogdanm | 82:6473597d706e | 247 | uint32_t pseg1; /*!< Phase segment 1*/ |
bogdanm | 82:6473597d706e | 248 | uint32_t pseg2; /*!< Phase segment 2*/ |
bogdanm | 82:6473597d706e | 249 | uint32_t pre_divider; /*!< Clock pre divider*/ |
bogdanm | 82:6473597d706e | 250 | uint32_t rjw; /*!< Resync jump width*/ |
bogdanm | 82:6473597d706e | 251 | } flexcan_time_segment_t; |
bogdanm | 82:6473597d706e | 252 | |
bogdanm | 82:6473597d706e | 253 | |
bogdanm | 82:6473597d706e | 254 | /******************************************************************************* |
bogdanm | 82:6473597d706e | 255 | * API |
bogdanm | 82:6473597d706e | 256 | ******************************************************************************/ |
bogdanm | 82:6473597d706e | 257 | |
bogdanm | 82:6473597d706e | 258 | #if defined(__cplusplus) |
bogdanm | 82:6473597d706e | 259 | extern "C" { |
bogdanm | 82:6473597d706e | 260 | #endif |
bogdanm | 82:6473597d706e | 261 | |
bogdanm | 82:6473597d706e | 262 | /*! |
bogdanm | 82:6473597d706e | 263 | * @name Configuration |
bogdanm | 82:6473597d706e | 264 | * @{ |
bogdanm | 82:6473597d706e | 265 | */ |
bogdanm | 82:6473597d706e | 266 | |
bogdanm | 82:6473597d706e | 267 | /*! |
bogdanm | 82:6473597d706e | 268 | * @brief Enables FlexCAN controller. |
bogdanm | 82:6473597d706e | 269 | * |
bogdanm | 82:6473597d706e | 270 | * @param instance The FlexCAN instance number |
bogdanm | 82:6473597d706e | 271 | * @return 0 if successful; non-zero failed |
bogdanm | 82:6473597d706e | 272 | */ |
bogdanm | 82:6473597d706e | 273 | flexcan_status_t flexcan_hal_enable(uint8_t instance); |
bogdanm | 82:6473597d706e | 274 | |
bogdanm | 82:6473597d706e | 275 | /*! |
bogdanm | 82:6473597d706e | 276 | * @brief Disables FlexCAN controller. |
bogdanm | 82:6473597d706e | 277 | * |
bogdanm | 82:6473597d706e | 278 | * @param instance The FlexCAN instance number |
bogdanm | 82:6473597d706e | 279 | * @return 0 if successful; non-zero failed |
bogdanm | 82:6473597d706e | 280 | */ |
bogdanm | 82:6473597d706e | 281 | flexcan_status_t flexcan_hal_disable(uint8_t instance); |
bogdanm | 82:6473597d706e | 282 | |
bogdanm | 82:6473597d706e | 283 | /*! |
bogdanm | 82:6473597d706e | 284 | * @brief Checks whether the FlexCAN is enabled or disabled. |
bogdanm | 82:6473597d706e | 285 | * |
bogdanm | 82:6473597d706e | 286 | * @param instance The FlexCAN instance number |
bogdanm | 82:6473597d706e | 287 | * @return State of FlexCAN enable(0)/disable(1) |
bogdanm | 82:6473597d706e | 288 | */ |
bogdanm | 82:6473597d706e | 289 | static inline bool flexcan_hal_is_enabled(uint8_t instance) |
bogdanm | 82:6473597d706e | 290 | { |
bogdanm | 82:6473597d706e | 291 | assert(instance < HW_CAN_INSTANCE_COUNT); |
bogdanm | 82:6473597d706e | 292 | |
bogdanm | 82:6473597d706e | 293 | return BR_CAN_MCR_MDIS(instance); |
bogdanm | 82:6473597d706e | 294 | } |
bogdanm | 82:6473597d706e | 295 | |
bogdanm | 82:6473597d706e | 296 | /*! |
bogdanm | 82:6473597d706e | 297 | * @brief Resets the FlexCAN controller. |
bogdanm | 82:6473597d706e | 298 | * |
bogdanm | 82:6473597d706e | 299 | * @param instance The FlexCAN instance number |
bogdanm | 82:6473597d706e | 300 | * @return 0 if successful; non-zero failed |
bogdanm | 82:6473597d706e | 301 | */ |
bogdanm | 82:6473597d706e | 302 | flexcan_status_t flexcan_hal_sw_reset(uint8_t instance); |
bogdanm | 82:6473597d706e | 303 | |
bogdanm | 82:6473597d706e | 304 | /*! |
bogdanm | 82:6473597d706e | 305 | * @brief Selects the clock source for FlexCAN. |
bogdanm | 82:6473597d706e | 306 | * |
bogdanm | 82:6473597d706e | 307 | * @param instance The FlexCAN instance number |
bogdanm | 82:6473597d706e | 308 | * @param clk The FlexCAN clock source |
bogdanm | 82:6473597d706e | 309 | * @return 0 if successful; non-zero failed |
bogdanm | 82:6473597d706e | 310 | */ |
bogdanm | 82:6473597d706e | 311 | flexcan_status_t flexcan_hal_select_clk(uint8_t instance, flexcan_clk_source_t clk); |
bogdanm | 82:6473597d706e | 312 | |
bogdanm | 82:6473597d706e | 313 | /*! |
bogdanm | 82:6473597d706e | 314 | * @brief Initializes the FlexCAN controller. |
bogdanm | 82:6473597d706e | 315 | * |
bogdanm | 82:6473597d706e | 316 | * @param instance The FlexCAN instance number |
bogdanm | 82:6473597d706e | 317 | * @param data The FlexCAN platform data. |
bogdanm | 82:6473597d706e | 318 | * @return 0 if successful; non-zero failed |
bogdanm | 82:6473597d706e | 319 | */ |
bogdanm | 82:6473597d706e | 320 | flexcan_status_t flexcan_hal_init(uint8_t instance, const flexcan_user_config_t *data); |
bogdanm | 82:6473597d706e | 321 | |
bogdanm | 82:6473597d706e | 322 | /*! |
bogdanm | 82:6473597d706e | 323 | * @brief Sets the FlexCAN time segments for setting up bit rate. |
bogdanm | 82:6473597d706e | 324 | * |
bogdanm | 82:6473597d706e | 325 | * @param instance The FlexCAN instance number |
bogdanm | 82:6473597d706e | 326 | * @param time_seg FlexCAN time segments, which need to be set for the bit rate. |
bogdanm | 82:6473597d706e | 327 | * @return 0 if successful; non-zero failed |
bogdanm | 82:6473597d706e | 328 | */ |
bogdanm | 82:6473597d706e | 329 | void flexcan_hal_set_time_segments(uint8_t instance, flexcan_time_segment_t *time_seg); |
bogdanm | 82:6473597d706e | 330 | |
bogdanm | 82:6473597d706e | 331 | /*! |
bogdanm | 82:6473597d706e | 332 | * @brief Gets the FlexCAN time segments to calculate the bit rate. |
bogdanm | 82:6473597d706e | 333 | * |
bogdanm | 82:6473597d706e | 334 | * @param instance The FlexCAN instance number |
bogdanm | 82:6473597d706e | 335 | * @param time_seg FlexCAN time segments read for bit rate |
bogdanm | 82:6473597d706e | 336 | * @return 0 if successful; non-zero failed |
bogdanm | 82:6473597d706e | 337 | */ |
bogdanm | 82:6473597d706e | 338 | void flexcan_hal_get_time_segments(uint8_t instance, flexcan_time_segment_t *time_seg); |
bogdanm | 82:6473597d706e | 339 | |
bogdanm | 82:6473597d706e | 340 | /*! |
bogdanm | 82:6473597d706e | 341 | * @brief Un freezes the FlexCAN module. |
bogdanm | 82:6473597d706e | 342 | * |
bogdanm | 82:6473597d706e | 343 | * @param instance The FlexCAN instance number |
bogdanm | 82:6473597d706e | 344 | * @return 0 if successful; non-zero failed. |
bogdanm | 82:6473597d706e | 345 | */ |
bogdanm | 82:6473597d706e | 346 | void flexcan_hal_exit_freeze_mode(uint8_t instance); |
bogdanm | 82:6473597d706e | 347 | |
bogdanm | 82:6473597d706e | 348 | /*! |
bogdanm | 82:6473597d706e | 349 | * @brief Freezes the FlexCAN module. |
bogdanm | 82:6473597d706e | 350 | * |
bogdanm | 82:6473597d706e | 351 | * @param instance The FlexCAN instance number |
bogdanm | 82:6473597d706e | 352 | */ |
bogdanm | 82:6473597d706e | 353 | void flexcan_hal_enter_freeze_mode(uint8_t instance); |
bogdanm | 82:6473597d706e | 354 | |
bogdanm | 82:6473597d706e | 355 | /*! |
bogdanm | 82:6473597d706e | 356 | * @brief Enables operation mode. |
bogdanm | 82:6473597d706e | 357 | * |
bogdanm | 82:6473597d706e | 358 | * @param instance The FlexCAN instance number |
bogdanm | 82:6473597d706e | 359 | * @param mode An operation mode to be enabled |
bogdanm | 82:6473597d706e | 360 | * @return 0 if successful; non-zero failed. |
bogdanm | 82:6473597d706e | 361 | */ |
bogdanm | 82:6473597d706e | 362 | flexcan_status_t flexcan_hal_enable_operation_mode( |
bogdanm | 82:6473597d706e | 363 | uint8_t instance, |
bogdanm | 82:6473597d706e | 364 | flexcan_operation_modes_t mode); |
bogdanm | 82:6473597d706e | 365 | |
bogdanm | 82:6473597d706e | 366 | /*! |
bogdanm | 82:6473597d706e | 367 | * @brief Disables operation mode. |
bogdanm | 82:6473597d706e | 368 | * |
bogdanm | 82:6473597d706e | 369 | * @param instance The FlexCAN instance number |
bogdanm | 82:6473597d706e | 370 | * @param mode An operation mode to be disabled |
bogdanm | 82:6473597d706e | 371 | * @return 0 if successful; non-zero failed. |
bogdanm | 82:6473597d706e | 372 | */ |
bogdanm | 82:6473597d706e | 373 | flexcan_status_t flexcan_hal_disable_operation_mode( |
bogdanm | 82:6473597d706e | 374 | uint8_t instance, |
bogdanm | 82:6473597d706e | 375 | flexcan_operation_modes_t mode); |
bogdanm | 82:6473597d706e | 376 | |
bogdanm | 82:6473597d706e | 377 | /*@}*/ |
bogdanm | 82:6473597d706e | 378 | |
bogdanm | 82:6473597d706e | 379 | /*! |
bogdanm | 82:6473597d706e | 380 | * @name Data transfer |
bogdanm | 82:6473597d706e | 381 | * @{ |
bogdanm | 82:6473597d706e | 382 | */ |
bogdanm | 82:6473597d706e | 383 | |
bogdanm | 82:6473597d706e | 384 | /*! |
bogdanm | 82:6473597d706e | 385 | * @brief Sets the FlexCAN message buffer fields for transmitting. |
bogdanm | 82:6473597d706e | 386 | * |
bogdanm | 82:6473597d706e | 387 | * @param instance The FlexCAN instance number |
bogdanm | 82:6473597d706e | 388 | * @param data The FlexCAN platform data |
bogdanm | 82:6473597d706e | 389 | * @param mb_idx Index of the message buffer |
bogdanm | 82:6473597d706e | 390 | * @param cs CODE/status values (TX) |
bogdanm | 82:6473597d706e | 391 | * @param msg_id ID of the message to transmit |
bogdanm | 82:6473597d706e | 392 | * @param mb_data Bytes of the FlexCAN message |
bogdanm | 82:6473597d706e | 393 | * @return 0 if successful; non-zero failed |
bogdanm | 82:6473597d706e | 394 | */ |
bogdanm | 82:6473597d706e | 395 | flexcan_status_t flexcan_hal_set_mb_tx( |
bogdanm | 82:6473597d706e | 396 | uint8_t instance, |
bogdanm | 82:6473597d706e | 397 | const flexcan_user_config_t *data, |
bogdanm | 82:6473597d706e | 398 | uint32_t mb_idx, |
bogdanm | 82:6473597d706e | 399 | flexcan_mb_code_status_tx_t *cs, |
bogdanm | 82:6473597d706e | 400 | uint32_t msg_id, |
bogdanm | 82:6473597d706e | 401 | uint8_t *mb_data); |
bogdanm | 82:6473597d706e | 402 | |
bogdanm | 82:6473597d706e | 403 | /*! |
bogdanm | 82:6473597d706e | 404 | * @brief Set the FlexCAN message buffer fields for receiving. |
bogdanm | 82:6473597d706e | 405 | * |
bogdanm | 82:6473597d706e | 406 | * @param instance The FlexCAN instance number |
bogdanm | 82:6473597d706e | 407 | * @param data The FlexCAN platform data |
bogdanm | 82:6473597d706e | 408 | * @param mb_idx Index of the message buffer |
bogdanm | 82:6473597d706e | 409 | * @param cs CODE/status values (RX) |
bogdanm | 82:6473597d706e | 410 | * @param msg_id ID of the message to receive |
bogdanm | 82:6473597d706e | 411 | * @return 0 if successful; non-zero failed |
bogdanm | 82:6473597d706e | 412 | */ |
bogdanm | 82:6473597d706e | 413 | flexcan_status_t flexcan_hal_set_mb_rx( |
bogdanm | 82:6473597d706e | 414 | uint8_t instance, |
bogdanm | 82:6473597d706e | 415 | const flexcan_user_config_t *data, |
bogdanm | 82:6473597d706e | 416 | uint32_t mb_idx, |
bogdanm | 82:6473597d706e | 417 | flexcan_mb_code_status_rx_t *cs, |
bogdanm | 82:6473597d706e | 418 | uint32_t msg_id); |
bogdanm | 82:6473597d706e | 419 | |
bogdanm | 82:6473597d706e | 420 | /*! |
bogdanm | 82:6473597d706e | 421 | * @brief Gets the FlexCAN message buffer fields. |
bogdanm | 82:6473597d706e | 422 | * |
bogdanm | 82:6473597d706e | 423 | * @param instance The FlexCAN instance number |
bogdanm | 82:6473597d706e | 424 | * @param data The FlexCAN platform data |
bogdanm | 82:6473597d706e | 425 | * @param mb_idx Index of the message buffer |
bogdanm | 82:6473597d706e | 426 | * @param mb The fields of the message buffer |
bogdanm | 82:6473597d706e | 427 | * @return 0 if successful; non-zero failed |
bogdanm | 82:6473597d706e | 428 | */ |
bogdanm | 82:6473597d706e | 429 | flexcan_status_t flexcan_hal_get_mb( |
bogdanm | 82:6473597d706e | 430 | uint8_t instance, |
bogdanm | 82:6473597d706e | 431 | const flexcan_user_config_t *data, |
bogdanm | 82:6473597d706e | 432 | uint32_t mb_idx, |
bogdanm | 82:6473597d706e | 433 | flexcan_mb_t *mb); |
bogdanm | 82:6473597d706e | 434 | |
bogdanm | 82:6473597d706e | 435 | /*! |
bogdanm | 82:6473597d706e | 436 | * @brief Locks the FlexCAN Rx message buffer. |
bogdanm | 82:6473597d706e | 437 | * |
bogdanm | 82:6473597d706e | 438 | * @param instance The FlexCAN instance number |
bogdanm | 82:6473597d706e | 439 | * @param data The FlexCAN platform data |
bogdanm | 82:6473597d706e | 440 | * @param mb_idx Index of the message buffer |
bogdanm | 82:6473597d706e | 441 | * @return 0 if successful; non-zero failed |
bogdanm | 82:6473597d706e | 442 | */ |
bogdanm | 82:6473597d706e | 443 | flexcan_status_t flexcan_hal_lock_rx_mb( |
bogdanm | 82:6473597d706e | 444 | uint8_t instance, |
bogdanm | 82:6473597d706e | 445 | const flexcan_user_config_t *data, |
bogdanm | 82:6473597d706e | 446 | uint32_t mb_idx); |
bogdanm | 82:6473597d706e | 447 | |
bogdanm | 82:6473597d706e | 448 | /*! |
bogdanm | 82:6473597d706e | 449 | * @brief Unlocks the FlexCAN Rx message buffer. |
bogdanm | 82:6473597d706e | 450 | * |
bogdanm | 82:6473597d706e | 451 | * @param instance The FlexCAN instance number |
bogdanm | 82:6473597d706e | 452 | * @return 0 if successful; non-zero failed |
bogdanm | 82:6473597d706e | 453 | */ |
bogdanm | 82:6473597d706e | 454 | static inline void flexcan_hal_unlock_rx_mb(uint8_t instance) |
bogdanm | 82:6473597d706e | 455 | { |
bogdanm | 82:6473597d706e | 456 | assert(instance < HW_CAN_INSTANCE_COUNT); |
bogdanm | 82:6473597d706e | 457 | |
bogdanm | 82:6473597d706e | 458 | /* Unlock the mailbox */ |
bogdanm | 82:6473597d706e | 459 | HW_CAN_TIMER_RD(instance); |
bogdanm | 82:6473597d706e | 460 | } |
bogdanm | 82:6473597d706e | 461 | |
bogdanm | 82:6473597d706e | 462 | /*! |
bogdanm | 82:6473597d706e | 463 | * @brief Enables the Rx FIFO. |
bogdanm | 82:6473597d706e | 464 | * |
bogdanm | 82:6473597d706e | 465 | * @param instance The FlexCAN instance number |
bogdanm | 82:6473597d706e | 466 | */ |
bogdanm | 82:6473597d706e | 467 | void flexcan_hal_enable_rx_fifo(uint8_t instance); |
bogdanm | 82:6473597d706e | 468 | |
bogdanm | 82:6473597d706e | 469 | /*! |
bogdanm | 82:6473597d706e | 470 | * @brief Disables the Rx FIFO. |
bogdanm | 82:6473597d706e | 471 | * |
bogdanm | 82:6473597d706e | 472 | * @param instance The FlexCAN instance number |
bogdanm | 82:6473597d706e | 473 | */ |
bogdanm | 82:6473597d706e | 474 | void flexcan_hal_disable_rx_fifo(uint8_t instance); |
bogdanm | 82:6473597d706e | 475 | |
bogdanm | 82:6473597d706e | 476 | /*! |
bogdanm | 82:6473597d706e | 477 | * @brief Sets the number of the Rx FIFO filters. |
bogdanm | 82:6473597d706e | 478 | * |
bogdanm | 82:6473597d706e | 479 | * @param instance The FlexCAN instance number |
bogdanm | 82:6473597d706e | 480 | * @param number The number of Rx FIFO filters |
bogdanm | 82:6473597d706e | 481 | */ |
bogdanm | 82:6473597d706e | 482 | void flexcan_hal_set_rx_fifo_filters_number(uint8_t instance, uint32_t number); |
bogdanm | 82:6473597d706e | 483 | |
bogdanm | 82:6473597d706e | 484 | /*! |
bogdanm | 82:6473597d706e | 485 | * @brief Sets the maximum number of Message Buffers. |
bogdanm | 82:6473597d706e | 486 | * |
bogdanm | 82:6473597d706e | 487 | * @param instance The FlexCAN instance number |
bogdanm | 82:6473597d706e | 488 | * @param data The FlexCAN platform data |
bogdanm | 82:6473597d706e | 489 | */ |
bogdanm | 82:6473597d706e | 490 | void flexcan_hal_set_max_mb_number( |
bogdanm | 82:6473597d706e | 491 | uint8_t instance, |
bogdanm | 82:6473597d706e | 492 | const flexcan_user_config_t *data); |
bogdanm | 82:6473597d706e | 493 | |
bogdanm | 82:6473597d706e | 494 | /*! |
bogdanm | 82:6473597d706e | 495 | * @brief Sets the Rx FIFO ID filter table elements. |
bogdanm | 82:6473597d706e | 496 | * |
bogdanm | 82:6473597d706e | 497 | * @param instance The FlexCAN instance number |
bogdanm | 82:6473597d706e | 498 | * @param data The FlexCAN platform data |
bogdanm | 82:6473597d706e | 499 | * @param id_format The format of the Rx FIFO ID Filter Table Elements |
bogdanm | 82:6473597d706e | 500 | * @param id_filter_table The ID filter table elements which contain if RTR bit, |
bogdanm | 82:6473597d706e | 501 | * IDE bit and RX message ID need to be set. |
bogdanm | 82:6473597d706e | 502 | * @return 0 if successful; non-zero failed. |
bogdanm | 82:6473597d706e | 503 | */ |
bogdanm | 82:6473597d706e | 504 | flexcan_status_t flexcan_hal_set_id_filter_table_elements( |
bogdanm | 82:6473597d706e | 505 | uint8_t instance, |
bogdanm | 82:6473597d706e | 506 | const flexcan_user_config_t *data, |
bogdanm | 82:6473597d706e | 507 | flexcan_rx_fifo_id_element_format_t id_format, |
bogdanm | 82:6473597d706e | 508 | flexcan_id_table_t *id_filter_table); |
bogdanm | 82:6473597d706e | 509 | |
bogdanm | 82:6473597d706e | 510 | /*! |
bogdanm | 82:6473597d706e | 511 | * @brief Sets the FlexCAN Rx FIFO fields. |
bogdanm | 82:6473597d706e | 512 | * |
bogdanm | 82:6473597d706e | 513 | * @param instance The FlexCAN instance number |
bogdanm | 82:6473597d706e | 514 | * @param data The FlexCAN platform data |
bogdanm | 82:6473597d706e | 515 | * @param id_format The format of the Rx FIFO ID Filter Table Elements |
bogdanm | 82:6473597d706e | 516 | * @param id_filter_table The ID filter table elements which contain RTR bit, IDE bit, |
bogdanm | 82:6473597d706e | 517 | * and RX message ID. |
bogdanm | 82:6473597d706e | 518 | * @return 0 if successful; non-zero failed. |
bogdanm | 82:6473597d706e | 519 | */ |
bogdanm | 82:6473597d706e | 520 | flexcan_status_t flexcan_hal_set_rx_fifo( |
bogdanm | 82:6473597d706e | 521 | uint8_t instance, |
bogdanm | 82:6473597d706e | 522 | const flexcan_user_config_t *data, |
bogdanm | 82:6473597d706e | 523 | flexcan_rx_fifo_id_element_format_t id_format, |
bogdanm | 82:6473597d706e | 524 | flexcan_id_table_t *id_filter_table); |
bogdanm | 82:6473597d706e | 525 | |
bogdanm | 82:6473597d706e | 526 | /*! |
bogdanm | 82:6473597d706e | 527 | * @brief Gets the FlexCAN Rx FIFO data. |
bogdanm | 82:6473597d706e | 528 | * |
bogdanm | 82:6473597d706e | 529 | * @param instance The FlexCAN instance number |
bogdanm | 82:6473597d706e | 530 | * @param rx_fifo The FlexCAN receive FIFO data |
bogdanm | 82:6473597d706e | 531 | * @return 0 if successful; non-zero failed. |
bogdanm | 82:6473597d706e | 532 | */ |
bogdanm | 82:6473597d706e | 533 | flexcan_status_t flexcan_hal_read_fifo( |
bogdanm | 82:6473597d706e | 534 | uint8_t instance, |
bogdanm | 82:6473597d706e | 535 | flexcan_mb_t *rx_fifo); |
bogdanm | 82:6473597d706e | 536 | |
bogdanm | 82:6473597d706e | 537 | /*@}*/ |
bogdanm | 82:6473597d706e | 538 | |
bogdanm | 82:6473597d706e | 539 | /*! |
bogdanm | 82:6473597d706e | 540 | * @name Interrupts |
bogdanm | 82:6473597d706e | 541 | * @{ |
bogdanm | 82:6473597d706e | 542 | */ |
bogdanm | 82:6473597d706e | 543 | |
bogdanm | 82:6473597d706e | 544 | /*! |
bogdanm | 82:6473597d706e | 545 | * @brief Enables the FlexCAN Message Buffer interrupt. |
bogdanm | 82:6473597d706e | 546 | * |
bogdanm | 82:6473597d706e | 547 | * @param instance The FlexCAN instance number |
bogdanm | 82:6473597d706e | 548 | * @param data The FlexCAN platform data |
bogdanm | 82:6473597d706e | 549 | * @param mb_idx Index of the message buffer |
bogdanm | 82:6473597d706e | 550 | * @return 0 if successful; non-zero failed |
bogdanm | 82:6473597d706e | 551 | */ |
bogdanm | 82:6473597d706e | 552 | flexcan_status_t flexcan_hal_enable_mb_interrupt( |
bogdanm | 82:6473597d706e | 553 | uint8_t instance, |
bogdanm | 82:6473597d706e | 554 | const flexcan_user_config_t *data, |
bogdanm | 82:6473597d706e | 555 | uint32_t mb_idx); |
bogdanm | 82:6473597d706e | 556 | |
bogdanm | 82:6473597d706e | 557 | /*! |
bogdanm | 82:6473597d706e | 558 | * @brief Disables the FlexCAN Message Buffer interrupt. |
bogdanm | 82:6473597d706e | 559 | * |
bogdanm | 82:6473597d706e | 560 | * @param instance The FlexCAN instance number |
bogdanm | 82:6473597d706e | 561 | * @param data The FlexCAN platform data |
bogdanm | 82:6473597d706e | 562 | * @param mb_idx Index of the message buffer |
bogdanm | 82:6473597d706e | 563 | * @return 0 if successful; non-zero failed |
bogdanm | 82:6473597d706e | 564 | */ |
bogdanm | 82:6473597d706e | 565 | flexcan_status_t flexcan_hal_disable_mb_interrupt( |
bogdanm | 82:6473597d706e | 566 | uint8_t instance, |
bogdanm | 82:6473597d706e | 567 | const flexcan_user_config_t *data, |
bogdanm | 82:6473597d706e | 568 | uint32_t mb_idx); |
bogdanm | 82:6473597d706e | 569 | |
bogdanm | 82:6473597d706e | 570 | /*! |
bogdanm | 82:6473597d706e | 571 | * @brief Enables error interrupt of the FlexCAN module. |
bogdanm | 82:6473597d706e | 572 | * @param instance The FlexCAN instance number |
bogdanm | 82:6473597d706e | 573 | */ |
bogdanm | 82:6473597d706e | 574 | void flexcan_hal_enable_error_interrupt(uint8_t instance); |
bogdanm | 82:6473597d706e | 575 | |
bogdanm | 82:6473597d706e | 576 | /*! |
bogdanm | 82:6473597d706e | 577 | * @brief Disables error interrupt of the FlexCAN module. |
bogdanm | 82:6473597d706e | 578 | * |
bogdanm | 82:6473597d706e | 579 | * @param instance The FlexCAN instance number |
bogdanm | 82:6473597d706e | 580 | */ |
bogdanm | 82:6473597d706e | 581 | void flexcan_hal_disable_error_interrupt(uint8_t instance); |
bogdanm | 82:6473597d706e | 582 | |
bogdanm | 82:6473597d706e | 583 | /*! |
bogdanm | 82:6473597d706e | 584 | * @brief Enables Bus off interrupt of the FlexCAN module. |
bogdanm | 82:6473597d706e | 585 | * |
bogdanm | 82:6473597d706e | 586 | * @param instance The FlexCAN instance number |
bogdanm | 82:6473597d706e | 587 | */ |
bogdanm | 82:6473597d706e | 588 | void flexcan_hal_enable_bus_off_interrupt(uint8_t instance); |
bogdanm | 82:6473597d706e | 589 | |
bogdanm | 82:6473597d706e | 590 | /*! |
bogdanm | 82:6473597d706e | 591 | * @brief Disables Bus off interrupt of the FlexCAN module. |
bogdanm | 82:6473597d706e | 592 | * |
bogdanm | 82:6473597d706e | 593 | * @param instance The FlexCAN instance number |
bogdanm | 82:6473597d706e | 594 | */ |
bogdanm | 82:6473597d706e | 595 | void flexcan_hal_disable_bus_off_interrupt(uint8_t instance); |
bogdanm | 82:6473597d706e | 596 | |
bogdanm | 82:6473597d706e | 597 | /*! |
bogdanm | 82:6473597d706e | 598 | * @brief Enables Wakeup interrupt of the FlexCAN module. |
bogdanm | 82:6473597d706e | 599 | * |
bogdanm | 82:6473597d706e | 600 | * @param instance The FlexCAN instance number |
bogdanm | 82:6473597d706e | 601 | */ |
bogdanm | 82:6473597d706e | 602 | void flexcan_hal_enable_wakeup_interrupt(uint8_t instance); |
bogdanm | 82:6473597d706e | 603 | |
bogdanm | 82:6473597d706e | 604 | /*! |
bogdanm | 82:6473597d706e | 605 | * @brief Disables Wakeup interrupt of the FlexCAN module. |
bogdanm | 82:6473597d706e | 606 | * |
bogdanm | 82:6473597d706e | 607 | * @param instance The FlexCAN instance number |
bogdanm | 82:6473597d706e | 608 | */ |
bogdanm | 82:6473597d706e | 609 | void flexcan_hal_disable_wakeup_interrupt(uint8_t instance); |
bogdanm | 82:6473597d706e | 610 | |
bogdanm | 82:6473597d706e | 611 | /*! |
bogdanm | 82:6473597d706e | 612 | * @brief Enables TX warning interrupt of the FlexCAN module |
bogdanm | 82:6473597d706e | 613 | * |
bogdanm | 82:6473597d706e | 614 | * @param instance The FlexCAN instance number |
bogdanm | 82:6473597d706e | 615 | */ |
bogdanm | 82:6473597d706e | 616 | void flexcan_hal_enable_tx_warning_interrupt(uint8_t instance); |
bogdanm | 82:6473597d706e | 617 | |
bogdanm | 82:6473597d706e | 618 | /*! |
bogdanm | 82:6473597d706e | 619 | * @brief Disables TX warning interrupt of the FlexCAN module. |
bogdanm | 82:6473597d706e | 620 | * |
bogdanm | 82:6473597d706e | 621 | * @param instance The FlexCAN instance number |
bogdanm | 82:6473597d706e | 622 | */ |
bogdanm | 82:6473597d706e | 623 | void flexcan_hal_disable_tx_warning_interrupt(uint8_t instance); |
bogdanm | 82:6473597d706e | 624 | |
bogdanm | 82:6473597d706e | 625 | /*! |
bogdanm | 82:6473597d706e | 626 | * @brief Enables RX warning interrupt of the FlexCAN module. |
bogdanm | 82:6473597d706e | 627 | * |
bogdanm | 82:6473597d706e | 628 | * @param instance The FlexCAN instance number |
bogdanm | 82:6473597d706e | 629 | */ |
bogdanm | 82:6473597d706e | 630 | void flexcan_hal_enable_rx_warning_interrupt(uint8_t instance); |
bogdanm | 82:6473597d706e | 631 | |
bogdanm | 82:6473597d706e | 632 | /*! |
bogdanm | 82:6473597d706e | 633 | * @brief Disables RX warning interrupt of the FlexCAN module. |
bogdanm | 82:6473597d706e | 634 | * |
bogdanm | 82:6473597d706e | 635 | * @param instance The FlexCAN instance number |
bogdanm | 82:6473597d706e | 636 | */ |
bogdanm | 82:6473597d706e | 637 | void flexcan_hal_disable_rx_warning_interrupt(uint8_t instance); |
bogdanm | 82:6473597d706e | 638 | |
bogdanm | 82:6473597d706e | 639 | /*@}*/ |
bogdanm | 82:6473597d706e | 640 | |
bogdanm | 82:6473597d706e | 641 | /*! |
bogdanm | 82:6473597d706e | 642 | * @name Status |
bogdanm | 82:6473597d706e | 643 | * @{ |
bogdanm | 82:6473597d706e | 644 | */ |
bogdanm | 82:6473597d706e | 645 | |
bogdanm | 82:6473597d706e | 646 | /*! |
bogdanm | 82:6473597d706e | 647 | * @brief Gets the value of FlexCAN freeze ACK. |
bogdanm | 82:6473597d706e | 648 | * |
bogdanm | 82:6473597d706e | 649 | * @param instance The FlexCAN instance number |
bogdanm | 82:6473597d706e | 650 | * @return freeze ACK state (1-freeze mode, 0-not in freeze mode). |
bogdanm | 82:6473597d706e | 651 | */ |
bogdanm | 82:6473597d706e | 652 | static inline uint32_t flexcan_hal_get_freeze_ack(uint8_t instance) |
bogdanm | 82:6473597d706e | 653 | { |
bogdanm | 82:6473597d706e | 654 | assert(instance < HW_CAN_INSTANCE_COUNT); |
bogdanm | 82:6473597d706e | 655 | return HW_CAN_MCR(instance).B.FRZACK; |
bogdanm | 82:6473597d706e | 656 | } |
bogdanm | 82:6473597d706e | 657 | |
bogdanm | 82:6473597d706e | 658 | /*! |
bogdanm | 82:6473597d706e | 659 | * @brief Gets the individual FlexCAN MB interrupt flag. |
bogdanm | 82:6473597d706e | 660 | * |
bogdanm | 82:6473597d706e | 661 | * @param instance The FlexCAN instance number |
bogdanm | 82:6473597d706e | 662 | * @param data The FlexCAN platform data |
bogdanm | 82:6473597d706e | 663 | * @param mb_idx Index of the message buffer |
bogdanm | 82:6473597d706e | 664 | * @return the individual MB interrupt flag (0 and 1 are the flag value) |
bogdanm | 82:6473597d706e | 665 | */ |
bogdanm | 82:6473597d706e | 666 | uint8_t flexcan_hal_get_mb_int_flag( |
bogdanm | 82:6473597d706e | 667 | uint8_t instance, |
bogdanm | 82:6473597d706e | 668 | const flexcan_user_config_t *data, |
bogdanm | 82:6473597d706e | 669 | uint32_t mb_idx); |
bogdanm | 82:6473597d706e | 670 | |
bogdanm | 82:6473597d706e | 671 | /*! |
bogdanm | 82:6473597d706e | 672 | * @brief Gets all FlexCAN MB interrupt flags. |
bogdanm | 82:6473597d706e | 673 | * |
bogdanm | 82:6473597d706e | 674 | * @param instance The FlexCAN instance number |
bogdanm | 82:6473597d706e | 675 | * @return all MB interrupt flags |
bogdanm | 82:6473597d706e | 676 | */ |
bogdanm | 82:6473597d706e | 677 | static inline uint32_t flexcan_hal_get_all_mb_int_flags(uint8_t instance) |
bogdanm | 82:6473597d706e | 678 | { |
bogdanm | 82:6473597d706e | 679 | assert(instance < HW_CAN_INSTANCE_COUNT); |
bogdanm | 82:6473597d706e | 680 | return HW_CAN_IFLAG1_RD(instance); |
bogdanm | 82:6473597d706e | 681 | } |
bogdanm | 82:6473597d706e | 682 | |
bogdanm | 82:6473597d706e | 683 | /*! |
bogdanm | 82:6473597d706e | 684 | * @brief Clears the interrupt flag of the message buffers. |
bogdanm | 82:6473597d706e | 685 | * |
bogdanm | 82:6473597d706e | 686 | * @param instance The FlexCAN instance number |
bogdanm | 82:6473597d706e | 687 | * @param reg_val The value to be written to the interrupt flag1 register. |
bogdanm | 82:6473597d706e | 688 | */ |
bogdanm | 82:6473597d706e | 689 | /* See fsl_flexcan_hal.h for documentation of this function.*/ |
bogdanm | 82:6473597d706e | 690 | static inline void flexcan_hal_clear_mb_int_flag( |
bogdanm | 82:6473597d706e | 691 | uint8_t instance, |
bogdanm | 82:6473597d706e | 692 | uint32_t reg_val) |
bogdanm | 82:6473597d706e | 693 | { |
bogdanm | 82:6473597d706e | 694 | assert(instance < HW_CAN_INSTANCE_COUNT); |
bogdanm | 82:6473597d706e | 695 | |
bogdanm | 82:6473597d706e | 696 | /* Clear the corresponding message buffer interrupt flag*/ |
bogdanm | 82:6473597d706e | 697 | HW_CAN_IFLAG1_SET(instance, reg_val); |
bogdanm | 82:6473597d706e | 698 | } |
bogdanm | 82:6473597d706e | 699 | |
bogdanm | 82:6473597d706e | 700 | /*! |
bogdanm | 82:6473597d706e | 701 | * @brief Gets the transmit error counter and receives the error counter. |
bogdanm | 82:6473597d706e | 702 | * |
bogdanm | 82:6473597d706e | 703 | * @param instance The FlexCAN instance number |
bogdanm | 82:6473597d706e | 704 | * @param err_cnt Transmit error counter and receive error counter |
bogdanm | 82:6473597d706e | 705 | */ |
bogdanm | 82:6473597d706e | 706 | void flexcan_hal_get_err_counter( |
bogdanm | 82:6473597d706e | 707 | uint8_t instance, |
bogdanm | 82:6473597d706e | 708 | flexcan_berr_counter_t *err_cnt); |
bogdanm | 82:6473597d706e | 709 | |
bogdanm | 82:6473597d706e | 710 | /*! |
bogdanm | 82:6473597d706e | 711 | * @brief Gets error and status. |
bogdanm | 82:6473597d706e | 712 | * |
bogdanm | 82:6473597d706e | 713 | * @param instance The FlexCAN instance number |
bogdanm | 82:6473597d706e | 714 | * @return The current error and status |
bogdanm | 82:6473597d706e | 715 | */ |
bogdanm | 82:6473597d706e | 716 | static inline uint32_t flexcan_hal_get_err_status(uint8_t instance) |
bogdanm | 82:6473597d706e | 717 | { |
bogdanm | 82:6473597d706e | 718 | assert(instance < HW_CAN_INSTANCE_COUNT); |
bogdanm | 82:6473597d706e | 719 | return HW_CAN_ESR1_RD(instance); |
bogdanm | 82:6473597d706e | 720 | } |
bogdanm | 82:6473597d706e | 721 | |
bogdanm | 82:6473597d706e | 722 | /*! |
bogdanm | 82:6473597d706e | 723 | * @brief Clears all other interrupts in ERRSTAT register (Error, Busoff, Wakeup). |
bogdanm | 82:6473597d706e | 724 | * |
bogdanm | 82:6473597d706e | 725 | * @param instance The FlexCAN instance number |
bogdanm | 82:6473597d706e | 726 | */ |
bogdanm | 82:6473597d706e | 727 | void flexcan_hal_clear_err_interrupt_status(uint8_t instance); |
bogdanm | 82:6473597d706e | 728 | |
bogdanm | 82:6473597d706e | 729 | /*@}*/ |
bogdanm | 82:6473597d706e | 730 | |
bogdanm | 82:6473597d706e | 731 | /*! |
bogdanm | 82:6473597d706e | 732 | * @name Mask |
bogdanm | 82:6473597d706e | 733 | * @{ |
bogdanm | 82:6473597d706e | 734 | */ |
bogdanm | 82:6473597d706e | 735 | |
bogdanm | 82:6473597d706e | 736 | /*! |
bogdanm | 82:6473597d706e | 737 | * @brief Sets the Rx masking type. |
bogdanm | 82:6473597d706e | 738 | * |
bogdanm | 82:6473597d706e | 739 | * @param instance The FlexCAN instance number |
bogdanm | 82:6473597d706e | 740 | * @param type The FlexCAN Rx mask type |
bogdanm | 82:6473597d706e | 741 | */ |
bogdanm | 82:6473597d706e | 742 | void flexcan_hal_set_mask_type(uint8_t instance, flexcan_rx_mask_type_t type); |
bogdanm | 82:6473597d706e | 743 | |
bogdanm | 82:6473597d706e | 744 | /*! |
bogdanm | 82:6473597d706e | 745 | * @brief Sets the FlexCAN RX FIFO global standard mask. |
bogdanm | 82:6473597d706e | 746 | * |
bogdanm | 82:6473597d706e | 747 | * @param instance The FlexCAN instance number |
bogdanm | 82:6473597d706e | 748 | * @param std_mask Standard mask |
bogdanm | 82:6473597d706e | 749 | */ |
bogdanm | 82:6473597d706e | 750 | void flexcan_hal_set_rx_fifo_global_std_mask( |
bogdanm | 82:6473597d706e | 751 | uint8_t instance, |
bogdanm | 82:6473597d706e | 752 | uint32_t std_mask); |
bogdanm | 82:6473597d706e | 753 | |
bogdanm | 82:6473597d706e | 754 | /*! |
bogdanm | 82:6473597d706e | 755 | * @brief Sets the FlexCAN Rx FIFO global extended mask. |
bogdanm | 82:6473597d706e | 756 | * |
bogdanm | 82:6473597d706e | 757 | * @param instance The FlexCAN instance number |
bogdanm | 82:6473597d706e | 758 | * @param ext_mask Extended mask |
bogdanm | 82:6473597d706e | 759 | */ |
bogdanm | 82:6473597d706e | 760 | void flexcan_hal_set_rx_fifo_global_ext_mask( |
bogdanm | 82:6473597d706e | 761 | uint8_t instance, |
bogdanm | 82:6473597d706e | 762 | uint32_t ext_mask); |
bogdanm | 82:6473597d706e | 763 | |
bogdanm | 82:6473597d706e | 764 | /*! |
bogdanm | 82:6473597d706e | 765 | * @brief Sets the FlexCAN Rx individual standard mask for ID filtering in the Rx MBs and the Rx FIFO. |
bogdanm | 82:6473597d706e | 766 | * |
bogdanm | 82:6473597d706e | 767 | * @param instance The FlexCAN instance number |
bogdanm | 82:6473597d706e | 768 | * @param data The FlexCAN platform data |
bogdanm | 82:6473597d706e | 769 | * @param mb_idx Index of the message buffer |
bogdanm | 82:6473597d706e | 770 | * @param std_mask Individual standard mask |
bogdanm | 82:6473597d706e | 771 | * @return 0 if successful; non-zero failed |
bogdanm | 82:6473597d706e | 772 | */ |
bogdanm | 82:6473597d706e | 773 | flexcan_status_t flexcan_hal_set_rx_individual_std_mask( |
bogdanm | 82:6473597d706e | 774 | uint8_t instance, |
bogdanm | 82:6473597d706e | 775 | const flexcan_user_config_t * data, |
bogdanm | 82:6473597d706e | 776 | uint32_t mb_idx, |
bogdanm | 82:6473597d706e | 777 | uint32_t std_mask); |
bogdanm | 82:6473597d706e | 778 | |
bogdanm | 82:6473597d706e | 779 | /*! |
bogdanm | 82:6473597d706e | 780 | * @brief Sets the FlexCAN Rx individual extended mask for ID filtering in the Rx MBs and the Rx FIFO. |
bogdanm | 82:6473597d706e | 781 | * |
bogdanm | 82:6473597d706e | 782 | * @param instance The FlexCAN instance number |
bogdanm | 82:6473597d706e | 783 | * @param data The FlexCAN platform data |
bogdanm | 82:6473597d706e | 784 | * @param mb_idx Index of the message buffer |
bogdanm | 82:6473597d706e | 785 | * @param ext_mask Individual extended mask |
bogdanm | 82:6473597d706e | 786 | * @return 0 if successful; non-zero failed |
bogdanm | 82:6473597d706e | 787 | */ |
bogdanm | 82:6473597d706e | 788 | flexcan_status_t flexcan_hal_set_rx_individual_ext_mask( |
bogdanm | 82:6473597d706e | 789 | uint8_t instance, |
bogdanm | 82:6473597d706e | 790 | const flexcan_user_config_t * data, |
bogdanm | 82:6473597d706e | 791 | uint32_t mb_idx, |
bogdanm | 82:6473597d706e | 792 | uint32_t ext_mask); |
bogdanm | 82:6473597d706e | 793 | |
bogdanm | 82:6473597d706e | 794 | /*! |
bogdanm | 82:6473597d706e | 795 | * @brief Sets the FlexCAN Rx MB global standard mask. |
bogdanm | 82:6473597d706e | 796 | * |
bogdanm | 82:6473597d706e | 797 | * @param instance The FlexCAN instance number |
bogdanm | 82:6473597d706e | 798 | * @param std_mask Standard mask |
bogdanm | 82:6473597d706e | 799 | */ |
bogdanm | 82:6473597d706e | 800 | void flexcan_hal_set_rx_mb_global_std_mask( |
bogdanm | 82:6473597d706e | 801 | uint8_t instance, |
bogdanm | 82:6473597d706e | 802 | uint32_t std_mask); |
bogdanm | 82:6473597d706e | 803 | |
bogdanm | 82:6473597d706e | 804 | /*! |
bogdanm | 82:6473597d706e | 805 | * @brief Sets the FlexCAN RX MB BUF14 standard mask. |
bogdanm | 82:6473597d706e | 806 | * |
bogdanm | 82:6473597d706e | 807 | * @param instance The FlexCAN instance number |
bogdanm | 82:6473597d706e | 808 | * @param std_mask Standard mask |
bogdanm | 82:6473597d706e | 809 | */ |
bogdanm | 82:6473597d706e | 810 | void flexcan_hal_set_rx_mb_buf14_std_mask( |
bogdanm | 82:6473597d706e | 811 | uint8_t instance, |
bogdanm | 82:6473597d706e | 812 | uint32_t std_mask); |
bogdanm | 82:6473597d706e | 813 | |
bogdanm | 82:6473597d706e | 814 | /*! |
bogdanm | 82:6473597d706e | 815 | * @brief Sets the FlexCAN Rx MB BUF15 standard mask. |
bogdanm | 82:6473597d706e | 816 | * |
bogdanm | 82:6473597d706e | 817 | * @param instance The FlexCAN instance number |
bogdanm | 82:6473597d706e | 818 | * @param std_mask Standard mask |
bogdanm | 82:6473597d706e | 819 | * @return 0 if successful; non-zero failed |
bogdanm | 82:6473597d706e | 820 | */ |
bogdanm | 82:6473597d706e | 821 | void flexcan_hal_set_rx_mb_buf15_std_mask( |
bogdanm | 82:6473597d706e | 822 | uint8_t instance, |
bogdanm | 82:6473597d706e | 823 | uint32_t std_mask); |
bogdanm | 82:6473597d706e | 824 | |
bogdanm | 82:6473597d706e | 825 | /*! |
bogdanm | 82:6473597d706e | 826 | * @brief Sets the FlexCAN RX MB global extended mask. |
bogdanm | 82:6473597d706e | 827 | * |
bogdanm | 82:6473597d706e | 828 | * @param instance The FlexCAN instance number |
bogdanm | 82:6473597d706e | 829 | * @param ext_mask Extended mask |
bogdanm | 82:6473597d706e | 830 | */ |
bogdanm | 82:6473597d706e | 831 | void flexcan_hal_set_rx_mb_global_ext_mask( |
bogdanm | 82:6473597d706e | 832 | uint8_t instance, |
bogdanm | 82:6473597d706e | 833 | uint32_t ext_mask); |
bogdanm | 82:6473597d706e | 834 | |
bogdanm | 82:6473597d706e | 835 | /*! |
bogdanm | 82:6473597d706e | 836 | * @brief Sets the FlexCAN RX MB BUF14 extended mask. |
bogdanm | 82:6473597d706e | 837 | * |
bogdanm | 82:6473597d706e | 838 | * @param instance The FlexCAN instance number |
bogdanm | 82:6473597d706e | 839 | * @param ext_mask Extended mask |
bogdanm | 82:6473597d706e | 840 | */ |
bogdanm | 82:6473597d706e | 841 | void flexcan_hal_set_rx_mb_buf14_ext_mask( |
bogdanm | 82:6473597d706e | 842 | uint8_t instance, |
bogdanm | 82:6473597d706e | 843 | uint32_t ext_mask); |
bogdanm | 82:6473597d706e | 844 | |
bogdanm | 82:6473597d706e | 845 | /*! |
bogdanm | 82:6473597d706e | 846 | * @brief Sets the FlexCAN RX MB BUF15 extended mask. |
bogdanm | 82:6473597d706e | 847 | * |
bogdanm | 82:6473597d706e | 848 | * @param instance The FlexCAN instance number |
bogdanm | 82:6473597d706e | 849 | * @param ext_mask Extended mask |
bogdanm | 82:6473597d706e | 850 | */ |
bogdanm | 82:6473597d706e | 851 | void flexcan_hal_set_rx_mb_buf15_ext_mask( |
bogdanm | 82:6473597d706e | 852 | uint8_t instance, |
bogdanm | 82:6473597d706e | 853 | uint32_t ext_mask); |
bogdanm | 82:6473597d706e | 854 | |
bogdanm | 82:6473597d706e | 855 | /*! |
bogdanm | 82:6473597d706e | 856 | * @brief Gets the FlexCAN ID acceptance filter hit indicator on Rx FIFO. |
bogdanm | 82:6473597d706e | 857 | * |
bogdanm | 82:6473597d706e | 858 | * @param instance The FlexCAN instance number |
bogdanm | 82:6473597d706e | 859 | * @return RX FIFO information |
bogdanm | 82:6473597d706e | 860 | */ |
bogdanm | 82:6473597d706e | 861 | static inline uint32_t flexcan_hal_get_rx_fifo_id_acceptance_filter(uint8_t instance) |
bogdanm | 82:6473597d706e | 862 | { |
bogdanm | 82:6473597d706e | 863 | assert(instance < HW_CAN_INSTANCE_COUNT); |
bogdanm | 82:6473597d706e | 864 | return BR_CAN_RXFIR_IDHIT(instance); |
bogdanm | 82:6473597d706e | 865 | } |
bogdanm | 82:6473597d706e | 866 | |
bogdanm | 82:6473597d706e | 867 | /*@}*/ |
bogdanm | 82:6473597d706e | 868 | |
bogdanm | 82:6473597d706e | 869 | #if defined(__cplusplus) |
bogdanm | 82:6473597d706e | 870 | } |
bogdanm | 82:6473597d706e | 871 | #endif |
bogdanm | 82:6473597d706e | 872 | |
bogdanm | 82:6473597d706e | 873 | /*! @}*/ |
bogdanm | 82:6473597d706e | 874 | |
bogdanm | 82:6473597d706e | 875 | #endif /* __FSL_FLEXCAN_HAL_H__*/ |
bogdanm | 82:6473597d706e | 876 | |
bogdanm | 82:6473597d706e | 877 | /******************************************************************************* |
bogdanm | 82:6473597d706e | 878 | * EOF |
bogdanm | 82:6473597d706e | 879 | ******************************************************************************/ |
bogdanm | 82:6473597d706e | 880 |