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