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.

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?

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