11#include "fsl_common.h"
25#define FSL_FLEXIO_DRIVER_VERSION (MAKE_VERSION(2, 1, 0))
29#define FLEXIO_TIMER_TRIGGER_SEL_PININPUT(x) ((uint32_t)(x) << 1U)
30#define FLEXIO_TIMER_TRIGGER_SEL_SHIFTnSTAT(x) (((uint32_t)(x) << 2U) | 0x1U)
31#define FLEXIO_TIMER_TRIGGER_SEL_TIMn(x) (((uint32_t)(x) << 2U) | 0x3U)
94#if (defined(FSL_FEATURE_FLEXIO_TIMCFG_TIMDCE_FIELD_WIDTH) && (FSL_FEATURE_FLEXIO_TIMCFG_TIMDCE_FIELD_WIDTH == 3))
96 kFLEXIO_TimerDecSrcDiv16OnFlexIOClockShiftTimerOutput,
98 kFLEXIO_TimerDecSrcDiv256OnFlexIOClockShiftTimerOutput,
100 kFLEXIO_TimerRisSrcOnPinInputShiftPinInput,
102 kFLEXIO_TimerRisSrcOnTriggerInputShiftTriggerInput
184#if FSL_FEATURE_FLEXIO_HAS_STATE_MODE
185 kFLEXIO_ShifterModeState = 0x6U,
188#if FSL_FEATURE_FLEXIO_HAS_LOGIC_MODE
189 kFLEXIO_ShifterModeLogic = 0x7U,
227#if defined(FSL_FEATURE_FLEXIO_HAS_SHFT_BUFFER_NIBBLE_BYTE_SWAP) && FSL_FEATURE_FLEXIO_HAS_SHFT_BUFFER_NIBBLE_BYTE_SWAP
228 kFLEXIO_ShifterBufferNibbleByteSwapped = 0x4U,
230#if defined(FSL_FEATURE_FLEXIO_HAS_SHFT_BUFFER_HALF_WORD_SWAP) && FSL_FEATURE_FLEXIO_HAS_SHFT_BUFFER_HALF_WORD_SWAP
231 kFLEXIO_ShifterBufferHalfWordSwapped = 0x5U,
233#if defined(FSL_FEATURE_FLEXIO_HAS_SHFT_BUFFER_NIBBLE_SWAP) && FSL_FEATURE_FLEXIO_HAS_SHFT_BUFFER_NIBBLE_SWAP
234 kFLEXIO_ShifterBufferNibbleSwapped = 0x6U,
289#if FSL_FEATURE_FLEXIO_HAS_PARALLEL_WIDTH
290 uint32_t parallelWidth;
306#if !(defined(FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL) && FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL)
314#if defined(__cplusplus)
393static inline void FLEXIO_Enable(
FLEXIO_Type *base,
bool enable)
397 base->CTRL |= FLEXIO_CTRL_FLEXEN_MASK;
401 base->CTRL &= ~FLEXIO_CTRL_FLEXEN_MASK;
405#if defined(FSL_FEATURE_FLEXIO_HAS_PIN_STATUS) && FSL_FEATURE_FLEXIO_HAS_PIN_STATUS
412static inline uint32_t FLEXIO_ReadPinInput(
FLEXIO_Type *base)
418#if defined(FSL_FEATURE_FLEXIO_HAS_STATE_MODE) && FSL_FEATURE_FLEXIO_HAS_STATE_MODE
425static inline uint8_t FLEXIO_GetShifterState(
FLEXIO_Type *base)
427 return ((uint8_t)(base->SHIFTSTATE) & FLEXIO_SHIFTSTATE_STATE_MASK);
497 uint32_t reg = base->TIMCFG[index];
499 reg &= ~FLEXIO_TIMCFG_TIMDEC_MASK;
503 base->TIMCFG[index] = reg;
521static inline void FLEXIO_EnableShifterStatusInterrupts(
FLEXIO_Type *base, uint32_t mask)
523 base->SHIFTSIEN |= mask;
534static inline void FLEXIO_DisableShifterStatusInterrupts(
FLEXIO_Type *base, uint32_t mask)
536 base->SHIFTSIEN &= ~mask;
547static inline void FLEXIO_EnableShifterErrorInterrupts(
FLEXIO_Type *base, uint32_t mask)
549 base->SHIFTEIEN |= mask;
560static inline void FLEXIO_DisableShifterErrorInterrupts(
FLEXIO_Type *base, uint32_t mask)
562 base->SHIFTEIEN &= ~mask;
573static inline void FLEXIO_EnableTimerStatusInterrupts(
FLEXIO_Type *base, uint32_t mask)
575 base->TIMIEN |= mask;
586static inline void FLEXIO_DisableTimerStatusInterrupts(
FLEXIO_Type *base, uint32_t mask)
588 base->TIMIEN &= ~mask;
604static inline uint32_t FLEXIO_GetShifterStatusFlags(
FLEXIO_Type *base)
606 return ((base->SHIFTSTAT) & FLEXIO_SHIFTSTAT_SSF_MASK);
617static inline void FLEXIO_ClearShifterStatusFlags(
FLEXIO_Type *base, uint32_t mask)
619 base->SHIFTSTAT = mask;
628static inline uint32_t FLEXIO_GetShifterErrorFlags(
FLEXIO_Type *base)
630 return ((base->SHIFTERR) & FLEXIO_SHIFTERR_SEF_MASK);
641static inline void FLEXIO_ClearShifterErrorFlags(
FLEXIO_Type *base, uint32_t mask)
643 base->SHIFTERR = mask;
652static inline uint32_t FLEXIO_GetTimerStatusFlags(
FLEXIO_Type *base)
654 return ((base->TIMSTAT) & FLEXIO_TIMSTAT_TSF_MASK);
665static inline void FLEXIO_ClearTimerStatusFlags(
FLEXIO_Type *base, uint32_t mask)
667 base->TIMSTAT = mask;
687static inline void FLEXIO_EnableShifterStatusDMA(
FLEXIO_Type *base, uint32_t mask,
bool enable)
691 base->SHIFTSDEN |= mask;
695 base->SHIFTSDEN &= ~mask;
730#if defined(__cplusplus)
#define FLEXIO_TIMCFG_TIMDEC(x)
Definition: MIMXRT1052.h:21034
enum _clock_ip_name clock_ip_name_t
CCM CCGR gate control for each module independently.
void FLEXIO_SetShifterConfig(FLEXIO_Type *base, uint8_t index, const flexio_shifter_config_t *shifterConfig)
Configures the shifter with the shifter configuration. The configuration structure covers both the SH...
Definition: fsl_flexio.c:247
enum _flexio_pin_polarity flexio_pin_polarity_t
Definition of pin polarity.
_flexio_timer_output
Define type of timer initial output or timer reset condition.
Definition: fsl_flexio.h:74
bool enableInDebug
Definition: fsl_flexio.h:243
flexio_timer_enable_condition_t timerEnable
Definition: fsl_flexio.h:269
bool enableInDoze
Definition: fsl_flexio.h:242
enum _flexio_pin_config flexio_pin_config_t
Define type of timer/shifter pin configuration.
enum _flexio_shifter_mode flexio_shifter_mode_t
Define type of shifter working mode.
flexio_timer_trigger_source_t triggerSource
Definition: fsl_flexio.h:254
_flexio_pin_polarity
Definition of pin polarity.
Definition: fsl_flexio.h:58
enum _flexio_shifter_start_bit flexio_shifter_start_bit_t
Define type of START bit configuration.
struct _flexio_timer_config flexio_timer_config_t
Define FlexIO timer configuration structure.
flexio_shifter_timer_polarity_t timerPolarity
Definition: fsl_flexio.h:282
void(* flexio_isr_t)(void *base, void *handle)
typedef for FlexIO simulated driver interrupt handler.
Definition: fsl_flexio.h:298
_flexio_shifter_timer_polarity
Define type of timer polarity for shifter control.
Definition: fsl_flexio.h:171
flexio_shifter_stop_bit_t shifterStop
Definition: fsl_flexio.h:293
flexio_shifter_start_bit_t shifterStart
Definition: fsl_flexio.h:294
enum _flexio_timer_output_state flexio_timer_output_state_t
FlexIO as PWM channel output state.
enum _flexio_shifter_input_source flexio_shifter_input_source_t
Define type of shifter input source.
_flexio_timer_disable_condition
Define type of timer disable condition.
Definition: fsl_flexio.h:121
enum _flexio_timer_mode flexio_timer_mode_t
Define type of timer work mode.
flexio_pin_config_t pinConfig
Definition: fsl_flexio.h:256
void FLEXIO_Deinit(FLEXIO_Type *base)
Gates the FlexIO clock. Call this API to stop the FlexIO clock.
Definition: fsl_flexio.c:120
flexio_pin_polarity_t pinPolarity
Definition: fsl_flexio.h:258
_flexio_shifter_start_bit
Define type of START bit configuration.
Definition: fsl_flexio.h:211
status_t FLEXIO_UnregisterHandleIRQ(void *base)
Unregisters the handle and the interrupt handler for the FlexIO-simulated peripheral.
Definition: fsl_flexio.c:356
uint32_t triggerSelect
Definition: fsl_flexio.h:252
void FLEXIO_Reset(FLEXIO_Type *base)
Resets the FlexIO module.
Definition: fsl_flexio.c:158
_flexio_shifter_buffer_type
Define FlexIO shifter buffer type.
Definition: fsl_flexio.h:222
enum _flexio_timer_reset_condition flexio_timer_reset_condition_t
Define type of timer reset condition.
_flexio_timer_trigger_polarity
Define time of timer trigger polarity.
Definition: fsl_flexio.h:35
uint32_t pinSelect
Definition: fsl_flexio.h:285
flexio_timer_trigger_polarity_t triggerPolarity
Definition: fsl_flexio.h:253
flexio_timer_stop_bit_condition_t timerStop
Definition: fsl_flexio.h:271
_flexio_timer_enable_condition
Define type of timer enable condition.
Definition: fsl_flexio.h:134
flexio_timer_start_bit_condition_t timerStart
Definition: fsl_flexio.h:272
_flexio_timer_mode
Define type of timer work mode.
Definition: fsl_flexio.h:65
_flexio_timer_output_state
FlexIO as PWM channel output state.
Definition: fsl_flexio.h:164
const clock_ip_name_t s_flexioClocks[]
Pointers to flexio clocks for each instance.
Definition: fsl_flexio.c:31
void FLEXIO_SetTimerConfig(FLEXIO_Type *base, uint8_t index, const flexio_timer_config_t *timerConfig)
Configures the timer with the timer configuration. The configuration structure covers both the TIMCTL...
Definition: fsl_flexio.c:292
flexio_timer_mode_t timerMode
Definition: fsl_flexio.h:260
flexio_shifter_mode_t shifterMode
Definition: fsl_flexio.h:288
enum _flexio_shifter_timer_polarity flexio_shifter_timer_polarity_t
Define type of timer polarity for shifter control.
uint32_t pinSelect
Definition: fsl_flexio.h:257
uint32_t FLEXIO_GetShifterBufferAddress(FLEXIO_Type *base, flexio_shifter_buffer_type_t type, uint8_t index)
Gets the shifter buffer address for the DMA transfer usage.
Definition: fsl_flexio.c:173
void FLEXIO_GetDefaultConfig(flexio_config_t *userConfig)
Gets the default configuration to configure the FlexIO module. The configuration can used directly to...
Definition: fsl_flexio.c:140
enum _flexio_shifter_buffer_type flexio_shifter_buffer_type_t
Define FlexIO shifter buffer type.
_flexio_shifter_mode
Define type of shifter working mode.
Definition: fsl_flexio.h:178
uint32_t FLEXIO_GetInstance(FLEXIO_Type *base)
Get instance number for FLEXIO module.
Definition: fsl_flexio.c:55
struct _flexio_config_ flexio_config_t
Define FlexIO user configuration structure.
FLEXIO_Type *const s_flexioBases[]
Pointers to flexio bases for each instance.
Definition: fsl_flexio.c:27
enum _flexio_timer_trigger_polarity flexio_timer_trigger_polarity_t
Define time of timer trigger polarity.
status_t FLEXIO_RegisterHandleIRQ(void *base, void *handle, flexio_isr_t isr)
Registers the handle and the interrupt handler for the FlexIO-simulated peripheral.
Definition: fsl_flexio.c:318
flexio_shifter_input_source_t inputSource
Definition: fsl_flexio.h:292
flexio_timer_decrement_source_t timerDecrement
Definition: fsl_flexio.h:263
enum _flexio_timer_decrement_source flexio_timer_decrement_source_t
Define type of timer decrement.
flexio_pin_polarity_t pinPolarity
Definition: fsl_flexio.h:286
_flexio_timer_start_bit_condition
Define type of timer start bit generate condition.
Definition: fsl_flexio.h:157
enum _flexio_timer_enable_condition flexio_timer_enable_condition_t
Define type of timer enable condition.
uint32_t timerCompare
Definition: fsl_flexio.h:273
enum _flexio_timer_trigger_source flexio_timer_trigger_source_t
Define type of timer trigger source.
bool enableFlexio
Definition: fsl_flexio.h:241
flexio_timer_reset_condition_t timerReset
Definition: fsl_flexio.h:265
_flexio_timer_decrement_source
Define type of timer decrement.
Definition: fsl_flexio.h:85
uint32_t timerSelect
Definition: fsl_flexio.h:280
_flexio_shifter_input_source
Define type of shifter input source.
Definition: fsl_flexio.h:196
enum _flexio_timer_stop_bit_condition flexio_timer_stop_bit_condition_t
Define type of timer stop bit generate condition.
_flexio_timer_trigger_source
Define type of timer trigger source.
Definition: fsl_flexio.h:42
_flexio_timer_reset_condition
Define type of timer reset condition.
Definition: fsl_flexio.h:109
struct _flexio_shifter_config flexio_shifter_config_t
Define FlexIO shifter configuration structure.
enum _flexio_timer_start_bit_condition flexio_timer_start_bit_condition_t
Define type of timer start bit generate condition.
flexio_timer_disable_condition_t timerDisable
Definition: fsl_flexio.h:267
enum _flexio_timer_disable_condition flexio_timer_disable_condition_t
Define type of timer disable condition.
void FLEXIO_Init(FLEXIO_Type *base, const flexio_config_t *userConfig)
Configures the FlexIO with a FlexIO configuration. The configuration structure can be filled by the u...
Definition: fsl_flexio.c:91
flexio_pin_config_t pinConfig
Definition: fsl_flexio.h:284
_flexio_pin_config
Define type of timer/shifter pin configuration.
Definition: fsl_flexio.h:49
enum _flexio_timer_output flexio_timer_output_t
Define type of timer initial output or timer reset condition.
bool enableFastAccess
Definition: fsl_flexio.h:244
enum _flexio_shifter_stop_bit flexio_shifter_stop_bit_t
Define of STOP bit configuration.
_flexio_timer_stop_bit_condition
Define type of timer stop bit generate condition.
Definition: fsl_flexio.h:147
flexio_timer_output_t timerOutput
Definition: fsl_flexio.h:261
_flexio_shifter_stop_bit
Define of STOP bit configuration.
Definition: fsl_flexio.h:203
@ kFLEXIO_TimerOutputOneNotAffectedByReset
Definition: fsl_flexio.h:75
@ kFLEXIO_TimerOutputOneAffectedByReset
Definition: fsl_flexio.h:79
@ kFLEXIO_TimerOutputZeroNotAffectedByReset
Definition: fsl_flexio.h:77
@ kFLEXIO_TimerOutputZeroAffectedByReset
Definition: fsl_flexio.h:80
@ kFLEXIO_PinActiveLow
Definition: fsl_flexio.h:60
@ kFLEXIO_PinActiveHigh
Definition: fsl_flexio.h:59
@ kFLEXIO_ShifterTimerPolarityOnNegitive
Definition: fsl_flexio.h:173
@ kFLEXIO_ShifterTimerPolarityOnPositive
Definition: fsl_flexio.h:172
@ kFLEXIO_TimerDisableOnPinBothEdge
Definition: fsl_flexio.h:126
@ kFLEXIO_TimerDisableOnPreTimerDisable
Definition: fsl_flexio.h:123
@ kFLEXIO_TimerDisableOnTriggerFallingEdge
Definition: fsl_flexio.h:129
@ kFLEXIO_TimerDisableNever
Definition: fsl_flexio.h:122
@ kFLEXIO_TimerDisableOnTimerCompare
Definition: fsl_flexio.h:124
@ kFLEXIO_TimerDisableOnTimerCompareTriggerLow
Definition: fsl_flexio.h:125
@ kFLEXIO_TimerDisableOnPinBothEdgeTriggerHigh
Definition: fsl_flexio.h:127
@ kFLEXIO_ShifterStartBitHigh
Definition: fsl_flexio.h:217
@ kFLEXIO_ShifterStartBitLow
Definition: fsl_flexio.h:216
@ kFLEXIO_ShifterStartBitDisabledLoadDataOnEnable
Definition: fsl_flexio.h:212
@ kFLEXIO_ShifterStartBitDisabledLoadDataOnShift
Definition: fsl_flexio.h:214
@ kFLEXIO_ShifterBufferBitSwapped
Definition: fsl_flexio.h:224
@ kFLEXIO_ShifterBuffer
Definition: fsl_flexio.h:223
@ kFLEXIO_ShifterBufferBitByteSwapped
Definition: fsl_flexio.h:226
@ kFLEXIO_ShifterBufferByteSwapped
Definition: fsl_flexio.h:225
@ kFLEXIO_TimerTriggerPolarityActiveLow
Definition: fsl_flexio.h:37
@ kFLEXIO_TimerTriggerPolarityActiveHigh
Definition: fsl_flexio.h:36
@ kFLEXIO_TimerEnableOnPrevTimerEnable
Definition: fsl_flexio.h:136
@ kFLEXIO_TimerEnabledAlways
Definition: fsl_flexio.h:135
@ kFLEXIO_TimerEnableOnPinRisingEdge
Definition: fsl_flexio.h:139
@ kFLEXIO_TimerEnableOnTriggerHighPinHigh
Definition: fsl_flexio.h:138
@ kFLEXIO_TimerEnableOnTriggerBothEdge
Definition: fsl_flexio.h:142
@ kFLEXIO_TimerEnableOnTriggerRisingEdge
Definition: fsl_flexio.h:141
@ kFLEXIO_TimerEnableOnTriggerHigh
Definition: fsl_flexio.h:137
@ kFLEXIO_TimerEnableOnPinRisingEdgeTriggerHigh
Definition: fsl_flexio.h:140
@ kFLEXIO_TimerModeDual8BitPWM
Definition: fsl_flexio.h:68
@ kFLEXIO_TimerModeDual8BitBaudBit
Definition: fsl_flexio.h:67
@ kFLEXIO_TimerModeSingle16Bit
Definition: fsl_flexio.h:69
@ kFLEXIO_TimerModeDisabled
Definition: fsl_flexio.h:66
@ kFLEXIO_PwmHigh
Definition: fsl_flexio.h:166
@ kFLEXIO_PwmLow
Definition: fsl_flexio.h:165
@ kFLEXIO_ShifterModeMatchStore
Definition: fsl_flexio.h:182
@ kFLEXIO_ShifterDisabled
Definition: fsl_flexio.h:179
@ kFLEXIO_ShifterModeReceive
Definition: fsl_flexio.h:180
@ kFLEXIO_ShifterModeMatchContinuous
Definition: fsl_flexio.h:183
@ kFLEXIO_ShifterModeTransmit
Definition: fsl_flexio.h:181
@ kFLEXIO_TimerStartBitDisabled
Definition: fsl_flexio.h:158
@ kFLEXIO_TimerStartBitEnabled
Definition: fsl_flexio.h:159
@ kFLEXIO_TimerDecSrcOnTriggerInputShiftTriggerInput
Definition: fsl_flexio.h:92
@ kFLEXIO_TimerDecSrcOnFlexIOClockShiftTimerOutput
Definition: fsl_flexio.h:86
@ kFLEXIO_TimerDecSrcOnPinInputShiftPinInput
Definition: fsl_flexio.h:90
@ kFLEXIO_TimerDecSrcOnTriggerInputShiftTimerOutput
Definition: fsl_flexio.h:88
@ kFLEXIO_ShifterInputFromNextShifterOutput
Definition: fsl_flexio.h:198
@ kFLEXIO_ShifterInputFromPin
Definition: fsl_flexio.h:197
@ kFLEXIO_TimerTriggerSourceInternal
Definition: fsl_flexio.h:44
@ kFLEXIO_TimerTriggerSourceExternal
Definition: fsl_flexio.h:43
@ kFLEXIO_TimerResetOnTimerPinRisingEdge
Definition: fsl_flexio.h:114
@ kFLEXIO_TimerResetNever
Definition: fsl_flexio.h:110
@ kFLEXIO_TimerResetOnTimerTriggerRisingEdge
Definition: fsl_flexio.h:115
@ kFLEXIO_TimerResetOnTimerTriggerEqualToTimerOutput
Definition: fsl_flexio.h:112
@ kFLEXIO_TimerResetOnTimerPinEqualToTimerOutput
Definition: fsl_flexio.h:111
@ kFLEXIO_TimerResetOnTimerTriggerBothEdge
Definition: fsl_flexio.h:116
@ kFLEXIO_PinConfigOutputDisabled
Definition: fsl_flexio.h:50
@ kFLEXIO_PinConfigOutput
Definition: fsl_flexio.h:53
@ kFLEXIO_PinConfigOpenDrainOrBidirection
Definition: fsl_flexio.h:51
@ kFLEXIO_PinConfigBidirectionOutputData
Definition: fsl_flexio.h:52
@ kFLEXIO_TimerStopBitEnableOnTimerCompare
Definition: fsl_flexio.h:149
@ kFLEXIO_TimerStopBitDisabled
Definition: fsl_flexio.h:148
@ kFLEXIO_TimerStopBitEnableOnTimerCompareDisable
Definition: fsl_flexio.h:151
@ kFLEXIO_TimerStopBitEnableOnTimerDisable
Definition: fsl_flexio.h:150
@ kFLEXIO_ShifterStopBitLow
Definition: fsl_flexio.h:205
@ kFLEXIO_ShifterStopBitHigh
Definition: fsl_flexio.h:206
@ kFLEXIO_ShifterStopBitDisable
Definition: fsl_flexio.h:204
int32_t status_t
Type used for all status and error return values.
Definition: fsl_common.h:225
Definition: MIMXRT1052.h:20511
Define FlexIO user configuration structure.
Definition: fsl_flexio.h:240
Define FlexIO shifter configuration structure.
Definition: fsl_flexio.h:278
Define FlexIO timer configuration structure.
Definition: fsl_flexio.h:250