MCXL255
AON_LPADC: 12-bit single-ended SAR Analog-to-Digital Converter Driver
-
void ADC_GetDefaultConfig(adc_config_t *config)
Gets an available pre-defined settings for ADC configuration.
- Parameters:
config – Pointer to ADC configuration structure, adc_config_t.
-
void ADC_Init(LPADC_Type *base, const adc_config_t *config)
Initializes the ADC module.
- Parameters:
base – ADC peripheral base address.
config – Pointer to configuration structure, adc_config_t.
-
void ADC_Deinit(LPADC_Type *base)
De-initializes the ADC module.
- Parameters:
base – ADC peripheral base address.
-
static inline void ADC_Enable(LPADC_Type *base, bool enable)
Enable/disable the ADC module.
- Parameters:
base – ADC peripheral base address.
enable – Indicates whether to enable the ADC module. - true Enable the ADC module. - false Disable the ADC module.
-
static inline void ADC_DoFifoRst(LPADC_Type *base, adc_fifo_index_t index)
Reset ADC FIFO.
- Parameters:
base – ADC peripheral base address.
index – ADC FIFO index, adc_fifo_index_t
-
static inline void ADC_DoSoftWareRst(LPADC_Type *base)
Software reset ADC module.
- Parameters:
base – ADC peripheral base address.
-
static inline uint32_t ADC_GetStatusFlags(LPADC_Type *base)
Get ADC status flags.
- Parameters:
base – ADC peripheral base address.
- Returns:
Mask value for ADC status flags to be got, should be the OR’ed value of _adc_status_flags.
-
static inline void ADC_ClearStatusFlags(LPADC_Type *base, uint32_t mask)
Clear ADC status flags.
Note
Only the flags can be cleared by writing ADCx_STATUS register would be cleared by this API.
- Parameters:
base – ADC peripheral base address.
mask – Mask value for ADC status flags to be cleared, should be the OR’ed value of _adc_status_flags.
-
static inline uint32_t ADC_GetTriggerStatusFlags(LPADC_Type *base)
Get ADC trigger status flags.
- Parameters:
base – ADC peripheral base address.
- Returns:
Mask value for ADC trigger status flags to be got, should be the OR’ed value of _adc_trig_status_flags.
-
static inline void ADC_ClearTriggerStatusFlags(LPADC_Type *base, uint32_t mask)
Clear ADC trigger status flags.
- Parameters:
base – ADC peripheral base address.
mask – Mask value for ADC trigger status flags to be cleared, should be the OR’ed value of _adc_trig_status_flags.
-
static inline void ADC_EnableInt(LPADC_Type *base, uint32_t mask)
Enable interrupts.
- Parameters:
base – ADC peripheral base address.
mask – Mask value for interrupt events to be enabled, should be the OR’ed value of _adc_int_en.
-
static inline void ADC_DisableInt(LPADC_Type *base, uint32_t mask)
Disable interrupts.
- Parameters:
base – ADC peripheral base address.
mask – Mask value for interrupt events to be disabled, should be the OR’ed value of _adc_int_en.
-
static inline void ADC_EnableFifoWatermarkDma(LPADC_Type *base, adc_fifo_index_t index, bool enable)
Enable/disable the specified ADC FIFO watermark DAM transfer.
- Parameters:
base – ADC peripheral base address.
index – ADC FIFO index, adc_fifo_index_t
enable – Indicates whether to enable the specified ADC FIFO watermark DAM transfer. true Enable the specified ADC FIFO watermark DMA transfer. false Disable the specified ADC FIFO watermark DMA transfer.
-
void ADC_GetDefaultTrigConfig(adc_trig_config_t *config)
Gets an available pre-defined settings for ADC trigger’s configuration.
- Parameters:
config – Pointer to ADC trigger configuration structure, adc_trig_config_t.
-
void ADC_SetTrigConfig(LPADC_Type *base, adc_trig_index_t index, const adc_trig_config_t *config)
Configure the ADC trigger source.
- Parameters:
base – ADC peripheral base address.
index – ADC trigger index, adc_trig_index_t.
config – Pointer to ADC trigger configuration structure, adc_trig_config_t.
-
static inline void ADC_DoSoftwareTrig(LPADC_Type *base, adc_trig_index_t index)
Do software trigger.
- Parameters:
base – ADC peripheral base address.
index – ADC trigger index, adc_trig_index_t.
-
static inline uint32_t ADC_GetResFifoCnt(LPADC_Type *base, adc_fifo_index_t index)
Get the count of result kept in specified ADC conversion result FIFO.
- Parameters:
base – ADC peripheral base address.
index – ADC FIFO index, adc_fifo_index_t
- Returns:
The count of result kept in specified ADC conversion result FIFO.
-
bool ADC_GetConvRes(LPADC_Type *base, adc_conv_res_t *result, adc_fifo_index_t index)
Get the result in specified conversion FIFO.
- Parameters:
base – ADC peripheral base address.
result – Pointer to ADC result structure, adc_conv_res_t.
index – ADC FIFO index, adc_fifo_index_t
- Returns:
Status whether FIFO entry is valid. - true Conversion FIFO result is valid. - false Conversion FIFO result is invalid.
-
void ADC_GetDefaultCmdConfig(adc_cmd_config_t *config)
Gets an available pre-defined settings for ADC command’s configuration.
- Parameters:
config – Pointer to ADC command configuration structure, adc_cmd_config_t.
-
void ADC_SetCmdConfig(LPADC_Type *base, adc_cmd_index_t index, const adc_cmd_config_t *config)
Do ADC command configuration.
- Parameters:
base – ADC peripheral base address.
index – ADC command index, adc_cmd_index_t.
config – Pointer to ADC commad configuration structure, adc_cmd_config_t.
-
static inline void ADC_SetOffsetTrimVal(LPADC_Type *base, uint8_t value)
Set trim value for offset.
- Parameters:
base – ADC peripheral base address.
value – 8-bit unsigned value that should be limited to values between 0h to A0h, with a nominal value of 50h.
-
static inline void ADC_GetOffsetTrimVal(LPADC_Type *base, uint8_t *pValue)
Get trim value of offset.
- Parameters:
base – ADC peripheral base address.
pValue – Pointer to the variable in type of uint8_t to store offset value.
-
void ADC_DoOffsetCal(LPADC_Type *base)
Do offset calibration.
- Parameters:
base – ADC peripheral base address.
-
FSL_AON_LPADC_DRIVER_VERSION
AON_LPADC driver version 2.0.1.
-
enum _adc_status_flags
ADC status flags enumeration.
Values:
-
enumerator kADC_ResFifo0RdyFlag
Indicates when the number of valid datawords in the result FIFO 0 is greater than the setting watermark level.
-
enumerator kADC_ResFifo0OverflowFlag
Indicates that more data has been written to the result FIFO 0 than it can hold.
-
enumerator kADC_ResFifo1RdyFlag
Indicates when the number of valid datawords in the result FIFO 1 is greater than the setting watermark level.
-
enumerator kADC_ResFifo1OverflowFlag
Indicates that more data has been written to the result FIFO 1 than it can hold.
-
enumerator kADC_TrigExcFlag
Indicates that a high priority trigger exception event has occurred.
-
enumerator kADC_TrigCompFlag
Indicates that a trigger sequence has occurred.
-
enumerator kADC_CalRdyFlag
Indicates that the calibration process is done.
-
enumerator kADC_ActFlag
Indicates that the ADC is in active state.
-
enumerator kADC_TrigAct
Indicates that the trigger is actively being processed.
-
enumerator kADC_CmdAct
Indicates that the command is actively being processed.
-
enumerator kADC_ResFifo0RdyFlag
-
enum _adc_trig_status_flags
ADC trigger status flags enumeration.
Values:
-
enumerator kADC_Trig0IntFlag
Indicates trigger 0 is interrupted by a high priority exception.
-
enumerator kADC_Trig1IntFlag
Indicates trigger 1 is interrupted by a high priority exception.
-
enumerator kADC_Trig2IntFlag
Indicates trigger 2 is interrupted by a high priority exception.
-
enumerator kADC_Trig3IntFlag
Indicates trigger 3 is interrupted by a high priority exception.
-
enumerator kADC_Trig0CompFlag
Indicates trigger 0 is completed and trigger 0 has enabled completion interrupts.
-
enumerator kADC_Trig1CompFlag
Indicates trigger 1 is completed and trigger 1 has enabled completion interrupts.
-
enumerator kADC_Trig2CompFlag
Indicates trigger 2 is completed and trigger 2 has enabled completion interrupts.
-
enumerator kADC_Trig3CompFlag
Indicates trigger 3 is completed and trigger 3 has enabled completion interrupts.
-
enumerator kADC_Trig0IntFlag
-
enum _adc_int_en
ADC interrupt enablement mask enumeration.
Values:
-
enumerator kADC_ResFifo0WatermarkIntEn
Configures ADC to generate overflow interrupt requests when FIFO0 ready flag is asserted.
-
enumerator kADC_ResFifo0OverflowIntEn
Configures ADC to generate overflow interrupt requests when FIFO0 overflow flag is asserted.
-
enumerator kADC_ResFifo1WatermarkIntEn
Configures ADC to generate overflow interrupt requests when FIFO1 ready flag is asserted.
-
enumerator kADC_ResFifo1OverflowIntEn
Configures ADC to generate overflow interrupt requests when FIFO1 overflow flag is asserted.
-
enumerator kADC_TrigExcIntEn
Configures ADC to generate trigger exception interrupt.
-
enumerator kADC_Trig0CompIntEn
Configures ADC to generate interrupt when trigger 0 completion.
-
enumerator kADC_Trig1CompIntEn
Configures ADC to generate interrupt when trigger 1 completion.
-
enumerator kADC_Trig2CompIntEn
Configures ADC to generate interrupt when trigger 2 completion.
-
enumerator kADC_Trig3CompIntEn
Configures ADC to generate interrupt when trigger 3 completion.
-
enumerator kADC_ResFifo0WatermarkIntEn
-
enum _adc_cal_conv_avg
ADC calibration conversion averages enumeration.
Values:
-
enumerator kADC_CalConvAvg0
Single conversion.
-
enumerator kADC_CalConvAvg2
2 conversions averaged.
-
enumerator kADC_CalConvAvg4
4 conversions averaged.
-
enumerator kADC_CalConvAvg8
8 conversions averaged.
-
enumerator kADC_CalConvAvg16
16 conversions averaged.
-
enumerator kADC_CalConvAvg32
32 conversions averaged.
-
enumerator kADC_CalConvAvg64
64 conversions averaged.
-
enumerator kADC_CalConvAvg128
128 conversions averaged.
-
enumerator kADC_CalConvAvg256
256 conversions averaged.
-
enumerator kADC_CalConvAvg512
512 conversions averaged.
-
enumerator kADC_CalConvAvg1024
1024 conversions averaged.
-
enumerator kADC_CalConvAvg0
-
enum _adc_cal_conv_sample_time
ADC calibration conversion sample time enumeration.
Values:
-
enumerator kADC_CalConvSampTime_AdckCycle0
1 ADCK cycles sample time.
-
enumerator kADC_CalConvSampTime_AdckCycle1
2 ADCK cycles sample time.
-
enumerator kADC_CalConvSampTime_AdckCycle2
3 ADCK cycles sample time.
-
enumerator kADC_CalConvSampTime_AdckCycle3
4 ADCK cycles sample time.
-
enumerator kADC_CalConvSampTime_AdckCycle4
5 ADCK cycles sample time.
-
enumerator kADC_CalConvSampTime_AdckCycle5
6 ADCK cycles sample time.
-
enumerator kADC_CalConvSampTime_AdckCycle6
7 ADCK cycles sample time.
-
enumerator kADC_CalConvSampTime_AdckCycle7
8 ADCK cycles sample time.
-
enumerator kADC_CalConvSampTime_AdckCycle0
-
enum _adc_fifo_index
ADC FIFO enumeration.
Values:
-
enumerator kADC_Fifo0
FIFO 0.
-
enumerator kADC_Fifo1
FIFO 1.
-
enumerator kADC_Fifo0
-
enum _adc_trig_index
ADC trigger enumeration.
Values:
-
enumerator kADC_Trig0
Trigger 0.
-
enumerator kADC_Trig1
Trigger 1.
-
enumerator kADC_Trig2
Trigger 2.
-
enumerator kADC_Trig3
Trigger 3.
-
enumerator kADC_Trig0
-
enum _adc_trig_cmd_index
ADC trigger command enumeration.
Values:
-
enumerator kADC_CmdNone
Not a valid selection from the command buffer, trigger event is ignored.
-
enumerator kADC_Cmd1
Trigger commad 1.
-
enumerator kADC_Cmd2
Trigger commad 2.
-
enumerator kADC_Cmd3
Trigger commad 3.
-
enumerator kADC_Cmd4
Trigger commad 4.
-
enumerator kADC_Cmd5
Trigger commad 5.
-
enumerator kADC_Cmd6
Trigger commad 6.
-
enumerator kADC_Cmd7
Trigger commad 7.
-
enumerator kADC_CmdNone
-
enum _adc_conv_avg
ADC hardware conversion averages enumeration.
Values:
-
enumerator kADC_ConvAvg1
Single conversion.
-
enumerator kADC_ConvAvg2
2 conversions averaged.
-
enumerator kADC_ConvAvg4
4 conversions averaged.
-
enumerator kADC_ConvAvg8
8 conversions averaged.
-
enumerator kADC_ConvAvg16
16 conversions averaged.
-
enumerator kADC_ConvAvg32
32 conversions averaged.
-
enumerator kADC_ConvAvg64
64 conversions averaged.
-
enumerator kADC_ConvAvg128
128 conversions averaged.
-
enumerator kADC_ConvAvg256
256 conversions averaged.
-
enumerator kADC_ConvAvg512
512 conversions averaged.
-
enumerator kADC_ConvAvg1024
1024 conversions averaged.
-
enumerator kADC_ConvAvg1
-
enum _adc_sample_time
ADC conversion sample time enumeration.
Values:
-
enumerator kADC_ConvSampleTime_AdcCycle1
1 ADCK cycles.
-
enumerator kADC_ConvSampleTime_AdcCycle2
2 ADCK cycles.
-
enumerator kADC_ConvSampleTime_AdcCycle3
3 ADCK cycles.
-
enumerator kADC_ConvSampleTime_AdcCycle4
4 ADCK cycles.
-
enumerator kADC_ConvSampleTime_AdcCycle5
5 ADCK cycles.
-
enumerator kADC_ConvSampleTime_AdcCycle6
6 ADCK cycles.
-
enumerator kADC_ConvSampleTime_AdcCycle7
7 ADCK cycles.
-
enumerator kADC_ConvSampleTime_AdcCycle8
8 ADCK cycles.
-
enumerator kADC_ConvSampleTime_AdcCycle10
10 ADCK cycles.
-
enumerator kADC_ConvSampleTime_AdcCycle12
12 ADCK cycles.
-
enumerator kADC_ConvSampleTime_AdcCycle16
16 ADCK cycles.
-
enumerator kADC_ConvSampleTime_AdcCycle24
24 ADCK cycles.
-
enumerator kADC_ConvSampleTime_AdcCycle40
40 ADCK cycles.
-
enumerator kADC_ConvSampleTime_AdcCycle72
72 ADCK cycles.
-
enumerator kADC_ConvSampleTime_AdcCycle136
136 ADCK cycles.
-
enumerator kADC_ConvSampleTime_AdcCycle264
264 ADCK cycles.
-
enumerator kADC_ConvSampleTime_AdcCycle1
-
enum _adc_comp_mode
ADC hardware compare mode enumeration.
Note
After an ADC channel input is sampled and converted and any averaging iterations are performed, this mode setting guides operation of the automatic compare function to optionally only store when the compare operation is true. When compare is enabled, the conversion result is compared to the compare values.
Values:
-
enumerator kADC_CompareDisabled
Compare disabled.
-
enumerator kADC_CompareStoreOnTrue
Compare enabled. Store on true.
-
enumerator kADC_CompareRepeatUntilTrue
Compare enabled. Repeat channel acquisition until true.
-
enumerator kADC_CompareDisabled
-
enum _adc_ref_voltage_src
ADC reference voltage source enumeration.
Values:
-
enumerator kADC_RefVoltageAlt1
Option 1 setting.
-
enumerator kADC_RefVoltageAlt2
Option 2 setting.
-
enumerator kADC_RefVoltageAlt1
-
enum _adc_dac_settle_delay
ADC DAC settle time enumeration.
Values:
-
enumerator kADC_FastDacSettleTime
Fastest settling
-
enumerator kADC_SlowDacSettleTime
Slowest settling
-
enumerator kADC_FastDacSettleTime
-
enum _adc_trig_priority_policy
ADC trigger priority exception handle policy enumeration.
Values:
-
enumerator kADC_ConvPreemptImmedNotAutoResumed
If a higher priority trigger is detected during command processing, the current conversion is aborted and the new command specified by the trigger is started, when higher priority conversion finishes, the preempted conversion is not automatically resumed or restarted.
-
enumerator kADC_ConvPreemptSoftlyNotAutoResumed
If a higher priority trigger is received during command processing, the current conversion is completed (including averaging iterations and compare function if enabled) and stored to the result FIFO before the higher priority trigger/command is initiated, when higher priority conversion finishes, the preempted conversion is not resumed or restarted.
-
enumerator kADC_ConvPreemptImmedAutoRestarted
If a higher priority trigger is detected during command processing, the current conversion is aborted and the new command specified by the trigger is started, when higher priority conversion finishes, the preempted conversion will automatically be restarted.
-
enumerator kADC_ConvPreemptSoftlyAutoRestarted
If a higher priority trigger is received during command processing, the current conversion is completed (including averaging iterations and compare function if enabled) and stored to the result FIFO before the higher priority trigger/command is initiated, when higher priority conversion finishes, the preempted conversion will automatically be restarted.
-
enumerator kADC_ConvPreemptImmedAutoResumed
If a higher priority trigger is detected during command processing, the current conversion is aborted and the new command specified by the trigger is started, when higher priority conversion finishes, the preempted conversion will automatically be resumed.
-
enumerator kADC_ConvPreemptSoftlyAutoResumed
If a higher priority trigger is received during command processing, the current conversion is completed (including averaging iterations and compare function if enabled) and stored to the result FIFO before the higher priority trigger/command is initiated, when higher priority conversion finishes, the preempted conversion will be automatically be resumed.
-
enumerator kADC_ConvPreemptSubsequentlyNotAutoResumed
If a higher priority trigger is received during command processing, the current command will be completed (averaging, looping, compare) before servicing the higher priority trigger, when higher priority conversion finishes, the preempted conversion will not automatically be restarted or resumed.
-
enumerator kADC_ConvPreemptSubsequentlyAutoRestarted
If a higher priority trigger is received during command processing, the current command will be completed (averaging, looping, compare) before servicing the higher priority trigger, when higher priority conversion finishes, the preempted conversion will be automatically restarted.
-
enumerator kADC_ConvPreemptSubsequentlyAutoResumed
If a higher priority trigger is received during command processing, the current command will be completed (averaging, looping, compare) before servicing the higher priority trigger, when higher priority conversion finishes, the preempted conversion will be automatically resumed.
-
enumerator kADC_TriggerPriorityExceptionDisabled
High priority trigger exception disabled.
-
enumerator kADC_ConvPreemptImmedNotAutoResumed
-
typedef enum _adc_cal_conv_avg adc_cal_conv_avg_t
ADC calibration conversion averages enumeration.
-
typedef enum _adc_cal_conv_sample_time adc_cal_conv_sample_time_t
ADC calibration conversion sample time enumeration.
-
typedef enum _adc_fifo_index adc_fifo_index_t
ADC FIFO enumeration.
-
typedef enum _adc_trig_index adc_trig_index_t
ADC trigger enumeration.
-
typedef enum _adc_trig_cmd_index adc_cmd_index_t
ADC trigger command enumeration.
-
typedef enum _adc_conv_avg adc_conv_avg_t
ADC hardware conversion averages enumeration.
-
typedef enum _adc_sample_time adc_conv_sample_time_t
ADC conversion sample time enumeration.
-
typedef enum _adc_comp_mode adc_comp_mode_t
ADC hardware compare mode enumeration.
Note
After an ADC channel input is sampled and converted and any averaging iterations are performed, this mode setting guides operation of the automatic compare function to optionally only store when the compare operation is true. When compare is enabled, the conversion result is compared to the compare values.
-
typedef enum _adc_ref_voltage_src adc_ref_voltage_src_t
ADC reference voltage source enumeration.
-
typedef enum _adc_dac_settle_delay adc_dac_settle_delay_t
ADC DAC settle time enumeration.
-
typedef enum _adc_trig_priority_policy adc_trig_priority_policy_t
ADC trigger priority exception handle policy enumeration.
-
typedef struct _adc_conv_res adc_conv_res_t
ADC conversion result structure.
-
typedef struct _adc_trig_config adc_trig_config_t
ADC trigger configuration structure.
-
typedef struct _adc_cmd_config adc_cmd_config_t
ADC command configuration structure.
-
typedef struct _adc_config adc_config_t
ADC configuration structure.
-
ADC_TRIG_PRIORITY_EXC_HANDLE_POLICY_EN(tprictrl, tres, tcmdres, hpted)
Trigger priority exception handle policy helper macro.
tprictrl: ADC Trigger Priority Control. 00b - If a higher priority trigger is detected during command processing, the current conversion is aborted and the new command specified by the trigger is started. 01b - If a higher priority trigger is received during command processing, the current command is stopped after completing the current conversion. If averaging is enabled, the averaging loop will be completed. However, CMDHa[LOOP] will be ignored and the higher priority trigger will be serviced. 10b - If a higher priority trigger is received during command processing, the current command will be completed (averaging, looping, compare) before servicing the higher priority trigger.
tres: Trigger Resume Enable. 0b - Trigger sequences interrupted by a high priority trigger exception are not automatically resumed or restarted. 1b - Trigger sequences interrupted by a high priority trigger exception are automatically resumed or restarted.
tcmdres: Trigger Command Resume, tres must be asserted for tcmdres to be used. 0b - Trigger sequences interrupted by a high priority trigger exception is automatically restarted. 1b - Trigger sequences interrupted by a high priority trigger exception is resumed from the command executing before the exception.
hpted: High Priority Trigger Exception Disable 0b - High priority trigger exceptions are enabled. 1b - High priority trigger exceptions are disabled.
-
ADC_TRIG_PRIORITY_EXC_HANDLE_POLICY_DE(policy)
-
struct _adc_conv_res
- #include <fsl_aon_lpadc.h>
ADC conversion result structure.
Public Members
-
uint8_t trigSrc
Indicate the trigger source that initiated a conversion and generated this result.
-
uint8_t cmdSrc
Indicate the command buffer being executed that generated this result.
-
uint8_t loopCnt
Indicate the loop count value during command execution that generated this result.
-
uint16_t convVal
ADC conversion result.
-
uint8_t trigSrc
-
struct _adc_trig_config
- #include <fsl_aon_lpadc.h>
ADC trigger configuration structure.
Public Members
-
bool trigEn
Controls hardware trigger source to initiate conversion on the rising edge of the input trigger source.
-
uint8_t trigDelay
Sets the trigger delay duration to wait at the start of servicing a trigger event.
-
uint8_t trigPriority
Sets the priority of the associated trigger source.
-
adc_fifo_index_t resFifo
Selects the FIFO to store the conversion result.
-
adc_cmd_index_t cmdIndex
Selects the trigger command from command buffer to execute upon detect of the associated trigger event.
-
bool trigEn
-
struct _adc_cmd_config
- #include <fsl_aon_lpadc.h>
ADC command configuration structure.
Public Members
-
bool waitTrigEn
Controls whether commands are automatically executed or a trigger must be received before execution.
-
bool autoChanIncEn
Controls whether enable automatic channel incrementing.
-
uint8_t loopCnt
Sets how many times this command executes (and stores conversion result to RESFIFO) before finish and transition to the next command or Idle state.
-
uint8_t chanIndex
Sets conversion channel.
-
uint16_t compValLow
Sets compare low value.
-
uint16_t compValHigh
Sets compare high value.
-
adc_conv_avg_t convAvg
Selects hardware average value.
-
adc_comp_mode_t compMode
Selects hardware compare mode.
-
adc_cmd_index_t nextCmdIndex
Selects the next command to execute after this command completes.
-
adc_conv_sample_time_t convSampleTime
Selects sample time value.
-
bool waitTrigEn
-
struct _adc_config
- #include <fsl_aon_lpadc.h>
ADC configuration structure.
Public Members
-
bool dozeModeEn
Controls system transition to low power modes while ADC is converting.
-
bool convPauseEn
Controls whether to enable the ADC pause function.
-
bool dynamicEleMatchEn
Controls whether to enable dynamic element match.
-
uint8_t compTime
Sets a configurable number of ADCK cycles to complete the compare phase of a conversion.
-
uint8_t convPauseDelay
Sets the duration of pausing during command execution sequencing.
-
uint8_t fifo0Watermark
Sets FIFO 0 watermark value.
-
adc_cal_conv_avg_t calConvAvg
Selects calibration conversion averages.
-
adc_ref_voltage_src_t refVoltageSrc
Selects the reference voltage source.
-
adc_dac_settle_delay_t dacSettleTime
Selects DAC settle delay.
-
adc_cal_conv_sample_time_t calConvSampTime
Selects calibration conversion sample time.
-
adc_trig_priority_policy_t trigPriorityPolicy
Selects trigger priority exception handle policy.
-
bool dozeModeEn
Clock Driver
-
enum _clock_ip_name
Clock gate name used for CLOCK_EnableClock/CLOCK_DisableClock.
Values:
-
enumerator kCLOCK_GateAonUART
Clock gate name: AON UART
-
enumerator kCLOCK_GateAonI2C
Clock gate name: AON I2C
-
enumerator kCLOCK_GateAonAPB
Clock gate name: AON APB
-
enumerator kCLOCK_GateAonPORT
Clock gate name: AON PORT
-
enumerator kCLOCK_GateAonGPIO
Clock gate name: AON GPIO
-
enumerator kCLOCK_GateAonQTMR0
Clock gate name: AON QTMR0
-
enumerator kCLOCK_GateAonQTMR1
Clock gate name: AON QTMR1
-
enumerator kCLOCK_GateAonLPTMR
Clock gate name: AON LPTMR
-
enumerator kCLOCK_GateAonKPP
Clock gate name: AON KPP
-
enumerator kCLOCK_GateAonLPADC
Clock gate name: AON LPADC
-
enumerator kCLOCK_GateAonSYS
Clock gate name: AON SYS (tick)
-
enumerator kCLOCK_GateAonCMP0
Clock gate name: AON comparator
-
enumerator kCLOCK_GateAonLCD
Clock gate name: AON LCD
-
enumerator kCLOCK_GateAonAVDC2P0
Clock gate name: AON AVDC2P0
-
enumerator kCLOCK_GateNotAvail
Clock gate name: None
-
enumerator kCLOCK_GateAonUART
-
enum _clock_name
Clock name used to get clock frequency.
Values:
-
enumerator kCLOCK_RtcOscClk
RTC OSC clock.
-
enumerator kCLOCK_Fro16k
AON PAC and SMM clock.
-
enumerator kCLOKC_FroAON
AON free runnin clock.
-
enumerator kCLOCK_RtcOscClk
-
enum _clock_select_name
Clock name used to get clock frequency.
Values:
-
enumerator kCLOKC_SelAonROOT_AUX
AON ROOT_AUX clock selection
-
enumerator kCLOKC_SelAonROOT
AON ROOT clock selection
-
enumerator kCLOKC_SelAonACMP0
AON ACMP0 clock selection
-
enumerator kCLOKC_SelAonLCD
AON LCD clock selection
-
enumerator kCLOKC_SelAonLPADC
AON LPADC clock selection
-
enumerator kCLOKC_SelAonSYSTICK
AON SYS tick clock selection
-
enumerator kCLOKC_SelAonKPP
AON KPP clock selection
-
enumerator kCLOKC_SelAonLPTMR
AON LPTMR GRP clock selection
-
enumerator kCLOKC_SelAonTMR
AON TMR GRP clock selection
-
enumerator kCLOKC_SelAonCOM
AON COM comaprator (aon_per_clk) clock selection
-
enumerator kCLOKC_SelAonROOT_AUX
-
enum _clock_attach_id
The enumerator of clock attach Id.
Values:
-
enumerator kXTAL32K_to_AON_ROOT_AUX
Attach XTAL32K to AON AUX.
-
enumerator kAUX_to_AON_ROOT_AUX
Attach AUX to AON AUX.
-
enumerator kFROdiv1_to_AON_CPU
Attach FRO div 1 to AON_CPU.
-
enumerator kFROdiv2_to_AON_CPU
Attach FRO div 2 to AON_CPU.
-
enumerator kFROdiv4_to_AON_CPU
Attach FRO div 4 to AON_CPU.
-
enumerator kROOT_AUX_to_AON_CPU
Attach ROOT AUX to AON_CPU.
-
enumerator kFROdiv1_to_AON_CMP0
Attach FRO div 1 to AON ACMP0.
-
enumerator kFROdiv2_to_AON_CMP0
Attach FRO div 2 to AON ACMP0.
-
enumerator kFROdiv4_to_AON_CMP0
Attach FRO div 4 to AON ACMP0.
-
enumerator kROOT_AUX_to_AON_CMP0
Attach ROOT AUX to AON ACMP0.
-
enumerator kCLK_16K_to_AON_LCD
Attach FRO clk_16k to AON LCD.
-
enumerator kFRO16K_to_AON_LCD
Attach FRO fro16k to AON LCD.
-
enumerator kFROdiv1_to_AON_LPADC
Attach FRO div 1 to AON LPADC.
-
enumerator kFROdiv2_to_AON_LPADC
Attach FRO div 2 to AON LPADC.
-
enumerator kFROdiv4_to_AON_LPADC
Attach FRO div 4 to AON LPADC.
-
enumerator kROOT_AUX_to_AON_LPADC
Attach ROOT AUX to AON LPADC.
-
enumerator kXTAL32K_to_AON_LPADC
Attach FRO RTC to AON LPADC.
-
enumerator kFRO16K_to_AON_LPADC
Attach FRO fro16k to AON LPADC.
-
enumerator kFROdiv1_to_AON_SYSTICK
Attach FRO div 1 to AON SYSTICK.
-
enumerator kFROdiv2_to_AON_SYSTICK
Attach FRO div 2 to AON SYSTICK.
-
enumerator kFROdiv4_to_AON_SYSTICK
Attach FRO div 4 to AON SYSTICK.
-
enumerator kROOT_AUX_to_AON_SYSTICK
Attach ROOT AUX to AON SYSTICK.
-
enumerator kXTAL32K_to_AON_KPP
Attach XTAL32K to AON KPP.
-
enumerator kFRO16K_to_AON_KPP
Attach FRO fro16k to AON KPP.
-
enumerator AON_TMR_to_AON_LPTMR
Attach AON TIMER CLK to AON LPTMR GRP.
-
enumerator kFRO16K_to_AON_LPTMR
Attach FRO16K to AON LPTMR GRP.
-
enumerator kCLK_16K_to_AON_LPTMR
Attach CLK_16K to AON LPTMR GRP.
-
enumerator kFROdiv1_to_AON_TMR
Attach FRO div 1 to AON TMR GRP.
-
enumerator kFROdiv2_to_AON_TMR
Attach FRO div 2 to AON TMR GRP.
-
enumerator kFROdiv4_to_AON_TMR
Attach FRO div 4 to AON TMR GRP.
-
enumerator kROOT_AUX_to_AON_TMR
Attach ROOT AUX to AON TMR GRP.
-
enumerator kFROdiv1_to_AON_COM
Attach FRO div 1 to AON COM GRP.
-
enumerator kFROdiv2_to_AON_COM
Attach FRO div 2 to AON COM GRP.
-
enumerator kFROdiv4_to_AON_COM
Attach FRO div 4 to AON COM GRP.
-
enumerator kROOT_AUX_to_AON_COM
Attach ROOT AUX to AON COM GRP.
-
enumerator kNONE_to_NONE
Attach NONE to NONE.
-
enumerator kXTAL32K_to_AON_ROOT_AUX
-
enum _clock_div_name
Clock dividers.
Values:
-
enumerator kCLOCK_DIVAonCPU
Aon CPU clock divider
-
enumerator kCLOCK_DIVAonCMP
Aon Comp grp clock divider
-
enumerator kCLOCK_DIVAonSYS
Aon SYSTICK clock divider
-
enumerator kCLOCK_DIVAonCMP0CLK0
Aon CMP0 CLK0 clock divider
-
enumerator kCLOCK_DIVAonCMP0CLK1
Aon CMP0 CLK1 clock divider
-
enumerator kCLOCK_DivMax
MAX clock divider
-
enumerator kCLOCK_DIVAonCPU
-
typedef enum _clock_ip_name clock_ip_name_t
Clock gate name used for CLOCK_EnableClock/CLOCK_DisableClock.
-
typedef enum _clock_name clock_name_t
Clock name used to get clock frequency.
-
typedef enum _clock_select_name clock_select_name_t
Clock name used to get clock frequency.
-
typedef enum _clock_attach_id clock_attach_id_t
The enumerator of clock attach Id.
-
typedef enum _clock_div_name clock_div_name_t
Clock dividers.
-
typedef struct _aon_fro_trim_config aon_fro_trim_config_t
AON FRO trim configuration.
-
volatile uint32_t g_xtal32Freq
External XTAL32/EXTAL32 clock frequency.
The XTAL32/EXTAL32 clock frequency in Hz. When the clock is set up, use the function CLOCK_SetXtal32Freq to set the value in the clock driver.
This is important for the multicore platforms where only one core needs to set up the clock. All other cores need to call the CLOCK_SetXtal32Freq to get a valid clock frequency.
-
static inline void CLOCK_EnableClock(clock_ip_name_t clk)
Enable the clock for specific IP.
- Parameters:
clk – : Clock to be enabled.
- Returns:
Nothing
-
static inline void CLOCK_DisableClock(clock_ip_name_t clk)
Disable the clock for specific IP.
- Parameters:
clk – : Clock to be Disabled.
- Returns:
Nothing
-
void CLOCK_AttachClk(clock_attach_id_t connection)
Configure the clock selection muxes.
- Parameters:
connection – : Clock to be configured.
- Returns:
Nothing
-
clock_attach_id_t CLOCK_GetClockAttachId(clock_attach_id_t connection)
Get the actual clock attach id. This fuction uses the offset in input attach id, then it reads the actual source value in the register and combine the offset to obtain an actual attach id.
- Parameters:
connection – : Clock attach id to get.
- Returns:
Clock source value.
-
void CLOCK_SetClockSelect(clock_select_name_t sel_name, uint32_t value)
Set the clock select value. This fuction set the peripheral clock select value.
- Parameters:
sel_name – : Clock select.
value – : value to be set.
-
uint32_t CLOCK_GetClockSelect(clock_select_name_t sel_name)
Get the clock select value. This fuction get the peripheral clock select value.
- Parameters:
sel_name – : Clock select.
- Returns:
Clock source value.
-
void CLOCK_SetClockDiv(clock_div_name_t div_name, uint32_t value)
Setup peripheral clock dividers.
- Parameters:
div_name – : Clock divider name
value – : Value to be divided
- Returns:
Nothing
-
uint32_t CLOCK_GetClockDiv(clock_div_name_t div_name)
Get peripheral clock dividers.
- Parameters:
div_name – : Clock divider name
- Returns:
peripheral clock dividers
-
void CLOCK_HaltClockDiv(clock_div_name_t div_name)
Halt peripheral clock dividers.
- Parameters:
div_name – : Clock divider name
- Returns:
Nothing
-
status_t CLOCK_SetupFROAonClocking(uint32_t iFreq)
Initialize the AON FRO to given frequency..
- Parameters:
iFreq – : Desired frequency (10M,4M,0=off).
- Returns:
returns success or fail status.
-
uint32_t CLOCK_GetFreq(clock_name_t clockName)
Return Frequency of selected clock.
- Returns:
Frequency of selected clock
-
uint32_t CLOCK_GetLpi2cClkFreq(uint32_t id)
Return Frequency of LPI2C functional Clock.
- Returns:
Frequency of LPI2C functional Clock
-
uint32_t CLOCK_GetLpuartClkFreq(uint32_t id)
Return Frequency of LPUART functional Clock.
- Returns:
Frequency of LPUART functional Clock
-
void CLOCK_AON_FRO_Trim_Set(uint8_t is_fro4m, aon_fro_trim_config_t config)
Sets AON FRO 10M or 4M trim.
- Parameters:
is_fro4m – : 0 for FRO10M, 1 for FRO4M
config – : trim value
-
void CLOCK_AON_FRO_Trim_Get(uint8_t is_fro4m, aon_fro_trim_config_t *config)
Reads AON FRO 10M or 4M trim values.
- Parameters:
is_fro4m – : 0 for FRO10M, 1 for FRO4M
config – : ptr to aon_fro_trim_config_t struct.
-
static inline void CLOCK_SetXtal32Freq(uint32_t freq)
Sets the XTAL32 frequency based on board settings.
- Parameters:
freq – The XTAL32/EXTAL32 input clock frequency in Hz.
-
FSL_CLOCK_DRIVER_VERSION
CLOCK driver version 1.0.0.
-
FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL
Configure whether driver controls clock.
When set to 0, peripheral drivers will enable clock in initialize function and disable clock in de-initialize function. When set to 1, peripheral driver will not control the clock, application could control the clock out of the driver.
Note
All drivers share this feature switcher. If it is set to 1, application should handle clock enable and disable for all drivers.
-
SDK_DEVICE_MAXIMUM_CPU_CLOCK_FREQUENCY
-
CLK_GATE_REG_PR_OFFSET(value)
Clock gate name used for CLOCK_EnableClock/CLOCK_DisableClock.
The offset of the registers MRCC_GLB_PR0 and MRCC_GLB_PR1.
-
CLK_GATE_REG_CC_OFFSET(value)
The offset of the registers MRCC_GLB_CC0 and MRCC_GLB_CC1.
-
CLK_PERIPHERAL_BIT_SHIFT(value)
Bit definitions for the peripherals in MRCC_GLB_PR and MRCC_GLB_CC.
-
CLK_OF_AON(value)
True when clock gate belongs to AON domain.
-
REG_PWM0SUBCTL
-
AOI_CLOCKS
Clock ip name array for AOI.
-
ATX_CLOCKS
Clock ip name array for ATX.
-
CRC_CLOCKS
Clock ip name array for CRC.
-
CTIMER_CLOCKS
Clock ip name array for CTIMER.
-
DMA_CLOCKS
Clock ip name array for DMA.
-
EDMA_CLOCKS
Clock gate name array for EDMA.
-
EZRAMC_CLOCKS
Clock ip name array for EZRAMC_RAMA.
-
FREQME_CLOCKS
Clock ip name array for FREQME.
-
GPIO_CLOCKS
Clock ip name array for GPIO.
-
INPUTMUX_CLOCKS
Clock ip name array for INPUTMUX.
-
LPCMP_CLOCKS
Clock ip name array for LPCMP.
-
LPADC_CLOCKS
Clock ip name array for LPADC.
-
LPUART_CLOCKS
Clock ip name array for LPUART.
-
LPI2C_CLOCKS
Clock ip name array for LPI2C.
-
LPSPI_CLOCKS
Clock ip name array for LPSPI.
-
MTR_CLOCKS
Clock ip name array for MTR.
-
OSTIMER_CLOCKS
Clock ip name array for OSTIMER.
-
PERIPHGROUP_CLOCKS
Clock ip name array for PERIPH_GROUP.
-
PORT_CLOCKS
Clock ip name array for PORT.
-
ROMCP_CLOCKS
Clock ip name array for ROMCP.
-
TCU_CLOCKS
Clock ip name array for TCU.
-
UTICK_CLOCKS
Clock ip name array for UTICK.
-
WWDT_CLOCKS
Clock ip name array for WWDT.
-
BUS_CLK
Peripherals clock source definition.
-
TMR_CLOCKS
Clock ip name array for QTMRs.
-
KPP_CLOCKS
Clock ip name array for QTMRs.
-
CLK_ATTACH_REG_OFFSET(value)
Clock Mux Switches The encoding is as follows each connection identified is 32bits wide while 24bits are valuable starting from LSB upwards.
[4 bits for choice, 0 means invalid choice] [8 bits mux ID]*
-
CLK_ATTACH_CLK_SEL(value)
-
CLK_ATTACH_MUX(reg, sel)
-
CLK_OF_AON_SEL(value)
-
CLK_AON_SEL_REG_OFFSET(value)
-
CLK_AON_SEL_SHIFT(value)
-
CLK_AON_SEL_MASK(value)
-
CLK_AON_SEL(reg, shift, mask)
-
uint8_t fs_bp
Replica voltage fs_bp. 0-7
-
uint8_t fs_vcco
Replica voltage fs_vcco. 0-3
-
uint8_t tf
Relationship between the frequency and temperature. 0-7
-
uint8_t cltrim
Trim coarse freq value; 0-63
-
uint8_t ccotrim
Trim fine freq value; 0-63
-
struct _aon_fro_trim_config
- #include <fsl_clock.h>
AON FRO trim configuration.
eDMA: Enhanced Direct Memory Access (eDMA) Controller Driver
-
void EDMA_Init(EDMA_Type *base, const edma_config_t *config)
Initializes the eDMA peripheral.
This function ungates the eDMA clock and configures the eDMA peripheral according to the configuration structure. All emda enabled request will be cleared in this function.
Note
This function enables the minor loop map feature.
- Parameters:
base – eDMA peripheral base address.
config – A pointer to the configuration structure, see “edma_config_t”.
-
void EDMA_Deinit(EDMA_Type *base)
Deinitializes the eDMA peripheral.
This function gates the eDMA clock.
- Parameters:
base – eDMA peripheral base address.
-
void EDMA_InstallTCD(EDMA_Type *base, uint32_t channel, edma_tcd_t *tcd)
Push content of TCD structure into hardware TCD register.
- Parameters:
base – EDMA peripheral base address.
channel – EDMA channel number.
tcd – Point to TCD structure.
-
void EDMA_GetDefaultConfig(edma_config_t *config)
Gets the eDMA default configuration structure.
This function sets the configuration structure to default values. The default configuration is set to the following values.
config.enableContinuousLinkMode = false; config.enableHaltOnError = true; config.enableRoundRobinArbitration = false; config.enableDebugMode = false;
- Parameters:
config – A pointer to the eDMA configuration structure.
-
void EDMA_InitChannel(EDMA_Type *base, uint32_t channel, edma_channel_config_t *channelConfig)
EDMA Channel initialization.
- Parameters:
base – eDMA4 peripheral base address.
channel – eDMA4 channel number.
channelConfig – pointer to user’s eDMA4 channel config structure, see edma_channel_config_t for detail.
-
static inline void EDMA_SetChannelMemoryAttribute(EDMA_Type *base, uint32_t channel, edma_channel_memory_attribute_t writeAttribute, edma_channel_memory_attribute_t readAttribute)
Set channel memory attribute.
- Parameters:
base – eDMA4 peripheral base address.
channel – eDMA4 channel number.
writeAttribute – Attributes associated with a write transaction.
readAttribute – Attributes associated with a read transaction.
-
static inline void EDMA_SetChannelSignExtension(EDMA_Type *base, uint32_t channel, uint8_t position)
Set channel sign extension.
- Parameters:
base – eDMA4 peripheral base address.
channel – eDMA4 channel number.
position – A non-zero value specifing the sign extend bit position. If 0, sign extension is disabled.
-
static inline void EDMA_SetChannelSwapSize(EDMA_Type *base, uint32_t channel, edma_channel_swap_size_t swapSize)
Set channel swap size.
- Parameters:
base – eDMA4 peripheral base address.
channel – eDMA4 channel number.
swapSize – Swap occurs with respect to the specified transfer size. If 0, swap is disabled.
-
static inline void EDMA_SetChannelAccessType(EDMA_Type *base, uint32_t channel, edma_channel_access_type_t channelAccessType)
Set channel access type.
- Parameters:
base – eDMA4 peripheral base address.
channel – eDMA4 channel number.
channelAccessType – eDMA4’s transactions type on the system bus when the channel is active.
-
static inline void EDMA_SetChannelMux(EDMA_Type *base, uint32_t channel, uint32_t channelRequestSource)
Set channel request source.
- Parameters:
base – eDMA peripheral base address.
channel – eDMA channel number.
channelRequestSource – eDMA hardware service request source for the channel. User need to use the dma_request_source_t type as the input parameter. Note that devices may use other enum type to express dma request source and User can fined it in SOC header or fsl_edma_soc.h.
-
static inline uint32_t EDMA_GetChannelSystemBusInformation(EDMA_Type *base, uint32_t channel)
Gets the channel identification and attribute information on the system bus interface.
- Parameters:
base – eDMA peripheral base address.
channel – eDMA channel number.
- Returns:
The mask of the channel system bus information. Users need to use the _edma_channel_sys_bus_info type to decode the return variables.
-
static inline void EDMA_EnableChannelMasterIDReplication(EDMA_Type *base, uint32_t channel, bool enable)
Set channel master ID replication.
- Parameters:
base – eDMA peripheral base address.
channel – eDMA channel number.
enable – true is enable, false is disable.
-
static inline void EDMA_SetChannelProtectionLevel(EDMA_Type *base, uint32_t channel, edma_channel_protection_level_t level)
Set channel security level.
- Parameters:
base – eDMA peripheral base address.
channel – eDMA channel number.
level – security level.
-
void EDMA_ResetChannel(EDMA_Type *base, uint32_t channel)
Sets all TCD registers to default values.
This function sets TCD registers for this channel to default values.
Note
This function must not be called while the channel transfer is ongoing or it causes unpredictable results.
Note
This function enables the auto stop request feature.
- Parameters:
base – eDMA peripheral base address.
channel – eDMA channel number.
-
void EDMA_SetTransferConfig(EDMA_Type *base, uint32_t channel, const edma_transfer_config_t *config, edma_tcd_t *nextTcd)
Configures the eDMA transfer attribute.
This function configures the transfer attribute, including source address, destination address, transfer size, address offset, and so on. It also configures the scatter gather feature if the user supplies the TCD address. Example:
edma_transfer_t config; edma_tcd_t tcd; config.srcAddr = ..; config.destAddr = ..; ... EDMA_SetTransferConfig(DMA0, channel, &config, &stcd);
Note
If nextTcd is not NULL, it means scatter gather feature is enabled and DREQ bit is cleared in the previous transfer configuration, which is set in the eDMA_ResetChannel.
- Parameters:
base – eDMA peripheral base address.
channel – eDMA channel number.
config – Pointer to eDMA transfer configuration structure.
nextTcd – Point to TCD structure. It can be NULL if users do not want to enable scatter/gather feature.
-
void EDMA_SetMinorOffsetConfig(EDMA_Type *base, uint32_t channel, const edma_minor_offset_config_t *config)
Configures the eDMA minor offset feature.
The minor offset means that the signed-extended value is added to the source address or destination address after each minor loop.
- Parameters:
base – eDMA peripheral base address.
channel – eDMA channel number.
config – A pointer to the minor offset configuration structure.
-
void EDMA_SetChannelPreemptionConfig(EDMA_Type *base, uint32_t channel, const edma_channel_Preemption_config_t *config)
Configures the eDMA channel preemption feature.
This function configures the channel preemption attribute and the priority of the channel.
- Parameters:
base – eDMA peripheral base address.
channel – eDMA channel number
config – A pointer to the channel preemption configuration structure.
-
void EDMA_SetChannelLink(EDMA_Type *base, uint32_t channel, edma_channel_link_type_t type, uint32_t linkedChannel)
Sets the channel link for the eDMA transfer.
This function configures either the minor link or the major link mode. The minor link means that the channel link is triggered every time CITER decreases by 1. The major link means that the channel link is triggered when the CITER is exhausted.
Note
Users should ensure that DONE flag is cleared before calling this interface, or the configuration is invalid.
- Parameters:
base – eDMA peripheral base address.
channel – eDMA channel number.
type – A channel link type, which can be one of the following:
kEDMA_LinkNone
kEDMA_MinorLink
kEDMA_MajorLink
linkedChannel – The linked channel number.
-
void EDMA_SetBandWidth(EDMA_Type *base, uint32_t channel, edma_bandwidth_t bandWidth)
Sets the bandwidth for the eDMA transfer.
Because the eDMA processes the minor loop, it continuously generates read/write sequences until the minor count is exhausted. The bandwidth forces the eDMA to stall after the completion of each read/write access to control the bus request bandwidth seen by the crossbar switch.
- Parameters:
base – eDMA peripheral base address.
channel – eDMA channel number.
bandWidth – A bandwidth setting, which can be one of the following:
kEDMABandwidthStallNone
kEDMABandwidthStall4Cycle
kEDMABandwidthStall8Cycle
-
void EDMA_SetModulo(EDMA_Type *base, uint32_t channel, edma_modulo_t srcModulo, edma_modulo_t destModulo)
Sets the source modulo and the destination modulo for the eDMA transfer.
This function defines a specific address range specified to be the value after (SADDR + SOFF)/(DADDR + DOFF) calculation is performed or the original register value. It provides the ability to implement a circular data queue easily.
- Parameters:
base – eDMA peripheral base address.
channel – eDMA channel number.
srcModulo – A source modulo value.
destModulo – A destination modulo value.
-
static inline void EDMA_EnableAutoStopRequest(EDMA_Type *base, uint32_t channel, bool enable)
Enables an auto stop request for the eDMA transfer.
If enabling the auto stop request, the eDMA hardware automatically disables the hardware channel request.
- Parameters:
base – eDMA peripheral base address.
channel – eDMA channel number.
enable – The command to enable (true) or disable (false).
-
void EDMA_EnableChannelInterrupts(EDMA_Type *base, uint32_t channel, uint32_t mask)
Enables the interrupt source for the eDMA transfer.
- Parameters:
base – eDMA peripheral base address.
channel – eDMA channel number.
mask – The mask of interrupt source to be set. Users need to use the defined edma_interrupt_enable_t type.
-
void EDMA_DisableChannelInterrupts(EDMA_Type *base, uint32_t channel, uint32_t mask)
Disables the interrupt source for the eDMA transfer.
- Parameters:
base – eDMA peripheral base address.
channel – eDMA channel number.
mask – The mask of the interrupt source to be set. Use the defined edma_interrupt_enable_t type.
-
void EDMA_SetMajorOffsetConfig(EDMA_Type *base, uint32_t channel, int32_t sourceOffset, int32_t destOffset)
Configures the eDMA channel TCD major offset feature.
Adjustment value added to the source address at the completion of the major iteration count
- Parameters:
base – eDMA peripheral base address.
channel – edma channel number.
sourceOffset – source address offset will be applied to source address after major loop done.
destOffset – destination address offset will be applied to source address after major loop done.
-
void EDMA_ConfigChannelSoftwareTCD(edma_tcd_t *tcd, const edma_transfer_config_t *transfer)
Sets TCD fields according to the user’s channel transfer configuration structure, edma_transfer_config_t.
@Note This API only supports EDMA4 TCD type. It can be used to support all types with extension API EDMA_ConfigChannelSoftwareTCDExt
Application should be careful about the TCD pool buffer storage class,
For the platform has cache, the software TCD should be put in non cache section
The TCD pool buffer should have a consistent storage class.
Note
This function enables the auto stop request feature.
- Parameters:
tcd – Pointer to the TCD structure.
transfer – channel transfer configuration pointer.
-
void EDMA_TcdReset(edma_tcd_t *tcd)
Sets all fields to default values for the TCD structure.
@Note This API only supports EDMA4 TCD type. It can be used to support all types with extension API EDMA_TcdResetExt
This function sets all fields for this TCD structure to default value.
Note
This function enables the auto stop request feature.
- Parameters:
tcd – Pointer to the TCD structure.
-
void EDMA_TcdSetTransferConfig(edma_tcd_t *tcd, const edma_transfer_config_t *config, edma_tcd_t *nextTcd)
Configures the eDMA TCD transfer attribute.
@Note This API only supports EDMA4 TCD type. It can be used to support all types with extension API EDMA_TcdSetTransferConfigExt
The TCD is a transfer control descriptor. The content of the TCD is the same as the hardware TCD registers. The TCD is used in the scatter-gather mode. This function configures the TCD transfer attribute, including source address, destination address, transfer size, address offset, and so on. It also configures the scatter gather feature if the user supplies the next TCD address. Example:
edma_transfer_t config = { ... } edma_tcd_t tcd __aligned(32); edma_tcd_t nextTcd __aligned(32); EDMA_TcdSetTransferConfig(&tcd, &config, &nextTcd);
Note
TCD address should be 32 bytes aligned or it causes an eDMA error.
Note
If the nextTcd is not NULL, the scatter gather feature is enabled and DREQ bit is cleared in the previous transfer configuration, which is set in the EDMA_TcdReset.
- Parameters:
tcd – Pointer to the TCD structure.
config – Pointer to eDMA transfer configuration structure.
nextTcd – Pointer to the next TCD structure. It can be NULL if users do not want to enable scatter/gather feature.
-
void EDMA_TcdSetMinorOffsetConfig(edma_tcd_t *tcd, const edma_minor_offset_config_t *config)
Configures the eDMA TCD minor offset feature.
@Note This API only supports EDMA4 TCD type. It can be used to support all types with extension API EDMA_TcdSetMinorOffsetConfigExt
A minor offset is a signed-extended value added to the source address or a destination address after each minor loop.
- Parameters:
tcd – A point to the TCD structure.
config – A pointer to the minor offset configuration structure.
-
void EDMA_TcdSetChannelLink(edma_tcd_t *tcd, edma_channel_link_type_t type, uint32_t linkedChannel)
Sets the channel link for the eDMA TCD.
@Note This API only supports EDMA4 TCD type. It can be used to support all types with extension API EDMA_TcdSetChannelLinkExt
This function configures either a minor link or a major link. The minor link means the channel link is triggered every time CITER decreases by 1. The major link means that the channel link is triggered when the CITER is exhausted.
Note
Users should ensure that DONE flag is cleared before calling this interface, or the configuration is invalid.
- Parameters:
tcd – Point to the TCD structure.
type – Channel link type, it can be one of:
kEDMA_LinkNone
kEDMA_MinorLink
kEDMA_MajorLink
linkedChannel – The linked channel number.
-
static inline void EDMA_TcdSetBandWidth(edma_tcd_t *tcd, edma_bandwidth_t bandWidth)
Sets the bandwidth for the eDMA TCD.
@Note This API only supports EDMA4 TCD type. It can be used to support all types with extension API EDMA_TcdSetBandWidthExt
Because the eDMA processes the minor loop, it continuously generates read/write sequences until the minor count is exhausted. The bandwidth forces the eDMA to stall after the completion of each read/write access to control the bus request bandwidth seen by the crossbar switch.
- Parameters:
tcd – A pointer to the TCD structure.
bandWidth – A bandwidth setting, which can be one of the following:
kEDMABandwidthStallNone
kEDMABandwidthStall4Cycle
kEDMABandwidthStall8Cycle
-
void EDMA_TcdSetModulo(edma_tcd_t *tcd, edma_modulo_t srcModulo, edma_modulo_t destModulo)
Sets the source modulo and the destination modulo for the eDMA TCD.
@Note This API only supports EDMA4 TCD type. It can be used to support all types with extension API EDMA_TcdSetModuloExt
This function defines a specific address range specified to be the value after (SADDR + SOFF)/(DADDR + DOFF) calculation is performed or the original register value. It provides the ability to implement a circular data queue easily.
- Parameters:
tcd – A pointer to the TCD structure.
srcModulo – A source modulo value.
destModulo – A destination modulo value.
-
static inline void EDMA_TcdEnableAutoStopRequest(edma_tcd_t *tcd, bool enable)
Sets the auto stop request for the eDMA TCD.
@Note This API only supports EDMA4 TCD type. It can be used to support all types with extension API EDMA_TcdEnableAutoStopRequestExt
If enabling the auto stop request, the eDMA hardware automatically disables the hardware channel request.
- Parameters:
tcd – A pointer to the TCD structure.
enable – The command to enable (true) or disable (false).
-
void EDMA_TcdEnableInterrupts(edma_tcd_t *tcd, uint32_t mask)
Enables the interrupt source for the eDMA TCD.
@Note This API only supports EDMA4 TCD type. It can be used to support all types with extension API EDMA_TcdEnableInterruptsExt
- Parameters:
tcd – Point to the TCD structure.
mask – The mask of interrupt source to be set. Users need to use the defined edma_interrupt_enable_t type.
-
void EDMA_TcdDisableInterrupts(edma_tcd_t *tcd, uint32_t mask)
Disables the interrupt source for the eDMA TCD.
@Note This API only supports EDMA4 TCD type. It can be used to support all types with extension API EDMA_TcdDisableInterruptsExt
- Parameters:
tcd – Point to the TCD structure.
mask – The mask of interrupt source to be set. Users need to use the defined edma_interrupt_enable_t type.
-
void EDMA_TcdSetMajorOffsetConfig(edma_tcd_t *tcd, int32_t sourceOffset, int32_t destOffset)
Configures the eDMA TCD major offset feature.
@Note This API only supports EDMA4 TCD type. It can be used to support all types with extension API EDMA_TcdSetMajorOffsetConfigExt
Adjustment value added to the source address at the completion of the major iteration count
- Parameters:
tcd – A point to the TCD structure.
sourceOffset – source address offset wiil be applied to source address after major loop done.
destOffset – destination address offset will be applied to source address after major loop done.
-
void EDMA_ConfigChannelSoftwareTCDExt(EDMA_Type *base, edma_tcd_t *tcd, const edma_transfer_config_t *transfer)
Sets TCD fields according to the user’s channel transfer configuration structure, edma_transfer_config_t.
Application should be careful about the TCD pool buffer storage class,
For the platform has cache, the software TCD should be put in non cache section
The TCD pool buffer should have a consistent storage class.
Note
This function enables the auto stop request feature.
- Parameters:
base – eDMA peripheral base address.
tcd – Pointer to the TCD structure.
transfer – channel transfer configuration pointer.
-
void EDMA_TcdResetExt(EDMA_Type *base, edma_tcd_t *tcd)
Sets all fields to default values for the TCD structure.
This function sets all fields for this TCD structure to default value.
Note
This function enables the auto stop request feature.
- Parameters:
base – eDMA peripheral base address.
tcd – Pointer to the TCD structure.
-
void EDMA_TcdSetTransferConfigExt(EDMA_Type *base, edma_tcd_t *tcd, const edma_transfer_config_t *config, edma_tcd_t *nextTcd)
Configures the eDMA TCD transfer attribute.
The TCD is a transfer control descriptor. The content of the TCD is the same as the hardware TCD registers. The TCD is used in the scatter-gather mode. This function configures the TCD transfer attribute, including source address, destination address, transfer size, address offset, and so on. It also configures the scatter gather feature if the user supplies the next TCD address. Example:
edma_transfer_t config = { ... } edma_tcd_t tcd __aligned(32); edma_tcd_t nextTcd __aligned(32); EDMA_TcdSetTransferConfig(&tcd, &config, &nextTcd);
Note
TCD address should be 32 bytes aligned or it causes an eDMA error.
Note
If the nextTcd is not NULL, the scatter gather feature is enabled and DREQ bit is cleared in the previous transfer configuration, which is set in the EDMA_TcdReset.
- Parameters:
base – eDMA peripheral base address.
tcd – Pointer to the TCD structure.
config – Pointer to eDMA transfer configuration structure.
nextTcd – Pointer to the next TCD structure. It can be NULL if users do not want to enable scatter/gather feature.
-
void EDMA_TcdSetMinorOffsetConfigExt(EDMA_Type *base, edma_tcd_t *tcd, const edma_minor_offset_config_t *config)
Configures the eDMA TCD minor offset feature.
A minor offset is a signed-extended value added to the source address or a destination address after each minor loop.
- Parameters:
base – eDMA peripheral base address.
tcd – A point to the TCD structure.
config – A pointer to the minor offset configuration structure.
-
void EDMA_TcdSetChannelLinkExt(EDMA_Type *base, edma_tcd_t *tcd, edma_channel_link_type_t type, uint32_t linkedChannel)
Sets the channel link for the eDMA TCD.
This function configures either a minor link or a major link. The minor link means the channel link is triggered every time CITER decreases by 1. The major link means that the channel link is triggered when the CITER is exhausted.
Note
Users should ensure that DONE flag is cleared before calling this interface, or the configuration is invalid.
- Parameters:
base – eDMA peripheral base address.
tcd – Point to the TCD structure.
type – Channel link type, it can be one of:
kEDMA_LinkNone
kEDMA_MinorLink
kEDMA_MajorLink
linkedChannel – The linked channel number.
-
static inline void EDMA_TcdSetBandWidthExt(EDMA_Type *base, edma_tcd_t *tcd, edma_bandwidth_t bandWidth)
Sets the bandwidth for the eDMA TCD.
Because the eDMA processes the minor loop, it continuously generates read/write sequences until the minor count is exhausted. The bandwidth forces the eDMA to stall after the completion of each read/write access to control the bus request bandwidth seen by the crossbar switch.
- Parameters:
base – eDMA peripheral base address.
tcd – A pointer to the TCD structure.
bandWidth – A bandwidth setting, which can be one of the following:
kEDMABandwidthStallNone
kEDMABandwidthStall4Cycle
kEDMABandwidthStall8Cycle
-
void EDMA_TcdSetModuloExt(EDMA_Type *base, edma_tcd_t *tcd, edma_modulo_t srcModulo, edma_modulo_t destModulo)
Sets the source modulo and the destination modulo for the eDMA TCD.
This function defines a specific address range specified to be the value after (SADDR + SOFF)/(DADDR + DOFF) calculation is performed or the original register value. It provides the ability to implement a circular data queue easily.
- Parameters:
base – eDMA peripheral base address.
tcd – A pointer to the TCD structure.
srcModulo – A source modulo value.
destModulo – A destination modulo value.
-
static inline void EDMA_TcdEnableAutoStopRequestExt(EDMA_Type *base, edma_tcd_t *tcd, bool enable)
Sets the auto stop request for the eDMA TCD.
If enabling the auto stop request, the eDMA hardware automatically disables the hardware channel request.
- Parameters:
base – eDMA peripheral base address.
tcd – A pointer to the TCD structure.
enable – The command to enable (true) or disable (false).
-
void EDMA_TcdEnableInterruptsExt(EDMA_Type *base, edma_tcd_t *tcd, uint32_t mask)
Enables the interrupt source for the eDMA TCD.
- Parameters:
base – eDMA peripheral base address.
tcd – Point to the TCD structure.
mask – The mask of interrupt source to be set. Users need to use the defined edma_interrupt_enable_t type.
-
void EDMA_TcdDisableInterruptsExt(EDMA_Type *base, edma_tcd_t *tcd, uint32_t mask)
Disables the interrupt source for the eDMA TCD.
- Parameters:
base – eDMA peripheral base address.
tcd – Point to the TCD structure.
mask – The mask of interrupt source to be set. Users need to use the defined edma_interrupt_enable_t type.
-
void EDMA_TcdSetMajorOffsetConfigExt(EDMA_Type *base, edma_tcd_t *tcd, int32_t sourceOffset, int32_t destOffset)
Configures the eDMA TCD major offset feature.
Adjustment value added to the source address at the completion of the major iteration count
- Parameters:
base – eDMA peripheral base address.
tcd – A point to the TCD structure.
sourceOffset – source address offset wiil be applied to source address after major loop done.
destOffset – destination address offset will be applied to source address after major loop done.
-
static inline void EDMA_EnableChannelRequest(EDMA_Type *base, uint32_t channel)
Enables the eDMA hardware channel request.
This function enables the hardware channel request.
- Parameters:
base – eDMA peripheral base address.
channel – eDMA channel number.
-
static inline void EDMA_DisableChannelRequest(EDMA_Type *base, uint32_t channel)
Disables the eDMA hardware channel request.
This function disables the hardware channel request.
- Parameters:
base – eDMA peripheral base address.
channel – eDMA channel number.
-
static inline void EDMA_TriggerChannelStart(EDMA_Type *base, uint32_t channel)
Starts the eDMA transfer by using the software trigger.
This function starts a minor loop transfer.
- Parameters:
base – eDMA peripheral base address.
channel – eDMA channel number.
-
uint32_t EDMA_GetRemainingMajorLoopCount(EDMA_Type *base, uint32_t channel)
Gets the remaining major loop count from the eDMA current channel TCD.
This function checks the TCD (Task Control Descriptor) status for a specified eDMA channel and returns the number of major loop count that has not finished.
Note
1. This function can only be used to get unfinished major loop count of transfer without the next TCD, or it might be inaccuracy.
The unfinished/remaining transfer bytes cannot be obtained directly from registers while the channel is running. Because to calculate the remaining bytes, the initial NBYTES configured in DMA_TCDn_NBYTES_MLNO register is needed while the eDMA IP does not support getting it while a channel is active. In another word, the NBYTES value reading is always the actual (decrementing) NBYTES value the dma_engine is working with while a channel is running. Consequently, to get the remaining transfer bytes, a software-saved initial value of NBYTES (for example copied before enabling the channel) is needed. The formula to calculate it is shown below: RemainingBytes = RemainingMajorLoopCount * NBYTES(initially configured)
- Parameters:
base – eDMA peripheral base address.
channel – eDMA channel number.
- Returns:
Major loop count which has not been transferred yet for the current TCD.
-
static inline uint32_t EDMA_GetErrorStatusFlags(EDMA_Type *base)
Gets the eDMA channel error status flags.
- Parameters:
base – eDMA peripheral base address.
- Returns:
The mask of error status flags. Users need to use the _edma_error_status_flags type to decode the return variables.
-
uint32_t EDMA_GetChannelStatusFlags(EDMA_Type *base, uint32_t channel)
Gets the eDMA channel status flags.
- Parameters:
base – eDMA peripheral base address.
channel – eDMA channel number.
- Returns:
The mask of channel status flags. Users need to use the _edma_channel_status_flags type to decode the return variables.
-
void EDMA_ClearChannelStatusFlags(EDMA_Type *base, uint32_t channel, uint32_t mask)
Clears the eDMA channel status flags.
- Parameters:
base – eDMA peripheral base address.
channel – eDMA channel number.
mask – The mask of channel status to be cleared. Users need to use the defined _edma_channel_status_flags type.
-
void EDMA_CreateHandle(edma_handle_t *handle, EDMA_Type *base, uint32_t channel)
Creates the eDMA handle.
This function is called if using the transactional API for eDMA. This function initializes the internal state of the eDMA handle.
- Parameters:
handle – eDMA handle pointer. The eDMA handle stores callback function and parameters.
base – eDMA peripheral base address.
channel – eDMA channel number.
-
void EDMA_InstallTCDMemory(edma_handle_t *handle, edma_tcd_t *tcdPool, uint32_t tcdSize)
Installs the TCDs memory pool into the eDMA handle.
This function is called after the EDMA_CreateHandle to use scatter/gather feature. This function shall only be used while users need to use scatter gather mode. Scatter gather mode enables EDMA to load a new transfer control block (tcd) in hardware, and automatically reconfigure that DMA channel for a new transfer. Users need to prepare tcd memory and also configure tcds using interface EDMA_SubmitTransfer.
- Parameters:
handle – eDMA handle pointer.
tcdPool – A memory pool to store TCDs. It must be 32 bytes aligned.
tcdSize – The number of TCD slots.
-
void EDMA_SetCallback(edma_handle_t *handle, edma_callback callback, void *userData)
Installs a callback function for the eDMA transfer.
This callback is called in the eDMA IRQ handler. Use the callback to do something after the current major loop transfer completes. This function will be called every time one tcd finished transfer.
- Parameters:
handle – eDMA handle pointer.
callback – eDMA callback function pointer.
userData – A parameter for the callback function.
-
void EDMA_PrepareTransferConfig(edma_transfer_config_t *config, void *srcAddr, uint32_t srcWidth, int16_t srcOffset, void *destAddr, uint32_t destWidth, int16_t destOffset, uint32_t bytesEachRequest, uint32_t transferBytes)
Prepares the eDMA transfer structure configurations.
This function prepares the transfer configuration structure according to the user input.
Note
The data address and the data width must be consistent. For example, if the SRC is 4 bytes, the source address must be 4 bytes aligned, or it results in source address error (SAE). User can check if 128 bytes support is available for specific instance by FSL_FEATURE_EDMA_INSTANCE_SUPPORT_128_BYTES_TRANSFERn.
- Parameters:
config – The user configuration structure of type edma_transfer_t.
srcAddr – eDMA transfer source address.
srcWidth – eDMA transfer source address width(bytes).
srcOffset – source address offset.
destAddr – eDMA transfer destination address.
destWidth – eDMA transfer destination address width(bytes).
destOffset – destination address offset.
bytesEachRequest – eDMA transfer bytes per channel request.
transferBytes – eDMA transfer bytes to be transferred.
-
void EDMA_PrepareTransfer(edma_transfer_config_t *config, void *srcAddr, uint32_t srcWidth, void *destAddr, uint32_t destWidth, uint32_t bytesEachRequest, uint32_t transferBytes, edma_transfer_type_t type)
Prepares the eDMA transfer structure.
This function prepares the transfer configuration structure according to the user input.
Note
The data address and the data width must be consistent. For example, if the SRC is 4 bytes, the source address must be 4 bytes aligned, or it results in source address error (SAE).
- Parameters:
config – The user configuration structure of type edma_transfer_t.
srcAddr – eDMA transfer source address.
srcWidth – eDMA transfer source address width(bytes).
destAddr – eDMA transfer destination address.
destWidth – eDMA transfer destination address width(bytes).
bytesEachRequest – eDMA transfer bytes per channel request.
transferBytes – eDMA transfer bytes to be transferred.
type – eDMA transfer type.
-
void EDMA_PrepareTransferTCD(edma_handle_t *handle, edma_tcd_t *tcd, void *srcAddr, uint32_t srcWidth, int16_t srcOffset, void *destAddr, uint32_t destWidth, int16_t destOffset, uint32_t bytesEachRequest, uint32_t transferBytes, edma_tcd_t *nextTcd)
Prepares the eDMA transfer content descriptor.
This function prepares the transfer content descriptor structure according to the user input.
Note
The data address and the data width must be consistent. For example, if the SRC is 4 bytes, the source address must be 4 bytes aligned, or it results in source address error (SAE).
- Parameters:
handle – eDMA handle pointer.
tcd – Pointer to eDMA transfer content descriptor structure.
srcAddr – eDMA transfer source address.
srcWidth – eDMA transfer source address width(bytes).
srcOffset – source address offset.
destAddr – eDMA transfer destination address.
destWidth – eDMA transfer destination address width(bytes).
destOffset – destination address offset.
bytesEachRequest – eDMA transfer bytes per channel request.
transferBytes – eDMA transfer bytes to be transferred.
nextTcd – eDMA transfer linked TCD address.
-
status_t EDMA_SubmitTransferTCD(edma_handle_t *handle, edma_tcd_t *tcd)
Submits the eDMA transfer content descriptor.
This function submits the eDMA transfer request according to the transfer content descriptor. In scatter gather mode, call this function will add a configured tcd to the circular list of tcd pool. The tcd pools is setup by call function EDMA_InstallTCDMemory before.
Typical user case:
submit single transfer
edma_tcd_t tcd; EDMA_PrepareTransferTCD(handle, tcd, ....) EDMA_SubmitTransferTCD(handle, tcd) EDMA_StartTransfer(handle)
submit static link transfer,
edma_tcd_t tcd[2]; EDMA_PrepareTransferTCD(handle, &tcd[0], ....) EDMA_PrepareTransferTCD(handle, &tcd[1], ....) EDMA_SubmitTransferTCD(handle, &tcd[0]) EDMA_StartTransfer(handle)
submit dynamic link transfer
edma_tcd_t tcdpool[2]; EDMA_InstallTCDMemory(&g_DMA_Handle, tcdpool, 2); edma_tcd_t tcd; EDMA_PrepareTransferTCD(handle, tcd, ....) EDMA_SubmitTransferTCD(handle, tcd) EDMA_PrepareTransferTCD(handle, tcd, ....) EDMA_SubmitTransferTCD(handle, tcd) EDMA_StartTransfer(handle)
submit loop transfer
edma_tcd_t tcd[2]; EDMA_PrepareTransferTCD(handle, &tcd[0], ...,&tcd[1]) EDMA_PrepareTransferTCD(handle, &tcd[1], ..., &tcd[0]) EDMA_SubmitTransferTCD(handle, &tcd[0]) EDMA_StartTransfer(handle)
- Parameters:
handle – eDMA handle pointer.
tcd – Pointer to eDMA transfer content descriptor structure.
- Return values:
kStatus_EDMA_Success – It means submit transfer request succeed.
kStatus_EDMA_QueueFull – It means TCD queue is full. Submit transfer request is not allowed.
kStatus_EDMA_Busy – It means the given channel is busy, need to submit request later.
-
status_t EDMA_SubmitTransfer(edma_handle_t *handle, const edma_transfer_config_t *config)
Submits the eDMA transfer request.
This function submits the eDMA transfer request according to the transfer configuration structure. In scatter gather mode, call this function will add a configured tcd to the circular list of tcd pool. The tcd pools is setup by call function EDMA_InstallTCDMemory before.
- Parameters:
handle – eDMA handle pointer.
config – Pointer to eDMA transfer configuration structure.
- Return values:
kStatus_EDMA_Success – It means submit transfer request succeed.
kStatus_EDMA_QueueFull – It means TCD queue is full. Submit transfer request is not allowed.
kStatus_EDMA_Busy – It means the given channel is busy, need to submit request later.
-
status_t EDMA_SubmitLoopTransfer(edma_handle_t *handle, edma_transfer_config_t *transfer, uint32_t transferLoopCount)
Submits the eDMA scatter gather transfer configurations.
The function is target for submit loop transfer request, the ring transfer request means that the transfer request TAIL is link to HEAD, such as, A->B->C->D->A, or A->A
To use the ring transfer feature, the application should allocate several transfer object, such as
Then eDMA driver will link transfer[0] and transfer[1] to each otheredma_channel_transfer_config_t transfer[2]; EDMA_TransferSubmitLoopTransfer(psHandle, &transfer, 2U);
Note
Application should check the return value of this function to avoid transfer request submit failed
- Parameters:
handle – eDMA handle pointer
transfer – pointer to user’s eDMA channel configure structure, see edma_channel_transfer_config_t for detail
transferLoopCount – the count of the transfer ring, if loop count is 1, that means that the one will link to itself.
- Return values:
kStatus_Success – It means submit transfer request succeed
kStatus_EDMA_Busy – channel is in busy status
kStatus_InvalidArgument – Invalid Argument
-
void EDMA_StartTransfer(edma_handle_t *handle)
eDMA starts transfer.
This function enables the channel request. Users can call this function after submitting the transfer request or before submitting the transfer request.
- Parameters:
handle – eDMA handle pointer.
-
void EDMA_StopTransfer(edma_handle_t *handle)
eDMA stops transfer.
This function disables the channel request to pause the transfer. Users can call EDMA_StartTransfer() again to resume the transfer.
- Parameters:
handle – eDMA handle pointer.
-
void EDMA_AbortTransfer(edma_handle_t *handle)
eDMA aborts transfer.
This function disables the channel request and clear transfer status bits. Users can submit another transfer after calling this API.
- Parameters:
handle – DMA handle pointer.
-
static inline uint32_t EDMA_GetUnusedTCDNumber(edma_handle_t *handle)
Get unused TCD slot number.
This function gets current tcd index which is run. If the TCD pool pointer is NULL, it will return 0.
- Parameters:
handle – DMA handle pointer.
- Returns:
The unused tcd slot number.
-
static inline uint32_t EDMA_GetNextTCDAddress(edma_handle_t *handle)
Get the next tcd address.
This function gets the next tcd address. If this is last TCD, return 0.
- Parameters:
handle – DMA handle pointer.
- Returns:
The next TCD address.
-
void EDMA_HandleIRQ(edma_handle_t *handle)
eDMA IRQ handler for the current major loop transfer completion.
This function clears the channel major interrupt flag and calls the callback function if it is not NULL.
Note: For the case using TCD queue, when the major iteration count is exhausted, additional operations are performed. These include the final address adjustments and reloading of the BITER field into the CITER. Assertion of an optional interrupt request also occurs at this time, as does a possible fetch of a new TCD from memory using the scatter/gather address pointer included in the descriptor (if scatter/gather is enabled).
For instance, when the time interrupt of TCD[0] happens, the TCD[1] has already been loaded into the eDMA engine. As sga and sga_index are calculated based on the DLAST_SGA bitfield lies in the TCD_CSR register, the sga_index in this case should be 2 (DLAST_SGA of TCD[1] stores the address of TCD[2]). Thus, the “tcdUsed” updated should be (tcdUsed - 2U) which indicates the number of TCDs can be loaded in the memory pool (because TCD[0] and TCD[1] have been loaded into the eDMA engine at this point already.).
For the last two continuous ISRs in a scatter/gather process, they both load the last TCD (The last ISR does not load a new TCD) from the memory pool to the eDMA engine when major loop completes. Therefore, ensure that the header and tcdUsed updated are identical for them. tcdUsed are both 0 in this case as no TCD to be loaded.
See the “eDMA basic data flow” in the eDMA Functional description section of the Reference Manual for further details.
- Parameters:
handle – eDMA handle pointer.
-
FSL_EDMA_DRIVER_VERSION
eDMA driver version
Version 2.10.5.
_edma_transfer_status eDMA transfer status
Values:
-
enumerator kStatus_EDMA_QueueFull
TCD queue is full.
-
enumerator kStatus_EDMA_Busy
Channel is busy and can’t handle the transfer request.
-
enumerator kStatus_EDMA_QueueFull
-
enum _edma_transfer_size
eDMA transfer configuration
Values:
-
enumerator kEDMA_TransferSize1Bytes
Source/Destination data transfer size is 1 byte every time
-
enumerator kEDMA_TransferSize2Bytes
Source/Destination data transfer size is 2 bytes every time
-
enumerator kEDMA_TransferSize4Bytes
Source/Destination data transfer size is 4 bytes every time
-
enumerator kEDMA_TransferSize8Bytes
Source/Destination data transfer size is 8 bytes every time
-
enumerator kEDMA_TransferSize16Bytes
Source/Destination data transfer size is 16 bytes every time
-
enumerator kEDMA_TransferSize32Bytes
Source/Destination data transfer size is 32 bytes every time
-
enumerator kEDMA_TransferSize64Bytes
Source/Destination data transfer size is 64 bytes every time
-
enumerator kEDMA_TransferSize128Bytes
Source/Destination data transfer size is 128 bytes every time
-
enumerator kEDMA_TransferSize1Bytes
-
enum _edma_modulo
eDMA modulo configuration
Values:
-
enumerator kEDMA_ModuloDisable
Disable modulo
-
enumerator kEDMA_Modulo2bytes
Circular buffer size is 2 bytes.
-
enumerator kEDMA_Modulo4bytes
Circular buffer size is 4 bytes.
-
enumerator kEDMA_Modulo8bytes
Circular buffer size is 8 bytes.
-
enumerator kEDMA_Modulo16bytes
Circular buffer size is 16 bytes.
-
enumerator kEDMA_Modulo32bytes
Circular buffer size is 32 bytes.
-
enumerator kEDMA_Modulo64bytes
Circular buffer size is 64 bytes.
-
enumerator kEDMA_Modulo128bytes
Circular buffer size is 128 bytes.
-
enumerator kEDMA_Modulo256bytes
Circular buffer size is 256 bytes.
-
enumerator kEDMA_Modulo512bytes
Circular buffer size is 512 bytes.
-
enumerator kEDMA_Modulo1Kbytes
Circular buffer size is 1 K bytes.
-
enumerator kEDMA_Modulo2Kbytes
Circular buffer size is 2 K bytes.
-
enumerator kEDMA_Modulo4Kbytes
Circular buffer size is 4 K bytes.
-
enumerator kEDMA_Modulo8Kbytes
Circular buffer size is 8 K bytes.
-
enumerator kEDMA_Modulo16Kbytes
Circular buffer size is 16 K bytes.
-
enumerator kEDMA_Modulo32Kbytes
Circular buffer size is 32 K bytes.
-
enumerator kEDMA_Modulo64Kbytes
Circular buffer size is 64 K bytes.
-
enumerator kEDMA_Modulo128Kbytes
Circular buffer size is 128 K bytes.
-
enumerator kEDMA_Modulo256Kbytes
Circular buffer size is 256 K bytes.
-
enumerator kEDMA_Modulo512Kbytes
Circular buffer size is 512 K bytes.
-
enumerator kEDMA_Modulo1Mbytes
Circular buffer size is 1 M bytes.
-
enumerator kEDMA_Modulo2Mbytes
Circular buffer size is 2 M bytes.
-
enumerator kEDMA_Modulo4Mbytes
Circular buffer size is 4 M bytes.
-
enumerator kEDMA_Modulo8Mbytes
Circular buffer size is 8 M bytes.
-
enumerator kEDMA_Modulo16Mbytes
Circular buffer size is 16 M bytes.
-
enumerator kEDMA_Modulo32Mbytes
Circular buffer size is 32 M bytes.
-
enumerator kEDMA_Modulo64Mbytes
Circular buffer size is 64 M bytes.
-
enumerator kEDMA_Modulo128Mbytes
Circular buffer size is 128 M bytes.
-
enumerator kEDMA_Modulo256Mbytes
Circular buffer size is 256 M bytes.
-
enumerator kEDMA_Modulo512Mbytes
Circular buffer size is 512 M bytes.
-
enumerator kEDMA_Modulo1Gbytes
Circular buffer size is 1 G bytes.
-
enumerator kEDMA_Modulo2Gbytes
Circular buffer size is 2 G bytes.
-
enumerator kEDMA_ModuloDisable
-
enum _edma_bandwidth
Bandwidth control.
Values:
-
enumerator kEDMA_BandwidthStallNone
No eDMA engine stalls.
-
enumerator kEDMA_BandwidthStall4Cycle
eDMA engine stalls for 4 cycles after each read/write.
-
enumerator kEDMA_BandwidthStall8Cycle
eDMA engine stalls for 8 cycles after each read/write.
-
enumerator kEDMA_BandwidthStallNone
-
enum _edma_channel_link_type
Channel link type.
Values:
-
enumerator kEDMA_LinkNone
No channel link
-
enumerator kEDMA_MinorLink
Channel link after each minor loop
-
enumerator kEDMA_MajorLink
Channel link while major loop count exhausted
-
enumerator kEDMA_LinkNone
_edma_channel_status_flags eDMA channel status flags.
Values:
-
enumerator kEDMA_DoneFlag
DONE flag, set while transfer finished, CITER value exhausted
-
enumerator kEDMA_ErrorFlag
eDMA error flag, an error occurred in a transfer
-
enumerator kEDMA_InterruptFlag
eDMA interrupt flag, set while an interrupt occurred of this channel
-
enumerator kEDMA_DoneFlag
_edma_error_status_flags eDMA channel error status flags.
Values:
-
enumerator kEDMA_DestinationBusErrorFlag
Bus error on destination address
-
enumerator kEDMA_SourceBusErrorFlag
Bus error on the source address
-
enumerator kEDMA_ScatterGatherErrorFlag
Error on the Scatter/Gather address, not 32byte aligned.
-
enumerator kEDMA_NbytesErrorFlag
NBYTES/CITER configuration error
-
enumerator kEDMA_DestinationOffsetErrorFlag
Destination offset not aligned with destination size
-
enumerator kEDMA_DestinationAddressErrorFlag
Destination address not aligned with destination size
-
enumerator kEDMA_SourceOffsetErrorFlag
Source offset not aligned with source size
-
enumerator kEDMA_SourceAddressErrorFlag
Source address not aligned with source size
-
enumerator kEDMA_ErrorChannelFlag
Error channel number of the cancelled channel number
-
enumerator kEDMA_TransferCanceledFlag
Transfer cancelled
-
enumerator kEDMA_ValidFlag
No error occurred, this bit is 0. Otherwise, it is 1.
-
enumerator kEDMA_DestinationBusErrorFlag
_edma_interrupt_enable eDMA interrupt source
Values:
-
enumerator kEDMA_ErrorInterruptEnable
Enable interrupt while channel error occurs.
-
enumerator kEDMA_MajorInterruptEnable
Enable interrupt while major count exhausted.
-
enumerator kEDMA_HalfInterruptEnable
Enable interrupt while major count to half value.
-
enumerator kEDMA_ErrorInterruptEnable
-
enum _edma_transfer_type
eDMA transfer type
Values:
-
enumerator kEDMA_MemoryToMemory
Transfer from memory to memory
-
enumerator kEDMA_PeripheralToMemory
Transfer from peripheral to memory
-
enumerator kEDMA_MemoryToPeripheral
Transfer from memory to peripheral
-
enumerator kEDMA_PeripheralToPeripheral
Transfer from Peripheral to peripheral
-
enumerator kEDMA_MemoryToMemory
-
enum edma_channel_memory_attribute
eDMA channel memory attribute
Values:
-
enumerator kEDMA_ChannelNoWriteNoReadNoCacheNoBuffer
No write allocate, no read allocate, non-cacheable, non-bufferable.
-
enumerator kEDMA_ChannelNoWriteNoReadNoCacheBufferable
No write allocate, no read allocate, non-cacheable, bufferable.
-
enumerator kEDMA_ChannelNoWriteNoReadCacheableNoBuffer
No write allocate, no read allocate, cacheable, non-bufferable.
-
enumerator kEDMA_ChannelNoWriteNoReadCacheableBufferable
No write allocate, no read allocate, cacheable, bufferable.
-
enumerator kEDMA_ChannelNoWriteReadNoCacheNoBuffer
No write allocate, read allocate, non-cacheable, non-bufferable.
-
enumerator kEDMA_ChannelNoWriteReadNoCacheBufferable
No write allocate, read allocate, non-cacheable, bufferable.
-
enumerator kEDMA_ChannelNoWriteReadCacheableNoBuffer
No write allocate, read allocate, cacheable, non-bufferable.
-
enumerator kEDMA_ChannelNoWriteReadCacheableBufferable
No write allocate, read allocate, cacheable, bufferable.
-
enumerator kEDMA_ChannelWriteNoReadNoCacheNoBuffer
write allocate, no read allocate, non-cacheable, non-bufferable.
-
enumerator kEDMA_ChannelWriteNoReadNoCacheBufferable
write allocate, no read allocate, non-cacheable, bufferable.
-
enumerator kEDMA_ChannelWriteNoReadCacheableNoBuffer
write allocate, no read allocate, cacheable, non-bufferable.
-
enumerator kEDMA_ChannelWriteNoReadCacheableBufferable
write allocate, no read allocate, cacheable, bufferable.
-
enumerator kEDMA_ChannelWriteReadNoCacheNoBuffer
write allocate, read allocate, non-cacheable, non-bufferable.
-
enumerator kEDMA_ChannelWriteReadNoCacheBufferable
write allocate, read allocate, non-cacheable, bufferable.
-
enumerator kEDMA_ChannelWriteReadCacheableNoBuffer
write allocate, read allocate, cacheable, non-bufferable.
-
enumerator kEDMA_ChannelWriteReadCacheableBufferable
write allocate, read allocate, cacheable, bufferable.
-
enumerator kEDMA_ChannelNoWriteNoReadNoCacheNoBuffer
-
enum _edma_channel_swap_size
eDMA4 channel swap size
Values:
-
enumerator kEDMA_ChannelSwapDisabled
Swap is disabled.
-
enumerator kEDMA_ChannelReadWith8bitSwap
Swap occurs with respect to the read 8bit.
-
enumerator kEDMA_ChannelReadWith16bitSwap
Swap occurs with respect to the read 16bit.
-
enumerator kEDMA_ChannelReadWith32bitSwap
Swap occurs with respect to the read 32bit.
-
enumerator kEDMA_ChannelWriteWith8bitSwap
Swap occurs with respect to the write 8bit.
-
enumerator kEDMA_ChannelWriteWith16bitSwap
Swap occurs with respect to the write 16bit.
-
enumerator kEDMA_ChannelWriteWith32bitSwap
Swap occurs with respect to the write 32bit.
-
enumerator kEDMA_ChannelSwapDisabled
eDMA channel system bus information, _edma_channel_sys_bus_info
Values:
-
enumerator kEDMA_PrivilegedAccessLevel
Privileged Access Level for DMA transfers. 0b - User protection level; 1b - Privileged protection level.
-
enumerator kEDMA_MasterId
DMA’s master ID when channel is active and master ID replication is enabled.
-
enumerator kEDMA_PrivilegedAccessLevel
-
enum _edma_channel_access_type
eDMA4 channel access type
Values:
-
enumerator kEDMA_ChannelDataAccess
Data access for eDMA4 transfers.
-
enumerator kEDMA_ChannelInstructionAccess
Instruction access for eDMA4 transfers.
-
enumerator kEDMA_ChannelDataAccess
-
enum _edma_channel_protection_level
eDMA4 channel protection level
Values:
-
enumerator kEDMA_ChannelProtectionLevelUser
user protection level for eDMA transfers.
-
enumerator kEDMA_ChannelProtectionLevelPrivileged
Privileged protection level eDMA transfers.
-
enumerator kEDMA_ChannelProtectionLevelUser
-
typedef enum _edma_transfer_size edma_transfer_size_t
eDMA transfer configuration
-
typedef enum _edma_modulo edma_modulo_t
eDMA modulo configuration
-
typedef enum _edma_bandwidth edma_bandwidth_t
Bandwidth control.
-
typedef enum _edma_channel_link_type edma_channel_link_type_t
Channel link type.
-
typedef enum _edma_transfer_type edma_transfer_type_t
eDMA transfer type
-
typedef struct _edma_channel_Preemption_config edma_channel_Preemption_config_t
eDMA channel priority configuration
-
typedef struct _edma_minor_offset_config edma_minor_offset_config_t
eDMA minor offset configuration
-
typedef enum edma_channel_memory_attribute edma_channel_memory_attribute_t
eDMA channel memory attribute
-
typedef enum _edma_channel_swap_size edma_channel_swap_size_t
eDMA4 channel swap size
-
typedef enum _edma_channel_access_type edma_channel_access_type_t
eDMA4 channel access type
-
typedef enum _edma_channel_protection_level edma_channel_protection_level_t
eDMA4 channel protection level
-
typedef struct _edma_channel_config edma_channel_config_t
eDMA4 channel configuration
-
typedef edma_core_tcd_t edma_tcd_t
eDMA TCD.
This structure is same as TCD register which is described in reference manual, and is used to configure the scatter/gather feature as a next hardware TCD.
-
typedef struct _edma_transfer_config edma_transfer_config_t
edma4 channel transfer configuration
The transfer configuration structure support full feature configuration of the transfer control descriptor.
1.To perform a simple transfer, below members should be initialized at least .srcAddr - source address .dstAddr - destination address .srcWidthOfEachTransfer - data width of source address .dstWidthOfEachTransfer - data width of destination address, normally it should be as same as srcWidthOfEachTransfer .bytesEachRequest - bytes to be transferred in each DMA request .totalBytes - total bytes to be transferred .srcOffsetOfEachTransfer - offset value in bytes unit to be applied to source address as each source read is completed .dstOffsetOfEachTransfer - offset value in bytes unit to be applied to destination address as each destination write is completed enablchannelRequest - channel request can be enabled together with transfer configure submission
2.The transfer configuration structure also support advance feature: Programmable source/destination address range(MODULO) Programmable minor loop offset Programmable major loop offset Programmable channel chain feature Programmable channel transfer control descriptor link feature
Note
User should pay attention to the transfer size alignment limitation
the bytesEachRequest should align with the srcWidthOfEachTransfer and the dstWidthOfEachTransfer that is to say bytesEachRequest % srcWidthOfEachTransfer should be 0
the srcOffsetOfEachTransfer and dstOffsetOfEachTransfer must be aligne with transfer width
the totalBytes should align with the bytesEachRequest
the srcAddr should align with the srcWidthOfEachTransfer
the dstAddr should align with the dstWidthOfEachTransfer
the srcAddr should align with srcAddrModulo if modulo feature is enabled
the dstAddr should align with dstAddrModulo if modulo feature is enabled If anyone of above condition can not be satisfied, the edma4 interfaces will generate assert error.
-
typedef struct _edma_config edma_config_t
eDMA global configuration structure.
-
typedef void (*edma_callback)(struct _edma_handle *handle, void *userData, bool transferDone, uint32_t tcds)
Define callback function for eDMA.
This callback function is called in the EDMA interrupt handle. In normal mode, run into callback function means the transfer users need is done. In scatter gather mode, run into callback function means a transfer control block (tcd) is finished. Not all transfer finished, users can get the finished tcd numbers using interface EDMA_GetUnusedTCDNumber.
- Param handle:
EDMA handle pointer, users shall not touch the values inside.
- Param userData:
The callback user parameter pointer. Users can use this parameter to involve things users need to change in EDMA callback function.
- Param transferDone:
If the current loaded transfer done. In normal mode it means if all transfer done. In scatter gather mode, this parameter shows is the current transfer block in EDMA register is done. As the load of core is different, it will be different if the new tcd loaded into EDMA registers while this callback called. If true, it always means new tcd still not loaded into registers, while false means new tcd already loaded into registers.
- Param tcds:
How many tcds are done from the last callback. This parameter only used in scatter gather mode. It tells user how many tcds are finished between the last callback and this.
-
typedef struct _edma_handle edma_handle_t
eDMA transfer handle structure
-
FSL_EDMA_DRIVER_EDMA4
eDMA driver name
-
EDMA_ALLOCATE_TCD(name, number)
Macro used for allocate edma TCD.
-
DMA_DCHPRI_INDEX(channel)
Compute the offset unit from DCHPRI3.
-
struct _edma_channel_Preemption_config
- #include <fsl_edma.h>
eDMA channel priority configuration
Public Members
-
bool enableChannelPreemption
If true: a channel can be suspended by other channel with higher priority
-
bool enablePreemptAbility
If true: a channel can suspend other channel with low priority
-
uint8_t channelPriority
Channel priority
-
bool enableChannelPreemption
-
struct _edma_minor_offset_config
- #include <fsl_edma.h>
eDMA minor offset configuration
Public Members
-
bool enableSrcMinorOffset
Enable(true) or Disable(false) source minor loop offset.
-
bool enableDestMinorOffset
Enable(true) or Disable(false) destination minor loop offset.
-
uint32_t minorOffset
Offset for a minor loop mapping.
-
bool enableSrcMinorOffset
-
struct _edma_channel_config
- #include <fsl_edma.h>
eDMA4 channel configuration
Public Members
-
edma_channel_Preemption_config_t channelPreemptionConfig
channel preemption configuration
-
edma_channel_memory_attribute_t channelReadMemoryAttribute
channel memory read attribute configuration
-
edma_channel_memory_attribute_t channelWriteMemoryAttribute
channel memory write attribute configuration
-
edma_channel_swap_size_t channelSwapSize
channel swap size configuration
-
edma_channel_access_type_t channelAccessType
channel access type configuration
-
uint8_t channelDataSignExtensionBitPosition
channel data sign extension bit psition configuration
-
uint32_t channelRequestSource
hardware service request source for the channel
-
bool enableMasterIDReplication
enable master ID replication
-
edma_channel_protection_level_t protectionLevel
protection level
-
edma_channel_Preemption_config_t channelPreemptionConfig
-
struct _edma_transfer_config
- #include <fsl_edma.h>
edma4 channel transfer configuration
The transfer configuration structure support full feature configuration of the transfer control descriptor.
1.To perform a simple transfer, below members should be initialized at least .srcAddr - source address .dstAddr - destination address .srcWidthOfEachTransfer - data width of source address .dstWidthOfEachTransfer - data width of destination address, normally it should be as same as srcWidthOfEachTransfer .bytesEachRequest - bytes to be transferred in each DMA request .totalBytes - total bytes to be transferred .srcOffsetOfEachTransfer - offset value in bytes unit to be applied to source address as each source read is completed .dstOffsetOfEachTransfer - offset value in bytes unit to be applied to destination address as each destination write is completed enablchannelRequest - channel request can be enabled together with transfer configure submission
2.The transfer configuration structure also support advance feature: Programmable source/destination address range(MODULO) Programmable minor loop offset Programmable major loop offset Programmable channel chain feature Programmable channel transfer control descriptor link feature
Note
User should pay attention to the transfer size alignment limitation
the bytesEachRequest should align with the srcWidthOfEachTransfer and the dstWidthOfEachTransfer that is to say bytesEachRequest % srcWidthOfEachTransfer should be 0
the srcOffsetOfEachTransfer and dstOffsetOfEachTransfer must be aligne with transfer width
the totalBytes should align with the bytesEachRequest
the srcAddr should align with the srcWidthOfEachTransfer
the dstAddr should align with the dstWidthOfEachTransfer
the srcAddr should align with srcAddrModulo if modulo feature is enabled
the dstAddr should align with dstAddrModulo if modulo feature is enabled If anyone of above condition can not be satisfied, the edma4 interfaces will generate assert error.
Public Members
-
uint32_t srcAddr
Source data address.
-
uint32_t destAddr
Destination data address.
-
edma_transfer_size_t srcTransferSize
Source data transfer size.
-
edma_transfer_size_t destTransferSize
Destination data transfer size.
-
int16_t srcOffset
Sign-extended offset value in byte unit applied to the current source address to form the next-state value as each source read is completed
-
int16_t destOffset
Sign-extended offset value in byte unit applied to the current destination address to form the next-state value as each destination write is completed.
-
uint32_t minorLoopBytes
bytes in each minor loop or each request range: 1 - (2^30 -1) when minor loop mapping is enabled range: 1 - (2^10 - 1) when minor loop mapping is enabled and source or dest minor loop offset is enabled range: 1 - (2^32 - 1) when minor loop mapping is disabled
-
uint32_t majorLoopCounts
minor loop counts in each major loop, should be 1 at least for each transfer range: (0 - (2^15 - 1)) when minor loop channel link is disabled range: (0 - (2^9 - 1)) when minor loop channel link is enabled total bytes in a transfer = minorLoopCountsEachMajorLoop * bytesEachMinorLoop
-
uint16_t enabledInterruptMask
channel interrupt to enable, can be OR’ed value of _edma_interrupt_enable
-
edma_modulo_t srcAddrModulo
source circular data queue range
-
int32_t srcMajorLoopOffset
source major loop offset
-
edma_modulo_t dstAddrModulo
destination circular data queue range
-
int32_t dstMajorLoopOffset
destination major loop offset
-
bool enableSrcMinorLoopOffset
enable source minor loop offset
-
bool enableDstMinorLoopOffset
enable dest minor loop offset
-
int32_t minorLoopOffset
burst offset, the offset will be applied after minor loop update
-
bool enableChannelMajorLoopLink
channel link when major loop complete
-
uint32_t majorLoopLinkChannel
major loop link channel number
-
bool enableChannelMinorLoopLink
channel link when minor loop complete
-
uint32_t minorLoopLinkChannel
minor loop link channel number
-
edma_tcd_t *linkTCD
pointer to the link transfer control descriptor
-
struct _edma_config
- #include <fsl_edma.h>
eDMA global configuration structure.
Public Members
-
bool enableMasterIdReplication
Enable (true) master ID replication. If Master ID replication is disabled, the privileged protection level (supervisor mode) for eDMA4 transfers is used.
-
bool enableGlobalChannelLink
Enable(true) channel linking is available and controlled by each channel’s link settings.
-
bool enableHaltOnError
Enable (true) transfer halt on error. Any error causes the HALT bit to set. Subsequently, all service requests are ignored until the HALT bit is cleared.
-
bool enableDebugMode
Enable(true) eDMA4 debug mode. When in debug mode, the eDMA4 stalls the start of a new channel. Executing channels are allowed to complete.
-
bool enableRoundRobinArbitration
Enable(true) channel linking is available and controlled by each channel’s link settings.
-
edma_channel_config_t *channelConfig[1]
channel preemption configuration
-
bool enableMasterIdReplication
-
struct _edma_handle
- #include <fsl_edma.h>
eDMA transfer handle structure
Public Members
-
edma_callback callback
Callback function for major count exhausted.
-
void *userData
Callback function parameter.
-
EDMA_ChannelType *channelBase
eDMA peripheral channel base address.
-
EDMA_Type *base
eDMA peripheral base address
-
EDMA_TCDType *tcdBase
eDMA peripheral tcd base address.
-
edma_tcd_t *tcdPool
Pointer to memory stored TCDs.
-
uint32_t channel
eDMA channel number.
-
volatile int8_t header
The first TCD index. Should point to the next TCD to be loaded into the eDMA engine.
-
volatile int8_t tail
The last TCD index. Should point to the next TCD to be stored into the memory pool.
-
volatile int8_t tcdUsed
The number of used TCD slots. Should reflect the number of TCDs can be used/loaded in the memory.
-
volatile int8_t tcdSize
The total number of TCD slots in the queue.
-
edma_callback callback
eDMA core Driver
-
enum _edma_tcd_type
eDMA tcd flag type
Values:
-
enumerator kEDMA_EDMA4Flag
Data access for eDMA4 transfers.
-
enumerator kEDMA_EDMA5Flag
Instruction access for eDMA4 transfers.
-
enumerator kEDMA_EDMA4Flag
-
typedef struct _edma_core_mp edma_core_mp_t
edma core channel struture definition
-
typedef struct _edma_core_channel edma_core_channel_t
edma core channel struture definition
-
typedef enum _edma_tcd_type edma_tcd_type_t
eDMA tcd flag type
-
typedef struct _edma5_core_tcd edma5_core_tcd_t
edma5 core TCD struture definition
-
typedef struct _edma4_core_tcd edma4_core_tcd_t
edma4 core TCD struture definition
-
typedef struct _edma_core_tcd edma_core_tcd_t
edma core TCD struture definition
-
typedef edma_core_channel_t EDMA_ChannelType
EDMA typedef.
-
typedef edma_core_tcd_t EDMA_TCDType
-
typedef void EDMA_Type
-
DMA_CORE_MP_CSR_EDBG_MASK
-
DMA_CORE_MP_CSR_ERCA_MASK
-
DMA_CORE_MP_CSR_HAE_MASK
-
DMA_CORE_MP_CSR_HALT_MASK
-
DMA_CORE_MP_CSR_GCLC_MASK
-
DMA_CORE_MP_CSR_GMRC_MASK
-
DMA_CORE_MP_CSR_EDBG(x)
-
DMA_CORE_MP_CSR_ERCA(x)
-
DMA_CORE_MP_CSR_HAE(x)
-
DMA_CORE_MP_CSR_HALT(x)
-
DMA_CORE_MP_CSR_GCLC(x)
-
DMA_CORE_MP_CSR_GMRC(x)
-
DMA_CSR_INTMAJOR_MASK
-
DMA_CSR_INTHALF_MASK
-
DMA_CSR_DREQ_MASK
-
DMA_CSR_ESG_MASK
-
DMA_CSR_BWC_MASK
-
DMA_CSR_BWC(x)
-
DMA_CSR_START_MASK
-
DMA_CITER_ELINKNO_CITER_MASK
-
DMA_BITER_ELINKNO_BITER_MASK
-
DMA_CITER_ELINKNO_CITER_SHIFT
-
DMA_CITER_ELINKYES_CITER_MASK
-
DMA_CITER_ELINKYES_CITER_SHIFT
-
DMA_ATTR_SMOD_MASK
-
DMA_ATTR_DMOD_MASK
-
DMA_CITER_ELINKNO_ELINK_MASK
-
DMA_CSR_MAJORELINK_MASK
-
DMA_BITER_ELINKYES_ELINK_MASK
-
DMA_CITER_ELINKYES_ELINK_MASK
-
DMA_CSR_MAJORLINKCH_MASK
-
DMA_BITER_ELINKYES_LINKCH_MASK
-
DMA_CITER_ELINKYES_LINKCH_MASK
-
DMA_NBYTES_MLOFFYES_MLOFF_MASK
-
DMA_NBYTES_MLOFFYES_DMLOE_MASK
-
DMA_NBYTES_MLOFFYES_SMLOE_MASK
-
DMA_NBYTES_MLOFFNO_NBYTES_MASK
-
DMA_ATTR_DMOD(x)
-
DMA_ATTR_SMOD(x)
-
DMA_BITER_ELINKYES_LINKCH(x)
-
DMA_CITER_ELINKYES_LINKCH(x)
-
DMA_NBYTES_MLOFFYES_MLOFF(x)
-
DMA_NBYTES_MLOFFYES_DMLOE(x)
-
DMA_NBYTES_MLOFFYES_SMLOE(x)
-
DMA_NBYTES_MLOFFNO_NBYTES(x)
-
DMA_NBYTES_MLOFFYES_NBYTES(x)
-
DMA_ATTR_DSIZE(x)
-
DMA_ATTR_SSIZE(x)
-
DMA_CSR_DREQ(x)
-
DMA_CSR_MAJORLINKCH(x)
-
DMA_CH_MATTR_WCACHE(x)
-
DMA_CH_MATTR_RCACHE(x)
-
DMA_CH_CSR_SIGNEXT_MASK
-
DMA_CH_CSR_SIGNEXT_SHIFT
-
DMA_CH_CSR_SWAP_MASK
-
DMA_CH_CSR_SWAP_SHIFT
-
DMA_CH_SBR_INSTR_MASK
-
DMA_CH_SBR_INSTR_SHIFT
-
DMA_CH_MUX_SOURCE(x)
-
DMA_ERR_DBE_FLAG
DMA error flag.
-
DMA_ERR_SBE_FLAG
-
DMA_ERR_SGE_FLAG
-
DMA_ERR_NCE_FLAG
-
DMA_ERR_DOE_FLAG
-
DMA_ERR_DAE_FLAG
-
DMA_ERR_SOE_FLAG
-
DMA_ERR_SAE_FLAG
-
DMA_ERR_ERRCHAN_FLAG
-
DMA_ERR_ECX_FLAG
-
DMA_ERR_FLAG
-
DMA_CLEAR_DONE_STATUS(base, channel)
get/clear DONE bit
-
DMA_GET_DONE_STATUS(base, channel)
-
DMA_ENABLE_ERROR_INT(base, channel)
enable/disable error interupt
-
DMA_DISABLE_ERROR_INT(base, channel)
-
DMA_CLEAR_ERROR_STATUS(base, channel)
get/clear error status
-
DMA_GET_ERROR_STATUS(base, channel)
-
DMA_CLEAR_INT_STATUS(base, channel)
get/clear INT status
-
DMA_GET_INT_STATUS(base, channel)
-
DMA_ENABLE_MAJOR_INT(base, channel)
enable/dsiable MAJOR/HALF INT
-
DMA_ENABLE_HALF_INT(base, channel)
-
DMA_DISABLE_MAJOR_INT(base, channel)
-
DMA_DISABLE_HALF_INT(base, channel)
-
EDMA_TCD_ALIGN_SIZE
EDMA tcd align size.
-
EDMA_CORE_BASE(base)
EDMA base address convert macro.
-
EDMA_MP_BASE(base)
-
EDMA_CHANNEL_BASE(base, channel)
-
EDMA_TCD_BASE(base, channel)
-
EDMA_TCD_TYPE(x)
EDMA TCD type macro.
-
EDMA_TCD_SADDR(tcd, flag)
EDMA TCD address convert macro.
-
EDMA_TCD_SOFF(tcd, flag)
-
EDMA_TCD_ATTR(tcd, flag)
-
EDMA_TCD_NBYTES(tcd, flag)
-
EDMA_TCD_SLAST(tcd, flag)
-
EDMA_TCD_DADDR(tcd, flag)
-
EDMA_TCD_DOFF(tcd, flag)
-
EDMA_TCD_CITER(tcd, flag)
-
EDMA_TCD_DLAST_SGA(tcd, flag)
-
EDMA_TCD_CSR(tcd, flag)
-
EDMA_TCD_BITER(tcd, flag)
-
struct _edma_core_mp
- #include <fsl_edma_core.h>
edma core channel struture definition
Public Members
- __IO uint32_t MP_CSR
Channel Control and Status, array offset: 0x10000, array step: 0x10000
- __IO uint32_t MP_ES
Channel Error Status, array offset: 0x10004, array step: 0x10000
-
struct _edma_core_channel
- #include <fsl_edma_core.h>
edma core channel struture definition
Public Members
- __IO uint32_t CH_CSR
Channel Control and Status, array offset: 0x10000, array step: 0x10000
- __IO uint32_t CH_ES
Channel Error Status, array offset: 0x10004, array step: 0x10000
- __IO uint32_t CH_INT
Channel Interrupt Status, array offset: 0x10008, array step: 0x10000
- __IO uint32_t CH_SBR
Channel System Bus, array offset: 0x1000C, array step: 0x10000
- __IO uint32_t CH_PRI
Channel Priority, array offset: 0x10010, array step: 0x10000
-
struct _edma5_core_tcd
- #include <fsl_edma_core.h>
edma5 core TCD struture definition
Public Members
- __IO uint32_t SADDR
SADDR register, used to save source address
- __IO uint32_t SADDR_HIGH
SADDR HIGH register, used to save source address
- __IO uint16_t SOFF
SOFF register, save offset bytes every transfer
- __IO uint16_t ATTR
ATTR register, source/destination transfer size and modulo
- __IO uint32_t NBYTES
Nbytes register, minor loop length in bytes
- __IO uint32_t SLAST
SLAST register
- __IO uint32_t SLAST_SDA_HIGH
SLAST SDA HIGH register
- __IO uint32_t DADDR
DADDR register, used for destination address
- __IO uint32_t DADDR_HIGH
DADDR HIGH register, used for destination address
- __IO uint32_t DLAST_SGA
DLASTSGA register, next tcd address used in scatter-gather mode
- __IO uint32_t DLAST_SGA_HIGH
DLASTSGA HIGH register, next tcd address used in scatter-gather mode
- __IO uint16_t DOFF
DOFF register, used for destination offset
- __IO uint16_t CITER
CITER register, current minor loop numbers, for unfinished minor loop.
- __IO uint16_t CSR
CSR register, for TCD control status
- __IO uint16_t BITER
BITER register, begin minor loop count.
-
uint8_t RESERVED[16]
Aligned 64 bytes
-
struct _edma4_core_tcd
- #include <fsl_edma_core.h>
edma4 core TCD struture definition
Public Members
- __IO uint32_t SADDR
SADDR register, used to save source address
- __IO uint16_t SOFF
SOFF register, save offset bytes every transfer
- __IO uint16_t ATTR
ATTR register, source/destination transfer size and modulo
- __IO uint32_t NBYTES
Nbytes register, minor loop length in bytes
- __IO uint32_t SLAST
SLAST register
- __IO uint32_t DADDR
DADDR register, used for destination address
- __IO uint16_t DOFF
DOFF register, used for destination offset
- __IO uint16_t CITER
CITER register, current minor loop numbers, for unfinished minor loop.
- __IO uint32_t DLAST_SGA
DLASTSGA register, next tcd address used in scatter-gather mode
- __IO uint16_t CSR
CSR register, for TCD control status
- __IO uint16_t BITER
BITER register, begin minor loop count.
-
struct _edma_core_tcd
- #include <fsl_edma_core.h>
edma core TCD struture definition
-
union MP_REGS
Public Members
-
struct _edma_core_mp EDMA5_REG
-
struct _edma_core_mp EDMA5_REG
-
struct EDMA5_REG
Public Members
- __IO uint32_t MP_INT_LOW
Channel Control and Status, array offset: 0x10008, array step: 0x10000
- __I uint32_t MP_INT_HIGH
Channel Control and Status, array offset: 0x1000C, array step: 0x10000
- __I uint32_t MP_HRS_LOW
Channel Control and Status, array offset: 0x10010, array step: 0x10000
- __I uint32_t MP_HRS_HIGH
Channel Control and Status, array offset: 0x10014, array step: 0x10000
- __IO uint32_t MP_STOPCH
Channel Control and Status, array offset: 0x10020, array step: 0x10000
- __I uint32_t MP_SSR_LOW
Channel Control and Status, array offset: 0x10030, array step: 0x10000
- __I uint32_t MP_SSR_HIGH
Channel Control and Status, array offset: 0x10034, array step: 0x10000
- __IO uint32_t CH_GRPRI [64]
Channel Control and Status, array offset: 0x10100, array step: 0x10000
- __IO uint32_t CH_MUX [64]
Channel Control and Status, array offset: 0x10200, array step: 0x10000
- __IO uint32_t CH_PROT [64]
Channel Control and Status, array offset: 0x10400, array step: 0x10000
-
union CH_REGS
-
struct EDMA5_REG
Public Members
- __IO uint32_t CH_MATTR
Memory Attributes Register, array offset: 0x10018, array step: 0x8000
-
struct EDMA4_REG
Public Members
- __IO uint32_t CH_MUX
Channel Multiplexor Configuration, array offset: 0x10014, array step: 0x10000
- __IO uint16_t CH_MATTR
Memory Attributes Register, array offset: 0x10018, array step: 0x8000
-
union TCD_REGS
Public Members
-
edma4_core_tcd_t edma4_tcd
-
edma4_core_tcd_t edma4_tcd
eDMA soc Driver
-
FSL_EDMA_SOC_DRIVER_VERSION
Driver version 1.0.0.
-
FSL_EDMA_SOC_IP_DMA3
DMA IP version.
-
FSL_EDMA_SOC_IP_DMA4
-
EDMA_BASE_PTRS
DMA base table.
-
EDMA_CHN_IRQS
-
FSL_FEATURE_EDMA_HAS_GLOBAL_MASTER_ID_REPLICATION
-
FSL_FEATURE_EDMA_HAS_CONTINUOUS_LINK_MODE
-
FSL_FEATURE_EDMA_MODULE_COUNT
-
FSL_FEATURE_EDMA_HAS_CHANNEL_CONFIG
-
FSL_FEATURE_EDMA_HAS_CHANNEL_SWAP_SIZE
-
FSL_FEATURE_EDMA_HAS_CHANNEL_ACCESS_TYPE
-
FSL_FEATURE_EDMA_HAS_CHANNEL_MEMRORY_ATTRIBUTE
-
FSL_FEATURE_EDMA_HAS_CHANNEL_SIGN_EXTENSION
-
FSL_FEATURE_EDMA_MODULE_SUPPORT_MATTR(base)
-
FSL_FEATURE_EDMA_MODULE_SUPPORT_SIGN_EXTENSION(base)
-
FSL_FEATURE_EDMA_MODULE_SUPPORT_SWAP(base)
-
FSL_FEATURE_EDMA_MODULE_SUPPORT_INSTR(base)
-
EDMA_CHANNEL_OFFSET
EDMA base address convert macro.
-
EDMA_CHANNEL_ARRAY_STEP(base)
FGPIO Driver
GPIO: General-Purpose Input/Output Driver
-
FSL_GPIO_DRIVER_VERSION
GPIO driver version.
-
enum _gpio_pin_direction
GPIO direction definition.
Values:
-
enumerator kGPIO_DigitalInput
Set current pin as digital input
-
enumerator kGPIO_DigitalOutput
Set current pin as digital output
-
enumerator kGPIO_DigitalInput
-
enum _gpio_checker_attribute
GPIO checker attribute.
Values:
-
enumerator kGPIO_UsernonsecureRWUsersecureRWPrivilegedsecureRW
User nonsecure:Read+Write; User Secure:Read+Write; Privileged Secure:Read+Write
-
enumerator kGPIO_UsernonsecureRUsersecureRWPrivilegedsecureRW
User nonsecure:Read; User Secure:Read+Write; Privileged Secure:Read+Write
-
enumerator kGPIO_UsernonsecureNUsersecureRWPrivilegedsecureRW
User nonsecure:None; User Secure:Read+Write; Privileged Secure:Read+Write
-
enumerator kGPIO_UsernonsecureRUsersecureRPrivilegedsecureRW
User nonsecure:Read; User Secure:Read; Privileged Secure:Read+Write
-
enumerator kGPIO_UsernonsecureNUsersecureRPrivilegedsecureRW
User nonsecure:None; User Secure:Read; Privileged Secure:Read+Write
-
enumerator kGPIO_UsernonsecureNUsersecureNPrivilegedsecureRW
User nonsecure:None; User Secure:None; Privileged Secure:Read+Write
-
enumerator kGPIO_UsernonsecureNUsersecureNPrivilegedsecureR
User nonsecure:None; User Secure:None; Privileged Secure:Read
-
enumerator kGPIO_UsernonsecureNUsersecureNPrivilegedsecureN
User nonsecure:None; User Secure:None; Privileged Secure:None
-
enumerator kGPIO_IgnoreAttributeCheck
Ignores the attribute check
-
enumerator kGPIO_UsernonsecureRWUsersecureRWPrivilegedsecureRW
-
enum _gpio_interrupt_config
Configures the interrupt generation condition.
Values:
-
enumerator kGPIO_InterruptStatusFlagDisabled
Interrupt status flag is disabled.
-
enumerator kGPIO_DMARisingEdge
ISF flag and DMA request on rising edge.
-
enumerator kGPIO_DMAFallingEdge
ISF flag and DMA request on falling edge.
-
enumerator kGPIO_DMAEitherEdge
ISF flag and DMA request on either edge.
-
enumerator kGPIO_FlagRisingEdge
Flag sets on rising edge.
-
enumerator kGPIO_FlagFallingEdge
Flag sets on falling edge.
-
enumerator kGPIO_FlagEitherEdge
Flag sets on either edge.
-
enumerator kGPIO_InterruptLogicZero
Interrupt when logic zero.
-
enumerator kGPIO_InterruptRisingEdge
Interrupt on rising edge.
-
enumerator kGPIO_InterruptFallingEdge
Interrupt on falling edge.
-
enumerator kGPIO_InterruptEitherEdge
Interrupt on either edge.
-
enumerator kGPIO_InterruptLogicOne
Interrupt when logic one.
-
enumerator kGPIO_ActiveHighTriggerOutputEnable
Enable active high-trigger output.
-
enumerator kGPIO_ActiveLowTriggerOutputEnable
Enable active low-trigger output.
-
enumerator kGPIO_InterruptStatusFlagDisabled
-
enum _gpio_interrupt_selection
Configures the selection of interrupt/DMA request/trigger output.
Values:
-
enumerator kGPIO_InterruptOutput0
Interrupt/DMA request/trigger output 0.
-
enumerator kGPIO_InterruptOutput1
Interrupt/DMA request/trigger output 1.
-
enumerator kGPIO_InterruptOutput0
-
enum gpio_pin_interrupt_control_t
GPIO pin and interrupt control.
Values:
-
enumerator kGPIO_PinControlNonSecure
Pin Control Non-Secure.
-
enumerator kGPIO_InterruptControlNonSecure
Interrupt Control Non-Secure.
-
enumerator kGPIO_PinControlNonPrivilege
Pin Control Non-Privilege.
-
enumerator kGPIO_InterruptControlNonPrivilege
Interrupt Control Non-Privilege.
-
enumerator kGPIO_PinControlNonSecure
-
typedef enum _gpio_pin_direction gpio_pin_direction_t
GPIO direction definition.
-
typedef enum _gpio_checker_attribute gpio_checker_attribute_t
GPIO checker attribute.
-
typedef struct _gpio_pin_config gpio_pin_config_t
The GPIO pin configuration structure.
Each pin can only be configured as either an output pin or an input pin at a time. If configured as an input pin, leave the outputConfig unused. Note that in some use cases, the corresponding port property should be configured in advance with the PORT_SetPinConfig().
-
typedef enum _gpio_interrupt_config gpio_interrupt_config_t
Configures the interrupt generation condition.
-
typedef enum _gpio_interrupt_selection gpio_interrupt_selection_t
Configures the selection of interrupt/DMA request/trigger output.
-
typedef struct _gpio_version_info gpio_version_info_t
GPIO version information.
-
GPIO_FIT_REG(value)
-
struct _gpio_pin_config
- #include <fsl_gpio.h>
The GPIO pin configuration structure.
Each pin can only be configured as either an output pin or an input pin at a time. If configured as an input pin, leave the outputConfig unused. Note that in some use cases, the corresponding port property should be configured in advance with the PORT_SetPinConfig().
Public Members
-
gpio_pin_direction_t pinDirection
GPIO direction, input or output
-
uint8_t outputLogic
Set a default output logic, which has no use in input
-
gpio_pin_direction_t pinDirection
-
struct _gpio_version_info
- #include <fsl_gpio.h>
GPIO version information.
Public Members
-
uint16_t feature
Feature Specification Number.
-
uint8_t minor
Minor Version Number.
-
uint8_t major
Major Version Number.
-
uint16_t feature
GPIO Driver
-
void GPIO_PortInit(GPIO_Type *base)
Initializes the GPIO peripheral.
This function ungates the GPIO clock.
- Parameters:
base – GPIO peripheral base pointer.
-
void GPIO_PortDenit(GPIO_Type *base)
Denitializes the GPIO peripheral.
- Parameters:
base – GPIO peripheral base pointer.
-
void GPIO_PinInit(GPIO_Type *base, uint32_t pin, const gpio_pin_config_t *config)
Initializes a GPIO pin used by the board.
To initialize the GPIO, define a pin configuration, as either input or output, in the user file. Then, call the GPIO_PinInit() function.
This is an example to define an input pin or an output pin configuration.
Define a digital input pin configuration, gpio_pin_config_t config = { kGPIO_DigitalInput, 0, } Define a digital output pin configuration, gpio_pin_config_t config = { kGPIO_DigitalOutput, 0, }
- Parameters:
base – GPIO peripheral base pointer (GPIOA, GPIOB, GPIOC, and so on.)
pin – GPIO port pin number
config – GPIO pin configuration pointer
-
void GPIO_GetVersionInfo(GPIO_Type *base, gpio_version_info_t *info)
Get GPIO version information.
- Parameters:
base – GPIO peripheral base pointer (GPIOA, GPIOB, GPIOC, and so on.)
info – GPIO version information
-
static inline void GPIO_SecurePrivilegeLock(GPIO_Type *base, gpio_pin_interrupt_control_t mask)
lock or unlock secure privilege.
- Parameters:
base – GPIO peripheral base pointer (GPIOA, GPIOB, GPIOC, and so on.)
mask – pin or interrupt macro
-
static inline void GPIO_EnablePinControlNonSecure(GPIO_Type *base, uint32_t mask)
Enable Pin Control Non-Secure.
- Parameters:
base – GPIO peripheral base pointer (GPIOA, GPIOB, GPIOC, and so on.)
mask – GPIO pin number macro
-
static inline void GPIO_DisablePinControlNonSecure(GPIO_Type *base, uint32_t mask)
Disable Pin Control Non-Secure.
- Parameters:
base – GPIO peripheral base pointer (GPIOA, GPIOB, GPIOC, and so on.)
mask – GPIO pin number macro
-
static inline void GPIO_EnablePinControlNonPrivilege(GPIO_Type *base, uint32_t mask)
Enable Pin Control Non-Privilege.
- Parameters:
base – GPIO peripheral base pointer (GPIOA, GPIOB, GPIOC, and so on.)
mask – GPIO pin number macro
-
static inline void GPIO_DisablePinControlNonPrivilege(GPIO_Type *base, uint32_t mask)
Disable Pin Control Non-Privilege.
- Parameters:
base – GPIO peripheral base pointer (GPIOA, GPIOB, GPIOC, and so on.)
mask – GPIO pin number macro
-
static inline void GPIO_EnableInterruptControlNonSecure(GPIO_Type *base, uint32_t mask)
Enable Interrupt Control Non-Secure.
- Parameters:
base – GPIO peripheral base pointer (GPIOA, GPIOB, GPIOC, and so on.)
mask – GPIO pin number macro
-
static inline void GPIO_DisableInterruptControlNonSecure(GPIO_Type *base, uint32_t mask)
Disable Interrupt Control Non-Secure.
- Parameters:
base – GPIO peripheral base pointer (GPIOA, GPIOB, GPIOC, and so on.)
mask – GPIO pin number macro
-
static inline void GPIO_EnableInterruptControlNonPrivilege(GPIO_Type *base, uint32_t mask)
Enable Interrupt Control Non-Privilege.
- Parameters:
base – GPIO peripheral base pointer (GPIOA, GPIOB, GPIOC, and so on.)
mask – GPIO pin number macro
-
static inline void GPIO_DisableInterruptControlNonPrivilege(GPIO_Type *base, uint32_t mask)
Disable Interrupt Control Non-Privilege.
- Parameters:
base – GPIO peripheral base pointer (GPIOA, GPIOB, GPIOC, and so on.)
mask – GPIO pin number macro
-
static inline void GPIO_PortInputEnable(GPIO_Type *base, uint32_t mask)
Enable port input.
- Parameters:
base – GPIO peripheral base pointer (GPIOA, GPIOB, GPIOC, and so on.)
mask – GPIO pin number macro
-
static inline void GPIO_PortInputDisable(GPIO_Type *base, uint32_t mask)
Disable port input.
- Parameters:
base – GPIO peripheral base pointer (GPIOA, GPIOB, GPIOC, and so on.)
mask – GPIO pin number macro
-
static inline void GPIO_PinWrite(GPIO_Type *base, uint32_t pin, uint8_t output)
Sets the output level of the multiple GPIO pins to the logic 1 or 0.
- Parameters:
base – GPIO peripheral base pointer (GPIOA, GPIOB, GPIOC, and so on.)
pin – GPIO pin number
output – GPIO pin output logic level.
0: corresponding pin output low-logic level.
1: corresponding pin output high-logic level.
-
static inline void GPIO_PortSet(GPIO_Type *base, uint32_t mask)
Sets the output level of the multiple GPIO pins to the logic 1.
- Parameters:
base – GPIO peripheral base pointer (GPIOA, GPIOB, GPIOC, and so on.)
mask – GPIO pin number macro
-
static inline void GPIO_PortClear(GPIO_Type *base, uint32_t mask)
Sets the output level of the multiple GPIO pins to the logic 0.
- Parameters:
base – GPIO peripheral base pointer (GPIOA, GPIOB, GPIOC, and so on.)
mask – GPIO pin number macro
-
static inline void GPIO_PortToggle(GPIO_Type *base, uint32_t mask)
Reverses the current output logic of the multiple GPIO pins.
- Parameters:
base – GPIO peripheral base pointer (GPIOA, GPIOB, GPIOC, and so on.)
mask – GPIO pin number macro
-
static inline uint32_t GPIO_PinRead(GPIO_Type *base, uint32_t pin)
Reads the current input value of the GPIO port.
- Parameters:
base – GPIO peripheral base pointer (GPIOA, GPIOB, GPIOC, and so on.)
pin – GPIO pin number
- Return values:
GPIO – port input value
0: corresponding pin input low-logic level.
1: corresponding pin input high-logic level.
-
static inline void GPIO_SetPinInterruptConfig(GPIO_Type *base, uint32_t pin, gpio_interrupt_config_t config)
Configures the gpio pin interrupt/DMA request.
- Parameters:
base – GPIO peripheral base pointer.
pin – GPIO pin number.
config – GPIO pin interrupt configuration.
kGPIO_InterruptStatusFlagDisabled: Interrupt/DMA request disabled.
kGPIO_DMARisingEdge : DMA request on rising edge(if the DMA requests exit).
kGPIO_DMAFallingEdge: DMA request on falling edge(if the DMA requests exit).
kGPIO_DMAEitherEdge : DMA request on either edge(if the DMA requests exit).
kGPIO_FlagRisingEdge : Flag sets on rising edge(if the Flag states exit).
kGPIO_FlagFallingEdge : Flag sets on falling edge(if the Flag states exit).
kGPIO_FlagEitherEdge : Flag sets on either edge(if the Flag states exit).
kGPIO_InterruptLogicZero : Interrupt when logic zero.
kGPIO_InterruptRisingEdge : Interrupt on rising edge.
kGPIO_InterruptFallingEdge: Interrupt on falling edge.
kGPIO_InterruptEitherEdge : Interrupt on either edge.
kGPIO_InterruptLogicOne : Interrupt when logic one.
kGPIO_ActiveHighTriggerOutputEnable : Enable active high-trigger output (if the trigger states exit).
kGPIO_ActiveLowTriggerOutputEnable : Enable active low-trigger output (if the trigger states exit).
-
static inline void GPIO_SetPinInterruptChannel(GPIO_Type *base, uint32_t pin, gpio_interrupt_selection_t selection)
Configures the gpio pin interrupt/DMA request/trigger output channel selection.
- Parameters:
base – GPIO peripheral base pointer.
pin – GPIO pin number.
selection – GPIO pin interrupt output selection.
kGPIO_InterruptOutput0: Interrupt/DMA request/trigger output 0.
kGPIO_InterruptOutput1 : Interrupt/DMA request/trigger output 1.
-
uint32_t GPIO_GpioGetInterruptFlags(GPIO_Type *base)
Read the GPIO interrupt status flags.
- Parameters:
base – GPIO peripheral base pointer. (GPIOA, GPIOB, GPIOC, and so on.)
- Returns:
The current GPIO’s interrupt status flag. ‘1’ means the related pin’s flag is set, ‘0’ means the related pin’s flag not set. For example, the return value 0x00010001 means the pin 0 and 17 have the interrupt pending.
-
uint32_t GPIO_GpioGetInterruptChannelFlags(GPIO_Type *base, uint32_t channel)
Read the GPIO interrupt status flags based on selected interrupt channel(IRQS).
- Parameters:
base – GPIO peripheral base pointer. (GPIOA, GPIOB, GPIOC, and so on.)
channel – ‘0’ means selete interrupt channel 0, ‘1’ means selete interrupt channel 1.
- Returns:
The current GPIO’s interrupt status flag based on the selected interrupt channel. ‘1’ means the related pin’s flag is set, ‘0’ means the related pin’s flag not set. For example, the return value 0x00010001 means the pin 0 and 17 have the interrupt pending.
-
uint8_t GPIO_PinGetInterruptFlag(GPIO_Type *base, uint32_t pin)
Read individual pin’s interrupt status flag.
- Parameters:
base – GPIO peripheral base pointer. (GPIOA, GPIOB, GPIOC, and so on)
pin – GPIO specific pin number.
- Returns:
The current selected pin’s interrupt status flag.
-
void GPIO_GpioClearInterruptFlags(GPIO_Type *base, uint32_t mask)
Clears GPIO pin interrupt status flags.
- Parameters:
base – GPIO peripheral base pointer (GPIOA, GPIOB, GPIOC, and so on.)
mask – GPIO pin number macro
-
void GPIO_GpioClearInterruptChannelFlags(GPIO_Type *base, uint32_t mask, uint32_t channel)
Clears GPIO pin interrupt status flags based on selected interrupt channel(IRQS).
- Parameters:
base – GPIO peripheral base pointer (GPIOA, GPIOB, GPIOC, and so on.)
mask – GPIO pin number macro
channel – ‘0’ means selete interrupt channel 0, ‘1’ means selete interrupt channel 1.
-
void GPIO_PinClearInterruptFlag(GPIO_Type *base, uint32_t pin)
Clear GPIO individual pin’s interrupt status flag.
- Parameters:
base – GPIO peripheral base pointer (GPIOA, GPIOB, GPIOC, and so on).
pin – GPIO specific pin number.
-
static inline void GPIO_SetMultipleInterruptPinsConfig(GPIO_Type *base, uint32_t mask, gpio_interrupt_config_t config)
Sets the GPIO interrupt configuration in PCR register for multiple pins.
- Parameters:
base – GPIO peripheral base pointer.
mask – GPIO pin number macro.
config – GPIO pin interrupt configuration.
kGPIO_InterruptStatusFlagDisabled: Interrupt disabled.
kGPIO_DMARisingEdge : DMA request on rising edge(if the DMA requests exit).
kGPIO_DMAFallingEdge: DMA request on falling edge(if the DMA requests exit).
kGPIO_DMAEitherEdge : DMA request on either edge(if the DMA requests exit).
kGPIO_FlagRisingEdge : Flag sets on rising edge(if the Flag states exit).
kGPIO_FlagFallingEdge : Flag sets on falling edge(if the Flag states exit).
kGPIO_FlagEitherEdge : Flag sets on either edge(if the Flag states exit).
kGPIO_InterruptLogicZero : Interrupt when logic zero.
kGPIO_InterruptRisingEdge : Interrupt on rising edge.
kGPIO_InterruptFallingEdge: Interrupt on falling edge.
kGPIO_InterruptEitherEdge : Interrupt on either edge.
kGPIO_InterruptLogicOne : Interrupt when logic one.
kGPIO_ActiveHighTriggerOutputEnable : Enable active high-trigger output (if the trigger states exit).
kGPIO_ActiveLowTriggerOutputEnable : Enable active low-trigger output (if the trigger states exit)..
-
void GPIO_CheckAttributeBytes(GPIO_Type *base, gpio_checker_attribute_t attribute)
brief The GPIO module supports a device-specific number of data ports, organized as 32-bit words/8-bit Bytes. Each 32-bit/8-bit data port includes a GACR register, which defines the byte-level attributes required for a successful access to the GPIO programming model. If the GPIO module’s GACR register organized as 32-bit words, the attribute controls for the 4 data bytes in the GACR follow a standard little endian data convention.
- Parameters:
base – GPIO peripheral base pointer (GPIOA, GPIOB, GPIOC, and so on.)
attribute – GPIO checker attribute
IPMQ Driver
-
enum _ipmq_ret_value
Defines the enumeration type for IPMQ return values.
This enumeration type defines various return values for IPMQ message queue operations, indicating the status of these operations.
Values:
-
enumerator kIPMQ_Ret_Error
Operation error
-
enumerator kIPMQ_Ret_ReceiveUnkownMsg
Received unknown message
-
enumerator kIPMQ_Ret_ReceiveOpcodeMismatch
Received a message with mismatched opcode
-
enumerator kIPMQ_Ret_ReceiveUserDataMismatch
Received a message with mismatched user data
-
enumerator kIPMQ_Ret_ReceiveAck
Successfully received an acknowledgement message
-
enumerator kIPMQ_Ret_ReceiveNACK
Successfully received a negative acknowledgement message
-
enumerator kIPMQ_Ret_Error
-
enum _ipmq_msg_type
Defines an enumeration for IPMQ message types.
This enumeration defines various message types within the message queue, used to distinguish different categories of messages.
Values:
-
enumerator kIPMQ_MsgType_Message
Regular message type
-
enumerator kIPMQ_MsgType_ACK
Acknowledgement message type
-
enumerator kIPMQ_MsgType_NACK
Negative acknowledgement message type
-
enumerator kIPMQ_MsgType_Reserved
Reserved message type for future use
-
enumerator kIPMQ_MsgType_Message
-
enum _ipmq_msg_opcode
Enumeration of IPMQ Message Opcodes.
This enumeration lists the different message opcodes supported by the IPMQ messaging system, which define the specific actions or operations to be performed on the target device.
Values:
-
enumerator kIPMQ_MsgOpcode_BootReason
Opcode for querying the reason of boot
-
enumerator kIPMQ_MsgOpcode_DataLoad
Opcode for loading data
-
enumerator kIPMQ_MsgOpcode_AdvcEnable
Opcode to enable ADVC functionality
-
enumerator kIPMQ_MsgOpcode_RegisterWrite
Opcode to write to a register
-
enumerator kIPMQ_MsgOpcode_RegisterRead
Opcode to read from a register
-
enumerator kIPMQ_MsgOpcode_GpioInit
Opcode to initialize GPIO
-
enumerator kIPMQ_MsgOpcode_GpioSet
Opcode to set GPIO state
-
enumerator kIPMQ_MsgOpcode_GpioGet
Opcode to get GPIO state
-
enumerator kIPMQ_MsgOpcode_GpioDeinit
Opcode to deinitialize GPIO
-
enumerator kIPMQ_MsgOpcode_UartInit
Opcode to initialize UART
-
enumerator kIPMQ_MsgOpcode_UartPinsSelect
Opcode to select UART pins
-
enumerator kIPMQ_MsgOpcode_UartRbInit
Opcode to initialize UART ring buffer
-
enumerator kIPMQ_MsgOpcode_UartRead
Opcode to read from UART
-
enumerator kIPMQ_MsgOpcode_UartRbDeinit
Opcode to deinitialize UART ring buffer
-
enumerator kIPMQ_MsgOpcode_UartDeinit
Opcode to deinitialize UART
-
enumerator kIPMQ_MsgOpcode_I2cPinsSelect
Opcode to select I2C pins
-
enumerator kIPMQ_MsgOpcode_I2cMasterInit
Opcode to initialize I2C master
-
enumerator kIPMQ_MsgOpcode_I2cMasterCreatehandle
Opcode to create an I2C master handle
-
enumerator kIPMQ_MsgOpcode_I2cMasterTransfernonblocking
Opcode for non-blocking I2C master transfer
-
enumerator kIPMQ_MsgOpcode_I2cMasterDeinit
Opcode to deinitialize I2C master
-
enumerator kIPMQ_MsgOpcode_I2cSlaveInit
Opcode to initialize I2C slave
-
enumerator kIPMQ_MsgOpcode_I2cSlaveCreatehandle
Opcode to create an I2C slave handle
-
enumerator kIPMQ_MsgOpcode_I2cSlaveTransfernonblocking
Opcode for non-blocking I2C slave transfer
-
enumerator kIPMQ_MsgOpcode_I2cRead
Opcode to read from I2C
-
enumerator kIPMQ_MsgOpcode_I2cSlaveDeinit
Opcode to deinitialize I2C slave
-
enumerator kIPMQ_MsgOpcode_Ping
Opcode for ping operation
-
enumerator kIPMQ_MsgOpcode_ApiDeinit
Opcode to deinitialize API
-
enumerator kIPMQ_MsgOpcode_RegisterReadModifyWrite
Opcode for reading, modifying, and writing to a register
-
enumerator kIPMQ_MsgOpcode_RtcIsAlive
Opcode to check if RTC is alive
-
enumerator kIPMQ_MsgOpcode_RtcSetAlarm
Opcode to set RTC alarm
-
enumerator kIPMQ_MsgOpcode_RtcClearAlarm
Opcode to clear RTC alarm
-
enumerator kIPMQ_MsgOpcode_RtcGetCounter
Opcode to get RTC counter value
-
enumerator kIPMQ_MsgOpcode_RtcLiveDetectorEnable
Opcode to enable RTC live detector
-
enumerator kIPMQ_MsgOpcode_RtcAnalogDone
Opcode for RTC analog done event
-
enumerator kIPMQ_MsgOpcode_SecuritySet
Opcode to set security settings
-
enumerator kIPMQ_MsgOpcode_ComparatorInit
Opcode to initialize comparator
-
enumerator kIPMQ_MsgOpcode_ComparatorDeinit
Opcode to deinitialize comparator
-
enumerator kIPMQ_MsgOpcode_ComparatorInterruptEn
Opcode to enable comparator interrupt
-
enumerator kIPMQ_MsgOpcode_MemoryRead
Opcode to read memory
-
enumerator kIPMQ_MsgOpcode_MemoryWrite
Opcode to write to memory
-
enumerator kIPMQ_MsgOpcode_MemoryLock
Opcode to lock memory
-
enumerator kIPMQ_MsgOpcode_DebugEn
Opcode to enable debug mode
-
enumerator kIPMQ_MsgOpcode_AdvcEn
Opcode to enable ADV feature
-
enumerator kIPMQ_MsgOpcode_AdvcPreVoltageReqest
Opcode for ADV pre-voltage request
-
enumerator kIPMQ_MsgOpcode_AdvcPostChangeFrequencyVoltageRequest
Opcode for ADV post-change frequency voltage request
-
enumerator kIPMQ_MsgOpcode_UpdateTemperature
Opcode to update temperature
-
enumerator kIPMQ_MsgOpcode_DeepPowerDown
Opcode to enter deep power down mode
-
enumerator kIPMQ_MsgOpcode_DeepPowerDownAbort
Opcode to abort deep power down mode
-
enumerator kIPMQ_MsgOpcode_RomDone
Opcode for ROM done event
-
enumerator kIPMQ_MsgOpcode_UartMode
Opcode to configure UART mode
-
enumerator kIPMQ_MsgOpcode_LogReset
Opcode to reset logs
-
enumerator kIPMQ_MsgOpcode_LogDump
Opcode to dump logs
-
enumerator kIPMQ_MsgOpcode_WakeupSource
Opcode related to wakeup source
-
enumerator kIPMQ_MsgOpcode_CommandsStub
Opcode for commands stub
-
enumerator kIPMQ_MsgOpcode_UartWrite
Opcode to write to UART
-
enumerator kIPMQ_MsgOpcode_BootReason
-
enum _ipmq_msg_general_purpose_interrupt
Enumeration of IPMQ General Purpose Interrupts.
This enumeration defines the general-purpose interrupts used in the IPMQ (Inter-Process Messaging Queue). These interrupts are triggered when specific events occur within the AON domain.
Values:
-
enumerator kIPMQ_MsgGpi_NewMsg
Interrupt for new message arrival
-
enumerator kIPMQ_MsgGpi_Error
Interrupt for error occurrence
-
enumerator kIPMQ_MsgGpi_NewMsg
-
typedef enum _ipmq_ret_value ipmq_ret_value_t
Defines the enumeration type for IPMQ return values.
This enumeration type defines various return values for IPMQ message queue operations, indicating the status of these operations.
-
typedef enum _ipmq_msg_type ipmq_msg_type_t
Defines an enumeration for IPMQ message types.
This enumeration defines various message types within the message queue, used to distinguish different categories of messages.
-
typedef enum _ipmq_msg_opcode ipmq_msg_opcode_t
Enumeration of IPMQ Message Opcodes.
This enumeration lists the different message opcodes supported by the IPMQ messaging system, which define the specific actions or operations to be performed on the target device.
-
typedef enum _ipmq_msg_general_purpose_interrupt ipmq_msg_general_purpose_interrupt_t
Enumeration of IPMQ General Purpose Interrupts.
This enumeration defines the general-purpose interrupts used in the IPMQ (Inter-Process Messaging Queue). These interrupts are triggered when specific events occur within the AON domain.
-
typedef struct _ipmq_interrupt_cb ipmq_interrupt_cb_t
Structure definition for IPMQ Interrupt Callbacks.
This structure holds function pointers for callback functions to be invoked when specific IPMQ interrupt events occur.
error()
: A pointer to a function that will be called when an error interrupt occurs within the AON domain.
-
typedef struct _ipmq_config ipmq_config_t
IP Message Queue Configuration Structure.
This structure is used to configure the behavior and parameters for the inter-processor message queue.
-
ipmq_interrupt_cb_t g_ipmCabllbacks
-
FSL_IPMQ_DRIVER_VERSION
ipmq driver version 2.0.0
-
IPMQ_MSG_HEADER_SYNC_CODE
-
IPMQ_MSG_PHY_CHANNEL_COUNT
-
IPMQ_USELESS_VALUE
-
IPMQ_MSG_GPI_COUNT
-
void IPMQ_Init(const ipmq_config_t *ptrConfig)
Initialize inter-processor message queue.
Note
Once initalized, please do not invoke this API repeatedly.
Note
If recoveryQueueBeforeInit is set as true, this function execution might involve a considerable duration due to the presence of an inlined delay function.
- Parameters:
ptrConfig – [in] Pointer to ipmq_config_t, used to set basic configuration of Message queue.
-
void IPMQ_Deinit(void)
De-initialize inter-processor message queue.
Note
This function should be invoked only after the IPMQ has been successfully initialized.
-
void IPMQ_RecoveryQueue(uint32_t coreClock_Hz)
Establish synchronization between the CM33 and AON domains through the recovery message queue mechanism.
Used when an executable file is loaded directly into RAM,in which case the RAM executable resets local pointers while the AON ROM remains unaware
Note
Please note that this function execution might involve a considerable duration due to the presence of an inlined delay function.
- Parameters:
coreClock_Hz – [in] The core clock frequency to delay servial micro seconds.
-
void IPMQ_EnableMsgGeneralPurposeInterrupts(uint32_t mask)
Enable message general purpose interrupt.
- Parameters:
mask – [in] The mask of interrupts to enable, should be the OR’ed value of ipmq_msg_general_purpose_interrupt_t.
-
void IPMQ_DisableMsgGeneralPurposeInterrupts(uint32_t mask)
Disable message general purpose interrupt.
- Parameters:
mask – [in] The mask of interrupts to disable, should be the OR’ed value of ipmq_msg_general_purpose_interrupt_t.
-
void IPMQ_SendMessage(ipmq_msg_opcode_t opcode, uint8_t userData, uint8_t payloadSize, uint32_t *ptrPayload)
Send message to AON with payload from single memory location.
- Parameters:
opcode – [in] Message opcode, please refer to ipmq_msg_opcode_t.
userData – [in] User data send with the message, return with the ACK/NACK feedback, can be used by application to match feedback to the message.
payloadSize – [in] Size of payload to send.
ptrPayload – [in] Pointer to the buffer of payload to send.
-
void IPMQ_SendMessage2Payload(ipmq_msg_opcode_t opcode, uint8_t userData, uint8_t payload1Size, uint32_t *ptr1stPayload, uint8_t payload2Size, uint32_t *ptr2ndPayload)
Send message to AON with two different payload from different memory location, for example the first payload may from RAM, and the second payload may from flash.
- Parameters:
opcode – [in] Message opcode, please refer to ipmq_msg_opcode_t.
userData – [in] User data send with the message, return with the ACK/NACK feedback, can be used by application to match feedback to the message.
payload1Size – [in] Size of first payload to send.
ptr1stPayload – [in] Pointer to the buffer of the first payload to send.
payload2Size – [in] Size of second payload to send.
ptr2ndPayload – [in] Pointer to the buffer of the second payload to send.
-
ipmq_ret_value_t IPMQ_ReceiveMessage(ipmq_msg_opcode_t opcode, uint8_t userData, uint32_t *ptrResponsePayload, uint8_t *ptrResponsePayloadSize)
Block receiving message until error detected or message finished.
Note
In case the return value of this function is anything other than kIPMQ_Ret_ReceiveAck, it is recommended for the user to examine the sent message according to the reported error and resend the message accordingly
- Parameters:
opcode – [in] Message opcode, please refer to ipmq_msg_opcode_t.
userData – [in] User data send with the message, return with the ACK/NACK feedback, can be used by application to match feedback to the message.
ptrResponsePayload – [out] Pointer to the buffer to store response message’s payload.
ptrResponsePayloadSize – [out] Pointer to the variable to store the size of response message’s payload.
- Return values:
kIPMQ_Ret_ReceiveUnkownMsg – An unknown message was received
kIPMQ_Ret_ReceiveOpcodeMismatch – The received message does not match the expected message header
kIPMQ_Ret_ReceiveUserDataMismatch – The received user data does not match the input value.
kIPMQ_Ret_ReceiveAck – The message was received successfully and an acknowledgment (ACK) is returned
kIPMQ_Ret_ReceiveNACK – The message was received but there was a failure, a negative acknowledgment (NACK) is returned, and the NACK reason may contain in payload.
-
struct _ipmq_interrupt_cb
- #include <fsl_ipmq.h>
Structure definition for IPMQ Interrupt Callbacks.
This structure holds function pointers for callback functions to be invoked when specific IPMQ interrupt events occur.
error()
: A pointer to a function that will be called when an error interrupt occurs within the AON domain.
Public Members
-
void (*error)(void)
Callback function for error interrupts
-
struct _ipmq_config
- #include <fsl_ipmq.h>
IP Message Queue Configuration Structure.
This structure is used to configure the behavior and parameters for the inter-processor message queue.
Public Members
-
bool receiveByPolling
Whether to receive messages through polling, if set as false the kIPMQ_MsgGpi_NewMsg will be enabled, if set as true the code will polling the MU general purpose status.
-
bool enableErrorInterrupt
Whether to enable/disable error interrupts, if enabled please note as set error callback function in ptrCb.
-
bool recoveryQueueBeforeInit
Whether to recover the message queue before initialization. This option is used when an executable file is loaded directly into RAM, in which case the RAM executable resets local pointers while the AON ROM remains unaware. Set this to true to enable recovery.
-
uint32_t coreClock_Hz
The core clock frequency required to recover the queue before initialization, if recoveryQueueBeforeInit is set as false, this member will not be used.
-
ipmq_interrupt_cb_t *ptrCb
Pointer to the interrupt callback functions.
-
bool receiveByPolling
KPP: KeyPad Port Driver
-
void KPP_Init(KPP_Type *base, kpp_config_t *configure)
KPP initialize. This function ungates the KPP clock and initializes KPP. This function must be called before calling any other KPP driver functions.
- Parameters:
base – KPP peripheral base address.
configure – The KPP configuration structure pointer.
-
void KPP_Deinit(KPP_Type *base)
Deinitializes the KPP module and gates the clock. This function gates the KPP clock. As a result, the KPP module doesn’t work after calling this function.
- Parameters:
base – KPP peripheral base address.
-
static inline void KPP_EnableInterrupts(KPP_Type *base, uint16_t mask)
Enable the interrupt.
- Parameters:
base – KPP peripheral base address.
mask – KPP interrupts to enable. This is a logical OR of the enumeration :: kpp_interrupt_enable_t.
-
static inline void KPP_DisableInterrupts(KPP_Type *base, uint16_t mask)
Disable the interrupt.
- Parameters:
base – KPP peripheral base address.
mask – KPP interrupts to disable. This is a logical OR of the enumeration :: kpp_interrupt_enable_t.
-
static inline uint16_t KPP_GetStatusFlag(KPP_Type *base)
Gets the KPP interrupt event status.
- Parameters:
base – KPP peripheral base address.
- Returns:
The status of the KPP. Application can use the enum type in the “kpp_interrupt_enable_t” to get the right status of the related event.
-
static inline void KPP_ClearStatusFlag(KPP_Type *base, uint16_t mask)
Clears KPP status flag.
- Parameters:
base – KPP peripheral base address.
mask – KPP mask to be cleared. This is a logical OR of the enumeration :: kpp_interrupt_enable_t.
-
static inline void KPP_SetSynchronizeChain(KPP_Type *base, uint16_t mask)
Set KPP synchronization chain.
- Parameters:
base – KPP peripheral base address.
mask – KPP mask to be cleared. This is a logical OR of the enumeration :: kpp_sync_operation_t.
-
void KPP_keyPressScanning(KPP_Type *base, uint8_t *data, uint32_t clockSrc_Hz)
Keypad press scanning.
This function will scanning all columns and rows. so all scanning data will be stored in the data pointer.
- Parameters:
base – KPP peripheral base address.
data – KPP key press scanning data. The data buffer should be prepared with length at least equal to KPP_KEYPAD_COLUMNNUM_MAX * KPP_KEYPAD_ROWNUM_MAX. the data pointer is recommended to be a array like uint8_t data[KPP_KEYPAD_COLUMNNUM_MAX]. for example the data[2] = 4, that means in column 1 row 2 has a key press event.
clockSrc_Hz – Source clock.
-
FSL_KPP_DRIVER_VERSION
KPP driver version.
-
enum _kpp_interrupt_enable
List of interrupts supported by the peripheral. This enumeration uses one-bot encoding to allow a logical OR of multiple members. Members usually map to interrupt enable bits in one or more peripheral registers.
Values:
-
enumerator kKPP_keyDepressInterrupt
Keypad depress interrupt source
-
enumerator kKPP_keyReleaseInterrupt
Keypad release interrupt source
-
enumerator kKPP_keyDepressInterrupt
-
enum _kpp_sync_operation
Lists of KPP synchronize chain operation.
Values:
-
enumerator kKPP_ClearKeyDepressSyncChain
Keypad depress interrupt status.
-
enumerator kKPP_SetKeyReleasesSyncChain
Keypad release interrupt status.
-
enumerator kKPP_ClearKeyDepressSyncChain
-
typedef enum _kpp_interrupt_enable kpp_interrupt_enable_t
List of interrupts supported by the peripheral. This enumeration uses one-bot encoding to allow a logical OR of multiple members. Members usually map to interrupt enable bits in one or more peripheral registers.
-
typedef enum _kpp_sync_operation kpp_sync_operation_t
Lists of KPP synchronize chain operation.
-
typedef struct _kpp_config kpp_config_t
Lists of KPP status.
-
KPP_KEYPAD_COLUMNNUM_MAX
-
KPP_KEYPAD_ROWNUM_MAX
-
struct _kpp_config
- #include <fsl_kpp.h>
Lists of KPP status.
Public Members
-
uint8_t activeRow
The row number: bit 7 ~ 0 represents the row 7 ~ 0.
-
uint8_t activeColumn
The column number: bit 7 ~ 0 represents the column 7 ~ 0.
-
uint16_t interrupt
KPP interrupt source. A logical OR of “kpp_interrupt_enable_t”.
-
uint8_t activeRow
Common Driver
-
FSL_COMMON_DRIVER_VERSION
common driver version.
-
DEBUG_CONSOLE_DEVICE_TYPE_NONE
No debug console.
-
DEBUG_CONSOLE_DEVICE_TYPE_UART
Debug console based on UART.
-
DEBUG_CONSOLE_DEVICE_TYPE_LPUART
Debug console based on LPUART.
-
DEBUG_CONSOLE_DEVICE_TYPE_LPSCI
Debug console based on LPSCI.
-
DEBUG_CONSOLE_DEVICE_TYPE_USBCDC
Debug console based on USBCDC.
-
DEBUG_CONSOLE_DEVICE_TYPE_FLEXCOMM
Debug console based on FLEXCOMM.
-
DEBUG_CONSOLE_DEVICE_TYPE_IUART
Debug console based on i.MX UART.
-
DEBUG_CONSOLE_DEVICE_TYPE_VUSART
Debug console based on LPC_VUSART.
-
DEBUG_CONSOLE_DEVICE_TYPE_MINI_USART
Debug console based on LPC_USART.
-
DEBUG_CONSOLE_DEVICE_TYPE_SWO
Debug console based on SWO.
-
DEBUG_CONSOLE_DEVICE_TYPE_QSCI
Debug console based on QSCI.
-
MIN(a, b)
Computes the minimum of a and b.
-
MAX(a, b)
Computes the maximum of a and b.
-
UINT16_MAX
Max value of uint16_t type.
-
UINT32_MAX
Max value of uint32_t type.
-
SDK_ATOMIC_LOCAL_ADD(addr, val)
Add value val from the variable at address address.
-
SDK_ATOMIC_LOCAL_SUB(addr, val)
Subtract value val to the variable at address address.
-
SDK_ATOMIC_LOCAL_SET(addr, bits)
Set the bits specifiled by bits to the variable at address address.
-
SDK_ATOMIC_LOCAL_CLEAR(addr, bits)
Clear the bits specifiled by bits to the variable at address address.
-
SDK_ATOMIC_LOCAL_TOGGLE(addr, bits)
Toggle the bits specifiled by bits to the variable at address address.
-
SDK_ATOMIC_LOCAL_CLEAR_AND_SET(addr, clearBits, setBits)
For the variable at address address, clear the bits specifiled by clearBits and set the bits specifiled by setBits.
-
SDK_ATOMIC_LOCAL_COMPARE_AND_SET(addr, expected, newValue)
For the variable at address address, check whether the value equal to expected. If value same as expected then update newValue to address and return true , else return false .
-
SDK_ATOMIC_LOCAL_TEST_AND_SET(addr, newValue)
For the variable at address address, set as newValue value and return old value.
-
USEC_TO_COUNT(us, clockFreqInHz)
Macro to convert a microsecond period to raw count value
-
COUNT_TO_USEC(count, clockFreqInHz)
Macro to convert a raw count value to microsecond
-
MSEC_TO_COUNT(ms, clockFreqInHz)
Macro to convert a millisecond period to raw count value
-
COUNT_TO_MSEC(count, clockFreqInHz)
Macro to convert a raw count value to millisecond
-
SDK_ISR_EXIT_BARRIER
-
SDK_SIZEALIGN(var, alignbytes)
Macro to define a variable with L1 d-cache line size alignment
Macro to define a variable with L2 cache line size alignment
Macro to change a value to a given size aligned value
-
AT_NONCACHEABLE_SECTION(var)
Define a variable var, and place it in non-cacheable section.
-
AT_NONCACHEABLE_SECTION_ALIGN(var, alignbytes)
Define a variable var, and place it in non-cacheable section, the start address of the variable is aligned to alignbytes.
-
AT_NONCACHEABLE_SECTION_INIT(var)
Define a variable var with initial value, and place it in non-cacheable section.
-
AT_NONCACHEABLE_SECTION_ALIGN_INIT(var, alignbytes)
Define a variable var with initial value, and place it in non-cacheable section, the start address of the variable is aligned to alignbytes.
-
enum _status_groups
Status group numbers.
Values:
-
enumerator kStatusGroup_Generic
Group number for generic status codes.
-
enumerator kStatusGroup_FLASH
Group number for FLASH status codes.
-
enumerator kStatusGroup_LPSPI
Group number for LPSPI status codes.
-
enumerator kStatusGroup_FLEXIO_SPI
Group number for FLEXIO SPI status codes.
-
enumerator kStatusGroup_DSPI
Group number for DSPI status codes.
-
enumerator kStatusGroup_FLEXIO_UART
Group number for FLEXIO UART status codes.
-
enumerator kStatusGroup_FLEXIO_I2C
Group number for FLEXIO I2C status codes.
-
enumerator kStatusGroup_LPI2C
Group number for LPI2C status codes.
-
enumerator kStatusGroup_UART
Group number for UART status codes.
-
enumerator kStatusGroup_I2C
Group number for UART status codes.
-
enumerator kStatusGroup_LPSCI
Group number for LPSCI status codes.
-
enumerator kStatusGroup_LPUART
Group number for LPUART status codes.
-
enumerator kStatusGroup_SPI
Group number for SPI status code.
-
enumerator kStatusGroup_XRDC
Group number for XRDC status code.
-
enumerator kStatusGroup_SEMA42
Group number for SEMA42 status code.
-
enumerator kStatusGroup_SDHC
Group number for SDHC status code
-
enumerator kStatusGroup_SDMMC
Group number for SDMMC status code
-
enumerator kStatusGroup_SAI
Group number for SAI status code
-
enumerator kStatusGroup_MCG
Group number for MCG status codes.
-
enumerator kStatusGroup_SCG
Group number for SCG status codes.
-
enumerator kStatusGroup_SDSPI
Group number for SDSPI status codes.
-
enumerator kStatusGroup_FLEXIO_I2S
Group number for FLEXIO I2S status codes
-
enumerator kStatusGroup_FLEXIO_MCULCD
Group number for FLEXIO LCD status codes
-
enumerator kStatusGroup_FLASHIAP
Group number for FLASHIAP status codes
-
enumerator kStatusGroup_FLEXCOMM_I2C
Group number for FLEXCOMM I2C status codes
-
enumerator kStatusGroup_I2S
Group number for I2S status codes
-
enumerator kStatusGroup_IUART
Group number for IUART status codes
-
enumerator kStatusGroup_CSI
Group number for CSI status codes
-
enumerator kStatusGroup_MIPI_DSI
Group number for MIPI DSI status codes
-
enumerator kStatusGroup_SDRAMC
Group number for SDRAMC status codes.
-
enumerator kStatusGroup_POWER
Group number for POWER status codes.
-
enumerator kStatusGroup_ENET
Group number for ENET status codes.
-
enumerator kStatusGroup_PHY
Group number for PHY status codes.
-
enumerator kStatusGroup_TRGMUX
Group number for TRGMUX status codes.
-
enumerator kStatusGroup_SMARTCARD
Group number for SMARTCARD status codes.
-
enumerator kStatusGroup_LMEM
Group number for LMEM status codes.
-
enumerator kStatusGroup_QSPI
Group number for QSPI status codes.
-
enumerator kStatusGroup_DMA
Group number for DMA status codes.
-
enumerator kStatusGroup_EDMA
Group number for EDMA status codes.
-
enumerator kStatusGroup_DMAMGR
Group number for DMAMGR status codes.
-
enumerator kStatusGroup_FLEXCAN
Group number for FlexCAN status codes.
-
enumerator kStatusGroup_LTC
Group number for LTC status codes.
-
enumerator kStatusGroup_FLEXIO_CAMERA
Group number for FLEXIO CAMERA status codes.
-
enumerator kStatusGroup_LPC_SPI
Group number for LPC_SPI status codes.
-
enumerator kStatusGroup_LPC_USART
Group number for LPC_USART status codes.
-
enumerator kStatusGroup_DMIC
Group number for DMIC status codes.
-
enumerator kStatusGroup_SDIF
Group number for SDIF status codes.
-
enumerator kStatusGroup_SPIFI
Group number for SPIFI status codes.
-
enumerator kStatusGroup_OTP
Group number for OTP status codes.
-
enumerator kStatusGroup_MCAN
Group number for MCAN status codes.
-
enumerator kStatusGroup_CAAM
Group number for CAAM status codes.
-
enumerator kStatusGroup_ECSPI
Group number for ECSPI status codes.
-
enumerator kStatusGroup_USDHC
Group number for USDHC status codes.
-
enumerator kStatusGroup_LPC_I2C
Group number for LPC_I2C status codes.
-
enumerator kStatusGroup_DCP
Group number for DCP status codes.
-
enumerator kStatusGroup_MSCAN
Group number for MSCAN status codes.
-
enumerator kStatusGroup_ESAI
Group number for ESAI status codes.
-
enumerator kStatusGroup_FLEXSPI
Group number for FLEXSPI status codes.
-
enumerator kStatusGroup_MMDC
Group number for MMDC status codes.
-
enumerator kStatusGroup_PDM
Group number for MIC status codes.
-
enumerator kStatusGroup_SDMA
Group number for SDMA status codes.
-
enumerator kStatusGroup_ICS
Group number for ICS status codes.
-
enumerator kStatusGroup_SPDIF
Group number for SPDIF status codes.
-
enumerator kStatusGroup_LPC_MINISPI
Group number for LPC_MINISPI status codes.
-
enumerator kStatusGroup_HASHCRYPT
Group number for Hashcrypt status codes
-
enumerator kStatusGroup_LPC_SPI_SSP
Group number for LPC_SPI_SSP status codes.
-
enumerator kStatusGroup_I3C
Group number for I3C status codes
-
enumerator kStatusGroup_LPC_I2C_1
Group number for LPC_I2C_1 status codes.
-
enumerator kStatusGroup_NOTIFIER
Group number for NOTIFIER status codes.
-
enumerator kStatusGroup_DebugConsole
Group number for debug console status codes.
-
enumerator kStatusGroup_SEMC
Group number for SEMC status codes.
-
enumerator kStatusGroup_ApplicationRangeStart
Starting number for application groups.
-
enumerator kStatusGroup_IAP
Group number for IAP status codes
-
enumerator kStatusGroup_SFA
Group number for SFA status codes
-
enumerator kStatusGroup_SPC
Group number for SPC status codes.
-
enumerator kStatusGroup_PUF
Group number for PUF status codes.
-
enumerator kStatusGroup_TOUCH_PANEL
Group number for touch panel status codes
-
enumerator kStatusGroup_VBAT
Group number for VBAT status codes
-
enumerator kStatusGroup_XSPI
Group number for XSPI status codes
-
enumerator kStatusGroup_PNGDEC
Group number for PNGDEC status codes
-
enumerator kStatusGroup_JPEGDEC
Group number for JPEGDEC status codes
-
enumerator kStatusGroup_HAL_GPIO
Group number for HAL GPIO status codes.
-
enumerator kStatusGroup_HAL_UART
Group number for HAL UART status codes.
-
enumerator kStatusGroup_HAL_TIMER
Group number for HAL TIMER status codes.
-
enumerator kStatusGroup_HAL_SPI
Group number for HAL SPI status codes.
-
enumerator kStatusGroup_HAL_I2C
Group number for HAL I2C status codes.
-
enumerator kStatusGroup_HAL_FLASH
Group number for HAL FLASH status codes.
-
enumerator kStatusGroup_HAL_PWM
Group number for HAL PWM status codes.
-
enumerator kStatusGroup_HAL_RNG
Group number for HAL RNG status codes.
-
enumerator kStatusGroup_HAL_I2S
Group number for HAL I2S status codes.
-
enumerator kStatusGroup_HAL_ADC_SENSOR
Group number for HAL ADC SENSOR status codes.
-
enumerator kStatusGroup_TIMERMANAGER
Group number for TiMER MANAGER status codes.
-
enumerator kStatusGroup_SERIALMANAGER
Group number for SERIAL MANAGER status codes.
-
enumerator kStatusGroup_LED
Group number for LED status codes.
-
enumerator kStatusGroup_BUTTON
Group number for BUTTON status codes.
-
enumerator kStatusGroup_EXTERN_EEPROM
Group number for EXTERN EEPROM status codes.
-
enumerator kStatusGroup_SHELL
Group number for SHELL status codes.
-
enumerator kStatusGroup_MEM_MANAGER
Group number for MEM MANAGER status codes.
-
enumerator kStatusGroup_LIST
Group number for List status codes.
-
enumerator kStatusGroup_OSA
Group number for OSA status codes.
-
enumerator kStatusGroup_COMMON_TASK
Group number for Common task status codes.
-
enumerator kStatusGroup_MSG
Group number for messaging status codes.
-
enumerator kStatusGroup_SDK_OCOTP
Group number for OCOTP status codes.
-
enumerator kStatusGroup_SDK_FLEXSPINOR
Group number for FLEXSPINOR status codes.
-
enumerator kStatusGroup_CODEC
Group number for codec status codes.
-
enumerator kStatusGroup_ASRC
Group number for codec status ASRC.
-
enumerator kStatusGroup_OTFAD
Group number for codec status codes.
-
enumerator kStatusGroup_SDIOSLV
Group number for SDIOSLV status codes.
-
enumerator kStatusGroup_MECC
Group number for MECC status codes.
-
enumerator kStatusGroup_ENET_QOS
Group number for ENET_QOS status codes.
-
enumerator kStatusGroup_LOG
Group number for LOG status codes.
-
enumerator kStatusGroup_I3CBUS
Group number for I3CBUS status codes.
-
enumerator kStatusGroup_QSCI
Group number for QSCI status codes.
-
enumerator kStatusGroup_ELEMU
Group number for ELEMU status codes.
-
enumerator kStatusGroup_QUEUEDSPI
Group number for QSPI status codes.
-
enumerator kStatusGroup_POWER_MANAGER
Group number for POWER_MANAGER status codes.
-
enumerator kStatusGroup_IPED
Group number for IPED status codes.
-
enumerator kStatusGroup_ELS_PKC
Group number for ELS PKC status codes.
-
enumerator kStatusGroup_CSS_PKC
Group number for CSS PKC status codes.
-
enumerator kStatusGroup_HOSTIF
Group number for HOSTIF status codes.
-
enumerator kStatusGroup_CLIF
Group number for CLIF status codes.
-
enumerator kStatusGroup_BMA
Group number for BMA status codes.
-
enumerator kStatusGroup_NETC
Group number for NETC status codes.
-
enumerator kStatusGroup_ELE
Group number for ELE status codes.
-
enumerator kStatusGroup_GLIKEY
Group number for GLIKEY status codes.
-
enumerator kStatusGroup_AON_POWER
Group number for AON_POWER status codes.
-
enumerator kStatusGroup_AON_COMMON
Group number for AON_COMMON status codes.
-
enumerator kStatusGroup_ENDAT3
Group number for ENDAT3 status codes.
-
enumerator kStatusGroup_HIPERFACE
Group number for HIPERFACE status codes.
-
enumerator kStatusGroup_NPX
Group number for NPX status codes.
-
enumerator kStatusGroup_CSEC
Group number for CSEC status codes.
-
enumerator kStatusGroup_Generic
Generic status return codes.
Values:
-
enumerator kStatus_Success
Generic status for Success.
-
enumerator kStatus_Fail
Generic status for Fail.
-
enumerator kStatus_ReadOnly
Generic status for read only failure.
-
enumerator kStatus_OutOfRange
Generic status for out of range access.
-
enumerator kStatus_InvalidArgument
Generic status for invalid argument check.
-
enumerator kStatus_Timeout
Generic status for timeout.
-
enumerator kStatus_NoTransferInProgress
Generic status for no transfer in progress.
-
enumerator kStatus_Busy
Generic status for module is busy.
-
enumerator kStatus_NoData
Generic status for no data is found for the operation.
-
enumerator kStatus_Success
-
typedef int32_t status_t
Type used for all status and error return values.
-
void *SDK_Malloc(size_t size, size_t alignbytes)
Allocate memory with given alignment and aligned size.
This is provided to support the dynamically allocated memory used in cache-able region.
- Parameters:
size – The length required to malloc.
alignbytes – The alignment size.
- Return values:
The – allocated memory.
-
void SDK_Free(void *ptr)
Free memory.
- Parameters:
ptr – The memory to be release.
-
void SDK_DelayAtLeastUs(uint32_t delayTime_us, uint32_t coreClock_Hz)
Delay at least for some time. Please note that, this API uses while loop for delay, different run-time environments make the time not precise, if precise delay count was needed, please implement a new delay function with hardware timer.
- Parameters:
delayTime_us – Delay time in unit of microsecond.
coreClock_Hz – Core clock frequency with Hz.
-
static inline status_t EnableIRQ(IRQn_Type interrupt)
Enable specific interrupt.
Enable LEVEL1 interrupt. For some devices, there might be multiple interrupt levels. For example, there are NVIC and intmux. Here the interrupts connected to NVIC are the LEVEL1 interrupts, because they are routed to the core directly. The interrupts connected to intmux are the LEVEL2 interrupts, they are routed to NVIC first then routed to core.
This function only enables the LEVEL1 interrupts. The number of LEVEL1 interrupts is indicated by the feature macro FSL_FEATURE_NUMBER_OF_LEVEL1_INT_VECTORS.
- Parameters:
interrupt – The IRQ number.
- Return values:
kStatus_Success – Interrupt enabled successfully
kStatus_Fail – Failed to enable the interrupt
-
static inline status_t DisableIRQ(IRQn_Type interrupt)
Disable specific interrupt.
Disable LEVEL1 interrupt. For some devices, there might be multiple interrupt levels. For example, there are NVIC and intmux. Here the interrupts connected to NVIC are the LEVEL1 interrupts, because they are routed to the core directly. The interrupts connected to intmux are the LEVEL2 interrupts, they are routed to NVIC first then routed to core.
This function only disables the LEVEL1 interrupts. The number of LEVEL1 interrupts is indicated by the feature macro FSL_FEATURE_NUMBER_OF_LEVEL1_INT_VECTORS.
- Parameters:
interrupt – The IRQ number.
- Return values:
kStatus_Success – Interrupt disabled successfully
kStatus_Fail – Failed to disable the interrupt
-
static inline status_t EnableIRQWithPriority(IRQn_Type interrupt, uint8_t priNum)
Enable the IRQ, and also set the interrupt priority.
Only handle LEVEL1 interrupt. For some devices, there might be multiple interrupt levels. For example, there are NVIC and intmux. Here the interrupts connected to NVIC are the LEVEL1 interrupts, because they are routed to the core directly. The interrupts connected to intmux are the LEVEL2 interrupts, they are routed to NVIC first then routed to core.
This function only handles the LEVEL1 interrupts. The number of LEVEL1 interrupts is indicated by the feature macro FSL_FEATURE_NUMBER_OF_LEVEL1_INT_VECTORS.
- Parameters:
interrupt – The IRQ to Enable.
priNum – Priority number set to interrupt controller register.
- Return values:
kStatus_Success – Interrupt priority set successfully
kStatus_Fail – Failed to set the interrupt priority.
-
static inline status_t IRQ_SetPriority(IRQn_Type interrupt, uint8_t priNum)
Set the IRQ priority.
Only handle LEVEL1 interrupt. For some devices, there might be multiple interrupt levels. For example, there are NVIC and intmux. Here the interrupts connected to NVIC are the LEVEL1 interrupts, because they are routed to the core directly. The interrupts connected to intmux are the LEVEL2 interrupts, they are routed to NVIC first then routed to core.
This function only handles the LEVEL1 interrupts. The number of LEVEL1 interrupts is indicated by the feature macro FSL_FEATURE_NUMBER_OF_LEVEL1_INT_VECTORS.
- Parameters:
interrupt – The IRQ to set.
priNum – Priority number set to interrupt controller register.
- Return values:
kStatus_Success – Interrupt priority set successfully
kStatus_Fail – Failed to set the interrupt priority.
-
static inline status_t IRQ_ClearPendingIRQ(IRQn_Type interrupt)
Clear the pending IRQ flag.
Only handle LEVEL1 interrupt. For some devices, there might be multiple interrupt levels. For example, there are NVIC and intmux. Here the interrupts connected to NVIC are the LEVEL1 interrupts, because they are routed to the core directly. The interrupts connected to intmux are the LEVEL2 interrupts, they are routed to NVIC first then routed to core.
This function only handles the LEVEL1 interrupts. The number of LEVEL1 interrupts is indicated by the feature macro FSL_FEATURE_NUMBER_OF_LEVEL1_INT_VECTORS.
- Parameters:
interrupt – The flag which IRQ to clear.
- Return values:
kStatus_Success – Interrupt priority set successfully
kStatus_Fail – Failed to set the interrupt priority.
-
static inline uint32_t DisableGlobalIRQ(void)
Disable the global IRQ.
Disable the global interrupt and return the current primask register. User is required to provided the primask register for the EnableGlobalIRQ().
- Returns:
Current primask value.
-
static inline void EnableGlobalIRQ(uint32_t primask)
Enable the global IRQ.
Set the primask register with the provided primask value but not just enable the primask. The idea is for the convenience of integration of RTOS. some RTOS get its own management mechanism of primask. User is required to use the EnableGlobalIRQ() and DisableGlobalIRQ() in pair.
- Parameters:
primask – value of primask register to be restored. The primask value is supposed to be provided by the DisableGlobalIRQ().
-
static inline bool _SDK_AtomicLocalCompareAndSet(uint32_t *addr, uint32_t expected, uint32_t newValue)
-
static inline uint32_t _SDK_AtomicTestAndSet(uint32_t *addr, uint32_t newValue)
-
FSL_DRIVER_TRANSFER_DOUBLE_WEAK_IRQ
Macro to use the default weak IRQ handler in drivers.
-
MAKE_STATUS(group, code)
Construct a status code value from a group and code number.
-
MAKE_VERSION(major, minor, bugfix)
Construct the version number for drivers.
The driver version is a 32-bit number, for both 32-bit platforms(such as Cortex M) and 16-bit platforms(such as DSC).
| Unused || Major Version || Minor Version || Bug Fix | 31 25 24 17 16 9 8 0
-
ARRAY_SIZE(x)
Computes the number of elements in an array.
-
UINT64_H(X)
Macro to get upper 32 bits of a 64-bit value
-
UINT64_L(X)
Macro to get lower 32 bits of a 64-bit value
-
SUPPRESS_FALL_THROUGH_WARNING()
For switch case code block, if case section ends without “break;” statement, there wil be fallthrough warning with compiler flag -Wextra or -Wimplicit-fallthrough=n when using armgcc. To suppress this warning, “SUPPRESS_FALL_THROUGH_WARNING();” need to be added at the end of each case section which misses “break;”statement.
-
MSDK_REG_SECURE_ADDR(x)
Convert the register address to the one used in secure mode.
-
MSDK_REG_NONSECURE_ADDR(x)
Convert the register address to the one used in non-secure mode.
LPCMP: Low Power Analog Comparator Driver
-
void LPCMP_Init(LPCMP_Type *base, const lpcmp_config_t *config)
Initialize the LPCMP.
This function initializes the LPCMP module. The operations included are:
Enabling the clock for LPCMP module.
Configuring the comparator.
Enabling the LPCMP module. Note: For some devices, multiple LPCMP instance share the same clock gate. In this case, to enable the clock for any instance enables all the LPCMPs. Check the chip reference manual for the clock assignment of the LPCMP.
- Parameters:
base – LPCMP peripheral base address.
config – Pointer to “lpcmp_config_t” structure.
-
void LPCMP_Deinit(LPCMP_Type *base)
De-initializes the LPCMP module.
This function de-initializes the LPCMP module. The operations included are:
Disabling the LPCMP module.
Disabling the clock for LPCMP module.
This function disables the clock for the LPCMP. Note: For some devices, multiple LPCMP instance shares the same clock gate. In this case, before disabling the clock for the LPCMP, ensure that all the LPCMP instances are not used.
- Parameters:
base – LPCMP peripheral base address.
-
void LPCMP_GetDefaultConfig(lpcmp_config_t *config)
Gets an available pre-defined settings for the comparator’s configuration.
This function initializes the comparator configuration structure to these default values:
config->enableStopMode = false; config->enableOutputPin = false; config->enableCmpToDacLink = false; config->useUnfilteredOutput = false; config->enableInvertOutput = false; config->hysteresisMode = kLPCMP_HysteresisLevel0; config->powerMode = kLPCMP_LowSpeedPowerMode; config->functionalSourceClock = kLPCMP_FunctionalClockSource0; config->plusInputSrc = kLPCMP_PlusInputSrcMux; config->minusInputSrc = kLPCMP_MinusInputSrcMux;
- Parameters:
config – Pointer to “lpcmp_config_t” structure.
-
static inline void LPCMP_Enable(LPCMP_Type *base, bool enable)
Enable/Disable LPCMP module.
- Parameters:
base – LPCMP peripheral base address.
enable – “true” means enable the module, and “false” means disable the module.
-
void LPCMP_SetInputChannels(LPCMP_Type *base, uint32_t positiveChannel, uint32_t negativeChannel)
Select the input channels for LPCMP. This function determines which input is selected for the negative and positive mux.
- Parameters:
base – LPCMP peripheral base address.
positiveChannel – Positive side input channel number. Available range is 0-7.
negativeChannel – Negative side input channel number. Available range is 0-7.
-
static inline void LPCMP_EnableDMA(LPCMP_Type *base, bool enable)
Enables/disables the DMA request for rising/falling events. Normally, the LPCMP generates a CPU interrupt if there is a rising/falling event. When DMA support is enabled and the rising/falling interrupt is enabled , the rising/falling event forces a DMA transfer request rather than a CPU interrupt instead.
- Parameters:
base – LPCMP peripheral base address.
enable – “true” means enable DMA support, and “false” means disable DMA support.
-
void LPCMP_SetFilterConfig(LPCMP_Type *base, const lpcmp_filter_config_t *config)
Configures the filter.
- Parameters:
base – LPCMP peripheral base address.
config – Pointer to “lpcmp_filter_config_t” structure.
-
void LPCMP_SetDACConfig(LPCMP_Type *base, const lpcmp_dac_config_t *config)
Configure the internal DAC module.
- Parameters:
base – LPCMP peripheral base address.
config – Pointer to “lpcmp_dac_config_t” structure. If config is “NULL”, disable internal DAC.
-
static inline void LPCMP_EnableInterrupts(LPCMP_Type *base, uint32_t mask)
Enable the interrupts.
- Parameters:
base – LPCMP peripheral base address.
mask – Mask value for interrupts. See “_lpcmp_interrupt_enable”.
-
static inline void LPCMP_DisableInterrupts(LPCMP_Type *base, uint32_t mask)
Disable the interrupts.
- Parameters:
base – LPCMP peripheral base address.
mask – Mask value for interrupts. See “_lpcmp_interrupt_enable”.
-
static inline uint32_t LPCMP_GetStatusFlags(LPCMP_Type *base)
Get the LPCMP status flags.
- Parameters:
base – LPCMP peripheral base address.
- Returns:
Mask value for the asserted flags. See “_lpcmp_status_flags”.
-
static inline void LPCMP_ClearStatusFlags(LPCMP_Type *base, uint32_t mask)
Clear the LPCMP status flags.
- Parameters:
base – LPCMP peripheral base address.
mask – Mask value for the flags. See “_lpcmp_status_flags”.
-
static inline void LPCMP_EnableWindowMode(LPCMP_Type *base, bool enable)
Enable/Disable window mode.When any windowed mode is active, COUTA is clocked by the bus clock whenever WINDOW = 1. The last latched value is held when WINDOW = 0. The optionally inverted comparator output COUT_RAW is sampled on every bus clock when WINDOW=1 to generate COUTA.
- Parameters:
base – LPCMP peripheral base address.
enable – “true” means enable window mode, and “false” means disable window mode.
-
void LPCMP_SetWindowControl(LPCMP_Type *base, const lpcmp_window_control_config_t *config)
Configure the window control, users can use this API to implement operations on the window, such as inverting the window signal, setting the window closing event(only valid in windowing mode), and setting the COUTA signal after the window is closed(only valid in windowing mode).
- Parameters:
base – LPCMP peripheral base address.
config – Pointer “lpcmp_window_control_config_t” structure.
-
void LPCMP_SetRoundRobinConfig(LPCMP_Type *base, const lpcmp_roundrobin_config_t *config)
Configure the roundrobin mode.
- Parameters:
base – LPCMP peripheral base address.
config – Pointer “lpcmp_roundrobin_config_t” structure.
-
static inline void LPCMP_EnableRoundRobinMode(LPCMP_Type *base, bool enable)
Enable/Disable roundrobin mode.
- Parameters:
base – LPCMP peripheral base address.
enable – “true” means enable roundrobin mode, and “false” means disable roundrobin mode.
-
void LPCMP_SetRoundRobinInternalTimer(LPCMP_Type *base, uint32_t value)
brief Configure the roundrobin internal timer reload value.
param base LPCMP peripheral base address. param value RoundRobin internal timer reload value, allowed range:0x0UL-0xFFFFFFFUL.
-
static inline void LPCMP_EnableRoundRobinInternalTimer(LPCMP_Type *base, bool enable)
Enable/Disable roundrobin internal timer, note that this function is only valid when using the internal trigger source.
- Parameters:
base – LPCMP peripheral base address.
enable – “true” means enable roundrobin internal timer, and “false” means disable roundrobin internal timer.
-
static inline void LPCMP_SetPreSetValue(LPCMP_Type *base, uint8_t mask)
Set preset value for all channels, users can set all channels’ preset vaule through this API, for example, if the mask set to 0x03U means channel0 and channel2’s preset value set to 1U and other channels’ preset value set to 0U.
- Parameters:
base – LPCMP peripheral base address.
mask – Mask of channel index.
-
static inline uint8_t LPCMP_GetComparisonResult(LPCMP_Type *base)
Get comparison results for all channels, users can get all channels’ comparison results through this API.
- Parameters:
base – LPCMP peripheral base address.
- Returns:
return All channels’ comparison result.
-
static inline void LPCMP_ClearInputChangedFlags(LPCMP_Type *base, uint8_t mask)
Clear input changed flags for single channel or multiple channels, users can clear input changed flag of a single channel or multiple channels through this API, for example, if the mask set to 0x03U means clear channel0 and channel2’s input changed flags.
- Parameters:
base – LPCMP peripheral base address.
mask – Mask of channel index.
-
static inline uint8_t LPCMP_GetInputChangedFlags(LPCMP_Type *base)
Get input changed flags for all channels, Users can get all channels’ input changed flags through this API.
- Parameters:
base – LPCMP peripheral base address.
- Returns:
return All channels’ changed flag.
-
FSL_LPCMP_DRIVER_VERSION
LPCMP driver version 2.3.1.
-
enum _lpcmp_status_flags
LPCMP status falgs mask.
Values:
-
enumerator kLPCMP_OutputRisingEventFlag
Rising-edge on the comparison output has occurred.
-
enumerator kLPCMP_OutputFallingEventFlag
Falling-edge on the comparison output has occurred.
-
enumerator kLPCMP_OutputRoundRobinEventFlag
Detects when any channel’s last comparison result is different from the pre-set value in trigger mode.
-
enumerator kLPCMP_OutputAssertEventFlag
Return the current value of the analog comparator output. The flag does not support W1C.
-
enumerator kLPCMP_OutputRisingEventFlag
-
enum _lpcmp_interrupt_enable
LPCMP interrupt enable/disable mask.
Values:
-
enumerator kLPCMP_OutputRisingInterruptEnable
Comparator interrupt enable rising.
-
enumerator kLPCMP_OutputFallingInterruptEnable
Comparator interrupt enable falling.
-
enumerator kLPCMP_RoundRobinInterruptEnable
Comparator round robin mode interrupt occurred when the comparison result changes for a given channel.
-
enumerator kLPCMP_OutputRisingInterruptEnable
-
enum _lpcmp_hysteresis_mode
LPCMP hysteresis mode. See chip data sheet to get the actual hystersis value with each level.
Values:
-
enumerator kLPCMP_HysteresisLevel0
The hard block output has level 0 hysteresis internally.
-
enumerator kLPCMP_HysteresisLevel1
The hard block output has level 1 hysteresis internally.
-
enumerator kLPCMP_HysteresisLevel2
The hard block output has level 2 hysteresis internally.
-
enumerator kLPCMP_HysteresisLevel3
The hard block output has level 3 hysteresis internally.
-
enumerator kLPCMP_HysteresisLevel0
-
enum _lpcmp_power_mode
LPCMP nano mode.
Values:
-
enumerator kLPCMP_LowSpeedPowerMode
Low speed comparison mode is selected.
-
enumerator kLPCMP_HighSpeedPowerMode
High speed comparison mode is selected.
-
enumerator kLPCMP_NanoPowerMode
Nano power comparator is enabled.
-
enumerator kLPCMP_LowSpeedPowerMode
-
enum _lpcmp_dac_reference_voltage_source
Internal DAC reference voltage source.
Values:
-
enumerator kLPCMP_VrefSourceVin1
vrefh_int is selected as resistor ladder network supply reference Vin.
-
enumerator kLPCMP_VrefSourceVin2
vrefh_ext is selected as resistor ladder network supply reference Vin.
-
enumerator kLPCMP_VrefSourceVin1
-
enum _lpcmp_functional_source_clock
LPCMP functional mode clock source selection.
Note: In different devices, the functional mode clock source selection is different, please refer to specific device Reference Manual for details.
Values:
-
enumerator kLPCMP_FunctionalClockSource0
Select functional mode clock source0.
-
enumerator kLPCMP_FunctionalClockSource1
Select functional mode clock source1.
-
enumerator kLPCMP_FunctionalClockSource2
Select functional mode clock source2.
-
enumerator kLPCMP_FunctionalClockSource3
Select functional mode clock source3.
-
enumerator kLPCMP_FunctionalClockSource0
-
enum _lpcmp_couta_signal
Set the COUTA signal value when the window is closed.
Values:
-
enumerator kLPCMP_COUTASignalNoSet
NO set the COUTA signal value when the window is closed.
-
enumerator kLPCMP_COUTASignalLow
Set COUTA signal low(0) when the window is closed.
-
enumerator kLPCMP_COUTASignalHigh
Set COUTA signal high(1) when the window is closed.
-
enumerator kLPCMP_COUTASignalNoSet
-
enum _lpcmp_close_window_event
Set COUT event, which can close the active window in window mode.
Values:
-
enumerator kLPCMP_CLoseWindowEventNoSet
No Set COUT event, which can close the active window in window mode.
-
enumerator kLPCMP_CloseWindowEventRisingEdge
Set rising edge COUT signal as COUT event.
-
enumerator kLPCMP_CloseWindowEventFallingEdge
Set falling edge COUT signal as COUT event.
-
enumerator kLPCMP_CLoseWindowEventBothEdge
Set both rising and falling edge COUT signal as COUT event.
-
enumerator kLPCMP_CLoseWindowEventNoSet
-
enum _lpcmp_roundrobin_fixedmuxport
LPCMP round robin mode fixed mux port.
Values:
-
enumerator kLPCMP_FixedPlusMuxPort
Fixed plus mux port.
-
enumerator kLPCMP_FixedMinusMuxPort
Fixed minus mux port.
-
enumerator kLPCMP_FixedPlusMuxPort
-
enum _lpcmp_roundrobin_clock_source
LPCMP round robin mode clock source selection.
Note: In different devices,the round robin mode clock source selection is different, please refer to the specific device Reference Manual for details.
Values:
-
enumerator kLPCMP_RoundRobinClockSource0
Select roundrobin mode clock source0.
-
enumerator kLPCMP_RoundRobinClockSource1
Select roundrobin mode clock source1.
-
enumerator kLPCMP_RoundRobinClockSource2
Select roundrobin mode clock source2.
-
enumerator kLPCMP_RoundRobinClockSource3
Select roundrobin mode clock source3.
-
enumerator kLPCMP_RoundRobinClockSource0
-
enum _lpcmp_roundrobin_trigger_source
LPCMP round robin mode trigger source.
Values:
-
enumerator kLPCMP_TriggerSourceExternally
Select external trigger source.
-
enumerator kLPCMP_TriggerSourceInternally
Select internal trigger source.
-
enumerator kLPCMP_TriggerSourceExternally
-
typedef enum _lpcmp_hysteresis_mode lpcmp_hysteresis_mode_t
LPCMP hysteresis mode. See chip data sheet to get the actual hystersis value with each level.
-
typedef enum _lpcmp_power_mode lpcmp_power_mode_t
LPCMP nano mode.
-
typedef enum _lpcmp_dac_reference_voltage_source lpcmp_dac_reference_voltage_source_t
Internal DAC reference voltage source.
-
typedef enum _lpcmp_functional_source_clock lpcmp_functional_source_clock_t
LPCMP functional mode clock source selection.
Note: In different devices, the functional mode clock source selection is different, please refer to specific device Reference Manual for details.
-
typedef enum _lpcmp_couta_signal lpcmp_couta_signal_t
Set the COUTA signal value when the window is closed.
-
typedef enum _lpcmp_close_window_event lpcmp_close_window_event_t
Set COUT event, which can close the active window in window mode.
-
typedef enum _lpcmp_roundrobin_fixedmuxport lpcmp_roundrobin_fixedmuxport_t
LPCMP round robin mode fixed mux port.
-
typedef enum _lpcmp_roundrobin_clock_source lpcmp_roundrobin_clock_source_t
LPCMP round robin mode clock source selection.
Note: In different devices,the round robin mode clock source selection is different, please refer to the specific device Reference Manual for details.
-
typedef enum _lpcmp_roundrobin_trigger_source lpcmp_roundrobin_trigger_source_t
LPCMP round robin mode trigger source.
-
typedef struct _lpcmp_filter_config lpcmp_filter_config_t
Configure the filter.
-
typedef struct _lpcmp_dac_config lpcmp_dac_config_t
configure the internal DAC.
-
typedef struct _lpcmp_config lpcmp_config_t
Configures the comparator.
-
typedef struct _lpcmp_window_control_config lpcmp_window_control_config_t
Configure the window mode control.
-
typedef struct _lpcmp_roundrobin_config lpcmp_roundrobin_config_t
Configure the round robin mode.
-
LPCMP_CCR1_COUTA_CFG_MASK
-
LPCMP_CCR1_COUTA_CFG_SHIFT
-
LPCMP_CCR1_COUTA_CFG(x)
-
LPCMP_CCR1_EVT_SEL_CFG_MASK
-
LPCMP_CCR1_EVT_SEL_CFG_SHIFT
-
LPCMP_CCR1_EVT_SEL_CFG(x)
-
struct _lpcmp_filter_config
- #include <fsl_lpcmp.h>
Configure the filter.
Public Members
-
bool enableSample
Decide whether to use the external SAMPLE as a sampling clock input.
-
uint8_t filterSampleCount
Filter Sample Count. Available range is 1-7; 0 disables the filter.
-
uint8_t filterSamplePeriod
Filter Sample Period. The divider to the bus clock. Available range is 0-255. The sampling clock must be at least 4 times slower than the system clock to the comparator. So if enableSample is “false”, filterSamplePeriod should be set greater than 4.
-
bool enableSample
-
struct _lpcmp_dac_config
- #include <fsl_lpcmp.h>
configure the internal DAC.
Public Members
-
bool enableLowPowerMode
Decide whether to enable DAC low power mode.
-
lpcmp_dac_reference_voltage_source_t referenceVoltageSource
Internal DAC supply voltage reference source.
-
uint8_t DACValue
Value for the DAC Output Voltage. Different devices has different available range, for specific values, please refer to the reference manual.
-
bool enableLowPowerMode
-
struct _lpcmp_config
- #include <fsl_lpcmp.h>
Configures the comparator.
Public Members
-
bool enableStopMode
Decide whether to enable the comparator when in STOP modes.
-
bool enableOutputPin
Decide whether to enable the comparator is available in selected pin.
-
bool useUnfilteredOutput
Decide whether to use unfiltered output.
-
bool enableInvertOutput
Decide whether to inverts the comparator output.
-
lpcmp_hysteresis_mode_t hysteresisMode
LPCMP hysteresis mode.
-
lpcmp_power_mode_t powerMode
LPCMP power mode.
-
lpcmp_functional_source_clock_t functionalSourceClock
Select LPCMP functional mode clock source.
-
bool enableStopMode
-
struct _lpcmp_window_control_config
- #include <fsl_lpcmp.h>
Configure the window mode control.
Public Members
-
bool enableInvertWindowSignal
True: enable invert window signal, False: disable invert window signal.
-
lpcmp_couta_signal_t COUTASignal
Decide whether to define the COUTA signal value when the window is closed.
-
lpcmp_close_window_event_t closeWindowEvent
Decide whether to select COUT event signal edge defines a COUT event to close window.
-
bool enableInvertWindowSignal
-
struct _lpcmp_roundrobin_config
- #include <fsl_lpcmp.h>
Configure the round robin mode.
Public Members
-
uint8_t initDelayModules
Comparator and DAC initialization delay modulus, See Reference Manual and DataSheet for specific value.
-
uint8_t sampleClockNumbers
Specify the number of the round robin clock cycles(0~3) to wait after scanning the active channel before sampling the channel’s comparison result.
-
uint8_t channelSampleNumbers
Specify the number of samples for one channel, note that channelSampleNumbers must not smaller than sampleTimeThreshhold.
-
uint8_t sampleTimeThreshhold
Specify that for one channel, when (sampleTimeThreshhold + 1) sample results are “1”,the final result is “1”, otherwise the final result is “0”, note that the sampleTimeThreshhold must not be larger than channelSampleNumbers.
-
lpcmp_roundrobin_clock_source_t roundrobinClockSource
Decide which clock source to choose in round robin mode.
-
lpcmp_roundrobin_trigger_source_t roundrobinTriggerSource
Decide which trigger source to choose in round robin mode.
-
lpcmp_roundrobin_fixedmuxport_t fixedMuxPort
Decide which mux port to choose as fixed channel in round robin mode.
-
uint8_t fixedChannel
Indicate which channel of the fixed mux port is used in round robin mode.
-
uint8_t checkerChannelMask
Indicate which channel of the non-fixed mux port to check its voltage value in round robin mode, for example, if checkerChannelMask set to 0x11U means select channel 0 and channel 4 as checker channel.
-
uint8_t initDelayModules
LPI2C: Low Power Inter-Integrated Circuit Driver
-
void LPI2C_DriverIRQHandler(uint32_t instance)
LPI2C driver IRQ handler common entry.
This function provides the common IRQ request entry for LPI2C.
- Parameters:
instance – LPI2C instance.
-
FSL_LPI2C_DRIVER_VERSION
LPI2C driver version.
LPI2C status return codes.
Values:
-
enumerator kStatus_LPI2C_Busy
The master is already performing a transfer.
-
enumerator kStatus_LPI2C_Idle
The slave driver is idle.
-
enumerator kStatus_LPI2C_Nak
The slave device sent a NAK in response to a byte.
-
enumerator kStatus_LPI2C_FifoError
FIFO under run or overrun.
-
enumerator kStatus_LPI2C_BitError
Transferred bit was not seen on the bus.
-
enumerator kStatus_LPI2C_ArbitrationLost
Arbitration lost error.
-
enumerator kStatus_LPI2C_PinLowTimeout
SCL or SDA were held low longer than the timeout.
-
enumerator kStatus_LPI2C_NoTransferInProgress
Attempt to abort a transfer when one is not in progress.
-
enumerator kStatus_LPI2C_DmaRequestFail
DMA request failed.
-
enumerator kStatus_LPI2C_Timeout
Timeout polling status flags.
-
enumerator kStatus_LPI2C_Busy
-
IRQn_Type const kLpi2cIrqs[]
Array to map LPI2C instance number to IRQ number, used internally for LPI2C master interrupt and EDMA transactional APIs.
-
lpi2c_master_isr_t s_lpi2cMasterIsr
Pointer to master IRQ handler for each instance, used internally for LPI2C master interrupt and EDMA transactional APIs.
-
void *s_lpi2cMasterHandle[]
Pointers to master handles for each instance, used internally for LPI2C master interrupt and EDMA transactional APIs.
-
uint32_t LPI2C_GetInstance(LPI2C_Type *base)
Returns an instance number given a base address.
If an invalid base address is passed, debug builds will assert. Release builds will just return instance number 0.
- Parameters:
base – The LPI2C peripheral base address.
- Returns:
LPI2C instance number starting from 0.
-
I2C_RETRY_TIMES
Retry times for waiting flag.
LPI2C Master Driver
-
void LPI2C_MasterGetDefaultConfig(lpi2c_master_config_t *masterConfig)
Provides a default configuration for the LPI2C master peripheral.
This function provides the following default configuration for the LPI2C master peripheral:
masterConfig->enableMaster = true; masterConfig->debugEnable = false; masterConfig->ignoreAck = false; masterConfig->pinConfig = kLPI2C_2PinOpenDrain; masterConfig->baudRate_Hz = 100000U; masterConfig->busIdleTimeout_ns = 0; masterConfig->pinLowTimeout_ns = 0; masterConfig->sdaGlitchFilterWidth_ns = 0; masterConfig->sclGlitchFilterWidth_ns = 0; masterConfig->hostRequest.enable = false; masterConfig->hostRequest.source = kLPI2C_HostRequestExternalPin; masterConfig->hostRequest.polarity = kLPI2C_HostRequestPinActiveHigh;
After calling this function, you can override any settings in order to customize the configuration, prior to initializing the master driver with LPI2C_MasterInit().
- Parameters:
masterConfig – [out] User provided configuration structure for default values. Refer to lpi2c_master_config_t.
-
void LPI2C_MasterInit(LPI2C_Type *base, const lpi2c_master_config_t *masterConfig, uint32_t sourceClock_Hz)
Initializes the LPI2C master peripheral.
This function enables the peripheral clock and initializes the LPI2C master peripheral as described by the user provided configuration. A software reset is performed prior to configuration.
- Parameters:
base – The LPI2C peripheral base address.
masterConfig – User provided peripheral configuration. Use LPI2C_MasterGetDefaultConfig() to get a set of defaults that you can override.
sourceClock_Hz – Frequency in Hertz of the LPI2C functional clock. Used to calculate the baud rate divisors, filter widths, and timeout periods.
-
void LPI2C_MasterDeinit(LPI2C_Type *base)
Deinitializes the LPI2C master peripheral.
This function disables the LPI2C master peripheral and gates the clock. It also performs a software reset to restore the peripheral to reset conditions.
- Parameters:
base – The LPI2C peripheral base address.
-
void LPI2C_MasterConfigureDataMatch(LPI2C_Type *base, const lpi2c_data_match_config_t *matchConfig)
Configures LPI2C master data match feature.
- Parameters:
base – The LPI2C peripheral base address.
matchConfig – Settings for the data match feature.
-
status_t LPI2C_MasterCheckAndClearError(LPI2C_Type *base, uint32_t status)
Convert provided flags to status code, and clear any errors if present.
- Parameters:
base – The LPI2C peripheral base address.
status – Current status flags value that will be checked.
- Return values:
kStatus_Success –
kStatus_LPI2C_PinLowTimeout –
kStatus_LPI2C_ArbitrationLost –
kStatus_LPI2C_Nak –
kStatus_LPI2C_FifoError –
-
status_t LPI2C_CheckForBusyBus(LPI2C_Type *base)
Make sure the bus isn’t already busy.
A busy bus is allowed if we are the one driving it.
- Parameters:
base – The LPI2C peripheral base address.
- Return values:
kStatus_Success –
kStatus_LPI2C_Busy –
-
static inline void LPI2C_MasterReset(LPI2C_Type *base)
Performs a software reset.
Restores the LPI2C master peripheral to reset conditions.
- Parameters:
base – The LPI2C peripheral base address.
-
static inline void LPI2C_MasterEnable(LPI2C_Type *base, bool enable)
Enables or disables the LPI2C module as master.
- Parameters:
base – The LPI2C peripheral base address.
enable – Pass true to enable or false to disable the specified LPI2C as master.
-
static inline uint32_t LPI2C_MasterGetStatusFlags(LPI2C_Type *base)
Gets the LPI2C master status flags.
A bit mask with the state of all LPI2C master status flags is returned. For each flag, the corresponding bit in the return value is set if the flag is asserted.
See also
_lpi2c_master_flags
- Parameters:
base – The LPI2C peripheral base address.
- Returns:
State of the status flags:
1: related status flag is set.
0: related status flag is not set.
-
static inline void LPI2C_MasterClearStatusFlags(LPI2C_Type *base, uint32_t statusMask)
Clears the LPI2C master status flag state.
The following status register flags can be cleared:
kLPI2C_MasterEndOfPacketFlag
kLPI2C_MasterStopDetectFlag
kLPI2C_MasterNackDetectFlag
kLPI2C_MasterArbitrationLostFlag
kLPI2C_MasterFifoErrFlag
kLPI2C_MasterPinLowTimeoutFlag
kLPI2C_MasterDataMatchFlag
Attempts to clear other flags has no effect.
See also
_lpi2c_master_flags.
- Parameters:
base – The LPI2C peripheral base address.
statusMask – A bitmask of status flags that are to be cleared. The mask is composed of _lpi2c_master_flags enumerators OR’d together. You may pass the result of a previous call to LPI2C_MasterGetStatusFlags().
-
static inline void LPI2C_MasterEnableInterrupts(LPI2C_Type *base, uint32_t interruptMask)
Enables the LPI2C master interrupt requests.
All flags except kLPI2C_MasterBusyFlag and kLPI2C_MasterBusBusyFlag can be enabled as interrupts.
- Parameters:
base – The LPI2C peripheral base address.
interruptMask – Bit mask of interrupts to enable. See _lpi2c_master_flags for the set of constants that should be OR’d together to form the bit mask.
-
static inline void LPI2C_MasterDisableInterrupts(LPI2C_Type *base, uint32_t interruptMask)
Disables the LPI2C master interrupt requests.
All flags except kLPI2C_MasterBusyFlag and kLPI2C_MasterBusBusyFlag can be enabled as interrupts.
- Parameters:
base – The LPI2C peripheral base address.
interruptMask – Bit mask of interrupts to disable. See _lpi2c_master_flags for the set of constants that should be OR’d together to form the bit mask.
-
static inline uint32_t LPI2C_MasterGetEnabledInterrupts(LPI2C_Type *base)
Returns the set of currently enabled LPI2C master interrupt requests.
- Parameters:
base – The LPI2C peripheral base address.
- Returns:
A bitmask composed of _lpi2c_master_flags enumerators OR’d together to indicate the set of enabled interrupts.
-
static inline void LPI2C_MasterEnableDMA(LPI2C_Type *base, bool enableTx, bool enableRx)
Enables or disables LPI2C master DMA requests.
- Parameters:
base – The LPI2C peripheral base address.
enableTx – Enable flag for transmit DMA request. Pass true for enable, false for disable.
enableRx – Enable flag for receive DMA request. Pass true for enable, false for disable.
-
static inline uint32_t LPI2C_MasterGetTxFifoAddress(LPI2C_Type *base)
Gets LPI2C master transmit data register address for DMA transfer.
- Parameters:
base – The LPI2C peripheral base address.
- Returns:
The LPI2C Master Transmit Data Register address.
-
static inline uint32_t LPI2C_MasterGetRxFifoAddress(LPI2C_Type *base)
Gets LPI2C master receive data register address for DMA transfer.
- Parameters:
base – The LPI2C peripheral base address.
- Returns:
The LPI2C Master Receive Data Register address.
-
static inline void LPI2C_MasterSetWatermarks(LPI2C_Type *base, size_t txWords, size_t rxWords)
Sets the watermarks for LPI2C master FIFOs.
- Parameters:
base – The LPI2C peripheral base address.
txWords – Transmit FIFO watermark value in words. The kLPI2C_MasterTxReadyFlag flag is set whenever the number of words in the transmit FIFO is equal or less than txWords. Writing a value equal or greater than the FIFO size is truncated.
rxWords – Receive FIFO watermark value in words. The kLPI2C_MasterRxReadyFlag flag is set whenever the number of words in the receive FIFO is greater than rxWords. Writing a value equal or greater than the FIFO size is truncated.
-
static inline void LPI2C_MasterGetFifoCounts(LPI2C_Type *base, size_t *rxCount, size_t *txCount)
Gets the current number of words in the LPI2C master FIFOs.
- Parameters:
base – The LPI2C peripheral base address.
txCount – [out] Pointer through which the current number of words in the transmit FIFO is returned. Pass NULL if this value is not required.
rxCount – [out] Pointer through which the current number of words in the receive FIFO is returned. Pass NULL if this value is not required.
-
void LPI2C_MasterSetBaudRate(LPI2C_Type *base, uint32_t sourceClock_Hz, uint32_t baudRate_Hz)
Sets the I2C bus frequency for master transactions.
The LPI2C master is automatically disabled and re-enabled as necessary to configure the baud rate. Do not call this function during a transfer, or the transfer is aborted.
Note
Please note that the second parameter is the clock frequency of LPI2C module, the third parameter means user configured bus baudrate, this implementation is different from other I2C drivers which use baudrate configuration as second parameter and source clock frequency as third parameter.
- Parameters:
base – The LPI2C peripheral base address.
sourceClock_Hz – LPI2C functional clock frequency in Hertz.
baudRate_Hz – Requested bus frequency in Hertz.
-
static inline bool LPI2C_MasterGetBusIdleState(LPI2C_Type *base)
Returns whether the bus is idle.
Requires the master mode to be enabled.
- Parameters:
base – The LPI2C peripheral base address.
- Return values:
true – Bus is busy.
false – Bus is idle.
-
status_t LPI2C_MasterStart(LPI2C_Type *base, uint8_t address, lpi2c_direction_t dir)
Sends a START signal and slave address on the I2C bus.
This function is used to initiate a new master mode transfer. First, the bus state is checked to ensure that another master is not occupying the bus. Then a START signal is transmitted, followed by the 7-bit address specified in the address parameter. Note that this function does not actually wait until the START and address are successfully sent on the bus before returning.
- Parameters:
base – The LPI2C peripheral base address.
address – 7-bit slave device address, in bits [6:0].
dir – Master transfer direction, either kLPI2C_Read or kLPI2C_Write. This parameter is used to set the R/w bit (bit 0) in the transmitted slave address.
- Return values:
kStatus_Success – START signal and address were successfully enqueued in the transmit FIFO.
kStatus_LPI2C_Busy – Another master is currently utilizing the bus.
-
static inline status_t LPI2C_MasterRepeatedStart(LPI2C_Type *base, uint8_t address, lpi2c_direction_t dir)
Sends a repeated START signal and slave address on the I2C bus.
This function is used to send a Repeated START signal when a transfer is already in progress. Like LPI2C_MasterStart(), it also sends the specified 7-bit address.
Note
This function exists primarily to maintain compatible APIs between LPI2C and I2C drivers, as well as to better document the intent of code that uses these APIs.
- Parameters:
base – The LPI2C peripheral base address.
address – 7-bit slave device address, in bits [6:0].
dir – Master transfer direction, either kLPI2C_Read or kLPI2C_Write. This parameter is used to set the R/w bit (bit 0) in the transmitted slave address.
- Return values:
kStatus_Success – Repeated START signal and address were successfully enqueued in the transmit FIFO.
kStatus_LPI2C_Busy – Another master is currently utilizing the bus.
-
status_t LPI2C_MasterSend(LPI2C_Type *base, void *txBuff, size_t txSize)
Performs a polling send transfer on the I2C bus.
Sends up to txSize number of bytes to the previously addressed slave device. The slave may reply with a NAK to any byte in order to terminate the transfer early. If this happens, this function returns kStatus_LPI2C_Nak.
- Parameters:
base – The LPI2C peripheral base address.
txBuff – The pointer to the data to be transferred.
txSize – The length in bytes of the data to be transferred.
- Return values:
kStatus_Success – Data was sent successfully.
kStatus_LPI2C_Busy – Another master is currently utilizing the bus.
kStatus_LPI2C_Nak – The slave device sent a NAK in response to a byte.
kStatus_LPI2C_FifoError – FIFO under run or over run.
kStatus_LPI2C_ArbitrationLost – Arbitration lost error.
kStatus_LPI2C_PinLowTimeout – SCL or SDA were held low longer than the timeout.
-
status_t LPI2C_MasterReceive(LPI2C_Type *base, void *rxBuff, size_t rxSize)
Performs a polling receive transfer on the I2C bus.
- Parameters:
base – The LPI2C peripheral base address.
rxBuff – The pointer to the data to be transferred.
rxSize – The length in bytes of the data to be transferred.
- Return values:
kStatus_Success – Data was received successfully.
kStatus_LPI2C_Busy – Another master is currently utilizing the bus.
kStatus_LPI2C_Nak – The slave device sent a NAK in response to a byte.
kStatus_LPI2C_FifoError – FIFO under run or overrun.
kStatus_LPI2C_ArbitrationLost – Arbitration lost error.
kStatus_LPI2C_PinLowTimeout – SCL or SDA were held low longer than the timeout.
-
status_t LPI2C_MasterStop(LPI2C_Type *base)
Sends a STOP signal on the I2C bus.
This function does not return until the STOP signal is seen on the bus, or an error occurs.
- Parameters:
base – The LPI2C peripheral base address.
- Return values:
kStatus_Success – The STOP signal was successfully sent on the bus and the transaction terminated.
kStatus_LPI2C_Busy – Another master is currently utilizing the bus.
kStatus_LPI2C_Nak – The slave device sent a NAK in response to a byte.
kStatus_LPI2C_FifoError – FIFO under run or overrun.
kStatus_LPI2C_ArbitrationLost – Arbitration lost error.
kStatus_LPI2C_PinLowTimeout – SCL or SDA were held low longer than the timeout.
-
status_t LPI2C_MasterTransferBlocking(LPI2C_Type *base, lpi2c_master_transfer_t *transfer)
Performs a master polling transfer on the I2C bus.
Note
The API does not return until the transfer succeeds or fails due to error happens during transfer.
- Parameters:
base – The LPI2C peripheral base address.
transfer – Pointer to the transfer structure.
- Return values:
kStatus_Success – Data was received successfully.
kStatus_LPI2C_Busy – Another master is currently utilizing the bus.
kStatus_LPI2C_Nak – The slave device sent a NAK in response to a byte.
kStatus_LPI2C_FifoError – FIFO under run or overrun.
kStatus_LPI2C_ArbitrationLost – Arbitration lost error.
kStatus_LPI2C_PinLowTimeout – SCL or SDA were held low longer than the timeout.
-
void LPI2C_MasterTransferCreateHandle(LPI2C_Type *base, lpi2c_master_handle_t *handle, lpi2c_master_transfer_callback_t callback, void *userData)
Creates a new handle for the LPI2C master non-blocking APIs.
The creation of a handle is for use with the non-blocking APIs. Once a handle is created, there is not a corresponding destroy handle. If the user wants to terminate a transfer, the LPI2C_MasterTransferAbort() API shall be called.
Note
The function also enables the NVIC IRQ for the input LPI2C. Need to notice that on some SoCs the LPI2C IRQ is connected to INTMUX, in this case user needs to enable the associated INTMUX IRQ in application.
- Parameters:
base – The LPI2C peripheral base address.
handle – [out] Pointer to the LPI2C master driver handle.
callback – User provided pointer to the asynchronous callback function.
userData – User provided pointer to the application callback data.
-
status_t LPI2C_MasterTransferNonBlocking(LPI2C_Type *base, lpi2c_master_handle_t *handle, lpi2c_master_transfer_t *transfer)
Performs a non-blocking transaction on the I2C bus.
- Parameters:
base – The LPI2C peripheral base address.
handle – Pointer to the LPI2C master driver handle.
transfer – The pointer to the transfer descriptor.
- Return values:
kStatus_Success – The transaction was started successfully.
kStatus_LPI2C_Busy – Either another master is currently utilizing the bus, or a non-blocking transaction is already in progress.
-
status_t LPI2C_MasterTransferGetCount(LPI2C_Type *base, lpi2c_master_handle_t *handle, size_t *count)
Returns number of bytes transferred so far.
- Parameters:
base – The LPI2C peripheral base address.
handle – Pointer to the LPI2C master driver handle.
count – [out] Number of bytes transferred so far by the non-blocking transaction.
- Return values:
kStatus_Success –
kStatus_NoTransferInProgress – There is not a non-blocking transaction currently in progress.
-
void LPI2C_MasterTransferAbort(LPI2C_Type *base, lpi2c_master_handle_t *handle)
Terminates a non-blocking LPI2C master transmission early.
Note
It is not safe to call this function from an IRQ handler that has a higher priority than the LPI2C peripheral’s IRQ priority.
- Parameters:
base – The LPI2C peripheral base address.
handle – Pointer to the LPI2C master driver handle.
-
void LPI2C_MasterTransferHandleIRQ(LPI2C_Type *base, void *lpi2cMasterHandle)
Reusable routine to handle master interrupts.
Note
This function does not need to be called unless you are reimplementing the nonblocking API’s interrupt handler routines to add special functionality.
- Parameters:
base – The LPI2C peripheral base address.
lpi2cMasterHandle – Pointer to the LPI2C master driver handle.
-
enum _lpi2c_master_flags
LPI2C master peripheral flags.
The following status register flags can be cleared:
kLPI2C_MasterEndOfPacketFlag
kLPI2C_MasterStopDetectFlag
kLPI2C_MasterNackDetectFlag
kLPI2C_MasterArbitrationLostFlag
kLPI2C_MasterFifoErrFlag
kLPI2C_MasterPinLowTimeoutFlag
kLPI2C_MasterDataMatchFlag
All flags except kLPI2C_MasterBusyFlag and kLPI2C_MasterBusBusyFlag can be enabled as interrupts.
Note
These enums are meant to be OR’d together to form a bit mask.
Values:
-
enumerator kLPI2C_MasterTxReadyFlag
Transmit data flag
-
enumerator kLPI2C_MasterRxReadyFlag
Receive data flag
-
enumerator kLPI2C_MasterEndOfPacketFlag
End Packet flag
-
enumerator kLPI2C_MasterStopDetectFlag
Stop detect flag
-
enumerator kLPI2C_MasterNackDetectFlag
NACK detect flag
-
enumerator kLPI2C_MasterArbitrationLostFlag
Arbitration lost flag
-
enumerator kLPI2C_MasterFifoErrFlag
FIFO error flag
-
enumerator kLPI2C_MasterPinLowTimeoutFlag
Pin low timeout flag
-
enumerator kLPI2C_MasterDataMatchFlag
Data match flag
-
enumerator kLPI2C_MasterBusyFlag
Master busy flag
-
enumerator kLPI2C_MasterBusBusyFlag
Bus busy flag
-
enumerator kLPI2C_MasterClearFlags
All flags which are cleared by the driver upon starting a transfer.
-
enumerator kLPI2C_MasterIrqFlags
IRQ sources enabled by the non-blocking transactional API.
-
enumerator kLPI2C_MasterErrorFlags
Errors to check for.
-
enum _lpi2c_direction
Direction of master and slave transfers.
Values:
-
enumerator kLPI2C_Write
Master transmit.
-
enumerator kLPI2C_Read
Master receive.
-
enumerator kLPI2C_Write
-
enum _lpi2c_master_pin_config
LPI2C pin configuration.
Values:
-
enumerator kLPI2C_2PinOpenDrain
LPI2C Configured for 2-pin open drain mode
-
enumerator kLPI2C_2PinOutputOnly
LPI2C Configured for 2-pin output only mode (ultra-fast mode)
-
enumerator kLPI2C_2PinPushPull
LPI2C Configured for 2-pin push-pull mode
-
enumerator kLPI2C_4PinPushPull
LPI2C Configured for 4-pin push-pull mode
-
enumerator kLPI2C_2PinOpenDrainWithSeparateSlave
LPI2C Configured for 2-pin open drain mode with separate LPI2C slave
-
enumerator kLPI2C_2PinOutputOnlyWithSeparateSlave
LPI2C Configured for 2-pin output only mode(ultra-fast mode) with separate LPI2C slave
-
enumerator kLPI2C_2PinPushPullWithSeparateSlave
LPI2C Configured for 2-pin push-pull mode with separate LPI2C slave
-
enumerator kLPI2C_4PinPushPullWithInvertedOutput
LPI2C Configured for 4-pin push-pull mode(inverted outputs)
-
enumerator kLPI2C_2PinOpenDrain
-
enum _lpi2c_host_request_source
LPI2C master host request selection.
Values:
-
enumerator kLPI2C_HostRequestExternalPin
Select the LPI2C_HREQ pin as the host request input
-
enumerator kLPI2C_HostRequestInputTrigger
Select the input trigger as the host request input
-
enumerator kLPI2C_HostRequestExternalPin
-
enum _lpi2c_host_request_polarity
LPI2C master host request pin polarity configuration.
Values:
-
enumerator kLPI2C_HostRequestPinActiveLow
Configure the LPI2C_HREQ pin active low
-
enumerator kLPI2C_HostRequestPinActiveHigh
Configure the LPI2C_HREQ pin active high
-
enumerator kLPI2C_HostRequestPinActiveLow
-
enum _lpi2c_data_match_config_mode
LPI2C master data match configuration modes.
Values:
-
enumerator kLPI2C_MatchDisabled
LPI2C Match Disabled
-
enumerator kLPI2C_1stWordEqualsM0OrM1
LPI2C Match Enabled and 1st data word equals MATCH0 OR MATCH1
-
enumerator kLPI2C_AnyWordEqualsM0OrM1
LPI2C Match Enabled and any data word equals MATCH0 OR MATCH1
-
enumerator kLPI2C_1stWordEqualsM0And2ndWordEqualsM1
LPI2C Match Enabled and 1st data word equals MATCH0, 2nd data equals MATCH1
-
enumerator kLPI2C_AnyWordEqualsM0AndNextWordEqualsM1
LPI2C Match Enabled and any data word equals MATCH0, next data equals MATCH1
-
enumerator kLPI2C_1stWordAndM1EqualsM0AndM1
LPI2C Match Enabled and 1st data word and MATCH0 equals MATCH0 and MATCH1
-
enumerator kLPI2C_AnyWordAndM1EqualsM0AndM1
LPI2C Match Enabled and any data word and MATCH0 equals MATCH0 and MATCH1
-
enumerator kLPI2C_MatchDisabled
-
enum _lpi2c_master_transfer_flags
Transfer option flags.
Note
These enumerations are intended to be OR’d together to form a bit mask of options for the _lpi2c_master_transfer::flags field.
Values:
-
enumerator kLPI2C_TransferDefaultFlag
Transfer starts with a start signal, stops with a stop signal.
-
enumerator kLPI2C_TransferNoStartFlag
Don’t send a start condition, address, and sub address
-
enumerator kLPI2C_TransferRepeatedStartFlag
Send a repeated start condition
-
enumerator kLPI2C_TransferNoStopFlag
Don’t send a stop condition.
-
enumerator kLPI2C_TransferDefaultFlag
-
typedef enum _lpi2c_direction lpi2c_direction_t
Direction of master and slave transfers.
-
typedef enum _lpi2c_master_pin_config lpi2c_master_pin_config_t
LPI2C pin configuration.
-
typedef enum _lpi2c_host_request_source lpi2c_host_request_source_t
LPI2C master host request selection.
-
typedef enum _lpi2c_host_request_polarity lpi2c_host_request_polarity_t
LPI2C master host request pin polarity configuration.
-
typedef struct _lpi2c_master_config lpi2c_master_config_t
Structure with settings to initialize the LPI2C master module.
This structure holds configuration settings for the LPI2C peripheral. To initialize this structure to reasonable defaults, call the LPI2C_MasterGetDefaultConfig() function and pass a pointer to your configuration structure instance.
The configuration structure can be made constant so it resides in flash.
-
typedef enum _lpi2c_data_match_config_mode lpi2c_data_match_config_mode_t
LPI2C master data match configuration modes.
-
typedef struct _lpi2c_match_config lpi2c_data_match_config_t
LPI2C master data match configuration structure.
-
typedef struct _lpi2c_master_transfer lpi2c_master_transfer_t
LPI2C master descriptor of the transfer.
-
typedef struct _lpi2c_master_handle lpi2c_master_handle_t
LPI2C master handle of the transfer.
-
typedef void (*lpi2c_master_transfer_callback_t)(LPI2C_Type *base, lpi2c_master_handle_t *handle, status_t completionStatus, void *userData)
Master completion callback function pointer type.
This callback is used only for the non-blocking master transfer API. Specify the callback you wish to use in the call to LPI2C_MasterTransferCreateHandle().
- Param base:
The LPI2C peripheral base address.
- Param handle:
Pointer to the LPI2C master driver handle.
- Param completionStatus:
Either kStatus_Success or an error code describing how the transfer completed.
- Param userData:
Arbitrary pointer-sized value passed from the application.
-
typedef void (*lpi2c_master_isr_t)(LPI2C_Type *base, void *handle)
Typedef for master interrupt handler, used internally for LPI2C master interrupt and EDMA transactional APIs.
-
struct _lpi2c_master_config
- #include <fsl_lpi2c.h>
Structure with settings to initialize the LPI2C master module.
This structure holds configuration settings for the LPI2C peripheral. To initialize this structure to reasonable defaults, call the LPI2C_MasterGetDefaultConfig() function and pass a pointer to your configuration structure instance.
The configuration structure can be made constant so it resides in flash.
Public Members
-
bool enableMaster
Whether to enable master mode.
-
bool enableDoze
Whether master is enabled in doze mode.
-
bool debugEnable
Enable transfers to continue when halted in debug mode.
-
bool ignoreAck
Whether to ignore ACK/NACK.
-
lpi2c_master_pin_config_t pinConfig
The pin configuration option.
-
uint32_t baudRate_Hz
Desired baud rate in Hertz.
-
uint32_t busIdleTimeout_ns
Bus idle timeout in nanoseconds. Set to 0 to disable.
-
uint32_t pinLowTimeout_ns
Pin low timeout in nanoseconds. Set to 0 to disable.
-
uint8_t sdaGlitchFilterWidth_ns
Width in nanoseconds of glitch filter on SDA pin. Set to 0 to disable.
-
uint8_t sclGlitchFilterWidth_ns
Width in nanoseconds of glitch filter on SCL pin. Set to 0 to disable.
-
struct _lpi2c_master_config hostRequest
Host request options.
-
bool enableMaster
-
struct _lpi2c_match_config
- #include <fsl_lpi2c.h>
LPI2C master data match configuration structure.
Public Members
-
lpi2c_data_match_config_mode_t matchMode
Data match configuration setting.
-
bool rxDataMatchOnly
When set to true, received data is ignored until a successful match.
-
uint32_t match0
Match value 0.
-
uint32_t match1
Match value 1.
-
lpi2c_data_match_config_mode_t matchMode
-
struct _lpi2c_master_transfer
- #include <fsl_lpi2c.h>
Non-blocking transfer descriptor structure.
This structure is used to pass transaction parameters to the LPI2C_MasterTransferNonBlocking() API.
Public Members
-
uint32_t flags
Bit mask of options for the transfer. See enumeration _lpi2c_master_transfer_flags for available options. Set to 0 or kLPI2C_TransferDefaultFlag for normal transfers.
-
uint16_t slaveAddress
The 7-bit slave address.
-
lpi2c_direction_t direction
Either kLPI2C_Read or kLPI2C_Write.
-
uint32_t subaddress
Sub address. Transferred MSB first.
-
size_t subaddressSize
Length of sub address to send in bytes. Maximum size is 4 bytes.
-
void *data
Pointer to data to transfer.
-
size_t dataSize
Number of bytes to transfer.
-
uint32_t flags
-
struct _lpi2c_master_handle
- #include <fsl_lpi2c.h>
Driver handle for master non-blocking APIs.
Note
The contents of this structure are private and subject to change.
Public Members
-
uint8_t state
Transfer state machine current state.
-
uint16_t remainingBytes
Remaining byte count in current state.
-
uint8_t *buf
Buffer pointer for current state.
-
uint16_t commandBuffer[6]
LPI2C command sequence. When all 6 command words are used: Start&addr&write[1 word] + subaddr[4 words] + restart&addr&read[1 word]
-
lpi2c_master_transfer_t transfer
Copy of the current transfer info.
-
lpi2c_master_transfer_callback_t completionCallback
Callback function pointer.
-
void *userData
Application data passed to callback.
-
uint8_t state
-
struct hostRequest
Public Members
-
bool enable
Enable host request.
-
lpi2c_host_request_source_t source
Host request source.
-
lpi2c_host_request_polarity_t polarity
Host request pin polarity.
-
bool enable
LPI2C Master DMA Driver
-
void LPI2C_MasterCreateEDMAHandle(LPI2C_Type *base, lpi2c_master_edma_handle_t *handle, edma_handle_t *rxDmaHandle, edma_handle_t *txDmaHandle, lpi2c_master_edma_transfer_callback_t callback, void *userData)
Create a new handle for the LPI2C master DMA APIs.
The creation of a handle is for use with the DMA APIs. Once a handle is created, there is not a corresponding destroy handle. If the user wants to terminate a transfer, the LPI2C_MasterTransferAbortEDMA() API shall be called.
For devices where the LPI2C send and receive DMA requests are OR’d together, the txDmaHandle parameter is ignored and may be set to NULL.
- Parameters:
base – The LPI2C peripheral base address.
handle – [out] Pointer to the LPI2C master driver handle.
rxDmaHandle – Handle for the eDMA receive channel. Created by the user prior to calling this function.
txDmaHandle – Handle for the eDMA transmit channel. Created by the user prior to calling this function.
callback – User provided pointer to the asynchronous callback function.
userData – User provided pointer to the application callback data.
-
status_t LPI2C_MasterTransferEDMA(LPI2C_Type *base, lpi2c_master_edma_handle_t *handle, lpi2c_master_transfer_t *transfer)
Performs a non-blocking DMA-based transaction on the I2C bus.
The callback specified when the handle was created is invoked when the transaction has completed.
- Parameters:
base – The LPI2C peripheral base address.
handle – Pointer to the LPI2C master driver handle.
transfer – The pointer to the transfer descriptor.
- Return values:
kStatus_Success – The transaction was started successfully.
kStatus_LPI2C_Busy – Either another master is currently utilizing the bus, or another DMA transaction is already in progress.
-
status_t LPI2C_MasterTransferGetCountEDMA(LPI2C_Type *base, lpi2c_master_edma_handle_t *handle, size_t *count)
Returns number of bytes transferred so far.
- Parameters:
base – The LPI2C peripheral base address.
handle – Pointer to the LPI2C master driver handle.
count – [out] Number of bytes transferred so far by the non-blocking transaction.
- Return values:
kStatus_Success –
kStatus_NoTransferInProgress – There is not a DMA transaction currently in progress.
-
status_t LPI2C_MasterTransferAbortEDMA(LPI2C_Type *base, lpi2c_master_edma_handle_t *handle)
Terminates a non-blocking LPI2C master transmission early.
Note
It is not safe to call this function from an IRQ handler that has a higher priority than the eDMA peripheral’s IRQ priority.
- Parameters:
base – The LPI2C peripheral base address.
handle – Pointer to the LPI2C master driver handle.
- Return values:
kStatus_Success – A transaction was successfully aborted.
kStatus_LPI2C_Idle – There is not a DMA transaction currently in progress.
-
typedef struct _lpi2c_master_edma_handle lpi2c_master_edma_handle_t
LPI2C master EDMA handle of the transfer.
-
typedef void (*lpi2c_master_edma_transfer_callback_t)(LPI2C_Type *base, lpi2c_master_edma_handle_t *handle, status_t completionStatus, void *userData)
Master DMA completion callback function pointer type.
This callback is used only for the non-blocking master transfer API. Specify the callback you wish to use in the call to LPI2C_MasterCreateEDMAHandle().
- Param base:
The LPI2C peripheral base address.
- Param handle:
Handle associated with the completed transfer.
- Param completionStatus:
Either kStatus_Success or an error code describing how the transfer completed.
- Param userData:
Arbitrary pointer-sized value passed from the application.
-
struct _lpi2c_master_edma_handle
- #include <fsl_lpi2c_edma.h>
Driver handle for master DMA APIs.
Note
The contents of this structure are private and subject to change.
Public Members
-
LPI2C_Type *base
LPI2C base pointer.
-
bool isBusy
Transfer state machine current state.
-
uint8_t nbytes
eDMA minor byte transfer count initially configured.
-
uint16_t commandBuffer[10]
LPI2C command sequence. When all 10 command words are used: Start&addr&write[1 word] + subaddr[4 words] + restart&addr&read[1 word] + receive&Size[4 words]
-
lpi2c_master_transfer_t transfer
Copy of the current transfer info.
-
lpi2c_master_edma_transfer_callback_t completionCallback
Callback function pointer.
-
void *userData
Application data passed to callback.
-
edma_handle_t *rx
Handle for receive DMA channel.
-
edma_handle_t *tx
Handle for transmit DMA channel.
-
edma_tcd_t tcds[3]
Software TCD. Three are allocated to provide enough room to align to 32-bytes.
-
LPI2C_Type *base
LPI2C Slave Driver
-
void LPI2C_SlaveGetDefaultConfig(lpi2c_slave_config_t *slaveConfig)
Provides a default configuration for the LPI2C slave peripheral.
This function provides the following default configuration for the LPI2C slave peripheral:
slaveConfig->enableSlave = true; slaveConfig->address0 = 0U; slaveConfig->address1 = 0U; slaveConfig->addressMatchMode = kLPI2C_MatchAddress0; slaveConfig->filterDozeEnable = true; slaveConfig->filterEnable = true; slaveConfig->enableGeneralCall = false; slaveConfig->sclStall.enableAck = false; slaveConfig->sclStall.enableTx = true; slaveConfig->sclStall.enableRx = true; slaveConfig->sclStall.enableAddress = true; slaveConfig->ignoreAck = false; slaveConfig->enableReceivedAddressRead = false; slaveConfig->sdaGlitchFilterWidth_ns = 0; slaveConfig->sclGlitchFilterWidth_ns = 0; slaveConfig->dataValidDelay_ns = 0; slaveConfig->clockHoldTime_ns = 0;
After calling this function, override any settings to customize the configuration, prior to initializing the master driver with LPI2C_SlaveInit(). Be sure to override at least the address0 member of the configuration structure with the desired slave address.
- Parameters:
slaveConfig – [out] User provided configuration structure that is set to default values. Refer to lpi2c_slave_config_t.
-
void LPI2C_SlaveInit(LPI2C_Type *base, const lpi2c_slave_config_t *slaveConfig, uint32_t sourceClock_Hz)
Initializes the LPI2C slave peripheral.
This function enables the peripheral clock and initializes the LPI2C slave peripheral as described by the user provided configuration.
- Parameters:
base – The LPI2C peripheral base address.
slaveConfig – User provided peripheral configuration. Use LPI2C_SlaveGetDefaultConfig() to get a set of defaults that you can override.
sourceClock_Hz – Frequency in Hertz of the LPI2C functional clock. Used to calculate the filter widths, data valid delay, and clock hold time.
-
void LPI2C_SlaveDeinit(LPI2C_Type *base)
Deinitializes the LPI2C slave peripheral.
This function disables the LPI2C slave peripheral and gates the clock. It also performs a software reset to restore the peripheral to reset conditions.
- Parameters:
base – The LPI2C peripheral base address.
-
static inline void LPI2C_SlaveReset(LPI2C_Type *base)
Performs a software reset of the LPI2C slave peripheral.
- Parameters:
base – The LPI2C peripheral base address.
-
static inline void LPI2C_SlaveEnable(LPI2C_Type *base, bool enable)
Enables or disables the LPI2C module as slave.
- Parameters:
base – The LPI2C peripheral base address.
enable – Pass true to enable or false to disable the specified LPI2C as slave.
-
static inline uint32_t LPI2C_SlaveGetStatusFlags(LPI2C_Type *base)
Gets the LPI2C slave status flags.
A bit mask with the state of all LPI2C slave status flags is returned. For each flag, the corresponding bit in the return value is set if the flag is asserted.
See also
_lpi2c_slave_flags
- Parameters:
base – The LPI2C peripheral base address.
- Returns:
State of the status flags:
1: related status flag is set.
0: related status flag is not set.
-
static inline void LPI2C_SlaveClearStatusFlags(LPI2C_Type *base, uint32_t statusMask)
Clears the LPI2C status flag state.
The following status register flags can be cleared:
kLPI2C_SlaveRepeatedStartDetectFlag
kLPI2C_SlaveStopDetectFlag
kLPI2C_SlaveBitErrFlag
kLPI2C_SlaveFifoErrFlag
Attempts to clear other flags has no effect.
See also
_lpi2c_slave_flags.
- Parameters:
base – The LPI2C peripheral base address.
statusMask – A bitmask of status flags that are to be cleared. The mask is composed of _lpi2c_slave_flags enumerators OR’d together. You may pass the result of a previous call to LPI2C_SlaveGetStatusFlags().
-
static inline void LPI2C_SlaveEnableInterrupts(LPI2C_Type *base, uint32_t interruptMask)
Enables the LPI2C slave interrupt requests.
All flags except kLPI2C_SlaveBusyFlag and kLPI2C_SlaveBusBusyFlag can be enabled as interrupts.
- Parameters:
base – The LPI2C peripheral base address.
interruptMask – Bit mask of interrupts to enable. See _lpi2c_slave_flags for the set of constants that should be OR’d together to form the bit mask.
-
static inline void LPI2C_SlaveDisableInterrupts(LPI2C_Type *base, uint32_t interruptMask)
Disables the LPI2C slave interrupt requests.
All flags except kLPI2C_SlaveBusyFlag and kLPI2C_SlaveBusBusyFlag can be enabled as interrupts.
- Parameters:
base – The LPI2C peripheral base address.
interruptMask – Bit mask of interrupts to disable. See _lpi2c_slave_flags for the set of constants that should be OR’d together to form the bit mask.
-
static inline uint32_t LPI2C_SlaveGetEnabledInterrupts(LPI2C_Type *base)
Returns the set of currently enabled LPI2C slave interrupt requests.
- Parameters:
base – The LPI2C peripheral base address.
- Returns:
A bitmask composed of _lpi2c_slave_flags enumerators OR’d together to indicate the set of enabled interrupts.
-
static inline void LPI2C_SlaveEnableDMA(LPI2C_Type *base, bool enableAddressValid, bool enableRx, bool enableTx)
Enables or disables the LPI2C slave peripheral DMA requests.
- Parameters:
base – The LPI2C peripheral base address.
enableAddressValid – Enable flag for the address valid DMA request. Pass true for enable, false for disable. The address valid DMA request is shared with the receive data DMA request.
enableRx – Enable flag for the receive data DMA request. Pass true for enable, false for disable.
enableTx – Enable flag for the transmit data DMA request. Pass true for enable, false for disable.
-
static inline bool LPI2C_SlaveGetBusIdleState(LPI2C_Type *base)
Returns whether the bus is idle.
Requires the slave mode to be enabled.
- Parameters:
base – The LPI2C peripheral base address.
- Return values:
true – Bus is busy.
false – Bus is idle.
-
static inline void LPI2C_SlaveTransmitAck(LPI2C_Type *base, bool ackOrNack)
Transmits either an ACK or NAK on the I2C bus in response to a byte from the master.
Use this function to send an ACK or NAK when the kLPI2C_SlaveTransmitAckFlag is asserted. This only happens if you enable the sclStall.enableAck field of the lpi2c_slave_config_t configuration structure used to initialize the slave peripheral.
- Parameters:
base – The LPI2C peripheral base address.
ackOrNack – Pass true for an ACK or false for a NAK.
-
static inline void LPI2C_SlaveEnableAckStall(LPI2C_Type *base, bool enable)
Enables or disables ACKSTALL.
When enables ACKSTALL, software can transmit either an ACK or NAK on the I2C bus in response to a byte from the master.
- Parameters:
base – The LPI2C peripheral base address.
enable – True will enable ACKSTALL,false will disable ACKSTALL.
-
static inline uint32_t LPI2C_SlaveGetReceivedAddress(LPI2C_Type *base)
Returns the slave address sent by the I2C master.
This function should only be called if the kLPI2C_SlaveAddressValidFlag is asserted.
- Parameters:
base – The LPI2C peripheral base address.
- Returns:
The 8-bit address matched by the LPI2C slave. Bit 0 contains the R/w direction bit, and the 7-bit slave address is in the upper 7 bits.
-
status_t LPI2C_SlaveSend(LPI2C_Type *base, void *txBuff, size_t txSize, size_t *actualTxSize)
Performs a polling send transfer on the I2C bus.
- Parameters:
base – The LPI2C peripheral base address.
txBuff – The pointer to the data to be transferred.
txSize – The length in bytes of the data to be transferred.
actualTxSize – [out]
- Returns:
Error or success status returned by API.
-
status_t LPI2C_SlaveReceive(LPI2C_Type *base, void *rxBuff, size_t rxSize, size_t *actualRxSize)
Performs a polling receive transfer on the I2C bus.
- Parameters:
base – The LPI2C peripheral base address.
rxBuff – The pointer to the data to be transferred.
rxSize – The length in bytes of the data to be transferred.
actualRxSize – [out]
- Returns:
Error or success status returned by API.
-
void LPI2C_SlaveTransferCreateHandle(LPI2C_Type *base, lpi2c_slave_handle_t *handle, lpi2c_slave_transfer_callback_t callback, void *userData)
Creates a new handle for the LPI2C slave non-blocking APIs.
The creation of a handle is for use with the non-blocking APIs. Once a handle is created, there is not a corresponding destroy handle. If the user wants to terminate a transfer, the LPI2C_SlaveTransferAbort() API shall be called.
Note
The function also enables the NVIC IRQ for the input LPI2C. Need to notice that on some SoCs the LPI2C IRQ is connected to INTMUX, in this case user needs to enable the associated INTMUX IRQ in application.
- Parameters:
base – The LPI2C peripheral base address.
handle – [out] Pointer to the LPI2C slave driver handle.
callback – User provided pointer to the asynchronous callback function.
userData – User provided pointer to the application callback data.
-
status_t LPI2C_SlaveTransferNonBlocking(LPI2C_Type *base, lpi2c_slave_handle_t *handle, uint32_t eventMask)
Starts accepting slave transfers.
Call this API after calling I2C_SlaveInit() and LPI2C_SlaveTransferCreateHandle() to start processing transactions driven by an I2C master. The slave monitors the I2C bus and pass events to the callback that was passed into the call to LPI2C_SlaveTransferCreateHandle(). The callback is always invoked from the interrupt context.
The set of events received by the callback is customizable. To do so, set the eventMask parameter to the OR’d combination of lpi2c_slave_transfer_event_t enumerators for the events you wish to receive. The kLPI2C_SlaveTransmitEvent and kLPI2C_SlaveReceiveEvent events are always enabled and do not need to be included in the mask. Alternatively, you can pass 0 to get a default set of only the transmit and receive events that are always enabled. In addition, the kLPI2C_SlaveAllEvents constant is provided as a convenient way to enable all events.
- Parameters:
base – The LPI2C peripheral base address.
handle – Pointer to lpi2c_slave_handle_t structure which stores the transfer state.
eventMask – Bit mask formed by OR’ing together lpi2c_slave_transfer_event_t enumerators to specify which events to send to the callback. Other accepted values are 0 to get a default set of only the transmit and receive events, and kLPI2C_SlaveAllEvents to enable all events.
- Return values:
kStatus_Success – Slave transfers were successfully started.
kStatus_LPI2C_Busy – Slave transfers have already been started on this handle.
-
status_t LPI2C_SlaveTransferGetCount(LPI2C_Type *base, lpi2c_slave_handle_t *handle, size_t *count)
Gets the slave transfer status during a non-blocking transfer.
- Parameters:
base – The LPI2C peripheral base address.
handle – Pointer to i2c_slave_handle_t structure.
count – [out] Pointer to a value to hold the number of bytes transferred. May be NULL if the count is not required.
- Return values:
kStatus_Success –
kStatus_NoTransferInProgress –
-
void LPI2C_SlaveTransferAbort(LPI2C_Type *base, lpi2c_slave_handle_t *handle)
Aborts the slave non-blocking transfers.
Note
This API could be called at any time to stop slave for handling the bus events.
- Parameters:
base – The LPI2C peripheral base address.
handle – Pointer to lpi2c_slave_handle_t structure which stores the transfer state.
-
void LPI2C_SlaveTransferHandleIRQ(LPI2C_Type *base, lpi2c_slave_handle_t *handle)
Reusable routine to handle slave interrupts.
Note
This function does not need to be called unless you are reimplementing the non blocking API’s interrupt handler routines to add special functionality.
- Parameters:
base – The LPI2C peripheral base address.
handle – Pointer to lpi2c_slave_handle_t structure which stores the transfer state.
-
enum _lpi2c_slave_flags
LPI2C slave peripheral flags.
The following status register flags can be cleared:
kLPI2C_SlaveRepeatedStartDetectFlag
kLPI2C_SlaveStopDetectFlag
kLPI2C_SlaveBitErrFlag
kLPI2C_SlaveFifoErrFlag
All flags except kLPI2C_SlaveBusyFlag and kLPI2C_SlaveBusBusyFlag can be enabled as interrupts.
Note
These enumerations are meant to be OR’d together to form a bit mask.
Values:
-
enumerator kLPI2C_SlaveTxReadyFlag
Transmit data flag
-
enumerator kLPI2C_SlaveRxReadyFlag
Receive data flag
-
enumerator kLPI2C_SlaveAddressValidFlag
Address valid flag
-
enumerator kLPI2C_SlaveTransmitAckFlag
Transmit ACK flag
-
enumerator kLPI2C_SlaveRepeatedStartDetectFlag
Repeated start detect flag
-
enumerator kLPI2C_SlaveStopDetectFlag
Stop detect flag
-
enumerator kLPI2C_SlaveBitErrFlag
Bit error flag
-
enumerator kLPI2C_SlaveFifoErrFlag
FIFO error flag
-
enumerator kLPI2C_SlaveAddressMatch0Flag
Address match 0 flag
-
enumerator kLPI2C_SlaveAddressMatch1Flag
Address match 1 flag
-
enumerator kLPI2C_SlaveGeneralCallFlag
General call flag
-
enumerator kLPI2C_SlaveBusyFlag
Master busy flag
-
enumerator kLPI2C_SlaveBusBusyFlag
Bus busy flag
-
enumerator kLPI2C_SlaveClearFlags
All flags which are cleared by the driver upon starting a transfer.
-
enumerator kLPI2C_SlaveIrqFlags
IRQ sources enabled by the non-blocking transactional API.
-
enumerator kLPI2C_SlaveErrorFlags
Errors to check for.
-
enum _lpi2c_slave_address_match
LPI2C slave address match options.
Values:
-
enumerator kLPI2C_MatchAddress0
Match only address 0.
-
enumerator kLPI2C_MatchAddress0OrAddress1
Match either address 0 or address 1.
-
enumerator kLPI2C_MatchAddress0ThroughAddress1
Match a range of slave addresses from address 0 through address 1.
-
enumerator kLPI2C_MatchAddress0
-
enum _lpi2c_slave_transfer_event
Set of events sent to the callback for non blocking slave transfers.
These event enumerations are used for two related purposes. First, a bit mask created by OR’ing together events is passed to LPI2C_SlaveTransferNonBlocking() in order to specify which events to enable. Then, when the slave callback is invoked, it is passed the current event through its transfer parameter.
Note
These enumerations are meant to be OR’d together to form a bit mask of events.
Values:
-
enumerator kLPI2C_SlaveAddressMatchEvent
Received the slave address after a start or repeated start.
-
enumerator kLPI2C_SlaveTransmitEvent
Callback is requested to provide data to transmit (slave-transmitter role).
-
enumerator kLPI2C_SlaveReceiveEvent
Callback is requested to provide a buffer in which to place received data (slave-receiver role).
-
enumerator kLPI2C_SlaveTransmitAckEvent
Callback needs to either transmit an ACK or NACK.
-
enumerator kLPI2C_SlaveRepeatedStartEvent
A repeated start was detected.
-
enumerator kLPI2C_SlaveCompletionEvent
A stop was detected, completing the transfer.
-
enumerator kLPI2C_SlaveAllEvents
Bit mask of all available events.
-
enumerator kLPI2C_SlaveAddressMatchEvent
-
typedef enum _lpi2c_slave_address_match lpi2c_slave_address_match_t
LPI2C slave address match options.
-
typedef struct _lpi2c_slave_config lpi2c_slave_config_t
Structure with settings to initialize the LPI2C slave module.
This structure holds configuration settings for the LPI2C slave peripheral. To initialize this structure to reasonable defaults, call the LPI2C_SlaveGetDefaultConfig() function and pass a pointer to your configuration structure instance.
The configuration structure can be made constant so it resides in flash.
-
typedef enum _lpi2c_slave_transfer_event lpi2c_slave_transfer_event_t
Set of events sent to the callback for non blocking slave transfers.
These event enumerations are used for two related purposes. First, a bit mask created by OR’ing together events is passed to LPI2C_SlaveTransferNonBlocking() in order to specify which events to enable. Then, when the slave callback is invoked, it is passed the current event through its transfer parameter.
Note
These enumerations are meant to be OR’d together to form a bit mask of events.
-
typedef struct _lpi2c_slave_transfer lpi2c_slave_transfer_t
LPI2C slave transfer structure.
-
typedef struct _lpi2c_slave_handle lpi2c_slave_handle_t
LPI2C slave handle structure.
-
typedef void (*lpi2c_slave_transfer_callback_t)(LPI2C_Type *base, lpi2c_slave_transfer_t *transfer, void *userData)
Slave event callback function pointer type.
This callback is used only for the slave non-blocking transfer API. To install a callback, use the LPI2C_SlaveSetCallback() function after you have created a handle.
- Param base:
Base address for the LPI2C instance on which the event occurred.
- Param transfer:
Pointer to transfer descriptor containing values passed to and/or from the callback.
- Param userData:
Arbitrary pointer-sized value passed from the application.
-
struct _lpi2c_slave_config
- #include <fsl_lpi2c.h>
Structure with settings to initialize the LPI2C slave module.
This structure holds configuration settings for the LPI2C slave peripheral. To initialize this structure to reasonable defaults, call the LPI2C_SlaveGetDefaultConfig() function and pass a pointer to your configuration structure instance.
The configuration structure can be made constant so it resides in flash.
Public Members
-
bool enableSlave
Enable slave mode.
-
uint8_t address0
Slave’s 7-bit address.
-
uint8_t address1
Alternate slave 7-bit address.
-
lpi2c_slave_address_match_t addressMatchMode
Address matching options.
-
bool filterDozeEnable
Enable digital glitch filter in doze mode.
-
bool filterEnable
Enable digital glitch filter.
-
bool enableGeneralCall
Enable general call address matching.
-
struct _lpi2c_slave_config sclStall
SCL stall enable options.
-
bool ignoreAck
Continue transfers after a NACK is detected.
-
bool enableReceivedAddressRead
Enable reading the address received address as the first byte of data.
-
uint32_t sdaGlitchFilterWidth_ns
Width in nanoseconds of the digital filter on the SDA signal. Set to 0 to disable.
-
uint32_t sclGlitchFilterWidth_ns
Width in nanoseconds of the digital filter on the SCL signal. Set to 0 to disable.
-
uint32_t dataValidDelay_ns
Width in nanoseconds of the data valid delay.
-
uint32_t clockHoldTime_ns
Width in nanoseconds of the clock hold time.
-
bool enableSlave
-
struct _lpi2c_slave_transfer
- #include <fsl_lpi2c.h>
LPI2C slave transfer structure.
Public Members
-
lpi2c_slave_transfer_event_t event
Reason the callback is being invoked.
-
uint8_t receivedAddress
Matching address send by master.
-
uint8_t *data
Transfer buffer
-
size_t dataSize
Transfer size
-
status_t completionStatus
Success or error code describing how the transfer completed. Only applies for kLPI2C_SlaveCompletionEvent.
-
size_t transferredCount
Number of bytes actually transferred since start or last repeated start.
-
lpi2c_slave_transfer_event_t event
-
struct _lpi2c_slave_handle
- #include <fsl_lpi2c.h>
LPI2C slave handle structure.
Note
The contents of this structure are private and subject to change.
Public Members
-
lpi2c_slave_transfer_t transfer
LPI2C slave transfer copy.
-
bool isBusy
Whether transfer is busy.
-
bool wasTransmit
Whether the last transfer was a transmit.
-
uint32_t eventMask
Mask of enabled events.
-
uint32_t transferredCount
Count of bytes transferred.
-
lpi2c_slave_transfer_callback_t callback
Callback function called at transfer event.
-
void *userData
Callback parameter passed to callback.
-
lpi2c_slave_transfer_t transfer
-
struct sclStall
Public Members
-
bool enableAck
Enables SCL clock stretching during slave-transmit address byte(s) and slave-receiver address and data byte(s) to allow software to write the Transmit ACK Register before the ACK or NACK is transmitted. Clock stretching occurs when transmitting the 9th bit. When enableAckSCLStall is enabled, there is no need to set either enableRxDataSCLStall or enableAddressSCLStall.
-
bool enableTx
Enables SCL clock stretching when the transmit data flag is set during a slave-transmit transfer.
-
bool enableRx
Enables SCL clock stretching when receive data flag is set during a slave-receive transfer.
-
bool enableAddress
Enables SCL clock stretching when the address valid flag is asserted.
-
bool enableAck
LPSPI: Low Power Serial Peripheral Interface
LPSPI Peripheral driver
-
void LPSPI_MasterInit(LPSPI_Type *base, const lpspi_master_config_t *masterConfig, uint32_t srcClock_Hz)
Initializes the LPSPI master.
- Parameters:
base – LPSPI peripheral address.
masterConfig – Pointer to structure lpspi_master_config_t.
srcClock_Hz – Module source input clock in Hertz
-
void LPSPI_MasterGetDefaultConfig(lpspi_master_config_t *masterConfig)
Sets the lpspi_master_config_t structure to default values.
This API initializes the configuration structure for LPSPI_MasterInit(). The initialized structure can remain unchanged in LPSPI_MasterInit(), or can be modified before calling the LPSPI_MasterInit(). Example:
lpspi_master_config_t masterConfig; LPSPI_MasterGetDefaultConfig(&masterConfig);
- Parameters:
masterConfig – pointer to lpspi_master_config_t structure
-
void LPSPI_SlaveInit(LPSPI_Type *base, const lpspi_slave_config_t *slaveConfig)
LPSPI slave configuration.
- Parameters:
base – LPSPI peripheral address.
slaveConfig – Pointer to a structure lpspi_slave_config_t.
-
void LPSPI_SlaveGetDefaultConfig(lpspi_slave_config_t *slaveConfig)
Sets the lpspi_slave_config_t structure to default values.
This API initializes the configuration structure for LPSPI_SlaveInit(). The initialized structure can remain unchanged in LPSPI_SlaveInit() or can be modified before calling the LPSPI_SlaveInit(). Example:
lpspi_slave_config_t slaveConfig; LPSPI_SlaveGetDefaultConfig(&slaveConfig);
- Parameters:
slaveConfig – pointer to lpspi_slave_config_t structure.
-
void LPSPI_Deinit(LPSPI_Type *base)
De-initializes the LPSPI peripheral. Call this API to disable the LPSPI clock.
- Parameters:
base – LPSPI peripheral address.
-
void LPSPI_Reset(LPSPI_Type *base)
Restores the LPSPI peripheral to reset state. Note that this function sets all registers to reset state. As a result, the LPSPI module can’t work after calling this API.
- Parameters:
base – LPSPI peripheral address.
-
uint32_t LPSPI_GetInstance(LPSPI_Type *base)
Get the LPSPI instance from peripheral base address.
- Parameters:
base – LPSPI peripheral base address.
- Returns:
LPSPI instance.
-
static inline void LPSPI_Enable(LPSPI_Type *base, bool enable)
Enables the LPSPI peripheral and sets the MCR MDIS to 0.
- Parameters:
base – LPSPI peripheral address.
enable – Pass true to enable module, false to disable module.
-
static inline uint32_t LPSPI_GetStatusFlags(LPSPI_Type *base)
Gets the LPSPI status flag state.
- Parameters:
base – LPSPI peripheral address.
- Returns:
The LPSPI status(in SR register).
-
static inline uint8_t LPSPI_GetTxFifoSize(LPSPI_Type *base)
Gets the LPSPI Tx FIFO size.
- Parameters:
base – LPSPI peripheral address.
- Returns:
The LPSPI Tx FIFO size.
-
static inline uint8_t LPSPI_GetRxFifoSize(LPSPI_Type *base)
Gets the LPSPI Rx FIFO size.
- Parameters:
base – LPSPI peripheral address.
- Returns:
The LPSPI Rx FIFO size.
-
static inline uint32_t LPSPI_GetTxFifoCount(LPSPI_Type *base)
Gets the LPSPI Tx FIFO count.
- Parameters:
base – LPSPI peripheral address.
- Returns:
The number of words in the transmit FIFO.
-
static inline uint32_t LPSPI_GetRxFifoCount(LPSPI_Type *base)
Gets the LPSPI Rx FIFO count.
- Parameters:
base – LPSPI peripheral address.
- Returns:
The number of words in the receive FIFO.
-
static inline void LPSPI_ClearStatusFlags(LPSPI_Type *base, uint32_t statusFlags)
Clears the LPSPI status flag.
This function clears the desired status bit by using a write-1-to-clear. The user passes in the base and the desired status flag bit to clear. The list of status flags is defined in the _lpspi_flags. Example usage:
LPSPI_ClearStatusFlags(base, kLPSPI_TxDataRequestFlag|kLPSPI_RxDataReadyFlag);
- Parameters:
base – LPSPI peripheral address.
statusFlags – The status flag used from type _lpspi_flags.
-
static inline uint32_t LPSPI_GetTcr(LPSPI_Type *base)
-
static inline void LPSPI_EnableInterrupts(LPSPI_Type *base, uint32_t mask)
Enables the LPSPI interrupts.
This function configures the various interrupt masks of the LPSPI. The parameters are base and an interrupt mask. Note that, for Tx fill and Rx FIFO drain requests, enabling the interrupt request disables the DMA request.
LPSPI_EnableInterrupts(base, kLPSPI_TxInterruptEnable | kLPSPI_RxInterruptEnable );
- Parameters:
base – LPSPI peripheral address.
mask – The interrupt mask; Use the enum _lpspi_interrupt_enable.
-
static inline void LPSPI_DisableInterrupts(LPSPI_Type *base, uint32_t mask)
Disables the LPSPI interrupts.
LPSPI_DisableInterrupts(base, kLPSPI_TxInterruptEnable | kLPSPI_RxInterruptEnable );
- Parameters:
base – LPSPI peripheral address.
mask – The interrupt mask; Use the enum _lpspi_interrupt_enable.
-
static inline void LPSPI_EnableDMA(LPSPI_Type *base, uint32_t mask)
Enables the LPSPI DMA request.
This function configures the Rx and Tx DMA mask of the LPSPI. The parameters are base and a DMA mask.
LPSPI_EnableDMA(base, kLPSPI_TxDmaEnable | kLPSPI_RxDmaEnable);
- Parameters:
base – LPSPI peripheral address.
mask – The interrupt mask; Use the enum _lpspi_dma_enable.
-
static inline void LPSPI_DisableDMA(LPSPI_Type *base, uint32_t mask)
Disables the LPSPI DMA request.
This function configures the Rx and Tx DMA mask of the LPSPI. The parameters are base and a DMA mask.
SPI_DisableDMA(base, kLPSPI_TxDmaEnable | kLPSPI_RxDmaEnable);
- Parameters:
base – LPSPI peripheral address.
mask – The interrupt mask; Use the enum _lpspi_dma_enable.
-
static inline uint32_t LPSPI_GetTxRegisterAddress(LPSPI_Type *base)
Gets the LPSPI Transmit Data Register address for a DMA operation.
This function gets the LPSPI Transmit Data Register address because this value is needed for the DMA operation. This function can be used for either master or slave mode.
- Parameters:
base – LPSPI peripheral address.
- Returns:
The LPSPI Transmit Data Register address.
-
static inline uint32_t LPSPI_GetRxRegisterAddress(LPSPI_Type *base)
Gets the LPSPI Receive Data Register address for a DMA operation.
This function gets the LPSPI Receive Data Register address because this value is needed for the DMA operation. This function can be used for either master or slave mode.
- Parameters:
base – LPSPI peripheral address.
- Returns:
The LPSPI Receive Data Register address.
-
bool LPSPI_CheckTransferArgument(LPSPI_Type *base, lpspi_transfer_t *transfer, bool isEdma)
Check the argument for transfer .
- Parameters:
base – LPSPI peripheral address.
transfer – the transfer struct to be used.
isEdma – True to check for EDMA transfer, false to check interrupt non-blocking transfer
- Returns:
Return true for right and false for wrong.
-
static inline void LPSPI_SetMasterSlaveMode(LPSPI_Type *base, lpspi_master_slave_mode_t mode)
Configures the LPSPI for either master or slave.
Note that the CFGR1 should only be written when the LPSPI is disabled (LPSPIx_CR_MEN = 0).
- Parameters:
base – LPSPI peripheral address.
mode – Mode setting (master or slave) of type lpspi_master_slave_mode_t.
-
static inline void LPSPI_SelectTransferPCS(LPSPI_Type *base, lpspi_which_pcs_t select)
Configures the peripheral chip select used for the transfer.
- Parameters:
base – LPSPI peripheral address.
select – LPSPI Peripheral Chip Select (PCS) configuration.
-
static inline void LPSPI_SetPCSContinous(LPSPI_Type *base, bool IsContinous)
Set the PCS signal to continuous or uncontinuous mode.
Note
In master mode, continuous transfer will keep the PCS asserted at the end of the frame size, until a command word is received that starts a new frame. So PCS must be set back to uncontinuous when transfer finishes. In slave mode, when continuous transfer is enabled, the LPSPI will only transmit the first frame size bits, after that the LPSPI will transmit received data back (assuming a 32-bit shift register).
- Parameters:
base – LPSPI peripheral address.
IsContinous – True to set the transfer PCS to continuous mode, false to set to uncontinuous mode.
-
static inline bool LPSPI_IsMaster(LPSPI_Type *base)
Returns whether the LPSPI module is in master mode.
- Parameters:
base – LPSPI peripheral address.
- Returns:
Returns true if the module is in master mode or false if the module is in slave mode.
-
static inline void LPSPI_FlushFifo(LPSPI_Type *base, bool flushTxFifo, bool flushRxFifo)
Flushes the LPSPI FIFOs.
- Parameters:
base – LPSPI peripheral address.
flushTxFifo – Flushes (true) the Tx FIFO, else do not flush (false) the Tx FIFO.
flushRxFifo – Flushes (true) the Rx FIFO, else do not flush (false) the Rx FIFO.
-
static inline void LPSPI_SetFifoWatermarks(LPSPI_Type *base, uint32_t txWater, uint32_t rxWater)
Sets the transmit and receive FIFO watermark values.
This function allows the user to set the receive and transmit FIFO watermarks. The function does not compare the watermark settings to the FIFO size. The FIFO watermark should not be equal to or greater than the FIFO size. It is up to the higher level driver to make this check.
- Parameters:
base – LPSPI peripheral address.
txWater – The TX FIFO watermark value. Writing a value equal or greater than the FIFO size is truncated.
rxWater – The RX FIFO watermark value. Writing a value equal or greater than the FIFO size is truncated.
-
static inline void LPSPI_SetAllPcsPolarity(LPSPI_Type *base, uint32_t mask)
Configures all LPSPI peripheral chip select polarities simultaneously.
Note that the CFGR1 should only be written when the LPSPI is disabled (LPSPIx_CR_MEN = 0).
This is an example: PCS0 and PCS1 set to active low and other PCSs set to active high. Note that the number of PCS is device-specific.
LPSPI_SetAllPcsPolarity(base, kLPSPI_Pcs0ActiveLow | kLPSPI_Pcs1ActiveLow);
- Parameters:
base – LPSPI peripheral address.
mask – The PCS polarity mask; Use the enum _lpspi_pcs_polarity.
-
static inline void LPSPI_SetFrameSize(LPSPI_Type *base, uint32_t frameSize)
Configures the frame size.
The minimum frame size is 8-bits and the maximum frame size is 4096-bits. If the frame size is less than or equal to 32-bits, the word size and frame size are identical. If the frame size is greater than 32-bits, the word size is 32-bits for each word except the last (the last word contains the remainder bits if the frame size is not divisible by 32). The minimum word size is 2-bits. A frame size of 33-bits (or similar) is not supported.
Note 1: The transmit command register should be initialized before enabling the LPSPI in slave mode, although the command register does not update until after the LPSPI is enabled. After it is enabled, the transmit command register should only be changed if the LPSPI is idle.
Note 2: The transmit and command FIFO is a combined FIFO that includes both transmit data and command words. That means the TCR register should be written to when the Tx FIFO is not full.
- Parameters:
base – LPSPI peripheral address.
frameSize – The frame size in number of bits.
-
uint32_t LPSPI_MasterSetBaudRate(LPSPI_Type *base, uint32_t baudRate_Bps, uint32_t srcClock_Hz, uint32_t *tcrPrescaleValue)
Sets the LPSPI baud rate in bits per second.
This function takes in the desired bitsPerSec (baud rate) and calculates the nearest possible baud rate without exceeding the desired baud rate and returns the calculated baud rate in bits-per-second. It requires the caller to provide the frequency of the module source clock (in Hertz). Note that the baud rate does not go into effect until the Transmit Control Register (TCR) is programmed with the prescale value. Hence, this function returns the prescale tcrPrescaleValue parameter for later programming in the TCR. The higher level peripheral driver should alert the user of an out of range baud rate input.
Note that the LPSPI module must first be disabled before configuring this. Note that the LPSPI module must be configured for master mode before configuring this.
- Parameters:
base – LPSPI peripheral address.
baudRate_Bps – The desired baud rate in bits per second.
srcClock_Hz – Module source input clock in Hertz.
tcrPrescaleValue – The TCR prescale value needed to program the TCR.
- Returns:
The actual calculated baud rate. This function may also return a “0” if the LPSPI is not configured for master mode or if the LPSPI module is not disabled.
-
void LPSPI_MasterSetDelayScaler(LPSPI_Type *base, uint32_t scaler, lpspi_delay_type_t whichDelay)
Manually configures a specific LPSPI delay parameter (module must be disabled to change the delay values).
This function configures the following: SCK to PCS delay, or PCS to SCK delay, or The configurations must occur between the transfer delay.
The delay names are available in type lpspi_delay_type_t.
The user passes the desired delay along with the delay value. This allows the user to directly set the delay values if they have pre-calculated them or if they simply wish to manually increment the value.
Note that the LPSPI module must first be disabled before configuring this. Note that the LPSPI module must be configured for master mode before configuring this.
- Parameters:
base – LPSPI peripheral address.
scaler – The 8-bit delay value 0x00 to 0xFF (255).
whichDelay – The desired delay to configure, must be of type lpspi_delay_type_t.
-
uint32_t LPSPI_MasterSetDelayTimes(LPSPI_Type *base, uint32_t delayTimeInNanoSec, lpspi_delay_type_t whichDelay, uint32_t srcClock_Hz)
Calculates the delay based on the desired delay input in nanoseconds (module must be disabled to change the delay values).
This function calculates the values for the following: SCK to PCS delay, or PCS to SCK delay, or The configurations must occur between the transfer delay.
The delay names are available in type lpspi_delay_type_t.
The user passes the desired delay and the desired delay value in nano-seconds. The function calculates the value needed for the desired delay parameter and returns the actual calculated delay because an exact delay match may not be possible. In this case, the closest match is calculated without going below the desired delay value input. It is possible to input a very large delay value that exceeds the capability of the part, in which case the maximum supported delay is returned. It is up to the higher level peripheral driver to alert the user of an out of range delay input.
Note that the LPSPI module must be configured for master mode before configuring this. And note that the delayTime = LPSPI_clockSource / (PRESCALE * Delay_scaler).
- Parameters:
base – LPSPI peripheral address.
delayTimeInNanoSec – The desired delay value in nano-seconds.
whichDelay – The desired delay to configuration, which must be of type lpspi_delay_type_t.
srcClock_Hz – Module source input clock in Hertz.
- Returns:
actual Calculated delay value in nano-seconds.
-
static inline void LPSPI_WriteData(LPSPI_Type *base, uint32_t data)
Writes data into the transmit data buffer.
This function writes data passed in by the user to the Transmit Data Register (TDR). The user can pass up to 32-bits of data to load into the TDR. If the frame size exceeds 32-bits, the user has to manage sending the data one 32-bit word at a time. Any writes to the TDR result in an immediate push to the transmit FIFO. This function can be used for either master or slave modes.
- Parameters:
base – LPSPI peripheral address.
data – The data word to be sent.
-
static inline uint32_t LPSPI_ReadData(LPSPI_Type *base)
Reads data from the data buffer.
This function reads the data from the Receive Data Register (RDR). This function can be used for either master or slave mode.
- Parameters:
base – LPSPI peripheral address.
- Returns:
The data read from the data buffer.
-
void LPSPI_SetDummyData(LPSPI_Type *base, uint8_t dummyData)
Set up the dummy data.
- Parameters:
base – LPSPI peripheral address.
dummyData – Data to be transferred when tx buffer is NULL. Note: This API has no effect when LPSPI in slave interrupt mode, because driver will set the TXMSK bit to 1 if txData is NULL, no data is loaded from transmit FIFO and output pin is tristated.
-
void LPSPI_MasterTransferCreateHandle(LPSPI_Type *base, lpspi_master_handle_t *handle, lpspi_master_transfer_callback_t callback, void *userData)
Initializes the LPSPI master handle.
This function initializes the LPSPI handle, which can be used for other LPSPI transactional APIs. Usually, for a specified LPSPI instance, call this API once to get the initialized handle.
- Parameters:
base – LPSPI peripheral address.
handle – LPSPI handle pointer to lpspi_master_handle_t.
callback – DSPI callback.
userData – callback function parameter.
-
status_t LPSPI_MasterTransferBlocking(LPSPI_Type *base, lpspi_transfer_t *transfer)
LPSPI master transfer data using a polling method.
This function transfers data using a polling method. This is a blocking function, which does not return until all transfers have been completed.
Note: The transfer data size should be integer multiples of bytesPerFrame if bytesPerFrame is less than or equal to 4. For bytesPerFrame greater than 4: The transfer data size should be equal to bytesPerFrame if the bytesPerFrame is not integer multiples of 4. Otherwise, the transfer data size can be an integer multiple of bytesPerFrame.
- Parameters:
base – LPSPI peripheral address.
transfer – pointer to lpspi_transfer_t structure.
- Returns:
status of status_t.
-
status_t LPSPI_MasterTransferNonBlocking(LPSPI_Type *base, lpspi_master_handle_t *handle, lpspi_transfer_t *transfer)
LPSPI master transfer data using an interrupt method.
This function transfers data using an interrupt method. This is a non-blocking function, which returns right away. When all data is transferred, the callback function is called.
Note: The transfer data size should be integer multiples of bytesPerFrame if bytesPerFrame is less than or equal to 4. For bytesPerFrame greater than 4: The transfer data size should be equal to bytesPerFrame if the bytesPerFrame is not integer multiples of 4. Otherwise, the transfer data size can be an integer multiple of bytesPerFrame.
- Parameters:
base – LPSPI peripheral address.
handle – pointer to lpspi_master_handle_t structure which stores the transfer state.
transfer – pointer to lpspi_transfer_t structure.
- Returns:
status of status_t.
-
status_t LPSPI_MasterTransferGetCount(LPSPI_Type *base, lpspi_master_handle_t *handle, size_t *count)
Gets the master transfer remaining bytes.
This function gets the master transfer remaining bytes.
- Parameters:
base – LPSPI peripheral address.
handle – pointer to lpspi_master_handle_t structure which stores the transfer state.
count – Number of bytes transferred so far by the non-blocking transaction.
- Returns:
status of status_t.
-
void LPSPI_MasterTransferAbort(LPSPI_Type *base, lpspi_master_handle_t *handle)
LPSPI master abort transfer which uses an interrupt method.
This function aborts a transfer which uses an interrupt method.
- Parameters:
base – LPSPI peripheral address.
handle – pointer to lpspi_master_handle_t structure which stores the transfer state.
-
void LPSPI_MasterTransferHandleIRQ(LPSPI_Type *base, lpspi_master_handle_t *handle)
LPSPI Master IRQ handler function.
This function processes the LPSPI transmit and receive IRQ.
- Parameters:
base – LPSPI peripheral address.
handle – pointer to lpspi_master_handle_t structure which stores the transfer state.
-
void LPSPI_SlaveTransferCreateHandle(LPSPI_Type *base, lpspi_slave_handle_t *handle, lpspi_slave_transfer_callback_t callback, void *userData)
Initializes the LPSPI slave handle.
This function initializes the LPSPI handle, which can be used for other LPSPI transactional APIs. Usually, for a specified LPSPI instance, call this API once to get the initialized handle.
- Parameters:
base – LPSPI peripheral address.
handle – LPSPI handle pointer to lpspi_slave_handle_t.
callback – DSPI callback.
userData – callback function parameter.
-
status_t LPSPI_SlaveTransferNonBlocking(LPSPI_Type *base, lpspi_slave_handle_t *handle, lpspi_transfer_t *transfer)
LPSPI slave transfer data using an interrupt method.
This function transfer data using an interrupt method. This is a non-blocking function, which returns right away. When all data is transferred, the callback function is called.
Note: The transfer data size should be integer multiples of bytesPerFrame if bytesPerFrame is less than or equal to 4. For bytesPerFrame greater than 4: The transfer data size should be equal to bytesPerFrame if the bytesPerFrame is not an integer multiple of 4. Otherwise, the transfer data size can be an integer multiple of bytesPerFrame.
- Parameters:
base – LPSPI peripheral address.
handle – pointer to lpspi_slave_handle_t structure which stores the transfer state.
transfer – pointer to lpspi_transfer_t structure.
- Returns:
status of status_t.
-
status_t LPSPI_SlaveTransferGetCount(LPSPI_Type *base, lpspi_slave_handle_t *handle, size_t *count)
Gets the slave transfer remaining bytes.
This function gets the slave transfer remaining bytes.
- Parameters:
base – LPSPI peripheral address.
handle – pointer to lpspi_slave_handle_t structure which stores the transfer state.
count – Number of bytes transferred so far by the non-blocking transaction.
- Returns:
status of status_t.
-
void LPSPI_SlaveTransferAbort(LPSPI_Type *base, lpspi_slave_handle_t *handle)
LPSPI slave aborts a transfer which uses an interrupt method.
This function aborts a transfer which uses an interrupt method.
- Parameters:
base – LPSPI peripheral address.
handle – pointer to lpspi_slave_handle_t structure which stores the transfer state.
-
void LPSPI_SlaveTransferHandleIRQ(LPSPI_Type *base, lpspi_slave_handle_t *handle)
LPSPI Slave IRQ handler function.
This function processes the LPSPI transmit and receives an IRQ.
- Parameters:
base – LPSPI peripheral address.
handle – pointer to lpspi_slave_handle_t structure which stores the transfer state.
-
bool LPSPI_WaitTxFifoEmpty(LPSPI_Type *base)
Wait for tx FIFO to be empty.
This function wait the tx fifo empty
- Parameters:
base – LPSPI peripheral address.
- Returns:
true for the tx FIFO is ready, false is not.
-
void LPSPI_DriverIRQHandler(uint32_t instance)
LPSPI driver IRQ handler common entry.
This function provides the common IRQ request entry for LPSPI.
- Parameters:
instance – LPSPI instance.
-
FSL_LPSPI_DRIVER_VERSION
LPSPI driver version.
Status for the LPSPI driver.
Values:
-
enumerator kStatus_LPSPI_Busy
LPSPI transfer is busy.
-
enumerator kStatus_LPSPI_Error
LPSPI driver error.
-
enumerator kStatus_LPSPI_Idle
LPSPI is idle.
-
enumerator kStatus_LPSPI_OutOfRange
LPSPI transfer out Of range.
-
enumerator kStatus_LPSPI_Timeout
LPSPI timeout polling status flags.
-
enumerator kStatus_LPSPI_Busy
-
enum _lpspi_flags
LPSPI status flags in SPIx_SR register.
Values:
-
enumerator kLPSPI_TxDataRequestFlag
Transmit data flag
-
enumerator kLPSPI_RxDataReadyFlag
Receive data flag
-
enumerator kLPSPI_WordCompleteFlag
Word Complete flag
-
enumerator kLPSPI_FrameCompleteFlag
Frame Complete flag
-
enumerator kLPSPI_TransferCompleteFlag
Transfer Complete flag
-
enumerator kLPSPI_TransmitErrorFlag
Transmit Error flag (FIFO underrun)
-
enumerator kLPSPI_ReceiveErrorFlag
Receive Error flag (FIFO overrun)
-
enumerator kLPSPI_DataMatchFlag
Data Match flag
-
enumerator kLPSPI_ModuleBusyFlag
Module Busy flag
-
enumerator kLPSPI_AllStatusFlag
Used for clearing all w1c status flags
-
enumerator kLPSPI_TxDataRequestFlag
-
enum _lpspi_interrupt_enable
LPSPI interrupt source.
Values:
-
enumerator kLPSPI_TxInterruptEnable
Transmit data interrupt enable
-
enumerator kLPSPI_RxInterruptEnable
Receive data interrupt enable
-
enumerator kLPSPI_WordCompleteInterruptEnable
Word complete interrupt enable
-
enumerator kLPSPI_FrameCompleteInterruptEnable
Frame complete interrupt enable
-
enumerator kLPSPI_TransferCompleteInterruptEnable
Transfer complete interrupt enable
-
enumerator kLPSPI_TransmitErrorInterruptEnable
Transmit error interrupt enable(FIFO underrun)
-
enumerator kLPSPI_ReceiveErrorInterruptEnable
Receive Error interrupt enable (FIFO overrun)
-
enumerator kLPSPI_DataMatchInterruptEnable
Data Match interrupt enable
-
enumerator kLPSPI_AllInterruptEnable
All above interrupts enable.
-
enumerator kLPSPI_TxInterruptEnable
-
enum _lpspi_dma_enable
LPSPI DMA source.
Values:
-
enumerator kLPSPI_TxDmaEnable
Transmit data DMA enable
-
enumerator kLPSPI_RxDmaEnable
Receive data DMA enable
-
enumerator kLPSPI_TxDmaEnable
-
enum _lpspi_master_slave_mode
LPSPI master or slave mode configuration.
Values:
-
enumerator kLPSPI_Master
LPSPI peripheral operates in master mode.
-
enumerator kLPSPI_Slave
LPSPI peripheral operates in slave mode.
-
enumerator kLPSPI_Master
-
enum _lpspi_which_pcs_config
LPSPI Peripheral Chip Select (PCS) configuration (which PCS to configure).
Values:
-
enumerator kLPSPI_Pcs0
PCS[0]
-
enumerator kLPSPI_Pcs1
PCS[1]
-
enumerator kLPSPI_Pcs2
PCS[2]
-
enumerator kLPSPI_Pcs3
PCS[3]
-
enumerator kLPSPI_Pcs0
-
enum _lpspi_pcs_polarity_config
LPSPI Peripheral Chip Select (PCS) Polarity configuration.
Values:
-
enumerator kLPSPI_PcsActiveHigh
PCS Active High (idles low)
-
enumerator kLPSPI_PcsActiveLow
PCS Active Low (idles high)
-
enumerator kLPSPI_PcsActiveHigh
-
enum _lpspi_pcs_polarity
LPSPI Peripheral Chip Select (PCS) Polarity.
Values:
-
enumerator kLPSPI_Pcs0ActiveLow
Pcs0 Active Low (idles high).
-
enumerator kLPSPI_Pcs1ActiveLow
Pcs1 Active Low (idles high).
-
enumerator kLPSPI_Pcs2ActiveLow
Pcs2 Active Low (idles high).
-
enumerator kLPSPI_Pcs3ActiveLow
Pcs3 Active Low (idles high).
-
enumerator kLPSPI_PcsAllActiveLow
Pcs0 to Pcs5 Active Low (idles high).
-
enumerator kLPSPI_Pcs0ActiveLow
-
enum _lpspi_clock_polarity
LPSPI clock polarity configuration.
Values:
-
enumerator kLPSPI_ClockPolarityActiveHigh
CPOL=0. Active-high LPSPI clock (idles low)
-
enumerator kLPSPI_ClockPolarityActiveLow
CPOL=1. Active-low LPSPI clock (idles high)
-
enumerator kLPSPI_ClockPolarityActiveHigh
-
enum _lpspi_clock_phase
LPSPI clock phase configuration.
Values:
-
enumerator kLPSPI_ClockPhaseFirstEdge
CPHA=0. Data is captured on the leading edge of the SCK and changed on the following edge.
-
enumerator kLPSPI_ClockPhaseSecondEdge
CPHA=1. Data is changed on the leading edge of the SCK and captured on the following edge.
-
enumerator kLPSPI_ClockPhaseFirstEdge
-
enum _lpspi_shift_direction
LPSPI data shifter direction options.
Values:
-
enumerator kLPSPI_MsbFirst
Data transfers start with most significant bit.
-
enumerator kLPSPI_LsbFirst
Data transfers start with least significant bit.
-
enumerator kLPSPI_MsbFirst
-
enum _lpspi_host_request_select
LPSPI Host Request select configuration.
Values:
-
enumerator kLPSPI_HostReqExtPin
Host Request is an ext pin.
-
enumerator kLPSPI_HostReqInternalTrigger
Host Request is an internal trigger.
-
enumerator kLPSPI_HostReqExtPin
-
enum _lpspi_match_config
LPSPI Match configuration options.
Values:
-
enumerator kLPSI_MatchDisabled
LPSPI Match Disabled.
-
enumerator kLPSI_1stWordEqualsM0orM1
LPSPI Match Enabled.
-
enumerator kLPSI_AnyWordEqualsM0orM1
LPSPI Match Enabled.
-
enumerator kLPSI_1stWordEqualsM0and2ndWordEqualsM1
LPSPI Match Enabled.
-
enumerator kLPSI_AnyWordEqualsM0andNxtWordEqualsM1
LPSPI Match Enabled.
-
enumerator kLPSI_1stWordAndM1EqualsM0andM1
LPSPI Match Enabled.
-
enumerator kLPSI_AnyWordAndM1EqualsM0andM1
LPSPI Match Enabled.
-
enumerator kLPSI_MatchDisabled
-
enum _lpspi_pin_config
LPSPI pin (SDO and SDI) configuration.
Values:
-
enumerator kLPSPI_SdiInSdoOut
LPSPI SDI input, SDO output.
-
enumerator kLPSPI_SdiInSdiOut
LPSPI SDI input, SDI output.
-
enumerator kLPSPI_SdoInSdoOut
LPSPI SDO input, SDO output.
-
enumerator kLPSPI_SdoInSdiOut
LPSPI SDO input, SDI output.
-
enumerator kLPSPI_SdiInSdoOut
-
enum _lpspi_data_out_config
LPSPI data output configuration.
Values:
-
enumerator kLpspiDataOutRetained
Data out retains last value when chip select is de-asserted
-
enumerator kLpspiDataOutTristate
Data out is tristated when chip select is de-asserted
-
enumerator kLpspiDataOutRetained
-
enum _lpspi_transfer_width
LPSPI transfer width configuration.
Values:
-
enumerator kLPSPI_SingleBitXfer
1-bit shift at a time, data out on SDO, in on SDI (normal mode)
-
enumerator kLPSPI_TwoBitXfer
2-bits shift out on SDO/SDI and in on SDO/SDI
-
enumerator kLPSPI_FourBitXfer
4-bits shift out on SDO/SDI/PCS[3:2] and in on SDO/SDI/PCS[3:2]
-
enumerator kLPSPI_SingleBitXfer
-
enum _lpspi_delay_type
LPSPI delay type selection.
Values:
-
enumerator kLPSPI_PcsToSck
PCS-to-SCK delay.
-
enumerator kLPSPI_LastSckToPcs
Last SCK edge to PCS delay.
-
enumerator kLPSPI_BetweenTransfer
Delay between transfers.
-
enumerator kLPSPI_PcsToSck
-
enum _lpspi_transfer_config_flag_for_master
Use this enumeration for LPSPI master transfer configFlags.
Values:
-
enumerator kLPSPI_MasterPcs0
LPSPI master PCS shift macro , internal used. LPSPI master transfer use PCS0 signal
-
enumerator kLPSPI_MasterPcs1
LPSPI master PCS shift macro , internal used. LPSPI master transfer use PCS1 signal
-
enumerator kLPSPI_MasterPcs2
LPSPI master PCS shift macro , internal used. LPSPI master transfer use PCS2 signal
-
enumerator kLPSPI_MasterPcs3
LPSPI master PCS shift macro , internal used. LPSPI master transfer use PCS3 signal
-
enumerator kLPSPI_MasterPcsContinuous
Is PCS signal continuous
-
enumerator kLPSPI_MasterByteSwap
Is master swap the byte. For example, when want to send data 1 2 3 4 5 6 7 8 (suppose you set lpspi_shift_direction_t to MSB).
If you set bitPerFrame = 8 , no matter the kLPSPI_MasterByteSwapyou flag is used or not, the waveform is 1 2 3 4 5 6 7 8.
If you set bitPerFrame = 16 : (1) the waveform is 2 1 4 3 6 5 8 7 if you do not use the kLPSPI_MasterByteSwap flag. (2) the waveform is 1 2 3 4 5 6 7 8 if you use the kLPSPI_MasterByteSwap flag.
If you set bitPerFrame = 32 : (1) the waveform is 4 3 2 1 8 7 6 5 if you do not use the kLPSPI_MasterByteSwap flag. (2) the waveform is 1 2 3 4 5 6 7 8 if you use the kLPSPI_MasterByteSwap flag.
-
enumerator kLPSPI_MasterPcs0
-
enum _lpspi_transfer_config_flag_for_slave
Use this enumeration for LPSPI slave transfer configFlags.
Values:
-
enumerator kLPSPI_SlavePcs0
LPSPI slave PCS shift macro , internal used. LPSPI slave transfer use PCS0 signal
-
enumerator kLPSPI_SlavePcs1
LPSPI slave PCS shift macro , internal used. LPSPI slave transfer use PCS1 signal
-
enumerator kLPSPI_SlavePcs2
LPSPI slave PCS shift macro , internal used. LPSPI slave transfer use PCS2 signal
-
enumerator kLPSPI_SlavePcs3
LPSPI slave PCS shift macro , internal used. LPSPI slave transfer use PCS3 signal
-
enumerator kLPSPI_SlaveByteSwap
Is slave swap the byte. For example, when want to send data 1 2 3 4 5 6 7 8 (suppose you set lpspi_shift_direction_t to MSB).
If you set bitPerFrame = 8 , no matter the kLPSPI_SlaveByteSwap flag is used or not, the waveform is 1 2 3 4 5 6 7 8.
If you set bitPerFrame = 16 : (1) the waveform is 2 1 4 3 6 5 8 7 if you do not use the kLPSPI_SlaveByteSwap flag. (2) the waveform is 1 2 3 4 5 6 7 8 if you use the kLPSPI_SlaveByteSwap flag.
If you set bitPerFrame = 32 : (1) the waveform is 4 3 2 1 8 7 6 5 if you do not use the kLPSPI_SlaveByteSwap flag. (2) the waveform is 1 2 3 4 5 6 7 8 if you use the kLPSPI_SlaveByteSwap flag.
-
enumerator kLPSPI_SlavePcs0
-
enum _lpspi_transfer_state
LPSPI transfer state, which is used for LPSPI transactional API state machine.
Values:
-
enumerator kLPSPI_Idle
Nothing in the transmitter/receiver.
-
enumerator kLPSPI_Busy
Transfer queue is not finished.
-
enumerator kLPSPI_Error
Transfer error.
-
enumerator kLPSPI_Idle
-
typedef enum _lpspi_master_slave_mode lpspi_master_slave_mode_t
LPSPI master or slave mode configuration.
-
typedef enum _lpspi_which_pcs_config lpspi_which_pcs_t
LPSPI Peripheral Chip Select (PCS) configuration (which PCS to configure).
-
typedef enum _lpspi_pcs_polarity_config lpspi_pcs_polarity_config_t
LPSPI Peripheral Chip Select (PCS) Polarity configuration.
-
typedef enum _lpspi_clock_polarity lpspi_clock_polarity_t
LPSPI clock polarity configuration.
-
typedef enum _lpspi_clock_phase lpspi_clock_phase_t
LPSPI clock phase configuration.
-
typedef enum _lpspi_shift_direction lpspi_shift_direction_t
LPSPI data shifter direction options.
-
typedef enum _lpspi_host_request_select lpspi_host_request_select_t
LPSPI Host Request select configuration.
-
typedef enum _lpspi_match_config lpspi_match_config_t
LPSPI Match configuration options.
-
typedef enum _lpspi_pin_config lpspi_pin_config_t
LPSPI pin (SDO and SDI) configuration.
-
typedef enum _lpspi_data_out_config lpspi_data_out_config_t
LPSPI data output configuration.
-
typedef enum _lpspi_transfer_width lpspi_transfer_width_t
LPSPI transfer width configuration.
-
typedef enum _lpspi_delay_type lpspi_delay_type_t
LPSPI delay type selection.
-
typedef struct _lpspi_master_config lpspi_master_config_t
LPSPI master configuration structure.
-
typedef struct _lpspi_slave_config lpspi_slave_config_t
LPSPI slave configuration structure.
-
typedef struct _lpspi_master_handle lpspi_master_handle_t
Forward declaration of the _lpspi_master_handle typedefs.
-
typedef struct _lpspi_slave_handle lpspi_slave_handle_t
Forward declaration of the _lpspi_slave_handle typedefs.
-
typedef void (*lpspi_master_transfer_callback_t)(LPSPI_Type *base, lpspi_master_handle_t *handle, status_t status, void *userData)
Master completion callback function pointer type.
- Param base:
LPSPI peripheral address.
- Param handle:
Pointer to the handle for the LPSPI master.
- Param status:
Success or error code describing whether the transfer is completed.
- Param userData:
Arbitrary pointer-dataSized value passed from the application.
-
typedef void (*lpspi_slave_transfer_callback_t)(LPSPI_Type *base, lpspi_slave_handle_t *handle, status_t status, void *userData)
Slave completion callback function pointer type.
- Param base:
LPSPI peripheral address.
- Param handle:
Pointer to the handle for the LPSPI slave.
- Param status:
Success or error code describing whether the transfer is completed.
- Param userData:
Arbitrary pointer-dataSized value passed from the application.
-
typedef struct _lpspi_transfer lpspi_transfer_t
LPSPI master/slave transfer structure.
-
volatile uint8_t g_lpspiDummyData[]
Global variable for dummy data value setting.
-
LPSPI_DUMMY_DATA
LPSPI dummy data if no Tx data.
Dummy data used for tx if there is not txData.
-
SPI_RETRY_TIMES
Retry times for waiting flag.
-
LPSPI_MASTER_PCS_SHIFT
LPSPI master PCS shift macro , internal used.
-
LPSPI_MASTER_PCS_MASK
LPSPI master PCS shift macro , internal used.
-
LPSPI_SLAVE_PCS_SHIFT
LPSPI slave PCS shift macro , internal used.
-
LPSPI_SLAVE_PCS_MASK
LPSPI slave PCS shift macro , internal used.
-
struct _lpspi_master_config
- #include <fsl_lpspi.h>
LPSPI master configuration structure.
Public Members
-
uint32_t baudRate
Baud Rate for LPSPI.
-
uint32_t bitsPerFrame
Bits per frame, minimum 8, maximum 4096.
-
lpspi_clock_polarity_t cpol
Clock polarity.
-
lpspi_clock_phase_t cpha
Clock phase.
-
lpspi_shift_direction_t direction
MSB or LSB data shift direction.
-
uint32_t pcsToSckDelayInNanoSec
PCS to SCK delay time in nanoseconds, setting to 0 sets the minimum delay. It sets the boundary value if out of range.
-
uint32_t lastSckToPcsDelayInNanoSec
Last SCK to PCS delay time in nanoseconds, setting to 0 sets the minimum delay. It sets the boundary value if out of range.
-
uint32_t betweenTransferDelayInNanoSec
After the SCK delay time with nanoseconds, setting to 0 sets the minimum delay. It sets the boundary value if out of range.
-
lpspi_which_pcs_t whichPcs
Desired Peripheral Chip Select (PCS).
-
lpspi_pcs_polarity_config_t pcsActiveHighOrLow
Desired PCS active high or low
-
lpspi_pin_config_t pinCfg
Configures which pins are used for input and output data during single bit transfers.
-
lpspi_data_out_config_t dataOutConfig
Configures if the output data is tristated between accesses (LPSPI_PCS is negated).
-
bool enableInputDelay
Enable master to sample the input data on a delayed SCK. This can help improve slave setup time. Refer to device data sheet for specific time length.
-
uint32_t baudRate
-
struct _lpspi_slave_config
- #include <fsl_lpspi.h>
LPSPI slave configuration structure.
Public Members
-
uint32_t bitsPerFrame
Bits per frame, minimum 8, maximum 4096.
-
lpspi_clock_polarity_t cpol
Clock polarity.
-
lpspi_clock_phase_t cpha
Clock phase.
-
lpspi_shift_direction_t direction
MSB or LSB data shift direction.
-
lpspi_which_pcs_t whichPcs
Desired Peripheral Chip Select (pcs)
-
lpspi_pcs_polarity_config_t pcsActiveHighOrLow
Desired PCS active high or low
-
lpspi_pin_config_t pinCfg
Configures which pins are used for input and output data during single bit transfers.
-
lpspi_data_out_config_t dataOutConfig
Configures if the output data is tristated between accesses (LPSPI_PCS is negated).
-
uint32_t bitsPerFrame
-
struct _lpspi_transfer
- #include <fsl_lpspi.h>
LPSPI master/slave transfer structure.
Public Members
-
const uint8_t *txData
Send buffer.
-
uint8_t *rxData
Receive buffer.
-
volatile size_t dataSize
Transfer bytes.
-
uint32_t configFlags
Transfer transfer configuration flags. Set from _lpspi_transfer_config_flag_for_master if the transfer is used for master or _lpspi_transfer_config_flag_for_slave enumeration if the transfer is used for slave.
-
const uint8_t *txData
-
struct _lpspi_master_handle
- #include <fsl_lpspi.h>
LPSPI master transfer handle structure used for transactional API.
Public Members
-
volatile bool isPcsContinuous
Is PCS continuous in transfer.
-
volatile bool writeTcrInIsr
A flag that whether should write TCR in ISR.
-
volatile bool isByteSwap
A flag that whether should byte swap.
-
volatile bool isTxMask
A flag that whether TCR[TXMSK] is set.
-
volatile uint16_t bytesPerFrame
Number of bytes in each frame
-
volatile uint8_t fifoSize
FIFO dataSize.
-
volatile uint8_t rxWatermark
Rx watermark.
-
volatile uint8_t bytesEachWrite
Bytes for each write TDR.
-
volatile uint8_t bytesEachRead
Bytes for each read RDR.
-
const uint8_t *volatile txData
Send buffer.
-
uint8_t *volatile rxData
Receive buffer.
-
volatile size_t txRemainingByteCount
Number of bytes remaining to send.
-
volatile size_t rxRemainingByteCount
Number of bytes remaining to receive.
-
volatile uint32_t writeRegRemainingTimes
Write TDR register remaining times.
-
volatile uint32_t readRegRemainingTimes
Read RDR register remaining times.
-
uint32_t totalByteCount
Number of transfer bytes
-
uint32_t txBuffIfNull
Used if the txData is NULL.
-
volatile uint8_t state
LPSPI transfer state , _lpspi_transfer_state.
-
lpspi_master_transfer_callback_t callback
Completion callback.
-
void *userData
Callback user data.
-
volatile bool isPcsContinuous
-
struct _lpspi_slave_handle
- #include <fsl_lpspi.h>
LPSPI slave transfer handle structure used for transactional API.
Public Members
-
volatile bool isByteSwap
A flag that whether should byte swap.
-
volatile uint8_t fifoSize
FIFO dataSize.
-
volatile uint8_t rxWatermark
Rx watermark.
-
volatile uint8_t bytesEachWrite
Bytes for each write TDR.
-
volatile uint8_t bytesEachRead
Bytes for each read RDR.
-
const uint8_t *volatile txData
Send buffer.
-
uint8_t *volatile rxData
Receive buffer.
-
volatile size_t txRemainingByteCount
Number of bytes remaining to send.
-
volatile size_t rxRemainingByteCount
Number of bytes remaining to receive.
-
volatile uint32_t writeRegRemainingTimes
Write TDR register remaining times.
-
volatile uint32_t readRegRemainingTimes
Read RDR register remaining times.
-
uint32_t totalByteCount
Number of transfer bytes
-
volatile uint8_t state
LPSPI transfer state , _lpspi_transfer_state.
-
volatile uint32_t errorCount
Error count for slave transfer.
-
lpspi_slave_transfer_callback_t callback
Completion callback.
-
void *userData
Callback user data.
-
volatile bool isByteSwap
LPSPI eDMA Driver
-
FSL_LPSPI_EDMA_DRIVER_VERSION
LPSPI EDMA driver version.
-
DMA_MAX_TRANSFER_COUNT
DMA max transfer size.
-
typedef struct _lpspi_master_edma_handle lpspi_master_edma_handle_t
Forward declaration of the _lpspi_master_edma_handle typedefs.
-
typedef struct _lpspi_slave_edma_handle lpspi_slave_edma_handle_t
Forward declaration of the _lpspi_slave_edma_handle typedefs.
-
typedef void (*lpspi_master_edma_transfer_callback_t)(LPSPI_Type *base, lpspi_master_edma_handle_t *handle, status_t status, void *userData)
Completion callback function pointer type.
- Param base:
LPSPI peripheral base address.
- Param handle:
Pointer to the handle for the LPSPI master.
- Param status:
Success or error code describing whether the transfer completed.
- Param userData:
Arbitrary pointer-dataSized value passed from the application.
-
typedef void (*lpspi_slave_edma_transfer_callback_t)(LPSPI_Type *base, lpspi_slave_edma_handle_t *handle, status_t status, void *userData)
Completion callback function pointer type.
- Param base:
LPSPI peripheral base address.
- Param handle:
Pointer to the handle for the LPSPI slave.
- Param status:
Success or error code describing whether the transfer completed.
- Param userData:
Arbitrary pointer-dataSized value passed from the application.
-
void LPSPI_MasterTransferCreateHandleEDMA(LPSPI_Type *base, lpspi_master_edma_handle_t *handle, lpspi_master_edma_transfer_callback_t callback, void *userData, edma_handle_t *edmaRxRegToRxDataHandle, edma_handle_t *edmaTxDataToTxRegHandle)
Initializes the LPSPI master eDMA handle.
This function initializes the LPSPI eDMA handle which can be used for other LPSPI transactional APIs. Usually, for a specified LPSPI instance, call this API once to get the initialized handle.
Note that the LPSPI eDMA has a separated (Rx and Tx as two sources) or shared (Rx and Tx are the same source) DMA request source. (1) For a separated DMA request source, enable and set the Rx DMAMUX source for edmaRxRegToRxDataHandle and Tx DMAMUX source for edmaTxDataToTxRegHandle. (2) For a shared DMA request source, enable and set the Rx/Tx DMAMUX source for edmaRxRegToRxDataHandle.
- Parameters:
base – LPSPI peripheral base address.
handle – LPSPI handle pointer to lpspi_master_edma_handle_t.
callback – LPSPI callback.
userData – callback function parameter.
edmaRxRegToRxDataHandle – edmaRxRegToRxDataHandle pointer to edma_handle_t.
edmaTxDataToTxRegHandle – edmaTxDataToTxRegHandle pointer to edma_handle_t.
-
status_t LPSPI_MasterTransferEDMA(LPSPI_Type *base, lpspi_master_edma_handle_t *handle, lpspi_transfer_t *transfer)
LPSPI master transfer data using eDMA.
This function transfers data using eDMA. This is a non-blocking function, which returns right away. When all data is transferred, the callback function is called.
Note: The transfer data size should be an integer multiple of bytesPerFrame if bytesPerFrame is less than or equal to 4. For bytesPerFrame greater than 4: The transfer data size should be equal to bytesPerFrame if the bytesPerFrame is not an integer multiple of 4. Otherwise, the transfer data size can be an integer multiple of bytesPerFrame.
- Parameters:
base – LPSPI peripheral base address.
handle – pointer to lpspi_master_edma_handle_t structure which stores the transfer state.
transfer – pointer to lpspi_transfer_t structure.
- Returns:
status of status_t.
-
status_t LPSPI_MasterTransferPrepareEDMALite(LPSPI_Type *base, lpspi_master_edma_handle_t *handle, uint32_t configFlags)
LPSPI master config transfer parameter while using eDMA.
This function is preparing to transfer data using eDMA, work with LPSPI_MasterTransferEDMALite.
- Parameters:
base – LPSPI peripheral base address.
handle – pointer to lpspi_master_edma_handle_t structure which stores the transfer state.
configFlags – transfer configuration flags. _lpspi_transfer_config_flag_for_master.
- Return values:
kStatus_Success – Execution successfully.
kStatus_LPSPI_Busy – The LPSPI device is busy.
- Returns:
Indicates whether LPSPI master transfer was successful or not.
-
status_t LPSPI_MasterTransferEDMALite(LPSPI_Type *base, lpspi_master_edma_handle_t *handle, lpspi_transfer_t *transfer)
LPSPI master transfer data using eDMA without configs.
This function transfers data using eDMA. This is a non-blocking function, which returns right away. When all data is transferred, the callback function is called.
Note: This API is only for transfer through DMA without configuration. Before calling this API, you must call LPSPI_MasterTransferPrepareEDMALite to configure it once. The transfer data size should be an integer multiple of bytesPerFrame if bytesPerFrame is less than or equal to 4. For bytesPerFrame greater than 4: The transfer data size should be equal to bytesPerFrame if the bytesPerFrame is not an integer multiple of 4. Otherwise, the transfer data size can be an integer multiple of bytesPerFrame.
- Parameters:
base – LPSPI peripheral base address.
handle – pointer to lpspi_master_edma_handle_t structure which stores the transfer state.
transfer – pointer to lpspi_transfer_t structure, config field is not uesed.
- Return values:
kStatus_Success – Execution successfully.
kStatus_LPSPI_Busy – The LPSPI device is busy.
kStatus_InvalidArgument – The transfer structure is invalid.
- Returns:
Indicates whether LPSPI master transfer was successful or not.
-
void LPSPI_MasterTransferAbortEDMA(LPSPI_Type *base, lpspi_master_edma_handle_t *handle)
LPSPI master aborts a transfer which is using eDMA.
This function aborts a transfer which is using eDMA.
- Parameters:
base – LPSPI peripheral base address.
handle – pointer to lpspi_master_edma_handle_t structure which stores the transfer state.
-
status_t LPSPI_MasterTransferGetCountEDMA(LPSPI_Type *base, lpspi_master_edma_handle_t *handle, size_t *count)
Gets the master eDMA transfer remaining bytes.
This function gets the master eDMA transfer remaining bytes.
- Parameters:
base – LPSPI peripheral base address.
handle – pointer to lpspi_master_edma_handle_t structure which stores the transfer state.
count – Number of bytes transferred so far by the EDMA transaction.
- Returns:
status of status_t.
-
void LPSPI_SlaveTransferCreateHandleEDMA(LPSPI_Type *base, lpspi_slave_edma_handle_t *handle, lpspi_slave_edma_transfer_callback_t callback, void *userData, edma_handle_t *edmaRxRegToRxDataHandle, edma_handle_t *edmaTxDataToTxRegHandle)
Initializes the LPSPI slave eDMA handle.
This function initializes the LPSPI eDMA handle which can be used for other LPSPI transactional APIs. Usually, for a specified LPSPI instance, call this API once to get the initialized handle.
Note that LPSPI eDMA has a separated (Rx and Tx as two sources) or shared (Rx and Tx as the same source) DMA request source.
(1) For a separated DMA request source, enable and set the Rx DMAMUX source for edmaRxRegToRxDataHandle and Tx DMAMUX source for edmaTxDataToTxRegHandle. (2) For a shared DMA request source, enable and set the Rx/Rx DMAMUX source for edmaRxRegToRxDataHandle .
- Parameters:
base – LPSPI peripheral base address.
handle – LPSPI handle pointer to lpspi_slave_edma_handle_t.
callback – LPSPI callback.
userData – callback function parameter.
edmaRxRegToRxDataHandle – edmaRxRegToRxDataHandle pointer to edma_handle_t.
edmaTxDataToTxRegHandle – edmaTxDataToTxRegHandle pointer to edma_handle_t.
-
status_t LPSPI_SlaveTransferEDMA(LPSPI_Type *base, lpspi_slave_edma_handle_t *handle, lpspi_transfer_t *transfer)
LPSPI slave transfers data using eDMA.
This function transfers data using eDMA. This is a non-blocking function, which return right away. When all data is transferred, the callback function is called.
Note: The transfer data size should be an integer multiple of bytesPerFrame if bytesPerFrame is less than or equal to 4. For bytesPerFrame greater than 4: The transfer data size should be equal to bytesPerFrame if the bytesPerFrame is not an integer multiple of 4. Otherwise, the transfer data size can be an integer multiple of bytesPerFrame.
- Parameters:
base – LPSPI peripheral base address.
handle – pointer to lpspi_slave_edma_handle_t structure which stores the transfer state.
transfer – pointer to lpspi_transfer_t structure.
- Returns:
status of status_t.
-
void LPSPI_SlaveTransferAbortEDMA(LPSPI_Type *base, lpspi_slave_edma_handle_t *handle)
LPSPI slave aborts a transfer which is using eDMA.
This function aborts a transfer which is using eDMA.
- Parameters:
base – LPSPI peripheral base address.
handle – pointer to lpspi_slave_edma_handle_t structure which stores the transfer state.
-
status_t LPSPI_SlaveTransferGetCountEDMA(LPSPI_Type *base, lpspi_slave_edma_handle_t *handle, size_t *count)
Gets the slave eDMA transfer remaining bytes.
This function gets the slave eDMA transfer remaining bytes.
- Parameters:
base – LPSPI peripheral base address.
handle – pointer to lpspi_slave_edma_handle_t structure which stores the transfer state.
count – Number of bytes transferred so far by the eDMA transaction.
- Returns:
status of status_t.
-
struct _lpspi_master_edma_handle
- #include <fsl_lpspi_edma.h>
LPSPI master eDMA transfer handle structure used for transactional API.
Public Members
-
volatile bool isPcsContinuous
Is PCS continuous in transfer.
-
volatile bool isByteSwap
A flag that whether should byte swap.
-
volatile uint8_t fifoSize
FIFO dataSize.
-
volatile uint8_t rxWatermark
Rx watermark.
-
volatile uint8_t bytesEachWrite
Bytes for each write TDR.
-
volatile uint8_t bytesEachRead
Bytes for each read RDR.
-
volatile uint8_t bytesLastRead
Bytes for last read RDR.
-
volatile bool isThereExtraRxBytes
Is there extra RX byte.
-
const uint8_t *volatile txData
Send buffer.
-
uint8_t *volatile rxData
Receive buffer.
-
volatile size_t txRemainingByteCount
Number of bytes remaining to send.
-
volatile size_t rxRemainingByteCount
Number of bytes remaining to receive.
-
volatile uint32_t writeRegRemainingTimes
Write TDR register remaining times.
-
volatile uint32_t readRegRemainingTimes
Read RDR register remaining times.
-
uint32_t totalByteCount
Number of transfer bytes
-
edma_tcd_t *lastTimeTCD
Pointer to the lastTime TCD
-
bool isMultiDMATransmit
Is there multi DMA transmit
-
volatile uint8_t dmaTransmitTime
DMA Transfer times.
-
uint32_t lastTimeDataBytes
DMA transmit last Time data Bytes
-
uint32_t dataBytesEveryTime
Bytes in a time for DMA transfer, default is DMA_MAX_TRANSFER_COUNT
-
edma_transfer_config_t transferConfigRx
Config of DMA rx channel.
-
edma_transfer_config_t transferConfigTx
Config of DMA tx channel.
-
uint32_t txBuffIfNull
Used if there is not txData for DMA purpose.
-
uint32_t rxBuffIfNull
Used if there is not rxData for DMA purpose.
-
uint32_t transmitCommand
Used to write TCR for DMA purpose.
-
volatile uint8_t state
LPSPI transfer state , _lpspi_transfer_state.
-
uint8_t nbytes
eDMA minor byte transfer count initially configured.
-
lpspi_master_edma_transfer_callback_t callback
Completion callback.
-
void *userData
Callback user data.
-
edma_handle_t *edmaRxRegToRxDataHandle
edma_handle_t handle point used for RxReg to RxData buff
-
edma_handle_t *edmaTxDataToTxRegHandle
edma_handle_t handle point used for TxData to TxReg buff
-
edma_tcd_t lpspiSoftwareTCD[3]
SoftwareTCD, internal used
-
volatile bool isPcsContinuous
-
struct _lpspi_slave_edma_handle
- #include <fsl_lpspi_edma.h>
LPSPI slave eDMA transfer handle structure used for transactional API.
Public Members
-
volatile bool isByteSwap
A flag that whether should byte swap.
-
volatile uint8_t fifoSize
FIFO dataSize.
-
volatile uint8_t rxWatermark
Rx watermark.
-
volatile uint8_t bytesEachWrite
Bytes for each write TDR.
-
volatile uint8_t bytesEachRead
Bytes for each read RDR.
-
volatile uint8_t bytesLastRead
Bytes for last read RDR.
-
volatile bool isThereExtraRxBytes
Is there extra RX byte.
-
uint8_t nbytes
eDMA minor byte transfer count initially configured.
-
const uint8_t *volatile txData
Send buffer.
-
uint8_t *volatile rxData
Receive buffer.
-
volatile size_t txRemainingByteCount
Number of bytes remaining to send.
-
volatile size_t rxRemainingByteCount
Number of bytes remaining to receive.
-
volatile uint32_t writeRegRemainingTimes
Write TDR register remaining times.
-
volatile uint32_t readRegRemainingTimes
Read RDR register remaining times.
-
uint32_t totalByteCount
Number of transfer bytes
-
uint32_t txBuffIfNull
Used if there is not txData for DMA purpose.
-
uint32_t rxBuffIfNull
Used if there is not rxData for DMA purpose.
-
volatile uint8_t state
LPSPI transfer state.
-
uint32_t errorCount
Error count for slave transfer.
-
lpspi_slave_edma_transfer_callback_t callback
Completion callback.
-
void *userData
Callback user data.
-
edma_handle_t *edmaRxRegToRxDataHandle
edma_handle_t handle point used for RxReg to RxData buff
-
edma_handle_t *edmaTxDataToTxRegHandle
edma_handle_t handle point used for TxData to TxReg
-
edma_tcd_t lpspiSoftwareTCD[2]
SoftwareTCD, internal used
-
volatile bool isByteSwap
LPTMR: Low-Power Timer
-
void LPTMR_Init(LPTMR_Type *base, const lptmr_config_t *config)
Ungates the LPTMR clock and configures the peripheral for a basic operation.
Note
This API should be called at the beginning of the application using the LPTMR driver.
- Parameters:
base – LPTMR peripheral base address
config – A pointer to the LPTMR configuration structure.
-
void LPTMR_Deinit(LPTMR_Type *base)
Gates the LPTMR clock.
- Parameters:
base – LPTMR peripheral base address
-
void LPTMR_GetDefaultConfig(lptmr_config_t *config)
Fills in the LPTMR configuration structure with default settings.
The default values are as follows.
config->timerMode = kLPTMR_TimerModeTimeCounter; config->pinSelect = kLPTMR_PinSelectInput_0; config->pinPolarity = kLPTMR_PinPolarityActiveHigh; config->enableFreeRunning = false; config->bypassPrescaler = true; config->prescalerClockSource = kLPTMR_PrescalerClock_1; config->value = kLPTMR_Prescale_Glitch_0;
- Parameters:
config – A pointer to the LPTMR configuration structure.
-
static inline void LPTMR_EnableInterrupts(LPTMR_Type *base, uint32_t mask)
Enables the selected LPTMR interrupts.
- Parameters:
base – LPTMR peripheral base address
mask – The interrupts to enable. This is a logical OR of members of the enumeration lptmr_interrupt_enable_t
-
static inline void LPTMR_DisableInterrupts(LPTMR_Type *base, uint32_t mask)
Disables the selected LPTMR interrupts.
- Parameters:
base – LPTMR peripheral base address
mask – The interrupts to disable. This is a logical OR of members of the enumeration lptmr_interrupt_enable_t.
-
static inline uint32_t LPTMR_GetEnabledInterrupts(LPTMR_Type *base)
Gets the enabled LPTMR interrupts.
- Parameters:
base – LPTMR peripheral base address
- Returns:
The enabled interrupts. This is the logical OR of members of the enumeration lptmr_interrupt_enable_t
-
static inline uint32_t LPTMR_GetStatusFlags(LPTMR_Type *base)
Gets the LPTMR status flags.
- Parameters:
base – LPTMR peripheral base address
- Returns:
The status flags. This is the logical OR of members of the enumeration lptmr_status_flags_t
-
static inline void LPTMR_ClearStatusFlags(LPTMR_Type *base, uint32_t mask)
Clears the LPTMR status flags.
- Parameters:
base – LPTMR peripheral base address
mask – The status flags to clear. This is a logical OR of members of the enumeration lptmr_status_flags_t.
-
static inline void LPTMR_SetTimerPeriod(LPTMR_Type *base, uint32_t ticks)
Sets the timer period in units of count.
Timers counts from 0 until it equals the count value set here. The count value is written to the CMR register.
Note
The TCF flag is set with the CNR equals the count provided here and then increments.
Call the utility macros provided in the fsl_common.h to convert to ticks.
- Parameters:
base – LPTMR peripheral base address
ticks – A timer period in units of ticks, which should be equal or greater than 1.
-
static inline uint32_t LPTMR_GetCurrentTimerCount(LPTMR_Type *base)
Reads the current timer counting value.
This function returns the real-time timer counting value in a range from 0 to a timer period.
Note
Call the utility macros provided in the fsl_common.h to convert ticks to usec or msec.
- Parameters:
base – LPTMR peripheral base address
- Returns:
The current counter value in ticks
-
static inline void LPTMR_StartTimer(LPTMR_Type *base)
Starts the timer.
After calling this function, the timer counts up to the CMR register value. Each time the timer reaches the CMR value and then increments, it generates a trigger pulse and sets the timeout interrupt flag. An interrupt is also triggered if the timer interrupt is enabled.
- Parameters:
base – LPTMR peripheral base address
-
static inline void LPTMR_StopTimer(LPTMR_Type *base)
Stops the timer.
This function stops the timer and resets the timer’s counter register.
- Parameters:
base – LPTMR peripheral base address
-
FSL_LPTMR_DRIVER_VERSION
Driver Version
-
enum _lptmr_pin_select
LPTMR pin selection used in pulse counter mode.
Values:
-
enumerator kLPTMR_PinSelectInput_0
Pulse counter input 0 is selected
-
enumerator kLPTMR_PinSelectInput_1
Pulse counter input 1 is selected
-
enumerator kLPTMR_PinSelectInput_2
Pulse counter input 2 is selected
-
enumerator kLPTMR_PinSelectInput_3
Pulse counter input 3 is selected
-
enumerator kLPTMR_PinSelectInput_0
-
enum _lptmr_pin_polarity
LPTMR pin polarity used in pulse counter mode.
Values:
-
enumerator kLPTMR_PinPolarityActiveHigh
Pulse Counter input source is active-high
-
enumerator kLPTMR_PinPolarityActiveLow
Pulse Counter input source is active-low
-
enumerator kLPTMR_PinPolarityActiveHigh
-
enum _lptmr_timer_mode
LPTMR timer mode selection.
Values:
-
enumerator kLPTMR_TimerModeTimeCounter
Time Counter mode
-
enumerator kLPTMR_TimerModePulseCounter
Pulse Counter mode
-
enumerator kLPTMR_TimerModeTimeCounter
-
enum _lptmr_prescaler_glitch_value
LPTMR prescaler/glitch filter values.
Values:
-
enumerator kLPTMR_Prescale_Glitch_0
Prescaler divide 2, glitch filter does not support this setting
-
enumerator kLPTMR_Prescale_Glitch_1
Prescaler divide 4, glitch filter 2
-
enumerator kLPTMR_Prescale_Glitch_2
Prescaler divide 8, glitch filter 4
-
enumerator kLPTMR_Prescale_Glitch_3
Prescaler divide 16, glitch filter 8
-
enumerator kLPTMR_Prescale_Glitch_4
Prescaler divide 32, glitch filter 16
-
enumerator kLPTMR_Prescale_Glitch_5
Prescaler divide 64, glitch filter 32
-
enumerator kLPTMR_Prescale_Glitch_6
Prescaler divide 128, glitch filter 64
-
enumerator kLPTMR_Prescale_Glitch_7
Prescaler divide 256, glitch filter 128
-
enumerator kLPTMR_Prescale_Glitch_8
Prescaler divide 512, glitch filter 256
-
enumerator kLPTMR_Prescale_Glitch_9
Prescaler divide 1024, glitch filter 512
-
enumerator kLPTMR_Prescale_Glitch_10
Prescaler divide 2048 glitch filter 1024
-
enumerator kLPTMR_Prescale_Glitch_11
Prescaler divide 4096, glitch filter 2048
-
enumerator kLPTMR_Prescale_Glitch_12
Prescaler divide 8192, glitch filter 4096
-
enumerator kLPTMR_Prescale_Glitch_13
Prescaler divide 16384, glitch filter 8192
-
enumerator kLPTMR_Prescale_Glitch_14
Prescaler divide 32768, glitch filter 16384
-
enumerator kLPTMR_Prescale_Glitch_15
Prescaler divide 65536, glitch filter 32768
-
enumerator kLPTMR_Prescale_Glitch_0
-
enum _lptmr_prescaler_clock_select
LPTMR prescaler/glitch filter clock select.
Note
Clock connections are SoC-specific
Values:
-
enum _lptmr_interrupt_enable
List of the LPTMR interrupts.
Values:
-
enumerator kLPTMR_TimerInterruptEnable
Timer interrupt enable
-
enumerator kLPTMR_TimerInterruptEnable
-
enum _lptmr_status_flags
List of the LPTMR status flags.
Values:
-
enumerator kLPTMR_TimerCompareFlag
Timer compare flag
-
enumerator kLPTMR_TimerCompareFlag
-
typedef enum _lptmr_pin_select lptmr_pin_select_t
LPTMR pin selection used in pulse counter mode.
-
typedef enum _lptmr_pin_polarity lptmr_pin_polarity_t
LPTMR pin polarity used in pulse counter mode.
-
typedef enum _lptmr_timer_mode lptmr_timer_mode_t
LPTMR timer mode selection.
-
typedef enum _lptmr_prescaler_glitch_value lptmr_prescaler_glitch_value_t
LPTMR prescaler/glitch filter values.
-
typedef enum _lptmr_prescaler_clock_select lptmr_prescaler_clock_select_t
LPTMR prescaler/glitch filter clock select.
Note
Clock connections are SoC-specific
-
typedef enum _lptmr_interrupt_enable lptmr_interrupt_enable_t
List of the LPTMR interrupts.
-
typedef enum _lptmr_status_flags lptmr_status_flags_t
List of the LPTMR status flags.
-
typedef struct _lptmr_config lptmr_config_t
LPTMR config structure.
This structure holds the configuration settings for the LPTMR peripheral. To initialize this structure to reasonable defaults, call the LPTMR_GetDefaultConfig() function and pass a pointer to your configuration structure instance.
The configuration struct can be made constant so it resides in flash.
-
static inline void LPTMR_EnableTimerDMA(LPTMR_Type *base, bool enable)
Enable or disable timer DMA request.
- Parameters:
base – base LPTMR peripheral base address
enable – Switcher of timer DMA feature. “true” means to enable, “false” means to disable.
-
struct _lptmr_config
- #include <fsl_lptmr.h>
LPTMR config structure.
This structure holds the configuration settings for the LPTMR peripheral. To initialize this structure to reasonable defaults, call the LPTMR_GetDefaultConfig() function and pass a pointer to your configuration structure instance.
The configuration struct can be made constant so it resides in flash.
Public Members
-
lptmr_timer_mode_t timerMode
Time counter mode or pulse counter mode
-
lptmr_pin_select_t pinSelect
LPTMR pulse input pin select; used only in pulse counter mode
-
lptmr_pin_polarity_t pinPolarity
LPTMR pulse input pin polarity; used only in pulse counter mode
-
bool enableFreeRunning
True: enable free running, counter is reset on overflow False: counter is reset when the compare flag is set
-
bool bypassPrescaler
True: bypass prescaler; false: use clock from prescaler
-
lptmr_prescaler_clock_select_t prescalerClockSource
LPTMR clock source
-
lptmr_prescaler_glitch_value_t value
Prescaler or glitch filter value
-
lptmr_timer_mode_t timerMode
LPUART: Low Power Universal Asynchronous Receiver/Transmitter Driver
LPUART Driver
-
static inline void LPUART_SoftwareReset(LPUART_Type *base)
Resets the LPUART using software.
This function resets all internal logic and registers except the Global Register. Remains set until cleared by software.
- Parameters:
base – LPUART peripheral base address.
-
status_t LPUART_Init(LPUART_Type *base, const lpuart_config_t *config, uint32_t srcClock_Hz)
Initializes an LPUART instance with the user configuration structure and the peripheral clock.
This function configures the LPUART module with user-defined settings. Call the LPUART_GetDefaultConfig() function to configure the configuration structure and get the default configuration. The example below shows how to use this API to configure the LPUART.
lpuart_config_t lpuartConfig; lpuartConfig.baudRate_Bps = 115200U; lpuartConfig.parityMode = kLPUART_ParityDisabled; lpuartConfig.dataBitsCount = kLPUART_EightDataBits; lpuartConfig.isMsb = false; lpuartConfig.stopBitCount = kLPUART_OneStopBit; lpuartConfig.txFifoWatermark = 0; lpuartConfig.rxFifoWatermark = 1; LPUART_Init(LPUART1, &lpuartConfig, 20000000U);
- Parameters:
base – LPUART peripheral base address.
config – Pointer to a user-defined configuration structure.
srcClock_Hz – LPUART clock source frequency in HZ.
- Return values:
kStatus_LPUART_BaudrateNotSupport – Baudrate is not support in current clock source.
kStatus_Success – LPUART initialize succeed
-
void LPUART_Deinit(LPUART_Type *base)
Deinitializes a LPUART instance.
This function waits for transmit to complete, disables TX and RX, and disables the LPUART clock.
- Parameters:
base – LPUART peripheral base address.
-
void LPUART_GetDefaultConfig(lpuart_config_t *config)
Gets the default configuration structure.
This function initializes the LPUART configuration structure to a default value. The default values are: lpuartConfig->baudRate_Bps = 115200U; lpuartConfig->parityMode = kLPUART_ParityDisabled; lpuartConfig->dataBitsCount = kLPUART_EightDataBits; lpuartConfig->isMsb = false; lpuartConfig->stopBitCount = kLPUART_OneStopBit; lpuartConfig->txFifoWatermark = 0; lpuartConfig->rxFifoWatermark = 1; lpuartConfig->rxIdleType = kLPUART_IdleTypeStartBit; lpuartConfig->rxIdleConfig = kLPUART_IdleCharacter1; lpuartConfig->enableTx = false; lpuartConfig->enableRx = false;
- Parameters:
config – Pointer to a configuration structure.
-
status_t LPUART_SetBaudRate(LPUART_Type *base, uint32_t baudRate_Bps, uint32_t srcClock_Hz)
Sets the LPUART instance baudrate.
This function configures the LPUART module baudrate. This function is used to update the LPUART module baudrate after the LPUART module is initialized by the LPUART_Init.
LPUART_SetBaudRate(LPUART1, 115200U, 20000000U);
- Parameters:
base – LPUART peripheral base address.
baudRate_Bps – LPUART baudrate to be set.
srcClock_Hz – LPUART clock source frequency in HZ.
- Return values:
kStatus_LPUART_BaudrateNotSupport – Baudrate is not supported in the current clock source.
kStatus_Success – Set baudrate succeeded.
-
void LPUART_Enable9bitMode(LPUART_Type *base, bool enable)
Enable 9-bit data mode for LPUART.
This function set the 9-bit mode for LPUART module. The 9th bit is not used for parity thus can be modified by user.
- Parameters:
base – LPUART peripheral base address.
enable – true to enable, flase to disable.
-
static inline void LPUART_SetMatchAddress(LPUART_Type *base, uint16_t address1, uint16_t address2)
Set the LPUART address.
This function configures the address for LPUART module that works as slave in 9-bit data mode. One or two address fields can be configured. When the address field’s match enable bit is set, the frame it receices with MSB being 1 is considered as an address frame, otherwise it is considered as data frame. Once the address frame matches one of slave’s own addresses, this slave is addressed. This address frame and its following data frames are stored in the receive buffer, otherwise the frames will be discarded. To un-address a slave, just send an address frame with unmatched address.
Note
Any LPUART instance joined in the multi-slave system can work as slave. The position of the address mark is the same as the parity bit when parity is enabled for 8 bit and 9 bit data formats.
- Parameters:
base – LPUART peripheral base address.
address1 – LPUART slave address1.
address2 – LPUART slave address2.
-
static inline void LPUART_EnableMatchAddress(LPUART_Type *base, bool match1, bool match2)
Enable the LPUART match address feature.
- Parameters:
base – LPUART peripheral base address.
match1 – true to enable match address1, false to disable.
match2 – true to enable match address2, false to disable.
-
static inline void LPUART_SetRxFifoWatermark(LPUART_Type *base, uint8_t water)
Sets the rx FIFO watermark.
- Parameters:
base – LPUART peripheral base address.
water – Rx FIFO watermark.
-
static inline void LPUART_SetTxFifoWatermark(LPUART_Type *base, uint8_t water)
Sets the tx FIFO watermark.
- Parameters:
base – LPUART peripheral base address.
water – Tx FIFO watermark.
-
static inline void LPUART_TransferEnable16Bit(lpuart_handle_t *handle, bool enable)
Sets the LPUART using 16bit transmit, only for 9bit or 10bit mode.
This function Enable 16bit Data transmit in lpuart_handle_t.
- Parameters:
handle – LPUART handle pointer.
enable – true to enable, false to disable.
-
uint32_t LPUART_GetStatusFlags(LPUART_Type *base)
Gets LPUART status flags.
This function gets all LPUART status flags. The flags are returned as the logical OR value of the enumerators _lpuart_flags. To check for a specific status, compare the return value with enumerators in the _lpuart_flags. For example, to check whether the TX is empty:
if (kLPUART_TxDataRegEmptyFlag & LPUART_GetStatusFlags(LPUART1)) { ... }
- Parameters:
base – LPUART peripheral base address.
- Returns:
LPUART status flags which are ORed by the enumerators in the _lpuart_flags.
-
status_t LPUART_ClearStatusFlags(LPUART_Type *base, uint32_t mask)
Clears status flags with a provided mask.
This function clears LPUART status flags with a provided mask. Automatically cleared flags can’t be cleared by this function. Flags that can only cleared or set by hardware are: kLPUART_TxDataRegEmptyFlag, kLPUART_TransmissionCompleteFlag, kLPUART_RxDataRegFullFlag, kLPUART_RxActiveFlag, kLPUART_NoiseErrorFlag, kLPUART_ParityErrorFlag, kLPUART_TxFifoEmptyFlag,kLPUART_RxFifoEmptyFlag Note: This API should be called when the Tx/Rx is idle, otherwise it takes no effects.
- Parameters:
base – LPUART peripheral base address.
mask – the status flags to be cleared. The user can use the enumerators in the _lpuart_status_flag_t to do the OR operation and get the mask.
- Return values:
kStatus_LPUART_FlagCannotClearManually – The flag can’t be cleared by this function but it is cleared automatically by hardware.
kStatus_Success – Status in the mask are cleared.
- Returns:
0 succeed, others failed.
-
void LPUART_EnableInterrupts(LPUART_Type *base, uint32_t mask)
Enables LPUART interrupts according to a provided mask.
This function enables the LPUART interrupts according to a provided mask. The mask is a logical OR of enumeration members. See the _lpuart_interrupt_enable. This examples shows how to enable TX empty interrupt and RX full interrupt:
LPUART_EnableInterrupts(LPUART1,kLPUART_TxDataRegEmptyInterruptEnable | kLPUART_RxDataRegFullInterruptEnable);
- Parameters:
base – LPUART peripheral base address.
mask – The interrupts to enable. Logical OR of _lpuart_interrupt_enable.
-
void LPUART_DisableInterrupts(LPUART_Type *base, uint32_t mask)
Disables LPUART interrupts according to a provided mask.
This function disables the LPUART interrupts according to a provided mask. The mask is a logical OR of enumeration members. See _lpuart_interrupt_enable. This example shows how to disable the TX empty interrupt and RX full interrupt:
LPUART_DisableInterrupts(LPUART1,kLPUART_TxDataRegEmptyInterruptEnable | kLPUART_RxDataRegFullInterruptEnable);
- Parameters:
base – LPUART peripheral base address.
mask – The interrupts to disable. Logical OR of _lpuart_interrupt_enable.
-
uint32_t LPUART_GetEnabledInterrupts(LPUART_Type *base)
Gets enabled LPUART interrupts.
This function gets the enabled LPUART interrupts. The enabled interrupts are returned as the logical OR value of the enumerators _lpuart_interrupt_enable. To check a specific interrupt enable status, compare the return value with enumerators in _lpuart_interrupt_enable. For example, to check whether the TX empty interrupt is enabled:
uint32_t enabledInterrupts = LPUART_GetEnabledInterrupts(LPUART1); if (kLPUART_TxDataRegEmptyInterruptEnable & enabledInterrupts) { ... }
- Parameters:
base – LPUART peripheral base address.
- Returns:
LPUART interrupt flags which are logical OR of the enumerators in _lpuart_interrupt_enable.
-
static inline uintptr_t LPUART_GetDataRegisterAddress(LPUART_Type *base)
Gets the LPUART data register address.
This function returns the LPUART data register address, which is mainly used by the DMA/eDMA.
- Parameters:
base – LPUART peripheral base address.
- Returns:
LPUART data register addresses which are used both by the transmitter and receiver.
-
static inline void LPUART_EnableTxDMA(LPUART_Type *base, bool enable)
Enables or disables the LPUART transmitter DMA request.
This function enables or disables the transmit data register empty flag, STAT[TDRE], to generate DMA requests.
- Parameters:
base – LPUART peripheral base address.
enable – True to enable, false to disable.
-
static inline void LPUART_EnableRxDMA(LPUART_Type *base, bool enable)
Enables or disables the LPUART receiver DMA.
This function enables or disables the receiver data register full flag, STAT[RDRF], to generate DMA requests.
- Parameters:
base – LPUART peripheral base address.
enable – True to enable, false to disable.
-
uint32_t LPUART_GetInstance(LPUART_Type *base)
Get the LPUART instance from peripheral base address.
- Parameters:
base – LPUART peripheral base address.
- Returns:
LPUART instance.
-
static inline void LPUART_EnableTx(LPUART_Type *base, bool enable)
Enables or disables the LPUART transmitter.
This function enables or disables the LPUART transmitter.
- Parameters:
base – LPUART peripheral base address.
enable – True to enable, false to disable.
-
static inline void LPUART_EnableRx(LPUART_Type *base, bool enable)
Enables or disables the LPUART receiver.
This function enables or disables the LPUART receiver.
- Parameters:
base – LPUART peripheral base address.
enable – True to enable, false to disable.
-
static inline void LPUART_WriteByte(LPUART_Type *base, uint8_t data)
Writes to the transmitter register.
This function writes data to the transmitter register directly. The upper layer must ensure that the TX register is empty or that the TX FIFO has room before calling this function.
- Parameters:
base – LPUART peripheral base address.
data – Data write to the TX register.
-
static inline uint8_t LPUART_ReadByte(LPUART_Type *base)
Reads the receiver register.
This function reads data from the receiver register directly. The upper layer must ensure that the receiver register is full or that the RX FIFO has data before calling this function.
- Parameters:
base – LPUART peripheral base address.
- Returns:
Data read from data register.
-
static inline uint8_t LPUART_GetRxFifoCount(LPUART_Type *base)
Gets the rx FIFO data count.
- Parameters:
base – LPUART peripheral base address.
- Returns:
rx FIFO data count.
-
static inline uint8_t LPUART_GetTxFifoCount(LPUART_Type *base)
Gets the tx FIFO data count.
- Parameters:
base – LPUART peripheral base address.
- Returns:
tx FIFO data count.
-
void LPUART_SendAddress(LPUART_Type *base, uint8_t address)
Transmit an address frame in 9-bit data mode.
- Parameters:
base – LPUART peripheral base address.
address – LPUART slave address.
-
status_t LPUART_WriteBlocking(LPUART_Type *base, const uint8_t *data, size_t length)
Writes to the transmitter register using a blocking method.
This function polls the transmitter register, first waits for the register to be empty or TX FIFO to have room, and writes data to the transmitter buffer, then waits for the dat to be sent out to the bus.
- Parameters:
base – LPUART peripheral base address.
data – Start address of the data to write.
length – Size of the data to write.
- Return values:
kStatus_LPUART_Timeout – Transmission timed out and was aborted.
kStatus_Success – Successfully wrote all data.
-
status_t LPUART_WriteBlocking16bit(LPUART_Type *base, const uint16_t *data, size_t length)
Writes to the transmitter register using a blocking method in 9bit or 10bit mode.
Note
This function only support 9bit or 10bit transfer. Please make sure only 10bit of data is valid and other bits are 0.
- Parameters:
base – LPUART peripheral base address.
data – Start address of the data to write.
length – Size of the data to write.
- Return values:
kStatus_LPUART_Timeout – Transmission timed out and was aborted.
kStatus_Success – Successfully wrote all data.
-
status_t LPUART_ReadBlocking(LPUART_Type *base, uint8_t *data, size_t length)
Reads the receiver data register using a blocking method.
This function polls the receiver register, waits for the receiver register full or receiver FIFO has data, and reads data from the TX register.
- Parameters:
base – LPUART peripheral base address.
data – Start address of the buffer to store the received data.
length – Size of the buffer.
- Return values:
kStatus_LPUART_RxHardwareOverrun – Receiver overrun happened while receiving data.
kStatus_LPUART_NoiseError – Noise error happened while receiving data.
kStatus_LPUART_FramingError – Framing error happened while receiving data.
kStatus_LPUART_ParityError – Parity error happened while receiving data.
kStatus_LPUART_Timeout – Transmission timed out and was aborted.
kStatus_Success – Successfully received all data.
-
status_t LPUART_ReadBlocking16bit(LPUART_Type *base, uint16_t *data, size_t length)
Reads the receiver data register in 9bit or 10bit mode.
Note
This function only support 9bit or 10bit transfer.
- Parameters:
base – LPUART peripheral base address.
data – Start address of the buffer to store the received data by 16bit, only 10bit is valid.
length – Size of the buffer.
- Return values:
kStatus_LPUART_RxHardwareOverrun – Receiver overrun happened while receiving data.
kStatus_LPUART_NoiseError – Noise error happened while receiving data.
kStatus_LPUART_FramingError – Framing error happened while receiving data.
kStatus_LPUART_ParityError – Parity error happened while receiving data.
kStatus_LPUART_Timeout – Transmission timed out and was aborted.
kStatus_Success – Successfully received all data.
-
void LPUART_TransferCreateHandle(LPUART_Type *base, lpuart_handle_t *handle, lpuart_transfer_callback_t callback, void *userData)
Initializes the LPUART handle.
This function initializes the LPUART handle, which can be used for other LPUART transactional APIs. Usually, for a specified LPUART instance, call this API once to get the initialized handle.
The LPUART driver supports the “background” receiving, which means that user can set up an RX ring buffer optionally. Data received is stored into the ring buffer even when the user doesn’t call the LPUART_TransferReceiveNonBlocking() API. If there is already data received in the ring buffer, the user can get the received data from the ring buffer directly. The ring buffer is disabled if passing NULL as
ringBuffer
.- Parameters:
base – LPUART peripheral base address.
handle – LPUART handle pointer.
callback – Callback function.
userData – User data.
-
status_t LPUART_TransferSendNonBlocking(LPUART_Type *base, lpuart_handle_t *handle, lpuart_transfer_t *xfer)
Transmits a buffer of data using the interrupt method.
This function send data using an interrupt method. This is a non-blocking function, which returns directly without waiting for all data written to the transmitter register. When all data is written to the TX register in the ISR, the LPUART driver calls the callback function and passes the kStatus_LPUART_TxIdle as status parameter.
Note
The kStatus_LPUART_TxIdle is passed to the upper layer when all data are written to the TX register. However, there is no check to ensure that all the data sent out. Before disabling the TX, check the kLPUART_TransmissionCompleteFlag to ensure that the transmit is finished.
- Parameters:
base – LPUART peripheral base address.
handle – LPUART handle pointer.
xfer – LPUART transfer structure, see lpuart_transfer_t.
- Return values:
kStatus_Success – Successfully start the data transmission.
kStatus_LPUART_TxBusy – Previous transmission still not finished, data not all written to the TX register.
kStatus_InvalidArgument – Invalid argument.
-
void LPUART_TransferStartRingBuffer(LPUART_Type *base, lpuart_handle_t *handle, uint8_t *ringBuffer, size_t ringBufferSize)
Sets up the RX ring buffer.
This function sets up the RX ring buffer to a specific UART handle.
When the RX ring buffer is used, data received is stored into the ring buffer even when the user doesn’t call the UART_TransferReceiveNonBlocking() API. If there is already data received in the ring buffer, the user can get the received data from the ring buffer directly.
Note
When using RX ring buffer, one byte is reserved for internal use. In other words, if
ringBufferSize
is 32, then only 31 bytes are used for saving data.- Parameters:
base – LPUART peripheral base address.
handle – LPUART handle pointer.
ringBuffer – Start address of ring buffer for background receiving. Pass NULL to disable the ring buffer.
ringBufferSize – size of the ring buffer.
-
void LPUART_TransferStopRingBuffer(LPUART_Type *base, lpuart_handle_t *handle)
Aborts the background transfer and uninstalls the ring buffer.
This function aborts the background transfer and uninstalls the ring buffer.
- Parameters:
base – LPUART peripheral base address.
handle – LPUART handle pointer.
-
size_t LPUART_TransferGetRxRingBufferLength(LPUART_Type *base, lpuart_handle_t *handle)
Get the length of received data in RX ring buffer.
- Parameters:
base – LPUART peripheral base address.
handle – LPUART handle pointer.
- Returns:
Length of received data in RX ring buffer.
-
void LPUART_TransferAbortSend(LPUART_Type *base, lpuart_handle_t *handle)
Aborts the interrupt-driven data transmit.
This function aborts the interrupt driven data sending. The user can get the remainBtyes to find out how many bytes are not sent out.
- Parameters:
base – LPUART peripheral base address.
handle – LPUART handle pointer.
-
status_t LPUART_TransferGetSendCount(LPUART_Type *base, lpuart_handle_t *handle, uint32_t *count)
Gets the number of bytes that have been sent out to bus.
This function gets the number of bytes that have been sent out to bus by an interrupt method.
- Parameters:
base – LPUART peripheral base address.
handle – LPUART handle pointer.
count – Send bytes count.
- Return values:
kStatus_NoTransferInProgress – No send in progress.
kStatus_InvalidArgument – Parameter is invalid.
kStatus_Success – Get successfully through the parameter
count
;
-
status_t LPUART_TransferReceiveNonBlocking(LPUART_Type *base, lpuart_handle_t *handle, lpuart_transfer_t *xfer, size_t *receivedBytes)
Receives a buffer of data using the interrupt method.
This function receives data using an interrupt method. This is a non-blocking function which returns without waiting to ensure that all data are received. If the RX ring buffer is used and not empty, the data in the ring buffer is copied and the parameter
receivedBytes
shows how many bytes are copied from the ring buffer. After copying, if the data in the ring buffer is not enough for read, the receive request is saved by the LPUART driver. When the new data arrives, the receive request is serviced first. When all data is received, the LPUART driver notifies the upper layer through a callback function and passes a status parameter kStatus_UART_RxIdle. For example, the upper layer needs 10 bytes but there are only 5 bytes in ring buffer. The 5 bytes are copied to xfer->data, which returns with the parameterreceivedBytes
set to 5. For the remaining 5 bytes, the newly arrived data is saved from xfer->data[5]. When 5 bytes are received, the LPUART driver notifies the upper layer. If the RX ring buffer is not enabled, this function enables the RX and RX interrupt to receive data to xfer->data. When all data is received, the upper layer is notified.- Parameters:
base – LPUART peripheral base address.
handle – LPUART handle pointer.
xfer – LPUART transfer structure, see uart_transfer_t.
receivedBytes – Bytes received from the ring buffer directly.
- Return values:
kStatus_Success – Successfully queue the transfer into the transmit queue.
kStatus_LPUART_RxBusy – Previous receive request is not finished.
kStatus_InvalidArgument – Invalid argument.
-
void LPUART_TransferAbortReceive(LPUART_Type *base, lpuart_handle_t *handle)
Aborts the interrupt-driven data receiving.
This function aborts the interrupt-driven data receiving. The user can get the remainBytes to find out how many bytes not received yet.
- Parameters:
base – LPUART peripheral base address.
handle – LPUART handle pointer.
-
status_t LPUART_TransferGetReceiveCount(LPUART_Type *base, lpuart_handle_t *handle, uint32_t *count)
Gets the number of bytes that have been received.
This function gets the number of bytes that have been received.
- Parameters:
base – LPUART peripheral base address.
handle – LPUART handle pointer.
count – Receive bytes count.
- Return values:
kStatus_NoTransferInProgress – No receive in progress.
kStatus_InvalidArgument – Parameter is invalid.
kStatus_Success – Get successfully through the parameter
count
;
-
void LPUART_TransferHandleIRQ(LPUART_Type *base, void *irqHandle)
LPUART IRQ handle function.
This function handles the LPUART transmit and receive IRQ request.
- Parameters:
base – LPUART peripheral base address.
irqHandle – LPUART handle pointer.
-
void LPUART_TransferHandleErrorIRQ(LPUART_Type *base, void *irqHandle)
LPUART Error IRQ handle function.
This function handles the LPUART error IRQ request.
- Parameters:
base – LPUART peripheral base address.
irqHandle – LPUART handle pointer.
-
void LPUART_DriverIRQHandler(uint32_t instance)
LPUART driver IRQ handler common entry.
This function provides the common IRQ request entry for LPUART.
- Parameters:
instance – LPUART instance.
-
FSL_LPUART_DRIVER_VERSION
LPUART driver version.
Error codes for the LPUART driver.
Values:
-
enumerator kStatus_LPUART_TxBusy
TX busy
-
enumerator kStatus_LPUART_RxBusy
RX busy
-
enumerator kStatus_LPUART_TxIdle
LPUART transmitter is idle.
-
enumerator kStatus_LPUART_RxIdle
LPUART receiver is idle.
-
enumerator kStatus_LPUART_TxWatermarkTooLarge
TX FIFO watermark too large
-
enumerator kStatus_LPUART_RxWatermarkTooLarge
RX FIFO watermark too large
-
enumerator kStatus_LPUART_FlagCannotClearManually
Some flag can’t manually clear
-
enumerator kStatus_LPUART_Error
Error happens on LPUART.
-
enumerator kStatus_LPUART_RxRingBufferOverrun
LPUART RX software ring buffer overrun.
-
enumerator kStatus_LPUART_RxHardwareOverrun
LPUART RX receiver overrun.
-
enumerator kStatus_LPUART_NoiseError
LPUART noise error.
-
enumerator kStatus_LPUART_FramingError
LPUART framing error.
-
enumerator kStatus_LPUART_ParityError
LPUART parity error.
-
enumerator kStatus_LPUART_BaudrateNotSupport
Baudrate is not support in current clock source
-
enumerator kStatus_LPUART_IdleLineDetected
IDLE flag.
-
enumerator kStatus_LPUART_Timeout
LPUART times out.
-
enumerator kStatus_LPUART_TxBusy
-
enum _lpuart_parity_mode
LPUART parity mode.
Values:
-
enumerator kLPUART_ParityDisabled
Parity disabled
-
enumerator kLPUART_ParityEven
Parity enabled, type even, bit setting: PE|PT = 10
-
enumerator kLPUART_ParityOdd
Parity enabled, type odd, bit setting: PE|PT = 11
-
enumerator kLPUART_ParityDisabled
-
enum _lpuart_data_bits
LPUART data bits count.
Values:
-
enumerator kLPUART_EightDataBits
Eight data bit
-
enumerator kLPUART_SevenDataBits
Seven data bit
-
enumerator kLPUART_EightDataBits
-
enum _lpuart_stop_bit_count
LPUART stop bit count.
Values:
-
enumerator kLPUART_OneStopBit
One stop bit
-
enumerator kLPUART_TwoStopBit
Two stop bits
-
enumerator kLPUART_OneStopBit
-
enum _lpuart_transmit_cts_source
LPUART transmit CTS source.
Values:
-
enumerator kLPUART_CtsSourcePin
CTS resource is the LPUART_CTS pin.
-
enumerator kLPUART_CtsSourceMatchResult
CTS resource is the match result.
-
enumerator kLPUART_CtsSourcePin
-
enum _lpuart_transmit_cts_config
LPUART transmit CTS configure.
Values:
-
enumerator kLPUART_CtsSampleAtStart
CTS input is sampled at the start of each character.
-
enumerator kLPUART_CtsSampleAtIdle
CTS input is sampled when the transmitter is idle
-
enumerator kLPUART_CtsSampleAtStart
-
enum _lpuart_idle_type_select
LPUART idle flag type defines when the receiver starts counting.
Values:
-
enumerator kLPUART_IdleTypeStartBit
Start counting after a valid start bit.
-
enumerator kLPUART_IdleTypeStopBit
Start counting after a stop bit.
-
enumerator kLPUART_IdleTypeStartBit
-
enum _lpuart_idle_config
LPUART idle detected configuration. This structure defines the number of idle characters that must be received before the IDLE flag is set.
Values:
-
enumerator kLPUART_IdleCharacter1
the number of idle characters.
-
enumerator kLPUART_IdleCharacter2
the number of idle characters.
-
enumerator kLPUART_IdleCharacter4
the number of idle characters.
-
enumerator kLPUART_IdleCharacter8
the number of idle characters.
-
enumerator kLPUART_IdleCharacter16
the number of idle characters.
-
enumerator kLPUART_IdleCharacter32
the number of idle characters.
-
enumerator kLPUART_IdleCharacter64
the number of idle characters.
-
enumerator kLPUART_IdleCharacter128
the number of idle characters.
-
enumerator kLPUART_IdleCharacter1
-
enum _lpuart_interrupt_enable
LPUART interrupt configuration structure, default settings all disabled.
This structure contains the settings for all LPUART interrupt configurations.
Values:
-
enumerator kLPUART_LinBreakInterruptEnable
LIN break detect. bit 7
-
enumerator kLPUART_RxActiveEdgeInterruptEnable
Receive Active Edge. bit 6
-
enumerator kLPUART_TxDataRegEmptyInterruptEnable
Transmit data register empty. bit 23
-
enumerator kLPUART_TransmissionCompleteInterruptEnable
Transmission complete. bit 22
-
enumerator kLPUART_RxDataRegFullInterruptEnable
Receiver data register full. bit 21
-
enumerator kLPUART_IdleLineInterruptEnable
Idle line. bit 20
-
enumerator kLPUART_RxOverrunInterruptEnable
Receiver Overrun. bit 27
-
enumerator kLPUART_NoiseErrorInterruptEnable
Noise error flag. bit 26
-
enumerator kLPUART_FramingErrorInterruptEnable
Framing error flag. bit 25
-
enumerator kLPUART_ParityErrorInterruptEnable
Parity error flag. bit 24
-
enumerator kLPUART_Match1InterruptEnable
Parity error flag. bit 15
-
enumerator kLPUART_Match2InterruptEnable
Parity error flag. bit 14
-
enumerator kLPUART_TxFifoOverflowInterruptEnable
Transmit FIFO Overflow. bit 9
-
enumerator kLPUART_RxFifoUnderflowInterruptEnable
Receive FIFO Underflow. bit 8
-
enumerator kLPUART_AllInterruptEnable
-
enumerator kLPUART_LinBreakInterruptEnable
-
enum _lpuart_flags
LPUART status flags.
This provides constants for the LPUART status flags for use in the LPUART functions.
Values:
-
enumerator kLPUART_TxDataRegEmptyFlag
Transmit data register empty flag, sets when transmit buffer is empty. bit 23
-
enumerator kLPUART_TransmissionCompleteFlag
Transmission complete flag, sets when transmission activity complete. bit 22
-
enumerator kLPUART_RxDataRegFullFlag
Receive data register full flag, sets when the receive data buffer is full. bit 21
-
enumerator kLPUART_IdleLineFlag
Idle line detect flag, sets when idle line detected. bit 20
-
enumerator kLPUART_RxOverrunFlag
Receive Overrun, sets when new data is received before data is read from receive register. bit 19
-
enumerator kLPUART_NoiseErrorFlag
Receive takes 3 samples of each received bit. If any of these samples differ, noise flag sets. bit 18
-
enumerator kLPUART_FramingErrorFlag
Frame error flag, sets if logic 0 was detected where stop bit expected. bit 17
-
enumerator kLPUART_ParityErrorFlag
If parity enabled, sets upon parity error detection. bit 16
-
enumerator kLPUART_LinBreakFlag
LIN break detect interrupt flag, sets when LIN break char detected and LIN circuit enabled. bit 31
-
enumerator kLPUART_RxActiveEdgeFlag
Receive pin active edge interrupt flag, sets when active edge detected. bit 30
-
enumerator kLPUART_RxActiveFlag
Receiver Active Flag (RAF), sets at beginning of valid start. bit 24
-
enumerator kLPUART_DataMatch1Flag
The next character to be read from LPUART_DATA matches MA1. bit 15
-
enumerator kLPUART_DataMatch2Flag
The next character to be read from LPUART_DATA matches MA2. bit 14
-
enumerator kLPUART_TxFifoEmptyFlag
TXEMPT bit, sets if transmit buffer is empty. bit 7
-
enumerator kLPUART_RxFifoEmptyFlag
RXEMPT bit, sets if receive buffer is empty. bit 6
-
enumerator kLPUART_TxFifoOverflowFlag
TXOF bit, sets if transmit buffer overflow occurred. bit 1
-
enumerator kLPUART_RxFifoUnderflowFlag
RXUF bit, sets if receive buffer underflow occurred. bit 0
-
enumerator kLPUART_AllClearFlags
-
enumerator kLPUART_AllFlags
-
enumerator kLPUART_TxDataRegEmptyFlag
-
typedef enum _lpuart_parity_mode lpuart_parity_mode_t
LPUART parity mode.
-
typedef enum _lpuart_data_bits lpuart_data_bits_t
LPUART data bits count.
-
typedef enum _lpuart_stop_bit_count lpuart_stop_bit_count_t
LPUART stop bit count.
-
typedef enum _lpuart_transmit_cts_source lpuart_transmit_cts_source_t
LPUART transmit CTS source.
-
typedef enum _lpuart_transmit_cts_config lpuart_transmit_cts_config_t
LPUART transmit CTS configure.
-
typedef enum _lpuart_idle_type_select lpuart_idle_type_select_t
LPUART idle flag type defines when the receiver starts counting.
-
typedef enum _lpuart_idle_config lpuart_idle_config_t
LPUART idle detected configuration. This structure defines the number of idle characters that must be received before the IDLE flag is set.
-
typedef struct _lpuart_config lpuart_config_t
LPUART configuration structure.
-
typedef struct _lpuart_transfer lpuart_transfer_t
LPUART transfer structure.
-
typedef struct _lpuart_handle lpuart_handle_t
-
typedef void (*lpuart_transfer_callback_t)(LPUART_Type *base, lpuart_handle_t *handle, status_t status, void *userData)
LPUART transfer callback function.
-
typedef void (*lpuart_isr_t)(LPUART_Type *base, void *handle)
-
void *s_lpuartHandle[]
-
const IRQn_Type s_lpuartTxIRQ[]
-
lpuart_isr_t s_lpuartIsr[]
-
UART_RETRY_TIMES
Retry times for waiting flag.
-
struct _lpuart_config
- #include <fsl_lpuart.h>
LPUART configuration structure.
Public Members
-
uint32_t baudRate_Bps
LPUART baud rate
-
lpuart_parity_mode_t parityMode
Parity mode, disabled (default), even, odd
-
lpuart_data_bits_t dataBitsCount
Data bits count, eight (default), seven
-
bool isMsb
Data bits order, LSB (default), MSB
-
lpuart_stop_bit_count_t stopBitCount
Number of stop bits, 1 stop bit (default) or 2 stop bits
-
uint8_t txFifoWatermark
TX FIFO watermark
-
uint8_t rxFifoWatermark
RX FIFO watermark
-
bool enableRxRTS
RX RTS enable
-
bool enableTxCTS
TX CTS enable
-
lpuart_transmit_cts_source_t txCtsSource
TX CTS source
-
lpuart_transmit_cts_config_t txCtsConfig
TX CTS configure
-
lpuart_idle_type_select_t rxIdleType
RX IDLE type.
-
lpuart_idle_config_t rxIdleConfig
RX IDLE configuration.
-
bool enableTx
Enable TX
-
bool enableRx
Enable RX
-
uint32_t baudRate_Bps
-
struct _lpuart_transfer
- #include <fsl_lpuart.h>
LPUART transfer structure.
Public Members
-
size_t dataSize
The byte count to be transfer.
-
size_t dataSize
-
struct _lpuart_handle
- #include <fsl_lpuart.h>
LPUART handle structure.
Public Members
-
volatile size_t txDataSize
Size of the remaining data to send.
-
size_t txDataSizeAll
Size of the data to send out.
-
volatile size_t rxDataSize
Size of the remaining data to receive.
-
size_t rxDataSizeAll
Size of the data to receive.
-
size_t rxRingBufferSize
Size of the ring buffer.
-
volatile uint16_t rxRingBufferHead
Index for the driver to store received data into ring buffer.
-
volatile uint16_t rxRingBufferTail
Index for the user to get data from the ring buffer.
-
lpuart_transfer_callback_t callback
Callback function.
-
void *userData
LPUART callback function parameter.
-
volatile uint8_t txState
TX transfer state.
-
volatile uint8_t rxState
RX transfer state.
-
bool isSevenDataBits
Seven data bits flag.
-
bool is16bitData
16bit data bits flag, only used for 9bit or 10bit data
-
volatile size_t txDataSize
-
union __unnamed22__
Public Members
-
uint8_t *data
The buffer of data to be transfer.
-
uint8_t *rxData
The buffer to receive data.
-
uint16_t *rxData16
The buffer to receive data.
-
const uint8_t *txData
The buffer of data to be sent.
-
const uint16_t *txData16
The buffer of data to be sent.
-
uint8_t *data
-
union __unnamed24__
Public Members
-
const uint8_t *volatile txData
Address of remaining data to send.
-
const uint16_t *volatile txData16
Address of remaining data to send.
-
const uint8_t *volatile txData
-
union __unnamed26__
Public Members
-
uint8_t *volatile rxData
Address of remaining data to receive.
-
uint16_t *volatile rxData16
Address of remaining data to receive.
-
uint8_t *volatile rxData
-
union __unnamed28__
Public Members
-
uint8_t *rxRingBuffer
Start address of the receiver ring buffer.
-
uint16_t *rxRingBuffer16
Start address of the receiver ring buffer.
-
uint8_t *rxRingBuffer
LPUART eDMA Driver
-
void LPUART_TransferCreateHandleEDMA(LPUART_Type *base, lpuart_edma_handle_t *handle, lpuart_edma_transfer_callback_t callback, void *userData, edma_handle_t *txEdmaHandle, edma_handle_t *rxEdmaHandle)
Initializes the LPUART handle which is used in transactional functions.
Note
This function disables all LPUART interrupts.
- Parameters:
base – LPUART peripheral base address.
handle – Pointer to lpuart_edma_handle_t structure.
callback – Callback function.
userData – User data.
txEdmaHandle – User requested DMA handle for TX DMA transfer.
rxEdmaHandle – User requested DMA handle for RX DMA transfer.
-
status_t LPUART_SendEDMA(LPUART_Type *base, lpuart_edma_handle_t *handle, lpuart_transfer_t *xfer)
Sends data using eDMA.
This function sends data using eDMA. This is a non-blocking function, which returns right away. When all data is sent, the send callback function is called.
- Parameters:
base – LPUART peripheral base address.
handle – LPUART handle pointer.
xfer – LPUART eDMA transfer structure. See lpuart_transfer_t.
- Return values:
kStatus_Success – if succeed, others failed.
kStatus_LPUART_TxBusy – Previous transfer on going.
kStatus_InvalidArgument – Invalid argument.
-
status_t LPUART_ReceiveEDMA(LPUART_Type *base, lpuart_edma_handle_t *handle, lpuart_transfer_t *xfer)
Receives data using eDMA.
This function receives data using eDMA. This is non-blocking function, which returns right away. When all data is received, the receive callback function is called.
- Parameters:
base – LPUART peripheral base address.
handle – Pointer to lpuart_edma_handle_t structure.
xfer – LPUART eDMA transfer structure, see lpuart_transfer_t.
- Return values:
kStatus_Success – if succeed, others fail.
kStatus_LPUART_RxBusy – Previous transfer ongoing.
kStatus_InvalidArgument – Invalid argument.
-
void LPUART_TransferAbortSendEDMA(LPUART_Type *base, lpuart_edma_handle_t *handle)
Aborts the sent data using eDMA.
This function aborts the sent data using eDMA.
- Parameters:
base – LPUART peripheral base address.
handle – Pointer to lpuart_edma_handle_t structure.
-
void LPUART_TransferAbortReceiveEDMA(LPUART_Type *base, lpuart_edma_handle_t *handle)
Aborts the received data using eDMA.
This function aborts the received data using eDMA.
- Parameters:
base – LPUART peripheral base address.
handle – Pointer to lpuart_edma_handle_t structure.
-
status_t LPUART_TransferGetSendCountEDMA(LPUART_Type *base, lpuart_edma_handle_t *handle, uint32_t *count)
Gets the number of bytes written to the LPUART TX register.
This function gets the number of bytes written to the LPUART TX register by DMA.
- Parameters:
base – LPUART peripheral base address.
handle – LPUART handle pointer.
count – Send bytes count.
- Return values:
kStatus_NoTransferInProgress – No send in progress.
kStatus_InvalidArgument – Parameter is invalid.
kStatus_Success – Get successfully through the parameter
count
;
-
status_t LPUART_TransferGetReceiveCountEDMA(LPUART_Type *base, lpuart_edma_handle_t *handle, uint32_t *count)
Gets the number of received bytes.
This function gets the number of received bytes.
- Parameters:
base – LPUART peripheral base address.
handle – LPUART handle pointer.
count – Receive bytes count.
- Return values:
kStatus_NoTransferInProgress – No receive in progress.
kStatus_InvalidArgument – Parameter is invalid.
kStatus_Success – Get successfully through the parameter
count
;
-
void LPUART_TransferEdmaHandleIRQ(LPUART_Type *base, void *lpuartEdmaHandle)
LPUART eDMA IRQ handle function.
This function handles the LPUART tx complete IRQ request and invoke user callback. It is not set to static so that it can be used in user application.
Note
This function is used as default IRQ handler by double weak mechanism. If user’s specific IRQ handler is implemented, make sure this function is invoked in the handler.
- Parameters:
base – LPUART peripheral base address.
lpuartEdmaHandle – LPUART handle pointer.
-
FSL_LPUART_EDMA_DRIVER_VERSION
LPUART EDMA driver version.
-
typedef struct _lpuart_edma_handle lpuart_edma_handle_t
-
typedef void (*lpuart_edma_transfer_callback_t)(LPUART_Type *base, lpuart_edma_handle_t *handle, status_t status, void *userData)
LPUART transfer callback function.
-
struct _lpuart_edma_handle
- #include <fsl_lpuart_edma.h>
LPUART eDMA handle.
Public Members
-
lpuart_edma_transfer_callback_t callback
Callback function.
-
void *userData
LPUART callback function parameter.
-
size_t rxDataSizeAll
Size of the data to receive.
-
size_t txDataSizeAll
Size of the data to send out.
-
edma_handle_t *txEdmaHandle
The eDMA TX channel used.
-
edma_handle_t *rxEdmaHandle
The eDMA RX channel used.
-
uint8_t nbytes
eDMA minor byte transfer count initially configured.
-
volatile uint8_t txState
TX transfer state.
-
volatile uint8_t rxState
RX transfer state
-
lpuart_edma_transfer_callback_t callback
MU: Messaging Unit
-
void MU_Init(MU_Type *base)
Initializes the MU module.
This function enables the MU clock only.
- Parameters:
base – MU peripheral base address.
-
void MU_Deinit(MU_Type *base)
De-initializes the MU module.
This function disables the MU clock only.
- Parameters:
base – MU peripheral base address.
-
static inline void MU_SendMsgNonBlocking(MU_Type *base, uint32_t regIndex, uint32_t msg)
Writes a message to the TX register.
This function writes a message to the specific TX register. It does not check whether the TX register is empty or not. The upper layer should make sure the TX register is empty before calling this function. This function can be used in ISR for better performance.
while (!(kMU_Tx0EmptyFlag & MU_GetStatusFlags(base))) { } Wait for TX0 register empty. MU_SendMsgNonBlocking(base, kMU_MsgReg0, MSG_VAL); Write message to the TX0 register.
- Parameters:
base – MU peripheral base address.
regIndex – TX register index, see mu_msg_reg_index_t.
msg – Message to send.
-
void MU_SendMsg(MU_Type *base, uint32_t regIndex, uint32_t msg)
Blocks to send a message.
This function waits until the TX register is empty and sends the message.
- Parameters:
base – MU peripheral base address.
regIndex – MU message register, see mu_msg_reg_index_t.
msg – Message to send.
-
static inline uint32_t MU_ReceiveMsgNonBlocking(MU_Type *base, uint32_t regIndex)
Reads a message from the RX register.
This function reads a message from the specific RX register. It does not check whether the RX register is full or not. The upper layer should make sure the RX register is full before calling this function. This function can be used in ISR for better performance.
uint32_t msg; while (!(kMU_Rx0FullFlag & MU_GetStatusFlags(base))) { } Wait for the RX0 register full. msg = MU_ReceiveMsgNonBlocking(base, kMU_MsgReg0); Read message from RX0 register.
- Parameters:
base – MU peripheral base address.
regIndex – RX register index, see mu_msg_reg_index_t.
- Returns:
The received message.
-
uint32_t MU_ReceiveMsg(MU_Type *base, uint32_t regIndex)
Blocks to receive a message.
This function waits until the RX register is full and receives the message.
- Parameters:
base – MU peripheral base address.
regIndex – MU message register, see mu_msg_reg_index_t
- Returns:
The received message.
-
static inline void MU_SetFlagsNonBlocking(MU_Type *base, uint32_t flags)
Sets the 3-bit MU flags reflect on the other MU side.
This function sets the 3-bit MU flags directly. Every time the 3-bit MU flags are changed, the status flag
kMU_FlagsUpdatingFlag
asserts indicating the 3-bit MU flags are updating to the other side. After the 3-bit MU flags are updated, the status flagkMU_FlagsUpdatingFlag
is cleared by hardware. During the flags updating period, the flags cannot be changed. The upper layer should make sure the status flagkMU_FlagsUpdatingFlag
is cleared before calling this function.while (kMU_FlagsUpdatingFlag & MU_GetStatusFlags(base)) { } Wait for previous MU flags updating. MU_SetFlagsNonBlocking(base, 0U); Set the mU flags.
- Parameters:
base – MU peripheral base address.
flags – The 3-bit MU flags to set.
-
void MU_SetFlags(MU_Type *base, uint32_t flags)
Blocks setting the 3-bit MU flags reflect on the other MU side.
This function blocks setting the 3-bit MU flags. Every time the 3-bit MU flags are changed, the status flag
kMU_FlagsUpdatingFlag
asserts indicating the 3-bit MU flags are updating to the other side. After the 3-bit MU flags are updated, the status flagkMU_FlagsUpdatingFlag
is cleared by hardware. During the flags updating period, the flags cannot be changed. This function waits for the MU status flagkMU_FlagsUpdatingFlag
cleared and sets the 3-bit MU flags.- Parameters:
base – MU peripheral base address.
flags – The 3-bit MU flags to set.
-
static inline uint32_t MU_GetFlags(MU_Type *base)
Gets the current value of the 3-bit MU flags set by the other side.
This function gets the current 3-bit MU flags on the current side.
- Parameters:
base – MU peripheral base address.
- Returns:
flags Current value of the 3-bit flags.
-
static inline uint32_t MU_GetStatusFlags(MU_Type *base)
Gets the MU status flags.
This function returns the bit mask of the MU status flags. See _mu_status_flags.
uint32_t flags; flags = MU_GetStatusFlags(base); Get all status flags. if (kMU_Tx0EmptyFlag & flags) { The TX0 register is empty. Message can be sent. MU_SendMsgNonBlocking(base, kMU_MsgReg0, MSG0_VAL); } if (kMU_Tx1EmptyFlag & flags) { The TX1 register is empty. Message can be sent. MU_SendMsgNonBlocking(base, kMU_MsgReg1, MSG1_VAL); }
- Parameters:
base – MU peripheral base address.
- Returns:
Bit mask of the MU status flags, see _mu_status_flags.
-
static inline uint32_t MU_GetRxStatusFlags(MU_Type *base)
Return the RX status flags.
This function return the RX status flags. Note: RFn bits of SR[27-24](mu status register) are mapped in reverse numerical order: RF0 -> SR[27] RF1 -> SR[26] RF2 -> SR[25] RF3 -> SR[24]
status_reg = MU_GetRxStatusFlags(base);
- Parameters:
base – MU peripheral base address.
- Returns:
MU RX status
-
static inline uint32_t MU_GetInterruptsPending(MU_Type *base)
Gets the MU IRQ pending status of enabled interrupts.
This function returns the bit mask of the pending MU IRQs of enabled interrupts. Only these flags are checked. kMU_Tx0EmptyFlag kMU_Tx1EmptyFlag kMU_Tx2EmptyFlag kMU_Tx3EmptyFlag kMU_Rx0FullFlag kMU_Rx1FullFlag kMU_Rx2FullFlag kMU_Rx3FullFlag kMU_GenInt0Flag kMU_GenInt1Flag kMU_GenInt2Flag kMU_GenInt3Flag
- Parameters:
base – MU peripheral base address.
- Returns:
Bit mask of the MU IRQs pending.
-
static inline void MU_ClearStatusFlags(MU_Type *base, uint32_t mask)
Clears the specific MU status flags.
This function clears the specific MU status flags. The flags to clear should be passed in as bit mask. See _mu_status_flags.
Clear general interrupt 0 and general interrupt 1 pending flags. MU_ClearStatusFlags(base, kMU_GenInt0Flag | kMU_GenInt1Flag);
- Parameters:
base – MU peripheral base address.
mask – Bit mask of the MU status flags. See _mu_status_flags. The following flags are cleared by hardware, this function could not clear them.
kMU_Tx0EmptyFlag
kMU_Tx1EmptyFlag
kMU_Tx2EmptyFlag
kMU_Tx3EmptyFlag
kMU_Rx0FullFlag
kMU_Rx1FullFlag
kMU_Rx2FullFlag
kMU_Rx3FullFlag
kMU_EventPendingFlag
kMU_FlagsUpdatingFlag
kMU_OtherSideInResetFlag
-
static inline void MU_EnableInterrupts(MU_Type *base, uint32_t mask)
Enables the specific MU interrupts.
This function enables the specific MU interrupts. The interrupts to enable should be passed in as bit mask. See _mu_interrupt_enable.
Enable general interrupt 0 and TX0 empty interrupt. MU_EnableInterrupts(base, kMU_GenInt0InterruptEnable | kMU_Tx0EmptyInterruptEnable);
- Parameters:
base – MU peripheral base address.
mask – Bit mask of the MU interrupts. See _mu_interrupt_enable.
-
static inline void MU_DisableInterrupts(MU_Type *base, uint32_t mask)
Disables the specific MU interrupts.
This function disables the specific MU interrupts. The interrupts to disable should be passed in as bit mask. See _mu_interrupt_enable.
Disable general interrupt 0 and TX0 empty interrupt. MU_DisableInterrupts(base, kMU_GenInt0InterruptEnable | kMU_Tx0EmptyInterruptEnable);
- Parameters:
base – MU peripheral base address.
mask – Bit mask of the MU interrupts. See _mu_interrupt_enable.
-
status_t MU_TriggerInterrupts(MU_Type *base, uint32_t mask)
Triggers interrupts to the other core.
This function triggers the specific interrupts to the other core. The interrupts to trigger are passed in as bit mask. See _mu_interrupt_trigger. The MU should not trigger an interrupt to the other core when the previous interrupt has not been processed by the other core. This function checks whether the previous interrupts have been processed. If not, it returns an error.
if (kStatus_Success != MU_TriggerInterrupts(base, kMU_GenInt0InterruptTrigger | kMU_GenInt2InterruptTrigger)) { Previous general purpose interrupt 0 or general purpose interrupt 2 has not been processed by the other core. }
- Parameters:
base – MU peripheral base address.
mask – Bit mask of the interrupts to trigger. See _mu_interrupt_trigger.
- Return values:
kStatus_Success – Interrupts have been triggered successfully.
kStatus_Fail – Previous interrupts have not been accepted.
-
void MU_BootCoreB(MU_Type *base, mu_core_boot_mode_t mode)
Boots the core at B side.
This function sets the B side core’s boot configuration and releases the core from reset.
Note
Only MU side A can use this function.
- Parameters:
base – MU peripheral base address.
mode – Core B boot mode.
-
static inline void MU_HoldCoreBReset(MU_Type *base)
Holds the core reset of B side.
This function causes the core of B side to be held in reset following any reset event.
Note
Only A side could call this function.
- Parameters:
base – MU peripheral base address.
-
void MU_BootOtherCore(MU_Type *base, mu_core_boot_mode_t mode)
Boots the other core.
This function boots the other core with a boot configuration.
- Parameters:
base – MU peripheral base address.
mode – The other core boot mode.
-
static inline void MU_HoldOtherCoreReset(MU_Type *base)
Holds the other core reset.
This function causes the other core to be held in reset following any reset event.
- Parameters:
base – MU peripheral base address.
-
static inline void MU_ResetBothSides(MU_Type *base)
Resets the MU for both A side and B side.
This function resets the MU for both A side and B side. Before reset, it is recommended to interrupt processor B, because this function may affect the ongoing processor B programs.
Note
For some platforms, only MU side A could use this function, check reference manual for details.
- Parameters:
base – MU peripheral base address.
-
void MU_HardwareResetOtherCore(MU_Type *base, bool waitReset, bool holdReset, mu_core_boot_mode_t bootMode)
Hardware reset the other core.
This function resets the other core, the other core could mask the hardware reset by calling MU_MaskHardwareReset. The hardware reset mask feature is only available for some platforms. This function could be used together with MU_BootOtherCore to control the other core reset workflow.
Example 1: Reset the other core, and no hold reset
In this example, the core at MU side B will reset with the specified boot mode.MU_HardwareResetOtherCore(MU_A, true, false, bootMode);
Example 2: Reset the other core and hold it, then boot the other core later.
Here the other core enters reset, and the reset is hold MU_HardwareResetOtherCore(MU_A, true, true, modeDontCare); Current core boot the other core when necessary. MU_BootOtherCore(MU_A, bootMode);
- Parameters:
base – MU peripheral base address.
waitReset – Wait the other core enters reset.
true: Wait until the other core enters reset, if the other core has masked the hardware reset, then this function will be blocked.
false: Don’t wait the reset.
holdReset – Hold the other core reset or not.
true: Hold the other core in reset, this function returns directly when the other core enters reset.
false: Don’t hold the other core in reset, this function waits until the other core out of reset.
bootMode – Boot mode of the other core, if
holdReset
is true, this parameter is useless.
-
static inline mu_power_mode_t MU_GetOtherCorePowerMode(MU_Type *base)
Gets the power mode of the other core.
This function gets the power mode of the other core.
- Parameters:
base – MU peripheral base address.
- Returns:
Power mode of the other core.
-
FSL_MU_DRIVER_VERSION
MU driver version.
-
enum _mu_status_flags
MU status flags.
Values:
-
enumerator kMU_Tx0EmptyFlag
TX0 empty.
-
enumerator kMU_Tx1EmptyFlag
TX1 empty.
-
enumerator kMU_Tx2EmptyFlag
TX2 empty.
-
enumerator kMU_Tx3EmptyFlag
TX3 empty.
-
enumerator kMU_Rx0FullFlag
RX0 full.
-
enumerator kMU_Rx1FullFlag
RX1 full.
-
enumerator kMU_Rx2FullFlag
RX2 full.
-
enumerator kMU_Rx3FullFlag
RX3 full.
-
enumerator kMU_GenInt0Flag
General purpose interrupt 0 pending.
-
enumerator kMU_GenInt1Flag
General purpose interrupt 1 pending.
-
enumerator kMU_GenInt2Flag
General purpose interrupt 2 pending.
-
enumerator kMU_GenInt3Flag
General purpose interrupt 3 pending.
-
enumerator kMU_EventPendingFlag
MU event pending.
-
enumerator kMU_FlagsUpdatingFlag
MU flags update is on-going.
-
enumerator kMU_ResetAssertInterruptFlag
The other core reset assert interrupt pending.
-
enumerator kMU_ResetDeassertInterruptFlag
The other core reset de-assert interrupt pending.
-
enumerator kMU_MuResetInterruptFlag
The other side initializes MU reset.
-
enumerator kMU_HardwareResetInterruptFlag
Current side has been hardware reset by the other side.
-
enumerator kMU_Tx0EmptyFlag
-
enum _mu_interrupt_enable
MU interrupt source to enable.
Values:
-
enumerator kMU_Tx0EmptyInterruptEnable
TX0 empty.
-
enumerator kMU_Tx1EmptyInterruptEnable
TX1 empty.
-
enumerator kMU_Tx2EmptyInterruptEnable
TX2 empty.
-
enumerator kMU_Tx3EmptyInterruptEnable
TX3 empty.
-
enumerator kMU_Rx0FullInterruptEnable
RX0 full.
-
enumerator kMU_Rx1FullInterruptEnable
RX1 full.
-
enumerator kMU_Rx2FullInterruptEnable
RX2 full.
-
enumerator kMU_Rx3FullInterruptEnable
RX3 full.
-
enumerator kMU_GenInt0InterruptEnable
General purpose interrupt 0.
-
enumerator kMU_GenInt1InterruptEnable
General purpose interrupt 1.
-
enumerator kMU_GenInt2InterruptEnable
General purpose interrupt 2.
-
enumerator kMU_GenInt3InterruptEnable
General purpose interrupt 3.
-
enumerator kMU_ResetAssertInterruptEnable
The other core reset assert interrupt.
-
enumerator kMU_ResetDeassertInterruptEnable
The other core reset de-assert interrupt.
-
enumerator kMU_MuResetInterruptEnable
The other side initializes MU reset. The interrupt is ORed with the general purpose interrupt 3. The general purpose interrupt 3 is issued when the other side set the MU reset and this interrupt is enabled.
-
enumerator kMU_HardwareResetInterruptEnable
Current side has been hardware reset by the other side.
-
enumerator kMU_Tx0EmptyInterruptEnable
-
enum _mu_interrupt_trigger
MU interrupt that could be triggered to the other core.
Values:
-
enumerator kMU_GenInt0InterruptTrigger
General purpose interrupt 0.
-
enumerator kMU_GenInt1InterruptTrigger
General purpose interrupt 1.
-
enumerator kMU_GenInt2InterruptTrigger
General purpose interrupt 2.
-
enumerator kMU_GenInt3InterruptTrigger
General purpose interrupt 3.
-
enumerator kMU_GenInt0InterruptTrigger
-
enum _mu_msg_reg_index
MU message register.
Values:
-
enumerator kMU_MsgReg0
-
enumerator kMU_MsgReg1
-
enumerator kMU_MsgReg2
-
enumerator kMU_MsgReg3
-
enumerator kMU_MsgReg0
-
typedef enum _mu_msg_reg_index mu_msg_reg_index_t
MU message register.
-
MU_CR_NMI_MASK
-
MU_GET_CORE_FLAG(flags)
-
MU_GET_STAT_FLAG(flags)
-
MU_GET_TX_FLAG(flags)
-
MU_GET_RX_FLAG(flags)
-
MU_GET_GI_FLAG(flags)
PORT: Port Control and Interrupts
-
static inline void PORT_GetVersionInfo(PORT_Type *base, port_version_info_t *info)
Get PORT version information.
- Parameters:
base – PORT peripheral base pointer
info – PORT version information
-
static inline void PORT_SecletPortVoltageRange(PORT_Type *base, port_voltage_range_t range)
Get PORT version information.
Note
: PORTA_CONFIG[RANGE] controls the voltage ranges of Port A, B, and C. Read or write PORTB_CONFIG[RANGE] and PORTC_CONFIG[RANGE] does not take effect.
- Parameters:
base – PORT peripheral base pointer
range – port voltage range
-
static inline void PORT_SetPinConfig(PORT_Type *base, uint32_t pin, const port_pin_config_t *config)
Sets the port PCR register.
This is an example to define an input pin or output pin PCR configuration.
// Define a digital input pin PCR configuration port_pin_config_t config = { kPORT_PullUp, kPORT_FastSlewRate, kPORT_PassiveFilterDisable, kPORT_OpenDrainDisable, kPORT_LowDriveStrength, kPORT_MuxAsGpio, kPORT_UnLockRegister, };
- Parameters:
base – PORT peripheral base pointer.
pin – PORT pin number.
config – PORT PCR register configuration structure.
-
static inline void PORT_SetMultiplePinsConfig(PORT_Type *base, uint32_t mask, const port_pin_config_t *config)
Sets the port PCR register for multiple pins.
This is an example to define input pins or output pins PCR configuration.
Define a digital input pin PCR configuration port_pin_config_t config = { kPORT_PullUp , kPORT_PullEnable, kPORT_FastSlewRate, kPORT_PassiveFilterDisable, kPORT_OpenDrainDisable, kPORT_LowDriveStrength, kPORT_MuxAsGpio, kPORT_UnlockRegister, };
- Parameters:
base – PORT peripheral base pointer.
mask – PORT pin number macro.
config – PORT PCR register configuration structure.
-
static inline void PORT_SetMultipleInterruptPinsConfig(PORT_Type *base, uint32_t mask, port_interrupt_t config)
Sets the port interrupt configuration in PCR register for multiple pins.
- Parameters:
base – PORT peripheral base pointer.
mask – PORT pin number macro.
config – PORT pin interrupt configuration.
#kPORT_InterruptOrDMADisabled: Interrupt/DMA request disabled.
#kPORT_DMARisingEdge : DMA request on rising edge(if the DMA requests exit).
#kPORT_DMAFallingEdge: DMA request on falling edge(if the DMA requests exit).
#kPORT_DMAEitherEdge : DMA request on either edge(if the DMA requests exit).
#kPORT_FlagRisingEdge : Flag sets on rising edge(if the Flag states exit).
#kPORT_FlagFallingEdge : Flag sets on falling edge(if the Flag states exit).
#kPORT_FlagEitherEdge : Flag sets on either edge(if the Flag states exit).
#kPORT_InterruptLogicZero : Interrupt when logic zero.
#kPORT_InterruptRisingEdge : Interrupt on rising edge.
#kPORT_InterruptFallingEdge: Interrupt on falling edge.
#kPORT_InterruptEitherEdge : Interrupt on either edge.
#kPORT_InterruptLogicOne : Interrupt when logic one.
#kPORT_ActiveHighTriggerOutputEnable : Enable active high-trigger output (if the trigger states exit).
#kPORT_ActiveLowTriggerOutputEnable : Enable active low-trigger output (if the trigger states exit)..
-
static inline void PORT_SetPinMux(PORT_Type *base, uint32_t pin, port_mux_t mux)
Configures the pin muxing.
Note
: This function is NOT recommended to use together with the PORT_SetPinsConfig, because the PORT_SetPinsConfig need to configure the pin mux anyway (Otherwise the pin mux is reset to zero : kPORT_PinDisabledOrAnalog). This function is recommended to use to reset the pin mux
- Parameters:
base – PORT peripheral base pointer.
pin – PORT pin number.
mux – pin muxing slot selection.
kPORT_PinDisabledOrAnalog: Pin disabled or work in analog function.
kPORT_MuxAsGpio : Set as GPIO.
kPORT_MuxAlt2 : chip-specific.
kPORT_MuxAlt3 : chip-specific.
kPORT_MuxAlt4 : chip-specific.
kPORT_MuxAlt5 : chip-specific.
kPORT_MuxAlt6 : chip-specific.
kPORT_MuxAlt7 : chip-specific.
-
static inline void PORT_EnablePinsDigitalFilter(PORT_Type *base, uint32_t mask, bool enable)
Enables the digital filter in one port, each bit of the 32-bit register represents one pin.
- Parameters:
base – PORT peripheral base pointer.
mask – PORT pin number macro.
enable – PORT digital filter configuration.
-
static inline void PORT_SetDigitalFilterConfig(PORT_Type *base, const port_digital_filter_config_t *config)
Sets the digital filter in one port, each bit of the 32-bit register represents one pin.
- Parameters:
base – PORT peripheral base pointer.
config – PORT digital filter configuration structure.
-
static inline void PORT_SetPinDriveStrength(PORT_Type *base, uint32_t pin, uint8_t strength)
Configures the port pin drive strength.
- Parameters:
base – PORT peripheral base pointer.
pin – PORT pin number.
strength – PORT pin drive strength
kPORT_LowDriveStrength = 0U - Low-drive strength is configured.
kPORT_HighDriveStrength = 1U - High-drive strength is configured.
-
static inline void PORT_EnablePinDoubleDriveStrength(PORT_Type *base, uint32_t pin, bool enable)
Enables the port pin double drive strength.
- Parameters:
base – PORT peripheral base pointer.
pin – PORT pin number.
enable – PORT pin drive strength configuration.
-
static inline void PORT_SetPinPullValue(PORT_Type *base, uint32_t pin, uint8_t value)
Configures the port pin pull value.
- Parameters:
base – PORT peripheral base pointer.
pin – PORT pin number.
value – PORT pin pull value
kPORT_LowPullResistor = 0U - Low internal pull resistor value is selected.
kPORT_HighPullResistor = 1U - High internal pull resistor value is selected.
-
static inline uint32_t PORT_GetEFTDetectFlags(PORT_Type *base)
Get EFT detect flags.
- Parameters:
base – PORT peripheral base pointer
- Returns:
EFT detect flags
-
static inline void PORT_EnableEFTDetectInterrupts(PORT_Type *base, uint32_t interrupt)
Enable EFT detect interrupts.
- Parameters:
base – PORT peripheral base pointer
interrupt – EFT detect interrupt
-
static inline void PORT_DisableEFTDetectInterrupts(PORT_Type *base, uint32_t interrupt)
Disable EFT detect interrupts.
- Parameters:
base – PORT peripheral base pointer
interrupt – EFT detect interrupt
-
static inline void PORT_ClearAllLowEFTDetectors(PORT_Type *base)
Clear all low EFT detector.
Note
: Port B and Port C pins share the same EFT detector clear control from PORTC_EDCR register. Any write to the PORTB_EDCR does not take effect.
- Parameters:
base – PORT peripheral base pointer
interrupt – EFT detect interrupt
-
static inline void PORT_ClearAllHighEFTDetectors(PORT_Type *base)
Clear all high EFT detector.
- Parameters:
base – PORT peripheral base pointer
interrupt – EFT detect interrupt
-
FSL_PORT_DRIVER_VERSION
PORT driver version.
-
enum _port_pull
Internal resistor pull feature selection.
Values:
-
enumerator kPORT_PullDisable
Internal pull-up/down resistor is disabled.
-
enumerator kPORT_PullDown
Internal pull-down resistor is enabled.
-
enumerator kPORT_PullUp
Internal pull-up resistor is enabled.
-
enumerator kPORT_PullDisable
-
enum _port_pull_value
Internal resistor pull value selection.
Values:
-
enumerator kPORT_LowPullResistor
Low internal pull resistor value is selected.
-
enumerator kPORT_HighPullResistor
High internal pull resistor value is selected.
-
enumerator kPORT_LowPullResistor
-
enum _port_slew_rate
Slew rate selection.
Values:
-
enumerator kPORT_FastSlewRate
Fast slew rate is configured.
-
enumerator kPORT_SlowSlewRate
Slow slew rate is configured.
-
enumerator kPORT_FastSlewRate
-
enum _port_open_drain_enable
Open Drain feature enable/disable.
Values:
-
enumerator kPORT_OpenDrainDisable
Open drain output is disabled.
-
enumerator kPORT_OpenDrainEnable
Open drain output is enabled.
-
enumerator kPORT_OpenDrainDisable
-
enum _port_passive_filter_enable
Passive filter feature enable/disable.
Values:
-
enumerator kPORT_PassiveFilterDisable
Passive input filter is disabled.
-
enumerator kPORT_PassiveFilterEnable
Passive input filter is enabled.
-
enumerator kPORT_PassiveFilterDisable
-
enum _port_drive_strength
Configures the drive strength.
Values:
-
enumerator kPORT_LowDriveStrength
Low-drive strength is configured.
-
enumerator kPORT_HighDriveStrength
High-drive strength is configured.
-
enumerator kPORT_LowDriveStrength
-
enum _port_drive_strength1
Configures the drive strength1.
Values:
-
enumerator kPORT_NormalDriveStrength
Normal drive strength
-
enumerator kPORT_DoubleDriveStrength
Double drive strength
-
enumerator kPORT_NormalDriveStrength
-
enum _port_input_buffer
input buffer disable/enable.
Values:
-
enumerator kPORT_InputBufferDisable
Digital input is disabled
-
enumerator kPORT_InputBufferEnable
Digital input is enabled
-
enumerator kPORT_InputBufferDisable
-
enum _port_invet_input
Digital input is not inverted or it is inverted.
Values:
-
enumerator kPORT_InputNormal
Digital input is not inverted
-
enumerator kPORT_InputInvert
Digital input is inverted
-
enumerator kPORT_InputNormal
-
enum _port_lock_register
Unlock/lock the pin control register field[15:0].
Values:
-
enumerator kPORT_UnlockRegister
Pin Control Register fields [15:0] are not locked.
-
enumerator kPORT_LockRegister
Pin Control Register fields [15:0] are locked.
-
enumerator kPORT_UnlockRegister
-
enum _port_mux
Pin mux selection.
Values:
-
enumerator kPORT_PinDisabledOrAnalog
Corresponding pin is disabled, but is used as an analog pin.
-
enumerator kPORT_MuxAsGpio
Corresponding pin is configured as GPIO.
-
enumerator kPORT_MuxAlt0
Chip-specific
-
enumerator kPORT_MuxAlt1
Chip-specific
-
enumerator kPORT_MuxAlt2
Chip-specific
-
enumerator kPORT_MuxAlt3
Chip-specific
-
enumerator kPORT_MuxAlt4
Chip-specific
-
enumerator kPORT_MuxAlt5
Chip-specific
-
enumerator kPORT_MuxAlt6
Chip-specific
-
enumerator kPORT_MuxAlt7
Chip-specific
-
enumerator kPORT_MuxAlt8
Chip-specific
-
enumerator kPORT_MuxAlt9
Chip-specific
-
enumerator kPORT_MuxAlt10
Chip-specific
-
enumerator kPORT_MuxAlt11
Chip-specific
-
enumerator kPORT_MuxAlt12
Chip-specific
-
enumerator kPORT_MuxAlt13
Chip-specific
-
enumerator kPORT_MuxAlt14
Chip-specific
-
enumerator kPORT_MuxAlt15
Chip-specific
-
enumerator kPORT_PinDisabledOrAnalog
-
enum _port_digital_filter_clock_source
Digital filter clock source selection.
Values:
-
enumerator kPORT_BusClock
Digital filters are clocked by the bus clock.
-
enumerator kPORT_LpoClock
Digital filters are clocked by the 1 kHz LPO clock.
-
enumerator kPORT_BusClock
-
enum _port_voltage_range
PORT voltage range.
Values:
-
enumerator kPORT_VoltageRange1Dot71V_3Dot6V
Port voltage range is 1.71 V - 3.6 V.
-
enumerator kPORT_VoltageRange2Dot70V_3Dot6V
Port voltage range is 2.70 V - 3.6 V.
-
enumerator kPORT_VoltageRange1Dot71V_3Dot6V
-
typedef enum _port_mux port_mux_t
Pin mux selection.
-
typedef enum _port_digital_filter_clock_source port_digital_filter_clock_source_t
Digital filter clock source selection.
-
typedef struct _port_digital_filter_config port_digital_filter_config_t
PORT digital filter feature configuration definition.
-
typedef struct _port_pin_config port_pin_config_t
PORT pin configuration structure.
-
typedef struct _port_version_info port_version_info_t
PORT version information.
-
typedef enum _port_voltage_range port_voltage_range_t
PORT voltage range.
-
FSL_COMPONENT_ID
-
struct _port_digital_filter_config
- #include <fsl_port.h>
PORT digital filter feature configuration definition.
Public Members
-
uint32_t digitalFilterWidth
Set digital filter width
-
port_digital_filter_clock_source_t clockSource
Set digital filter clockSource
-
uint32_t digitalFilterWidth
-
struct _port_pin_config
- #include <fsl_port.h>
PORT pin configuration structure.
Public Members
-
uint16_t pullSelect
No-pull/pull-down/pull-up select
-
uint16_t pullValueSelect
Pull value select
-
uint16_t slewRate
Fast/slow slew rate Configure
-
uint16_t passiveFilterEnable
Passive filter enable/disable
-
uint16_t openDrainEnable
Open drain enable/disable
-
uint16_t driveStrength
Fast/slow drive strength configure
-
uint16_t driveStrength1
Normal/Double drive strength enable/disable
-
uint16_t inputBuffer
Input Buffer Configure
-
uint16_t invertInput
Invert Input Configure
-
uint16_t lockRegister
Lock/unlock the PCR field[15:0]
-
uint16_t pullSelect
-
struct _port_version_info
- #include <fsl_port.h>
PORT version information.
Public Members
-
uint16_t feature
Feature Specification Number.
-
uint8_t minor
Minor Version Number.
-
uint8_t major
Major Version Number.
-
uint16_t feature
POWER Driver
Values:
-
enumerator kStatus_POWER_MuTransferError
Fail due to Mu transfer error.
-
enumerator kStatus_POWER_RequestNotAllowed
Request not allowed by another core.
-
enumerator kStatus_Power_HandleDuplicated
Handle already be created.
-
enumerator kStatus_POWER_MuTransferError
-
enum _power_low_power_mode
The enumeration of low power modes.
Values:
-
enumerator kPower_Sleep
Sleep Mode.
-
enumerator kPower_DeepSleep
Deep Sleep Mode.
-
enumerator kPower_PowerDown1
Power Down Mode 1.
-
enumerator kPower_PowerDown2
Power Down Mode 2.
-
enumerator kPower_DeepPowerDown1
Deep Power Down Mode 1.
-
enumerator kPower_DeepPowerDown2
Deep Power Down Mode 2.
-
enumerator kPower_DeepPowerDown3
Deep Power Down Mode 3.
-
enumerator kPower_ShutDown
ShutDown Mode
-
enumerator kPower_Active
Active Mode.
-
enumerator kPower_Sleep
-
enum _power_wakeup_source
The enumeration of wakeup sources for different low power modes.
Values:
-
enumerator kPower_WS_Main_RtcAlarm0
RTC Alarm0 as wakeup source, only wakeup Main Domain
-
enumerator kPower_WS_Aon_RtcAlarm0
RTC Alarm0 as wakeup source, only wakeup AON Domain
-
enumerator kPower_WS_Both_RtcAlarm0
RTC Alarm0 as wakeup source, wakeup both Main and AON Domains
-
enumerator kPower_WS_Main_RtcAlarm1
RTC Alarm1 as wakeup source, only wakeup Main Domain
-
enumerator kPower_WS_Aon_RtcAlarm1
RTC Alarm1 as wakeup source, only wakeup AON Domain
-
enumerator kPower_WS_Both_RtcAlarm1
RTC Alarm1 as wakeup source, wakeup both Main and AON Domains
-
enumerator kPower_WS_Main_QTimerIrq
QTimer IRQ as wakeup source, only wakeup Main Domain
-
enumerator kPower_WS_Aon_QTimerIrq
QTimer IRQ as wakeup source, only wakeup AON Domain
-
enumerator kPower_WS_Both_QTimerIrq
QTimer IRQ as wakeup source, wakeup both Main and AON Domains
-
enumerator kPower_WS_Main_RtcWDT
RTC watch dog as wakeup source, only wakeup Main Domain
-
enumerator kPower_WS_Aon_RtcWDT
RTC watch dog as wakeup source, only wakeup AON Domain
-
enumerator kPower_WS_Both_RtcWDT
RTC watch dog as wakeup source, wakeup both Main and AON Domains
-
enumerator kPower_WS_Main_RtcXtalFail
RTC XTAL fail as wakeup source, only wakeup Main Domain
-
enumerator kPower_WS_Aon_RtcXtalFail
RTC XTAL fail as wakeup source, only wakeup AON Domain
-
enumerator kPower_WS_Both_RtcXtalFail
RTC XTAL fail as wakeup source, wakeup both Main and AON Domains
-
enumerator kPower_WS_Main_ExternalINTFallEdge
External INT falling edge as wakeup source, only wakeup Main Domain
-
enumerator kPower_WS_Aon_ExternalINTFallEdge
External INT falling edge as wakeup source, only wakeup AON Domain
-
enumerator kPower_WS_Both_ExternalINTFallEdge
External INT falling edge as wakeup source, wakeup both Main and AON Domains
-
enumerator kPower_WS_Main_ExternalINTRiseEdge
External INT rising edge as wakeup source, only wakeup Main Domain
-
enumerator kPower_WS_Aon_ExternalINTRiseEdge
External INT rising edge as wakeup source, only wakeup AON Domain
-
enumerator kPower_WS_Both_ExternalINTRiseEdge
External INT rising edge as wakeup source, wakeup both Main and AON Domains
-
enumerator kPower_WS_Main_SMMTimer
Deep sleep counter as wakeup source, only wakeup Main Domain
-
enumerator kPower_WS_Aon_SMMTimer
Deep sleep counter as wakeup source, only wakeup AON Domain
-
enumerator kPower_WS_Both_SMMTimer
Deep sleep counter as wakeup source, wakeup both Main and AON Domains
-
enumerator kPower_WS_Main_Comparator
Voltage comparator as wakeup source, only wakeup Main Domain
-
enumerator kPower_WS_Aon_Comparator
Voltage comparator as wakeup source, only wakeup AON Domain
-
enumerator kPower_WS_Both_Comparator
Voltage comparator as wakeup source, wakeup both Main and AON Domains
-
enumerator kPower_WS_Main_AonHsGpioWakeup0
HS_GPIO wakeup0 as wakeup source, only wakeup Main Domain
-
enumerator kPower_WS_Aon_AonHsGpioWakeup0
HS_GPIO wakeup0 as wakeup source, only wakeup AON Domain
-
enumerator kPower_WS_Both_AonHsGpioWakeup0
HS_GPIO wakeup0 as wakeup source, wakeup both Main and AON Domains
-
enumerator kPower_WS_Main_Lpuart0
LPUART0 Interrupt as wakeup source, only wakeup Main Domain
-
enumerator kPower_WS_Aon_Lpuart0
LPUART0 Interrupt as wakeup source, only wakeup AON Domain
-
enumerator kPower_WS_Both_Lpuart0
LPUART0 Interrupt as wakeup source, wakeup both Main and AON Domains
-
enumerator kPower_WS_Main_AdvcOrACMP
ADVC or ACMP as wakeup source, only wakeup Main Domain
-
enumerator kPower_WS_Aon_AdvcOrACMP
ADVC or ACMP as wakeup source, only wakeup AON Domain
-
enumerator kPower_WS_Both_AdvcOrACMP
ADVC or ACMP as wakeup source, wakeup both Main and AON Domains
-
enumerator kPower_WS_Main_Lpi2cInt
AON Lpi2c interrupt as wakeup source, only wakeup Main Domain
-
enumerator kPower_WS_Aon_Lpi2cInt
AON Lpi2c interrupt as wakeup source, only wakeup AON Domain
-
enumerator kPower_WS_Both_Lpi2cInt
AON Lpi2c interrupt as wakeup source, wakeup both Main and AON Domains
-
enumerator kPower_WS_Main_AdcInt
ADC interrupt as wakeup source, only wakeup Main Domain
-
enumerator kPower_WS_Aon_AdcInt
ADC interrupt as wakeup source, only wakeup AON Domain
-
enumerator kPower_WS_Both_AdcInt
ADC interrupt as wakeup source, wakeup both Main and AON Domains
-
enumerator kPower_WS_Main_LptmrInt
LPTMR interrupt as wakeup source, only wakeup Main Domain
-
enumerator kPower_WS_Aon_LptmrInt
LPTMR interrupt as wakeup source, only wakeup AON Domain
-
enumerator kPower_WS_Both_LptmrInt
LPTMR interrupt as wakeup source, wakeup both Main and AON Domains
-
enumerator kPower_WS_Main_TamperDetect
Tamper detect as wakeup source, only wakeup Main Domain
-
enumerator kPower_WS_Aon_TamperDetect
Tamper detect as wakeup source, only wakeup AON Domain
-
enumerator kPower_WS_Both_TamperDetect
Tamper detect as wakeup source, wakeup both Main and AON Domains
-
enumerator kPower_WS_Main_LcdInt
LCD interrupt as wakeup source, only wakeup Main Domain
-
enumerator kPower_WS_Aon_LcdInt
LCD interrupt as wakeup source, only wakeup AON Domain
-
enumerator kPower_WS_Both_LcdInt
LCD interrupt as wakeup source, wakeup both Main and AON Domains
-
enumerator kPower_WS_Main_P0_0RiseEdgeInt
Pin P0_0 rising edge interrupt as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P0_0RiseEdgeDma
Pin P0_0 rising edge DMA request as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P0_0RiseEdgeTrig
Pin P0_0 rising edge trigger as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P0_0FallEdgeInt
Pin P0_0 falling edge interrupt as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P0_0FallEdgeDma
Pin P0_0 falling edge DMA request as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P0_0FallEdgeTrig
Pin P0_0 falling edge trigger as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P0_0AnyEdgeInt
Pin P0_0 any edge interrupt as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P0_0AnyEdgeDma
Pin P0_0 any edge DMA request as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P0_0AnyEdgeTrig
Pin P0_0 any edge interrupt as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P0_15RiseEdgeInt
Pin P0_15 rising edge interrupt as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P0_15RiseEdgeDma
Pin P0_15 rising edge DMA request as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P0_15RiseEdgeTrig
Pin P0_15 rising edge trigger as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P0_15FallEdgeInt
Pin P0_15 falling edge interrupt as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P0_15FallEdgeDma
Pin P0_15 falling edge DMA request as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P0_15FallEdgeTrig
Pin P0_15 falling edge trigger as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P0_15AnyEdgeInt
Pin P0_15 any edge interrupt as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P0_15AnyEdgeDma
Pin P0_15 any edge DMA request as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P0_15AnyEdgeTrig
Pin P0_15 any edge interrupt as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P1_16RiseEdgeInt
Pin P1_16 rising edge interrupt as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P1_16RiseEdgeDma
Pin P1_16 rising edge DMA request as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P1_16RiseEdgeTrig
Pin P1_16 rising edge trigger as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P1_16FallEdgeInt
Pin P1_16 falling edge interrupt as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P1_16FallEdgeDma
Pin P1_16 falling edge DMA request as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P1_16FallEdgeTrig
Pin P1_16 falling edge trigger as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P1_16AnyEdgeInt
Pin P1_16 any edge interrupt as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P1_16AnyEdgeDma
Pin P1_16 any edge DMA request as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P1_16AnyEdgeTrig
Pin P1_16 any edge interrupt as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P1_17RiseEdgeInt
Pin P1_17 rising edge interrupt as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P1_17RiseEdgeDma
Pin P1_17 rising edge DMA request as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P1_17RiseEdgeTrig
Pin P1_17 rising edge trigger as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P1_17FallEdgeInt
Pin P1_17 falling edge interrupt as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P1_17FallEdgeDma
Pin P1_17 falling edge DMA request as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P1_17FallEdgeTrig
Pin P1_17 falling edge trigger as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P1_17AnyEdgeInt
Pin P1_17 any edge interrupt as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P1_17AnyEdgeDma
Pin P1_17 any edge DMA request as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P1_17AnyEdgeTrig
Pin P1_17 any edge interrupt as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P0_20RiseEdgeInt
Pin P0_20 rising edge interrupt as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P0_20RiseEdgeDma
Pin P0_20 rising edge DMA request as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P0_20RiseEdgeTrig
Pin P0_20 rising edge trigger as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P0_20FallEdgeInt
Pin P0_20 falling edge interrupt as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P0_20FallEdgeDma
Pin P0_20 falling edge DMA request as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P0_20FallEdgeTrig
Pin P0_20 falling edge trigger as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P0_20AnyEdgeInt
Pin P0_20 any edge interrupt as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P0_20AnyEdgeDma
Pin P0_20 any edge DMA request as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P0_20AnyEdgeTrig
Pin P0_20 any edge interrupt as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P0_23RiseEdgeInt
Pin P0_23 rising edge interrupt as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P0_23RiseEdgeDma
Pin P0_23 rising edge DMA request as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P0_23RiseEdgeTrig
Pin P0_23 rising edge trigger as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P0_23FallEdgeInt
Pin P0_23 falling edge interrupt as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P0_23FallEdgeDma
Pin P0_23 falling edge DMA request as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P0_23FallEdgeTrig
Pin P0_23 falling edge trigger as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P0_23AnyEdgeInt
Pin P0_23 any edge interrupt as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P0_23AnyEdgeDma
Pin P0_23 any edge DMA request as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P0_23AnyEdgeTrig
Pin P0_23 any edge interrupt as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P0_3RiseEdgeInt
Pin P0_3 rising edge interrupt as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P0_3RiseEdgeDma
Pin P0_3 rising edge DMA request as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P0_3RiseEdgeTrig
Pin P0_3 rising edge trigger as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P0_3FallEdgeInt
Pin P0_3 falling edge interrupt as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P0_3FallEdgeDma
Pin P0_3 falling edge DMA request as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P0_3FallEdgeTrig
Pin P0_3 falling edge trigger as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P0_3AnyEdgeInt
Pin P0_3 any edge interrupt as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P0_3AnyEdgeDma
Pin P0_3 any edge DMA request as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P0_3AnyEdgeTrig
Pin P0_3 any edge interrupt as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P0_4RiseEdgeInt
Pin P0_4 rising edge interrupt as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P0_4RiseEdgeDma
Pin P0_4 rising edge DMA request as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P0_4RiseEdgeTrig
Pin P0_4 rising edge trigger as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P0_4FallEdgeInt
Pin P0_4 falling edge interrupt as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P0_4FallEdgeDma
Pin P0_4 falling edge DMA request as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P0_4FallEdgeTrig
Pin P0_4 falling edge trigger as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P0_4AnyEdgeInt
Pin P0_4 any edge interrupt as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P0_4AnyEdgeDma
Pin P0_4 any edge DMA request as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P0_4AnyEdgeTrig
Pin P0_4 any edge interrupt as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P0_13RiseEdgeInt
Pin P0_13 rising edge interrupt as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P0_13RiseEdgeDma
Pin P0_13 rising edge DMA request as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P0_13RiseEdgeTrig
Pin P0_13 rising edge trigger as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P0_13FallEdgeInt
Pin P0_13 falling edge interrupt as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P0_13FallEdgeDma
Pin P0_13 falling edge DMA request as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P0_13FallEdgeTrig
Pin P0_13 falling edge trigger as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P0_13AnyEdgeInt
Pin P0_13 any edge interrupt as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P0_13AnyEdgeDma
Pin P0_13 any edge DMA request as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P0_13AnyEdgeTrig
Pin P0_13 any edge interrupt as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P1_13RiseEdgeInt
Pin P1_13 rising edge interrupt as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P1_13RiseEdgeDma
Pin P1_13 rising edge DMA request as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P1_13RiseEdgeTrig
Pin P1_13 rising edge trigger as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P1_13FallEdgeInt
Pin P1_13 falling edge interrupt as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P1_13FallEdgeDma
Pin P1_13 falling edge DMA request as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P1_13FallEdgeTrig
Pin P1_13 falling edge trigger as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P1_13AnyEdgeInt
Pin P1_13 any edge interrupt as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P1_13AnyEdgeDma
Pin P1_13 any edge DMA request as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P1_13AnyEdgeTrig
Pin P1_13 any edge interrupt as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P1_1RiseEdgeInt
Pin P1_1 rising edge interrupt as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P1_1RiseEdgeDma
Pin P1_1 rising edge DMA request as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P1_1RiseEdgeTrig
Pin P1_1 rising edge trigger as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P1_1FallEdgeInt
Pin P1_1 falling edge interrupt as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P1_1FallEdgeDma
Pin P1_1 falling edge DMA request as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P1_1FallEdgeTrig
Pin P1_1 falling edge trigger as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P1_1AnyEdgeInt
Pin P1_1 any edge interrupt as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P1_1AnyEdgeDma
Pin P1_1 any edge DMA request as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P1_1AnyEdgeTrig
Pin P1_1 any edge interrupt as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P1_2RiseEdgeInt
Pin P1_2 rising edge interrupt as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P1_2RiseEdgeDma
Pin P1_2 rising edge DMA request as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P1_2RiseEdgeTrig
Pin P1_2 rising edge trigger as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P1_2FallEdgeInt
Pin P1_2 falling edge interrupt as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P1_2FallEdgeDma
Pin P1_2 falling edge DMA request as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P1_2FallEdgeTrig
Pin P1_2 falling edge trigger as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P1_2AnyEdgeInt
Pin P1_2 any edge interrupt as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P1_2AnyEdgeDma
Pin P1_2 any edge DMA request as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P1_2AnyEdgeTrig
Pin P1_2 any edge interrupt as wakeup source, can be used to wakeup from DS mode.
-
enumerator kPower_WS_Main_P1_5RiseEdgeInt
P1_5 pin rising edge interrupt as wakeup source, wakeup Main Domain
-
enumerator kPower_WS_Main_P1_5RiseEdgeDma
P1_5 pin rising edge DMA as wakeup source, wakeup Main Domain
-
enumerator kPower_WS_Main_P1_5RiseEdgeTrig
P1_5 pin rising edge trigger as wakeup source, wakeup Main Domain
-
enumerator kPower_WS_Main_P1_5FallEdgeInt
P1_5 pin falling edge interrupt as wakeup source, wakeup Main Domain
-
enumerator kPower_WS_Main_P1_5FallEdgeDma
P1_5 pin falling edge DMA as wakeup source, wakeup Main Domain
-
enumerator kPower_WS_Main_P1_5FallEdgeTrig
P1_5 pin falling edge trigger as wakeup source, wakeup Main Domain
-
enumerator kPower_WS_Main_P1_5AnyEdgeInt
P1_5 pin any edge interrupt as wakeup source, wakeup Main Domain
-
enumerator kPower_WS_Main_P1_5AnyEdgeDma
P1_5 pin any edge DMA as wakeup source, wakeup Main Domain
-
enumerator kPower_WS_Main_P1_5AnyEdgeTrig
P1_5 pin any edge trigger as wakeup source, wakeup Main Domain
-
enumerator kPower_WS_Main_P1_14RiseEdgeInt
P1_14 pin rising edge interrupt as wakeup source, wakeup Main Domain
-
enumerator kPower_WS_Main_P1_14RiseEdgeDma
P1_14 pin rising edge DMA as wakeup source, wakeup Main Domain
-
enumerator kPower_WS_Main_P1_14RiseEdgeTrig
P1_14 pin rising edge trigger as wakeup source, wakeup Main Domain
-
enumerator kPower_WS_Main_P1_14FallEdgeInt
P1_14 pin falling edge interrupt as wakeup source, wakeup Main Domain
-
enumerator kPower_WS_Main_P1_14FallEdgeDma
P1_14 pin falling edge DMA as wakeup source, wakeup Main Domain
-
enumerator kPower_WS_Main_P1_14FallEdgeTrig
P1_14 pin falling edge trigger as wakeup source, wakeup Main Domain
-
enumerator kPower_WS_Main_P1_14AnyEdgeInt
P1_14 pin any edge interrupt as wakeup source, wakeup Main Domain
-
enumerator kPower_WS_Main_P1_14AnyEdgeDma
P1_14 pin any edge DMA as wakeup source, wakeup Main Domain
-
enumerator kPower_WS_Main_P1_14AnyEdgeTrig
P1_14 pin any edge trigger as wakeup source, wakeup Main Domain
-
enumerator kPower_WS_Main_P1_19RiseEdgeInt
P1_19 pin rising edge interrupt as wakeup source, wakeup Main Domain
-
enumerator kPower_WS_Main_P1_19RiseEdgeDma
P1_19 pin rising edge DMA as wakeup source, wakeup Main Domain
-
enumerator kPower_WS_Main_P1_19RiseEdgeTrig
P1_19 pin rising edge trigger as wakeup source, wakeup Main Domain
-
enumerator kPower_WS_Main_P1_19FallEdgeInt
P1_19 pin falling edge interrupt as wakeup source, wakeup Main Domain
-
enumerator kPower_WS_Main_P1_19FallEdgeDma
P1_19 pin falling edge DMA as wakeup source, wakeup Main Domain
-
enumerator kPower_WS_Main_P1_19FallEdgeTrig
P1_19 pin falling edge trigger as wakeup source, wakeup Main Domain
-
enumerator kPower_WS_Main_P1_19AnyEdgeInt
P1_19 pin any edge interrupt as wakeup source, wakeup Main Domain
-
enumerator kPower_WS_Main_P1_19AnyEdgeDma
P1_19 pin any edge DMA as wakeup source, wakeup Main Domain
-
enumerator kPower_WS_Main_P1_19AnyEdgeTrig
P1_19 pin any edge trigger as wakeup source, wakeup Main Domain
-
enumerator kPower_WS_Main_P1_23RiseEdgeInt
P1_23 pin rising edge interrupt as wakeup source, wakeup Main Domain
-
enumerator kPower_WS_Main_P1_23RiseEdgeDma
P1_23 pin rising edge DMA as wakeup source, wakeup Main Domain
-
enumerator kPower_WS_Main_P1_23RiseEdgeTrig
P1_23 pin rising edge trigger as wakeup source, wakeup Main Domain
-
enumerator kPower_WS_Main_P1_23FallEdgeInt
P1_23 pin falling edge interrupt as wakeup source, wakeup Main Domain
-
enumerator kPower_WS_Main_P1_23FallEdgeDma
P1_23 pin falling edge DMA as wakeup source, wakeup Main Domain
-
enumerator kPower_WS_Main_P1_23FallEdgeTrig
P1_23 pin falling edge trigger as wakeup source, wakeup Main Domain
-
enumerator kPower_WS_Main_P1_23AnyEdgeInt
P1_23 pin any edge interrupt as wakeup source, wakeup Main Domain
-
enumerator kPower_WS_Main_P1_23AnyEdgeDma
P1_23 pin any edge DMA as wakeup source, wakeup Main Domain
-
enumerator kPower_WS_Main_P1_23AnyEdgeTrig
P1_23 pin any edge trigger as wakeup source, wakeup Main Domain
-
enumerator kPower_WS_Main_P1_22RiseEdgeInt
P1_22 pin rising edge interrupt as wakeup source, wakeup Main Domain
-
enumerator kPower_WS_Main_P1_22RiseEdgeDma
P1_22 pin rising edge DMA as wakeup source, wakeup Main Domain
-
enumerator kPower_WS_Main_P1_22RiseEdgeTrig
P1_22 pin rising edge trigger as wakeup source, wakeup Main Domain
-
enumerator kPower_WS_Main_P1_22FallEdgeInt
P1_22 pin falling edge interrupt as wakeup source, wakeup Main Domain
-
enumerator kPower_WS_Main_P1_22FallEdgeDma
P1_22 pin falling edge DMA as wakeup source, wakeup Main Domain
-
enumerator kPower_WS_Main_P1_22FallEdgeTrig
P1_22 pin falling edge trigger as wakeup source, wakeup Main Domain
-
enumerator kPower_WS_Main_P1_22AnyEdgeInt
P1_22 pin any edge interrupt as wakeup source, wakeup Main Domain
-
enumerator kPower_WS_Main_P1_22AnyEdgeDma
P1_22 pin any edge DMA as wakeup source, wakeup Main Domain
-
enumerator kPower_WS_Main_P1_22AnyEdgeTrig
P1_22 pin any edge trigger as wakeup source, wakeup Main Domain
-
enumerator kPower_WS_Main_Lptmr0Int
LPTMR0 interrupt as wakeup source, wakeup Main Domain
-
enumerator kPower_WS_Main_Cmp0Int
CMP0 interrupt as wakeup source, wakeup Main Domain
-
enumerator kPower_WS_Main_Lptmr0Dma
LPTMR0 DMA as wakeup source, wakeup Main Domain
-
enumerator kPower_WS_Main_Lptmr0Trig
LPTMR0 trigger as wakeup source, wakeup Main Domain
-
enumerator kPower_WS_Main_Cmp0DMA
CMP0 DMA as wakeup source, wakeup Main Domain
-
enumerator kPower_WS_Main_RtcAlarm0
-
enum _power_main_domain_sram_array
-
Values:
-
enumerator kPower_MainDomainRamX0
Main Domain RAM X0, bitmask representation for power control
-
enumerator kPower_MainDomainRamX1
Main Domain RAM X1, bitmask representation for power control
-
enumerator kPower_MainDomainRamA0
Main Domain RAM A0, bitmask representation for power control
-
enumerator kPower_MainDomainRamA1
Main Domain RAM A1, bitmask representation for power control
-
enumerator kPower_MainDomainRamA2
Main Domain RAM A2, bitmask representation for power control
-
enumerator kPower_MainDomainRamA3
Main Domain RAM A3, bitmask representation for power control
-
enumerator kPower_MainDomainRamB0
Main Domain RAM B0, bitmask representation for power control
-
enumerator kPower_MainDomainRamB1
Main Domain RAM B1, bitmask representation for power control
-
enumerator kPower_MainDomainRamB2ToB4
Main Domain RAM B2 to B4, bitmask representation for power control
-
enumerator kPower_MainDomainAllRams
Represents all RAMs in the Main Domain, bitmask for power control
-
enumerator kPower_MainDomainRamX0
-
enum _power_aon_domain_sram_array
-
Values:
-
enumerator kPower_AonDomainRam1stHalf16kB
First half (16kB) of AON Domain RAM, bitmask for power control
-
enumerator kPower_AonDomainRam2nd8kB
Second 8kB of AON Domain RAM, bitmask for power control
-
enumerator kPower_AonDomainRamLower8kB
Lower 8kB of AON Domain RAM, bitmask for power control
-
enumerator kPower_AonDomainAllRams
Represents all RAMs in the AON Domain, bitmask for power control
-
enumerator kPower_AonDomainRam1stHalf16kB
-
enum _power_mu_message_direction
Enumeration of power MU message directions.
Values:
-
enumerator kPower_MsgDirMainToAon
Message direction from Main to AON domain
-
enumerator kPower_MsgDirAonToMain
Message direction from AON to Main domain
-
enumerator kPower_MsgDirMainToAon
-
enum _power_mu_message_type
Enumeration of power MU message types.
Values:
-
enumerator kPower_MsgTypeRequest
Message type is a request
-
enumerator kPower_MsgTypeACK
Message type is an ACKnowledgment
-
enumerator kPower_MsgTypeNACK
Message type is a Negative ACKnowledgment
-
enumerator kPower_MsgTypeRequest
-
typedef enum _power_low_power_mode power_low_power_mode_t
The enumeration of low power modes.
-
typedef bool (*power_user_callback_t)(power_low_power_mode_t targetPowerMode, void *ptrPowerConfig, void *userData)
-
typedef enum _power_wakeup_source power_wakeup_source_t
The enumeration of wakeup sources for different low power modes.
-
typedef struct _power_wakeup_source_info power_wakeup_source_info_t
The structure of dumped wakeup source information.
-
typedef enum _power_mu_message_direction power_mu_message_direction_t
Enumeration of power MU message directions.
-
typedef enum _power_mu_message_type power_mu_message_type_t
Enumeration of power MU message types.
-
typedef union _power_mu_message power_mu_message_t
Union representing a power MU message.
-
typedef struct _power_ds_config power_ds_config_t
-
typedef struct _power_pd_config power_pd_config_t
Configuration structure for power down mode.
-
typedef power_pd_config_t power_dpd1_config_t
-
typedef struct _power_dpd2_config power_dpd2_config_t
Configuration structure for deep power down mode 2.
-
typedef struct _power_dpd3_config power_dpd3_config_t
-
typedef struct _power_sd_config power_sd_config_t
-
typedef struct _power_handle power_handle_t
Structure to handle power management operations.
-
status_t Power_CreateHandle(power_handle_t *handle, uint32_t muChannelId)
Create shared power handle.
- Parameters:
handle – [in] Pointer to a handle in type of power_handle_t, must be in shared RAM.
muChannelId – [in] MU channel ID used by power driver.
- Return values:
kStatus_POWER_MuTransferError – Something error occurs during MU transfer.
kStatus_Power_HandleDuplicated – Shared power handle already be created.
kStatus_Success – Created handle successfully.
-
FSL_POWER_DRIVER_VERSION
power driver version 2.0.0.
-
POWER_SHARED_RAM_BASE_ADDR
-
POWER_ENCODE_WS(cm33Ws, wuuExtPin, wakeupDomain, pinEdge, wuuEvent, wuuIndex, aonIndex)
Encode wakeup source code.
Note
bit 7 - 0: aon control bit index; bit 15 - 8: wuu control bit index; bit 19 - 16: wuu event(0: interrupt, 1: DMA request, 2: trigger event); bit 23 - 20: external pin edge(1: rising edge, 2: falling edge, 3: any edge); bit 27 - 24: Wakeup domain(0: only Main, 1: only Aon, 2: Both Main and Aon), in some low power mode(such as PD2) it is possible only wakeup Aon Domain. bit 30: external pin or internal module(0: internal module, 1: external pin); bit 31: wakeup source in aon domain or cm33 domain(0: In AON domain, 1: In CM33 domain).
-
POWER_DECODE_WS(wsCode)
-
POWER_DPD2_WS_BIT_MASK
-
POWER_DPD3_WS_BIT_MASK
-
POWER_SHUTDOWN_WS_BIT_MASK
-
void Power_EnableWakeupSource(power_wakeup_source_t ws)
Enable input wakeup source, once enabled it will be effective until disabled.
- Parameters:
ws – [in] Specify the coded wakeup source, please refer to power_wakeup_source_t for details.
-
void Power_DisableWakeupSource(power_wakeup_source_t ws)
Disable input wakeup source.
- Parameters:
ws – [in] Specify the coded wakeup source, please refer to power_wakeup_source_t for details.
-
void Power_DumpEnabledWakeSource(power_wakeup_source_info_t *ptrWsInfo)
Dump information of all configured wakeup sources, in type of power_wakeup_source_info_t.
- Parameters:
ptrWsInfo – [out] Pointer to the variable to store dumped wakeup source information.
-
void Power_GetWakeupSource(uint32_t *ptrWakeupSourceMask)
Get latest mask of wakeup sources which cause the wake-up to main CPU.
- Parameters:
ptrWakeupSourceMask – [out] Pointer to the variable to store mask of wakeup sources.
-
void Power_RegisterUserCallback(power_user_callback_t callback, void *userData)
Register user callback.
- Parameters:
callback – [in] Pointer to callback in type of power_user_callback_t.
userData – [in] Pointer to user data.
-
void Power_UnRegisterUserCallback(void)
Unregister user callback.
-
status_t Power_EnterLowPowerMode(power_low_power_mode_t lowpowerMode, void *config)
Enter selected low power mode.
- Parameters:
lowpowerMode – [in] Indicate specific low power mode.
config – Point to low power configurations.
- Return values:
kStatus_POWER_MuTransferError – Something error occurs during MU transfer.
kStatus_POWER_RequestNotAllowed – Request not allowed by another core.
-
status_t Power_EnterSleep(void)
Enter the sleep mode.
This function is used to put the system into sleep mode.
- Return values:
kStatus_Success – Successfully entered sleep mode.
kStatus_POWER_MuTransferError – Something error occurs during MU transfer.
kStatus_POWER_RequestNotAllowed – Request not allowed by another core.
-
status_t Power_EnterDeepSleep(power_ds_config_t *config)
Enter Deep Sleep mode.
This function attempts to put the system into Deep Sleep mode with the provided configuration.
- Parameters:
config – [in] Pointer to the Deep Sleep mode configuration.
- Return values:
kStatus_Success – Successfully entered Deep Sleep mode.
kStatus_POWER_MuTransferError – Something error occurs during MU transfer.
kStatus_POWER_RequestNotAllowed – Request not allowed by another core.
-
status_t Power_EnterPowerDown1(power_pd_config_t *config)
Enter Power Down 1 mode.
This function attempts to put the system into Power Down 1 mode with the provided configuration.
- Parameters:
config – [in] Pointer to the Power Down 1 mode configuration.
- Return values:
kStatus_Success – Successfully entered Power Down 1 mode.
kStatus_POWER_MuTransferError – Something error occurs during MU transfer.
kStatus_POWER_RequestNotAllowed – Request not allowed by another core.
-
status_t Power_EnterPowerDown2(power_pd_config_t *config)
Enter Power Down 2 mode.
This function attempts to put the system into Power Down 2 mode with the provided configuration.
- Parameters:
config – [in] Pointer to the Power Down 2 mode configuration.
- Return values:
kStatus_Success – Successfully entered Power Down 2 mode.
kStatus_POWER_MuTransferError – Something error occurs during MU transfer.
kStatus_POWER_RequestNotAllowed – Request not allowed by another core.
-
status_t Power_EnterDeepPowerDown1(power_dpd1_config_t *config)
Enter Deep Power Down 1 mode.
This function attempts to put the system into Deep Power Down 1 mode with the provided configuration.
- Parameters:
config – [in] Pointer to the Deep Power Down 1 mode configuration.
- Return values:
kStatus_Success – Successfully entered Deep Power Down 1 mode.
kStatus_POWER_MuTransferError – Something error occurs during MU transfer.
kStatus_POWER_RequestNotAllowed – Request not allowed by another core.
-
status_t Power_EnterDeepPowerDown2(power_dpd2_config_t *config)
Enter Deep Power Down 2 mode.
This function attempts to put the system into Deep Power Down 2 mode with the provided configuration.
- Parameters:
config – [in] Pointer to the Deep Power Down 2 mode configuration.
- Return values:
kStatus_Success – Successfully entered Deep Power Down 2 mode.
kStatus_POWER_MuTransferError – Something error occurs during MU transfer.
kStatus_POWER_RequestNotAllowed – Request not allowed by another core.
-
status_t Power_EnterDeepPowerDown3(power_dpd3_config_t *config)
Enter Deep Power Down 3 mode.
This function attempts to put the system into Deep Power Down 3 mode with the provided configuration.
- Parameters:
config – [in] Pointer to the Deep Power Down 3 mode configuration.
- Return values:
kStatus_Success – Successfully entered Deep Power Down 3 mode.
kStatus_POWER_MuTransferError – Something error occurs during MU transfer.
kStatus_POWER_RequestNotAllowed – Request not allowed by another core.
-
status_t Power_EnterShutDown(power_sd_config_t *config)
Enter Shutdown mode.
This function attempts to put the system into Shutdown mode with the provided configuration.
- Parameters:
config – [in] Pointer to the Shutdown mode configuration.
- Return values:
kStatus_Success – Successfully entered Shutdown mode.
kStatus_POWER_MuTransferError – Something error occurs during MU transfer.
kStatus_POWER_RequestNotAllowed – Request not allowed by another core.
-
void Power_MuMessageCallback(uint32_t message, uint32_t channelId)
Callback function for handling power MU messages.
This function is called when a power MU message is received. It processes the message based on the given message content and the channel ID.
- Parameters:
message – [in] The received power MU message.
channelId – [in] The ID of the channel on which the message was received.
- Return values:
None – This function does not return a value.
-
struct _power_wakeup_source_info
- #include <fsl_power.h>
The structure of dumped wakeup source information.
Public Members
-
uint32_t aonWakeupSourceMask
The mask of wakeup sources in AON domain.
-
uint32_t wuuPinIntEnable[2]
Information of enabled Pin interrupts.
-
uint32_t wuuModuleIntEnable
Information of enabled internal module interrupts.
-
uint32_t wuuModuleDmaTrigEnable
Information of enabled internal module DMA request/trigger.
-
uint32_t wuuPinDmaTrigConfig[2]
Information of enabled pin DMA request/trigger.
-
uint32_t aonWakeupSourceMask
-
union _power_mu_message
- #include <fsl_power.h>
Union representing a power MU message.
-
struct _power_ds_config
- #include <fsl_power.h>
-
struct _power_pd_config
- #include <fsl_power.h>
Configuration structure for power down mode.
Public Members
-
uint32_t mainRamArraysToRetain
Bitmask representing the main domain RAM arrays to retain during power down
-
bool disableBandgap
Flag to indicate whether to disable the bandgap during power down
-
uint32_t mainRamArraysToRetain
-
struct _power_dpd2_config
- #include <fsl_power.h>
Configuration structure for deep power down mode 2.
Public Members
-
uint32_t mainRamArraysToRetain
Bitmask representing the main domain RAM arrays to retain during DPD2 mode
-
uint8_t aonRamArraysToRetain
Bitmask representing the AON domain RAM arrays to retain during DPD2 mode
-
bool disableBandgap
Flag to indicate whether to disable the bandgap during DPD2 mode
-
bool switchToX32K
Flag to indicate whether to switch to X32K clock source during DPD2 mode
-
uint32_t mainRamArraysToRetain
-
struct _power_dpd3_config
- #include <fsl_power.h>
-
struct _power_sd_config
- #include <fsl_power.h>
-
struct _power_handle
- #include <fsl_power.h>
Structure to handle power management operations.
Public Members
-
uint32_t muChannelId
ID of the Message Unit (MU) channel used for power communication
-
power_low_power_mode_t curPowerMode
Current low power mode of the system
-
uint32_t lpConfig[2U]
Array of two 32-bit values for low power configuration
-
bool dualCoreSynced
Flag indicating whether dual cores are synchronized
-
bool requestCM33Start
Flag indicating whether a request to start CM33 core is made
-
uint32_t muChannelId
-
struct strcutFormat
Public Members
-
uint32_t syncCode
Synchronization code for the message
-
power_mu_message_type_t type
Type of the message, refer to power_mu_message_type_t
-
power_mu_message_direction_t direction
Direction of the message, refer to power_mu_message_direction_t
-
power_low_power_mode_t reqestLowPowerMode
Requested low power mode
-
bool init
Initialization flag
-
uint32_t sharedHandleAddrOff
Offset from shared ram base address
-
uint32_t syncCode
QTMR: Quad Timer Driver
-
void QTMR_Init(TMR_Type *base, qtmr_channel_selection_t channel, const qtmr_config_t *config)
Ungates the Quad Timer clock and configures the peripheral for basic operation.
Note
This API should be called at the beginning of the application using the Quad Timer driver.
- Parameters:
base – Quad Timer peripheral base address
channel – Quad Timer channel number
config – Pointer to user’s Quad Timer config structure
-
void QTMR_Deinit(TMR_Type *base, qtmr_channel_selection_t channel)
Stops the counter and gates the Quad Timer clock.
- Parameters:
base – Quad Timer peripheral base address
channel – Quad Timer channel number
-
void QTMR_GetDefaultConfig(qtmr_config_t *config)
Fill in the Quad Timer config struct with the default settings.
The default values are:
config->debugMode = kQTMR_RunNormalInDebug; config->enableExternalForce = false; config->enableMasterMode = false; config->faultFilterCount = 0; config->faultFilterPeriod = 0; config->primarySource = kQTMR_ClockDivide_2; config->secondarySource = kQTMR_Counter0InputPin;
- Parameters:
config – Pointer to user’s Quad Timer config structure.
-
void QTMR_EnableInterrupts(TMR_Type *base, qtmr_channel_selection_t channel, uint32_t mask)
Enables the selected Quad Timer interrupts.
- Parameters:
base – Quad Timer peripheral base address
channel – Quad Timer channel number
mask – The interrupts to enable. This is a logical OR of members of the enumeration qtmr_interrupt_enable_t
-
void QTMR_DisableInterrupts(TMR_Type *base, qtmr_channel_selection_t channel, uint32_t mask)
Disables the selected Quad Timer interrupts.
- Parameters:
base – Quad Timer peripheral base addres
channel – Quad Timer channel number
mask – The interrupts to enable. This is a logical OR of members of the enumeration qtmr_interrupt_enable_t
-
uint32_t QTMR_GetEnabledInterrupts(TMR_Type *base, qtmr_channel_selection_t channel)
Gets the enabled Quad Timer interrupts.
- Parameters:
base – Quad Timer peripheral base address
channel – Quad Timer channel number
- Returns:
The enabled interrupts. This is the logical OR of members of the enumeration qtmr_interrupt_enable_t
-
uint32_t QTMR_GetStatus(TMR_Type *base, qtmr_channel_selection_t channel)
Gets the Quad Timer status flags.
- Parameters:
base – Quad Timer peripheral base address
channel – Quad Timer channel number
- Returns:
The status flags. This is the logical OR of members of the enumeration qtmr_status_flags_t
-
void QTMR_ClearStatusFlags(TMR_Type *base, qtmr_channel_selection_t channel, uint32_t mask)
Clears the Quad Timer status flags.
- Parameters:
base – Quad Timer peripheral base address
channel – Quad Timer channel number
mask – The status flags to clear. This is a logical OR of members of the enumeration qtmr_status_flags_t
-
void QTMR_SetTimerPeriod(TMR_Type *base, qtmr_channel_selection_t channel, uint16_t ticks)
Sets the timer period in ticks.
Timers counts from initial value till it equals the count value set here. The counter will then reinitialize to the value specified in the Load register.
Note
This function will write the time period in ticks to COMP1 or COMP2 register depending on the count direction
User can call the utility macros provided in fsl_common.h to convert to ticks
This function supports cases, providing only primary source clock without secondary source clock.
- Parameters:
base – Quad Timer peripheral base address
channel – Quad Timer channel number
ticks – Timer period in units of ticks
-
void QTMR_SetCompareValue(TMR_Type *base, qtmr_channel_selection_t channel, uint16_t ticks)
Set compare value.
This function sets the value used for comparison with the counter value.
- Parameters:
base – Quad Timer peripheral base address
channel – Quad Timer channel number
ticks – Timer period in units of ticks.
-
static inline void QTMR_SetLoadValue(TMR_Type *base, qtmr_channel_selection_t channel, uint16_t value)
Set load value.
This function sets the value used to initialize the counter after a counter comparison.
- Parameters:
base – Quad Timer peripheral base address
channel – Quad Timer channel number
value – Load register initialization value.
-
static inline uint16_t QTMR_GetCurrentTimerCount(TMR_Type *base, qtmr_channel_selection_t channel)
Reads the current timer counting value.
This function returns the real-time timer counting value, in a range from 0 to a timer period.
Note
User can call the utility macros provided in fsl_common.h to convert ticks to usec or msec
- Parameters:
base – Quad Timer peripheral base address
channel – Quad Timer channel number
- Returns:
Current counter value in ticks
-
static inline void QTMR_StartTimer(TMR_Type *base, qtmr_channel_selection_t channel, qtmr_counting_mode_t clockSource)
Starts the Quad Timer counter.
- Parameters:
base – Quad Timer peripheral base address
channel – Quad Timer channel number
clockSource – Quad Timer clock source
-
static inline void QTMR_StopTimer(TMR_Type *base, qtmr_channel_selection_t channel)
Stops the Quad Timer counter.
- Parameters:
base – Quad Timer peripheral base address
channel – Quad Timer channel number
-
void QTMR_EnableDma(TMR_Type *base, qtmr_channel_selection_t channel, uint32_t mask)
Enable the Quad Timer DMA.
- Parameters:
base – Quad Timer peripheral base address
channel – Quad Timer channel number
mask – The DMA to enable. This is a logical OR of members of the enumeration qtmr_dma_enable_t
-
void QTMR_DisableDma(TMR_Type *base, qtmr_channel_selection_t channel, uint32_t mask)
Disable the Quad Timer DMA.
- Parameters:
base – Quad Timer peripheral base address
channel – Quad Timer channel number
mask – The DMA to enable. This is a logical OR of members of the enumeration qtmr_dma_enable_t
-
void QTMR_SetPwmOutputToIdle(TMR_Type *base, qtmr_channel_selection_t channel, bool idleStatus)
Set PWM output in idle status (high or low).
Note
When the PWM is set again, the counting needs to be restarted.
- Parameters:
base – Quad Timer peripheral base address
channel – Quad Timer channel number
idleStatus – True: PWM output is high in idle status; false: PWM output is low in idle status.
-
static inline qtmr_pwm_out_state_t QTMR_GetPwmOutputStatus(TMR_Type *base, qtmr_channel_selection_t channel)
Get the channel output status.
- Parameters:
base – Quad Timer peripheral base address
channel – Quad Timer channel number
- Returns:
Current channel output status.
-
uint8_t QTMR_GetPwmChannelStatus(TMR_Type *base, qtmr_channel_selection_t channel)
Get the PWM channel dutycycle value.
- Parameters:
base – Quad Timer peripheral base address
channel – Quad Timer channel number
- Returns:
Current channel dutycycle value.
-
void QTMR_SetPwmClockMode(TMR_Type *base, qtmr_channel_selection_t channel, qtmr_primary_count_source_t prescaler)
This function set the value of the prescaler on QTimer channels.
- Parameters:
base – Quad Timer peripheral base address
channel – Quad Timer channel number
prescaler – Set prescaler value
-
FSL_QTMR_DRIVER_VERSION
Version
-
enum _qtmr_primary_count_source
Quad Timer primary clock source selection.
Values:
-
enumerator kQTMR_ClockCounter0InputPin
Use counter 0 input pin
-
enumerator kQTMR_ClockCounter1InputPin
Use counter 1 input pin
-
enumerator kQTMR_ClockCounter2InputPin
Use counter 2 input pin
-
enumerator kQTMR_ClockCounter3InputPin
Use counter 3 input pin
-
enumerator kQTMR_ClockCounter0Output
Use counter 0 output
-
enumerator kQTMR_ClockCounter1Output
Use counter 1 output
-
enumerator kQTMR_ClockCounter2Output
Use counter 2 output
-
enumerator kQTMR_ClockCounter3Output
Use counter 3 output
-
enumerator kQTMR_ClockDivide_1
IP bus clock divide by 1 prescaler
-
enumerator kQTMR_ClockDivide_2
IP bus clock divide by 2 prescaler
-
enumerator kQTMR_ClockDivide_4
IP bus clock divide by 4 prescaler
-
enumerator kQTMR_ClockDivide_8
IP bus clock divide by 8 prescaler
-
enumerator kQTMR_ClockDivide_16
IP bus clock divide by 16 prescaler
-
enumerator kQTMR_ClockDivide_32
IP bus clock divide by 32 prescaler
-
enumerator kQTMR_ClockDivide_64
IP bus clock divide by 64 prescaler
-
enumerator kQTMR_ClockDivide_128
IP bus clock divide by 128 prescaler
-
enumerator kQTMR_ClockCounter0InputPin
-
enum _qtmr_input_source
Quad Timer input sources selection.
Values:
-
enumerator kQTMR_Counter0InputPin
Use counter 0 input pin
-
enumerator kQTMR_Counter1InputPin
Use counter 1 input pin
-
enumerator kQTMR_Counter2InputPin
Use counter 2 input pin
-
enumerator kQTMR_Counter3InputPin
Use counter 3 input pin
-
enumerator kQTMR_Counter0InputPin
-
enum _qtmr_counting_mode
Quad Timer counting mode selection.
Values:
-
enumerator kQTMR_NoOperation
No operation
-
enumerator kQTMR_PriSrcRiseEdge
Count rising edges of primary source
-
enumerator kQTMR_PriSrcRiseAndFallEdge
Count rising and falling edges of primary source
-
enumerator kQTMR_PriSrcRiseEdgeSecInpHigh
Count rise edges of pri SRC while sec inp high active
-
enumerator kQTMR_QuadCountMode
Quadrature count mode, uses pri and sec sources
-
enumerator kQTMR_PriSrcRiseEdgeSecDir
Count rising edges of pri SRC; sec SRC specifies dir
-
enumerator kQTMR_SecSrcTrigPriCnt
Edge of sec SRC trigger primary count until compare
-
enumerator kQTMR_CascadeCount
Cascaded count mode (up/down)
-
enumerator kQTMR_NoOperation
-
enum _qtmr_pwm_out_state
Quad Timer PWM output state.
Values:
-
enumerator kQTMR_PwmLow
The output state of PWM channel is low
-
enumerator kQTMR_PwmHigh
The output state of PWM channel is low
-
enumerator kQTMR_PwmLow
-
enum _qtmr_output_mode
Quad Timer output mode selection.
Values:
-
enumerator kQTMR_AssertWhenCountActive
Assert OFLAG while counter is active
-
enumerator kQTMR_ClearOnCompare
Clear OFLAG on successful compare
-
enumerator kQTMR_SetOnCompare
Set OFLAG on successful compare
-
enumerator kQTMR_ToggleOnCompare
Toggle OFLAG on successful compare
-
enumerator kQTMR_ToggleOnAltCompareReg
Toggle OFLAG using alternating compare registers
-
enumerator kQTMR_SetOnCompareClearOnSecSrcInp
Set OFLAG on compare, clear on sec SRC input edge
-
enumerator kQTMR_SetOnCompareClearOnCountRoll
Set OFLAG on compare, clear on counter rollover
-
enumerator kQTMR_EnableGateClock
Enable gated clock output while count is active
-
enumerator kQTMR_AssertWhenCountActive
-
enum _qtmr_input_capture_edge
Quad Timer input capture edge mode, rising edge, or falling edge.
Values:
-
enumerator kQTMR_NoCapture
Capture is disabled
-
enumerator kQTMR_RisingEdge
Capture on rising edge (IPS=0) or falling edge (IPS=1)
-
enumerator kQTMR_FallingEdge
Capture on falling edge (IPS=0) or rising edge (IPS=1)
-
enumerator kQTMR_RisingAndFallingEdge
Capture on both edges
-
enumerator kQTMR_NoCapture
-
enum _qtmr_preload_control
Quad Timer input capture edge mode, rising edge, or falling edge.
Values:
-
enumerator kQTMR_NoPreload
Never preload
-
enumerator kQTMR_LoadOnComp1
Load upon successful compare with value in COMP1
-
enumerator kQTMR_LoadOnComp2
Load upon successful compare with value in COMP2
-
enumerator kQTMR_NoPreload
-
enum _qtmr_debug_action
List of Quad Timer run options when in Debug mode.
Values:
-
enumerator kQTMR_RunNormalInDebug
Continue with normal operation
-
enumerator kQTMR_HaltCounter
Halt counter
-
enumerator kQTMR_ForceOutToZero
Force output to logic 0
-
enumerator kQTMR_HaltCountForceOutZero
Halt counter and force output to logic 0
-
enumerator kQTMR_RunNormalInDebug
-
enum _qtmr_interrupt_enable
List of Quad Timer interrupts.
Values:
-
enumerator kQTMR_CompareInterruptEnable
Compare interrupt.
-
enumerator kQTMR_Compare1InterruptEnable
Compare 1 interrupt.
-
enumerator kQTMR_Compare2InterruptEnable
Compare 2 interrupt.
-
enumerator kQTMR_OverflowInterruptEnable
Timer overflow interrupt.
-
enumerator kQTMR_EdgeInterruptEnable
Input edge interrupt.
-
enumerator kQTMR_CompareInterruptEnable
-
enum _qtmr_status_flags
List of Quad Timer flags.
Values:
-
enumerator kQTMR_CompareFlag
Compare flag
-
enumerator kQTMR_Compare1Flag
Compare 1 flag
-
enumerator kQTMR_Compare2Flag
Compare 2 flag
-
enumerator kQTMR_OverflowFlag
Timer overflow flag
-
enumerator kQTMR_EdgeFlag
Input edge flag
-
enumerator kQTMR_CompareFlag
-
enum _qtmr_channel_selection
List of channel selection.
Values:
-
enumerator kQTMR_Channel_0
TMR Channel 0
-
enumerator kQTMR_Channel_1
TMR Channel 1
-
enumerator kQTMR_Channel_2
TMR Channel 2
-
enumerator kQTMR_Channel_3
TMR Channel 3
-
enumerator kQTMR_Channel_0
-
enum _qtmr_dma_enable
List of Quad Timer DMA enable.
Values:
-
enumerator kQTMR_InputEdgeFlagDmaEnable
Input Edge Flag DMA Enable.
-
enumerator kQTMR_ComparatorPreload1DmaEnable
Comparator Preload Register 1 DMA Enable.
-
enumerator kQTMR_ComparatorPreload2DmaEnable
Comparator Preload Register 2 DMA Enable.
-
enumerator kQTMR_InputEdgeFlagDmaEnable
-
typedef enum _qtmr_primary_count_source qtmr_primary_count_source_t
Quad Timer primary clock source selection.
-
typedef enum _qtmr_input_source qtmr_input_source_t
Quad Timer input sources selection.
-
typedef enum _qtmr_counting_mode qtmr_counting_mode_t
Quad Timer counting mode selection.
-
typedef enum _qtmr_pwm_out_state qtmr_pwm_out_state_t
Quad Timer PWM output state.
-
typedef enum _qtmr_output_mode qtmr_output_mode_t
Quad Timer output mode selection.
-
typedef enum _qtmr_input_capture_edge qtmr_input_capture_edge_t
Quad Timer input capture edge mode, rising edge, or falling edge.
-
typedef enum _qtmr_preload_control qtmr_preload_control_t
Quad Timer input capture edge mode, rising edge, or falling edge.
-
typedef enum _qtmr_debug_action qtmr_debug_action_t
List of Quad Timer run options when in Debug mode.
-
typedef enum _qtmr_interrupt_enable qtmr_interrupt_enable_t
List of Quad Timer interrupts.
-
typedef enum _qtmr_status_flags qtmr_status_flags_t
List of Quad Timer flags.
-
typedef enum _qtmr_channel_selection qtmr_channel_selection_t
List of channel selection.
-
typedef enum _qtmr_dma_enable qtmr_dma_enable_t
List of Quad Timer DMA enable.
-
typedef struct _qtmr_config qtmr_config_t
Quad Timer config structure.
This structure holds the configuration settings for the Quad Timer peripheral. To initialize this structure to reasonable defaults, call the QTMR_GetDefaultConfig() function and pass a pointer to your config structure instance.
The config struct can be made const so it resides in flash
-
status_t QTMR_SetupPwm(TMR_Type *base, qtmr_channel_selection_t channel, uint32_t pwmFreqHz, uint8_t dutyCyclePercent, bool outputPolarity, uint32_t srcClock_Hz)
Sets up Quad timer module for PWM signal output.
The function initializes the timer module according to the parameters passed in by the user. The function also sets up the value compare registers to match the PWM signal requirements.
- Parameters:
base – Quad Timer peripheral base address
channel – Quad Timer channel number
pwmFreqHz – PWM signal frequency in Hz
dutyCyclePercent – PWM pulse width, value should be between 0 to 100 0=inactive signal(0% duty cycle)… 100=active signal (100% duty cycle)
outputPolarity – true: invert polarity of the output signal, false: no inversion
srcClock_Hz – Main counter clock in Hz.
- Returns:
Returns an error if there was error setting up the signal.
-
void QTMR_SetupInputCapture(TMR_Type *base, qtmr_channel_selection_t channel, qtmr_input_source_t capturePin, bool inputPolarity, bool reloadOnCapture, qtmr_input_capture_edge_t captureMode)
Allows the user to count the source clock cycles until a capture event arrives.
The count is stored in the capture register.
- Parameters:
base – Quad Timer peripheral base address
channel – Quad Timer channel number
capturePin – Pin through which we receive the input signal to trigger the capture
inputPolarity – true: invert polarity of the input signal, false: no inversion
reloadOnCapture – true: reload the counter when an input capture occurs, false: no reload
captureMode – Specifies which edge of the input signal triggers a capture
-
TMR_CSCTRL_OFLAG_MASK
-
TMR_CSCTRL_OFLAG_SHIFT
-
struct _qtmr_config
- #include <fsl_qtmr.h>
Quad Timer config structure.
This structure holds the configuration settings for the Quad Timer peripheral. To initialize this structure to reasonable defaults, call the QTMR_GetDefaultConfig() function and pass a pointer to your config structure instance.
The config struct can be made const so it resides in flash
Public Members
-
qtmr_primary_count_source_t primarySource
Specify the primary count source
-
qtmr_input_source_t secondarySource
Specify the secondary count source
-
bool enableMasterMode
true: Broadcast compare function output to other counters; false no broadcast
-
bool enableExternalForce
true: Compare from another counter force state of OFLAG signal false: OFLAG controlled by local counter
-
uint8_t faultFilterCount
Fault filter count
-
uint8_t faultFilterPeriod
Fault filter period;value of 0 will bypass the filter
-
qtmr_debug_action_t debugMode
Operation in Debug mode
-
qtmr_primary_count_source_t primarySource
Reset Driver
-
enum _SYSCON_RSTn
Enumeration for peripheral reset control bits.
Defines the enumeration for peripheral reset control bits in PRESETCTRL/ASYNCPRESETCTRL registers
Values:
-
enumerator kAonUART_RST_SHIFT_RSTn
AON UART reset control
-
enumerator kAonI2C_RST_SHIFT_RSTn
AON I2C reset control
-
enumerator kAonCAL_RST_SHIFT_RSTn
AON CAL reset control
-
enumerator kAonQTMR0_RST_SHIFT_RSTn
AON QTMR0 reset control
-
enumerator kAonLPTMR_RST_SHIFT_RSTn
AON LPTMR reset control
-
enumerator kAonKPP_RST_SHIFT_RSTn
AON KPP reset control
-
enumerator kAonLPADC_RST_SHIFT_RSTn
AON LPADC reset control
-
enumerator kAonLCD_RST_SHIFT_RSTn
AON UART reset control
-
enumerator kAonCMP0_RST_SHIFT_RSTn
AON ACMP reset control
-
enumerator kAonADVC2P0_RST_SHIFT_RSTn
AON ADVC2P0 reset control
-
enumerator NotAvail_RSTn
No reset control
-
enumerator kAonUART_RST_SHIFT_RSTn
-
typedef enum _SYSCON_RSTn SYSCON_RSTn_t
Enumeration for peripheral reset control bits.
Defines the enumeration for peripheral reset control bits in PRESETCTRL/ASYNCPRESETCTRL registers
-
typedef SYSCON_RSTn_t reset_ip_name_t
-
void RESET_SetPeripheralReset(reset_ip_name_t peripheral)
Assert reset to peripheral.
Asserts reset signal to specified peripheral module.
- Parameters:
peripheral – Assert reset to this peripheral. The enum argument contains encoding of reset register and reset bit position in the reset register.
-
void RESET_ClearPeripheralReset(reset_ip_name_t peripheral)
Clear reset to peripheral.
Clears reset signal to specified peripheral module, allows it to operate.
- Parameters:
peripheral – Clear reset to this peripheral. The enum argument contains encoding of reset register and reset bit position in the reset register.
-
void RESET_PeripheralReset(reset_ip_name_t peripheral)
Reset peripheral module.
Reset peripheral module.
- Parameters:
peripheral – Peripheral to reset. The enum argument contains encoding of reset register and reset bit position in the reset register.
-
static inline void RESET_ReleasePeripheralReset(reset_ip_name_t peripheral)
Release peripheral module.
Release peripheral module.
- Parameters:
peripheral – Peripheral to release. The enum argument contains encoding of reset register and reset bit position in the reset register.
-
FSL_RESET_DRIVER_VERSION
reset driver version 2.4.0
-
ADC_RSTS
-
LPUART_RSTS
-
LPI2C_RSTS
-
CTIMER_RSTS
-
PORT_RSTS_N
-
PORT_RSTS_N
-
GPIO_RSTS_N
-
GPIO_RSTS_N
-
CMP_RSTS
-
LPACMP_RSTS
ROMAPI Driver
-
enum _flash_property_tag
Enumeration for various flash properties.
Values:
-
enumerator kFLASH_PropertyPflashSectorSize
Pflash sector size property.
-
enumerator kFLASH_PropertyPflashTotalSize
Pflash total size property.
-
enumerator kFLASH_PropertyPflashBlockSize
Pflash block size property.
-
enumerator kFLASH_PropertyPflashBlockCount
Pflash block count property.
-
enumerator kFLASH_PropertyPflashBlockBaseAddr
Pflash block base address property.
-
enumerator kFLASH_PropertyPflashPageSize
Pflash page size property.
-
enumerator kFLASH_PropertyPflashSystemFreq
System Frequency property.
-
enumerator kFLASH_PropertyFfrSectorSize
FFR sector size property.
-
enumerator kFLASH_PropertyFfrTotalSize
FFR total size property.
-
enumerator kFLASH_PropertyFfrBlockBaseAddr
FFR block base address property.
-
enumerator kFLASH_PropertyFfrPageSize
FFR page size property.
-
enumerator kFLASH_PropertyPflashSectorSize
-
enum _flash_driver_api_keys
Enumeration for Flash driver API keys.
Note
The resulting value is built with a byte order such that the string being readable in expected order when viewed in a hex editor, if the value is treated as a 32-bit little endian value.
Values:
-
enumerator kFLASH_ApiEraseKey
Key value used to validate all flash erase APIs.
-
enumerator kFLASH_ApiEraseKey
-
typedef enum _flash_property_tag flash_property_tag_t
Enumeration for various flash properties.
-
typedef struct _flash_ffr_config flash_ffr_config_t
Flash controller paramter config.
-
typedef struct _flash_config flash_config_t
Flash driver state information.
An instance of this structure is allocated by the user of the flash driver and passed into each of the driver APIs.
-
typedef struct _flash_driver_interface flash_driver_interface_t
Interface for the flash driver.
-
typedef struct _bootloader_tree bootloader_tree_t
Root of the bootloader API tree.
An instance of this struct resides in read-only memory in the bootloader. It provides a user application access to APIs exported by the bootloader.
-
FSL_ROMAPI_DRIVER_VERSION
romapi driver version 2.0.0.
-
FOUR_CHAR_CODE(a, b, c, d)
Constructs the four character code for the Flash driver API key.
-
ROM_API_BASE
ROM API base address
-
ROM_API
ROM API base pointer
-
FLASH_API
FLASH API base pointer
-
uint32_t ffrBlockBase
-
uint32_t ffrTotalSize
-
uint32_t ffrPageSize
-
uint32_t sectorSize
-
uint32_t cfpaPageVersion
-
uint32_t cfpaPageOffset
-
uint32_t PFlashBlockBase
A base address of the first PFlash block
-
uint32_t PFlashTotalSize
The size of the combined PFlash block.
-
uint32_t PFlashBlockCount
A number of PFlash blocks.
-
uint32_t PFlashPageSize
The size in bytes of a page of PFlash.
-
uint32_t PFlashSectorSize
The size in bytes of a sector of PFlash.
-
flash_ffr_config_t ffrConfig
-
status_t (*flash_init)(flash_config_t *config)
-
status_t (*flash_erase_sector)(flash_config_t *config, uint32_t start, uint32_t lengthInBytes, uint32_t key)
-
status_t (*flash_program_phrase)(flash_config_t *config, uint32_t start, uint8_t *src, uint32_t lengthInBytes)
-
status_t (*flash_program_page)(flash_config_t *config, uint32_t start, uint8_t *src, uint32_t lengthInBytes)
-
status_t (*flash_verify_program)(flash_config_t *config, uint32_t start, uint32_t lengthInBytes, const uint8_t *expectedData, uint32_t *failedAddress, uint32_t *failedData)
-
status_t (*flash_verify_erase_phrase)(flash_config_t *config, uint32_t start, uint32_t lengthInBytes)
-
status_t (*flash_verify_erase_page)(flash_config_t *config, uint32_t start, uint32_t lengthInBytes)
-
status_t (*flash_verify_erase_sector)(flash_config_t *config, uint32_t start, uint32_t lengthInBytes)
-
status_t (*flash_get_property)(flash_config_t *config, flash_property_tag_t whichProperty, uint32_t *value)
-
status_t (*ifr_verify_erase_phrase)(flash_config_t *config, uint32_t start, uint32_t lengthInBytes)
-
status_t (*ifr_verify_erase_page)(flash_config_t *config, uint32_t start, uint32_t lengthInBytes)
-
status_t (*ifr_verify_erase_sector)(flash_config_t *config, uint32_t start, uint32_t lengthInBytes)
-
status_t (*flash_read)(flash_config_t *config, uint32_t start, uint8_t *dest, uint32_t lengthInBytes)
-
uint32_t version
-
uint32_t reserved
-
uint32_t boot_image_index
-
uint32_t instance
-
uint32_t boot_interface
-
uint32_t mode
-
uint32_t tag
-
struct user_app_boot_invoke_option_t B
-
uint32_t U
-
union user_app_boot_invoke_option_t option
-
void (*run_bootloader)(void *arg)
Function to start the bootloader executing.
-
const flash_driver_interface_t *flash_driver
Internal Flash driver API.
-
void (*jump)(void *arg)
-
FSL_COMPONENT_ID
-
struct _flash_ffr_config
- #include <fsl_romapi.h>
Flash controller paramter config.
-
struct _flash_config
- #include <fsl_romapi.h>
Flash driver state information.
An instance of this structure is allocated by the user of the flash driver and passed into each of the driver APIs.
-
struct _flash_driver_interface
- #include <fsl_romapi.h>
Interface for the flash driver.
-
struct user_app_boot_invoke_option_t
- #include <fsl_romapi.h>
-
struct _bootloader_tree
- #include <fsl_romapi.h>
Root of the bootloader API tree.
An instance of this struct resides in read-only memory in the bootloader. It provides a user application access to APIs exported by the bootloader.
-
union option
-
struct B
Trdc_soc
-
FSL_TRDC_SOC_DRIVER_VERSION
Driver version 1.0.0.
-
FSL_FEATURE_TRDC_DOMAIN_COUNT
TRDC feature.
-
TRDC_MBC_COUNT
TRDC base address convert macro.
-
TRDC_MBC_OFFSET(x)
-
TRDC_MBC_ARRAY_STEP
-
FSL_COMPONENT_ID