The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.
Dependents: hello SerialTestv11 SerialTestv12 Sierpinski ... more
mbed 2
This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.
TARGET_KL82Z/TOOLCHAIN_IAR/fsl_flexio.h@172:65be27845400, 2019-02-20 (annotated)
- Committer:
- AnnaBridge
- Date:
- Wed Feb 20 20:53:29 2019 +0000
- Revision:
- 172:65be27845400
- Parent:
- 171:3a7713b1edbc
mbed library release version 165
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
AnnaBridge | 145:64910690c574 | 1 | /* |
AnnaBridge | 145:64910690c574 | 2 | * Copyright (c) 2015, Freescale Semiconductor, Inc. |
AnnaBridge | 145:64910690c574 | 3 | * All rights reserved. |
AnnaBridge | 145:64910690c574 | 4 | * |
AnnaBridge | 145:64910690c574 | 5 | * Redistribution and use in source and binary forms, with or without modification, |
AnnaBridge | 145:64910690c574 | 6 | * are permitted provided that the following conditions are met: |
AnnaBridge | 145:64910690c574 | 7 | * |
AnnaBridge | 145:64910690c574 | 8 | * o Redistributions of source code must retain the above copyright notice, this list |
AnnaBridge | 145:64910690c574 | 9 | * of conditions and the following disclaimer. |
AnnaBridge | 145:64910690c574 | 10 | * |
AnnaBridge | 145:64910690c574 | 11 | * o Redistributions in binary form must reproduce the above copyright notice, this |
AnnaBridge | 145:64910690c574 | 12 | * list of conditions and the following disclaimer in the documentation and/or |
AnnaBridge | 145:64910690c574 | 13 | * other materials provided with the distribution. |
AnnaBridge | 145:64910690c574 | 14 | * |
AnnaBridge | 145:64910690c574 | 15 | * o Neither the name of Freescale Semiconductor, Inc. nor the names of its |
AnnaBridge | 145:64910690c574 | 16 | * contributors may be used to endorse or promote products derived from this |
AnnaBridge | 145:64910690c574 | 17 | * software without specific prior written permission. |
AnnaBridge | 145:64910690c574 | 18 | * |
AnnaBridge | 145:64910690c574 | 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
AnnaBridge | 145:64910690c574 | 20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
AnnaBridge | 145:64910690c574 | 21 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
AnnaBridge | 145:64910690c574 | 22 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR |
AnnaBridge | 145:64910690c574 | 23 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
AnnaBridge | 145:64910690c574 | 24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
AnnaBridge | 145:64910690c574 | 25 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON |
AnnaBridge | 145:64910690c574 | 26 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
AnnaBridge | 145:64910690c574 | 27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
AnnaBridge | 145:64910690c574 | 28 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
AnnaBridge | 145:64910690c574 | 29 | */ |
AnnaBridge | 145:64910690c574 | 30 | #ifndef _FSL_FLEXIO_H_ |
AnnaBridge | 145:64910690c574 | 31 | #define _FSL_FLEXIO_H_ |
AnnaBridge | 145:64910690c574 | 32 | |
AnnaBridge | 145:64910690c574 | 33 | #include "fsl_common.h" |
AnnaBridge | 145:64910690c574 | 34 | |
AnnaBridge | 145:64910690c574 | 35 | /*! |
AnnaBridge | 145:64910690c574 | 36 | * @addtogroup flexio_driver |
AnnaBridge | 145:64910690c574 | 37 | * @{ |
AnnaBridge | 145:64910690c574 | 38 | */ |
AnnaBridge | 145:64910690c574 | 39 | |
AnnaBridge | 145:64910690c574 | 40 | |
AnnaBridge | 145:64910690c574 | 41 | /******************************************************************************* |
AnnaBridge | 145:64910690c574 | 42 | * Definitions |
AnnaBridge | 145:64910690c574 | 43 | ******************************************************************************/ |
AnnaBridge | 145:64910690c574 | 44 | |
AnnaBridge | 145:64910690c574 | 45 | /*! @name Driver version */ |
AnnaBridge | 145:64910690c574 | 46 | /*@{*/ |
AnnaBridge | 145:64910690c574 | 47 | /*! @brief FlexIO driver version 2.0.0. */ |
AnnaBridge | 145:64910690c574 | 48 | #define FSL_FLEXIO_DRIVER_VERSION (MAKE_VERSION(2, 0, 0)) |
AnnaBridge | 145:64910690c574 | 49 | /*@}*/ |
AnnaBridge | 145:64910690c574 | 50 | |
AnnaBridge | 145:64910690c574 | 51 | /*! @brief Calculate FlexIO timer trigger.*/ |
AnnaBridge | 145:64910690c574 | 52 | #define FLEXIO_TIMER_TRIGGER_SEL_PININPUT(x) ((uint32_t)(x) << 1U) |
AnnaBridge | 145:64910690c574 | 53 | #define FLEXIO_TIMER_TRIGGER_SEL_SHIFTnSTAT(x) (((uint32_t)(x) << 2U) | 0x1U) |
AnnaBridge | 145:64910690c574 | 54 | #define FLEXIO_TIMER_TRIGGER_SEL_TIMn(x) (((uint32_t)(x) << 2U) | 0x3U) |
AnnaBridge | 145:64910690c574 | 55 | |
AnnaBridge | 145:64910690c574 | 56 | /*! @brief Define time of timer trigger polarity.*/ |
AnnaBridge | 145:64910690c574 | 57 | typedef enum _flexio_timer_trigger_polarity |
AnnaBridge | 145:64910690c574 | 58 | { |
AnnaBridge | 145:64910690c574 | 59 | kFLEXIO_TimerTriggerPolarityActiveHigh = 0x0U, /*!< Active high. */ |
AnnaBridge | 145:64910690c574 | 60 | kFLEXIO_TimerTriggerPolarityActiveLow = 0x1U, /*!< Active low. */ |
AnnaBridge | 145:64910690c574 | 61 | } flexio_timer_trigger_polarity_t; |
AnnaBridge | 145:64910690c574 | 62 | |
AnnaBridge | 145:64910690c574 | 63 | /*! @brief Define type of timer trigger source.*/ |
AnnaBridge | 145:64910690c574 | 64 | typedef enum _flexio_timer_trigger_source |
AnnaBridge | 145:64910690c574 | 65 | { |
AnnaBridge | 145:64910690c574 | 66 | kFLEXIO_TimerTriggerSourceExternal = 0x0U, /*!< External trigger selected. */ |
AnnaBridge | 145:64910690c574 | 67 | kFLEXIO_TimerTriggerSourceInternal = 0x1U, /*!< Internal trigger selected. */ |
AnnaBridge | 145:64910690c574 | 68 | } flexio_timer_trigger_source_t; |
AnnaBridge | 145:64910690c574 | 69 | |
AnnaBridge | 145:64910690c574 | 70 | /*! @brief Define type of timer/shifter pin configuration.*/ |
AnnaBridge | 145:64910690c574 | 71 | typedef enum _flexio_pin_config |
AnnaBridge | 145:64910690c574 | 72 | { |
AnnaBridge | 145:64910690c574 | 73 | kFLEXIO_PinConfigOutputDisabled = 0x0U, /*!< Pin output disabled. */ |
AnnaBridge | 145:64910690c574 | 74 | kFLEXIO_PinConfigOpenDrainOrBidirection = 0x1U, /*!< Pin open drain or bidirectional output enable. */ |
AnnaBridge | 145:64910690c574 | 75 | kFLEXIO_PinConfigBidirectionOutputData = 0x2U, /*!< Pin bidirectional output data. */ |
AnnaBridge | 145:64910690c574 | 76 | kFLEXIO_PinConfigOutput = 0x3U, /*!< Pin output. */ |
AnnaBridge | 145:64910690c574 | 77 | } flexio_pin_config_t; |
AnnaBridge | 145:64910690c574 | 78 | |
AnnaBridge | 145:64910690c574 | 79 | /*! @brief Definition of pin polarity.*/ |
AnnaBridge | 145:64910690c574 | 80 | typedef enum _flexio_pin_polarity |
AnnaBridge | 145:64910690c574 | 81 | { |
AnnaBridge | 145:64910690c574 | 82 | kFLEXIO_PinActiveHigh = 0x0U, /*!< Active high. */ |
AnnaBridge | 145:64910690c574 | 83 | kFLEXIO_PinActiveLow = 0x1U, /*!< Active low. */ |
AnnaBridge | 145:64910690c574 | 84 | } flexio_pin_polarity_t; |
AnnaBridge | 145:64910690c574 | 85 | |
AnnaBridge | 145:64910690c574 | 86 | /*! @brief Define type of timer work mode.*/ |
AnnaBridge | 145:64910690c574 | 87 | typedef enum _flexio_timer_mode |
AnnaBridge | 145:64910690c574 | 88 | { |
AnnaBridge | 145:64910690c574 | 89 | kFLEXIO_TimerModeDisabled = 0x0U, /*!< Timer Disabled. */ |
AnnaBridge | 145:64910690c574 | 90 | kFLEXIO_TimerModeDual8BitBaudBit = 0x1U, /*!< Dual 8-bit counters baud/bit mode. */ |
AnnaBridge | 145:64910690c574 | 91 | kFLEXIO_TimerModeDual8BitPWM = 0x2U, /*!< Dual 8-bit counters PWM mode. */ |
AnnaBridge | 145:64910690c574 | 92 | kFLEXIO_TimerModeSingle16Bit = 0x3U, /*!< Single 16-bit counter mode. */ |
AnnaBridge | 145:64910690c574 | 93 | } flexio_timer_mode_t; |
AnnaBridge | 145:64910690c574 | 94 | |
AnnaBridge | 145:64910690c574 | 95 | /*! @brief Define type of timer initial output or timer reset condition.*/ |
AnnaBridge | 145:64910690c574 | 96 | typedef enum _flexio_timer_output |
AnnaBridge | 145:64910690c574 | 97 | { |
AnnaBridge | 145:64910690c574 | 98 | kFLEXIO_TimerOutputOneNotAffectedByReset = 0x0U, /*!< Logic one when enabled and is not affected by timer |
AnnaBridge | 145:64910690c574 | 99 | reset. */ |
AnnaBridge | 145:64910690c574 | 100 | kFLEXIO_TimerOutputZeroNotAffectedByReset = 0x1U, /*!< Logic zero when enabled and is not affected by timer |
AnnaBridge | 145:64910690c574 | 101 | reset. */ |
AnnaBridge | 145:64910690c574 | 102 | kFLEXIO_TimerOutputOneAffectedByReset = 0x2U, /*!< Logic one when enabled and on timer reset. */ |
AnnaBridge | 145:64910690c574 | 103 | kFLEXIO_TimerOutputZeroAffectedByReset = 0x3U, /*!< Logic zero when enabled and on timer reset. */ |
AnnaBridge | 145:64910690c574 | 104 | } flexio_timer_output_t; |
AnnaBridge | 145:64910690c574 | 105 | |
AnnaBridge | 145:64910690c574 | 106 | /*! @brief Define type of timer decrement.*/ |
AnnaBridge | 145:64910690c574 | 107 | typedef enum _flexio_timer_decrement_source |
AnnaBridge | 145:64910690c574 | 108 | { |
AnnaBridge | 145:64910690c574 | 109 | kFLEXIO_TimerDecSrcOnFlexIOClockShiftTimerOutput = 0x0U, /*!< Decrement counter on FlexIO clock, Shift clock |
AnnaBridge | 145:64910690c574 | 110 | equals Timer output. */ |
AnnaBridge | 145:64910690c574 | 111 | kFLEXIO_TimerDecSrcOnTriggerInputShiftTimerOutput = 0x1U, /*!< Decrement counter on Trigger input (both edges), |
AnnaBridge | 145:64910690c574 | 112 | Shift clock equals Timer output. */ |
AnnaBridge | 145:64910690c574 | 113 | kFLEXIO_TimerDecSrcOnPinInputShiftPinInput = 0x2U, /*!< Decrement counter on Pin input (both edges), |
AnnaBridge | 145:64910690c574 | 114 | Shift clock equals Pin input. */ |
AnnaBridge | 145:64910690c574 | 115 | kFLEXIO_TimerDecSrcOnTriggerInputShiftTriggerInput = 0x3U, /*!< Decrement counter on Trigger input (both edges), |
AnnaBridge | 145:64910690c574 | 116 | Shift clock equals Trigger input. */ |
AnnaBridge | 145:64910690c574 | 117 | } flexio_timer_decrement_source_t; |
AnnaBridge | 145:64910690c574 | 118 | |
AnnaBridge | 145:64910690c574 | 119 | /*! @brief Define type of timer reset condition.*/ |
AnnaBridge | 145:64910690c574 | 120 | typedef enum _flexio_timer_reset_condition |
AnnaBridge | 145:64910690c574 | 121 | { |
AnnaBridge | 145:64910690c574 | 122 | kFLEXIO_TimerResetNever = 0x0U, /*!< Timer never reset. */ |
AnnaBridge | 145:64910690c574 | 123 | kFLEXIO_TimerResetOnTimerPinEqualToTimerOutput = 0x2U, /*!< Timer reset on Timer Pin equal to Timer Output. */ |
AnnaBridge | 145:64910690c574 | 124 | kFLEXIO_TimerResetOnTimerTriggerEqualToTimerOutput = 0x3U, /*!< Timer reset on Timer Trigger equal to |
AnnaBridge | 145:64910690c574 | 125 | Timer Output. */ |
AnnaBridge | 145:64910690c574 | 126 | kFLEXIO_TimerResetOnTimerPinRisingEdge = 0x4U, /*!< Timer reset on Timer Pin rising edge. */ |
AnnaBridge | 145:64910690c574 | 127 | kFLEXIO_TimerResetOnTimerTriggerRisingEdge = 0x6U, /*!< Timer reset on Trigger rising edge. */ |
AnnaBridge | 145:64910690c574 | 128 | kFLEXIO_TimerResetOnTimerTriggerBothEdge = 0x7U, /*!< Timer reset on Trigger rising or falling edge. */ |
AnnaBridge | 145:64910690c574 | 129 | } flexio_timer_reset_condition_t; |
AnnaBridge | 145:64910690c574 | 130 | |
AnnaBridge | 145:64910690c574 | 131 | /*! @brief Define type of timer disable condition.*/ |
AnnaBridge | 145:64910690c574 | 132 | typedef enum _flexio_timer_disable_condition |
AnnaBridge | 145:64910690c574 | 133 | { |
AnnaBridge | 145:64910690c574 | 134 | kFLEXIO_TimerDisableNever = 0x0U, /*!< Timer never disabled. */ |
AnnaBridge | 145:64910690c574 | 135 | kFLEXIO_TimerDisableOnPreTimerDisable = 0x1U, /*!< Timer disabled on Timer N-1 disable. */ |
AnnaBridge | 145:64910690c574 | 136 | kFLEXIO_TimerDisableOnTimerCompare = 0x2U, /*!< Timer disabled on Timer compare. */ |
AnnaBridge | 145:64910690c574 | 137 | kFLEXIO_TimerDisableOnTimerCompareTriggerLow = 0x3U, /*!< Timer disabled on Timer compare and Trigger Low. */ |
AnnaBridge | 145:64910690c574 | 138 | kFLEXIO_TimerDisableOnPinBothEdge = 0x4U, /*!< Timer disabled on Pin rising or falling edge. */ |
AnnaBridge | 145:64910690c574 | 139 | kFLEXIO_TimerDisableOnPinBothEdgeTriggerHigh = 0x5U, /*!< Timer disabled on Pin rising or falling edge provided |
AnnaBridge | 145:64910690c574 | 140 | Trigger is high. */ |
AnnaBridge | 145:64910690c574 | 141 | kFLEXIO_TimerDisableOnTriggerFallingEdge = 0x6U, /*!< Timer disabled on Trigger falling edge. */ |
AnnaBridge | 145:64910690c574 | 142 | } flexio_timer_disable_condition_t; |
AnnaBridge | 145:64910690c574 | 143 | |
AnnaBridge | 145:64910690c574 | 144 | /*! @brief Define type of timer enable condition.*/ |
AnnaBridge | 145:64910690c574 | 145 | typedef enum _flexio_timer_enable_condition |
AnnaBridge | 145:64910690c574 | 146 | { |
AnnaBridge | 145:64910690c574 | 147 | kFLEXIO_TimerEnabledAlways = 0x0U, /*!< Timer always enabled. */ |
AnnaBridge | 145:64910690c574 | 148 | kFLEXIO_TimerEnableOnPrevTimerEnable = 0x1U, /*!< Timer enabled on Timer N-1 enable. */ |
AnnaBridge | 145:64910690c574 | 149 | kFLEXIO_TimerEnableOnTriggerHigh = 0x2U, /*!< Timer enabled on Trigger high. */ |
AnnaBridge | 145:64910690c574 | 150 | kFLEXIO_TimerEnableOnTriggerHighPinHigh = 0x3U, /*!< Timer enabled on Trigger high and Pin high. */ |
AnnaBridge | 145:64910690c574 | 151 | kFLEXIO_TimerEnableOnPinRisingEdge = 0x4U, /*!< Timer enabled on Pin rising edge. */ |
AnnaBridge | 145:64910690c574 | 152 | kFLEXIO_TimerEnableOnPinRisingEdgeTriggerHigh = 0x5U, /*!< Timer enabled on Pin rising edge and Trigger high. */ |
AnnaBridge | 145:64910690c574 | 153 | kFLEXIO_TimerEnableOnTriggerRisingEdge = 0x6U, /*!< Timer enabled on Trigger rising edge. */ |
AnnaBridge | 145:64910690c574 | 154 | kFLEXIO_TimerEnableOnTriggerBothEdge = 0x7U, /*!< Timer enabled on Trigger rising or falling edge. */ |
AnnaBridge | 145:64910690c574 | 155 | } flexio_timer_enable_condition_t; |
AnnaBridge | 145:64910690c574 | 156 | |
AnnaBridge | 145:64910690c574 | 157 | /*! @brief Define type of timer stop bit generate condition.*/ |
AnnaBridge | 145:64910690c574 | 158 | typedef enum _flexio_timer_stop_bit_condition |
AnnaBridge | 145:64910690c574 | 159 | { |
AnnaBridge | 145:64910690c574 | 160 | kFLEXIO_TimerStopBitDisabled = 0x0U, /*!< Stop bit disabled. */ |
AnnaBridge | 145:64910690c574 | 161 | kFLEXIO_TimerStopBitEnableOnTimerCompare = 0x1U, /*!< Stop bit is enabled on timer compare. */ |
AnnaBridge | 145:64910690c574 | 162 | kFLEXIO_TimerStopBitEnableOnTimerDisable = 0x2U, /*!< Stop bit is enabled on timer disable. */ |
AnnaBridge | 145:64910690c574 | 163 | kFLEXIO_TimerStopBitEnableOnTimerCompareDisable = 0x3U, /*!< Stop bit is enabled on timer compare and timer |
AnnaBridge | 145:64910690c574 | 164 | disable. */ |
AnnaBridge | 145:64910690c574 | 165 | } flexio_timer_stop_bit_condition_t; |
AnnaBridge | 145:64910690c574 | 166 | |
AnnaBridge | 145:64910690c574 | 167 | /*! @brief Define type of timer start bit generate condition.*/ |
AnnaBridge | 145:64910690c574 | 168 | typedef enum _flexio_timer_start_bit_condition |
AnnaBridge | 145:64910690c574 | 169 | { |
AnnaBridge | 145:64910690c574 | 170 | kFLEXIO_TimerStartBitDisabled = 0x0U, /*!< Start bit disabled. */ |
AnnaBridge | 145:64910690c574 | 171 | kFLEXIO_TimerStartBitEnabled = 0x1U, /*!< Start bit enabled. */ |
AnnaBridge | 145:64910690c574 | 172 | } flexio_timer_start_bit_condition_t; |
AnnaBridge | 145:64910690c574 | 173 | |
AnnaBridge | 145:64910690c574 | 174 | /*! @brief Define type of timer polarity for shifter control. */ |
AnnaBridge | 145:64910690c574 | 175 | typedef enum _flexio_shifter_timer_polarity |
AnnaBridge | 145:64910690c574 | 176 | { |
AnnaBridge | 145:64910690c574 | 177 | kFLEXIO_ShifterTimerPolarityOnPositive = 0x0U, /* Shift on positive edge of shift clock. */ |
AnnaBridge | 145:64910690c574 | 178 | kFLEXIO_ShifterTimerPolarityOnNegitive = 0x1U, /* Shift on negative edge of shift clock. */ |
AnnaBridge | 145:64910690c574 | 179 | } flexio_shifter_timer_polarity_t; |
AnnaBridge | 145:64910690c574 | 180 | |
AnnaBridge | 145:64910690c574 | 181 | /*! @brief Define type of shifter working mode.*/ |
AnnaBridge | 145:64910690c574 | 182 | typedef enum _flexio_shifter_mode |
AnnaBridge | 145:64910690c574 | 183 | { |
AnnaBridge | 145:64910690c574 | 184 | kFLEXIO_ShifterDisabled = 0x0U, /*!< Shifter is disabled. */ |
AnnaBridge | 145:64910690c574 | 185 | kFLEXIO_ShifterModeReceive = 0x1U, /*!< Receive mode. */ |
AnnaBridge | 145:64910690c574 | 186 | kFLEXIO_ShifterModeTransmit = 0x2U, /*!< Transmit mode. */ |
AnnaBridge | 145:64910690c574 | 187 | kFLEXIO_ShifterModeMatchStore = 0x4U, /*!< Match store mode. */ |
AnnaBridge | 145:64910690c574 | 188 | kFLEXIO_ShifterModeMatchContinuous = 0x5U, /*!< Match continuous mode. */ |
AnnaBridge | 145:64910690c574 | 189 | #if FSL_FEATURE_FLEXIO_HAS_STATE_MODE |
AnnaBridge | 145:64910690c574 | 190 | kFLEXIO_ShifterModeState = 0x6U, /*!< SHIFTBUF contents are used for storing |
AnnaBridge | 145:64910690c574 | 191 | programmable state attributes. */ |
AnnaBridge | 145:64910690c574 | 192 | #endif /* FSL_FEATURE_FLEXIO_HAS_STATE_MODE */ |
AnnaBridge | 145:64910690c574 | 193 | #if FSL_FEATURE_FLEXIO_HAS_LOGIC_MODE |
AnnaBridge | 145:64910690c574 | 194 | kFLEXIO_ShifterModeLogic = 0x7U, /*!< SHIFTBUF contents are used for implementing |
AnnaBridge | 145:64910690c574 | 195 | programmable logic look up table. */ |
AnnaBridge | 145:64910690c574 | 196 | #endif /* FSL_FEATURE_FLEXIO_HAS_LOGIC_MODE */ |
AnnaBridge | 145:64910690c574 | 197 | } flexio_shifter_mode_t; |
AnnaBridge | 145:64910690c574 | 198 | |
AnnaBridge | 145:64910690c574 | 199 | /*! @brief Define type of shifter input source.*/ |
AnnaBridge | 145:64910690c574 | 200 | typedef enum _flexio_shifter_input_source |
AnnaBridge | 145:64910690c574 | 201 | { |
AnnaBridge | 145:64910690c574 | 202 | kFLEXIO_ShifterInputFromPin = 0x0U, /*!< Shifter input from pin. */ |
AnnaBridge | 145:64910690c574 | 203 | kFLEXIO_ShifterInputFromNextShifterOutput = 0x1U, /*!< Shifter input from Shifter N+1. */ |
AnnaBridge | 145:64910690c574 | 204 | } flexio_shifter_input_source_t; |
AnnaBridge | 145:64910690c574 | 205 | |
AnnaBridge | 145:64910690c574 | 206 | /*! @brief Define of STOP bit configuration.*/ |
AnnaBridge | 145:64910690c574 | 207 | typedef enum _flexio_shifter_stop_bit |
AnnaBridge | 145:64910690c574 | 208 | { |
AnnaBridge | 145:64910690c574 | 209 | kFLEXIO_ShifterStopBitDisable = 0x0U, /*!< Disable shifter stop bit. */ |
AnnaBridge | 145:64910690c574 | 210 | kFLEXIO_ShifterStopBitLow = 0x2U, /*!< Set shifter stop bit to logic low level. */ |
AnnaBridge | 145:64910690c574 | 211 | kFLEXIO_ShifterStopBitHigh = 0x3U, /*!< Set shifter stop bit to logic high level. */ |
AnnaBridge | 145:64910690c574 | 212 | } flexio_shifter_stop_bit_t; |
AnnaBridge | 145:64910690c574 | 213 | |
AnnaBridge | 145:64910690c574 | 214 | /*! @brief Define type of START bit configuration.*/ |
AnnaBridge | 145:64910690c574 | 215 | typedef enum _flexio_shifter_start_bit |
AnnaBridge | 145:64910690c574 | 216 | { |
AnnaBridge | 145:64910690c574 | 217 | kFLEXIO_ShifterStartBitDisabledLoadDataOnEnable = 0x0U, /*!< Disable shifter start bit, transmitter loads |
AnnaBridge | 145:64910690c574 | 218 | data on enable. */ |
AnnaBridge | 145:64910690c574 | 219 | kFLEXIO_ShifterStartBitDisabledLoadDataOnShift = 0x1U, /*!< Disable shifter start bit, transmitter loads |
AnnaBridge | 145:64910690c574 | 220 | data on first shift. */ |
AnnaBridge | 145:64910690c574 | 221 | kFLEXIO_ShifterStartBitLow = 0x2U, /*!< Set shifter start bit to logic low level. */ |
AnnaBridge | 145:64910690c574 | 222 | kFLEXIO_ShifterStartBitHigh = 0x3U, /*!< Set shifter start bit to logic high level. */ |
AnnaBridge | 145:64910690c574 | 223 | } flexio_shifter_start_bit_t; |
AnnaBridge | 145:64910690c574 | 224 | |
AnnaBridge | 145:64910690c574 | 225 | /*! @brief Define FlexIO shifter buffer type*/ |
AnnaBridge | 145:64910690c574 | 226 | typedef enum _flexio_shifter_buffer_type |
AnnaBridge | 145:64910690c574 | 227 | { |
AnnaBridge | 145:64910690c574 | 228 | kFLEXIO_ShifterBuffer = 0x0U, /*!< Shifter Buffer N Register. */ |
AnnaBridge | 145:64910690c574 | 229 | kFLEXIO_ShifterBufferBitSwapped = 0x1U, /*!< Shifter Buffer N Bit Byte Swapped Register. */ |
AnnaBridge | 145:64910690c574 | 230 | kFLEXIO_ShifterBufferByteSwapped = 0x2U, /*!< Shifter Buffer N Byte Swapped Register. */ |
AnnaBridge | 145:64910690c574 | 231 | kFLEXIO_ShifterBufferBitByteSwapped = 0x3U, /*!< Shifter Buffer N Bit Swapped Register. */ |
AnnaBridge | 145:64910690c574 | 232 | #if defined(FSL_FEATURE_FLEXIO_HAS_SHFT_BUFFER_NIBBLE_BYTE_SWAP) && FSL_FEATURE_FLEXIO_HAS_SHFT_BUFFER_NIBBLE_BYTE_SWAP |
AnnaBridge | 145:64910690c574 | 233 | kFLEXIO_ShifterBufferNibbleByteSwapped = 0x4U, /*!< Shifter Buffer N Nibble Byte Swapped Register. */ |
AnnaBridge | 145:64910690c574 | 234 | #endif /*FSL_FEATURE_FLEXIO_HAS_SHFT_BUFFER_NIBBLE_BYTE_SWAP*/ |
AnnaBridge | 145:64910690c574 | 235 | #if defined(FSL_FEATURE_FLEXIO_HAS_SHFT_BUFFER_HALF_WORD_SWAP) && FSL_FEATURE_FLEXIO_HAS_SHFT_BUFFER_HALF_WORD_SWAP |
AnnaBridge | 145:64910690c574 | 236 | kFLEXIO_ShifterBufferHalfWordSwapped = 0x5U, /*!< Shifter Buffer N Half Word Swapped Register. */ |
AnnaBridge | 145:64910690c574 | 237 | #endif |
AnnaBridge | 145:64910690c574 | 238 | #if defined(FSL_FEATURE_FLEXIO_HAS_SHFT_BUFFER_NIBBLE_SWAP) && FSL_FEATURE_FLEXIO_HAS_SHFT_BUFFER_NIBBLE_SWAP |
AnnaBridge | 145:64910690c574 | 239 | kFLEXIO_ShifterBufferNibbleSwapped = 0x6U, /*!< Shifter Buffer N Nibble Swapped Register. */ |
AnnaBridge | 145:64910690c574 | 240 | #endif |
AnnaBridge | 145:64910690c574 | 241 | } flexio_shifter_buffer_type_t; |
AnnaBridge | 145:64910690c574 | 242 | |
AnnaBridge | 145:64910690c574 | 243 | /*! @brief Define FlexIO user configuration structure. */ |
AnnaBridge | 145:64910690c574 | 244 | typedef struct _flexio_config_ |
AnnaBridge | 145:64910690c574 | 245 | { |
AnnaBridge | 145:64910690c574 | 246 | bool enableFlexio; /*!< Enable/disable FlexIO module */ |
AnnaBridge | 145:64910690c574 | 247 | bool enableInDoze; /*!< Enable/disable FlexIO operation in doze mode */ |
AnnaBridge | 145:64910690c574 | 248 | bool enableInDebug; /*!< Enable/disable FlexIO operation in debug mode */ |
AnnaBridge | 145:64910690c574 | 249 | bool enableFastAccess; /*!< Enable/disable fast access to FlexIO registers, fast access requires |
AnnaBridge | 145:64910690c574 | 250 | the FlexIO clock to be at least twice the frequency of the bus clock. */ |
AnnaBridge | 145:64910690c574 | 251 | } flexio_config_t; |
AnnaBridge | 145:64910690c574 | 252 | |
AnnaBridge | 145:64910690c574 | 253 | /*! @brief Define FlexIO timer configuration structure. */ |
AnnaBridge | 145:64910690c574 | 254 | typedef struct _flexio_timer_config |
AnnaBridge | 145:64910690c574 | 255 | { |
AnnaBridge | 145:64910690c574 | 256 | /* Trigger. */ |
AnnaBridge | 145:64910690c574 | 257 | uint32_t triggerSelect; /*!< The internal trigger selection number using MACROs. */ |
AnnaBridge | 145:64910690c574 | 258 | flexio_timer_trigger_polarity_t triggerPolarity; /*!< Trigger Polarity. */ |
AnnaBridge | 145:64910690c574 | 259 | flexio_timer_trigger_source_t triggerSource; /*!< Trigger Source, internal (see 'trgsel') or external. */ |
AnnaBridge | 145:64910690c574 | 260 | /* Pin. */ |
AnnaBridge | 145:64910690c574 | 261 | flexio_pin_config_t pinConfig; /*!< Timer Pin Configuration. */ |
AnnaBridge | 145:64910690c574 | 262 | uint32_t pinSelect; /*!< Timer Pin number Select. */ |
AnnaBridge | 145:64910690c574 | 263 | flexio_pin_polarity_t pinPolarity; /*!< Timer Pin Polarity. */ |
AnnaBridge | 145:64910690c574 | 264 | /* Timer. */ |
AnnaBridge | 145:64910690c574 | 265 | flexio_timer_mode_t timerMode; /*!< Timer work Mode. */ |
AnnaBridge | 145:64910690c574 | 266 | flexio_timer_output_t timerOutput; /*!< Configures the initial state of the Timer Output and |
AnnaBridge | 145:64910690c574 | 267 | whether it is affected by the Timer reset. */ |
AnnaBridge | 145:64910690c574 | 268 | flexio_timer_decrement_source_t timerDecrement; /*!< Configures the source of the Timer decrement and the |
AnnaBridge | 145:64910690c574 | 269 | source of the Shift clock. */ |
AnnaBridge | 145:64910690c574 | 270 | flexio_timer_reset_condition_t timerReset; /*!< Configures the condition that causes the timer counter |
AnnaBridge | 145:64910690c574 | 271 | (and optionally the timer output) to be reset. */ |
AnnaBridge | 145:64910690c574 | 272 | flexio_timer_disable_condition_t timerDisable; /*!< Configures the condition that causes the Timer to be |
AnnaBridge | 145:64910690c574 | 273 | disabled and stop decrementing. */ |
AnnaBridge | 145:64910690c574 | 274 | flexio_timer_enable_condition_t timerEnable; /*!< Configures the condition that causes the Timer to be |
AnnaBridge | 145:64910690c574 | 275 | enabled and start decrementing. */ |
AnnaBridge | 145:64910690c574 | 276 | flexio_timer_stop_bit_condition_t timerStop; /*!< Timer STOP Bit generation. */ |
AnnaBridge | 145:64910690c574 | 277 | flexio_timer_start_bit_condition_t timerStart; /*!< Timer STRAT Bit generation. */ |
AnnaBridge | 145:64910690c574 | 278 | uint32_t timerCompare; /*!< Value for Timer Compare N Register. */ |
AnnaBridge | 145:64910690c574 | 279 | } flexio_timer_config_t; |
AnnaBridge | 145:64910690c574 | 280 | |
AnnaBridge | 145:64910690c574 | 281 | /*! @brief Define FlexIO shifter configuration structure. */ |
AnnaBridge | 145:64910690c574 | 282 | typedef struct _flexio_shifter_config |
AnnaBridge | 145:64910690c574 | 283 | { |
AnnaBridge | 145:64910690c574 | 284 | /* Timer. */ |
AnnaBridge | 145:64910690c574 | 285 | uint32_t timerSelect; /*!< Selects which Timer is used for controlling the |
AnnaBridge | 145:64910690c574 | 286 | logic/shift register and generating the Shift clock. */ |
AnnaBridge | 145:64910690c574 | 287 | flexio_shifter_timer_polarity_t timerPolarity; /*!< Timer Polarity. */ |
AnnaBridge | 145:64910690c574 | 288 | /* Pin. */ |
AnnaBridge | 145:64910690c574 | 289 | flexio_pin_config_t pinConfig; /*!< Shifter Pin Configuration. */ |
AnnaBridge | 145:64910690c574 | 290 | uint32_t pinSelect; /*!< Shifter Pin number Select. */ |
AnnaBridge | 145:64910690c574 | 291 | flexio_pin_polarity_t pinPolarity; /*!< Shifter Pin Polarity. */ |
AnnaBridge | 145:64910690c574 | 292 | /* Shifter. */ |
AnnaBridge | 145:64910690c574 | 293 | flexio_shifter_mode_t shifterMode; /*!< Configures the mode of the Shifter. */ |
AnnaBridge | 145:64910690c574 | 294 | #if FSL_FEATURE_FLEXIO_HAS_PARALLEL_WIDTH |
AnnaBridge | 145:64910690c574 | 295 | uint32_t parallelWidth; /*!< Configures the parallel width when using parallel mode.*/ |
AnnaBridge | 145:64910690c574 | 296 | #endif /* FSL_FEATURE_FLEXIO_HAS_PARALLEL_WIDTH */ |
AnnaBridge | 145:64910690c574 | 297 | flexio_shifter_input_source_t inputSource; /*!< Selects the input source for the shifter. */ |
AnnaBridge | 145:64910690c574 | 298 | flexio_shifter_stop_bit_t shifterStop; /*!< Shifter STOP bit. */ |
AnnaBridge | 145:64910690c574 | 299 | flexio_shifter_start_bit_t shifterStart; /*!< Shifter START bit. */ |
AnnaBridge | 145:64910690c574 | 300 | } flexio_shifter_config_t; |
AnnaBridge | 145:64910690c574 | 301 | |
AnnaBridge | 145:64910690c574 | 302 | /*! @brief typedef for FlexIO simulated driver interrupt handler.*/ |
AnnaBridge | 145:64910690c574 | 303 | typedef void (*flexio_isr_t)(void *base, void *handle); |
AnnaBridge | 145:64910690c574 | 304 | |
AnnaBridge | 145:64910690c574 | 305 | /******************************************************************************* |
AnnaBridge | 145:64910690c574 | 306 | * API |
AnnaBridge | 145:64910690c574 | 307 | ******************************************************************************/ |
AnnaBridge | 145:64910690c574 | 308 | |
AnnaBridge | 145:64910690c574 | 309 | #if defined(__cplusplus) |
AnnaBridge | 145:64910690c574 | 310 | extern "C" { |
AnnaBridge | 145:64910690c574 | 311 | #endif /*_cplusplus*/ |
AnnaBridge | 145:64910690c574 | 312 | |
AnnaBridge | 145:64910690c574 | 313 | /*! |
AnnaBridge | 145:64910690c574 | 314 | * @name FlexIO Initialization and De-initialization |
AnnaBridge | 145:64910690c574 | 315 | * @{ |
AnnaBridge | 145:64910690c574 | 316 | */ |
AnnaBridge | 145:64910690c574 | 317 | |
AnnaBridge | 145:64910690c574 | 318 | /*! |
AnnaBridge | 145:64910690c574 | 319 | * @brief Gets the default configuration to configure FlexIO module. The configuration |
AnnaBridge | 145:64910690c574 | 320 | * can used directly for calling FLEXIO_Configure(). |
AnnaBridge | 145:64910690c574 | 321 | * |
AnnaBridge | 145:64910690c574 | 322 | * Example: |
AnnaBridge | 145:64910690c574 | 323 | @code |
AnnaBridge | 145:64910690c574 | 324 | flexio_config_t config; |
AnnaBridge | 145:64910690c574 | 325 | FLEXIO_GetDefaultConfig(&config); |
AnnaBridge | 145:64910690c574 | 326 | @endcode |
AnnaBridge | 145:64910690c574 | 327 | * |
AnnaBridge | 145:64910690c574 | 328 | * @param userConfig pointer to flexio_config_t structure |
AnnaBridge | 145:64910690c574 | 329 | */ |
AnnaBridge | 145:64910690c574 | 330 | void FLEXIO_GetDefaultConfig(flexio_config_t *userConfig); |
AnnaBridge | 145:64910690c574 | 331 | |
AnnaBridge | 145:64910690c574 | 332 | /*! |
AnnaBridge | 145:64910690c574 | 333 | * @brief Configures the FlexIO with FlexIO configuration. The configuration structure |
AnnaBridge | 145:64910690c574 | 334 | * can be filled by the user, or be set with default values by FLEXIO_GetDefaultConfig(). |
AnnaBridge | 145:64910690c574 | 335 | * |
AnnaBridge | 145:64910690c574 | 336 | * Example |
AnnaBridge | 145:64910690c574 | 337 | @code |
AnnaBridge | 145:64910690c574 | 338 | flexio_config_t config = { |
AnnaBridge | 145:64910690c574 | 339 | .enableFlexio = true, |
AnnaBridge | 145:64910690c574 | 340 | .enableInDoze = false, |
AnnaBridge | 145:64910690c574 | 341 | .enableInDebug = true, |
AnnaBridge | 145:64910690c574 | 342 | .enableFastAccess = false |
AnnaBridge | 145:64910690c574 | 343 | }; |
AnnaBridge | 145:64910690c574 | 344 | FLEXIO_Configure(base, &config); |
AnnaBridge | 145:64910690c574 | 345 | @endcode |
AnnaBridge | 145:64910690c574 | 346 | * |
AnnaBridge | 145:64910690c574 | 347 | * @param base FlexIO peripheral base address |
AnnaBridge | 145:64910690c574 | 348 | * @param userConfig pointer to flexio_config_t structure |
AnnaBridge | 145:64910690c574 | 349 | */ |
AnnaBridge | 145:64910690c574 | 350 | void FLEXIO_Init(FLEXIO_Type *base, const flexio_config_t *userConfig); |
AnnaBridge | 145:64910690c574 | 351 | |
AnnaBridge | 145:64910690c574 | 352 | /*! |
AnnaBridge | 145:64910690c574 | 353 | * @brief Gates the FlexIO clock. Call this API to stop the FlexIO clock. |
AnnaBridge | 145:64910690c574 | 354 | * |
AnnaBridge | 145:64910690c574 | 355 | * @note After calling this API, call the FLEXO_Init to use the FlexIO module. |
AnnaBridge | 145:64910690c574 | 356 | * |
AnnaBridge | 145:64910690c574 | 357 | * @param base FlexIO peripheral base address |
AnnaBridge | 145:64910690c574 | 358 | */ |
AnnaBridge | 145:64910690c574 | 359 | void FLEXIO_Deinit(FLEXIO_Type *base); |
AnnaBridge | 145:64910690c574 | 360 | |
AnnaBridge | 145:64910690c574 | 361 | /* @} */ |
AnnaBridge | 145:64910690c574 | 362 | |
AnnaBridge | 145:64910690c574 | 363 | /*! |
AnnaBridge | 145:64910690c574 | 364 | * @name FlexIO Basic Operation |
AnnaBridge | 145:64910690c574 | 365 | * @{ |
AnnaBridge | 145:64910690c574 | 366 | */ |
AnnaBridge | 145:64910690c574 | 367 | |
AnnaBridge | 145:64910690c574 | 368 | /*! |
AnnaBridge | 145:64910690c574 | 369 | * @brief Resets the FlexIO module. |
AnnaBridge | 145:64910690c574 | 370 | * |
AnnaBridge | 145:64910690c574 | 371 | * @param base FlexIO peripheral base address |
AnnaBridge | 145:64910690c574 | 372 | */ |
AnnaBridge | 145:64910690c574 | 373 | void FLEXIO_Reset(FLEXIO_Type *base); |
AnnaBridge | 145:64910690c574 | 374 | |
AnnaBridge | 145:64910690c574 | 375 | /*! |
AnnaBridge | 145:64910690c574 | 376 | * @brief Enables the FlexIO module operation. |
AnnaBridge | 145:64910690c574 | 377 | * |
AnnaBridge | 145:64910690c574 | 378 | * @param base FlexIO peripheral base address |
AnnaBridge | 145:64910690c574 | 379 | * @param enable true to enable, false to disable. |
AnnaBridge | 145:64910690c574 | 380 | */ |
AnnaBridge | 145:64910690c574 | 381 | static inline void FLEXIO_Enable(FLEXIO_Type *base, bool enable) |
AnnaBridge | 145:64910690c574 | 382 | { |
AnnaBridge | 145:64910690c574 | 383 | if (enable) |
AnnaBridge | 145:64910690c574 | 384 | { |
AnnaBridge | 145:64910690c574 | 385 | base->CTRL |= FLEXIO_CTRL_FLEXEN_MASK; |
AnnaBridge | 145:64910690c574 | 386 | } |
AnnaBridge | 145:64910690c574 | 387 | else |
AnnaBridge | 145:64910690c574 | 388 | { |
AnnaBridge | 145:64910690c574 | 389 | base->CTRL &= ~FLEXIO_CTRL_FLEXEN_MASK; |
AnnaBridge | 145:64910690c574 | 390 | } |
AnnaBridge | 145:64910690c574 | 391 | } |
AnnaBridge | 145:64910690c574 | 392 | |
AnnaBridge | 145:64910690c574 | 393 | #if defined(FSL_FEATURE_FLEXIO_HAS_PIN_STATUS) && FSL_FEATURE_FLEXIO_HAS_PIN_STATUS |
AnnaBridge | 145:64910690c574 | 394 | /*! |
AnnaBridge | 145:64910690c574 | 395 | * @brief Reads the input data on each of the FlexIO pins. |
AnnaBridge | 145:64910690c574 | 396 | * |
AnnaBridge | 145:64910690c574 | 397 | * @param base FlexIO peripheral base address |
AnnaBridge | 145:64910690c574 | 398 | * @return FlexIO pin input data |
AnnaBridge | 145:64910690c574 | 399 | */ |
AnnaBridge | 145:64910690c574 | 400 | static inline uint32_t FLEXIO_ReadPinInput(FLEXIO_Type *base) |
AnnaBridge | 145:64910690c574 | 401 | { |
AnnaBridge | 145:64910690c574 | 402 | return base->PIN; |
AnnaBridge | 145:64910690c574 | 403 | } |
AnnaBridge | 145:64910690c574 | 404 | #endif /*FSL_FEATURE_FLEXIO_HAS_PIN_STATUS*/ |
AnnaBridge | 145:64910690c574 | 405 | |
AnnaBridge | 145:64910690c574 | 406 | #if defined(FSL_FEATURE_FLEXIO_HAS_STATE_MODE) && FSL_FEATURE_FLEXIO_HAS_STATE_MODE |
AnnaBridge | 145:64910690c574 | 407 | /*! |
AnnaBridge | 145:64910690c574 | 408 | * @brief Gets the current state pointer for state mode use. |
AnnaBridge | 145:64910690c574 | 409 | * |
AnnaBridge | 145:64910690c574 | 410 | * @param base FlexIO peripheral base address |
AnnaBridge | 145:64910690c574 | 411 | * @return current state pointer |
AnnaBridge | 145:64910690c574 | 412 | */ |
AnnaBridge | 145:64910690c574 | 413 | static inline uint8_t FLEXIO_GetShifterState(FLEXIO_Type *base) |
AnnaBridge | 145:64910690c574 | 414 | { |
AnnaBridge | 145:64910690c574 | 415 | return ((base->SHIFTSTATE) & FLEXIO_SHIFTSTATE_STATE_MASK); |
AnnaBridge | 145:64910690c574 | 416 | } |
AnnaBridge | 145:64910690c574 | 417 | #endif /*FSL_FEATURE_FLEXIO_HAS_STATE_MODE*/ |
AnnaBridge | 145:64910690c574 | 418 | |
AnnaBridge | 145:64910690c574 | 419 | /*! |
AnnaBridge | 145:64910690c574 | 420 | * @brief Configures the shifter with shifter configuration. The configuration structure |
AnnaBridge | 145:64910690c574 | 421 | * covers both the SHIFTCTL and SHIFTCFG registers. To configure the shifter to the proper |
AnnaBridge | 145:64910690c574 | 422 | * mode, select which timer controls the shifter to shift, whether to generate start bit/stop |
AnnaBridge | 145:64910690c574 | 423 | * bit, and the polarity of start bit and stop bit. |
AnnaBridge | 145:64910690c574 | 424 | * |
AnnaBridge | 145:64910690c574 | 425 | * Example |
AnnaBridge | 145:64910690c574 | 426 | @code |
AnnaBridge | 145:64910690c574 | 427 | flexio_shifter_config_t config = { |
AnnaBridge | 145:64910690c574 | 428 | .timerSelect = 0, |
AnnaBridge | 145:64910690c574 | 429 | .timerPolarity = kFLEXIO_ShifterTimerPolarityOnPositive, |
AnnaBridge | 145:64910690c574 | 430 | .pinConfig = kFLEXIO_PinConfigOpenDrainOrBidirection, |
AnnaBridge | 145:64910690c574 | 431 | .pinPolarity = kFLEXIO_PinActiveLow, |
AnnaBridge | 145:64910690c574 | 432 | .shifterMode = kFLEXIO_ShifterModeTransmit, |
AnnaBridge | 145:64910690c574 | 433 | .inputSource = kFLEXIO_ShifterInputFromPin, |
AnnaBridge | 145:64910690c574 | 434 | .shifterStop = kFLEXIO_ShifterStopBitHigh, |
AnnaBridge | 145:64910690c574 | 435 | .shifterStart = kFLEXIO_ShifterStartBitLow |
AnnaBridge | 145:64910690c574 | 436 | }; |
AnnaBridge | 145:64910690c574 | 437 | FLEXIO_SetShifterConfig(base, &config); |
AnnaBridge | 145:64910690c574 | 438 | @endcode |
AnnaBridge | 145:64910690c574 | 439 | * |
AnnaBridge | 145:64910690c574 | 440 | * @param base FlexIO peripheral base address |
AnnaBridge | 145:64910690c574 | 441 | * @param index shifter index |
AnnaBridge | 145:64910690c574 | 442 | * @param shifterConfig pointer to flexio_shifter_config_t structure |
AnnaBridge | 145:64910690c574 | 443 | */ |
AnnaBridge | 145:64910690c574 | 444 | void FLEXIO_SetShifterConfig(FLEXIO_Type *base, uint8_t index, const flexio_shifter_config_t *shifterConfig); |
AnnaBridge | 145:64910690c574 | 445 | /*! |
AnnaBridge | 145:64910690c574 | 446 | * @brief Configures the timer with the timer configuration. The configuration structure |
AnnaBridge | 145:64910690c574 | 447 | * covers both the TIMCTL and TIMCFG registers. To configure the timer to the proper |
AnnaBridge | 145:64910690c574 | 448 | * mode, select trigger source for timer and the timer pin output and the timing for timer. |
AnnaBridge | 145:64910690c574 | 449 | * |
AnnaBridge | 145:64910690c574 | 450 | * Example |
AnnaBridge | 145:64910690c574 | 451 | @code |
AnnaBridge | 145:64910690c574 | 452 | flexio_timer_config_t config = { |
AnnaBridge | 145:64910690c574 | 453 | .triggerSelect = FLEXIO_TIMER_TRIGGER_SEL_SHIFTnSTAT(0), |
AnnaBridge | 145:64910690c574 | 454 | .triggerPolarity = kFLEXIO_TimerTriggerPolarityActiveLow, |
AnnaBridge | 145:64910690c574 | 455 | .triggerSource = kFLEXIO_TimerTriggerSourceInternal, |
AnnaBridge | 145:64910690c574 | 456 | .pinConfig = kFLEXIO_PinConfigOpenDrainOrBidirection, |
AnnaBridge | 145:64910690c574 | 457 | .pinSelect = 0, |
AnnaBridge | 145:64910690c574 | 458 | .pinPolarity = kFLEXIO_PinActiveHigh, |
AnnaBridge | 145:64910690c574 | 459 | .timerMode = kFLEXIO_TimerModeDual8BitBaudBit, |
AnnaBridge | 145:64910690c574 | 460 | .timerOutput = kFLEXIO_TimerOutputZeroNotAffectedByReset, |
AnnaBridge | 145:64910690c574 | 461 | .timerDecrement = kFLEXIO_TimerDecSrcOnFlexIOClockShiftTimerOutput, |
AnnaBridge | 145:64910690c574 | 462 | .timerReset = kFLEXIO_TimerResetOnTimerPinEqualToTimerOutput, |
AnnaBridge | 145:64910690c574 | 463 | .timerDisable = kFLEXIO_TimerDisableOnTimerCompare, |
AnnaBridge | 145:64910690c574 | 464 | .timerEnable = kFLEXIO_TimerEnableOnTriggerHigh, |
AnnaBridge | 145:64910690c574 | 465 | .timerStop = kFLEXIO_TimerStopBitEnableOnTimerDisable, |
AnnaBridge | 145:64910690c574 | 466 | .timerStart = kFLEXIO_TimerStartBitEnabled |
AnnaBridge | 145:64910690c574 | 467 | }; |
AnnaBridge | 145:64910690c574 | 468 | FLEXIO_SetTimerConfig(base, &config); |
AnnaBridge | 145:64910690c574 | 469 | @endcode |
AnnaBridge | 145:64910690c574 | 470 | * |
AnnaBridge | 145:64910690c574 | 471 | * @param base FlexIO peripheral base address |
AnnaBridge | 145:64910690c574 | 472 | * @param index timer index |
AnnaBridge | 145:64910690c574 | 473 | * @param timerConfig pointer to flexio_timer_config_t structure |
AnnaBridge | 145:64910690c574 | 474 | */ |
AnnaBridge | 145:64910690c574 | 475 | void FLEXIO_SetTimerConfig(FLEXIO_Type *base, uint8_t index, const flexio_timer_config_t *timerConfig); |
AnnaBridge | 145:64910690c574 | 476 | |
AnnaBridge | 145:64910690c574 | 477 | /* @} */ |
AnnaBridge | 145:64910690c574 | 478 | |
AnnaBridge | 145:64910690c574 | 479 | /*! |
AnnaBridge | 145:64910690c574 | 480 | * @name FlexIO Interrupt Operation |
AnnaBridge | 145:64910690c574 | 481 | * @{ |
AnnaBridge | 145:64910690c574 | 482 | */ |
AnnaBridge | 145:64910690c574 | 483 | |
AnnaBridge | 145:64910690c574 | 484 | /*! |
AnnaBridge | 145:64910690c574 | 485 | * @brief Enables the shifter status interrupt. The interrupt generates when the corresponding SSF is set. |
AnnaBridge | 145:64910690c574 | 486 | * |
AnnaBridge | 145:64910690c574 | 487 | * @param base FlexIO peripheral base address |
AnnaBridge | 145:64910690c574 | 488 | * @param mask the shifter status mask which could be calculated by (1 << shifter index) |
AnnaBridge | 145:64910690c574 | 489 | * @note for multiple shifter status interrupt enable, for example, two shifter status enable, could calculate |
AnnaBridge | 145:64910690c574 | 490 | * the mask by using ((1 << shifter index0) | (1 << shifter index1)) |
AnnaBridge | 145:64910690c574 | 491 | */ |
AnnaBridge | 145:64910690c574 | 492 | static inline void FLEXIO_EnableShifterStatusInterrupts(FLEXIO_Type *base, uint32_t mask) |
AnnaBridge | 145:64910690c574 | 493 | { |
AnnaBridge | 145:64910690c574 | 494 | base->SHIFTSIEN |= mask; |
AnnaBridge | 145:64910690c574 | 495 | } |
AnnaBridge | 145:64910690c574 | 496 | |
AnnaBridge | 145:64910690c574 | 497 | /*! |
AnnaBridge | 145:64910690c574 | 498 | * @brief Disables the shifter status interrupt. The interrupt won't generate when the corresponding SSF is set. |
AnnaBridge | 145:64910690c574 | 499 | * |
AnnaBridge | 145:64910690c574 | 500 | * @param base FlexIO peripheral base address |
AnnaBridge | 145:64910690c574 | 501 | * @param mask the shifter status mask which could be calculated by (1 << shifter index) |
AnnaBridge | 145:64910690c574 | 502 | * @note for multiple shifter status interrupt enable, for example, two shifter status enable, could calculate |
AnnaBridge | 145:64910690c574 | 503 | * the mask by using ((1 << shifter index0) | (1 << shifter index1)) |
AnnaBridge | 145:64910690c574 | 504 | */ |
AnnaBridge | 145:64910690c574 | 505 | static inline void FLEXIO_DisableShifterStatusInterrupts(FLEXIO_Type *base, uint32_t mask) |
AnnaBridge | 145:64910690c574 | 506 | { |
AnnaBridge | 145:64910690c574 | 507 | base->SHIFTSIEN &= ~mask; |
AnnaBridge | 145:64910690c574 | 508 | } |
AnnaBridge | 145:64910690c574 | 509 | |
AnnaBridge | 145:64910690c574 | 510 | /*! |
AnnaBridge | 145:64910690c574 | 511 | * @brief Enables the shifter error interrupt. The interrupt generates when the corresponding SEF is set. |
AnnaBridge | 145:64910690c574 | 512 | * |
AnnaBridge | 145:64910690c574 | 513 | * @param base FlexIO peripheral base address |
AnnaBridge | 145:64910690c574 | 514 | * @param mask the shifter error mask which could be calculated by (1 << shifter index) |
AnnaBridge | 145:64910690c574 | 515 | * @note for multiple shifter error interrupt enable, for example, two shifter error enable, could calculate |
AnnaBridge | 145:64910690c574 | 516 | * the mask by using ((1 << shifter index0) | (1 << shifter index1)) |
AnnaBridge | 145:64910690c574 | 517 | */ |
AnnaBridge | 145:64910690c574 | 518 | static inline void FLEXIO_EnableShifterErrorInterrupts(FLEXIO_Type *base, uint32_t mask) |
AnnaBridge | 145:64910690c574 | 519 | { |
AnnaBridge | 145:64910690c574 | 520 | base->SHIFTEIEN |= mask; |
AnnaBridge | 145:64910690c574 | 521 | } |
AnnaBridge | 145:64910690c574 | 522 | |
AnnaBridge | 145:64910690c574 | 523 | /*! |
AnnaBridge | 145:64910690c574 | 524 | * @brief Disables the shifter error interrupt. The interrupt won't generate when the corresponding SEF is set. |
AnnaBridge | 145:64910690c574 | 525 | * |
AnnaBridge | 145:64910690c574 | 526 | * @param base FlexIO peripheral base address |
AnnaBridge | 145:64910690c574 | 527 | * @param mask the shifter error mask which could be calculated by (1 << shifter index) |
AnnaBridge | 145:64910690c574 | 528 | * @note for multiple shifter error interrupt enable, for example, two shifter error enable, could calculate |
AnnaBridge | 145:64910690c574 | 529 | * the mask by using ((1 << shifter index0) | (1 << shifter index1)) |
AnnaBridge | 145:64910690c574 | 530 | */ |
AnnaBridge | 145:64910690c574 | 531 | static inline void FLEXIO_DisableShifterErrorInterrupts(FLEXIO_Type *base, uint32_t mask) |
AnnaBridge | 145:64910690c574 | 532 | { |
AnnaBridge | 145:64910690c574 | 533 | base->SHIFTEIEN &= ~mask; |
AnnaBridge | 145:64910690c574 | 534 | } |
AnnaBridge | 145:64910690c574 | 535 | |
AnnaBridge | 145:64910690c574 | 536 | /*! |
AnnaBridge | 145:64910690c574 | 537 | * @brief Enables the timer status interrupt. The interrupt generates when the corresponding SSF is set. |
AnnaBridge | 145:64910690c574 | 538 | * |
AnnaBridge | 145:64910690c574 | 539 | * @param base FlexIO peripheral base address |
AnnaBridge | 145:64910690c574 | 540 | * @param mask the timer status mask which could be calculated by (1 << timer index) |
AnnaBridge | 145:64910690c574 | 541 | * @note for multiple timer status interrupt enable, for example, two timer status enable, could calculate |
AnnaBridge | 145:64910690c574 | 542 | * the mask by using ((1 << timer index0) | (1 << timer index1)) |
AnnaBridge | 145:64910690c574 | 543 | */ |
AnnaBridge | 145:64910690c574 | 544 | static inline void FLEXIO_EnableTimerStatusInterrupts(FLEXIO_Type *base, uint32_t mask) |
AnnaBridge | 145:64910690c574 | 545 | { |
AnnaBridge | 145:64910690c574 | 546 | base->TIMIEN |= mask; |
AnnaBridge | 145:64910690c574 | 547 | } |
AnnaBridge | 145:64910690c574 | 548 | |
AnnaBridge | 145:64910690c574 | 549 | /*! |
AnnaBridge | 145:64910690c574 | 550 | * @brief Disables the timer status interrupt. The interrupt won't generate when the corresponding SSF is set. |
AnnaBridge | 145:64910690c574 | 551 | * |
AnnaBridge | 145:64910690c574 | 552 | * @param base FlexIO peripheral base address |
AnnaBridge | 145:64910690c574 | 553 | * @param mask the timer status mask which could be calculated by (1 << timer index) |
AnnaBridge | 145:64910690c574 | 554 | * @note for multiple timer status interrupt enable, for example, two timer status enable, could calculate |
AnnaBridge | 145:64910690c574 | 555 | * the mask by using ((1 << timer index0) | (1 << timer index1)) |
AnnaBridge | 145:64910690c574 | 556 | */ |
AnnaBridge | 145:64910690c574 | 557 | static inline void FLEXIO_DisableTimerStatusInterrupts(FLEXIO_Type *base, uint32_t mask) |
AnnaBridge | 145:64910690c574 | 558 | { |
AnnaBridge | 145:64910690c574 | 559 | base->TIMIEN &= ~mask; |
AnnaBridge | 145:64910690c574 | 560 | } |
AnnaBridge | 145:64910690c574 | 561 | |
AnnaBridge | 145:64910690c574 | 562 | /* @} */ |
AnnaBridge | 145:64910690c574 | 563 | |
AnnaBridge | 145:64910690c574 | 564 | /*! |
AnnaBridge | 145:64910690c574 | 565 | * @name FlexIO Status Operation |
AnnaBridge | 145:64910690c574 | 566 | * @{ |
AnnaBridge | 145:64910690c574 | 567 | */ |
AnnaBridge | 145:64910690c574 | 568 | |
AnnaBridge | 145:64910690c574 | 569 | /*! |
AnnaBridge | 145:64910690c574 | 570 | * @brief Gets the shifter status flags. |
AnnaBridge | 145:64910690c574 | 571 | * |
AnnaBridge | 145:64910690c574 | 572 | * @param base FlexIO peripheral base address |
AnnaBridge | 145:64910690c574 | 573 | * @return shifter status flags |
AnnaBridge | 145:64910690c574 | 574 | */ |
AnnaBridge | 145:64910690c574 | 575 | static inline uint32_t FLEXIO_GetShifterStatusFlags(FLEXIO_Type *base) |
AnnaBridge | 145:64910690c574 | 576 | { |
AnnaBridge | 145:64910690c574 | 577 | return ((base->SHIFTSTAT) & FLEXIO_SHIFTSTAT_SSF_MASK); |
AnnaBridge | 145:64910690c574 | 578 | } |
AnnaBridge | 145:64910690c574 | 579 | |
AnnaBridge | 145:64910690c574 | 580 | /*! |
AnnaBridge | 145:64910690c574 | 581 | * @brief Clears the shifter status flags. |
AnnaBridge | 145:64910690c574 | 582 | * |
AnnaBridge | 145:64910690c574 | 583 | * @param base FlexIO peripheral base address |
AnnaBridge | 145:64910690c574 | 584 | * @param mask the shifter status mask which could be calculated by (1 << shifter index) |
AnnaBridge | 145:64910690c574 | 585 | * @note for clearing multiple shifter status flags, for example, two shifter status flags, could calculate |
AnnaBridge | 145:64910690c574 | 586 | * the mask by using ((1 << shifter index0) | (1 << shifter index1)) |
AnnaBridge | 145:64910690c574 | 587 | */ |
AnnaBridge | 145:64910690c574 | 588 | static inline void FLEXIO_ClearShifterStatusFlags(FLEXIO_Type *base, uint32_t mask) |
AnnaBridge | 145:64910690c574 | 589 | { |
AnnaBridge | 145:64910690c574 | 590 | base->SHIFTSTAT = mask; |
AnnaBridge | 145:64910690c574 | 591 | } |
AnnaBridge | 145:64910690c574 | 592 | |
AnnaBridge | 145:64910690c574 | 593 | /*! |
AnnaBridge | 145:64910690c574 | 594 | * @brief Gets the shifter error flags. |
AnnaBridge | 145:64910690c574 | 595 | * |
AnnaBridge | 145:64910690c574 | 596 | * @param base FlexIO peripheral base address |
AnnaBridge | 145:64910690c574 | 597 | * @return shifter error flags |
AnnaBridge | 145:64910690c574 | 598 | */ |
AnnaBridge | 145:64910690c574 | 599 | static inline uint32_t FLEXIO_GetShifterErrorFlags(FLEXIO_Type *base) |
AnnaBridge | 145:64910690c574 | 600 | { |
AnnaBridge | 145:64910690c574 | 601 | return ((base->SHIFTERR) & FLEXIO_SHIFTERR_SEF_MASK); |
AnnaBridge | 145:64910690c574 | 602 | } |
AnnaBridge | 145:64910690c574 | 603 | |
AnnaBridge | 145:64910690c574 | 604 | /*! |
AnnaBridge | 145:64910690c574 | 605 | * @brief Clears the shifter error flags. |
AnnaBridge | 145:64910690c574 | 606 | * |
AnnaBridge | 145:64910690c574 | 607 | * @param base FlexIO peripheral base address |
AnnaBridge | 145:64910690c574 | 608 | * @param mask the shifter error mask which could be calculated by (1 << shifter index) |
AnnaBridge | 145:64910690c574 | 609 | * @note for clearing multiple shifter error flags, for example, two shifter error flags, could calculate |
AnnaBridge | 145:64910690c574 | 610 | * the mask by using ((1 << shifter index0) | (1 << shifter index1)) |
AnnaBridge | 145:64910690c574 | 611 | */ |
AnnaBridge | 145:64910690c574 | 612 | static inline void FLEXIO_ClearShifterErrorFlags(FLEXIO_Type *base, uint32_t mask) |
AnnaBridge | 145:64910690c574 | 613 | { |
AnnaBridge | 145:64910690c574 | 614 | base->SHIFTERR = mask; |
AnnaBridge | 145:64910690c574 | 615 | } |
AnnaBridge | 145:64910690c574 | 616 | |
AnnaBridge | 145:64910690c574 | 617 | /*! |
AnnaBridge | 145:64910690c574 | 618 | * @brief Gets the timer status flags. |
AnnaBridge | 145:64910690c574 | 619 | * |
AnnaBridge | 145:64910690c574 | 620 | * @param base FlexIO peripheral base address |
AnnaBridge | 145:64910690c574 | 621 | * @return timer status flags |
AnnaBridge | 145:64910690c574 | 622 | */ |
AnnaBridge | 145:64910690c574 | 623 | static inline uint32_t FLEXIO_GetTimerStatusFlags(FLEXIO_Type *base) |
AnnaBridge | 145:64910690c574 | 624 | { |
AnnaBridge | 145:64910690c574 | 625 | return ((base->TIMSTAT) & FLEXIO_TIMSTAT_TSF_MASK); |
AnnaBridge | 145:64910690c574 | 626 | } |
AnnaBridge | 145:64910690c574 | 627 | |
AnnaBridge | 145:64910690c574 | 628 | /*! |
AnnaBridge | 145:64910690c574 | 629 | * @brief Clears the timer status flags. |
AnnaBridge | 145:64910690c574 | 630 | * |
AnnaBridge | 145:64910690c574 | 631 | * @param base FlexIO peripheral base address |
AnnaBridge | 145:64910690c574 | 632 | * @param mask the timer status mask which could be calculated by (1 << timer index) |
AnnaBridge | 145:64910690c574 | 633 | * @note for clearing multiple timer status flags, for example, two timer status flags, could calculate |
AnnaBridge | 145:64910690c574 | 634 | * the mask by using ((1 << timer index0) | (1 << timer index1)) |
AnnaBridge | 145:64910690c574 | 635 | */ |
AnnaBridge | 145:64910690c574 | 636 | static inline void FLEXIO_ClearTimerStatusFlags(FLEXIO_Type *base, uint32_t mask) |
AnnaBridge | 145:64910690c574 | 637 | { |
AnnaBridge | 145:64910690c574 | 638 | base->TIMSTAT = mask; |
AnnaBridge | 145:64910690c574 | 639 | } |
AnnaBridge | 145:64910690c574 | 640 | |
AnnaBridge | 145:64910690c574 | 641 | /* @} */ |
AnnaBridge | 145:64910690c574 | 642 | |
AnnaBridge | 145:64910690c574 | 643 | /*! |
AnnaBridge | 145:64910690c574 | 644 | * @name FlexIO DMA Operation |
AnnaBridge | 145:64910690c574 | 645 | * @{ |
AnnaBridge | 145:64910690c574 | 646 | */ |
AnnaBridge | 145:64910690c574 | 647 | |
AnnaBridge | 145:64910690c574 | 648 | /*! |
AnnaBridge | 145:64910690c574 | 649 | * @brief Enables/disables the shifter status DMA. The DMA request generates when the corresponding SSF is set. |
AnnaBridge | 145:64910690c574 | 650 | * |
AnnaBridge | 145:64910690c574 | 651 | * @note For multiple shifter status DMA enables, for example, calculate |
AnnaBridge | 145:64910690c574 | 652 | * the mask by using ((1 << shifter index0) | (1 << shifter index1)) |
AnnaBridge | 145:64910690c574 | 653 | * |
AnnaBridge | 145:64910690c574 | 654 | * @param base FlexIO peripheral base address |
AnnaBridge | 145:64910690c574 | 655 | * @param mask the shifter status mask which could be calculated by (1 << shifter index) |
AnnaBridge | 145:64910690c574 | 656 | * @param enable True to enable, false to disable. |
AnnaBridge | 145:64910690c574 | 657 | */ |
AnnaBridge | 145:64910690c574 | 658 | static inline void FLEXIO_EnableShifterStatusDMA(FLEXIO_Type *base, uint32_t mask, bool enable) |
AnnaBridge | 145:64910690c574 | 659 | { |
AnnaBridge | 145:64910690c574 | 660 | if (enable) |
AnnaBridge | 145:64910690c574 | 661 | { |
AnnaBridge | 145:64910690c574 | 662 | base->SHIFTSDEN |= mask; |
AnnaBridge | 145:64910690c574 | 663 | } |
AnnaBridge | 145:64910690c574 | 664 | else |
AnnaBridge | 145:64910690c574 | 665 | { |
AnnaBridge | 145:64910690c574 | 666 | base->SHIFTSDEN &= ~mask; |
AnnaBridge | 145:64910690c574 | 667 | } |
AnnaBridge | 145:64910690c574 | 668 | } |
AnnaBridge | 145:64910690c574 | 669 | |
AnnaBridge | 145:64910690c574 | 670 | /*! |
AnnaBridge | 145:64910690c574 | 671 | * @brief Gets the shifter buffer address for the DMA transfer usage. |
AnnaBridge | 145:64910690c574 | 672 | * |
AnnaBridge | 145:64910690c574 | 673 | * @param base FlexIO peripheral base address |
AnnaBridge | 145:64910690c574 | 674 | * @param type shifter type of flexio_shifter_buffer_type_t |
AnnaBridge | 145:64910690c574 | 675 | * @param index shifter index |
AnnaBridge | 145:64910690c574 | 676 | * @return corresponding shifter buffer index |
AnnaBridge | 145:64910690c574 | 677 | */ |
AnnaBridge | 145:64910690c574 | 678 | uint32_t FLEXIO_GetShifterBufferAddress(FLEXIO_Type *base, flexio_shifter_buffer_type_t type, uint8_t index); |
AnnaBridge | 145:64910690c574 | 679 | |
AnnaBridge | 145:64910690c574 | 680 | /*! |
AnnaBridge | 145:64910690c574 | 681 | * @brief Registers the handle and the interrupt handler for the FlexIO-simulated peripheral. |
AnnaBridge | 145:64910690c574 | 682 | * |
AnnaBridge | 145:64910690c574 | 683 | * @param base pointer to FlexIO simulated peripheral type. |
AnnaBridge | 145:64910690c574 | 684 | * @param handle pointer to handler for FlexIO simulated peripheral. |
AnnaBridge | 145:64910690c574 | 685 | * @param isr FlexIO simulated peripheral interrupt handler. |
AnnaBridge | 145:64910690c574 | 686 | * @retval kStatus_Success Successfully create the handle. |
AnnaBridge | 145:64910690c574 | 687 | * @retval kStatus_OutOfRange The FlexIO type/handle/ISR table out of range. |
AnnaBridge | 145:64910690c574 | 688 | */ |
AnnaBridge | 145:64910690c574 | 689 | status_t FLEXIO_RegisterHandleIRQ(void *base, void *handle, flexio_isr_t isr); |
AnnaBridge | 145:64910690c574 | 690 | |
AnnaBridge | 145:64910690c574 | 691 | /*! |
AnnaBridge | 145:64910690c574 | 692 | * @brief Unregisters the handle and the interrupt handler for the FlexIO-simulated peripheral. |
AnnaBridge | 145:64910690c574 | 693 | * |
AnnaBridge | 145:64910690c574 | 694 | * @param base pointer to FlexIO simulated peripheral type. |
AnnaBridge | 145:64910690c574 | 695 | * @retval kStatus_Success Successfully create the handle. |
AnnaBridge | 145:64910690c574 | 696 | * @retval kStatus_OutOfRange The FlexIO type/handle/ISR table out of range. |
AnnaBridge | 145:64910690c574 | 697 | */ |
AnnaBridge | 145:64910690c574 | 698 | status_t FLEXIO_UnregisterHandleIRQ(void *base); |
AnnaBridge | 145:64910690c574 | 699 | /* @} */ |
AnnaBridge | 145:64910690c574 | 700 | |
AnnaBridge | 145:64910690c574 | 701 | #if defined(__cplusplus) |
AnnaBridge | 145:64910690c574 | 702 | } |
AnnaBridge | 145:64910690c574 | 703 | #endif /*_cplusplus*/ |
AnnaBridge | 145:64910690c574 | 704 | /*@}*/ |
AnnaBridge | 145:64910690c574 | 705 | |
AnnaBridge | 145:64910690c574 | 706 | #endif /*_FSL_FLEXIO_H_*/ |