MIMXRT798S

ACMP: Analog Comparator Driver

void ACMP_Init(CMP_Type *base, const acmp_config_t *config)

Initializes the ACMP.

The default configuration can be got by calling ACMP_GetDefaultConfig().

Parameters:
  • base – ACMP peripheral base address.

  • config – Pointer to ACMP configuration structure.

void ACMP_Deinit(CMP_Type *base)

Deinitializes the ACMP.

Parameters:
  • base – ACMP peripheral base address.

void ACMP_GetDefaultConfig(acmp_config_t *config)

Gets the default configuration for ACMP.

This function initializes the user configuration structure to default value. The default value are:

Example:

config->enableHighSpeed = false;
config->enableInvertOutput = false;
config->useUnfilteredOutput = false;
config->enablePinOut = false;
config->enableHysteresisBothDirections = false;
config->hysteresisMode = kACMP_hysteresisMode0;

Parameters:
  • config – Pointer to ACMP configuration structure.

void ACMP_Enable(CMP_Type *base, bool enable)

Enables or disables the ACMP.

Parameters:
  • base – ACMP peripheral base address.

  • enable – True to enable the ACMP.

void ACMP_EnableLinkToDAC(CMP_Type *base, bool enable)

Enables the link from CMP to DAC enable.

When this bit is set, the DAC enable/disable is controlled by the bit CMP_C0[EN] instead of CMP_C1[DACEN].

Parameters:
  • base – ACMP peripheral base address.

  • enable – Enable the feature or not.

void ACMP_SetChannelConfig(CMP_Type *base, const acmp_channel_config_t *config)

Sets the channel configuration.

Note that the plus/minus mux’s setting is only valid when the positive/negative port’s input isn’t from DAC but from channel mux.

Example:

acmp_channel_config_t configStruct = {0};
configStruct.positivePortInput = kACMP_PortInputFromDAC;
configStruct.negativePortInput = kACMP_PortInputFromMux;
configStruct.minusMuxInput = 1U;
ACMP_SetChannelConfig(CMP0, &configStruct);

Parameters:
  • base – ACMP peripheral base address.

  • config – Pointer to channel configuration structure.

void ACMP_EnableDMA(CMP_Type *base, bool enable)

Enables or disables DMA.

Parameters:
  • base – ACMP peripheral base address.

  • enable – True to enable DMA.

void ACMP_SetFilterConfig(CMP_Type *base, const acmp_filter_config_t *config)

Configures the filter.

The filter can be enabled when the filter count is bigger than 1, the filter period is greater than 0 and the sample clock is from divided bus clock or the filter is bigger than 1 and the sample clock is from external clock. Detailed usage can be got from the reference manual.

Example:

acmp_filter_config_t configStruct = {0};
configStruct.filterCount = 5U;
configStruct.filterPeriod = 200U;
configStruct.enableSample = false;
ACMP_SetFilterConfig(CMP0, &configStruct);

Parameters:
  • base – ACMP peripheral base address.

  • config – Pointer to filter configuration structure.

void ACMP_SetDACConfig(CMP_Type *base, const acmp_dac_config_t *config)

Configures the internal DAC.

Example:

acmp_dac_config_t configStruct = {0};
configStruct.referenceVoltageSource = kACMP_VrefSourceVin1;
configStruct.DACValue = 20U;
configStruct.enableOutput = false;
configStruct.workMode = kACMP_DACWorkLowSpeedMode;
ACMP_SetDACConfig(CMP0, &configStruct);

Parameters:
  • base – ACMP peripheral base address.

  • config – Pointer to DAC configuration structure. “NULL” is for disabling the feature.

void ACMP_EnableInterrupts(CMP_Type *base, uint32_t mask)

Enables interrupts.

Parameters:
  • base – ACMP peripheral base address.

  • mask – Interrupts mask. See “_acmp_interrupt_enable”.

void ACMP_DisableInterrupts(CMP_Type *base, uint32_t mask)

Disables interrupts.

Parameters:
  • base – ACMP peripheral base address.

  • mask – Interrupts mask. See “_acmp_interrupt_enable”.

uint32_t ACMP_GetStatusFlags(CMP_Type *base)

Gets status flags.

Parameters:
  • base – ACMP peripheral base address.

Returns:

Status flags asserted mask. See “_acmp_status_flags”.

void ACMP_ClearStatusFlags(CMP_Type *base, uint32_t mask)

Clears status flags.

Parameters:
  • base – ACMP peripheral base address.

  • mask – Status flags mask. See “_acmp_status_flags”.

void ACMP_SetDiscreteModeConfig(CMP_Type *base, const acmp_discrete_mode_config_t *config)

Configure the discrete mode.

Configure the discrete mode when supporting 3V domain with 1.8V core.

Parameters:
  • base – ACMP peripheral base address.

  • config – Pointer to configuration structure. See “acmp_discrete_mode_config_t”.

void ACMP_GetDefaultDiscreteModeConfig(acmp_discrete_mode_config_t *config)

Get the default configuration for discrete mode setting.

Parameters:
  • config – Pointer to configuration structure to be restored with the setting values.

FSL_ACMP_DRIVER_VERSION

ACMP driver version 2.3.0.

enum _acmp_interrupt_enable

Interrupt enable/disable mask.

Values:

enumerator kACMP_OutputRisingInterruptEnable

Enable the interrupt when comparator outputs rising.

enumerator kACMP_OutputFallingInterruptEnable

Enable the interrupt when comparator outputs falling.

enum _acmp_status_flags

Status flag mask.

Values:

enumerator kACMP_OutputRisingEventFlag

Rising-edge on compare output has occurred.

enumerator kACMP_OutputFallingEventFlag

Falling-edge on compare output has occurred.

enumerator kACMP_OutputAssertEventFlag

Return the current value of the analog comparator output.

enum _acmp_offset_mode

Comparator hard block offset control.

If OFFSET level is 1, then there is no hysteresis in the case of positive port input crossing negative port input in the positive direction (or negative port input crossing positive port input in the negative direction). Hysteresis still exists for positive port input crossing negative port input in the falling direction. If OFFSET level is 0, then the hysteresis selected by acmp_hysteresis_mode_t is valid for both directions.

Values:

enumerator kACMP_OffsetLevel0

The comparator hard block output has level 0 offset internally.

enumerator kACMP_OffsetLevel1

The comparator hard block output has level 1 offset internally.

enum _acmp_hysteresis_mode

Comparator hard block hysteresis control.

See chip data sheet to get the actual hysteresis value with each level.

Values:

enumerator kACMP_HysteresisLevel0

Offset is level 0 and Hysteresis is level 0.

enumerator kACMP_HysteresisLevel1

Offset is level 0 and Hysteresis is level 1.

enumerator kACMP_HysteresisLevel2

Offset is level 0 and Hysteresis is level 2.

enumerator kACMP_HysteresisLevel3

Offset is level 0 and Hysteresis is level 3.

enum _acmp_reference_voltage_source

CMP Voltage Reference source.

Values:

enumerator kACMP_VrefSourceVin1

Vin1 is selected as resistor ladder network supply reference Vin.

enumerator kACMP_VrefSourceVin2

Vin2 is selected as resistor ladder network supply reference Vin.

enum _acmp_port_input

Port input source.

Values:

enumerator kACMP_PortInputFromDAC

Port input from the 8-bit DAC output.

enumerator kACMP_PortInputFromMux

Port input from the analog 8-1 mux.

enum _acmp_dac_work_mode

Internal DAC’s work mode.

Values:

enumerator kACMP_DACWorkLowSpeedMode

DAC is selected to work in low speed and low power mode.

enumerator kACMP_DACWorkHighSpeedMode

DAC is selected to work in high speed high power mode.

typedef enum _acmp_offset_mode acmp_offset_mode_t

Comparator hard block offset control.

If OFFSET level is 1, then there is no hysteresis in the case of positive port input crossing negative port input in the positive direction (or negative port input crossing positive port input in the negative direction). Hysteresis still exists for positive port input crossing negative port input in the falling direction. If OFFSET level is 0, then the hysteresis selected by acmp_hysteresis_mode_t is valid for both directions.

typedef enum _acmp_hysteresis_mode acmp_hysteresis_mode_t

Comparator hard block hysteresis control.

See chip data sheet to get the actual hysteresis value with each level.

typedef enum _acmp_reference_voltage_source acmp_reference_voltage_source_t

CMP Voltage Reference source.

typedef enum _acmp_port_input acmp_port_input_t

Port input source.

typedef enum _acmp_dac_work_mode acmp_dac_work_mode_t

Internal DAC’s work mode.

typedef struct _acmp_config acmp_config_t

Configuration for ACMP.

typedef struct _acmp_channel_config acmp_channel_config_t

Configuration for channel.

The comparator’s port can be input from channel mux or DAC. If port input is from channel mux, detailed channel number for the mux should be configured.

typedef struct _acmp_filter_config acmp_filter_config_t

Configuration for filter.

typedef struct _acmp_dac_config acmp_dac_config_t

Configuration for DAC.

typedef struct _acmp_discrete_mode_config acmp_discrete_mode_config_t

Configuration for discrete mode.

CMP_C0_CFx_MASK

The mask of status flags cleared by writing 1.

struct _acmp_config
#include <fsl_acmp.h>

Configuration for ACMP.

Public Members

acmp_offset_mode_t offsetMode

Offset mode.

acmp_hysteresis_mode_t hysteresisMode

Hysteresis mode.

bool enableHighSpeed

Enable High Speed (HS) comparison mode.

bool enableInvertOutput

Enable inverted comparator output.

bool useUnfilteredOutput

Set compare output(COUT) to equal COUTA(true) or COUT(false).

bool enablePinOut

The comparator output is available on the associated pin.

struct _acmp_channel_config
#include <fsl_acmp.h>

Configuration for channel.

The comparator’s port can be input from channel mux or DAC. If port input is from channel mux, detailed channel number for the mux should be configured.

Public Members

acmp_port_input_t positivePortInput

Input source of the comparator’s positive port.

uint32_t plusMuxInput

Plus mux input channel(0~7).

acmp_port_input_t negativePortInput

Input source of the comparator’s negative port.

uint32_t minusMuxInput

Minus mux input channel(0~7).

struct _acmp_filter_config
#include <fsl_acmp.h>

Configuration for filter.

Public Members

uint32_t filterCount

Filter Sample Count. Available range is 1-7, 0 would cause the filter disabled.

uint32_t filterPeriod

Filter Sample Period. The divider to bus clock. Available range is 0-255.

struct _acmp_dac_config
#include <fsl_acmp.h>

Configuration for DAC.

Public Members

acmp_reference_voltage_source_t referenceVoltageSource

Supply voltage reference source.

uint32_t DACValue

Value for DAC Output Voltage. Available range is 0-255.

bool enableOutput

Enable the DAC output.

struct _acmp_discrete_mode_config
#include <fsl_acmp.h>

Configuration for discrete mode.

Public Members

bool enablePositiveChannelDiscreteMode

Positive Channel Continuous Mode Enable. By default, the continuous mode is used.

bool enableNegativeChannelDiscreteMode

Negative Channel Continuous Mode Enable. By default, the continuous mode is used.

CACHE: CACHE Memory Controller

uint32_t CACHE64_GetInstance(CACHE64_POLSEL_Type *base)

Returns an instance number given peripheral base address.

Parameters:
  • base – The peripheral base address.

Returns:

CACHE64_POLSEL instance number starting from 0.

uint32_t CACHE64_GetInstanceByAddr(uint32_t address)

brief Returns an instance number given physical memory address.

param address The physical memory address.

Returns:

CACHE64_CTRL instance number starting from 0.

status_t CACHE64_Init(CACHE64_POLSEL_Type *base, const cache64_config_t *config)

Initializes an CACHE64 instance with the user configuration structure.

This function configures the CACHE64 module with user-defined settings. Call the CACHE64_GetDefaultConfig() function to configure the configuration structure and get the default configuration.

Parameters:
  • base – CACHE64_POLSEL peripheral base address.

  • config – Pointer to a user-defined configuration structure.

Return values:

kStatus_Success – CACHE64 initialize succeed

void CACHE64_GetDefaultConfig(cache64_config_t *config)

Gets the default configuration structure.

This function initializes the CACHE64 configuration structure to a default value. The default values are first region covers whole cacheable area, and policy set to write back.

Parameters:
  • config – Pointer to a configuration structure.

void CACHE64_EnableCache(CACHE64_CTRL_Type *base)

Enables the cache.

Parameters:
  • base – CACHE64_CTRL peripheral base address.

void CACHE64_DisableCache(CACHE64_CTRL_Type *base)

Disables the cache.

Parameters:
  • base – CACHE64_CTRL peripheral base address.

void CACHE64_InvalidateCache(CACHE64_CTRL_Type *base)

Invalidates the cache.

Parameters:
  • base – CACHE64_CTRL peripheral base address.

void CACHE64_InvalidateCacheByRange(uint32_t address, uint32_t size_byte)

Invalidates cache by range.

Note

Address and size should be aligned to “CACHE64_LINESIZE_BYTE”. The startAddr here will be forced to align to CACHE64_LINESIZE_BYTE if startAddr is not aligned. For the size_byte, application should make sure the alignment or make sure the right operation order if the size_byte is not aligned.

Parameters:
  • address – The physical address of cache.

  • size_byte – size of the memory to be invalidated, should be larger than 0.

void CACHE64_CleanCache(CACHE64_CTRL_Type *base)

Cleans the cache.

Parameters:
  • base – CACHE64_CTRL peripheral base address.

void CACHE64_CleanCacheByRange(uint32_t address, uint32_t size_byte)

Cleans cache by range.

Note

Address and size should be aligned to “CACHE64_LINESIZE_BYTE”. The startAddr here will be forced to align to CACHE64_LINESIZE_BYTE if startAddr is not aligned. For the size_byte, application should make sure the alignment or make sure the right operation order if the size_byte is not aligned.

Parameters:
  • address – The physical address of cache.

  • size_byte – size of the memory to be cleaned, should be larger than 0.

void CACHE64_CleanInvalidateCache(CACHE64_CTRL_Type *base)

Cleans and invalidates the cache.

Parameters:
  • base – CACHE64_CTRL peripheral base address.

void CACHE64_CleanInvalidateCacheByRange(uint32_t address, uint32_t size_byte)

Cleans and invalidate cache by range.

Note

Address and size should be aligned to “CACHE64_LINESIZE_BYTE”. The startAddr here will be forced to align to CACHE64_LINESIZE_BYTE if startAddr is not aligned. For the size_byte, application should make sure the alignment or make sure the right operation order if the size_byte is not aligned.

Parameters:
  • address – The physical address of cache.

  • size_byte – size of the memory to be Cleaned and Invalidated, should be larger than 0.

void CACHE64_EnableWriteBuffer(CACHE64_CTRL_Type *base, bool enable)

Enables/disables the write buffer.

Parameters:
  • base – CACHE64_CTRL peripheral base address.

  • enable – The enable or disable flag. true - enable the write buffer. false - disable the write buffer.

static inline void ICACHE_InvalidateByRange(uint32_t address, uint32_t size_byte)

Invalidates instruction cache by range.

Note

Address and size should be aligned to CACHE64_LINESIZE_BYTE due to the cache operation unit FSL_FEATURE_CACHE64_CTRL_LINESIZE_BYTE. The startAddr here will be forced to align to the cache line size if startAddr is not aligned. For the size_byte, application should make sure the alignment or make sure the right operation order if the size_byte is not aligned.

Parameters:
  • address – The physical address.

  • size_byte – size of the memory to be invalidated, should be larger than 0.

static inline void DCACHE_InvalidateByRange(uint32_t address, uint32_t size_byte)

Invalidates data cache by range.

Note

Address and size should be aligned to CACHE64_LINESIZE_BYTE due to the cache operation unit FSL_FEATURE_CACHE64_CTRL_LINESIZE_BYTE. The startAddr here will be forced to align to the cache line size if startAddr is not aligned. For the size_byte, application should make sure the alignment or make sure the right operation order if the size_byte is not aligned.

Parameters:
  • address – The physical address.

  • size_byte – size of the memory to be invalidated, should be larger than 0.

static inline void DCACHE_CleanByRange(uint32_t address, uint32_t size_byte)

Clean data cache by range.

Note

Address and size should be aligned to CACHE64_LINESIZE_BYTE due to the cache operation unit FSL_FEATURE_CACHE64_CTRL_LINESIZE_BYTE. The startAddr here will be forced to align to the cache line size if startAddr is not aligned. For the size_byte, application should make sure the alignment or make sure the right operation order if the size_byte is not aligned.

Parameters:
  • address – The physical address.

  • size_byte – size of the memory to be cleaned, should be larger than 0.

static inline void DCACHE_CleanInvalidateByRange(uint32_t address, uint32_t size_byte)

Cleans and Invalidates data cache by range.

Note

Address and size should be aligned to CACHE64_LINESIZE_BYTE due to the cache operation unit FSL_FEATURE_CACHE64_CTRL_LINESIZE_BYTE. The startAddr here will be forced to align to the cache line size if startAddr is not aligned. For the size_byte, application should make sure the alignment or make sure the right operation order if the size_byte is not aligned.

Parameters:
  • address – The physical address.

  • size_byte – size of the memory to be Cleaned and Invalidated, should be larger than 0.

FSL_CACHE_DRIVER_VERSION

cache driver version.

enum _cache64_policy

Level 2 cache controller way size.

Values:

enumerator kCACHE64_PolicyNonCacheable

Non-cacheable

enumerator kCACHE64_PolicyWriteThrough

Write through

enumerator kCACHE64_PolicyWriteBack

Write back

typedef enum _cache64_policy cache64_policy_t

Level 2 cache controller way size.

typedef struct _cache64_config cache64_config_t

CACHE64 configuration structure.

CACHE64_LINESIZE_BYTE

cache line size.

CACHE64_REGION_NUM

cache region number.

CACHE64_REGION_ALIGNMENT

cache region alignment.

struct _cache64_config
#include <fsl_cache.h>

CACHE64 configuration structure.

Public Members

uint32_t boundaryAddr[(3U) - 1]

< The cache controller can divide whole memory into 3 regions. Boundary address is the FlexSPI internal address (start from 0) instead of system address (start from FlexSPI AMBA base) to split adjacent regions and must be 1KB aligned. The boundary address itself locates in upper region. Cacheable policy for each region.

CDOG

status_t CDOG_Init(CDOG_Type *base, cdog_config_t *conf)

Initialize CDOG.

This function initializes CDOG block and setting.

Parameters:
  • base – CDOG peripheral base address

  • conf – CDOG configuration structure

Returns:

Status of the init operation

void CDOG_Deinit(CDOG_Type *base)

Deinitialize CDOG.

This function deinitializes CDOG secure counter.

Parameters:
  • base – CDOG peripheral base address

void CDOG_GetDefaultConfig(cdog_config_t *conf)

Sets the default configuration of CDOG.

This function initialize CDOG config structure to default values.

Parameters:
  • conf – CDOG configuration structure

void CDOG_Stop(CDOG_Type *base, uint32_t stop)

Stops secure counter and instruction timer.

This function stops instruction timer and secure counter. This also change state od CDOG to IDLE.

Parameters:
  • base – CDOG peripheral base address

  • stop – expected value which will be compared with value of secure counter

void CDOG_Start(CDOG_Type *base, uint32_t reload, uint32_t start)

Sets secure counter and instruction timer values.

This function sets value in RELOAD and START registers for instruction timer and secure counter

Parameters:
  • base – CDOG peripheral base address

  • reload – reload value

  • start – start value

void CDOG_Check(CDOG_Type *base, uint32_t check)

Checks secure counter.

This function compares stop value in handler with secure counter value by writting to RELOAD refister.

Parameters:
  • base – CDOG peripheral base address

  • check – expected (stop) value

void CDOG_Set(CDOG_Type *base, uint32_t stop, uint32_t reload, uint32_t start)

Sets secure counter and instruction timer values.

This function sets value in STOP, RELOAD and START registers for instruction timer and secure counter.

Parameters:
  • base – CDOG peripheral base address

  • stop – expected value which will be compared with value of secure counter

  • reload – reload value for instruction timer

  • start – start value for secure timer

void CDOG_Add(CDOG_Type *base, uint32_t add)

Add value to secure counter.

This function add specified value to secure counter.

Parameters:
  • base – CDOG peripheral base address.

  • add – Value to be added.

void CDOG_Add1(CDOG_Type *base)

Add 1 to secure counter.

This function add 1 to secure counter.

Parameters:
  • base – CDOG peripheral base address.

void CDOG_Add16(CDOG_Type *base)

Add 16 to secure counter.

This function add 16 to secure counter.

Parameters:
  • base – CDOG peripheral base address.

void CDOG_Add256(CDOG_Type *base)

Add 256 to secure counter.

This function add 256 to secure counter.

Parameters:
  • base – CDOG peripheral base address.

void CDOG_Sub(CDOG_Type *base, uint32_t sub)

brief Substract value to secure counter

This function substract specified value to secure counter.

param base CDOG peripheral base address. param sub Value to be substracted.

void CDOG_Sub1(CDOG_Type *base)

Substract 1 from secure counter.

This function substract specified 1 from secure counter.

Parameters:
  • base – CDOG peripheral base address.

void CDOG_Sub16(CDOG_Type *base)

Substract 16 from secure counter.

This function substract specified 16 from secure counter.

Parameters:
  • base – CDOG peripheral base address.

void CDOG_Sub256(CDOG_Type *base)

Substract 256 from secure counter.

This function substract specified 256 from secure counter.

Parameters:
  • base – CDOG peripheral base address.

void CDOG_WritePersistent(CDOG_Type *base, uint32_t value)

Set the CDOG persistent word.

Parameters:
  • base – CDOG peripheral base address.

  • value – The value to be written.

uint32_t CDOG_ReadPersistent(CDOG_Type *base)

Get the CDOG persistent word.

Parameters:
  • base – CDOG peripheral base address.

Returns:

The persistent word.

FSL_CDOG_DRIVER_VERSION

Defines CDOG driver version 2.1.3.

Change log:

  • Version 2.1.3

    • Re-design multiple instance IRQs and Clocks

    • Add fix for RESTART command errata

  • Version 2.1.2

    • Support multiple IRQs

    • Fix default CONTROL values

  • Version 2.1.1

    • Remove bit CONTROL[CONTROL_CTRL]

  • Version 2.1.0

    • Rename CWT to CDOG

  • Version 2.0.2

    • Fix MISRA-2012 issues

  • Version 2.0.1

    • Fix doxygen issues

  • Version 2.0.0

    • initial version

enum __cdog_debug_Action_ctrl_enum

Values:

enumerator kCDOG_DebugHaltCtrl_Run
enumerator kCDOG_DebugHaltCtrl_Pause
enum __cdog_irq_pause_ctrl_enum

Values:

enumerator kCDOG_IrqPauseCtrl_Run
enumerator kCDOG_IrqPauseCtrl_Pause
enum __cdog_fault_ctrl_enum

Values:

enumerator kCDOG_FaultCtrl_EnableReset
enumerator kCDOG_FaultCtrl_EnableInterrupt
enumerator kCDOG_FaultCtrl_NoAction
enum __code_lock_ctrl_enum

Values:

enumerator kCDOG_LockCtrl_Lock
enumerator kCDOG_LockCtrl_Unlock
typedef uint32_t secure_counter_t
SC_ADD(add)
SC_ADD1
SC_ADD16
SC_ADD256
SC_SUB(sub)
SC_SUB1
SC_SUB16
SC_SUB256
SC_CHECK(val)
struct cdog_config_t
#include <fsl_cdog.h>

Clock Driver

enum _clock_usb_src

USB clock source definition.

Values:

enumerator kCLOCK_Usb480M

Use 480M.

enumerator kCLOCK_UsbSrcUnused

Used when the function does not care the clock source.

enum _clock_usb_phy_src

Source of the USB HS PHY.

Values:

enumerator kCLOCK_Usbphy480M

Use 480M.

enum _clock_ip_name

Clock gate name used for CLOCK_EnableClock/CLOCK_DisableClock.

Values:

enumerator kCLOCK_IpInvalid

Invalid Ip Name.

enumerator kCLOCK_Xcache1

Clock gate name: Code cache

enumerator kCLOCK_Xcache0

Clock gate name: System cache

enumerator kCLOCK_Ocotp0

Clock gate name: VDD2 OTP0

enumerator kCLOCK_Sleepcon0

Clock gate name: SLEEPCON_CMPT

enumerator kCLOCK_Syscon0

Clock gate name: SYSCON_CMPT

enumerator kCLOCK_Glikey0

Clock gate name: GLIKEY0

enumerator kCLOCK_Glikey3

Clock gate name: GLIKEY3

enumerator kCLOCK_TpiuTraceClkin

Clock gate name: TPIU_TRACECLKIN

enumerator kCLOCK_SWOTraceClkin

Clock gate name: SWO_TRACECLKIN

enumerator kCLOCK_Tsclk

Clock gate name: TRACE

enumerator kCLOCK_Dma0

Clock gate name: DMA0

enumerator kCLOCK_Dma1

Clock gate name: DMA1

enumerator kCLOCK_PkcRam

Clock gate name: PKC RAM

enumerator kCLOCK_Pkc

Clock gate name: PKC

enumerator kCLOCK_Romcp

Clock gate name: ROMCP

enumerator kCLOCK_Xspi0

Clock gate name: XSPI0

enumerator kCLOCK_Xspi1

Clock gate name: XSPI1

enumerator kCLOCK_Cache64ctrl0

Clock gate name: CACHE64_0

enumerator kCLOCK_Cache64ctrl1

Clock gate name: CACHE64_1

enumerator kCLOCK_Puf

Clock gate name: QK_SUBSYS

enumerator kCLOCK_Mmu0

Clock gate name: MMU0

enumerator kCLOCK_Mmu1

Clock gate name: MMU1

enumerator kCLOCK_Gpio0

Clock gate name: GPIO0

enumerator kCLOCK_Gpio1

Clock gate name: GPIO1

enumerator kCLOCK_Gpio2

Clock gate name: GPIO2

enumerator kCLOCK_Gpio3

Clock gate name: GPIO3

enumerator kCLOCK_Gpio4

Clock gate name: GPIO4

enumerator kCLOCK_Gpio5

Clock gate name: GPIO5

enumerator kCLOCK_Gpio6

Clock gate name: GPIO6

enumerator kCLOCK_Gpio7

Clock gate name: GPIO7

enumerator kCLOCK_Sct0

Clock gate name: SCT0

enumerator kCLOCK_Cdog0

Clock gate name: CDOG0

enumerator kCLOCK_Cdog1

Clock gate name: CDOG1

enumerator kCLOCK_Cdog2

Clock gate name: CDOG2

enumerator kCLOCK_LPFlexComm0

Clock gate name: LP_Flexcomm0

enumerator kCLOCK_LPFlexComm1

Clock gate name: LP_Flexcomm1

enumerator kCLOCK_LPUart0

Clock gate name: LPUART0

enumerator kCLOCK_LPUart1

Clock gate name: LPUART1

enumerator kCLOCK_LPI2c0

Clock gate name: LPI2C0

enumerator kCLOCK_LPI2c1

Clock gate name: LPI2C1

enumerator kCLOCK_LPSpi0

Clock gate name: LPSPI0

enumerator kCLOCK_LPSpi1

Clock gate name: LPSPI1

enumerator kCLOCK_LPFlexComm2

Clock gate name: LP_Flexcomm2

enumerator kCLOCK_LPFlexComm3

Clock gate name: LP_Flexcomm3

enumerator kCLOCK_LPFlexComm4

Clock gate name: LP_Flexcomm4

enumerator kCLOCK_LPFlexComm5

Clock gate name: LP_Flexcomm5

enumerator kCLOCK_LPFlexComm6

Clock gate name: LP_Flexcomm6

enumerator kCLOCK_LPFlexComm7

Clock gate name: LP_Flexcomm7

enumerator kCLOCK_LPFlexComm8

Clock gate name: LP_Flexcomm8

enumerator kCLOCK_LPFlexComm9

Clock gate name: LP_Flexcomm9

enumerator kCLOCK_LPFlexComm10

Clock gate name: LP_Flexcomm10

enumerator kCLOCK_LPFlexComm11

Clock gate name: LP_Flexcomm11

enumerator kCLOCK_LPFlexComm12

Clock gate name: LP_Flexcomm12

enumerator kCLOCK_LPFlexComm13

Clock gate name: LP_Flexcomm13

enumerator kCLOCK_LPUart2

Clock gate name: LPUART2

enumerator kCLOCK_LPUart3

Clock gate name: LPUART3

enumerator kCLOCK_LPUart4

Clock gate name: LPUART4

enumerator kCLOCK_LPUart5

Clock gate name: LPUART5

enumerator kCLOCK_LPUart6

Clock gate name: LPUART6

enumerator kCLOCK_LPUart7

Clock gate name: LPUART7

enumerator kCLOCK_LPUart8

Clock gate name: LPUART8

enumerator kCLOCK_LPUart9

Clock gate name: LPUART9

enumerator kCLOCK_LPUart10

Clock gate name: LPUART10

enumerator kCLOCK_LPUart11

Clock gate name: LPUART11

enumerator kCLOCK_LPUart12

Clock gate name: LPUART12

enumerator kCLOCK_LPUart13

Clock gate name: LPUART13

enumerator kCLOCK_LPI2c2

Clock gate name: LPI2C2

enumerator kCLOCK_LPI2c3

Clock gate name: LPI2C3

enumerator kCLOCK_LPI2c4

Clock gate name: LPI2C4

enumerator kCLOCK_LPI2c5

Clock gate name: LPI2C5

enumerator kCLOCK_LPI2c6

Clock gate name: LPI2C6

enumerator kCLOCK_LPI2c7

Clock gate name: LPI2C7

enumerator kCLOCK_LPI2c8

Clock gate name: LPI2C8

enumerator kCLOCK_LPI2c9

Clock gate name: LPI2C9

enumerator kCLOCK_LPI2c10

Clock gate name: LPI2C10

enumerator kCLOCK_LPI2c11

Clock gate name: LPI2C11

enumerator kCLOCK_LPI2c12

Clock gate name: LPI2C12

enumerator kCLOCK_LPI2c13

Clock gate name: LPI2C13

enumerator kCLOCK_LPSpi2

Clock gate name: LPSPI2

enumerator kCLOCK_LPSpi3

Clock gate name: LPSPI3

enumerator kCLOCK_LPSpi4

Clock gate name: LPSPI4

enumerator kCLOCK_LPSpi5

Clock gate name: LPSPI5

enumerator kCLOCK_LPSpi6

Clock gate name: LPSPI6

enumerator kCLOCK_LPSpi7

Clock gate name: LPSPI7

enumerator kCLOCK_LPSpi8

Clock gate name: LPSPI8

enumerator kCLOCK_LPSpi9

Clock gate name: LPSPI9

enumerator kCLOCK_LPSpi10

Clock gate name: LPSPI10

enumerator kCLOCK_LPSpi11

Clock gate name: LPSPI11

enumerator kCLOCK_LPSpi12

Clock gate name: LPSPI12

enumerator kCLOCK_LPSpi13

Clock gate name: LPSPI13

enumerator kCLOCK_Sai0

Clock gate name: SAI0

enumerator kCLOCK_Sai1

Clock gate name: SAI1

enumerator kCLOCK_Sai2

Clock gate name: SAI2

enumerator kCLOCK_I3c0

Clock gate name: I3C0

enumerator kCLOCK_I3c1

Clock gate name: I3C1

enumerator kCLOCK_Crc0

Clock gate name: CRC0

enumerator kCLOCK_Wwdt0

Clock gate name: WWDT0

enumerator kCLOCK_Wwdt1

Clock gate name: WWDT1

enumerator kCLOCK_Ct32b0

Clock gate name: CTIMER0

enumerator kCLOCK_Ct32b1

Clock gate name: CTIMER1

enumerator kCLOCK_Ct32b2

Clock gate name: CTIMER2

enumerator kCLOCK_Ct32b3

Clock gate name: CTIMER3

enumerator kCLOCK_Ct32b4

Clock gate name: CTIMER4

enumerator kCLOCK_Mrt0

Clock gate name: Mrt0

enumerator kCLOCK_Utick0

Clock gate name: Utick0

enumerator kCLOCK_Sema424

Clock gate name: SEMA42_4

enumerator kCLOCK_Mu4

Clock gate name: MU4

enumerator kCLOCK_Pint0

Clock gate name: PINT0

enumerator kCLOCK_InputMux0

Clock gate name: PMUX_CMPT_SPLITTER

enumerator kCLOCK_Freqme0

Clock gate name: FREQME0

enumerator kCLOCK_SafoSgi

Clock gate name: SAFO_SGI

enumerator kCLOCK_Trace

Clock gate name: TRACE

enumerator kCLOCK_Prince0

Clock gate name: PRINCE0

enumerator kCLOCK_Prince1

Clock gate name: PRINCE1

enumerator kCLOCK_PrinceExe

Clock gate name: PRINCE_EXE

enumerator kCLOCK_Syspm0

Clock gate name: CMX_PERFMON0

enumerator kCLOCK_Syspm1

Clock gate name: CMX_PERFMON1

enumerator kCLOCK_Hifi4

Clock gate name: HIFI4

enumerator kCLOCK_Npu0

Clock gate name: NPU0

enumerator kCLOCK_CompAccessRamArbiter1

Clock gate name: COMP_ACCESS_RAM_ARBITER1

enumerator kCLOCK_Iopctl0

Clock gate name: IOMUXC_VDD2

enumerator kCLOCK_Hifi4AccessRamArbiter1

Clock gate name: HIFI4_ACCESS_RAM_ARBITER1

enumerator kCLOCK_MediaAccessRamArbiter0

Clock gate name: MEDIA_ACCESS_RAM_ARBITER0

enumerator kCLOCK_Sleepcon1

Clock gate name: SLEEPCONCPU1

enumerator kCLOCK_Syscon1

Clock gate name: SYSCONSENSE1

enumerator kCLOCK_SenseAccessRamArbiter0

Clock gate name: SENSE_ACCESS_RAM_ARBITER0

enumerator kCLOCK_Hifi1

Clock gate name: HIFI1

enumerator kCLOCK_Dma2

Clock gate name: DMA2

enumerator kCLOCK_Dma3

Clock gate name: DMA3

enumerator kCLOCK_LPFlexComm17

Clock gate name: LP_Flexcomm17

enumerator kCLOCK_LPFlexComm18

Clock gate name: LP_Flexcomm18

enumerator kCLOCK_LPFlexComm19

Clock gate name: LP_Flexcomm19

enumerator kCLOCK_LPFlexComm20

Clock gate name: LP_Flexcomm20

enumerator kCLOCK_LPI2c17

Clock gate name: LPI2C17

enumerator kCLOCK_LPI2c18

Clock gate name: LPI2C18

enumerator kCLOCK_LPI2c19

Clock gate name: LPI2C19

enumerator kCLOCK_LPI2c20

Clock gate name: LPI2C20

enumerator kCLOCK_LPSpi17

Clock gate name: LPSPI17

enumerator kCLOCK_LPSpi18

Clock gate name: LPSPI18

enumerator kCLOCK_LPSpi19

Clock gate name: LPSPI19

enumerator kCLOCK_LPSpi20

Clock gate name: LPSPI20

enumerator kCLOCK_LPUart17

Clock gate name: LPUART17

enumerator kCLOCK_LPUart18

Clock gate name: LPUART18

enumerator kCLOCK_LPUart19

Clock gate name: LPUART19

enumerator kCLOCK_LPUart20

Clock gate name: LPUART20

enumerator kCLOCK_Sai3

Clock gate name: SAI3

enumerator kCLOCK_I3c2

Clock gate name: I3C2

enumerator kCLOCK_I3c3

Clock gate name: I3C3

enumerator kCLOCK_Gpio8

Clock gate name: GPIO8

enumerator kCLOCK_Gpio9

Clock gate name: GPIO9

enumerator kCLOCK_Gpio10

Clock gate name: GPIO10

enumerator kCLOCK_Pint1

Clock gate name: PINT1

enumerator kCLOCK_InputMux1

Clock gate name: PMUX_SNS_SPLITTER

enumerator kCLOCK_Ct32b5

Clock gate name: CTIMER5

enumerator kCLOCK_Ct32b6

Clock gate name: CTIMER6

enumerator kCLOCK_Ct32b7

Clock gate name: CTIMER7

enumerator kCLOCK_Mrt1

Clock gate name: Mrt1

enumerator kCLOCK_Utick1

Clock gate name: Utick1

enumerator kCLOCK_Cdog3

Clock gate name: CDOG3

enumerator kCLOCK_Cdog4

Clock gate name: CDOG4

enumerator kCLOCK_Mu3

Clock gate name: MU3

enumerator kCLOCK_Sema423

Clock gate name: SEMA42_3

enumerator kCLOCK_Wwdt2

Clock gate name: WWDT2

enumerator kCLOCK_Wwdt3

Clock gate name: WWDT3

enumerator kCLOCK_Syscon2

Clock gate name: SYSCON_COMM

enumerator kCLOCK_Iopctl2

Clock gate name: IOMUXC_VDDN

enumerator kCLOCK_Cpu1

Clock gate name: CPU1

enumerator kCLOCK_Mu0

Clock gate name: MU0

enumerator kCLOCK_Mu1

Clock gate name: MU1

enumerator kCLOCK_Mu2

Clock gate name: MU2

enumerator kCLOCK_OsTimer

Clock gate name: OsTimer

enumerator kCLOCK_Sema420

Clock gate name: SEMA42_0

enumerator kCLOCK_Sdadc0

Clock gate name: SDADC0

enumerator kCLOCK_Adc0

Clock gate name: SARADC0

enumerator kCLOCK_Acmp0

Clock gate name: Acmp0

enumerator kCLOCK_Pdm

Clock gate name: MICFIL(PDM)

enumerator kCLOCK_Glikey4

Clock gate name: GLIKEY_SYSCON1

enumerator kCLOCK_Dbg

Clock gate name: DBG

enumerator kCLOCK_Syscon3

Clock gate name: SYSCON_SENSE0

enumerator kCLOCK_Iopctl1

Clock gate name: IOMUXC_VDD1

enumerator kCLOCK_Glikey1

Clock gate name: GLIKEY1

enumerator kCLOCK_LPI2c15

Clock gate name: LPI2C

enumerator kCLOCK_MediaAccessRamArbiter1

Clock gate name: MEDIA_ACCESS_RAM_ARBITER1

enumerator kCLOCK_Axi0

Clock gate name: AXI0

enumerator kCLOCK_Gpu

Clock gate name: VGPU

enumerator kCLOCK_MipiDsiCtrl

Clock gate name: MIPIDSI

enumerator kCLOCK_LPSpi16

Clock gate name: LPSPI16

enumerator kCLOCK_LPSpi14

Clock gate name: LPSPI14

enumerator kCLOCK_Xspi2

Clock gate name: XSPI2

enumerator kCLOCK_Mmu2

Clock gate name: MMU2

enumerator kCLOCK_Glikey5

Clock gate name: GLIKEY_SYSCON2

enumerator kCLOCK_Flexio

Clock gate name: FLEXIO0

enumerator kCLOCK_Lcdif

Clock gate name: LCDIF(DCN)

enumerator kCLOCK_Syscon4

Clock gate name: SYSCONMEDIA

enumerator kCLOCK_JpgDecoder

Clock gate name: JPG_DECODER

enumerator kCLOCK_PngDecoder

Clock gate name: PNG_DECODER

enumerator kCLOCK_Ezhv

Clock gate name: EZHV

enumerator kCLOCK_AxbsEzh

Clock gate name: AXBS_EZH

enumerator kCLOCK_Glikey2

Clock gate name: GLIKEY2

enumerator kCLOCK_Usb0

Clock gate name: USB0

enumerator kCLOCK_Usb1

Clock gate name: USB1

enumerator kCLOCK_Usdhc0

Clock gate name: USHDC0

enumerator kCLOCK_Usdhc1

Clock gate name: USDHC1

enumerator kCLOCK_Gdet3Ref

Clock gate name: GDET3 Reference clock

enumerator kCLOCK_Rtc

RTC functional clock gating.

enumerator kCLOCK_Gdet3

GDET3 functional clock gating.

enumerator kCLOCK_UsbphyRef

USBPHY referrence clock gating.

enum _clock_name

Clock name used to get clock frequency.

Values:

enumerator kCLOCK_CoreSysClk

Core clock (aka system clock)

enumerator kCLOCK_BusClk

Bus clock (AHB/APB clock, aka HCLK)

enumerator kCLOCK_MclkClk

MCLK, to MCLK pin

enumerator kCLOCK_Wdt2Clk

Watchdog1

enumerator kCLOCK_Wdt3Clk

Watchdog1

enumerator kCLOCK_Hifi1CpuClk

Hifi1 DSP clock

enumerator kCLOCK_LPFlexComm17Clk

Flexcomm17Clock

enumerator kCLOCK_LPFlexComm18Clk

Flexcomm18Clock

enumerator kCLOCK_LPFlexComm19Clk

Flexcomm19Clock

enumerator kCLOCK_LPFlexComm20Clk

Flexcomm20Clock

enumerator kCLOCK_Vdd1ClockOutClk

VDD1 CLOCKOUT

enumerator kCLOCK_AdcClk

ADC

enumerator kCLOCK_Xspi2Clk

XSPI1

enumerator kCLOCK_SctClk

SCT

enumerator kCLOCK_SystickClk

Systick

enumerator kCLOCK_Sdio0Clk

SDIO0

enumerator kCLOCK_Sdio1Clk

SDIO1

enumerator kCLOCK_I3cClk

I3C

enumerator kCLOCK_Usb0Clk

USB0

enumerator kCLOCK_Usb1Clk

USB1

enumerator kCLOCK_PdmClk

Digital Mic clock

enumerator kCLOCK_AcmpClk

Acmp clock

enumerator kCLOCK_FlexioClk

FlexIO

enumerator kCLOCK_LPSpi14Clk

LPSPI14

enumerator kCLOCK_LPI2c15Clk

LPI2C15

enumerator kCLOCK_LPSpi16Clk

LPSPI16

enumerator kCLOCK_VgpuClk

VGPU Core

enumerator kCLOCK_LcdifClk

LCDIF Clock

enumerator kCLOCK_MipiDphyClk

MIPI D-PHY Bit Clock

enumerator kCLOCK_MipiDphyEscRxClk

MIPI D-PHY RX Clock

enumerator kCLOCK_MipiDphyEscTxClk

MIPI D-PHY TX Clock

enum _clock_attach_id

The enumerator of clock attach Id for multi sources clock slices. Not all Muxer has MUX output enable control, if no mux output enable control, the mux output will be always enabled.

Values:

enumerator kFRO1_DIV3_to_SENSE_BASE

Attach FRO1 divided-by-3 clock to Sense Base Clock.

enumerator kFRO1_DIV1_to_SENSE_BASE

Attach FRO1 max clock to Sense Base Clock.

enumerator kFRO2_DIV3_to_SENSE_BASE

Attach FRO2 divided-by-3 clock to Sense Base Clock.

enumerator kLPOSC_to_SENSE_BASE

Attach LPOSC to Sense Base Clock.

enumerator kSENSE_BASE_to_SENSE_DSP

Attach Sense base clock to Sense DSP Clock.

enumerator kFRO2_DIV1_to_SENSE_DSP

Attach FRO2 max clock to Sense DSP Clock.

enumerator kAUDIO_PLL_PFD1_to_SENSE_DSP

Attach Audio PLL PFD1 clock to Sense DSP Clock.

enumerator kFRO1_DIV1_to_SENSE_DSP

Attach FRO1 max clock to Sense DSP Clock.

enumerator kNONE_to_SENSE_DSP

Attach NONE to Sense DSP Clock.

enumerator kSENSE_BASE_to_SAI3

Attach Sense base clock to SAI3 Clock.

enumerator kFRO2_DIV8_to_SAI3

Attach FRO2_DIV8 clock to SAI3 Clock.

enumerator kFRO2_DIV1_to_SAI3

Attach FRO2 clock to SAI3 Clock.

enumerator kAUDIO_VDD1_to_SAI3

Attach audio_clk to SAI3 Clock.

enumerator kNONE_to_SAI3

Attach NONE to SAI3 Clock.

enumerator kSENSE_BASE_to_UTICK

Attach Sense base clock to UTICK Functional Clock.

enumerator kLPOSC_to_UTICK

Attach LPOSC clock to UTICK Functional Clock.

enumerator kFRO2_DIV1_to_UTICK

Attach FRO2 max clock to UTICK Functional Clock.

enumerator kFRO1_DIV2_to_UTICK

Attach FRO1_DIV2 clock to UTICK Functional Clock.

enumerator kNONE_to_UTICK

Attach NONE to UTICK Functional Clock.

enumerator kLPOSC_to_WWDT2

Attach LPOSC clock to WWDT2 Functional Clock.

enumerator kNONE_to_WWDT2

Attach NONE to WWDT2 Functional Clock.

enumerator kLPOSC_to_WWDT3

Attach LPOSC clock to WWDT3 Functional Clock.

enumerator kNONE_to_WWDT3

Attach NONE to WWDT3 Functional Clock.

enumerator kSENSE_BASE_to_SYSTICK

Attach Sense base clock to SYSTICK Functional Clock.

enumerator kLPOSC_to_SYSTICK

Attach LPOSC clock to SYSTICK Functional Clock.

enumerator k32KHZ_WAKE_to_SYSTICK

Attach 32 kHz wake clock(switch to other clock source before sense vdd1 enter SRPG mode.) to SYSTICK Functional Clock.

enumerator kOSC_CLK_to_SYSTICK

Attach OSC clock to SYSTICK Functional Clock.

enumerator kNONE_to_SYSTICK

Attach NONE to SYSTICK Functional Clock.

enumerator kSENSE_BASE_to_CTIMER5

Attach Sense base clock to CTIMER5 Clock.

enumerator kAUDIO_VDD1_to_CTIMER5

Attach audio_clk to CTIMER5 Clock.

enumerator kFRO2_DIV1_to_CTIMER5

Attach FRO2 Max clock to CTIMER5 Clock.

enumerator k32KHZ_WAKE_to_CTIMER5

Attach 32KHz wake clock to CTIMER5 Clock.

enumerator kNONE_to_CTIMER5

Attach NONE to CTIMER5 Clock.

enumerator kSENSE_BASE_to_CTIMER6

Attach Sense base clock to CTIMER6 Clock.

enumerator kAUDIO_VDD1_to_CTIMER6

Attach audio_clk to CTIMER6 Clock.

enumerator kFRO2_DIV1_to_CTIMER6

Attach FRO2 Max clock to CTIMER6 Clock.

enumerator k32KHZ_WAKE_to_CTIMER6

Attach 32KHz wake clock to CTIMER6 Clock.

enumerator kNONE_to_CTIMER6

Attach NONE to CTIMER6 Clock.

enumerator kSENSE_BASE_to_CTIMER7

Attach Sense base clock to CTIMER7 Clock.

enumerator kAUDIO_VDD1_to_CTIMER7

Attach audio_clk to CTIMER7 Clock.

enumerator kFRO2_DIV1_to_CTIMER7

Attach FRO2 Max clock to CTIMER7 Clock.

enumerator k32KHZ_WAKE_to_CTIMER7

Attach 32KHz wake clock to CTIMER7 Clock.

enumerator kNONE_to_CTIMER7

Attach NONE to CTIMER7 Clock.

enumerator kSENSE_BASE_to_I3C23

Attach Sense base clock to I3C2 and I3C3 Functional Clock.

enumerator kFRO2_DIV1_to_I3C23

Attach FRO2 max clock to I3C2 and I3C3 Functional Clock.

enumerator kFRO1_DIV8_to_I3C23

Attach FRO2_DIV8 clock to I3C2 and I3C3 Functional Clock.

enumerator kOSC_CLK_to_I3C23

Attach OSC clock to I3C2 and I3C3 Functional Clock.

enumerator kNONE_to_I3C23

Attach NONE to I3C2 and I3C3 Functional Clock.

enumerator kMCLK_to_AUDIO_VDD1

Attach MCLK IN from Pad to Audio VDD1 Clock.

enumerator kOSC_to_AUDIO_VDD1

Attach OSC clock to Audio VDD1 Clock.

enumerator kFRO2_DIV8_to_AUDIO_VDD1

Attach FRO2_DIV8 clock to Audio VDD1 Clock.

enumerator kAUDIO_PLL_PFD3_to_AUDIO_VDD1

Attach AUDIO PLL PFD3 clock to Audio VDD1 Clock.

enumerator kSENSE_BASE_to_FLEXCOMM17

Attach Sense base clock to FLEXCOMM17.

enumerator kFRO2_DIV1_to_FLEXCOMM17

Attach FRO2 max clock to FLEXCOMM17.

enumerator kFRO1_DIV1_to_FLEXCOMM17

Attach FRO1 max clock to FLEXCOMM17.

enumerator k32KHZ_WAKE_to_FLEXCOMM17

Attach 32k_wake_clk to FLEXCOMM17.

enumerator kNONE_to_FLEXCOMM17

Attach NONE to FLEXCOMM17.

enumerator kSENSE_BASE_to_FLEXCOMM18

Attach Sense base clock to FLEXCOMM18.

enumerator kFRO2_DIV1_to_FLEXCOMM18

Attach FRO2 max clock to FLEXCOMM18.

enumerator kFRO1_DIV1_to_FLEXCOMM18

Attach FRO1 max clock to FLEXCOMM18.

enumerator k32KHZ_WAKE_to_FLEXCOMM18

Attach 32k_wake_clk to FLEXCOMM18.

enumerator kNONE_to_FLEXCOMM18

Attach NONE to FLEXCOMM18.

enumerator kSENSE_BASE_to_FLEXCOMM19

Attach Sense base clock to FLEXCOMM19.

enumerator kFRO2_DIV1_to_FLEXCOMM19

Attach FRO2 max clock to FLEXCOMM19.

enumerator kFRO1_DIV1_to_FLEXCOMM19

Attach FRO1 max clock to FLEXCOMM19.

enumerator k32KHZ_WAKE_to_FLEXCOMM19

Attach 32k_wake_clk to FLEXCOMM19.

enumerator kNONE_to_FLEXCOMM19

Attach NONE to FLEXCOMM19.

enumerator kSENSE_BASE_to_FLEXCOMM20

Attach Sense base clock to FLEXCOMM20.

enumerator kFRO2_DIV1_to_FLEXCOMM20

Attach FRO2 max clock to FLEXCOMM20.

enumerator kFRO1_DIV1_to_FLEXCOMM20

Attach FRO1 max clock to FLEXCOMM20.

enumerator k32KHZ_WAKE_to_FLEXCOMM20

Attach 32k_wake_clk to FLEXCOMM20.

enumerator kNONE_to_FLEXCOMM20

Attach NONE to FLEXCOMM20.

enumerator kCOMMON_BASE_to_COMMON_VDDN

Attach Common base clock to Common VDDN Clock.

enumerator kMAIN_PLL_PFD3_to_COMMON_VDDN

Attach Main PLL PFD3 clock to Common VDDN Clock.

enumerator kFRO1_DIV1_to_COMMON_VDDN

Attach FRO1 max clock to Common VDDN Clock.

enumerator kOSC_CLK_to_COMMON_VDDN

Attach OSC clock to Common VDDN Clock.

enumerator kOSC_CLK_to_USB_24MHZ

Attach OSC_CLK clock to 24MHz USB OSC Clock.

enumerator kFRO1_DIV8_to_USB_24MHZ

Attach FRO1_DIV8 clock to 24MHz USB OSC Clock.

enumerator kFRO1_DIV3_to_COMMON_BASE

Attach Fro1 divided-by-3 to Common Base Clock.

enumerator kFRO1_DIV1_to_COMMON_BASE

Attach Fro1 divided-by-1 to Common Base Clock.

enumerator kFRO0_DIV3_to_COMMON_BASE

Attach Fro0 divided-by-3 to Common Base Clock.

enumerator kLPOSC_to_COMMON_BASE

Attach LPOSC to Common Base Clock.

enumerator kOSC_CLK_to_EUSB_24MHZ

Attach OSC_CLK clock to 24MHz eUSB OSC Clock.

enumerator kFRO1_DIV8_to_EUSB_24MHZ

Attach FRO1_DIV8 clock to 24MHz eUSB OSC Clock.

enumerator kFRO1_DIV8_to_MAIN_PLL0

Attach FRO1_DIV8 clock to Main PLL0 Clock.

enumerator kOSC_CLK_to_MAIN_PLL0

Attach OSC_CLK clock to Main PLL0 Clock.

enumerator kFRO1_DIV8_to_AUDIO_PLL0

Attach FRO1_DIV8 to Audio PLL0 Clock.

enumerator kOSC_CLK_to_AUDIO_PLL0

Attach OSC_CLK clock (User-Selectable) to Audio PLL0 Clock.

enumerator kSENSE_BASE_to_SENSE_MAIN

Attach Sense base clock to Sense main clock.

enumerator kFRO2_DIV1_to_SENSE_MAIN

Attach FRO2 max clock to Sense main clock.

enumerator kAUDIO_PLL_PFD3_to_SENSE_MAIN

Attach Audio PLL PFD3 clock to Sense main clock.

enumerator kFRO1_DIV1_to_SENSE_MAIN

Attach FRO1 max clock to Sense main clock.

enumerator kSENSE_BASE_to_SENSE_RAM

Attach Sense base clock to Sense RAM clock.

enumerator kFRO2_DIV1_to_SENSE_RAM

Attach FRO2 max clock to Sense RAM clock.

enumerator kAUDIO_PLL_PFD2_to_SENSE_RAM

Attach Audio PLL PFD2 clock to Sense RAM clock.

enumerator kFRO1_DIV1_to_SENSE_RAM

Attach FRO1 max clock to Sense RAM clock.

enumerator kSENSE_BASE_to_OSTIMER

Attach Sense Base to OSTIMER.

enumerator k32KHZ_WAKE_to_OSTIMER

Attach 32k_wake_clk to OSTIMER.

enumerator kLPOSC_to_OSTIMER

Attach LPOSC to OSTIMER.

enumerator kOSC_CLK_to_OSTIMER

Attach OSC clock to OSTIMER.

enumerator kNONE_to_OSTIMER

Attach NONE to OSTIMER.

enumerator kSENSE_BASE_to_SDADC

Attach Sense base clock to SDADC Functional Clock.

enumerator kFRO2_DIV8_to_SDADC

Attach FRO2_DIV8 clock to SDADC Functional Clock.

enumerator kAUDIO_PLL_to_SDADC

Attach Audio PLL VCO clock to SDADC Functional Clock.

enumerator kAUDIO_VDD1_to_SDADC

Attach audio_clk to SDADC Functional Clock.

enumerator kNONE_to_SDADC

Attach NONE to SDADC Functional Clock.

enumerator kSENSE_BASE_to_ADC

Attach Sense base clock to SARADC Functional Clock.

enumerator kMAIN_PLL_PFD1_to_ADC

Attach main_pll_pfd1 to SARADC Functional Clock.

enumerator kFRO2_DIV1_to_ADC

Attach FRO0 max clock to SARADC Functional Clock.

enumerator kOSC_CLK_to_ADC

Attach osc_clk to SARADC Functional Clock.

enumerator kNONE_to_ADC

Attach NONE to SARADC Functional Clock.

enumerator kOSC32K_to_32K_WAKE

Attach OSC 32K to Wake 32k Clock.

enumerator kLPOSC_DIV32_to_32K_WAKE

Attach LPOSC clock divided by 32 by default to Wake 32k Clock.

enumerator kNONE_to_32K_WAKE

Attach NONE to Wake 32k Clock.

enumerator kSENSE_BASE_to_MICFIL0

Attach Sense base clock to MICFIL0 Functional Clock.

enumerator kAUDIO_PLL_PFD3_to_MICFIL0

Attach Audio PLL PFD3 clock to MICFIL0 Functional Clock.

enumerator kFRO2_DIV1_to_MICFIL0

Attach FRO2 MAX clock to MICFIL0 Functional Clock.

enumerator kAUDIO_VDD1_to_MICFIL0

Attach Audio clock to MICFIL0 Functional Clock.

enumerator kNONE_to_MICFIL0

Attach NONE to MICFIL0 Functional Clock.

enumerator kSENSE_BASE_to_LPI2C15

Attach Sense base clock to LPI2C15 Functional Clock.

enumerator kFRO1_DIV1_to_LPI2C15

Attach FRO1 max clock to LPI2C15 Functional Clock.

enumerator kFRO1_DIV2_to_LPI2C15

Attach FRO1 divided-by-2 to LPI2C15 Functional Clock.

enumerator kFRO2_DIV1_to_LPI2C15

Attach FRO2 max clock to LPI2C15 Functional Clock.

enumerator kNONE_to_LPI2C15

Attach NONE to LPI2C15 Functional Clock.

enumerator kSENSE_BASE_to_VDD1_CLKOUT

Attach Sense VDD1 Base Clock to VDD1 CLKOUT Clock.

enumerator kAUDIO_PLL_PFD3_to_VDD1_CLKOUT

Attach AUDIO PLL PFD3 Clock to VDD1 CLKOUT Clock.

enumerator kFRO2_DIV1_to_VDD1_CLKOUT

Attach FRO2 Max Clock to VDD1 CLKOUT Clock.

enumerator kFRO1_DIV1_to_VDD1_CLKOUT

Attach FRO1 Max Clock to VDD1 CLKOUT Clock.

enumerator kNONE_to_VDD1_CLKOUT

Attach NONE to VDD1 CLKOUT Clock.

enumerator kMEDIA_VDDN_BASE_to_MEDIA_VDDN

Attach MEDIA VDDN base clock to MEDIA VDDN clock.

enumerator kMAIN_PLL_PFD0_to_MEDIA_VDDN

Attach MAIN PLL PFD0 to MEDIA VDDN clock.

enumerator kFRO0_DIV1_to_MEDIA_VDDN

Attach FRO0 max to MEDIA VDDN clock.

enumerator kMAIN_PLL_PFD2_to_MEDIA_VDDN

Attach MAIN PLL PFD2 to MEDIA VDDN clock.

enumerator kMEDIA_VDD2_BASE_to_MEDIA_MAIN

Attach MEDIA VDD2 base clock to MEDIA MAIN clock.

enumerator kMAIN_PLL_PFD0_to_MEDIA_MAIN

Attach Main PLL PFD0 clock to MEDIA MAIN clock.

enumerator kFRO0_DIV1_to_MEDIA_MAIN

Attach FRO0 to MEDIA MAIN clock.

enumerator kMAIN_PLL_PFD2_to_MEDIA_MAIN

Attach Main PLL PFD2 clock to MEDIA MAIN clock.

enumerator kFRO1_DIV3_to_MEDIA_VDDN_BASE

Attach Fro1 divided-by-3 to Media VDDN Base Clock.

enumerator kFRO1_DIV1_to_MEDIA_VDDN_BASE

Attach Fro1 divided-by-1 to Media VDDN Base Clock.

enumerator kFRO0_DIV3_to_MEDIA_VDDN_BASE

Attach Fro0 divided-by-3 to Media VDDN Base Clock.

enumerator kLPOSC_to_MEDIA_VDDN_BASE

Attach LPOSC clock to Media VDDN Base Clock.

enumerator kFRO1_DIV3_to_MEDIA_VDD2_BASE

Attach Fro1 divided-by-3 to Media VDD2 Base Clock.

enumerator kFRO1_DIV1_to_MEDIA_VDD2_BASE

Attach Fro1 divided-by-1 to Media VDD2 Base Clock.

enumerator kFRO0_DIV3_to_MEDIA_VDD2_BASE

Attach Fro0 divided-by-3 to Media VDD2 Base Clock.

enumerator kLPOSC_to_MEDIA_VDD2_BASE

Attach LPOSC clock to Media VDD2 Base Clock.

enumerator kCOMMON_BASE_to_XSPI2

Attach Common VDDN base clock to XSPI2 Functional Clock.

enumerator kAUDIO_PLL_PFD1_to_XSPI2

Attach Audio PLL PFD1 clock to XSPI2 Functional Clock.

enumerator kFRO0_DIV1_to_XSPI2

Attach FRO0 max clock to XSPI2 Functional Clock.

enumerator kMAIN_PLL_PFD3_to_XSPI2

Attach Main PLL PFD3 clock to XSPI2 Functional Clock.

enumerator kNONE_to_XSPI2

Attach NONE to XSPI2 Functional Clock.

enumerator k32KHZ_WAKE_to_USB

Attach Wakeup 32K to USB Functional Clock.

enumerator kLPOSC_to_USB

Attach LPOSC_1M to USB Functional Clock.

enumerator kUSB_24MHZ_to_USB

Attach 24MHz USB OSC clock to USB Functional Clock.

enumerator kNONE_to_USB

Attach NONE to USB Functional Clock.

enumerator k32KHZ_WAKE_to_EUSB

Attach Wakeup 32K to eUSB Functional Clock.

enumerator kLPOSC_to_EUSB

Attach LPOSC_1M to eUSB Functional Clock.

enumerator kEUSB_24MHZ_to_EUSB

Attach 24MHz eUSB OSC clock to eUSB Functional Clock.

enumerator kNONE_to_EUSB

Attach NONE to eUSB Functional Clock.

enumerator kMEDIA_VDDN_BASE_to_SDIO0

Attach Media VDDN base clock to SDIO0 Functional Clock.

enumerator kAUDIO_PLL_PFD0_to_SDIO0

Attach Audio PLL PFD0 clock to SDIO0 Functional Clock.

enumerator kFRO0_DIV1_to_SDIO0

Attach FRO0 max clock to SDIO0 Functional Clock.

enumerator kMAIN_PLL_PFD2_to_SDIO0

Attach Main PLL PFD2 clock to SDIO0 Functional Clock.

enumerator kNONE_to_SDIO0

Attach NONE to SDIO0 Functional Clock.

enumerator kMEDIA_VDDN_BASE_to_SDIO1

Attach Media VDDN base clock to SDIO1 Functional Clock.

enumerator kAUDIO_PLL_PFD0_to_SDIO1

Attach Audio PLL PFD0 clock to SDIO1 Functional Clock.

enumerator kFRO0_DIV1_to_SDIO1

Attach FRO0 max clock to SDIO1 Functional Clock.

enumerator kMAIN_PLL_PFD1_to_SDIO1

Attach Main PLL PFD1 clock to SDIO1 Functional Clock.

enumerator kNONE_to_SDIO1

Attach NONE to SDIO1 Functional Clock.

enumerator kMEDIA_VDD2_BASE_to_MIPI_DSI_HOST_PHY

Attach Media VDD2 base clock to MIPI_DSI_Host PHY Clock.

enumerator kFRO0_DIV1_to_MIPI_DSI_HOST_PHY

Attach FRO0 max clock to MIPI_DSI_Host PHY Clock.

enumerator kAUDIO_PLL_PFD2_to_MIPI_DSI_HOST_PHY

Attach Audio PLL PFD2 clock to MIPI_DSI_Host PHY Clock.

enumerator kNONE_to_MIPI_DSI_HOST_PHY

Attach NONE to MIPI_DSI_Host PHY Clock.

enumerator kMEDIA_VDD2_BASE_to_MIPI_DPHYESC_CLK

Attach Media VDD2 base clock to MIPI_DSI_Host DPHY Escape Mode Clock.

enumerator kMAIN_PLL_PFD1_to_MIPI_DPHYESC_CLK

Attach Main PLL PFD1 clock to MIPI_DSI_Host DPHY Escape Mode Clock.

enumerator kFRO0_DIV1_to_MIPI_DPHYESC_CLK

Attach FRO0 max clock to MIPI_DSI_Host DPHY Escape Mode Clock.

enumerator kAUDIO_PLL_PFD2_to_MIPI_DPHYESC_CLK

Attach Audio PLL PFD2 clock to MIPI_DSI_Host DPHY Escape Mode Clock.

enumerator kNONE_to_MIPI_DPHYESC_CLK

Attach NONE to MIPI_DSI_Host DPHY Escape Mode Clock.

enumerator kMEDIA_VDD2_BASE_to_VGPU

Attach Media VDD2 base clock to VGPU Clock.

enumerator kMAIN_PLL_PFD0_to_VGPU

Attach Main PLL PFD0 clock to VGPU Clock.

enumerator kFRO0_DIV1_to_VGPU

Attach FRO0 max clock to VGPU Clock.

enumerator kMAIN_PLL_PFD2_to_VGPU

Attach Main PLL PFD2 clock to VGPU Clock.

enumerator kNONE_to_VGPU

Attach NONE to VGPU Clock.

enumerator kMEDIA_VDD2_BASE_to_LPSPI14

Attach Media VDD2 base clock to LPSPI14 Clock.

enumerator kFRO0_DIV1_to_LPSPI14

Attach FRO0 max clock to LPSPI14 Clock.

enumerator kMAIN_PLL_PFD0_to_LPSPI14

Attach Main PLL PFD0 clock to LPSPI14 Clock.

enumerator kFRO1_DIV1_to_LPSPI14

Attach FRO1 max clock to LPSPI14 Clock.

enumerator kNONE_to_LPSPI14

Attach NONE to LPSPI14 Clock.

enumerator kMEDIA_VDD2_BASE_to_LPSPI16

Attach Media VDD2 base clock to LPSPI16 Clock.

enumerator kFRO0_DIV1_to_LPSPI16

Attach FRO0 max clock to LPSPI16 Clock.

enumerator kMAIN_PLL_PFD0_to_LPSPI16

Attach Main PLL PFD0 clock to LPSPI16 Clock.

enumerator kFRO1_DIV1_to_LPSPI16

Attach FRO1 max clock to LPSPI16 Clock.

enumerator kNONE_to_LPSPI16

Attach NONE to LPSPI16 Clock.

enumerator kMEDIA_VDD2_BASE_to_FLEXIO

Attach MEDIA VDD2 base clock to FLEXIO.

enumerator kFRO0_DIV1_to_FLEXIO

Attach FRO0 max clock to FLEXIO.

enumerator kFRO1_DIV1_to_FLEXIO

Attach FRO1 max clock to FLEXIO.

enumerator kMAIN_PLL_PFD3_to_FLEXIO

Attach Main PLL PFD3 clock to FLEXIO.

enumerator kNONE_to_FLEXIO

Attach NONE to FLEXIO.

enumerator kMEDIA_VDD2_BASE_to_LCDIF

Attach MEDIA VDD2 base clock to LCDIF.

enumerator kMAIN_PLL_PFD2_to_LCDIF

Attach Main PLL PFD0 clock to LCDIF.

enumerator kFRO0_DIV1_to_LCDIF

Attach FRO0 max clock to LCDIF.

enumerator kAUDIO_PLL_PFD1_to_LCDIF

Attach Audio PLL PFD1 to LCDIF.

enumerator kNONE_to_LCDIF

Attach NONE to LCDIF.

enum _clock_div_name

Clock dividers.

Values:

enumerator kCLOCK_DivLPFlexComm17Clk

LP_FLEXCOMM17 Clk Divider.

enumerator kCLOCK_DivLPFlexComm18Clk

LP_FLEXCOMM18 Clk Divider.

enumerator kCLOCK_DivLPFlexComm19Clk

LP_FLEXCOMM19 Clk Divider.

enumerator kCLOCK_DivLPFlexComm20Clk

LP_FLEXCOMM20 Clk Divider.

enumerator kCLOCK_DivSenseDspClk

Sense DSP Clk Divider.

enumerator kCLOCK_DivSai3Clk

SAI3 FCLK Clk Divider.

enumerator kCLOCK_DivUtick1Clk

UTICK1 Functional Clk Divider.

enumerator kCLOCK_DivSystickClk

SYSTICK Functional Clk Divider.

enumerator kCLOCK_DivCtimer5Clk

CTIMER5 FCLK Clk Divider.

enumerator kCLOCK_DivCtimer6Clk

CTIMER6 FCLK Clk Divider.

enumerator kCLOCK_DivCtimer7Clk

CTIMER7 FCLK Clk Divider.

enumerator kCLOCK_DivI3c23Clk

I3C2 and I3C3 Functional Clk Divider.

enumerator kCLOCK_DivCommonVddnClk

Common VDDN Clk Divider.

enumerator kCLOCK_DivSenseMainClk

VDD1_SENSE Main Clock Divider.

enumerator kCLOCK_DivSenseRamClk

Senese RAM Clk Divider.

enumerator kCLOCK_DivOstimerClk

OSTIMER Clk Divider.

enumerator kCLOCK_DivSdadcClk

SDADC Clk Divider.

enumerator kCLOCK_DivAdcClk

SARADC Clk Divider.

enumerator kCLOCK_Div32KhzWakeClk

32KHZ Wakeup Clk Divider.

enumerator kCLOCK_DivMicfil0Clk

DMIC0 Clk Divider.

enumerator kCLOCK_DivLpi2c15Clk

PMIC LPI2C Clk Divider.

enumerator kCLOCK_DivVdd1ClockOut

CLKOUT_VDD1 Clk Divider.

enumerator kCLOCK_DivMediaVddnClk

Media VDDN Clk Divider.

enumerator kCLOCK_DivMediaMainClk

Media Main Clk Divider.

enumerator kCLOCK_DivXspi2Clk

XSPI2 Clk Divider.

enumerator kCLOCK_DivSdio0Clk

SDIO0 Clk Divider.

enumerator kCLOCK_DivSdio1Clk

SDIO1 Clk Divider.

enumerator kCLOCK_DivDphyClk

DPHY Clk Divider.

enumerator kCLOCK_DivDphyEscRxClk

DphyEscRx Clk Divider.

enumerator kCLOCK_DivDphyEscTxClk

DphyEscTx Clk Divider.

enumerator kCLOCK_DivVgpuClk

VGPU Clk Divider.

enumerator kCLOCK_DivLpspi14Clk

LPSPI14 Clk Divider.

enumerator kCLOCK_DivLpspi16Clk

LPSPI16 Clk Divider.

enumerator kCLOCK_DivFlexioClk

FLEXIO Clk Divider.

enumerator kCLOCK_DivLcdifClk

LCDIF Pixel Clk Divider.

enumerator kCLOCK_DivLowFreqClk

Low frequency Clk Divider.

enum _clock_fro_output_en

FRO output enable.

Values:

enumerator kCLOCK_FroDiv1OutEn

Enable Fro Div1 output.

enumerator kCLOCK_FroDiv2OutEn

Enable Fro Div2 output.

enumerator kCLOCK_FroDiv3OutEn

Enable Fro Div3 output.

enumerator kCLOCK_FroDiv6OutEn

Enable Fro Div6 output.

enumerator kCLOCK_FroDiv8OutEn

Enable Fro Div8 output.

enumerator kCLOCK_FroAllOutEn

Enable all Fro output.

enum _clock_fro_interrupt

FRO Interrupt control.

Values:

enumerator kCLOCK_FroTrimUpdateReqInt

Trim Update Request Interrupt Enable.

enumerator kCLOCK_FroTuneErrInt

Tune Error Interrupt Enable.

enumerator kCLOCK_FroLossOfLockInt

Loss-of-Lock Error Interrupt Enable.

enumerator kCLOCK_FroAllIntterrupt

All Interrupt Enable.

enum _clock_fro_flag

FRO flags.

Values:

enumerator kCLOCK_FroTuneOnceDone

FRO Tune Once Done Flag.

enumerator kCLOCK_FroTrimLock

FRO Trim Lock Flag.

enumerator kCLOCK_FroTrimUpdateReq

FRO Trim Update Request Flag.

enumerator kCLOCK_FroTuneErr

FRO Tune Error Flag.

enumerator kCLOCK_FroLossOfLockErr

FRO Loss-of-lock Error Flag.

enum _clock_domain_enable

Clock Control for each power domain.

Values:

enumerator kCLOCK_Vdd2CompDomainEnable

Clock Control of VDD2_COMP Domain.

enumerator kCLOCK_Vdd1SenseDomainEnable

Clock Control of VDD1_SENSE Domain.

enumerator kCLOCK_Vdd2DspDomainEnable

Clock Control of VDD2_DSP Domain.

enumerator kCLOCK_Vdd2MediaDomainEnable

Clock Control of VDD2_MEDIA Domain.

enumerator kCLOCK_VddnMediaDomainEnable

Clock Control of VDDN_MEDIA Domain.

enumerator kCLOCK_Vdd2ComDomainEnable

Clock Control of VDD2_COM Domain.

enumerator kCLOCK_VddnComDomainEnable

Clock Control of VDDN_COM Domain.

enumerator kCLOCK_AllDomainEnable

Clock Control of all Domain.

enum _clock_pfd

PLL PFD clock name.

Values:

enumerator kCLOCK_Pfd0

PLL PFD0

enumerator kCLOCK_Pfd1

PLL PFD1

enumerator kCLOCK_Pfd2

PLL PFD2

enumerator kCLOCK_Pfd3

PLL PFD3

enum _main_pll_src

MainPLL Reference Input Clock Source.

Values:

enumerator kCLOCK_MainPllFro1Div8

FRO1_DIV8 clock

enumerator kCLOCK_MainPllOscClk

OSC clock

enum _main_pll_mult

MainPLL Multiplication Factor.

Values:

enumerator kCLOCK_MainPllMult16

Divide by 16

enumerator kCLOCK_MainPllMult17

Divide by 17

enumerator kCLOCK_MainPllMult18

Divide by 18

enumerator kCLOCK_MainPllMult19

Divide by 19

enumerator kCLOCK_MainPllMult20

Divide by 20

enumerator kCLOCK_MainPllMult21

Divide by 21

enumerator kCLOCK_MainPllMult22

Divide by 22

enum _audio_pll_src

AudioPll Reference Input Clock Source.

Values:

enumerator kCLOCK_AudioPllFro1Div8

FRO1_DIV8 clock

enumerator kCLOCK_AudioPllOscClk

OSC clock

enum _audio_pll_mult

AudioPll Multiplication Factor.

Values:

enumerator kCLOCK_AudioPllMult16

Divide by 16

enumerator kCLOCK_AudioPllMult17

Divide by 17

enumerator kCLOCK_AudioPllMult18

Divide by 18

enumerator kCLOCK_AudioPllMult19

Divide by 19

enumerator kCLOCK_AudioPllMult20

Divide by 20

enumerator kCLOCK_AudioPllMult21

Divide by 21

enumerator kCLOCK_AudioPllMult22

Divide by 22

enum _osc32k_cap_trim

Capacitor Trim Value for OSC32KNP.

Values:

enumerator kCLOCK_Osc32kCapPf0

Capacitor Trim Value 0pF.

enumerator kCLOCK_Osc32kCapPf2

Capacitor Trim Value 2pF.

enumerator kCLOCK_Osc32kCapPf4

Capacitor Trim Value 4pF.

enumerator kCLOCK_Osc32kCapPf6

Capacitor Trim Value 6pF.

enumerator kCLOCK_Osc32kCapPf8

Capacitor Trim Value 8pF.

enumerator kCLOCK_Osc32kCapPf10

Capacitor Trim Value 10pF.

enumerator kCLOCK_Osc32kCapPf12

Capacitor Trim Value 12pF.

enumerator kCLOCK_Osc32kCapPf14

Capacitor Trim Value 14pF.

enumerator kCLOCK_Osc32kCapPf16

Capacitor Trim Value 16pF.

enumerator kCLOCK_Osc32kCapPf18

Capacitor Trim Value 18pF.

enumerator kCLOCK_Osc32kCapPf20

Capacitor Trim Value 20pF.

enumerator kCLOCK_Osc32kCapPf22

Capacitor Trim Value 22pF.

enumerator kCLOCK_Osc32kCapPf24

Capacitor Trim Value 24pF.

enumerator kCLOCK_Osc32kCapPf26

Capacitor Trim Value 26pF.

enumerator kCLOCK_Osc32kCapPf28

Capacitor Trim Value 28pF.

enumerator kCLOCK_Osc32kCapPf30

Capacitor Trim Value 30pF.

typedef enum _clock_usb_src clock_usb_src_t

USB clock source definition.

typedef enum _clock_usb_phy_src clock_usb_phy_src_t

Source of the USB HS PHY.

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_attach_id clock_attach_id_t

The enumerator of clock attach Id for multi sources clock slices. Not all Muxer has MUX output enable control, if no mux output enable control, the mux output will be always enabled.

typedef enum _clock_div_name clock_div_name_t

Clock dividers.

typedef enum _clock_fro_output_en clock_fro_output_en_t

FRO output enable.

typedef struct _clock_fro_config clock_fro_config_t

FRO configuration.

typedef enum _clock_domain_enable clock_domain_enable_t

Clock Control for each power domain.

typedef enum _clock_pfd clock_pfd_t

PLL PFD clock name.

typedef enum _main_pll_src main_pll_src_t

MainPLL Reference Input Clock Source.

typedef enum _main_pll_mult main_pll_mult_t

MainPLL Multiplication Factor.

typedef struct _clock_main_pll_config clock_main_pll_config_t

PLL configuration for MAINPLL.

typedef enum _audio_pll_src audio_pll_src_t

AudioPll Reference Input Clock Source.

typedef enum _audio_pll_mult audio_pll_mult_t

AudioPll Multiplication Factor.

typedef struct _clock_audio_pll_config clock_audio_pll_config_t

PLL configuration for Audio PLL.

typedef enum _osc32k_cap_trim osc32k_cap_trim_t

Capacitor Trim Value for OSC32KNP.

typedef struct _clock_osc32k_config_t clock_osc32k_config_t

configuration for 32K OSC

volatile uint32_t g_xtalFreq

External XTAL (SYSOSC) clock frequency.

The XTAL (SYSOSC) clock frequency in Hz, when the clock is setup, use the function CLOCK_SetXtalFreq to set the value in to clock driver. For example, if XTAL is 16MHz,

CLOCK_SetXtalFreq(160000000);

volatile uint32_t g_clkinFreq

External CLK_IN pin clock frequency (clkin).

The CLK_IN pin (clkin) clock frequency in Hz, when the clock is setup, use the function CLOCK_SetClkinFreq to set the value in to clock driver. For example, if CLK_IN is 16MHz,

CLOCK_SetClkinFreq(160000000);

volatile uint32_t g_32kClkinFreq

External 32KHz input clock frequency.

The External 32KHz input clock frequency in Hz, used when OSC32KNP in bypass mode, use the function CLOCK_Set32kClkinFreq to set the value in to clock driver. For example, if EXTALIN32K input is 32768,

CLOCK_Set32kClkinFreq(32768);

volatile uint32_t g_mclkFreq

External MCLK IN clock frequency.

The MCLK IN clock frequency in Hz, when the clock is setup, use the function CLOCK_SetMclkFreq to set the value in to clock driver. For example, if MCLK IN is 16MHz,

CLOCK_SetMclkFreq(160000000);

void CLOCK_EnableClock(clock_ip_name_t clk)

Enable the clock for specific IP.

Parameters:
  • clk – : Clock to be enabled.

Returns:

Nothing

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)

brief Configure the clock selection muxes.

For some of the muxes, there’s SEL_EN bit to gate the mux ouput to reduce power, using kNONT_to_XXX to gate the mux oupput. used by any peripheral.

Parameters:
  • connection – : Clock to be configured.

Returns:

Nothing

void CLOCK_SetClkDiv(clock_div_name_t div_name, uint32_t divider)

Setup peripheral clock dividers.

Parameters:
  • div_name – : Clock divider name

  • divider – : Value to be divided. Divided clock frequency = Undivided clock frequency / divider.

Returns:

Nothing

uint32_t CLOCK_GetFreq(clock_name_t clockName)

Return Frequency of selected clock.

Returns:

Frequency of selected clock

uint32_t CLOCK_GetSenseAudioClkFreq(void)

Return Frequency of VDD1 audio clk.

Returns:

Frequency of audio_clk

uint32_t CLOCK_GetHifi1ClkFreq(void)

Return Frequency of Sense DSP clk.

Returns:

Frequency of Sense DSP clk

void CLOCK_EnableFroClkOutput(FRO_Type *base, uint32_t divOutEnable)

Enable/Disable FRO clock output.

Parameters:
  • base – : base address of FRO.

  • divOutEnable – : Or’ed value of clock_fro_output_en_t to enable certain clock freq output.

void CLOCK_ConfigFroTrim(FRO_Type *base, uint16_t trimVal)

Configure FRO trim values when FRO is configured in Open loop mode.

Parameters:
  • base – : base address of FRO.

  • trimVal – : 12bits trim value.

void CLOCK_DisableFro(FRO_Type *base)

Disable the FRO clock. This API will disable the FRO clock output and power off FRO.

Parameters:
  • base – : base address of FRO.

status_t CLOCK_EnableFroAutoTuning(FRO_Type *base, const clock_fro_config_t *config, bool enable)

Enable/Disable FRO for close loop mode(autotuner).

Parameters:
  • base – : base address of FRO.

  • config – : The configuration for FRO.

  • enable – Enable auto tuning mode or not.

Return values:
  • kStatus_Success – successfully tuned to the target configuration.

  • kStatus_InvalidArgument – Invalid arguement.

  • kStatus_Fail – failed to lock to the target frequency.

void CLOCK_EnableFroClkFreq(FRO_Type *base, uint32_t targetFreq, uint32_t divOutEnable)

Enable FRO clock output with specified frequency.

Parameters:
  • base – : base address of FRO.

  • targetFreq – target fro frequency.

  • divOutEnable – Or’ed value of clock_fro_output_en_t to enable certain clock freq output.

status_t CLOCK_EnableFroClkFreqCloseLoop(FRO_Type *base, const clock_fro_config_t *config, uint32_t divOutEnable)

Enable FRO clock output with target frequency using FRO close loop mode. For example, to enable FRO2 to ouput 200MHZ:

   const clock_fro_config_t config = {
    .targetFreq = 200000000U,
    .range = 50U,
    .trim1DelayUs = 15U,
    .trim2DelayUs = 150U,
    .refDiv = 0U,
    .enableInt = 0U,
    .coarseTrimEn = true,
};
CLOCK_EnableFroClkFreqCloseLoop(FRO2, &config, kCLOCK_FroAllOutEn);

Parameters:
  • base – : base address of FRO.

  • config – : The configuration for FRO.

  • divOutEnable – : Or’ed value of clock_fro_output_en_t to enable certain clock freq output.

Return values:
  • kStatus_Success – successfully tuned to the target configuration.

  • kStatus_InvalidArgument – Invalid arguement.

  • kStatus_Fail – failed to lock to the target frequency.

uint32_t CLOCK_GetFroFlags(FRO_Type *base)

Get FRO flags.

Parameters:
  • base – : base address of FRO.

  • flags – Or’ed value of _clock_fro_flag.

static inline void CLOCK_ClearFroFlags(FRO_Type *base, uint32_t flags)

Clear FRO flags.

Parameters:
  • base – : base address of FRO.

  • flags – Or’ed value of _clock_fro_flag to clear.

static inline void CLOCK_EnableFroFastStartup(FRO_Type *base, bool enable)

Enable/Disable FRO fast startup.

Parameters:
  • base – : base address of FRO.

  • true (enable,) – to enable fast startup, false to disable fast startup.

uint32_t CLOCK_GetFroClkFreq(uint32_t id)

Return Frequency of FRO clk.

Parameters:
  • id – FRO index

Returns:

Frequency of FRO clk

uint32_t CLOCK_GetSenseMainClkFreq(void)

Return Frequency of sense main clk.

Returns:

Frequency of main clk

uint32_t CLOCK_GetMainPllFreq(void)

Return Frequency of MAINPLL.

Returns:

Frequency of MAINPLL

uint32_t CLOCK_GetMainPfdFreq(clock_pfd_t pfd)

Get current output frequency of specific Main PLL PFD.

Parameters:
  • pfd – : pfd name to get frequency.

Returns:

Frequency of MainPLL PFD.

uint32_t CLOCK_GetAudioPllFreq(void)

Return Frequency of AUDIO PLL.

Returns:

Frequency of AUDIO PLL

uint32_t CLOCK_GetAudioPfdFreq(clock_pfd_t pfd)

Get current output frequency of specific Audio PLL PFD.

Parameters:
  • pfd – : pfd name to get frequency.

Returns:

Frequency of AUDIO PLL PFD.

static inline uint32_t CLOCK_GetXtalInClkFreq(void)

Return Frequency of High-Freq output of FRO.

Return Frequency of sys osc Clock

Returns:

Frequency of High-Freq output of FRO

Returns:

Frequency of sys osc Clock. Or CLK_IN pin frequency.

uint32_t CLOCK_GetSenseBaseClkFreq(void)

Return Frequency of Sense Base clock.

Returns:

Frequency of sense base clk

void CLOCK_EnableSysOscClk(bool enable, bool enableLowPower, uint32_t delay_us)

Enable/Disable sys osc clock from external crystal clock.

Parameters:
  • enable – : true to enable system osc clock, false to bypass system osc.

  • enableLowPower – : true to enable low power mode, false to enable high gain mode.

  • delay_us – : Delay time after OSC power up.

uint32_t CLOCK_GetVddnComBaseClkFreq(void)

Return Frequency of VDDN_COM Base Clock.

Returns:

Frequency of baseclk_comn

uint32_t CLOCK_GetVddnMediaBaseClkFreq(void)

Return Frequency of VDDN_MEDIA Base Clock.

Returns:

Frequency of baseclk_mdn

uint32_t CLOCK_GetVdd2MediaBaseClkFreq(void)

Return Frequency of VDD2_MEDIA Base Clock.

Returns:

Frequency of baseclk_md2

uint32_t CLOCK_GetMediaMainClkFreq(void)

Return Frequency of MEDIA_MAIN Clock.

Returns:

Frequency of media_main_clk

uint32_t CLOCK_GetMediaVddnClkFreq(void)

Return Frequency of MEDIA_VDDN Clock.

Returns:

Frequency of media_vddn_clk

void CLOCK_EnableFro2ClkForDomain(uint32_t domainEnable)

Enable/Disable FRO2 clock for various domains.

Parameters:
  • domainEnable – : Or’ed value of clock_domain_enable_t to enable DRFO2 max clock for certain domain.

void CLOCK_EnableMainPllPfdClkForDomain(clock_pfd_t pfd, uint32_t domainEnable)

Enable/Disable MainPLL PFD clock for various domains.

Enables PFD clock of MainPLL for various domains. Each PFD clock of MainPLL can be sent to various domain. To reduce power consumption, turn off the PFD in the domain when this PFD is not configured.

Parameters:
  • pfd – : Which PFD clock to control.

  • domainEnable – : Or’ed value of clock_domain_enable_t to enable clock for certain domain.

void CLOCK_EnableAudioPllPfdClkForDomain(clock_pfd_t pfd, uint32_t domainEnable)

Enable/Disable AUDIO PFD clock for various domains.

Enables PFD clock of AUDIO for various domains. Each PFD clock of AUDIO can be sent to various domain. To reduce power consumption, turn off the PFD in the domain when this PFD is not configured.

Parameters:
  • pfd – : Which PFD clock to control.

  • domainEnable – : Or’ed value of clock_domain_enable_t to enable clock for certain domain.

void CLOCK_EnableAudioPllVcoClkForDomain(uint32_t domainEnable)

Enable/Disable AUDIO VCO clock for various domains.

VCO clock of Audio PLL can be sent to various domains to reduce power consumption when VCO is not set to use in such domain. This VCO can be disabled for such domain.

Parameters:
  • domainEnable – : Or’ed value of clock_domain_enable_t to enable clock for certain domain.

void CLOCK_InitMainPll(const clock_main_pll_config_t *config)

Initialize the Main PLL.

Parameters:
  • config – : Configuration to set to PLL.

static inline void CLOCK_DeinitMainPll(void)

brief Deinit the Main PLL. param none.

status_t CLOCK_InitMainPfd(clock_pfd_t pfd, uint8_t divider)

Initialize the Main PLL PFD.

Note

It is recommended that PFD settings are kept between 12-35.

Parameters:
  • pfd – : Which PFD clock to enable.

  • divider – : The PFD divider value.

Returns:

kStatus_Success if successfully, kStatus_Timeout if timeout happen.

static inline void CLOCK_DeinitMainPfd(clock_pfd_t pfd)

brief Disable the Main PLL PFD. param pfd : Which PFD clock to disable.

void CLOCK_InitAudioPll(const clock_audio_pll_config_t *config)

Initialize the audio PLL.

Parameters:
  • config – : Configuration to set to PLL.

static inline void CLOCK_DeinitAudioPll(void)

brief Deinit the Audio PLL. param none.

status_t CLOCK_InitAudioPfd(clock_pfd_t pfd, uint8_t divider)

Initialize the audio PLL PFD.

Note

It is recommended that PFD settings are kept between 12-35.

Parameters:
  • pfd – : Which PFD clock to enable.

  • divider – : The PFD divider value.

Returns:

kStatus_Success if successfully, kStatus_Timeout if timeout happen.

static inline void CLOCK_DeinitAudioPfd(uint32_t pfd)

brief Disable the audio PLL PFD. param pfd : Which PFD clock to disable.

static inline uint32_t CLOCK_GetLpOscFreq(void)

Return Frequency of Lower power osc.

Returns:

Frequency of LPOSC

static inline uint32_t CLOCK_GetSysOscFreq(void)

Return Frequency of sys osc Clock.

Returns:

Frequency of sys osc Clock. Or CLK_IN pin frequency.

static inline uint32_t CLOCK_GetMclkInClkFreq(void)

Return Frequency of MCLK Input Clock.

Returns:

Frequency of MCLK input Clock.

uint32_t CLOCK_GetOsc32KFreq(void)

Return Frequency of 32kHz osc.

Returns:

Frequency of 32kHz osc

void CLOCK_EnableOsc32K(clock_osc32k_config_t *config)

Enables OSC32KNP.

Parameters:
  • config – : configuration set to OSC32KNP

static inline void CLOCK_DisableOsc32K(void)

Disable OSC32KNP.

uint32_t CLOCK_GetWakeClk32KFreq(void)

Return Frequency of 32khz wake clk.

Returns:

Frequency of 32kHz wake clk

static inline void CLOCK_SetXtalFreq(uint32_t freq)

Set the XTALIN (system OSC) frequency based on board setting. NOTE, when SOSC is used, either CLOCK_SetXtalFreq or CLOCK_SetClkinFreq(But NOT both.) should be called to tell driver the clock frequency connected to SOSC module.

Parameters:
  • freq – : The XTAL input clock frequency in Hz.

static inline void CLOCK_SetClkinFreq(uint32_t freq)

Set the CLKIN (CLKIN pin) frequency based on board setting.

Parameters:
  • freq – : The CLK_IN pin input clock frequency in Hz.

static inline void CLOCK_Set32kClkinFreq(uint32_t freq)

Set the 32KHz external input frequency based on board setting.

Parameters:
  • freq – : The 32KHz external pin input clock frequency in Hz.

static inline void CLOCK_SetMclkFreq(uint32_t freq)

Set the MCLK IN frequency based on board setting.

Parameters:
  • freq – : The MCLK input clock frequency in Hz.

static inline uint32_t CLOCK_GetCoreSysClkFreq(void)

Return Frequency of Core/system clock.

Returns:

Frequency of core or system Clock

uint32_t CLOCK_GetXspiClkFreq(uint32_t id)

Return Frequency of XSPI function clock.

Parameters:
  • id – : XSPI index to get frequency.

Returns:

Frequency of XSPI functional Clock

uint32_t CLOCK_GetUtickClkFreq(void)

Return Frequency of UTICK function clock.

Returns:

Frequency of UTICK functional Clock

uint32_t CLOCK_GetSystickClkFreq(void)

Return Frequency of systick clk.

Returns:

Frequency of systick clk

uint32_t CLOCK_GetWdtClkFreq(uint32_t id)

Return Frequency of WDT clk.

Parameters:
  • id – : WDT index to get frequency.

Returns:

Frequency of WDT clk

uint32_t CLOCK_GetAcmpClkFreq(void)

Return Frequency of ACMP clk.

Returns:

Frequency of ACMP clk

uint32_t CLOCK_GetSaiClkFreq(void)

Return Frequency of SAI clk.

Returns:

Frequency of SAI clk

uint32_t CLOCK_GetUsbClkFreq(void)

Return Frequency of USB clk.

Returns:

Frequency of USB clk

uint32_t CLOCK_GetI3cClkFreq(void)

Return Frequency of I3C clk.

Returns:

Frequency of I3C clk

uint32_t CLOCK_GetLPFlexCommClkFreq(uint32_t id)

Return Frequency of Flexcomm functional Clock.

Parameters:
  • id – : flexcomm index to get frequency.

Returns:

Frequency of Flexcomm functional Clock

uint32_t CLOCK_GetLPI2cClkFreq(uint32_t id)

Return Frequency of LPI2C functional Clock.

Parameters:
  • id – : LPI2C index to get frequency.

Returns:

Frequency of LPI2C functional Clock

uint32_t CLOCK_GetLPSpiClkFreq(uint32_t id)

Return Frequency of LPSPI functional Clock.

Parameters:
  • id – : LPSPI index to get frequency.

Returns:

Frequency of LPSPI functional Clock

uint32_t CLOCK_GetFlexioClkFreq(void)

Return Frequency of Flexio functional Clock.

Returns:

Frequency of Flexcomm functional Clock

uint32_t CLOCK_GetOSTimerClkFreq(void)

Return Frequency of OSTIMER functional Clock.

Returns:

Frequency of OSTIMER functional Clock

uint32_t CLOCK_GetMicfilClkFreq(void)

Return Frequency of MICFIL functional Clock.

Returns:

Frequency of MICFIL functional Clock

uint32_t CLOCK_GetCTimerClkFreq(uint32_t id)

Return Frequency of Ctimer Clock.

Parameters:
  • id – : ctimer index to get frequency.

Returns:

Frequency of Ctimer Clock

uint32_t CLOCK_GetClockOutClkFreq(void)

Return Frequency of VDD2 ClockOut.

Returns:

Frequency of ClockOut

uint32_t CLOCK_GetVdd1ClockOutClkFreq(void)

Return Frequency of VDD1 Clock Out.

Returns:

Frequency of ClockOut of sense domain

uint32_t CLOCK_GetAdcClkFreq(void)

Return Frequency of Adc Clock.

Returns:

Frequency of Adc Clock.

uint32_t CLOCK_GetSdAdcClkFreq(void)

Return Frequency of SDADC Clock.

Returns:

Frequency of SDADC Clock.

uint32_t CLOCK_GetVgpuClkFreq(void)

Return Frequency of VGPU functional Clock.

Returns:

Frequency of VGPU functional Clock

uint32_t CLOCK_GetLcdifClkFreq(void)

Return Frequency of LCDIF pixel Clock.

Returns:

Frequency of LCDIF pixel Clock

uint32_t CLOCK_GetMipiDphyClkFreq(void)

Return Frequency of MIPI DPHY functional Clock.

Returns:

Frequency of MIPI DPHY functional Clock

uint32_t CLOCK_GetMipiDphyEscRxClkFreq(void)

Return Frequency of MIPI DPHY Esc RX functional Clock.

Returns:

Frequency of MIPI DPHY Esc RX functional Clock

uint32_t CLOCK_GetMipiDphyEscTxClkFreq(void)

Return Frequency of MIPI DPHY Esc Tx functional Clock.

Returns:

Frequency of MIPI DPHY Esc Tx functional Clock

uint32_t CLOCK_GetUsdhcClkFreq(uint32_t id)

Return Frequency of USDHC Clock.

Parameters:
  • id – : uSDHC index to get frequency.

Returns:

Frequency of USDHC Clock

bool CLOCK_EnableUsbhs0PhyPllClock(clock_usb_phy_src_t src, uint32_t freq)

brief Enable USB HS PHY PLL clock.

This function enables the internal 480MHz USB PHY PLL clock.

param src USB HS PHY PLL clock source. param freq The frequency specified by src. retval true The clock is set successfully. retval false The clock source is invalid to get proper USB HS clock.

bool CLOCK_EnableUsbhs0Clock(clock_usb_src_t src, uint32_t freq)

brief Enable USB HS clock.

This function only enables the access to USB HS prepheral, upper layer should first call the ref CLOCK_EnableUsbhs0PhyPllClock to enable the PHY clock to use USB HS.

param src USB HS does not care about the clock source, here must be ref kCLOCK_UsbSrcUnused. param freq USB HS does not care about the clock source, so this parameter is ignored. retval true The clock is set successfully. retval false The clock source is invalid to get proper USB HS clock.

void CLOCK_DisableUsbhs0PhyPllClock(void)

brief Disable USB HS PHY PLL clock.

This function disables USB HS PHY PLL clock.

FSL_CLOCK_DRIVER_VERSION

CLOCK driver version 2.4.0.

CLOCK_DeinitSysPfd
CLOCK_InitSysPfd
CDOG_CLOCKS

Clock ip name array for CDOG.

FREQME_CLOCKS

Clock ip name array for FREQME.

GPU_CLOCKS

Clock ip name array for GPU.

MIPI_DSI_HOST_CLOCKS

Clock ip name array for MIPI DSI.

LCDIF_CLOCKS

Clock ip name array for LCDIF.

SCT_CLOCKS

Clock ip name array for SCT.

USB_CLOCKS

Clock ip name array for USB.

USBPHY_CLOCKS

Clock ip name array for USBPHY.

XSPI_CLOCKS

Clock ip name array for FlexSPI.

MMU_CLOCKS

Clock ip name array for MMU.

CACHE64_CLOCKS

Clock ip name array for CACHE64.

CACHE64POLSEL_CLOCKS

Clock ip name array for CACHE64_POLSEL.

LPADC_CLOCKS

Clock ip name array for ADC.

SDADC_CLOCKS

Clock ip name array for SDADC.

CMP_CLOCKS

Clock ip name array for ACMP.

USDHC_CLOCKS

Clock ip name array for uSDHC.

WWDT_CLOCKS

Clock ip name array for WWDT.

UTICK_CLOCKS

Clock ip name array for UTICK.

FLEXIO_CLOCKS

Clock ip name array for FlexIO.

LP_FLEXCOMM_CLOCKS

Clock ip name array for LP_FLEXCOMM.

LPUART_CLOCKS

Clock ip name array for LPUART.

LPI2C_CLOCKS

Clock ip name array for LPI2C.

LPSPI_CLOCKS

Clock ip name array for LSPI.

SAI_CLOCKS

Clock ip name array for SAI.

SEMA42_CLOCKS

Clock ip name array for SEMA.

CRC_CLOCKS

Clock ip name array for MU.

Clock ip name array for CRC.

GPIO_CLOCKS

Clock ip name array for GPIO.

PDM_CLOCKS

Clock ip name array for PDM.

PINT_CLOCKS

Clock ip name array for PINT.

PNGDEC_CLOCKS

Clock ip name array for PNGDEC.

JPEGDEC_CLOCKS

Clock ip name array for JPEGDEC.

I3C_CLOCKS

Clock ip name array for I3C.

MRT_CLOCKS

Clock ip name array for MRT.

CTIMER_CLOCKS

Clock ip name array for CT32B.

OSTIMER_CLOCKS

Clock ip name array for OSTIMER.

RTC_CLOCKS

Clock ip name array for RTC.

CLK_GATE_REG_OFFSET_SHIFT

Clock gate name used for CLOCK_EnableClock/CLOCK_DisableClock.

CLK_GATE_REG_OFFSET_MASK
CLK_GATE_BIT_SHIFT_SHIFT
CLK_GATE_BIT_SHIFT_MASK
CLK_GATE_DEFINE(reg_offset, bit_shift)
CLK_GATE_ABSTRACT_REG_OFFSET(x)
CLK_GATE_ABSTRACT_BITS_SHIFT(x)
CLK_CTL0_PSCCTL0
CLK_CTL0_PSCCTL1
CLK_CTL0_PSCCTL2
CLK_CTL0_PSCCTL3
CLK_CTL0_PSCCTL4
CLK_CTL0_PSCCTL5
CLK_CTL1_PSCCTL0
CLK_CTL1_PSCCTL1
CLK_CTL2_PSCCTL0
CLK_CTL3_PSCCTL0
CLK_CTL4_PSCCTL0
CLK_CTL4_PSCCTL1
SYSCON3_SEC_CLK_CTRL
CLKCTL0_ONE_SRC_CLKSLICE_ENABLE
CLKCTL3_ONE_SRC_CLKSLICE_ENABLE
CLKCTL4_ONE_SRC_CLKSLICE_ENABLE
CLK_MUX_INST_INDEX_SHIFT

Clock Mux Switches The encoding is as follows each connection identified is 32bits wide starting from LSB upwards.

[ 31-29 14 12:11 10:0 ] [CLKCTL index]: [Disable MUX output]: [MUXA choice]:[MUXA offset]. MUX offset 0 means end of descriptor.

CLK_MUX_CHOICE_OFFSET_SHIFT
CLK_MUX_DISABLE_OUTPUT_MASK
SENSEBASECLKSEL_OFFSET
SENSEDSPCPUCLKDIV_OFFSET
SENSEDSPCPUCLKSEL_OFFSET
SAI3FCLKSEL_OFFSET
SAI3CLKDIV_OFFSET
UTICK1FCLKSEL_OFFSET
UTICK1CLKDIV_OFFSET
WWDT2FCLKSEL_OFFSET
WWDT3FCLKSEL_OFFSET
SYSTICKFCLKSEL_OFFSET
SYSTICKFCLKDIV_OFFSET
CTIMER5FCLKSEL_OFFSET
CTIMER6FCLKSEL_OFFSET
CTIMER7FCLKSEL_OFFSET
CTIMER5CLKDIV_OFFSET
CTIMER6CLKDIV_OFFSET
CTIMER7CLKDIV_OFFSET
I3C23FCLKSEL_OFFSET
I3C23FCLKDIV_OFFSET
FC17FCLKSEL_OFFSET
FC18FCLKSEL_OFFSET
FC19FCLKSEL_OFFSET
FC20FCLKSEL_OFFSET
FC17FCLKDIV_OFFSET
FC18FCLKDIV_OFFSET
FC19FCLKDIV_OFFSET
FC20FCLKDIV_OFFSET
AUDIOVDD1CLKSEL_OFFSET
USBCLKSRC24MCLKSEL_OFFSET
USBCLKSRC24MCLKSEL_OFFSET
COMMONVDDNCLKSEL_OFFSET
COMMONVDDNCLKDIV_OFFSET
COMNBASECLKSEL_OFFSET
EUSBCLKSRC24MCLKSEL_OFFSET
MAINPLL0CLKSEL_OFFSET
MAINPLL0LOCKTIMEDIV2_OFFSET
AUDIOPLL0CLKSEL_OFFSET
AUDIOPLL0LOCKTIMEDIV2_OFFSET
SENSEMAINCLKDIV_OFFSET
SENSE_MAINCLKSEL_OFFSET
SENSERAMCLKSEL_OFFSET
SENSERAMCLKDIV_OFFSET
OSEVENTTFCLKSEL_OFFSET
OSEVENTFCLKDIV_OFFSET
SDADCFCLKSEL_OFFSET
SDADCFCLKDIV_OFFSET
SARADCFCLKSEL_OFFSET
SARADCFCLKDIV_OFFSET
WAKE32KCLKSEL_OFFSET
A32KHZWAKECLKDIV_OFFSET
MICFIL0FCLKSEL_OFFSET
MICFIL0FCLKDIV_OFFSET
LPI2CFCLKSEL_OFFSET
LPI2CFCLKDIV_OFFSET
SENSE_CLKOUTCLKSEL_OFFSET
SENSE_CLKOUTCLKDIV_OFFSET
MEDIAVDDNCLKSEL_OFFSET
MEDIAVDDNCLKDIV_OFFSET
MEDIAMAINCLKSEL_OFFSET
MEDIAMAINCLKDIV_OFFSET
MDNBASECLKSEL_OFFSET
MD2BASECLKSEL_OFFSET
XSPI2FCLKSEL_OFFSET
XSPI2FCLKDIV_OFFSET
USBFCLKSEL_OFFSET
EUSBFCLKSEL_OFFSET
SDIO0FCLKSEL_OFFSET
SDIO0FCLKDIV_OFFSET
SDIO1FCLKSEL_OFFSET
SDIO1FCLKDIV_OFFSET
DPHYCLKSEL_OFFSET
DPHYCLKDIV_OFFSET
DPHYESCCLKSEL_OFFSET
DPHYESCRXCLKDIV_OFFSET
DPHYESCTXCLKDIV_OFFSET
VGPUCLKSEL_OFFSET
VGPUCLKDIV_OFFSET
LPSPI14CLKSEL_OFFSET
LPSPI14CLKDIV_OFFSET
LPSPI16CLKSEL_OFFSET
LPSPI16CLKDIV_OFFSET
FLEXIOCLKSEL_OFFSET
FLEXIOCLKDIV_OFFSET
LCDIFPIXELCLKSEL_OFFSET
LCDIFPIXELCLKDIV_OFFSET
LOWFREQCLKDIV_OFFSET
CLKCTL0_INDEX
CLKCTL1_INDEX
CLKCTL2_INDEX
CLKCTL3_INDEX
CLKCTL4_INDEX
CLKCTL0_TUPLE_MUXA(reg, choice)
CLKCTL1_TUPLE_MUXA(reg, choice)
CLKCTL2_TUPLE_MUXA(reg, choice)
CLKCTL3_TUPLE_MUXA(reg, choice)
CLKCTL4_TUPLE_MUXA(reg, choice)
CLKCTL0_TUPLE_MUXA_NONE(reg, choice)

Macro for gated clock mux

CLKCTL1_TUPLE_MUXA_NONE(reg, choice)
CLKCTL2_TUPLE_MUXA_NONE(reg, choice)
CLKCTL3_TUPLE_MUXA_NONE(reg, choice)
CLKCTL4_TUPLE_MUXA_NONE(reg, choice)
CLKCTL_TUPLE_REG(base, tuple)
CLKCTL_TUPLE_SEL(tuple)
uint32_t targetFreq

Target frequency.

uint16_t refDiv

OSC Reference clock divider. 1 for divide ratio 1.

uint16_t trim1DelayUs

Trim 1 delay in us, minimum is 15us. Used when running in Closed Loop mode and trim values are updated by 1 decimal unit.

uint16_t trim2DelayUs

Trim 2 delay in us. Used at start of closed loop mode when auto tuner is updating trim values by 16 decimal unit steps

uint8_t range

Trim Expected Count Range. Specifies the + or - counts that the FRO frequency can be off from TEXPCNT to be considerred locked. The value/100 is the % deviation.

uint32_t enableInt

Enable interrupts. Bit mask of _clock_fro_interrupt.

bool coarseTrimEn

Coarse Trim Enable. Set to true to allow autotrimming of the FRO high-byte trim bits.

bool fastStartupEn

Fast startup Enable. Enables FRO fast startup.

main_pll_src_t main_pll_src

Reference Input Clock Source.

uint32_t numerator

30 bit numerator of fractional loop divider.

uint32_t denominator

30 bit numerator of fractional loop divider.

main_pll_mult_t main_pll_mult

Multiplication Factor.

audio_pll_src_t audio_pll_src

Reference Input Clock Source.

uint32_t numerator

30 bit numerator of fractional loop divider.

uint32_t denominator

30 bit numerator of fractional loop divider.

audio_pll_mult_t audio_pll_mult

Multiplication Factor.

bool enableVcoOut

Enable VCO output

bool bypass

Bypass enable.

bool monitorEnable

Clock Monitor Enable.

bool lowPowerMode

Low-Power (Nano-Power) mode enable. NOTE, can only change from High-Power mode to Nano-Power mode, and not vice versa.

osc32k_cap_trim_t cap

Capacitor Trim Value.

struct _clock_fro_config
#include <fsl_clock.h>

FRO configuration.

struct _clock_main_pll_config
#include <fsl_clock.h>

PLL configuration for MAINPLL.

struct _clock_audio_pll_config
#include <fsl_clock.h>

PLL configuration for Audio PLL.

struct _clock_osc32k_config_t
#include <fsl_clock.h>

configuration for 32K OSC

CRC: Cyclic Redundancy Check Driver

FSL_CRC_DRIVER_VERSION

CRC driver version. Version 2.0.4.

Current version: 2.0.4

Change log:

  • Version 2.0.4

    • Release peripheral from reset if necessary in init function.

  • Version 2.0.3

    • Fix MISRA issues

  • Version 2.0.2

    • Fix MISRA issues

  • Version 2.0.1

    • move DATA and DATALL macro definition from header file to source file

enum _crc_bits

CRC bit width.

Values:

enumerator kCrcBits16

Generate 16-bit CRC code

enumerator kCrcBits32

Generate 32-bit CRC code

enum _crc_result

CRC result type.

Values:

enumerator kCrcFinalChecksum

CRC data register read value is the final checksum. Reflect out and final xor protocol features are applied.

enumerator kCrcIntermediateChecksum

CRC data register read value is intermediate checksum (raw value). Reflect out and final xor protocol feature are not applied. Intermediate checksum can be used as a seed for CRC_Init() to continue adding data to this checksum.

typedef enum _crc_bits crc_bits_t

CRC bit width.

typedef enum _crc_result crc_result_t

CRC result type.

typedef struct _crc_config crc_config_t

CRC protocol configuration.

This structure holds the configuration for the CRC protocol.

void CRC_Init(CRC_Type *base, const crc_config_t *config)

Enables and configures the CRC peripheral module.

This function enables the clock gate in the SIM module for the CRC peripheral. It also configures the CRC module and starts a checksum computation by writing the seed.

Parameters:
  • base – CRC peripheral address.

  • config – CRC module configuration structure.

static inline void CRC_Deinit(CRC_Type *base)

Disables the CRC peripheral module.

This function disables the clock gate in the SIM module for the CRC peripheral.

Parameters:
  • base – CRC peripheral address.

void CRC_GetDefaultConfig(crc_config_t *config)

Loads default values to the CRC protocol configuration structure.

Loads default values to the CRC protocol configuration structure. The default values are as follows.

config->polynomial = 0x1021;
config->seed = 0xFFFF;
config->reflectIn = false;
config->reflectOut = false;
config->complementChecksum = false;
config->crcBits = kCrcBits16;
config->crcResult = kCrcFinalChecksum;

Parameters:
  • config – CRC protocol configuration structure.

void CRC_WriteData(CRC_Type *base, const uint8_t *data, size_t dataSize)

Writes data to the CRC module.

Writes input data buffer bytes to the CRC data register. The configured type of transpose is applied.

Parameters:
  • base – CRC peripheral address.

  • data – Input data stream, MSByte in data[0].

  • dataSize – Size in bytes of the input data buffer.

uint32_t CRC_Get32bitResult(CRC_Type *base)

Reads the 32-bit checksum from the CRC module.

Reads the CRC data register (either an intermediate or the final checksum). The configured type of transpose and complement is applied.

Parameters:
  • base – CRC peripheral address.

Returns:

An intermediate or the final 32-bit checksum, after configured transpose and complement operations.

uint16_t CRC_Get16bitResult(CRC_Type *base)

Reads a 16-bit checksum from the CRC module.

Reads the CRC data register (either an intermediate or the final checksum). The configured type of transpose and complement is applied.

Parameters:
  • base – CRC peripheral address.

Returns:

An intermediate or the final 16-bit checksum, after configured transpose and complement operations.

CRC_DRIVER_USE_CRC16_CCIT_FALSE_AS_DEFAULT

Default configuration structure filled by CRC_GetDefaultConfig(). Use CRC16-CCIT-FALSE as defeault.

struct _crc_config
#include <fsl_crc.h>

CRC protocol configuration.

This structure holds the configuration for the CRC protocol.

Public Members

uint32_t polynomial

CRC Polynomial, MSBit first. Example polynomial: 0x1021 = 1_0000_0010_0001 = x^12+x^5+1

uint32_t seed

Starting checksum value

bool reflectIn

Reflect bits on input.

bool reflectOut

Reflect bits on output.

bool complementChecksum

True if the result shall be complement of the actual checksum.

crc_bits_t crcBits

Selects 16- or 32- bit CRC protocol.

crc_result_t crcResult

Selects final or intermediate checksum return from CRC_Get16bitResult() or CRC_Get32bitResult()

CTIMER: Standard counter/timers

void CTIMER_Init(CTIMER_Type *base, const ctimer_config_t *config)

Ungates the clock and configures the peripheral for basic operation.

Note

This API should be called at the beginning of the application before using the driver.

Parameters:
  • base – Ctimer peripheral base address

  • config – Pointer to the user configuration structure.

void CTIMER_Deinit(CTIMER_Type *base)

Gates the timer clock.

Parameters:
  • base – Ctimer peripheral base address

void CTIMER_GetDefaultConfig(ctimer_config_t *config)

Fills in the timers configuration structure with the default settings.

The default values are:

config->mode = kCTIMER_TimerMode;
config->input = kCTIMER_Capture_0;
config->prescale = 0;

Parameters:
  • config – Pointer to the user configuration structure.

status_t CTIMER_SetupPwmPeriod(CTIMER_Type *base, const ctimer_match_t pwmPeriodChannel, ctimer_match_t matchChannel, uint32_t pwmPeriod, uint32_t pulsePeriod, bool enableInt)

Configures the PWM signal parameters.

Enables PWM mode on the match channel passed in and will then setup the match value and other match parameters to generate a PWM signal. This function can manually assign the specified channel to set the PWM cycle.

Note

When setting PWM output from multiple output pins, all should use the same PWM period

Parameters:
  • base – Ctimer peripheral base address

  • pwmPeriodChannel – Specify the channel to control the PWM period

  • matchChannel – Match pin to be used to output the PWM signal

  • pwmPeriod – PWM period match value

  • pulsePeriod – Pulse width match value

  • enableInt – Enable interrupt when the timer value reaches the match value of the PWM pulse, if it is 0 then no interrupt will be generated.

Returns:

kStatus_Success on success kStatus_Fail If matchChannel is equal to pwmPeriodChannel; this channel is reserved to set the PWM cycle If PWM pulse width register value is larger than 0xFFFFFFFF.

status_t CTIMER_SetupPwm(CTIMER_Type *base, const ctimer_match_t pwmPeriodChannel, ctimer_match_t matchChannel, uint8_t dutyCyclePercent, uint32_t pwmFreq_Hz, uint32_t srcClock_Hz, bool enableInt)

Configures the PWM signal parameters.

Enables PWM mode on the match channel passed in and will then setup the match value and other match parameters to generate a PWM signal. This function can manually assign the specified channel to set the PWM cycle.

Note

When setting PWM output from multiple output pins, all should use the same PWM frequency. Please use CTIMER_SetupPwmPeriod to set up the PWM with high resolution.

Parameters:
  • base – Ctimer peripheral base address

  • pwmPeriodChannel – Specify the channel to control the PWM period

  • matchChannel – Match pin to be used to output the PWM signal

  • dutyCyclePercent – PWM pulse width; the value should be between 0 to 100

  • pwmFreq_Hz – PWM signal frequency in Hz

  • srcClock_Hz – Timer counter clock in Hz

  • enableInt – Enable interrupt when the timer value reaches the match value of the PWM pulse, if it is 0 then no interrupt will be generated.

static inline void CTIMER_UpdatePwmPulsePeriod(CTIMER_Type *base, ctimer_match_t matchChannel, uint32_t pulsePeriod)

Updates the pulse period of an active PWM signal.

Parameters:
  • base – Ctimer peripheral base address

  • matchChannel – Match pin to be used to output the PWM signal

  • pulsePeriod – New PWM pulse width match value

status_t CTIMER_UpdatePwmDutycycle(CTIMER_Type *base, const ctimer_match_t pwmPeriodChannel, ctimer_match_t matchChannel, uint8_t dutyCyclePercent)

Updates the duty cycle of an active PWM signal.

Note

Please use CTIMER_SetupPwmPeriod to update the PWM with high resolution. This function can manually assign the specified channel to set the PWM cycle.

Parameters:
  • base – Ctimer peripheral base address

  • pwmPeriodChannel – Specify the channel to control the PWM period

  • matchChannel – Match pin to be used to output the PWM signal

  • dutyCyclePercent – New PWM pulse width; the value should be between 0 to 100

Returns:

kStatus_Success on success kStatus_Fail If PWM pulse width register value is larger than 0xFFFFFFFF.

static inline void CTIMER_EnableInterrupts(CTIMER_Type *base, uint32_t mask)

Enables the selected Timer interrupts.

Parameters:
  • base – Ctimer peripheral base address

  • mask – The interrupts to enable. This is a logical OR of members of the enumeration ctimer_interrupt_enable_t

static inline void CTIMER_DisableInterrupts(CTIMER_Type *base, uint32_t mask)

Disables the selected Timer interrupts.

Parameters:
  • base – Ctimer peripheral base address

  • mask – The interrupts to enable. This is a logical OR of members of the enumeration ctimer_interrupt_enable_t

static inline uint32_t CTIMER_GetEnabledInterrupts(CTIMER_Type *base)

Gets the enabled Timer interrupts.

Parameters:
  • base – Ctimer peripheral base address

Returns:

The enabled interrupts. This is the logical OR of members of the enumeration ctimer_interrupt_enable_t

static inline uint32_t CTIMER_GetStatusFlags(CTIMER_Type *base)

Gets the Timer status flags.

Parameters:
  • base – Ctimer peripheral base address

Returns:

The status flags. This is the logical OR of members of the enumeration ctimer_status_flags_t

static inline void CTIMER_ClearStatusFlags(CTIMER_Type *base, uint32_t mask)

Clears the Timer status flags.

Parameters:
  • base – Ctimer peripheral base address

  • mask – The status flags to clear. This is a logical OR of members of the enumeration ctimer_status_flags_t

static inline void CTIMER_StartTimer(CTIMER_Type *base)

Starts the Timer counter.

Parameters:
  • base – Ctimer peripheral base address

static inline void CTIMER_StopTimer(CTIMER_Type *base)

Stops the Timer counter.

Parameters:
  • base – Ctimer peripheral base address

FSL_CTIMER_DRIVER_VERSION

Version 2.3.3

enum _ctimer_capture_channel

List of Timer capture channels.

Values:

enumerator kCTIMER_Capture_0

Timer capture channel 0

enumerator kCTIMER_Capture_1

Timer capture channel 1

enumerator kCTIMER_Capture_3

Timer capture channel 3

enum _ctimer_capture_edge

List of capture edge options.

Values:

enumerator kCTIMER_Capture_RiseEdge

Capture on rising edge

enumerator kCTIMER_Capture_FallEdge

Capture on falling edge

enumerator kCTIMER_Capture_BothEdge

Capture on rising and falling edge

enum _ctimer_match

List of Timer match registers.

Values:

enumerator kCTIMER_Match_0

Timer match register 0

enumerator kCTIMER_Match_1

Timer match register 1

enumerator kCTIMER_Match_2

Timer match register 2

enumerator kCTIMER_Match_3

Timer match register 3

enum _ctimer_external_match

List of external match.

Values:

enumerator kCTIMER_External_Match_0

External match 0

enumerator kCTIMER_External_Match_1

External match 1

enumerator kCTIMER_External_Match_2

External match 2

enumerator kCTIMER_External_Match_3

External match 3

enum _ctimer_match_output_control

List of output control options.

Values:

enumerator kCTIMER_Output_NoAction

No action is taken

enumerator kCTIMER_Output_Clear

Clear the EM bit/output to 0

enumerator kCTIMER_Output_Set

Set the EM bit/output to 1

enumerator kCTIMER_Output_Toggle

Toggle the EM bit/output

enum _ctimer_timer_mode

List of Timer modes.

Values:

enumerator kCTIMER_TimerMode
enumerator kCTIMER_IncreaseOnRiseEdge
enumerator kCTIMER_IncreaseOnFallEdge
enumerator kCTIMER_IncreaseOnBothEdge
enum _ctimer_interrupt_enable

List of Timer interrupts.

Values:

enumerator kCTIMER_Match0InterruptEnable

Match 0 interrupt

enumerator kCTIMER_Match1InterruptEnable

Match 1 interrupt

enumerator kCTIMER_Match2InterruptEnable

Match 2 interrupt

enumerator kCTIMER_Match3InterruptEnable

Match 3 interrupt

enum _ctimer_status_flags

List of Timer flags.

Values:

enumerator kCTIMER_Match0Flag

Match 0 interrupt flag

enumerator kCTIMER_Match1Flag

Match 1 interrupt flag

enumerator kCTIMER_Match2Flag

Match 2 interrupt flag

enumerator kCTIMER_Match3Flag

Match 3 interrupt flag

enum ctimer_callback_type_t

Callback type when registering for a callback. When registering a callback an array of function pointers is passed the size could be 1 or 8, the callback type will tell that.

Values:

enumerator kCTIMER_SingleCallback

Single Callback type where there is only one callback for the timer. based on the status flags different channels needs to be handled differently

enumerator kCTIMER_MultipleCallback

Multiple Callback type where there can be 8 valid callbacks, one per channel. for both match/capture

typedef enum _ctimer_capture_channel ctimer_capture_channel_t

List of Timer capture channels.

typedef enum _ctimer_capture_edge ctimer_capture_edge_t

List of capture edge options.

typedef enum _ctimer_match ctimer_match_t

List of Timer match registers.

typedef enum _ctimer_external_match ctimer_external_match_t

List of external match.

typedef enum _ctimer_match_output_control ctimer_match_output_control_t

List of output control options.

typedef enum _ctimer_timer_mode ctimer_timer_mode_t

List of Timer modes.

typedef enum _ctimer_interrupt_enable ctimer_interrupt_enable_t

List of Timer interrupts.

typedef enum _ctimer_status_flags ctimer_status_flags_t

List of Timer flags.

typedef void (*ctimer_callback_t)(uint32_t flags)
typedef struct _ctimer_match_config ctimer_match_config_t

Match configuration.

This structure holds the configuration settings for each match register.

typedef struct _ctimer_config ctimer_config_t

Timer configuration structure.

This structure holds the configuration settings for the Timer peripheral. To initialize this structure to reasonable defaults, call the CTIMER_GetDefaultConfig() function and pass a pointer to the configuration structure instance.

The configuration structure can be made constant so as to reside in flash.

void CTIMER_SetupMatch(CTIMER_Type *base, ctimer_match_t matchChannel, const ctimer_match_config_t *config)

Setup the match register.

User configuration is used to setup the match value and action to be taken when a match occurs.

Parameters:
  • base – Ctimer peripheral base address

  • matchChannel – Match register to configure

  • config – Pointer to the match configuration structure

uint32_t CTIMER_GetOutputMatchStatus(CTIMER_Type *base, uint32_t matchChannel)

Get the status of output match.

This function gets the status of output MAT, whether or not this output is connected to a pin. This status is driven to the MAT pins if the match function is selected via IOCON. 0 = LOW. 1 = HIGH.

Parameters:
  • base – Ctimer peripheral base address

  • matchChannel – External match channel, user can obtain the status of multiple match channels at the same time by using the logic of “|” enumeration ctimer_external_match_t

Returns:

The mask of external match channel status flags. Users need to use the _ctimer_external_match type to decode the return variables.

void CTIMER_SetupCapture(CTIMER_Type *base, ctimer_capture_channel_t capture, ctimer_capture_edge_t edge, bool enableInt)

Setup the capture.

Parameters:
  • base – Ctimer peripheral base address

  • capture – Capture channel to configure

  • edge – Edge on the channel that will trigger a capture

  • enableInt – Flag to enable channel interrupts, if enabled then the registered call back is called upon capture

static inline uint32_t CTIMER_GetTimerCountValue(CTIMER_Type *base)

Get the timer count value from TC register.

Parameters:
  • base – Ctimer peripheral base address.

Returns:

return the timer count value.

void CTIMER_RegisterCallBack(CTIMER_Type *base, ctimer_callback_t *cb_func, ctimer_callback_type_t cb_type)

Register callback.

Parameters:
  • base – Ctimer peripheral base address

  • cb_func – callback function

  • cb_type – callback function type, singular or multiple

static inline void CTIMER_Reset(CTIMER_Type *base)

Reset the counter.

The timer counter and prescale counter are reset on the next positive edge of the APB clock.

Parameters:
  • base – Ctimer peripheral base address

static inline void CTIMER_SetPrescale(CTIMER_Type *base, uint32_t prescale)

Setup the timer prescale value.

Specifies the maximum value for the Prescale Counter.

Parameters:
  • base – Ctimer peripheral base address

  • prescale – Prescale value

static inline uint32_t CTIMER_GetCaptureValue(CTIMER_Type *base, ctimer_capture_channel_t capture)

Get capture channel value.

Get the counter/timer value on the corresponding capture channel.

Parameters:
  • base – Ctimer peripheral base address

  • capture – Select capture channel

Returns:

The timer count capture value.

static inline void CTIMER_EnableResetMatchChannel(CTIMER_Type *base, ctimer_match_t match, bool enable)

Enable reset match channel.

Set the specified match channel reset operation.

Parameters:
  • base – Ctimer peripheral base address

  • match – match channel used

  • enable – Enable match channel reset operation.

static inline void CTIMER_EnableStopMatchChannel(CTIMER_Type *base, ctimer_match_t match, bool enable)

Enable stop match channel.

Set the specified match channel stop operation.

Parameters:
  • base – Ctimer peripheral base address.

  • match – match channel used.

  • enable – Enable match channel stop operation.

static inline void CTIMER_EnableMatchChannelReload(CTIMER_Type *base, ctimer_match_t match, bool enable)

Enable reload channel falling edge.

Enable the specified match channel reload match shadow value.

Parameters:
  • base – Ctimer peripheral base address.

  • match – match channel used.

  • enable – Enable .

static inline void CTIMER_EnableRisingEdgeCapture(CTIMER_Type *base, ctimer_capture_channel_t capture, bool enable)

Enable capture channel rising edge.

Sets the specified capture channel for rising edge capture.

Parameters:
  • base – Ctimer peripheral base address.

  • capture – capture channel used.

  • enable – Enable rising edge capture.

static inline void CTIMER_EnableFallingEdgeCapture(CTIMER_Type *base, ctimer_capture_channel_t capture, bool enable)

Enable capture channel falling edge.

Sets the specified capture channel for falling edge capture.

Parameters:
  • base – Ctimer peripheral base address.

  • capture – capture channel used.

  • enable – Enable falling edge capture.

static inline void CTIMER_SetShadowValue(CTIMER_Type *base, ctimer_match_t match, uint32_t matchvalue)

Set the specified match shadow channel.

Parameters:
  • base – Ctimer peripheral base address.

  • match – match channel used.

  • matchvalue – Reload the value of the corresponding match register.

struct _ctimer_match_config
#include <fsl_ctimer.h>

Match configuration.

This structure holds the configuration settings for each match register.

Public Members

uint32_t matchValue

This is stored in the match register

bool enableCounterReset

true: Match will reset the counter false: Match will not reser the counter

bool enableCounterStop

true: Match will stop the counter false: Match will not stop the counter

ctimer_match_output_control_t outControl

Action to be taken on a match on the EM bit/output

bool outPinInitState

Initial value of the EM bit/output

bool enableInterrupt

true: Generate interrupt upon match false: Do not generate interrupt on match

struct _ctimer_config
#include <fsl_ctimer.h>

Timer configuration structure.

This structure holds the configuration settings for the Timer peripheral. To initialize this structure to reasonable defaults, call the CTIMER_GetDefaultConfig() function and pass a pointer to the configuration structure instance.

The configuration structure can be made constant so as to reside in flash.

Public Members

ctimer_timer_mode_t mode

Timer mode

ctimer_capture_channel_t input

Input channel to increment the timer, used only in timer modes that rely on this input signal to increment TC

uint32_t prescale

Prescale value

Dsp

enum _dsp_static_vec_sel

Fusion DSP vector table select.

Values:

enumerator kDSP_StatVecSel0
enumerator kDSP_StatVecSel1
typedef struct _dsp_copy_image dsp_copy_image_t

Structure for DSP copy image to destination address.

Defines start and destination address for copying image with given size.

typedef enum _dsp_static_vec_sel dsp_static_vec_sel_t

Fusion DSP vector table select.

void DSP_Init(void)

Initializing DSP core.

Power up DSP TCM Enable DSP clock Reset DSP peripheral

void DSP_Deinit(void)

Deinit DSP core.

Power down DSP TCM Disable DSP clock Set DSP peripheral reset

void DSP_CopyImage(dsp_copy_image_t *dspCopyImage)

Copy DSP image to destination address.

Copy DSP image from source address to destination address with given size.

Parameters:
  • dspCopyImage – Structure contains information for DSP copy image to destination address.

static inline void DSP_Start(void)

Start DSP core.

static inline void DSP_Stop(void)

Stop DSP core.

static inline void DSP_SetVecRemap(dsp_static_vec_sel_t statVecSel, uint32_t remap)

Set DSP static vector table remap.

Parameters:
  • statVecSel – static vector base address selection

  • remap – static vector remap, For HiFi1 when statVecSel = 0, the valid range is 0~0x3FF, when statVecSel=1, the valid range is 0~0x7FF. For HiFi4, the bits value will remap ARADDR[22:10] when [STATVECSELECT] is high and ARADDR hits 1 KB from 2010_0000h.

FSL_DSP_DRIVER_VERSION

DSP driver version 2.0.0.

uint32_t *srcAddr
uint32_t *destAddr
uint32_t size
struct _dsp_copy_image
#include <fsl_dsp.h>

Structure for DSP copy image to destination address.

Defines start and destination address for copying image with given size.

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_EnableAsyncRequest(EDMA_Type *base, uint32_t channel, bool enable)

Enables an async request for the eDMA transfer.

Parameters:
  • base – eDMA peripheral base address.

  • channel – eDMA channel number.

  • enable – The command to enable (true) or disable (false).

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.

  1. 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:

  1. submit single transfer

    edma_tcd_t tcd;
    EDMA_PrepareTransferTCD(handle, tcd, ....)
    EDMA_SubmitTransferTCD(handle, tcd)
    EDMA_StartTransfer(handle)
    

  2. 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)
    

  3. 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)
    

  4. 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

edma_channel_transfer_config_t transfer[2];
EDMA_TransferSubmitLoopTransfer(psHandle, &transfer, 2U);
Then eDMA driver will link transfer[0] and transfer[1] to each other

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.4.

_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.

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

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.

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.

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

_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

_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.

_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.

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

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.

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.

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.

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.

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.

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

  1. the bytesEachRequest should align with the srcWidthOfEachTransfer and the dstWidthOfEachTransfer that is to say bytesEachRequest % srcWidthOfEachTransfer should be 0

  2. the srcOffsetOfEachTransfer and dstOffsetOfEachTransfer must be aligne with transfer width

  3. the totalBytes should align with the bytesEachRequest

  4. the srcAddr should align with the srcWidthOfEachTransfer

  5. the dstAddr should align with the dstWidthOfEachTransfer

  6. the srcAddr should align with srcAddrModulo if modulo feature is enabled

  7. 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

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.

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

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

  1. the bytesEachRequest should align with the srcWidthOfEachTransfer and the dstWidthOfEachTransfer that is to say bytesEachRequest % srcWidthOfEachTransfer should be 0

  2. the srcOffsetOfEachTransfer and dstOffsetOfEachTransfer must be aligne with transfer width

  3. the totalBytes should align with the bytesEachRequest

  4. the srcAddr should align with the srcWidthOfEachTransfer

  5. the dstAddr should align with the dstWidthOfEachTransfer

  6. the srcAddr should align with srcAddrModulo if modulo feature is enabled

  7. 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

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 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.

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 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

Public Members

struct _edma_core_channel EDMA5_REG
struct _edma_core_channel EDMA4_REG
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

eDMA soc Driver

void EDMA_EnableRequest(DMA_Type *base, dma_request_source_t requestSource)

Enable the eDMA request.

This function enables the eDMA request controlled by SYSCON.

Parameters:
  • base – eDMA peripheral base address.

  • requestSource – eDMA request source, see “dma_request_source_t”.

void EDMA_DisableRequest(DMA_Type *base, dma_request_source_t requestSource)

Disable the eDMA request.

This function disables the eDMA request controlled by SYSCON.

Parameters:
  • base – eDMA peripheral base address.

  • requestSource – eDMA request source, see “dma_request_source_t”.

FSL_EDMA_SOC_DRIVER_VERSION

Driver version 1.0.0.

FSL_EDMA_SOC_IP_DMA3

DMA IP version.

FSL_EDMA_SOC_IP_DMA4
EDMA_CHANNEL_OFFSET

EDMA base address convert macro.

EDMA_CHANNEL_ARRAY_STEP(base)

Ezhv

enum _arm2ezhv_intctl

Definition of 4 interrupt requests from ARM to EZH-V.

Values:

enumerator kEZHV_ARM2EZHV_MEI
enumerator kEZHV_ARM2EZHV_SEI
enumerator kEZHV_ARM2EZHV_MSI
enumerator kEZHV_ARM2EZHV_MTI
enum _ezhv2arm_int_chan

EZH-V to ARM interrupt channel.

Values:

enumerator kEZHV_EzhvToArmIntChan0
enumerator kEZHV_EzhvToArmIntChan1
enumerator kEZHV_EzhvToArmIntChan2
enumerator kEZHV_EzhvToArmIntChan3
enumerator kEZHV_EzhvToArmIntChan4
enumerator kEZHV_EzhvToArmIntChan5
enumerator kEZHV_EzhvToArmIntChan6
enumerator kEZHV_EzhvToArmIntChan7
enumerator kEZHV_EzhvToArmIntChan8
enumerator kEZHV_EzhvToArmIntChan9
enumerator kEZHV_EzhvToArmIntChan10
enumerator kEZHV_EzhvToArmIntChan11
enumerator kEZHV_EzhvToArmIntChan12
enumerator kEZHV_EzhvToArmIntChan13
enumerator kEZHV_EzhvToArmIntChan14
enumerator kEZHV_EzhvToArmIntChan15
typedef void (*ezhv_callback_t)(void *userData)

define callback function for EZH-V

This callback function is called in EZH-V interrupt handle.

typedef struct _ezhv_copy_image ezhv_copy_image_t

Structure for EZH-V copy image to destination address.

Defines source and destination address for copying image with given size.

typedef uint32_t ezhv_api_t

@Brief List of EZH-V APIs

typedef struct _ezhv_param ezhv_param_t

parameters used by EZH-V

typedef enum _arm2ezhv_intctl arm2ezhv_intctl_t

Definition of 4 interrupt requests from ARM to EZH-V.

typedef enum _ezhv2arm_int_chan ezhv2arm_int_chan_t

EZH-V to ARM interrupt channel.

void EZHV_Init(ezhv_copy_image_t *ezhvCopyImage)

Initialize the EZH-V.

Parameters:
  • ezhvCopyImage – The information about the EZH-V image to copy.

void EZHV_InitWithoutFirmware(void)

Initialize the EZH-V.

This function is similar with EZHV_Init, the difference is this function does not install the firmware, the firmware could be installed using EZHV_InstallFirmware.

void EZHV_InstallFirmware(ezhv_copy_image_t *ezhvCopyImage)

install EZH-V firmware by given image info

Parameters:
  • ezhvCopyImage – The information about the EZH-V image to copy.

void EZHV_Boot(uint32_t bootAddr)

Boot EZH-V from given address bootAddr.

Parameters:
  • bootAddr – The boot address.

void EZHV_Deinit(void)

Deinitialize the EZH-V.

void EZHV_SetCallback(ezhv_callback_t callback, uint16_t channel, void *userData)

Install the EZH-V callback function.

Parameters:
  • callback – EZH-V callback function pointer.

  • channel – interrupt channel index.

  • userData – A parameter for the callback function.

void EZHV_SetPara(ezhv_param_t *para)

Set the parameter used by EZH-V.

Parameters:
  • para – Parameter written into shared mem between ARM and EZH-V.

uint32_t *EZHV_GetParaAddr(void)

Get shared space address.

Returns:

The start address of shared space

void EZHV_WakeUpEzhv(arm2ezhv_intctl_t arm2ezhvInt)

Check the wait status and wake up EZH-V.

Parameters:
  • arm2ezhvInt – The interrupt request which will send to the EZH-V.

static inline void EZHV_EnableArm2EzhvInt(arm2ezhv_intctl_t arm2ezhvInt)

Enable interrupt request from ARM core to EZH-V core.

Note

This interrupt can be used to send interrupt request to EZH-V

Parameters:
  • arm2ezhvInt – The interrupt request which will send to the EZH-V.

static inline void EZHV_DisableArm2EzhvInt(arm2ezhv_intctl_t arm2ezhvInt)

Disable interrupt request from ARM core to EZH-V core.

Parameters:
  • arm2ezhvInt – The interrupt request type.

void EZHV_DriverIRQHandler(void)

EZH-V IRQ handler.

static inline void EZHV_EnableEzhv2ArmIntChan(ezhv2arm_int_chan_t chan)

Enable the EZH-V interrupt channel to ARM core.

Parameters:
  • chan – Ezhv to arm interrupt channel index.

static inline uint32_t EZHV_GetEzhv2ArmIntChan(void)

Get EZH-V interrupt outputs.

static inline void EZHV_ClearEzhv2ArmIntChan(ezhv2arm_int_chan_t chan)

Clear EZH-V interrupt outputs.

Parameters:
  • chan – EZH-V to ARM interrupt channel index.

static inline bool EZHV_GetEzhvStopStatusFlag()

Get EZH-V stop status flag.

static inline bool EZHV_GetEzhvHaltStatusFlag()

Get EZH-V halt status flag.

static inline bool EZHV_GetEzhvWaitStatusFlag()

Get EZH-V wait status flag.

static inline bool EZHV_GetEzhvWakeupStatusFlag()

Get EZH-V wakeup status flag.

FSL_EZHV_DRIVER_VERSION

cache driver version.

EZHV_API_MAX_ARG
uint32_t srcAddr
uint32_t destAddr
uint32_t size
ezhv_api_t ezhvApi
uint32_t argc
uint32_t *argv[8U]
EZHV_M_EXT_INT

EZHV inside machine-mode external isr offset.

EZHV_SHARED_DATA_ADDR

shared data space between ARM and EZHV, space size is 256 Bytes

EZHV_INT_CHAN_NUM

definition for active ezhv2arm int channel number

please redefine this macro’s value if less channels are enabled

struct _ezhv_copy_image
#include <fsl_ezhv.h>

Structure for EZH-V copy image to destination address.

Defines source and destination address for copying image with given size.

struct _ezhv_param
#include <fsl_ezhv.h>

parameters used by EZH-V

FGPIO Driver

FlexIO: FlexIO Driver

FlexIO Driver

void FLEXIO_GetDefaultConfig(flexio_config_t *userConfig)

Gets the default configuration to configure the FlexIO module. The configuration can used directly to call the FLEXIO_Configure().

Example:

flexio_config_t config;
FLEXIO_GetDefaultConfig(&config);

Parameters:
  • userConfig – pointer to flexio_config_t structure

void FLEXIO_Init(FLEXIO_Type *base, const flexio_config_t *userConfig)

Configures the FlexIO with a FlexIO configuration. The configuration structure can be filled by the user or be set with default values by FLEXIO_GetDefaultConfig().

Example

flexio_config_t config = {
.enableFlexio = true,
.enableInDoze = false,
.enableInDebug = true,
.enableFastAccess = false
};
FLEXIO_Configure(base, &config);

Parameters:
  • base – FlexIO peripheral base address

  • userConfig – pointer to flexio_config_t structure

void FLEXIO_Deinit(FLEXIO_Type *base)

Gates the FlexIO clock. Call this API to stop the FlexIO clock.

Note

After calling this API, call the FLEXO_Init to use the FlexIO module.

Parameters:
  • base – FlexIO peripheral base address

uint32_t FLEXIO_GetInstance(FLEXIO_Type *base)

Get instance number for FLEXIO module.

Parameters:
  • base – FLEXIO peripheral base address.

void FLEXIO_Reset(FLEXIO_Type *base)

Resets the FlexIO module.

Parameters:
  • base – FlexIO peripheral base address

static inline void FLEXIO_Enable(FLEXIO_Type *base, bool enable)

Enables the FlexIO module operation.

Parameters:
  • base – FlexIO peripheral base address

  • enable – true to enable, false to disable.

static inline uint32_t FLEXIO_ReadPinInput(FLEXIO_Type *base)

Reads the input data on each of the FlexIO pins.

Parameters:
  • base – FlexIO peripheral base address

Returns:

FlexIO pin input data

static inline uint8_t FLEXIO_GetShifterState(FLEXIO_Type *base)

Gets the current state pointer for state mode use.

Parameters:
  • base – FlexIO peripheral base address

Returns:

current State pointer

void FLEXIO_SetShifterConfig(FLEXIO_Type *base, uint8_t index, const flexio_shifter_config_t *shifterConfig)

Configures the shifter with the shifter configuration. The configuration structure covers both the SHIFTCTL and SHIFTCFG registers. To configure the shifter to the proper mode, select which timer controls the shifter to shift, whether to generate start bit/stop bit, and the polarity of start bit and stop bit.

Example

flexio_shifter_config_t config = {
.timerSelect = 0,
.timerPolarity = kFLEXIO_ShifterTimerPolarityOnPositive,
.pinConfig = kFLEXIO_PinConfigOpenDrainOrBidirection,
.pinPolarity = kFLEXIO_PinActiveLow,
.shifterMode = kFLEXIO_ShifterModeTransmit,
.inputSource = kFLEXIO_ShifterInputFromPin,
.shifterStop = kFLEXIO_ShifterStopBitHigh,
.shifterStart = kFLEXIO_ShifterStartBitLow
};
FLEXIO_SetShifterConfig(base, &config);

Parameters:
  • base – FlexIO peripheral base address

  • index – Shifter index

  • shifterConfig – Pointer to flexio_shifter_config_t structure

void FLEXIO_SetTimerConfig(FLEXIO_Type *base, uint8_t index, const flexio_timer_config_t *timerConfig)

Configures the timer with the timer configuration. The configuration structure covers both the TIMCTL and TIMCFG registers. To configure the timer to the proper mode, select trigger source for timer and the timer pin output and the timing for timer.

Example

flexio_timer_config_t config = {
.triggerSelect = FLEXIO_TIMER_TRIGGER_SEL_SHIFTnSTAT(0),
.triggerPolarity = kFLEXIO_TimerTriggerPolarityActiveLow,
.triggerSource = kFLEXIO_TimerTriggerSourceInternal,
.pinConfig = kFLEXIO_PinConfigOpenDrainOrBidirection,
.pinSelect = 0,
.pinPolarity = kFLEXIO_PinActiveHigh,
.timerMode = kFLEXIO_TimerModeDual8BitBaudBit,
.timerOutput = kFLEXIO_TimerOutputZeroNotAffectedByReset,
.timerDecrement = kFLEXIO_TimerDecSrcOnFlexIOClockShiftTimerOutput,
.timerReset = kFLEXIO_TimerResetOnTimerPinEqualToTimerOutput,
.timerDisable = kFLEXIO_TimerDisableOnTimerCompare,
.timerEnable = kFLEXIO_TimerEnableOnTriggerHigh,
.timerStop = kFLEXIO_TimerStopBitEnableOnTimerDisable,
.timerStart = kFLEXIO_TimerStartBitEnabled
};
FLEXIO_SetTimerConfig(base, &config);

Parameters:
  • base – FlexIO peripheral base address

  • index – Timer index

  • timerConfig – Pointer to the flexio_timer_config_t structure

static inline void FLEXIO_SetClockMode(FLEXIO_Type *base, uint8_t index, flexio_timer_decrement_source_t clocksource)

This function set the value of the prescaler on flexio channels.

Parameters:
  • base – Pointer to the FlexIO simulated peripheral type.

  • index – Timer index

  • clocksource – Set clock value

static inline void FLEXIO_EnableShifterStatusInterrupts(FLEXIO_Type *base, uint32_t mask)

Enables the shifter status interrupt. The interrupt generates when the corresponding SSF is set.

Note

For multiple shifter status interrupt enable, for example, two shifter status enable, can calculate the mask by using ((1 << shifter index0) | (1 << shifter index1))

Parameters:
  • base – FlexIO peripheral base address

  • mask – The shifter status mask which can be calculated by (1 << shifter index)

static inline void FLEXIO_DisableShifterStatusInterrupts(FLEXIO_Type *base, uint32_t mask)

Disables the shifter status interrupt. The interrupt won’t generate when the corresponding SSF is set.

Note

For multiple shifter status interrupt enable, for example, two shifter status enable, can calculate the mask by using ((1 << shifter index0) | (1 << shifter index1))

Parameters:
  • base – FlexIO peripheral base address

  • mask – The shifter status mask which can be calculated by (1 << shifter index)

static inline void FLEXIO_EnableShifterErrorInterrupts(FLEXIO_Type *base, uint32_t mask)

Enables the shifter error interrupt. The interrupt generates when the corresponding SEF is set.

Note

For multiple shifter error interrupt enable, for example, two shifter error enable, can calculate the mask by using ((1 << shifter index0) | (1 << shifter index1))

Parameters:
  • base – FlexIO peripheral base address

  • mask – The shifter error mask which can be calculated by (1 << shifter index)

static inline void FLEXIO_DisableShifterErrorInterrupts(FLEXIO_Type *base, uint32_t mask)

Disables the shifter error interrupt. The interrupt won’t generate when the corresponding SEF is set.

Note

For multiple shifter error interrupt enable, for example, two shifter error enable, can calculate the mask by using ((1 << shifter index0) | (1 << shifter index1))

Parameters:
  • base – FlexIO peripheral base address

  • mask – The shifter error mask which can be calculated by (1 << shifter index)

static inline void FLEXIO_EnableTimerStatusInterrupts(FLEXIO_Type *base, uint32_t mask)

Enables the timer status interrupt. The interrupt generates when the corresponding SSF is set.

Note

For multiple timer status interrupt enable, for example, two timer status enable, can calculate the mask by using ((1 << timer index0) | (1 << timer index1))

Parameters:
  • base – FlexIO peripheral base address

  • mask – The timer status mask which can be calculated by (1 << timer index)

static inline void FLEXIO_DisableTimerStatusInterrupts(FLEXIO_Type *base, uint32_t mask)

Disables the timer status interrupt. The interrupt won’t generate when the corresponding SSF is set.

Note

For multiple timer status interrupt enable, for example, two timer status enable, can calculate the mask by using ((1 << timer index0) | (1 << timer index1))

Parameters:
  • base – FlexIO peripheral base address

  • mask – The timer status mask which can be calculated by (1 << timer index)

static inline uint32_t FLEXIO_GetShifterStatusFlags(FLEXIO_Type *base)

Gets the shifter status flags.

Parameters:
  • base – FlexIO peripheral base address

Returns:

Shifter status flags

static inline void FLEXIO_ClearShifterStatusFlags(FLEXIO_Type *base, uint32_t mask)

Clears the shifter status flags.

Note

For clearing multiple shifter status flags, for example, two shifter status flags, can calculate the mask by using ((1 << shifter index0) | (1 << shifter index1))

Parameters:
  • base – FlexIO peripheral base address

  • mask – The shifter status mask which can be calculated by (1 << shifter index)

static inline uint32_t FLEXIO_GetShifterErrorFlags(FLEXIO_Type *base)

Gets the shifter error flags.

Parameters:
  • base – FlexIO peripheral base address

Returns:

Shifter error flags

static inline void FLEXIO_ClearShifterErrorFlags(FLEXIO_Type *base, uint32_t mask)

Clears the shifter error flags.

Note

For clearing multiple shifter error flags, for example, two shifter error flags, can calculate the mask by using ((1 << shifter index0) | (1 << shifter index1))

Parameters:
  • base – FlexIO peripheral base address

  • mask – The shifter error mask which can be calculated by (1 << shifter index)

static inline uint32_t FLEXIO_GetTimerStatusFlags(FLEXIO_Type *base)

Gets the timer status flags.

Parameters:
  • base – FlexIO peripheral base address

Returns:

Timer status flags

static inline void FLEXIO_ClearTimerStatusFlags(FLEXIO_Type *base, uint32_t mask)

Clears the timer status flags.

Note

For clearing multiple timer status flags, for example, two timer status flags, can calculate the mask by using ((1 << timer index0) | (1 << timer index1))

Parameters:
  • base – FlexIO peripheral base address

  • mask – The timer status mask which can be calculated by (1 << timer index)

static inline void FLEXIO_EnableShifterStatusDMA(FLEXIO_Type *base, uint32_t mask, bool enable)

Enables/disables the shifter status DMA. The DMA request generates when the corresponding SSF is set.

Note

For multiple shifter status DMA enables, for example, calculate the mask by using ((1 << shifter index0) | (1 << shifter index1))

Parameters:
  • base – FlexIO peripheral base address

  • mask – The shifter status mask which can be calculated by (1 << shifter index)

  • enable – True to enable, false to disable.

uint32_t FLEXIO_GetShifterBufferAddress(FLEXIO_Type *base, flexio_shifter_buffer_type_t type, uint8_t index)

Gets the shifter buffer address for the DMA transfer usage.

Parameters:
  • base – FlexIO peripheral base address

  • type – Shifter type of flexio_shifter_buffer_type_t

  • index – Shifter index

Returns:

Corresponding shifter buffer index

status_t FLEXIO_RegisterHandleIRQ(void *base, void *handle, flexio_isr_t isr)

Registers the handle and the interrupt handler for the FlexIO-simulated peripheral.

Parameters:
  • base – Pointer to the FlexIO simulated peripheral type.

  • handle – Pointer to the handler for FlexIO simulated peripheral.

  • isr – FlexIO simulated peripheral interrupt handler.

Return values:
  • kStatus_Success – Successfully create the handle.

  • kStatus_OutOfRange – The FlexIO type/handle/ISR table out of range.

status_t FLEXIO_UnregisterHandleIRQ(void *base)

Unregisters the handle and the interrupt handler for the FlexIO-simulated peripheral.

Parameters:
  • base – Pointer to the FlexIO simulated peripheral type.

Return values:
  • kStatus_Success – Successfully create the handle.

  • kStatus_OutOfRange – The FlexIO type/handle/ISR table out of range.

static inline void FLEXIO_ClearPortOutput(FLEXIO_Type *base, uint32_t mask)

Sets the output level of the multiple FLEXIO pins to the logic 0.

Parameters:
  • base – FlexIO peripheral base address

  • mask – FLEXIO pin number mask

static inline void FLEXIO_SetPortOutput(FLEXIO_Type *base, uint32_t mask)

Sets the output level of the multiple FLEXIO pins to the logic 1.

Parameters:
  • base – FlexIO peripheral base address

  • mask – FLEXIO pin number mask

static inline void FLEXIO_TogglePortOutput(FLEXIO_Type *base, uint32_t mask)

Reverses the current output logic of the multiple FLEXIO pins.

Parameters:
  • base – FlexIO peripheral base address

  • mask – FLEXIO pin number mask

static inline void FLEXIO_PinWrite(FLEXIO_Type *base, uint32_t pin, uint8_t output)

Sets the output level of the FLEXIO pins to the logic 1 or 0.

Parameters:
  • base – FlexIO peripheral base address

  • pin – FLEXIO pin number.

  • output – FLEXIO pin output logic level.

    • 0: corresponding pin output low-logic level.

    • 1: corresponding pin output high-logic level.

static inline void FLEXIO_EnablePinOutput(FLEXIO_Type *base, uint32_t pin)

Enables the FLEXIO output pin function.

Parameters:
  • base – FlexIO peripheral base address

  • pin – FLEXIO pin number.

static inline uint32_t FLEXIO_PinRead(FLEXIO_Type *base, uint32_t pin)

Reads the current input value of the FLEXIO pin.

Parameters:
  • base – FlexIO peripheral base address

  • pin – FLEXIO pin number.

Return values:

FLEXIO – port input value

  • 0: corresponding pin input low-logic level.

  • 1: corresponding pin input high-logic level.

static inline uint32_t FLEXIO_GetPinStatus(FLEXIO_Type *base, uint32_t pin)

Gets the FLEXIO input pin status.

Parameters:
  • base – FlexIO peripheral base address

  • pin – FLEXIO pin number.

Return values:

FLEXIO – port input status

  • 0: corresponding pin input capture no status.

  • 1: corresponding pin input capture rising or falling edge.

static inline void FLEXIO_ClearPortStatus(FLEXIO_Type *base, uint32_t mask)

Clears the multiple FLEXIO input pins status.

Parameters:
  • base – FlexIO peripheral base address

  • mask – FLEXIO pin number mask

FSL_FLEXIO_DRIVER_VERSION

FlexIO driver version.

enum _flexio_timer_trigger_polarity

Define time of timer trigger polarity.

Values:

enumerator kFLEXIO_TimerTriggerPolarityActiveHigh

Active high.

enumerator kFLEXIO_TimerTriggerPolarityActiveLow

Active low.

enum _flexio_timer_trigger_source

Define type of timer trigger source.

Values:

enumerator kFLEXIO_TimerTriggerSourceExternal

External trigger selected.

enumerator kFLEXIO_TimerTriggerSourceInternal

Internal trigger selected.

enum _flexio_pin_config

Define type of timer/shifter pin configuration.

Values:

enumerator kFLEXIO_PinConfigOutputDisabled

Pin output disabled.

enumerator kFLEXIO_PinConfigOpenDrainOrBidirection

Pin open drain or bidirectional output enable.

enumerator kFLEXIO_PinConfigBidirectionOutputData

Pin bidirectional output data.

enumerator kFLEXIO_PinConfigOutput

Pin output.

enum _flexio_pin_polarity

Definition of pin polarity.

Values:

enumerator kFLEXIO_PinActiveHigh

Active high.

enumerator kFLEXIO_PinActiveLow

Active low.

enum _flexio_timer_mode

Define type of timer work mode.

Values:

enumerator kFLEXIO_TimerModeDisabled

Timer Disabled.

enumerator kFLEXIO_TimerModeDual8BitBaudBit

Dual 8-bit counters baud/bit mode.

enumerator kFLEXIO_TimerModeDual8BitPWM

Dual 8-bit counters PWM mode.

enumerator kFLEXIO_TimerModeSingle16Bit

Single 16-bit counter mode.

enum _flexio_timer_output

Define type of timer initial output or timer reset condition.

Values:

enumerator kFLEXIO_TimerOutputOneNotAffectedByReset

Logic one when enabled and is not affected by timer reset.

enumerator kFLEXIO_TimerOutputZeroNotAffectedByReset

Logic zero when enabled and is not affected by timer reset.

enumerator kFLEXIO_TimerOutputOneAffectedByReset

Logic one when enabled and on timer reset.

enumerator kFLEXIO_TimerOutputZeroAffectedByReset

Logic zero when enabled and on timer reset.

enum _flexio_timer_decrement_source

Define type of timer decrement.

Values:

enumerator kFLEXIO_TimerDecSrcOnFlexIOClockShiftTimerOutput

Decrement counter on FlexIO clock, Shift clock equals Timer output.

enumerator kFLEXIO_TimerDecSrcOnTriggerInputShiftTimerOutput

Decrement counter on Trigger input (both edges), Shift clock equals Timer output.

enumerator kFLEXIO_TimerDecSrcOnPinInputShiftPinInput

Decrement counter on Pin input (both edges), Shift clock equals Pin input.

enumerator kFLEXIO_TimerDecSrcOnTriggerInputShiftTriggerInput

Decrement counter on Trigger input (both edges), Shift clock equals Trigger input.

enum _flexio_timer_reset_condition

Define type of timer reset condition.

Values:

enumerator kFLEXIO_TimerResetNever

Timer never reset.

enumerator kFLEXIO_TimerResetOnTimerPinEqualToTimerOutput

Timer reset on Timer Pin equal to Timer Output.

enumerator kFLEXIO_TimerResetOnTimerTriggerEqualToTimerOutput

Timer reset on Timer Trigger equal to Timer Output.

enumerator kFLEXIO_TimerResetOnTimerPinRisingEdge

Timer reset on Timer Pin rising edge.

enumerator kFLEXIO_TimerResetOnTimerTriggerRisingEdge

Timer reset on Trigger rising edge.

enumerator kFLEXIO_TimerResetOnTimerTriggerBothEdge

Timer reset on Trigger rising or falling edge.

enum _flexio_timer_disable_condition

Define type of timer disable condition.

Values:

enumerator kFLEXIO_TimerDisableNever

Timer never disabled.

enumerator kFLEXIO_TimerDisableOnPreTimerDisable

Timer disabled on Timer N-1 disable.

enumerator kFLEXIO_TimerDisableOnTimerCompare

Timer disabled on Timer compare.

enumerator kFLEXIO_TimerDisableOnTimerCompareTriggerLow

Timer disabled on Timer compare and Trigger Low.

enumerator kFLEXIO_TimerDisableOnPinBothEdge

Timer disabled on Pin rising or falling edge.

enumerator kFLEXIO_TimerDisableOnPinBothEdgeTriggerHigh

Timer disabled on Pin rising or falling edge provided Trigger is high.

enumerator kFLEXIO_TimerDisableOnTriggerFallingEdge

Timer disabled on Trigger falling edge.

enum _flexio_timer_enable_condition

Define type of timer enable condition.

Values:

enumerator kFLEXIO_TimerEnabledAlways

Timer always enabled.

enumerator kFLEXIO_TimerEnableOnPrevTimerEnable

Timer enabled on Timer N-1 enable.

enumerator kFLEXIO_TimerEnableOnTriggerHigh

Timer enabled on Trigger high.

enumerator kFLEXIO_TimerEnableOnTriggerHighPinHigh

Timer enabled on Trigger high and Pin high.

enumerator kFLEXIO_TimerEnableOnPinRisingEdge

Timer enabled on Pin rising edge.

enumerator kFLEXIO_TimerEnableOnPinRisingEdgeTriggerHigh

Timer enabled on Pin rising edge and Trigger high.

enumerator kFLEXIO_TimerEnableOnTriggerRisingEdge

Timer enabled on Trigger rising edge.

enumerator kFLEXIO_TimerEnableOnTriggerBothEdge

Timer enabled on Trigger rising or falling edge.

enum _flexio_timer_stop_bit_condition

Define type of timer stop bit generate condition.

Values:

enumerator kFLEXIO_TimerStopBitDisabled

Stop bit disabled.

enumerator kFLEXIO_TimerStopBitEnableOnTimerCompare

Stop bit is enabled on timer compare.

enumerator kFLEXIO_TimerStopBitEnableOnTimerDisable

Stop bit is enabled on timer disable.

enumerator kFLEXIO_TimerStopBitEnableOnTimerCompareDisable

Stop bit is enabled on timer compare and timer disable.

enum _flexio_timer_start_bit_condition

Define type of timer start bit generate condition.

Values:

enumerator kFLEXIO_TimerStartBitDisabled

Start bit disabled.

enumerator kFLEXIO_TimerStartBitEnabled

Start bit enabled.

enum _flexio_timer_output_state

FlexIO as PWM channel output state.

Values:

enumerator kFLEXIO_PwmLow

The output state of PWM channel is low

enumerator kFLEXIO_PwmHigh

The output state of PWM channel is high

enum _flexio_shifter_timer_polarity

Define type of timer polarity for shifter control.

Values:

enumerator kFLEXIO_ShifterTimerPolarityOnPositive

Shift on positive edge of shift clock.

enumerator kFLEXIO_ShifterTimerPolarityOnNegitive

Shift on negative edge of shift clock.

enum _flexio_shifter_mode

Define type of shifter working mode.

Values:

enumerator kFLEXIO_ShifterDisabled

Shifter is disabled.

enumerator kFLEXIO_ShifterModeReceive

Receive mode.

enumerator kFLEXIO_ShifterModeTransmit

Transmit mode.

enumerator kFLEXIO_ShifterModeMatchStore

Match store mode.

enumerator kFLEXIO_ShifterModeMatchContinuous

Match continuous mode.

enumerator kFLEXIO_ShifterModeState

SHIFTBUF contents are used for storing programmable state attributes.

enumerator kFLEXIO_ShifterModeLogic

SHIFTBUF contents are used for implementing programmable logic look up table.

enum _flexio_shifter_input_source

Define type of shifter input source.

Values:

enumerator kFLEXIO_ShifterInputFromPin

Shifter input from pin.

enumerator kFLEXIO_ShifterInputFromNextShifterOutput

Shifter input from Shifter N+1.

enum _flexio_shifter_stop_bit

Define of STOP bit configuration.

Values:

enumerator kFLEXIO_ShifterStopBitDisable

Disable shifter stop bit.

enumerator kFLEXIO_ShifterStopBitLow

Set shifter stop bit to logic low level.

enumerator kFLEXIO_ShifterStopBitHigh

Set shifter stop bit to logic high level.

enum _flexio_shifter_start_bit

Define type of START bit configuration.

Values:

enumerator kFLEXIO_ShifterStartBitDisabledLoadDataOnEnable

Disable shifter start bit, transmitter loads data on enable.

enumerator kFLEXIO_ShifterStartBitDisabledLoadDataOnShift

Disable shifter start bit, transmitter loads data on first shift.

enumerator kFLEXIO_ShifterStartBitLow

Set shifter start bit to logic low level.

enumerator kFLEXIO_ShifterStartBitHigh

Set shifter start bit to logic high level.

enum _flexio_shifter_buffer_type

Define FlexIO shifter buffer type.

Values:

enumerator kFLEXIO_ShifterBuffer

Shifter Buffer N Register.

enumerator kFLEXIO_ShifterBufferBitSwapped

Shifter Buffer N Bit Byte Swapped Register.

enumerator kFLEXIO_ShifterBufferByteSwapped

Shifter Buffer N Byte Swapped Register.

enumerator kFLEXIO_ShifterBufferBitByteSwapped

Shifter Buffer N Bit Swapped Register.

enumerator kFLEXIO_ShifterBufferNibbleByteSwapped

Shifter Buffer N Nibble Byte Swapped Register.

enumerator kFLEXIO_ShifterBufferHalfWordSwapped

Shifter Buffer N Half Word Swapped Register.

enumerator kFLEXIO_ShifterBufferNibbleSwapped

Shifter Buffer N Nibble Swapped Register.

enum _flexio_gpio_direction

FLEXIO gpio direction definition.

Values:

enumerator kFLEXIO_DigitalInput

Set current pin as digital input

enumerator kFLEXIO_DigitalOutput

Set current pin as digital output

enum _flexio_pin_input_config

FLEXIO gpio input config.

Values:

enumerator kFLEXIO_InputInterruptDisabled

Interrupt request is disabled.

enumerator kFLEXIO_InputInterruptEnable

Interrupt request is enable.

enumerator kFLEXIO_FlagRisingEdgeEnable

Input pin flag on rising edge.

enumerator kFLEXIO_FlagFallingEdgeEnable

Input pin flag on falling edge.

typedef enum _flexio_timer_trigger_polarity flexio_timer_trigger_polarity_t

Define time of timer trigger polarity.

typedef enum _flexio_timer_trigger_source flexio_timer_trigger_source_t

Define type of timer trigger source.

typedef enum _flexio_pin_config flexio_pin_config_t

Define type of timer/shifter pin configuration.

typedef enum _flexio_pin_polarity flexio_pin_polarity_t

Definition of pin polarity.

typedef enum _flexio_timer_mode flexio_timer_mode_t

Define type of timer work mode.

typedef enum _flexio_timer_output flexio_timer_output_t

Define type of timer initial output or timer reset condition.

typedef enum _flexio_timer_decrement_source flexio_timer_decrement_source_t

Define type of timer decrement.

typedef enum _flexio_timer_reset_condition flexio_timer_reset_condition_t

Define type of timer reset condition.

typedef enum _flexio_timer_disable_condition flexio_timer_disable_condition_t

Define type of timer disable condition.

typedef enum _flexio_timer_enable_condition flexio_timer_enable_condition_t

Define type of timer enable condition.

typedef enum _flexio_timer_stop_bit_condition flexio_timer_stop_bit_condition_t

Define type of timer stop bit generate condition.

typedef enum _flexio_timer_start_bit_condition flexio_timer_start_bit_condition_t

Define type of timer start bit generate condition.

typedef enum _flexio_timer_output_state flexio_timer_output_state_t

FlexIO as PWM channel output state.

typedef enum _flexio_shifter_timer_polarity flexio_shifter_timer_polarity_t

Define type of timer polarity for shifter control.

typedef enum _flexio_shifter_mode flexio_shifter_mode_t

Define type of shifter working mode.

typedef enum _flexio_shifter_input_source flexio_shifter_input_source_t

Define type of shifter input source.

typedef enum _flexio_shifter_stop_bit flexio_shifter_stop_bit_t

Define of STOP bit configuration.

typedef enum _flexio_shifter_start_bit flexio_shifter_start_bit_t

Define type of START bit configuration.

typedef enum _flexio_shifter_buffer_type flexio_shifter_buffer_type_t

Define FlexIO shifter buffer type.

typedef struct _flexio_config_ flexio_config_t

Define FlexIO user configuration structure.

typedef struct _flexio_timer_config flexio_timer_config_t

Define FlexIO timer configuration structure.

typedef struct _flexio_shifter_config flexio_shifter_config_t

Define FlexIO shifter configuration structure.

typedef enum _flexio_gpio_direction flexio_gpio_direction_t

FLEXIO gpio direction definition.

typedef enum _flexio_pin_input_config flexio_pin_input_config_t

FLEXIO gpio input config.

typedef struct _flexio_gpio_config flexio_gpio_config_t

The FLEXIO 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, use inputConfig param. If configured as an output pin, use outputLogic.

typedef void (*flexio_isr_t)(void *base, void *handle)

typedef for FlexIO simulated driver interrupt handler.

FLEXIO_Type *const s_flexioBases[]

Pointers to flexio bases for each instance.

const clock_ip_name_t s_flexioClocks[]

Pointers to flexio clocks for each instance.

void FLEXIO_SetPinConfig(FLEXIO_Type *base, uint32_t pin, flexio_gpio_config_t *config)

Configure a FLEXIO pin used by the board.

To Config the FLEXIO PIN, define a pin configuration, as either input or output, in the user file. Then, call the FLEXIO_SetPinConfig() function.

This is an example to define an input pin or an output pin configuration.

Define a digital input pin configuration,
flexio_gpio_config_t config =
{
  kFLEXIO_DigitalInput,
  0U,
  kFLEXIO_FlagRisingEdgeEnable | kFLEXIO_InputInterruptEnable,
}
Define a digital output pin configuration,
flexio_gpio_config_t config =
{
  kFLEXIO_DigitalOutput,
  0U,
  0U
}

Parameters:
  • base – FlexIO peripheral base address

  • pin – FLEXIO pin number.

  • config – FLEXIO pin configuration pointer.

FLEXIO_TIMER_TRIGGER_SEL_PININPUT(x)

Calculate FlexIO timer trigger.

FLEXIO_TIMER_TRIGGER_SEL_SHIFTnSTAT(x)
FLEXIO_TIMER_TRIGGER_SEL_TIMn(x)
struct _flexio_config_
#include <fsl_flexio.h>

Define FlexIO user configuration structure.

Public Members

bool enableFlexio

Enable/disable FlexIO module

bool enableInDoze

Enable/disable FlexIO operation in doze mode

bool enableInDebug

Enable/disable FlexIO operation in debug mode

bool enableFastAccess

Enable/disable fast access to FlexIO registers, fast access requires the FlexIO clock to be at least twice the frequency of the bus clock.

struct _flexio_timer_config
#include <fsl_flexio.h>

Define FlexIO timer configuration structure.

Public Members

uint32_t triggerSelect

The internal trigger selection number using MACROs.

flexio_timer_trigger_polarity_t triggerPolarity

Trigger Polarity.

flexio_timer_trigger_source_t triggerSource

Trigger Source, internal (see ‘trgsel’) or external.

flexio_pin_config_t pinConfig

Timer Pin Configuration.

uint32_t pinSelect

Timer Pin number Select.

flexio_pin_polarity_t pinPolarity

Timer Pin Polarity.

flexio_timer_mode_t timerMode

Timer work Mode.

flexio_timer_output_t timerOutput

Configures the initial state of the Timer Output and whether it is affected by the Timer reset.

flexio_timer_decrement_source_t timerDecrement

Configures the source of the Timer decrement and the source of the Shift clock.

flexio_timer_reset_condition_t timerReset

Configures the condition that causes the timer counter (and optionally the timer output) to be reset.

flexio_timer_disable_condition_t timerDisable

Configures the condition that causes the Timer to be disabled and stop decrementing.

flexio_timer_enable_condition_t timerEnable

Configures the condition that causes the Timer to be enabled and start decrementing.

flexio_timer_stop_bit_condition_t timerStop

Timer STOP Bit generation.

flexio_timer_start_bit_condition_t timerStart

Timer STRAT Bit generation.

uint32_t timerCompare

Value for Timer Compare N Register.

struct _flexio_shifter_config
#include <fsl_flexio.h>

Define FlexIO shifter configuration structure.

Public Members

uint32_t timerSelect

Selects which Timer is used for controlling the logic/shift register and generating the Shift clock.

flexio_shifter_timer_polarity_t timerPolarity

Timer Polarity.

flexio_pin_config_t pinConfig

Shifter Pin Configuration.

uint32_t pinSelect

Shifter Pin number Select.

flexio_pin_polarity_t pinPolarity

Shifter Pin Polarity.

flexio_shifter_mode_t shifterMode

Configures the mode of the Shifter.

uint32_t parallelWidth

Configures the parallel width when using parallel mode.

flexio_shifter_input_source_t inputSource

Selects the input source for the shifter.

flexio_shifter_stop_bit_t shifterStop

Shifter STOP bit.

flexio_shifter_start_bit_t shifterStart

Shifter START bit.

struct _flexio_gpio_config
#include <fsl_flexio.h>

The FLEXIO 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, use inputConfig param. If configured as an output pin, use outputLogic.

Public Members

flexio_gpio_direction_t pinDirection

FLEXIO pin direction, input or output

uint8_t outputLogic

Set a default output logic, which has no use in input

uint8_t inputConfig

Set an input config

FlexIO eDMA I2S Driver

void FLEXIO_I2S_TransferTxCreateHandleEDMA(FLEXIO_I2S_Type *base, flexio_i2s_edma_handle_t *handle, flexio_i2s_edma_callback_t callback, void *userData, edma_handle_t *dmaHandle)

Initializes the FlexIO I2S eDMA handle.

This function initializes the FlexIO I2S master DMA handle which can be used for other FlexIO I2S master transactional APIs. Usually, for a specified FlexIO I2S instance, call this API once to get the initialized handle.

Parameters:
  • base – FlexIO I2S peripheral base address.

  • handle – FlexIO I2S eDMA handle pointer.

  • callback – FlexIO I2S eDMA callback function called while finished a block.

  • userData – User parameter for callback.

  • dmaHandle – eDMA handle for FlexIO I2S. This handle is a static value allocated by users.

void FLEXIO_I2S_TransferRxCreateHandleEDMA(FLEXIO_I2S_Type *base, flexio_i2s_edma_handle_t *handle, flexio_i2s_edma_callback_t callback, void *userData, edma_handle_t *dmaHandle)

Initializes the FlexIO I2S Rx eDMA handle.

This function initializes the FlexIO I2S slave DMA handle which can be used for other FlexIO I2S master transactional APIs. Usually, for a specified FlexIO I2S instance, call this API once to get the initialized handle.

Parameters:
  • base – FlexIO I2S peripheral base address.

  • handle – FlexIO I2S eDMA handle pointer.

  • callback – FlexIO I2S eDMA callback function called while finished a block.

  • userData – User parameter for callback.

  • dmaHandle – eDMA handle for FlexIO I2S. This handle is a static value allocated by users.

void FLEXIO_I2S_TransferSetFormatEDMA(FLEXIO_I2S_Type *base, flexio_i2s_edma_handle_t *handle, flexio_i2s_format_t *format, uint32_t srcClock_Hz)

Configures the FlexIO I2S Tx audio format.

Audio format can be changed in run-time of FlexIO I2S. This function configures the sample rate and audio data format to be transferred. This function also sets the eDMA parameter according to format.

Parameters:
  • base – FlexIO I2S peripheral base address.

  • handle – FlexIO I2S eDMA handle pointer

  • format – Pointer to FlexIO I2S audio data format structure.

  • srcClock_Hz – FlexIO I2S clock source frequency in Hz, it should be 0 while in slave mode.

status_t FLEXIO_I2S_TransferSendEDMA(FLEXIO_I2S_Type *base, flexio_i2s_edma_handle_t *handle, flexio_i2s_transfer_t *xfer)

Performs a non-blocking FlexIO I2S transfer using DMA.

Note

This interface returned immediately after transfer initiates. Users should call FLEXIO_I2S_GetTransferStatus to poll the transfer status and check whether the FlexIO I2S transfer is finished.

Parameters:
  • base – FlexIO I2S peripheral base address.

  • handle – FlexIO I2S DMA handle pointer.

  • xfer – Pointer to DMA transfer structure.

Return values:
  • kStatus_Success – Start a FlexIO I2S eDMA send successfully.

  • kStatus_InvalidArgument – The input arguments is invalid.

  • kStatus_TxBusy – FlexIO I2S is busy sending data.

status_t FLEXIO_I2S_TransferReceiveEDMA(FLEXIO_I2S_Type *base, flexio_i2s_edma_handle_t *handle, flexio_i2s_transfer_t *xfer)

Performs a non-blocking FlexIO I2S receive using eDMA.

Note

This interface returned immediately after transfer initiates. Users should call FLEXIO_I2S_GetReceiveRemainingBytes to poll the transfer status and check whether the FlexIO I2S transfer is finished.

Parameters:
  • base – FlexIO I2S peripheral base address.

  • handle – FlexIO I2S DMA handle pointer.

  • xfer – Pointer to DMA transfer structure.

Return values:
  • kStatus_Success – Start a FlexIO I2S eDMA receive successfully.

  • kStatus_InvalidArgument – The input arguments is invalid.

  • kStatus_RxBusy – FlexIO I2S is busy receiving data.

void FLEXIO_I2S_TransferAbortSendEDMA(FLEXIO_I2S_Type *base, flexio_i2s_edma_handle_t *handle)

Aborts a FlexIO I2S transfer using eDMA.

Parameters:
  • base – FlexIO I2S peripheral base address.

  • handle – FlexIO I2S DMA handle pointer.

void FLEXIO_I2S_TransferAbortReceiveEDMA(FLEXIO_I2S_Type *base, flexio_i2s_edma_handle_t *handle)

Aborts a FlexIO I2S receive using eDMA.

Parameters:
  • base – FlexIO I2S peripheral base address.

  • handle – FlexIO I2S DMA handle pointer.

status_t FLEXIO_I2S_TransferGetSendCountEDMA(FLEXIO_I2S_Type *base, flexio_i2s_edma_handle_t *handle, size_t *count)

Gets the remaining bytes to be sent.

Parameters:
  • base – FlexIO I2S peripheral base address.

  • handle – FlexIO I2S DMA handle pointer.

  • count – Bytes sent.

Return values:
  • kStatus_Success – Succeed get the transfer count.

  • kStatus_NoTransferInProgress – There is not a non-blocking transaction currently in progress.

status_t FLEXIO_I2S_TransferGetReceiveCountEDMA(FLEXIO_I2S_Type *base, flexio_i2s_edma_handle_t *handle, size_t *count)

Get the remaining bytes to be received.

Parameters:
  • base – FlexIO I2S peripheral base address.

  • handle – FlexIO I2S DMA handle pointer.

  • count – Bytes received.

Return values:
  • kStatus_Success – Succeed get the transfer count.

  • kStatus_NoTransferInProgress – There is not a non-blocking transaction currently in progress.

FSL_FLEXIO_I2S_EDMA_DRIVER_VERSION

FlexIO I2S EDMA driver version 2.1.8.

typedef struct _flexio_i2s_edma_handle flexio_i2s_edma_handle_t
typedef void (*flexio_i2s_edma_callback_t)(FLEXIO_I2S_Type *base, flexio_i2s_edma_handle_t *handle, status_t status, void *userData)

FlexIO I2S eDMA transfer callback function for finish and error.

struct _flexio_i2s_edma_handle
#include <fsl_flexio_i2s_edma.h>

FlexIO I2S DMA transfer handle, users should not touch the content of the handle.

Public Members

edma_handle_t *dmaHandle

DMA handler for FlexIO I2S send

uint8_t bytesPerFrame

Bytes in a frame

uint8_t nbytes

eDMA minor byte transfer count initially configured.

uint32_t state

Internal state for FlexIO I2S eDMA transfer

flexio_i2s_edma_callback_t callback

Callback for users while transfer finish or error occurred

void *userData

User callback parameter

edma_tcd_t tcd[(4U) + 1U]

TCD pool for eDMA transfer.

flexio_i2s_transfer_t queue[(4U)]

Transfer queue storing queued transfer.

size_t transferSize[(4U)]

Data bytes need to transfer

volatile uint8_t queueUser

Index for user to queue transfer.

volatile uint8_t queueDriver

Index for driver to get the transfer data and size

FlexIO eDMA SPI Driver

status_t FLEXIO_SPI_MasterTransferCreateHandleEDMA(FLEXIO_SPI_Type *base, flexio_spi_master_edma_handle_t *handle, flexio_spi_master_edma_transfer_callback_t callback, void *userData, edma_handle_t *txHandle, edma_handle_t *rxHandle)

Initializes the FlexIO SPI master eDMA handle.

This function initializes the FlexIO SPI master eDMA handle which can be used for other FlexIO SPI master transactional APIs. For a specified FlexIO SPI instance, call this API once to get the initialized handle.

Parameters:
  • base – Pointer to FLEXIO_SPI_Type structure.

  • handle – Pointer to flexio_spi_master_edma_handle_t structure to store the transfer state.

  • callback – SPI callback, NULL means no callback.

  • userData – callback function parameter.

  • txHandle – User requested eDMA handle for FlexIO SPI RX eDMA transfer.

  • rxHandle – User requested eDMA handle for FlexIO SPI TX eDMA transfer.

Return values:
  • kStatus_Success – Successfully create the handle.

  • kStatus_OutOfRange – The FlexIO SPI eDMA type/handle table out of range.

status_t FLEXIO_SPI_MasterTransferEDMA(FLEXIO_SPI_Type *base, flexio_spi_master_edma_handle_t *handle, flexio_spi_transfer_t *xfer)

Performs a non-blocking FlexIO SPI transfer using eDMA.

Note

This interface returns immediately after transfer initiates. Call FLEXIO_SPI_MasterGetTransferCountEDMA to poll the transfer status and check whether the FlexIO SPI transfer is finished.

Parameters:
  • base – Pointer to FLEXIO_SPI_Type structure.

  • handle – Pointer to flexio_spi_master_edma_handle_t structure to store the transfer state.

  • xfer – Pointer to FlexIO SPI transfer structure.

Return values:
  • kStatus_Success – Successfully start a transfer.

  • kStatus_InvalidArgument – Input argument is invalid.

  • kStatus_FLEXIO_SPI_Busy – FlexIO SPI is not idle, is running another transfer.

void FLEXIO_SPI_MasterTransferAbortEDMA(FLEXIO_SPI_Type *base, flexio_spi_master_edma_handle_t *handle)

Aborts a FlexIO SPI transfer using eDMA.

Parameters:
  • base – Pointer to FLEXIO_SPI_Type structure.

  • handle – FlexIO SPI eDMA handle pointer.

status_t FLEXIO_SPI_MasterTransferGetCountEDMA(FLEXIO_SPI_Type *base, flexio_spi_master_edma_handle_t *handle, size_t *count)

Gets the number of bytes transferred so far using FlexIO SPI master eDMA.

Parameters:
  • base – Pointer to FLEXIO_SPI_Type structure.

  • handle – FlexIO SPI eDMA handle pointer.

  • count – Number of bytes transferred so far by the non-blocking transaction.

static inline void FLEXIO_SPI_SlaveTransferCreateHandleEDMA(FLEXIO_SPI_Type *base, flexio_spi_slave_edma_handle_t *handle, flexio_spi_slave_edma_transfer_callback_t callback, void *userData, edma_handle_t *txHandle, edma_handle_t *rxHandle)

Initializes the FlexIO SPI slave eDMA handle.

This function initializes the FlexIO SPI slave eDMA handle.

Parameters:
  • base – Pointer to FLEXIO_SPI_Type structure.

  • handle – Pointer to flexio_spi_slave_edma_handle_t structure to store the transfer state.

  • callback – SPI callback, NULL means no callback.

  • userData – callback function parameter.

  • txHandle – User requested eDMA handle for FlexIO SPI TX eDMA transfer.

  • rxHandle – User requested eDMA handle for FlexIO SPI RX eDMA transfer.

status_t FLEXIO_SPI_SlaveTransferEDMA(FLEXIO_SPI_Type *base, flexio_spi_slave_edma_handle_t *handle, flexio_spi_transfer_t *xfer)

Performs a non-blocking FlexIO SPI transfer using eDMA.

Note

This interface returns immediately after transfer initiates. Call FLEXIO_SPI_SlaveGetTransferCountEDMA to poll the transfer status and check whether the FlexIO SPI transfer is finished.

Parameters:
  • base – Pointer to FLEXIO_SPI_Type structure.

  • handle – Pointer to flexio_spi_slave_edma_handle_t structure to store the transfer state.

  • xfer – Pointer to FlexIO SPI transfer structure.

Return values:
  • kStatus_Success – Successfully start a transfer.

  • kStatus_InvalidArgument – Input argument is invalid.

  • kStatus_FLEXIO_SPI_Busy – FlexIO SPI is not idle, is running another transfer.

static inline void FLEXIO_SPI_SlaveTransferAbortEDMA(FLEXIO_SPI_Type *base, flexio_spi_slave_edma_handle_t *handle)

Aborts a FlexIO SPI transfer using eDMA.

Parameters:
  • base – Pointer to FLEXIO_SPI_Type structure.

  • handle – Pointer to flexio_spi_slave_edma_handle_t structure to store the transfer state.

static inline status_t FLEXIO_SPI_SlaveTransferGetCountEDMA(FLEXIO_SPI_Type *base, flexio_spi_slave_edma_handle_t *handle, size_t *count)

Gets the number of bytes transferred so far using FlexIO SPI slave eDMA.

Parameters:
  • base – Pointer to FLEXIO_SPI_Type structure.

  • handle – FlexIO SPI eDMA handle pointer.

  • count – Number of bytes transferred so far by the non-blocking transaction.

FSL_FLEXIO_SPI_EDMA_DRIVER_VERSION

FlexIO SPI EDMA driver version.

typedef struct _flexio_spi_master_edma_handle flexio_spi_master_edma_handle_t

typedef for flexio_spi_master_edma_handle_t in advance.

typedef flexio_spi_master_edma_handle_t flexio_spi_slave_edma_handle_t

Slave handle is the same with master handle.

typedef void (*flexio_spi_master_edma_transfer_callback_t)(FLEXIO_SPI_Type *base, flexio_spi_master_edma_handle_t *handle, status_t status, void *userData)

FlexIO SPI master callback for finished transmit.

typedef void (*flexio_spi_slave_edma_transfer_callback_t)(FLEXIO_SPI_Type *base, flexio_spi_slave_edma_handle_t *handle, status_t status, void *userData)

FlexIO SPI slave callback for finished transmit.

struct _flexio_spi_master_edma_handle
#include <fsl_flexio_spi_edma.h>

FlexIO SPI eDMA transfer handle, users should not touch the content of the handle.

Public Members

size_t transferSize

Total bytes to be transferred.

uint8_t nbytes

eDMA minor byte transfer count initially configured.

bool txInProgress

Send transfer in progress

bool rxInProgress

Receive transfer in progress

edma_handle_t *txHandle

DMA handler for SPI send

edma_handle_t *rxHandle

DMA handler for SPI receive

flexio_spi_master_edma_transfer_callback_t callback

Callback for SPI DMA transfer

void *userData

User Data for SPI DMA callback

FlexIO eDMA UART Driver

status_t FLEXIO_UART_TransferCreateHandleEDMA(FLEXIO_UART_Type *base, flexio_uart_edma_handle_t *handle, flexio_uart_edma_transfer_callback_t callback, void *userData, edma_handle_t *txEdmaHandle, edma_handle_t *rxEdmaHandle)

Initializes the UART handle which is used in transactional functions.

Parameters:
  • base – Pointer to FLEXIO_UART_Type.

  • handle – Pointer to flexio_uart_edma_handle_t structure.

  • callback – The callback function.

  • userData – The parameter of the callback function.

  • rxEdmaHandle – User requested DMA handle for RX DMA transfer.

  • txEdmaHandle – User requested DMA handle for TX DMA transfer.

Return values:
  • kStatus_Success – Successfully create the handle.

  • kStatus_OutOfRange – The FlexIO SPI eDMA type/handle table out of range.

status_t FLEXIO_UART_TransferSendEDMA(FLEXIO_UART_Type *base, flexio_uart_edma_handle_t *handle, flexio_uart_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 out, the send callback function is called.

Parameters:
  • base – Pointer to FLEXIO_UART_Type

  • handle – UART handle pointer.

  • xfer – UART eDMA transfer structure, see flexio_uart_transfer_t.

Return values:
  • kStatus_Success – if succeed, others failed.

  • kStatus_FLEXIO_UART_TxBusy – Previous transfer on going.

status_t FLEXIO_UART_TransferReceiveEDMA(FLEXIO_UART_Type *base, flexio_uart_edma_handle_t *handle, flexio_uart_transfer_t *xfer)

Receives data using eDMA.

This function receives data using eDMA. This is a non-blocking function, which returns right away. When all data is received, the receive callback function is called.

Parameters:
  • base – Pointer to FLEXIO_UART_Type

  • handle – Pointer to flexio_uart_edma_handle_t structure

  • xfer – UART eDMA transfer structure, see flexio_uart_transfer_t.

Return values:
  • kStatus_Success – if succeed, others failed.

  • kStatus_UART_RxBusy – Previous transfer on going.

void FLEXIO_UART_TransferAbortSendEDMA(FLEXIO_UART_Type *base, flexio_uart_edma_handle_t *handle)

Aborts the sent data which using eDMA.

This function aborts sent data which using eDMA.

Parameters:
  • base – Pointer to FLEXIO_UART_Type

  • handle – Pointer to flexio_uart_edma_handle_t structure

void FLEXIO_UART_TransferAbortReceiveEDMA(FLEXIO_UART_Type *base, flexio_uart_edma_handle_t *handle)

Aborts the receive data which using eDMA.

This function aborts the receive data which using eDMA.

Parameters:
  • base – Pointer to FLEXIO_UART_Type

  • handle – Pointer to flexio_uart_edma_handle_t structure

status_t FLEXIO_UART_TransferGetSendCountEDMA(FLEXIO_UART_Type *base, flexio_uart_edma_handle_t *handle, size_t *count)

Gets the number of bytes sent out.

This function gets the number of bytes sent out.

Parameters:
  • base – Pointer to FLEXIO_UART_Type

  • handle – Pointer to flexio_uart_edma_handle_t structure

  • count – Number of bytes sent so far by the non-blocking transaction.

Return values:
  • kStatus_NoTransferInProgress – transfer has finished or no transfer in progress.

  • kStatus_Success – Successfully return the count.

status_t FLEXIO_UART_TransferGetReceiveCountEDMA(FLEXIO_UART_Type *base, flexio_uart_edma_handle_t *handle, size_t *count)

Gets the number of bytes received.

This function gets the number of bytes received.

Parameters:
  • base – Pointer to FLEXIO_UART_Type

  • handle – Pointer to flexio_uart_edma_handle_t structure

  • count – Number of bytes received so far by the non-blocking transaction.

Return values:
  • kStatus_NoTransferInProgress – transfer has finished or no transfer in progress.

  • kStatus_Success – Successfully return the count.

FSL_FLEXIO_UART_EDMA_DRIVER_VERSION

FlexIO UART EDMA driver version.

typedef struct _flexio_uart_edma_handle flexio_uart_edma_handle_t
typedef void (*flexio_uart_edma_transfer_callback_t)(FLEXIO_UART_Type *base, flexio_uart_edma_handle_t *handle, status_t status, void *userData)

UART transfer callback function.

struct _flexio_uart_edma_handle
#include <fsl_flexio_uart_edma.h>

UART eDMA handle.

Public Members

flexio_uart_edma_transfer_callback_t callback

Callback function.

void *userData

UART callback function parameter.

size_t txDataSizeAll

Total bytes to be sent.

size_t rxDataSizeAll

Total bytes to be received.

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

FlexIO I2C Master Driver

status_t FLEXIO_I2C_CheckForBusyBus(FLEXIO_I2C_Type *base)

Make sure the bus isn’t already pulled down.

Check the FLEXIO pin status to see whether either of SDA and SCL pin is pulled down.

Parameters:
  • base – Pointer to FLEXIO_I2C_Type structure..

Return values:
  • kStatus_Success

  • kStatus_FLEXIO_I2C_Busy

status_t FLEXIO_I2C_MasterInit(FLEXIO_I2C_Type *base, flexio_i2c_master_config_t *masterConfig, uint32_t srcClock_Hz)

Ungates the FlexIO clock, resets the FlexIO module, and configures the FlexIO I2C hardware configuration.

Example

FLEXIO_I2C_Type base = {
.flexioBase = FLEXIO,
.SDAPinIndex = 0,
.SCLPinIndex = 1,
.shifterIndex = {0,1},
.timerIndex = {0,1}
};
flexio_i2c_master_config_t config = {
.enableInDoze = false,
.enableInDebug = true,
.enableFastAccess = false,
.baudRate_Bps = 100000
};
FLEXIO_I2C_MasterInit(base, &config, srcClock_Hz);

Parameters:
  • base – Pointer to FLEXIO_I2C_Type structure.

  • masterConfig – Pointer to flexio_i2c_master_config_t structure.

  • srcClock_Hz – FlexIO source clock in Hz.

Return values:
  • kStatus_Success – Initialization successful

  • kStatus_InvalidArgument – The source clock exceed upper range limitation

void FLEXIO_I2C_MasterDeinit(FLEXIO_I2C_Type *base)

De-initializes the FlexIO I2C master peripheral. Calling this API Resets the FlexIO I2C master shifer and timer config, module can’t work unless the FLEXIO_I2C_MasterInit is called.

Parameters:
  • base – pointer to FLEXIO_I2C_Type structure.

void FLEXIO_I2C_MasterGetDefaultConfig(flexio_i2c_master_config_t *masterConfig)

Gets the default configuration to configure the FlexIO module. The configuration can be used directly for calling the FLEXIO_I2C_MasterInit().

Example:

flexio_i2c_master_config_t config;
FLEXIO_I2C_MasterGetDefaultConfig(&config);

Parameters:
  • masterConfig – Pointer to flexio_i2c_master_config_t structure.

static inline void FLEXIO_I2C_MasterEnable(FLEXIO_I2C_Type *base, bool enable)

Enables/disables the FlexIO module operation.

Parameters:
  • base – Pointer to FLEXIO_I2C_Type structure.

  • enable – Pass true to enable module, false does not have any effect.

uint32_t FLEXIO_I2C_MasterGetStatusFlags(FLEXIO_I2C_Type *base)

Gets the FlexIO I2C master status flags.

Parameters:
  • base – Pointer to FLEXIO_I2C_Type structure

Returns:

Status flag, use status flag to AND _flexio_i2c_master_status_flags can get the related status.

void FLEXIO_I2C_MasterClearStatusFlags(FLEXIO_I2C_Type *base, uint32_t mask)

Clears the FlexIO I2C master status flags.

Parameters:
  • base – Pointer to FLEXIO_I2C_Type structure.

  • mask – Status flag. The parameter can be any combination of the following values:

    • kFLEXIO_I2C_RxFullFlag

    • kFLEXIO_I2C_ReceiveNakFlag

void FLEXIO_I2C_MasterEnableInterrupts(FLEXIO_I2C_Type *base, uint32_t mask)

Enables the FlexIO i2c master interrupt requests.

Parameters:
  • base – Pointer to FLEXIO_I2C_Type structure.

  • mask – Interrupt source. Currently only one interrupt request source:

    • kFLEXIO_I2C_TransferCompleteInterruptEnable

void FLEXIO_I2C_MasterDisableInterrupts(FLEXIO_I2C_Type *base, uint32_t mask)

Disables the FlexIO I2C master interrupt requests.

Parameters:
  • base – Pointer to FLEXIO_I2C_Type structure.

  • mask – Interrupt source.

void FLEXIO_I2C_MasterSetBaudRate(FLEXIO_I2C_Type *base, uint32_t baudRate_Bps, uint32_t srcClock_Hz)

Sets the FlexIO I2C master transfer baudrate.

Parameters:
  • base – Pointer to FLEXIO_I2C_Type structure

  • baudRate_Bps – the baud rate value in HZ

  • srcClock_Hz – source clock in HZ

void FLEXIO_I2C_MasterStart(FLEXIO_I2C_Type *base, uint8_t address, flexio_i2c_direction_t direction)

Sends START + 7-bit address to the bus.

Note

This API should be called when the transfer configuration is ready to send a START signal and 7-bit address to the bus. This is a non-blocking API, which returns directly after the address is put into the data register but the address transfer is not finished on the bus. Ensure that the kFLEXIO_I2C_RxFullFlag status is asserted before calling this API.

Parameters:
  • base – Pointer to FLEXIO_I2C_Type structure.

  • address – 7-bit address.

  • direction – transfer direction. This parameter is one of the values in flexio_i2c_direction_t:

    • kFLEXIO_I2C_Write: Transmit

    • kFLEXIO_I2C_Read: Receive

void FLEXIO_I2C_MasterStop(FLEXIO_I2C_Type *base)

Sends the stop signal on the bus.

Parameters:
  • base – Pointer to FLEXIO_I2C_Type structure.

void FLEXIO_I2C_MasterRepeatedStart(FLEXIO_I2C_Type *base)

Sends the repeated start signal on the bus.

Parameters:
  • base – Pointer to FLEXIO_I2C_Type structure.

void FLEXIO_I2C_MasterAbortStop(FLEXIO_I2C_Type *base)

Sends the stop signal when transfer is still on-going.

Parameters:
  • base – Pointer to FLEXIO_I2C_Type structure.

void FLEXIO_I2C_MasterEnableAck(FLEXIO_I2C_Type *base, bool enable)

Configures the sent ACK/NAK for the following byte.

Parameters:
  • base – Pointer to FLEXIO_I2C_Type structure.

  • enable – True to configure send ACK, false configure to send NAK.

status_t FLEXIO_I2C_MasterSetTransferCount(FLEXIO_I2C_Type *base, uint16_t count)

Sets the number of bytes to be transferred from a start signal to a stop signal.

Note

Call this API before a transfer begins because the timer generates a number of clocks according to the number of bytes that need to be transferred.

Parameters:
  • base – Pointer to FLEXIO_I2C_Type structure.

  • count – Number of bytes need to be transferred from a start signal to a re-start/stop signal

Return values:
  • kStatus_Success – Successfully configured the count.

  • kStatus_InvalidArgument – Input argument is invalid.

static inline void FLEXIO_I2C_MasterWriteByte(FLEXIO_I2C_Type *base, uint32_t data)

Writes one byte of data to the I2C bus.

Note

This is a non-blocking API, which returns directly after the data is put into the data register but the data transfer is not finished on the bus. Ensure that the TxEmptyFlag is asserted before calling this API.

Parameters:
  • base – Pointer to FLEXIO_I2C_Type structure.

  • data – a byte of data.

static inline uint8_t FLEXIO_I2C_MasterReadByte(FLEXIO_I2C_Type *base)

Reads one byte of data from the I2C bus.

Note

This is a non-blocking API, which returns directly after the data is read from the data register. Ensure that the data is ready in the register.

Parameters:
  • base – Pointer to FLEXIO_I2C_Type structure.

Returns:

data byte read.

status_t FLEXIO_I2C_MasterWriteBlocking(FLEXIO_I2C_Type *base, const uint8_t *txBuff, uint8_t txSize)

Sends a buffer of data in bytes.

Note

This function blocks via polling until all bytes have been sent.

Parameters:
  • base – Pointer to FLEXIO_I2C_Type structure.

  • txBuff – The data bytes to send.

  • txSize – The number of data bytes to send.

Return values:
  • kStatus_Success – Successfully write data.

  • kStatus_FLEXIO_I2C_Nak – Receive NAK during writing data.

  • kStatus_FLEXIO_I2C_Timeout – Timeout polling status flags.

status_t FLEXIO_I2C_MasterReadBlocking(FLEXIO_I2C_Type *base, uint8_t *rxBuff, uint8_t rxSize)

Receives a buffer of bytes.

Note

This function blocks via polling until all bytes have been received.

Parameters:
  • base – Pointer to FLEXIO_I2C_Type structure.

  • rxBuff – The buffer to store the received bytes.

  • rxSize – The number of data bytes to be received.

Return values:
  • kStatus_Success – Successfully read data.

  • kStatus_FLEXIO_I2C_Timeout – Timeout polling status flags.

status_t FLEXIO_I2C_MasterTransferBlocking(FLEXIO_I2C_Type *base, flexio_i2c_master_transfer_t *xfer)

Performs a master polling transfer on the I2C bus.

Note

The API does not return until the transfer succeeds or fails due to receiving NAK.

Parameters:
  • base – pointer to FLEXIO_I2C_Type structure.

  • xfer – pointer to flexio_i2c_master_transfer_t structure.

Returns:

status of status_t.

status_t FLEXIO_I2C_MasterTransferCreateHandle(FLEXIO_I2C_Type *base, flexio_i2c_master_handle_t *handle, flexio_i2c_master_transfer_callback_t callback, void *userData)

Initializes the I2C handle which is used in transactional functions.

Parameters:
  • base – Pointer to FLEXIO_I2C_Type structure.

  • handle – Pointer to flexio_i2c_master_handle_t structure to store the transfer state.

  • callback – Pointer to user callback function.

  • userData – User param passed to the callback function.

Return values:
  • kStatus_Success – Successfully create the handle.

  • kStatus_OutOfRange – The FlexIO type/handle/isr table out of range.

status_t FLEXIO_I2C_MasterTransferNonBlocking(FLEXIO_I2C_Type *base, flexio_i2c_master_handle_t *handle, flexio_i2c_master_transfer_t *xfer)

Performs a master interrupt non-blocking transfer on the I2C bus.

Note

The API returns immediately after the transfer initiates. Call FLEXIO_I2C_MasterTransferGetCount to poll the transfer status to check whether the transfer is finished. If the return status is not kStatus_FLEXIO_I2C_Busy, the transfer is finished.

Parameters:
  • base – Pointer to FLEXIO_I2C_Type structure

  • handle – Pointer to flexio_i2c_master_handle_t structure which stores the transfer state

  • xfer – pointer to flexio_i2c_master_transfer_t structure

Return values:
  • kStatus_Success – Successfully start a transfer.

  • kStatus_FLEXIO_I2C_Busy – FlexIO I2C is not idle, is running another transfer.

status_t FLEXIO_I2C_MasterTransferGetCount(FLEXIO_I2C_Type *base, flexio_i2c_master_handle_t *handle, size_t *count)

Gets the master transfer status during a interrupt non-blocking transfer.

Parameters:
  • base – Pointer to FLEXIO_I2C_Type structure.

  • handle – Pointer to flexio_i2c_master_handle_t structure which stores the transfer state.

  • count – Number of bytes transferred so far by the non-blocking transaction.

Return values:
  • kStatus_InvalidArgument – count is Invalid.

  • kStatus_NoTransferInProgress – There is not a non-blocking transaction currently in progress.

  • kStatus_Success – Successfully return the count.

void FLEXIO_I2C_MasterTransferAbort(FLEXIO_I2C_Type *base, flexio_i2c_master_handle_t *handle)

Aborts an interrupt non-blocking transfer early.

Note

This API can be called at any time when an interrupt non-blocking transfer initiates to abort the transfer early.

Parameters:
  • base – Pointer to FLEXIO_I2C_Type structure

  • handle – Pointer to flexio_i2c_master_handle_t structure which stores the transfer state

void FLEXIO_I2C_MasterTransferHandleIRQ(void *i2cType, void *i2cHandle)

Master interrupt handler.

Parameters:
  • i2cType – Pointer to FLEXIO_I2C_Type structure

  • i2cHandle – Pointer to flexio_i2c_master_transfer_t structure

FSL_FLEXIO_I2C_MASTER_DRIVER_VERSION

FlexIO I2C transfer status.

Values:

enumerator kStatus_FLEXIO_I2C_Busy

I2C is busy doing transfer.

enumerator kStatus_FLEXIO_I2C_Idle

I2C is busy doing transfer.

enumerator kStatus_FLEXIO_I2C_Nak

NAK received during transfer.

enumerator kStatus_FLEXIO_I2C_Timeout

Timeout polling status flags.

enum _flexio_i2c_master_interrupt

Define FlexIO I2C master interrupt mask.

Values:

enumerator kFLEXIO_I2C_TxEmptyInterruptEnable

Tx buffer empty interrupt enable.

enumerator kFLEXIO_I2C_RxFullInterruptEnable

Rx buffer full interrupt enable.

enum _flexio_i2c_master_status_flags

Define FlexIO I2C master status mask.

Values:

enumerator kFLEXIO_I2C_TxEmptyFlag

Tx shifter empty flag.

enumerator kFLEXIO_I2C_RxFullFlag

Rx shifter full/Transfer complete flag.

enumerator kFLEXIO_I2C_ReceiveNakFlag

Receive NAK flag.

enum _flexio_i2c_direction

Direction of master transfer.

Values:

enumerator kFLEXIO_I2C_Write

Master send to slave.

enumerator kFLEXIO_I2C_Read

Master receive from slave.

typedef enum _flexio_i2c_direction flexio_i2c_direction_t

Direction of master transfer.

typedef struct _flexio_i2c_type FLEXIO_I2C_Type

Define FlexIO I2C master access structure typedef.

typedef struct _flexio_i2c_master_config flexio_i2c_master_config_t

Define FlexIO I2C master user configuration structure.

typedef struct _flexio_i2c_master_transfer flexio_i2c_master_transfer_t

Define FlexIO I2C master transfer structure.

typedef struct _flexio_i2c_master_handle flexio_i2c_master_handle_t

FlexIO I2C master handle typedef.

typedef void (*flexio_i2c_master_transfer_callback_t)(FLEXIO_I2C_Type *base, flexio_i2c_master_handle_t *handle, status_t status, void *userData)

FlexIO I2C master transfer callback typedef.

I2C_RETRY_TIMES

Retry times for waiting flag.

struct _flexio_i2c_type
#include <fsl_flexio_i2c_master.h>

Define FlexIO I2C master access structure typedef.

Public Members

FLEXIO_Type *flexioBase

FlexIO base pointer.

uint8_t SDAPinIndex

Pin select for I2C SDA.

uint8_t SCLPinIndex

Pin select for I2C SCL.

uint8_t shifterIndex[2]

Shifter index used in FlexIO I2C.

uint8_t timerIndex[3]

Timer index used in FlexIO I2C.

uint32_t baudrate

Master transfer baudrate, used to calculate delay time.

struct _flexio_i2c_master_config
#include <fsl_flexio_i2c_master.h>

Define FlexIO I2C master user configuration structure.

Public Members

bool enableMaster

Enables the FlexIO I2C peripheral at initialization time.

bool enableInDoze

Enable/disable FlexIO operation in doze mode.

bool enableInDebug

Enable/disable FlexIO operation in debug mode.

bool enableFastAccess

Enable/disable fast access to FlexIO registers, fast access requires the FlexIO clock to be at least twice the frequency of the bus clock.

uint32_t baudRate_Bps

Baud rate in Bps.

struct _flexio_i2c_master_transfer
#include <fsl_flexio_i2c_master.h>

Define FlexIO I2C master transfer structure.

Public Members

uint32_t flags

Transfer flag which controls the transfer, reserved for FlexIO I2C.

uint8_t slaveAddress

7-bit slave address.

flexio_i2c_direction_t direction

Transfer direction, read or write.

uint32_t subaddress

Sub address. Transferred MSB first.

uint8_t subaddressSize

Size of command buffer.

uint8_t volatile *data

Transfer buffer.

volatile size_t dataSize

Transfer size.

struct _flexio_i2c_master_handle
#include <fsl_flexio_i2c_master.h>

Define FlexIO I2C master handle structure.

Public Members

flexio_i2c_master_transfer_t transfer

FlexIO I2C master transfer copy.

size_t transferSize

Total bytes to be transferred.

uint8_t state

Transfer state maintained during transfer.

flexio_i2c_master_transfer_callback_t completionCallback

Callback function called at transfer event. Callback function called at transfer event.

void *userData

Callback parameter passed to callback function.

bool needRestart

Whether master needs to send re-start signal.

FlexIO I2S Driver

void FLEXIO_I2S_Init(FLEXIO_I2S_Type *base, const flexio_i2s_config_t *config)

Initializes the FlexIO I2S.

This API configures FlexIO pins and shifter to I2S and configures the FlexIO I2S with a configuration structure. The configuration structure can be filled by the user, or be set with default values by FLEXIO_I2S_GetDefaultConfig().

Note

This API should be called at the beginning of the application to use the FlexIO I2S driver. Otherwise, any access to the FlexIO I2S module can cause hard fault because the clock is not enabled.

Parameters:
  • base – FlexIO I2S base pointer

  • config – FlexIO I2S configure structure.

void FLEXIO_I2S_GetDefaultConfig(flexio_i2s_config_t *config)

Sets the FlexIO I2S configuration structure to default values.

The purpose of this API is to get the configuration structure initialized for use in FLEXIO_I2S_Init(). Users may use the initialized structure unchanged in FLEXIO_I2S_Init() or modify some fields of the structure before calling FLEXIO_I2S_Init().

Parameters:
  • config – pointer to master configuration structure

void FLEXIO_I2S_Deinit(FLEXIO_I2S_Type *base)

De-initializes the FlexIO I2S.

Calling this API resets the FlexIO I2S shifter and timer config. After calling this API, call the FLEXO_I2S_Init to use the FlexIO I2S module.

Parameters:
  • base – FlexIO I2S base pointer

static inline void FLEXIO_I2S_Enable(FLEXIO_I2S_Type *base, bool enable)

Enables/disables the FlexIO I2S module operation.

Parameters:
  • base – Pointer to FLEXIO_I2S_Type

  • enable – True to enable, false dose not have any effect.

uint32_t FLEXIO_I2S_GetStatusFlags(FLEXIO_I2S_Type *base)

Gets the FlexIO I2S status flags.

Parameters:
  • base – Pointer to FLEXIO_I2S_Type structure

Returns:

Status flag, which are ORed by the enumerators in the _flexio_i2s_status_flags.

void FLEXIO_I2S_EnableInterrupts(FLEXIO_I2S_Type *base, uint32_t mask)

Enables the FlexIO I2S interrupt.

This function enables the FlexIO UART interrupt.

Parameters:
  • base – Pointer to FLEXIO_I2S_Type structure

  • mask – interrupt source

void FLEXIO_I2S_DisableInterrupts(FLEXIO_I2S_Type *base, uint32_t mask)

Disables the FlexIO I2S interrupt.

This function enables the FlexIO UART interrupt.

Parameters:
  • base – pointer to FLEXIO_I2S_Type structure

  • mask – interrupt source

static inline void FLEXIO_I2S_TxEnableDMA(FLEXIO_I2S_Type *base, bool enable)

Enables/disables the FlexIO I2S Tx DMA requests.

Parameters:
  • base – FlexIO I2S base pointer

  • enable – True means enable DMA, false means disable DMA.

static inline void FLEXIO_I2S_RxEnableDMA(FLEXIO_I2S_Type *base, bool enable)

Enables/disables the FlexIO I2S Rx DMA requests.

Parameters:
  • base – FlexIO I2S base pointer

  • enable – True means enable DMA, false means disable DMA.

static inline uint32_t FLEXIO_I2S_TxGetDataRegisterAddress(FLEXIO_I2S_Type *base)

Gets the FlexIO I2S send data register address.

This function returns the I2S data register address, mainly used by DMA/eDMA.

Parameters:
  • base – Pointer to FLEXIO_I2S_Type structure

Returns:

FlexIO i2s send data register address.

static inline uint32_t FLEXIO_I2S_RxGetDataRegisterAddress(FLEXIO_I2S_Type *base)

Gets the FlexIO I2S receive data register address.

This function returns the I2S data register address, mainly used by DMA/eDMA.

Parameters:
  • base – Pointer to FLEXIO_I2S_Type structure

Returns:

FlexIO i2s receive data register address.

void FLEXIO_I2S_MasterSetFormat(FLEXIO_I2S_Type *base, flexio_i2s_format_t *format, uint32_t srcClock_Hz)

Configures the FlexIO I2S audio format in master mode.

Audio format can be changed in run-time of FlexIO I2S. This function configures the sample rate and audio data format to be transferred.

Parameters:
  • base – Pointer to FLEXIO_I2S_Type structure

  • format – Pointer to FlexIO I2S audio data format structure.

  • srcClock_Hz – I2S master clock source frequency in Hz.

void FLEXIO_I2S_SlaveSetFormat(FLEXIO_I2S_Type *base, flexio_i2s_format_t *format)

Configures the FlexIO I2S audio format in slave mode.

Audio format can be changed in run-time of FlexIO I2S. This function configures the sample rate and audio data format to be transferred.

Parameters:
  • base – Pointer to FLEXIO_I2S_Type structure

  • format – Pointer to FlexIO I2S audio data format structure.

status_t FLEXIO_I2S_WriteBlocking(FLEXIO_I2S_Type *base, uint8_t bitWidth, uint8_t *txData, size_t size)

Sends data using a blocking method.

Note

This function blocks via polling until data is ready to be sent.

Parameters:
  • base – FlexIO I2S base pointer.

  • bitWidth – How many bits in a audio word, usually 8/16/24/32 bits.

  • txData – Pointer to the data to be written.

  • size – Bytes to be written.

Return values:
  • kStatus_Success – Successfully write data.

  • kStatus_FLEXIO_I2C_Timeout – Timeout polling status flags.

static inline void FLEXIO_I2S_WriteData(FLEXIO_I2S_Type *base, uint8_t bitWidth, uint32_t data)

Writes data into a data register.

Parameters:
  • base – FlexIO I2S base pointer.

  • bitWidth – How many bits in a audio word, usually 8/16/24/32 bits.

  • data – Data to be written.

status_t FLEXIO_I2S_ReadBlocking(FLEXIO_I2S_Type *base, uint8_t bitWidth, uint8_t *rxData, size_t size)

Receives a piece of data using a blocking method.

Note

This function blocks via polling until data is ready to be sent.

Parameters:
  • base – FlexIO I2S base pointer

  • bitWidth – How many bits in a audio word, usually 8/16/24/32 bits.

  • rxData – Pointer to the data to be read.

  • size – Bytes to be read.

Return values:
  • kStatus_Success – Successfully read data.

  • kStatus_FLEXIO_I2C_Timeout – Timeout polling status flags.

static inline uint32_t FLEXIO_I2S_ReadData(FLEXIO_I2S_Type *base)

Reads a data from the data register.

Parameters:
  • base – FlexIO I2S base pointer

Returns:

Data read from data register.

void FLEXIO_I2S_TransferTxCreateHandle(FLEXIO_I2S_Type *base, flexio_i2s_handle_t *handle, flexio_i2s_callback_t callback, void *userData)

Initializes the FlexIO I2S handle.

This function initializes the FlexIO I2S handle which can be used for other FlexIO I2S transactional APIs. Call this API once to get the initialized handle.

Parameters:
  • base – Pointer to FLEXIO_I2S_Type structure

  • handle – Pointer to flexio_i2s_handle_t structure to store the transfer state.

  • callback – FlexIO I2S callback function, which is called while finished a block.

  • userData – User parameter for the FlexIO I2S callback.

void FLEXIO_I2S_TransferSetFormat(FLEXIO_I2S_Type *base, flexio_i2s_handle_t *handle, flexio_i2s_format_t *format, uint32_t srcClock_Hz)

Configures the FlexIO I2S audio format.

Audio format can be changed at run-time of FlexIO I2S. This function configures the sample rate and audio data format to be transferred.

Parameters:
  • base – Pointer to FLEXIO_I2S_Type structure.

  • handle – FlexIO I2S handle pointer.

  • format – Pointer to audio data format structure.

  • srcClock_Hz – FlexIO I2S bit clock source frequency in Hz. This parameter should be 0 while in slave mode.

void FLEXIO_I2S_TransferRxCreateHandle(FLEXIO_I2S_Type *base, flexio_i2s_handle_t *handle, flexio_i2s_callback_t callback, void *userData)

Initializes the FlexIO I2S receive handle.

This function initializes the FlexIO I2S handle which can be used for other FlexIO I2S transactional APIs. Call this API once to get the initialized handle.

Parameters:
  • base – Pointer to FLEXIO_I2S_Type structure.

  • handle – Pointer to flexio_i2s_handle_t structure to store the transfer state.

  • callback – FlexIO I2S callback function, which is called while finished a block.

  • userData – User parameter for the FlexIO I2S callback.

status_t FLEXIO_I2S_TransferSendNonBlocking(FLEXIO_I2S_Type *base, flexio_i2s_handle_t *handle, flexio_i2s_transfer_t *xfer)

Performs an interrupt non-blocking send transfer on FlexIO I2S.

Note

The API returns immediately after transfer initiates. Call FLEXIO_I2S_GetRemainingBytes to poll the transfer status and check whether the transfer is finished. If the return status is 0, the transfer is finished.

Parameters:
  • base – Pointer to FLEXIO_I2S_Type structure.

  • handle – Pointer to flexio_i2s_handle_t structure which stores the transfer state

  • xfer – Pointer to flexio_i2s_transfer_t structure

Return values:
  • kStatus_Success – Successfully start the data transmission.

  • kStatus_FLEXIO_I2S_TxBusy – Previous transmission still not finished, data not all written to TX register yet.

  • kStatus_InvalidArgument – The input parameter is invalid.

status_t FLEXIO_I2S_TransferReceiveNonBlocking(FLEXIO_I2S_Type *base, flexio_i2s_handle_t *handle, flexio_i2s_transfer_t *xfer)

Performs an interrupt non-blocking receive transfer on FlexIO I2S.

Note

The API returns immediately after transfer initiates. Call FLEXIO_I2S_GetRemainingBytes to poll the transfer status to check whether the transfer is finished. If the return status is 0, the transfer is finished.

Parameters:
  • base – Pointer to FLEXIO_I2S_Type structure.

  • handle – Pointer to flexio_i2s_handle_t structure which stores the transfer state

  • xfer – Pointer to flexio_i2s_transfer_t structure

Return values:
  • kStatus_Success – Successfully start the data receive.

  • kStatus_FLEXIO_I2S_RxBusy – Previous receive still not finished.

  • kStatus_InvalidArgument – The input parameter is invalid.

void FLEXIO_I2S_TransferAbortSend(FLEXIO_I2S_Type *base, flexio_i2s_handle_t *handle)

Aborts the current send.

Note

This API can be called at any time when interrupt non-blocking transfer initiates to abort the transfer in a early time.

Parameters:
  • base – Pointer to FLEXIO_I2S_Type structure.

  • handle – Pointer to flexio_i2s_handle_t structure which stores the transfer state

void FLEXIO_I2S_TransferAbortReceive(FLEXIO_I2S_Type *base, flexio_i2s_handle_t *handle)

Aborts the current receive.

Note

This API can be called at any time when interrupt non-blocking transfer initiates to abort the transfer in a early time.

Parameters:
  • base – Pointer to FLEXIO_I2S_Type structure.

  • handle – Pointer to flexio_i2s_handle_t structure which stores the transfer state

status_t FLEXIO_I2S_TransferGetSendCount(FLEXIO_I2S_Type *base, flexio_i2s_handle_t *handle, size_t *count)

Gets the remaining bytes to be sent.

Parameters:
  • base – Pointer to FLEXIO_I2S_Type structure.

  • handle – Pointer to flexio_i2s_handle_t structure which stores the transfer state

  • count – Bytes sent.

Return values:
  • kStatus_Success – Succeed get the transfer count.

  • kStatus_NoTransferInProgress – There is not a non-blocking transaction currently in progress.

status_t FLEXIO_I2S_TransferGetReceiveCount(FLEXIO_I2S_Type *base, flexio_i2s_handle_t *handle, size_t *count)

Gets the remaining bytes to be received.

Parameters:
  • base – Pointer to FLEXIO_I2S_Type structure.

  • handle – Pointer to flexio_i2s_handle_t structure which stores the transfer state

  • count – Bytes recieved.

Return values:
  • kStatus_Success – Succeed get the transfer count.

  • kStatus_NoTransferInProgress – There is not a non-blocking transaction currently in progress.

Returns:

count Bytes received.

void FLEXIO_I2S_TransferTxHandleIRQ(void *i2sBase, void *i2sHandle)

Tx interrupt handler.

Parameters:
  • i2sBase – Pointer to FLEXIO_I2S_Type structure.

  • i2sHandle – Pointer to flexio_i2s_handle_t structure

void FLEXIO_I2S_TransferRxHandleIRQ(void *i2sBase, void *i2sHandle)

Rx interrupt handler.

Parameters:
  • i2sBase – Pointer to FLEXIO_I2S_Type structure.

  • i2sHandle – Pointer to flexio_i2s_handle_t structure.

FSL_FLEXIO_I2S_DRIVER_VERSION

FlexIO I2S driver version 2.2.0.

FlexIO I2S transfer status.

Values:

enumerator kStatus_FLEXIO_I2S_Idle

FlexIO I2S is in idle state

enumerator kStatus_FLEXIO_I2S_TxBusy

FlexIO I2S Tx is busy

enumerator kStatus_FLEXIO_I2S_RxBusy

FlexIO I2S Tx is busy

enumerator kStatus_FLEXIO_I2S_Error

FlexIO I2S error occurred

enumerator kStatus_FLEXIO_I2S_QueueFull

FlexIO I2S transfer queue is full.

enumerator kStatus_FLEXIO_I2S_Timeout

FlexIO I2S timeout polling status flags.

enum _flexio_i2s_master_slave

Master or slave mode.

Values:

enumerator kFLEXIO_I2S_Master

Master mode

enumerator kFLEXIO_I2S_Slave

Slave mode

_flexio_i2s_interrupt_enable Define FlexIO FlexIO I2S interrupt mask.

Values:

enumerator kFLEXIO_I2S_TxDataRegEmptyInterruptEnable

Transmit buffer empty interrupt enable.

enumerator kFLEXIO_I2S_RxDataRegFullInterruptEnable

Receive buffer full interrupt enable.

_flexio_i2s_status_flags Define FlexIO FlexIO I2S status mask.

Values:

enumerator kFLEXIO_I2S_TxDataRegEmptyFlag

Transmit buffer empty flag.

enumerator kFLEXIO_I2S_RxDataRegFullFlag

Receive buffer full flag.

enum _flexio_i2s_sample_rate

Audio sample rate.

Values:

enumerator kFLEXIO_I2S_SampleRate8KHz

Sample rate 8000Hz

enumerator kFLEXIO_I2S_SampleRate11025Hz

Sample rate 11025Hz

enumerator kFLEXIO_I2S_SampleRate12KHz

Sample rate 12000Hz

enumerator kFLEXIO_I2S_SampleRate16KHz

Sample rate 16000Hz

enumerator kFLEXIO_I2S_SampleRate22050Hz

Sample rate 22050Hz

enumerator kFLEXIO_I2S_SampleRate24KHz

Sample rate 24000Hz

enumerator kFLEXIO_I2S_SampleRate32KHz

Sample rate 32000Hz

enumerator kFLEXIO_I2S_SampleRate44100Hz

Sample rate 44100Hz

enumerator kFLEXIO_I2S_SampleRate48KHz

Sample rate 48000Hz

enumerator kFLEXIO_I2S_SampleRate96KHz

Sample rate 96000Hz

enum _flexio_i2s_word_width

Audio word width.

Values:

enumerator kFLEXIO_I2S_WordWidth8bits

Audio data width 8 bits

enumerator kFLEXIO_I2S_WordWidth16bits

Audio data width 16 bits

enumerator kFLEXIO_I2S_WordWidth24bits

Audio data width 24 bits

enumerator kFLEXIO_I2S_WordWidth32bits

Audio data width 32 bits

typedef struct _flexio_i2s_type FLEXIO_I2S_Type

Define FlexIO I2S access structure typedef.

typedef enum _flexio_i2s_master_slave flexio_i2s_master_slave_t

Master or slave mode.

typedef struct _flexio_i2s_config flexio_i2s_config_t

FlexIO I2S configure structure.

typedef struct _flexio_i2s_format flexio_i2s_format_t

FlexIO I2S audio format, FlexIO I2S only support the same format in Tx and Rx.

typedef enum _flexio_i2s_sample_rate flexio_i2s_sample_rate_t

Audio sample rate.

typedef enum _flexio_i2s_word_width flexio_i2s_word_width_t

Audio word width.

typedef struct _flexio_i2s_transfer flexio_i2s_transfer_t

Define FlexIO I2S transfer structure.

typedef struct _flexio_i2s_handle flexio_i2s_handle_t
typedef void (*flexio_i2s_callback_t)(FLEXIO_I2S_Type *base, flexio_i2s_handle_t *handle, status_t status, void *userData)

FlexIO I2S xfer callback prototype.

I2S_RETRY_TIMES

Retry times for waiting flag.

FLEXIO_I2S_XFER_QUEUE_SIZE

FlexIO I2S transfer queue size, user can refine it according to use case.

struct _flexio_i2s_type
#include <fsl_flexio_i2s.h>

Define FlexIO I2S access structure typedef.

Public Members

FLEXIO_Type *flexioBase

FlexIO base pointer

uint8_t txPinIndex

Tx data pin index in FlexIO pins

uint8_t rxPinIndex

Rx data pin index

uint8_t bclkPinIndex

Bit clock pin index

uint8_t fsPinIndex

Frame sync pin index

uint8_t txShifterIndex

Tx data shifter index

uint8_t rxShifterIndex

Rx data shifter index

uint8_t bclkTimerIndex

Bit clock timer index

uint8_t fsTimerIndex

Frame sync timer index

struct _flexio_i2s_config
#include <fsl_flexio_i2s.h>

FlexIO I2S configure structure.

Public Members

bool enableI2S

Enable FlexIO I2S

flexio_i2s_master_slave_t masterSlave

Master or slave

flexio_pin_polarity_t txPinPolarity

Tx data pin polarity, active high or low

flexio_pin_polarity_t rxPinPolarity

Rx data pin polarity

flexio_pin_polarity_t bclkPinPolarity

Bit clock pin polarity

flexio_pin_polarity_t fsPinPolarity

Frame sync pin polarity

flexio_shifter_timer_polarity_t txTimerPolarity

Tx data valid on bclk rising or falling edge

flexio_shifter_timer_polarity_t rxTimerPolarity

Rx data valid on bclk rising or falling edge

struct _flexio_i2s_format
#include <fsl_flexio_i2s.h>

FlexIO I2S audio format, FlexIO I2S only support the same format in Tx and Rx.

Public Members

uint8_t bitWidth

Bit width of audio data, always 8/16/24/32 bits

uint32_t sampleRate_Hz

Sample rate of the audio data

struct _flexio_i2s_transfer
#include <fsl_flexio_i2s.h>

Define FlexIO I2S transfer structure.

Public Members

uint8_t *data

Data buffer start pointer

size_t dataSize

Bytes to be transferred.

struct _flexio_i2s_handle
#include <fsl_flexio_i2s.h>

Define FlexIO I2S handle structure.

Public Members

uint32_t state

Internal state

flexio_i2s_callback_t callback

Callback function called at transfer event

void *userData

Callback parameter passed to callback function

uint8_t bitWidth

Bit width for transfer, 8/16/24/32bits

flexio_i2s_transfer_t queue[(4U)]

Transfer queue storing queued transfer

size_t transferSize[(4U)]

Data bytes need to transfer

volatile uint8_t queueUser

Index for user to queue transfer

volatile uint8_t queueDriver

Index for driver to get the transfer data and size

FlexIO SPI Driver

void FLEXIO_SPI_MasterInit(FLEXIO_SPI_Type *base, flexio_spi_master_config_t *masterConfig, uint32_t srcClock_Hz)

Ungates the FlexIO clock, resets the FlexIO module, configures the FlexIO SPI master hardware, and configures the FlexIO SPI with FlexIO SPI master configuration. The configuration structure can be filled by the user, or be set with default values by the FLEXIO_SPI_MasterGetDefaultConfig().

Example

FLEXIO_SPI_Type spiDev = {
.flexioBase = FLEXIO,
.SDOPinIndex = 0,
.SDIPinIndex = 1,
.SCKPinIndex = 2,
.CSnPinIndex = 3,
.shifterIndex = {0,1},
.timerIndex = {0,1}
};
flexio_spi_master_config_t config = {
.enableMaster = true,
.enableInDoze = false,
.enableInDebug = true,
.enableFastAccess = false,
.baudRate_Bps = 500000,
.phase = kFLEXIO_SPI_ClockPhaseFirstEdge,
.direction = kFLEXIO_SPI_MsbFirst,
.dataMode = kFLEXIO_SPI_8BitMode
};
FLEXIO_SPI_MasterInit(&spiDev, &config, srcClock_Hz);

Note

1.FlexIO SPI master only support CPOL = 0, which means clock inactive low. 2.For FlexIO SPI master, the input valid time is 1.5 clock cycles, for slave the output valid time is 2.5 clock cycles. So if FlexIO SPI master communicates with other spi IPs, the maximum baud rate is FlexIO clock frequency divided by 2*2=4. If FlexIO SPI master communicates with FlexIO SPI slave, the maximum baud rate is FlexIO clock frequency divided by (1.5+2.5)*2=8.

Parameters:
  • base – Pointer to the FLEXIO_SPI_Type structure.

  • masterConfig – Pointer to the flexio_spi_master_config_t structure.

  • srcClock_Hz – FlexIO source clock in Hz.

void FLEXIO_SPI_MasterDeinit(FLEXIO_SPI_Type *base)

Resets the FlexIO SPI timer and shifter config.

Parameters:
  • base – Pointer to the FLEXIO_SPI_Type.

void FLEXIO_SPI_MasterGetDefaultConfig(flexio_spi_master_config_t *masterConfig)

Gets the default configuration to configure the FlexIO SPI master. The configuration can be used directly by calling the FLEXIO_SPI_MasterConfigure(). Example:

flexio_spi_master_config_t masterConfig;
FLEXIO_SPI_MasterGetDefaultConfig(&masterConfig);

Parameters:
  • masterConfig – Pointer to the flexio_spi_master_config_t structure.

void FLEXIO_SPI_SlaveInit(FLEXIO_SPI_Type *base, flexio_spi_slave_config_t *slaveConfig)

Ungates the FlexIO clock, resets the FlexIO module, configures the FlexIO SPI slave hardware configuration, and configures the FlexIO SPI with FlexIO SPI slave configuration. The configuration structure can be filled by the user, or be set with default values by the FLEXIO_SPI_SlaveGetDefaultConfig().

Note

1.Only one timer is needed in the FlexIO SPI slave. As a result, the second timer index is ignored. 2.FlexIO SPI slave only support CPOL = 0, which means clock inactive low. 3.For FlexIO SPI master, the input valid time is 1.5 clock cycles, for slave the output valid time is 2.5 clock cycles. So if FlexIO SPI slave communicates with other spi IPs, the maximum baud rate is FlexIO clock frequency divided by 3*2=6. If FlexIO SPI slave communicates with FlexIO SPI master, the maximum baud rate is FlexIO clock frequency divided by (1.5+2.5)*2=8. Example

FLEXIO_SPI_Type spiDev = {
.flexioBase = FLEXIO,
.SDOPinIndex = 0,
.SDIPinIndex = 1,
.SCKPinIndex = 2,
.CSnPinIndex = 3,
.shifterIndex = {0,1},
.timerIndex = {0}
};
flexio_spi_slave_config_t config = {
.enableSlave = true,
.enableInDoze = false,
.enableInDebug = true,
.enableFastAccess = false,
.phase = kFLEXIO_SPI_ClockPhaseFirstEdge,
.direction = kFLEXIO_SPI_MsbFirst,
.dataMode = kFLEXIO_SPI_8BitMode
};
FLEXIO_SPI_SlaveInit(&spiDev, &config);

Parameters:
  • base – Pointer to the FLEXIO_SPI_Type structure.

  • slaveConfig – Pointer to the flexio_spi_slave_config_t structure.

void FLEXIO_SPI_SlaveDeinit(FLEXIO_SPI_Type *base)

Gates the FlexIO clock.

Parameters:
  • base – Pointer to the FLEXIO_SPI_Type.

void FLEXIO_SPI_SlaveGetDefaultConfig(flexio_spi_slave_config_t *slaveConfig)

Gets the default configuration to configure the FlexIO SPI slave. The configuration can be used directly for calling the FLEXIO_SPI_SlaveConfigure(). Example:

flexio_spi_slave_config_t slaveConfig;
FLEXIO_SPI_SlaveGetDefaultConfig(&slaveConfig);

Parameters:
  • slaveConfig – Pointer to the flexio_spi_slave_config_t structure.

uint32_t FLEXIO_SPI_GetStatusFlags(FLEXIO_SPI_Type *base)

Gets FlexIO SPI status flags.

Parameters:
  • base – Pointer to the FLEXIO_SPI_Type structure.

Returns:

status flag; Use the status flag to AND the following flag mask and get the status.

  • kFLEXIO_SPI_TxEmptyFlag

  • kFLEXIO_SPI_RxEmptyFlag

void FLEXIO_SPI_ClearStatusFlags(FLEXIO_SPI_Type *base, uint32_t mask)

Clears FlexIO SPI status flags.

Parameters:
  • base – Pointer to the FLEXIO_SPI_Type structure.

  • mask – status flag The parameter can be any combination of the following values:

    • kFLEXIO_SPI_TxEmptyFlag

    • kFLEXIO_SPI_RxEmptyFlag

void FLEXIO_SPI_EnableInterrupts(FLEXIO_SPI_Type *base, uint32_t mask)

Enables the FlexIO SPI interrupt.

This function enables the FlexIO SPI interrupt.

Parameters:
  • base – Pointer to the FLEXIO_SPI_Type structure.

  • mask – interrupt source. The parameter can be any combination of the following values:

    • kFLEXIO_SPI_RxFullInterruptEnable

    • kFLEXIO_SPI_TxEmptyInterruptEnable

void FLEXIO_SPI_DisableInterrupts(FLEXIO_SPI_Type *base, uint32_t mask)

Disables the FlexIO SPI interrupt.

This function disables the FlexIO SPI interrupt.

Parameters:
  • base – Pointer to the FLEXIO_SPI_Type structure.

  • mask – interrupt source The parameter can be any combination of the following values:

    • kFLEXIO_SPI_RxFullInterruptEnable

    • kFLEXIO_SPI_TxEmptyInterruptEnable

void FLEXIO_SPI_EnableDMA(FLEXIO_SPI_Type *base, uint32_t mask, bool enable)

Enables/disables the FlexIO SPI transmit DMA. This function enables/disables the FlexIO SPI Tx DMA, which means that asserting the kFLEXIO_SPI_TxEmptyFlag does/doesn’t trigger the DMA request.

Parameters:
  • base – Pointer to the FLEXIO_SPI_Type structure.

  • mask – SPI DMA source.

  • enable – True means enable DMA, false means disable DMA.

static inline uint32_t FLEXIO_SPI_GetTxDataRegisterAddress(FLEXIO_SPI_Type *base, flexio_spi_shift_direction_t direction)

Gets the FlexIO SPI transmit data register address for MSB first transfer.

This function returns the SPI data register address, which is mainly used by DMA/eDMA.

Parameters:
  • base – Pointer to the FLEXIO_SPI_Type structure.

  • direction – Shift direction of MSB first or LSB first.

Returns:

FlexIO SPI transmit data register address.

static inline uint32_t FLEXIO_SPI_GetRxDataRegisterAddress(FLEXIO_SPI_Type *base, flexio_spi_shift_direction_t direction)

Gets the FlexIO SPI receive data register address for the MSB first transfer.

This function returns the SPI data register address, which is mainly used by DMA/eDMA.

Parameters:
  • base – Pointer to the FLEXIO_SPI_Type structure.

  • direction – Shift direction of MSB first or LSB first.

Returns:

FlexIO SPI receive data register address.

static inline void FLEXIO_SPI_Enable(FLEXIO_SPI_Type *base, bool enable)

Enables/disables the FlexIO SPI module operation.

Parameters:
  • base – Pointer to the FLEXIO_SPI_Type.

  • enable – True to enable, false does not have any effect.

void FLEXIO_SPI_MasterSetBaudRate(FLEXIO_SPI_Type *base, uint32_t baudRate_Bps, uint32_t srcClockHz)

Sets baud rate for the FlexIO SPI transfer, which is only used for the master.

Parameters:
  • base – Pointer to the FLEXIO_SPI_Type structure.

  • baudRate_Bps – Baud Rate needed in Hz.

  • srcClockHz – SPI source clock frequency in Hz.

static inline void FLEXIO_SPI_WriteData(FLEXIO_SPI_Type *base, flexio_spi_shift_direction_t direction, uint32_t data)

Writes one byte of data, which is sent using the MSB method.

Note

This is a non-blocking API, which returns directly after the data is put into the data register but the data transfer is not finished on the bus. Ensure that the TxEmptyFlag is asserted before calling this API.

Parameters:
  • base – Pointer to the FLEXIO_SPI_Type structure.

  • direction – Shift direction of MSB first or LSB first.

  • data – 8/16/32 bit data.

static inline uint32_t FLEXIO_SPI_ReadData(FLEXIO_SPI_Type *base, flexio_spi_shift_direction_t direction)

Reads 8 bit/16 bit data.

Note

This is a non-blocking API, which returns directly after the data is read from the data register. Ensure that the RxFullFlag is asserted before calling this API.

Parameters:
  • base – Pointer to the FLEXIO_SPI_Type structure.

  • direction – Shift direction of MSB first or LSB first.

Returns:

8 bit/16 bit data received.

status_t FLEXIO_SPI_WriteBlocking(FLEXIO_SPI_Type *base, flexio_spi_shift_direction_t direction, const uint8_t *buffer, size_t size)

Sends a buffer of data bytes.

Note

This function blocks using the polling method until all bytes have been sent.

Parameters:
  • base – Pointer to the FLEXIO_SPI_Type structure.

  • direction – Shift direction of MSB first or LSB first.

  • buffer – The data bytes to send.

  • size – The number of data bytes to send.

Return values:
  • kStatus_Success – Successfully create the handle.

  • kStatus_FLEXIO_SPI_Timeout – The transfer timed out and was aborted.

status_t FLEXIO_SPI_ReadBlocking(FLEXIO_SPI_Type *base, flexio_spi_shift_direction_t direction, uint8_t *buffer, size_t size)

Receives a buffer of bytes.

Note

This function blocks using the polling method until all bytes have been received.

Parameters:
  • base – Pointer to the FLEXIO_SPI_Type structure.

  • direction – Shift direction of MSB first or LSB first.

  • buffer – The buffer to store the received bytes.

  • size – The number of data bytes to be received.

Return values:
  • kStatus_Success – Successfully create the handle.

  • kStatus_FLEXIO_SPI_Timeout – The transfer timed out and was aborted.

status_t FLEXIO_SPI_MasterTransferBlocking(FLEXIO_SPI_Type *base, flexio_spi_transfer_t *xfer)

Receives a buffer of bytes.

Note

This function blocks via polling until all bytes have been received.

Parameters:
  • base – pointer to FLEXIO_SPI_Type structure

  • xfer – FlexIO SPI transfer structure, see flexio_spi_transfer_t.

Return values:
  • kStatus_Success – Successfully create the handle.

  • kStatus_FLEXIO_SPI_Timeout – The transfer timed out and was aborted.

void FLEXIO_SPI_FlushShifters(FLEXIO_SPI_Type *base)

Flush tx/rx shifters.

Parameters:
  • base – Pointer to the FLEXIO_SPI_Type structure.

status_t FLEXIO_SPI_MasterTransferCreateHandle(FLEXIO_SPI_Type *base, flexio_spi_master_handle_t *handle, flexio_spi_master_transfer_callback_t callback, void *userData)

Initializes the FlexIO SPI Master handle, which is used in transactional functions.

Parameters:
  • base – Pointer to the FLEXIO_SPI_Type structure.

  • handle – Pointer to the flexio_spi_master_handle_t structure to store the transfer state.

  • callback – The callback function.

  • userData – The parameter of the callback function.

Return values:
  • kStatus_Success – Successfully create the handle.

  • kStatus_OutOfRange – The FlexIO type/handle/ISR table out of range.

status_t FLEXIO_SPI_MasterTransferNonBlocking(FLEXIO_SPI_Type *base, flexio_spi_master_handle_t *handle, flexio_spi_transfer_t *xfer)

Master transfer data using IRQ.

This function sends data using IRQ. This is a non-blocking function, which returns right away. When all data is sent out/received, the callback function is called.

Parameters:
  • base – Pointer to the FLEXIO_SPI_Type structure.

  • handle – Pointer to the flexio_spi_master_handle_t structure to store the transfer state.

  • xfer – FlexIO SPI transfer structure. See flexio_spi_transfer_t.

Return values:
  • kStatus_Success – Successfully start a transfer.

  • kStatus_InvalidArgument – Input argument is invalid.

  • kStatus_FLEXIO_SPI_Busy – SPI is not idle, is running another transfer.

void FLEXIO_SPI_MasterTransferAbort(FLEXIO_SPI_Type *base, flexio_spi_master_handle_t *handle)

Aborts the master data transfer, which used IRQ.

Parameters:
  • base – Pointer to the FLEXIO_SPI_Type structure.

  • handle – Pointer to the flexio_spi_master_handle_t structure to store the transfer state.

status_t FLEXIO_SPI_MasterTransferGetCount(FLEXIO_SPI_Type *base, flexio_spi_master_handle_t *handle, size_t *count)

Gets the data transfer status which used IRQ.

Parameters:
  • base – Pointer to the FLEXIO_SPI_Type structure.

  • handle – Pointer to the flexio_spi_master_handle_t structure to store the transfer state.

  • count – Number of bytes transferred so far by the non-blocking transaction.

Return values:
  • kStatus_InvalidArgument – count is Invalid.

  • kStatus_Success – Successfully return the count.

void FLEXIO_SPI_MasterTransferHandleIRQ(void *spiType, void *spiHandle)

FlexIO SPI master IRQ handler function.

Parameters:
  • spiType – Pointer to the FLEXIO_SPI_Type structure.

  • spiHandle – Pointer to the flexio_spi_master_handle_t structure to store the transfer state.

status_t FLEXIO_SPI_SlaveTransferCreateHandle(FLEXIO_SPI_Type *base, flexio_spi_slave_handle_t *handle, flexio_spi_slave_transfer_callback_t callback, void *userData)

Initializes the FlexIO SPI Slave handle, which is used in transactional functions.

Parameters:
  • base – Pointer to the FLEXIO_SPI_Type structure.

  • handle – Pointer to the flexio_spi_slave_handle_t structure to store the transfer state.

  • callback – The callback function.

  • userData – The parameter of the callback function.

Return values:
  • kStatus_Success – Successfully create the handle.

  • kStatus_OutOfRange – The FlexIO type/handle/ISR table out of range.

status_t FLEXIO_SPI_SlaveTransferNonBlocking(FLEXIO_SPI_Type *base, flexio_spi_slave_handle_t *handle, flexio_spi_transfer_t *xfer)

Slave transfer data using IRQ.

This function sends data using IRQ. This is a non-blocking function, which returns right away. When all data is sent out/received, the callback function is called.

Parameters:
  • handle – Pointer to the flexio_spi_slave_handle_t structure to store the transfer state.

  • base – Pointer to the FLEXIO_SPI_Type structure.

  • xfer – FlexIO SPI transfer structure. See flexio_spi_transfer_t.

Return values:
  • kStatus_Success – Successfully start a transfer.

  • kStatus_InvalidArgument – Input argument is invalid.

  • kStatus_FLEXIO_SPI_Busy – SPI is not idle; it is running another transfer.

static inline void FLEXIO_SPI_SlaveTransferAbort(FLEXIO_SPI_Type *base, flexio_spi_slave_handle_t *handle)

Aborts the slave data transfer which used IRQ, share same API with master.

Parameters:
  • base – Pointer to the FLEXIO_SPI_Type structure.

  • handle – Pointer to the flexio_spi_slave_handle_t structure to store the transfer state.

static inline status_t FLEXIO_SPI_SlaveTransferGetCount(FLEXIO_SPI_Type *base, flexio_spi_slave_handle_t *handle, size_t *count)

Gets the data transfer status which used IRQ, share same API with master.

Parameters:
  • base – Pointer to the FLEXIO_SPI_Type structure.

  • handle – Pointer to the flexio_spi_slave_handle_t structure to store the transfer state.

  • count – Number of bytes transferred so far by the non-blocking transaction.

Return values:
  • kStatus_InvalidArgument – count is Invalid.

  • kStatus_Success – Successfully return the count.

void FLEXIO_SPI_SlaveTransferHandleIRQ(void *spiType, void *spiHandle)

FlexIO SPI slave IRQ handler function.

Parameters:
  • spiType – Pointer to the FLEXIO_SPI_Type structure.

  • spiHandle – Pointer to the flexio_spi_slave_handle_t structure to store the transfer state.

FSL_FLEXIO_SPI_DRIVER_VERSION

FlexIO SPI driver version.

Error codes for the FlexIO SPI driver.

Values:

enumerator kStatus_FLEXIO_SPI_Busy

FlexIO SPI is busy.

enumerator kStatus_FLEXIO_SPI_Idle

SPI is idle

enumerator kStatus_FLEXIO_SPI_Error

FlexIO SPI error.

enumerator kStatus_FLEXIO_SPI_Timeout

FlexIO SPI timeout polling status flags.

enum _flexio_spi_clock_phase

FlexIO SPI clock phase configuration.

Values:

enumerator kFLEXIO_SPI_ClockPhaseFirstEdge

First edge on SPSCK occurs at the middle of the first cycle of a data transfer.

enumerator kFLEXIO_SPI_ClockPhaseSecondEdge

First edge on SPSCK occurs at the start of the first cycle of a data transfer.

enum _flexio_spi_shift_direction

FlexIO SPI data shifter direction options.

Values:

enumerator kFLEXIO_SPI_MsbFirst

Data transfers start with most significant bit.

enumerator kFLEXIO_SPI_LsbFirst

Data transfers start with least significant bit.

enum _flexio_spi_data_bitcount_mode

FlexIO SPI data length mode options.

Values:

enumerator kFLEXIO_SPI_8BitMode

8-bit data transmission mode.

enumerator kFLEXIO_SPI_16BitMode

16-bit data transmission mode.

enumerator kFLEXIO_SPI_32BitMode

32-bit data transmission mode.

enum _flexio_spi_interrupt_enable

Define FlexIO SPI interrupt mask.

Values:

enumerator kFLEXIO_SPI_TxEmptyInterruptEnable

Transmit buffer empty interrupt enable.

enumerator kFLEXIO_SPI_RxFullInterruptEnable

Receive buffer full interrupt enable.

enum _flexio_spi_status_flags

Define FlexIO SPI status mask.

Values:

enumerator kFLEXIO_SPI_TxBufferEmptyFlag

Transmit buffer empty flag.

enumerator kFLEXIO_SPI_RxBufferFullFlag

Receive buffer full flag.

enum _flexio_spi_dma_enable

Define FlexIO SPI DMA mask.

Values:

enumerator kFLEXIO_SPI_TxDmaEnable

Tx DMA request source

enumerator kFLEXIO_SPI_RxDmaEnable

Rx DMA request source

enumerator kFLEXIO_SPI_DmaAllEnable

All DMA request source

enum _flexio_spi_transfer_flags

Define FlexIO SPI transfer flags.

Note

Use kFLEXIO_SPI_csContinuous and one of the other flags to OR together to form the transfer flag.

Values:

enumerator kFLEXIO_SPI_8bitMsb

FlexIO SPI 8-bit MSB first

enumerator kFLEXIO_SPI_8bitLsb

FlexIO SPI 8-bit LSB first

enumerator kFLEXIO_SPI_16bitMsb

FlexIO SPI 16-bit MSB first

enumerator kFLEXIO_SPI_16bitLsb

FlexIO SPI 16-bit LSB first

enumerator kFLEXIO_SPI_32bitMsb

FlexIO SPI 32-bit MSB first

enumerator kFLEXIO_SPI_32bitLsb

FlexIO SPI 32-bit LSB first

enumerator kFLEXIO_SPI_csContinuous

Enable the CS signal continuous mode

typedef enum _flexio_spi_clock_phase flexio_spi_clock_phase_t

FlexIO SPI clock phase configuration.

typedef enum _flexio_spi_shift_direction flexio_spi_shift_direction_t

FlexIO SPI data shifter direction options.

typedef enum _flexio_spi_data_bitcount_mode flexio_spi_data_bitcount_mode_t

FlexIO SPI data length mode options.

typedef struct _flexio_spi_type FLEXIO_SPI_Type

Define FlexIO SPI access structure typedef.

typedef struct _flexio_spi_master_config flexio_spi_master_config_t

Define FlexIO SPI master configuration structure.

typedef struct _flexio_spi_slave_config flexio_spi_slave_config_t

Define FlexIO SPI slave configuration structure.

typedef struct _flexio_spi_transfer flexio_spi_transfer_t

Define FlexIO SPI transfer structure.

typedef struct _flexio_spi_master_handle flexio_spi_master_handle_t

typedef for flexio_spi_master_handle_t in advance.

typedef flexio_spi_master_handle_t flexio_spi_slave_handle_t

Slave handle is the same with master handle.

typedef void (*flexio_spi_master_transfer_callback_t)(FLEXIO_SPI_Type *base, flexio_spi_master_handle_t *handle, status_t status, void *userData)

FlexIO SPI master callback for finished transmit.

typedef void (*flexio_spi_slave_transfer_callback_t)(FLEXIO_SPI_Type *base, flexio_spi_slave_handle_t *handle, status_t status, void *userData)

FlexIO SPI slave callback for finished transmit.

FLEXIO_SPI_DUMMYDATA

FlexIO SPI dummy transfer data, the data is sent while txData is NULL.

SPI_RETRY_TIMES

Retry times for waiting flag.

FLEXIO_SPI_XFER_DATA_FORMAT(flag)

Get the transfer data format of width and bit order.

struct _flexio_spi_type
#include <fsl_flexio_spi.h>

Define FlexIO SPI access structure typedef.

Public Members

FLEXIO_Type *flexioBase

FlexIO base pointer.

uint8_t SDOPinIndex

Pin select for data output. To set SDO pin in Hi-Z state, user needs to mux the pin as GPIO input and disable all pull up/down in application.

uint8_t SDIPinIndex

Pin select for data input.

uint8_t SCKPinIndex

Pin select for clock.

uint8_t CSnPinIndex

Pin select for enable.

uint8_t shifterIndex[2]

Shifter index used in FlexIO SPI.

uint8_t timerIndex[2]

Timer index used in FlexIO SPI.

struct _flexio_spi_master_config
#include <fsl_flexio_spi.h>

Define FlexIO SPI master configuration structure.

Public Members

bool enableMaster

Enable/disable FlexIO SPI master after configuration.

bool enableInDoze

Enable/disable FlexIO operation in doze mode.

bool enableInDebug

Enable/disable FlexIO operation in debug mode.

bool enableFastAccess

Enable/disable fast access to FlexIO registers, fast access requires the FlexIO clock to be at least twice the frequency of the bus clock.

uint32_t baudRate_Bps

Baud rate in Bps.

flexio_spi_clock_phase_t phase

Clock phase.

flexio_spi_data_bitcount_mode_t dataMode

8bit or 16bit mode.

struct _flexio_spi_slave_config
#include <fsl_flexio_spi.h>

Define FlexIO SPI slave configuration structure.

Public Members

bool enableSlave

Enable/disable FlexIO SPI slave after configuration.

bool enableInDoze

Enable/disable FlexIO operation in doze mode.

bool enableInDebug

Enable/disable FlexIO operation in debug mode.

bool enableFastAccess

Enable/disable fast access to FlexIO registers, fast access requires the FlexIO clock to be at least twice the frequency of the bus clock.

flexio_spi_clock_phase_t phase

Clock phase.

flexio_spi_data_bitcount_mode_t dataMode

8bit or 16bit mode.

struct _flexio_spi_transfer
#include <fsl_flexio_spi.h>

Define FlexIO SPI transfer structure.

Public Members

const uint8_t *txData

Send buffer.

uint8_t *rxData

Receive buffer.

size_t dataSize

Transfer bytes.

uint8_t flags

FlexIO SPI control flag, MSB first or LSB first.

struct _flexio_spi_master_handle
#include <fsl_flexio_spi.h>

Define FlexIO SPI handle structure.

Public Members

const uint8_t *txData

Transfer buffer.

uint8_t *rxData

Receive buffer.

size_t transferSize

Total bytes to be transferred.

volatile size_t txRemainingBytes

Send data remaining in bytes.

volatile size_t rxRemainingBytes

Receive data remaining in bytes.

volatile uint32_t state

FlexIO SPI internal state.

uint8_t bytePerFrame

SPI mode, 2bytes or 1byte in a frame

flexio_spi_shift_direction_t direction

Shift direction.

flexio_spi_master_transfer_callback_t callback

FlexIO SPI callback.

void *userData

Callback parameter.

FlexIO UART Driver

status_t FLEXIO_UART_Init(FLEXIO_UART_Type *base, const flexio_uart_config_t *userConfig, uint32_t srcClock_Hz)

Ungates the FlexIO clock, resets the FlexIO module, configures FlexIO UART hardware, and configures the FlexIO UART with FlexIO UART configuration. The configuration structure can be filled by the user or be set with default values by FLEXIO_UART_GetDefaultConfig().

Example

FLEXIO_UART_Type base = {
.flexioBase = FLEXIO,
.TxPinIndex = 0,
.RxPinIndex = 1,
.shifterIndex = {0,1},
.timerIndex = {0,1}
};
flexio_uart_config_t config = {
.enableInDoze = false,
.enableInDebug = true,
.enableFastAccess = false,
.baudRate_Bps = 115200U,
.bitCountPerChar = 8
};
FLEXIO_UART_Init(base, &config, srcClock_Hz);

Parameters:
  • base – Pointer to the FLEXIO_UART_Type structure.

  • userConfig – Pointer to the flexio_uart_config_t structure.

  • srcClock_Hz – FlexIO source clock in Hz.

Return values:
  • kStatus_Success – Configuration success.

  • kStatus_FLEXIO_UART_BaudrateNotSupport – Baudrate is not supported for current clock source frequency.

void FLEXIO_UART_Deinit(FLEXIO_UART_Type *base)

Resets the FlexIO UART shifter and timer config.

Note

After calling this API, call the FLEXO_UART_Init to use the FlexIO UART module.

Parameters:
  • base – Pointer to FLEXIO_UART_Type structure

void FLEXIO_UART_GetDefaultConfig(flexio_uart_config_t *userConfig)

Gets the default configuration to configure the FlexIO UART. The configuration can be used directly for calling the FLEXIO_UART_Init(). Example:

flexio_uart_config_t config;
FLEXIO_UART_GetDefaultConfig(&userConfig);

Parameters:
  • userConfig – Pointer to the flexio_uart_config_t structure.

uint32_t FLEXIO_UART_GetStatusFlags(FLEXIO_UART_Type *base)

Gets the FlexIO UART status flags.

Parameters:
  • base – Pointer to the FLEXIO_UART_Type structure.

Returns:

FlexIO UART status flags.

void FLEXIO_UART_ClearStatusFlags(FLEXIO_UART_Type *base, uint32_t mask)

Gets the FlexIO UART status flags.

Parameters:
  • base – Pointer to the FLEXIO_UART_Type structure.

  • mask – Status flag. The parameter can be any combination of the following values:

    • kFLEXIO_UART_TxDataRegEmptyFlag

    • kFLEXIO_UART_RxEmptyFlag

    • kFLEXIO_UART_RxOverRunFlag

void FLEXIO_UART_EnableInterrupts(FLEXIO_UART_Type *base, uint32_t mask)

Enables the FlexIO UART interrupt.

This function enables the FlexIO UART interrupt.

Parameters:
  • base – Pointer to the FLEXIO_UART_Type structure.

  • mask – Interrupt source.

void FLEXIO_UART_DisableInterrupts(FLEXIO_UART_Type *base, uint32_t mask)

Disables the FlexIO UART interrupt.

This function disables the FlexIO UART interrupt.

Parameters:
  • base – Pointer to the FLEXIO_UART_Type structure.

  • mask – Interrupt source.

static inline uint32_t FLEXIO_UART_GetTxDataRegisterAddress(FLEXIO_UART_Type *base)

Gets the FlexIO UARt transmit data register address.

This function returns the UART data register address, which is mainly used by DMA/eDMA.

Parameters:
  • base – Pointer to the FLEXIO_UART_Type structure.

Returns:

FlexIO UART transmit data register address.

static inline uint32_t FLEXIO_UART_GetRxDataRegisterAddress(FLEXIO_UART_Type *base)

Gets the FlexIO UART receive data register address.

This function returns the UART data register address, which is mainly used by DMA/eDMA.

Parameters:
  • base – Pointer to the FLEXIO_UART_Type structure.

Returns:

FlexIO UART receive data register address.

static inline void FLEXIO_UART_EnableTxDMA(FLEXIO_UART_Type *base, bool enable)

Enables/disables the FlexIO UART transmit DMA. This function enables/disables the FlexIO UART Tx DMA, which means asserting the kFLEXIO_UART_TxDataRegEmptyFlag does/doesn’t trigger the DMA request.

Parameters:
  • base – Pointer to the FLEXIO_UART_Type structure.

  • enable – True to enable, false to disable.

static inline void FLEXIO_UART_EnableRxDMA(FLEXIO_UART_Type *base, bool enable)

Enables/disables the FlexIO UART receive DMA. This function enables/disables the FlexIO UART Rx DMA, which means asserting kFLEXIO_UART_RxDataRegFullFlag does/doesn’t trigger the DMA request.

Parameters:
  • base – Pointer to the FLEXIO_UART_Type structure.

  • enable – True to enable, false to disable.

static inline void FLEXIO_UART_Enable(FLEXIO_UART_Type *base, bool enable)

Enables/disables the FlexIO UART module operation.

Parameters:
  • base – Pointer to the FLEXIO_UART_Type.

  • enable – True to enable, false does not have any effect.

static inline void FLEXIO_UART_WriteByte(FLEXIO_UART_Type *base, const uint8_t *buffer)

Writes one byte of data.

Note

This is a non-blocking API, which returns directly after the data is put into the data register. Ensure that the TxEmptyFlag is asserted before calling this API.

Parameters:
  • base – Pointer to the FLEXIO_UART_Type structure.

  • buffer – The data bytes to send.

static inline void FLEXIO_UART_ReadByte(FLEXIO_UART_Type *base, uint8_t *buffer)

Reads one byte of data.

Note

This is a non-blocking API, which returns directly after the data is read from the data register. Ensure that the RxFullFlag is asserted before calling this API.

Parameters:
  • base – Pointer to the FLEXIO_UART_Type structure.

  • buffer – The buffer to store the received bytes.

status_t FLEXIO_UART_WriteBlocking(FLEXIO_UART_Type *base, const uint8_t *txData, size_t txSize)

Sends a buffer of data bytes.

Note

This function blocks using the polling method until all bytes have been sent.

Parameters:
  • base – Pointer to the FLEXIO_UART_Type structure.

  • txData – The data bytes to send.

  • txSize – The number of data bytes to send.

Return values:
  • kStatus_FLEXIO_UART_Timeout – Transmission timed out and was aborted.

  • kStatus_Success – Successfully wrote all data.

status_t FLEXIO_UART_ReadBlocking(FLEXIO_UART_Type *base, uint8_t *rxData, size_t rxSize)

Receives a buffer of bytes.

Note

This function blocks using the polling method until all bytes have been received.

Parameters:
  • base – Pointer to the FLEXIO_UART_Type structure.

  • rxData – The buffer to store the received bytes.

  • rxSize – The number of data bytes to be received.

Return values:
  • kStatus_FLEXIO_UART_Timeout – Transmission timed out and was aborted.

  • kStatus_Success – Successfully received all data.

status_t FLEXIO_UART_TransferCreateHandle(FLEXIO_UART_Type *base, flexio_uart_handle_t *handle, flexio_uart_transfer_callback_t callback, void *userData)

Initializes the UART handle.

This function initializes the FlexIO UART handle, which can be used for other FlexIO UART transactional APIs. Call this API once to get the initialized handle.

The UART driver supports the “background” receiving, which means that users can set up a RX ring buffer optionally. Data received is stored into the ring buffer even when the user doesn’t call the FLEXIO_UART_TransferReceiveNonBlocking() API. If there is already data received in the ring buffer, users can get the received data from the ring buffer directly. The ring buffer is disabled if passing NULL as ringBuffer.

Parameters:
  • base – to FLEXIO_UART_Type structure.

  • handle – Pointer to the flexio_uart_handle_t structure to store the transfer state.

  • callback – The callback function.

  • userData – The parameter of the callback function.

Return values:
  • kStatus_Success – Successfully create the handle.

  • kStatus_OutOfRange – The FlexIO type/handle/ISR table out of range.

void FLEXIO_UART_TransferStartRingBuffer(FLEXIO_UART_Type *base, flexio_uart_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_ReceiveNonBlocking() API. If there is already data received in the ring buffer, users can get the received data from the ring buffer directly.

Note

When using the RX ring buffer, one byte is reserved for internal use. In other words, if ringBufferSize is 32, only 31 bytes are used for saving data.

Parameters:
  • base – Pointer to the FLEXIO_UART_Type structure.

  • handle – Pointer to the flexio_uart_handle_t structure to store the transfer state.

  • ringBuffer – Start address of ring buffer for background receiving. Pass NULL to disable the ring buffer.

  • ringBufferSize – Size of the ring buffer.

void FLEXIO_UART_TransferStopRingBuffer(FLEXIO_UART_Type *base, flexio_uart_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 – Pointer to the FLEXIO_UART_Type structure.

  • handle – Pointer to the flexio_uart_handle_t structure to store the transfer state.

status_t FLEXIO_UART_TransferSendNonBlocking(FLEXIO_UART_Type *base, flexio_uart_handle_t *handle, flexio_uart_transfer_t *xfer)

Transmits a buffer of data using the interrupt method.

This function sends data using an interrupt method. This is a non-blocking function, which returns directly without waiting for all data to be written to the TX register. When all data is written to the TX register in ISR, the FlexIO UART driver calls the callback function and passes the kStatus_FLEXIO_UART_TxIdle as status parameter.

Note

The kStatus_FLEXIO_UART_TxIdle is passed to the upper layer when all data is written to the TX register. However, it does not ensure that all data is sent out.

Parameters:
  • base – Pointer to the FLEXIO_UART_Type structure.

  • handle – Pointer to the flexio_uart_handle_t structure to store the transfer state.

  • xfer – FlexIO UART transfer structure. See flexio_uart_transfer_t.

Return values:
  • kStatus_Success – Successfully starts the data transmission.

  • kStatus_UART_TxBusy – Previous transmission still not finished, data not written to the TX register.

void FLEXIO_UART_TransferAbortSend(FLEXIO_UART_Type *base, flexio_uart_handle_t *handle)

Aborts the interrupt-driven data transmit.

This function aborts the interrupt-driven data sending. Get the remainBytes to find out how many bytes are still not sent out.

Parameters:
  • base – Pointer to the FLEXIO_UART_Type structure.

  • handle – Pointer to the flexio_uart_handle_t structure to store the transfer state.

status_t FLEXIO_UART_TransferGetSendCount(FLEXIO_UART_Type *base, flexio_uart_handle_t *handle, size_t *count)

Gets the number of bytes sent.

This function gets the number of bytes sent driven by interrupt.

Parameters:
  • base – Pointer to the FLEXIO_UART_Type structure.

  • handle – Pointer to the flexio_uart_handle_t structure to store the transfer state.

  • count – Number of bytes sent so far by the non-blocking transaction.

Return values:
  • kStatus_NoTransferInProgress – transfer has finished or no transfer in progress.

  • kStatus_Success – Successfully return the count.

status_t FLEXIO_UART_TransferReceiveNonBlocking(FLEXIO_UART_Type *base, flexio_uart_handle_t *handle, flexio_uart_transfer_t *xfer, size_t *receivedBytes)

Receives a buffer of data using the interrupt method.

This function receives data using the interrupt method. This is a non-blocking function, which returns without waiting for all data to be received. If the RX ring buffer is used and not empty, the data in ring buffer is copied and the parameter receivedBytes shows how many bytes are copied from the ring buffer. After copying, if the data in ring buffer is not enough to read, the receive request is saved by the UART driver. When new data arrives, the receive request is serviced first. When all data is received, the UART driver notifies the upper layer through a callback function and passes the status parameter kStatus_UART_RxIdle. For example, if the upper layer needs 10 bytes but there are only 5 bytes in the ring buffer, the 5 bytes are copied to xfer->data. This function returns with the parameter receivedBytes set to 5. For the last 5 bytes, newly arrived data is saved from the xfer->data[5]. When 5 bytes are received, the UART driver notifies 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 – Pointer to the FLEXIO_UART_Type structure.

  • handle – Pointer to the flexio_uart_handle_t structure to store the transfer state.

  • xfer – UART transfer structure. See flexio_uart_transfer_t.

  • receivedBytes – Bytes received from the ring buffer directly.

Return values:
  • kStatus_Success – Successfully queue the transfer into the transmit queue.

  • kStatus_FLEXIO_UART_RxBusy – Previous receive request is not finished.

void FLEXIO_UART_TransferAbortReceive(FLEXIO_UART_Type *base, flexio_uart_handle_t *handle)

Aborts the receive data which was using IRQ.

This function aborts the receive data which was using IRQ.

Parameters:
  • base – Pointer to the FLEXIO_UART_Type structure.

  • handle – Pointer to the flexio_uart_handle_t structure to store the transfer state.

status_t FLEXIO_UART_TransferGetReceiveCount(FLEXIO_UART_Type *base, flexio_uart_handle_t *handle, size_t *count)

Gets the number of bytes received.

This function gets the number of bytes received driven by interrupt.

Parameters:
  • base – Pointer to the FLEXIO_UART_Type structure.

  • handle – Pointer to the flexio_uart_handle_t structure to store the transfer state.

  • count – Number of bytes received so far by the non-blocking transaction.

Return values:
  • kStatus_NoTransferInProgress – transfer has finished or no transfer in progress.

  • kStatus_Success – Successfully return the count.

void FLEXIO_UART_TransferHandleIRQ(void *uartType, void *uartHandle)

FlexIO UART IRQ handler function.

This function processes the FlexIO UART transmit and receives the IRQ request.

Parameters:
  • uartType – Pointer to the FLEXIO_UART_Type structure.

  • uartHandle – Pointer to the flexio_uart_handle_t structure to store the transfer state.

void FLEXIO_UART_FlushShifters(FLEXIO_UART_Type *base)

Flush tx/rx shifters.

Parameters:
  • base – Pointer to the FLEXIO_UART_Type structure.

FSL_FLEXIO_UART_DRIVER_VERSION

FlexIO UART driver version.

Error codes for the UART driver.

Values:

enumerator kStatus_FLEXIO_UART_TxBusy

Transmitter is busy.

enumerator kStatus_FLEXIO_UART_RxBusy

Receiver is busy.

enumerator kStatus_FLEXIO_UART_TxIdle

UART transmitter is idle.

enumerator kStatus_FLEXIO_UART_RxIdle

UART receiver is idle.

enumerator kStatus_FLEXIO_UART_ERROR

ERROR happens on UART.

enumerator kStatus_FLEXIO_UART_RxRingBufferOverrun

UART RX software ring buffer overrun.

enumerator kStatus_FLEXIO_UART_RxHardwareOverrun

UART RX receiver overrun.

enumerator kStatus_FLEXIO_UART_Timeout

UART times out.

enumerator kStatus_FLEXIO_UART_BaudrateNotSupport

Baudrate is not supported in current clock source

enum _flexio_uart_bit_count_per_char

FlexIO UART bit count per char.

Values:

enumerator kFLEXIO_UART_7BitsPerChar

7-bit data characters

enumerator kFLEXIO_UART_8BitsPerChar

8-bit data characters

enumerator kFLEXIO_UART_9BitsPerChar

9-bit data characters

enum _flexio_uart_interrupt_enable

Define FlexIO UART interrupt mask.

Values:

enumerator kFLEXIO_UART_TxDataRegEmptyInterruptEnable

Transmit buffer empty interrupt enable.

enumerator kFLEXIO_UART_RxDataRegFullInterruptEnable

Receive buffer full interrupt enable.

enum _flexio_uart_status_flags

Define FlexIO UART status mask.

Values:

enumerator kFLEXIO_UART_TxDataRegEmptyFlag

Transmit buffer empty flag.

enumerator kFLEXIO_UART_RxDataRegFullFlag

Receive buffer full flag.

enumerator kFLEXIO_UART_RxOverRunFlag

Receive buffer over run flag.

typedef enum _flexio_uart_bit_count_per_char flexio_uart_bit_count_per_char_t

FlexIO UART bit count per char.

typedef struct _flexio_uart_type FLEXIO_UART_Type

Define FlexIO UART access structure typedef.

typedef struct _flexio_uart_config flexio_uart_config_t

Define FlexIO UART user configuration structure.

typedef struct _flexio_uart_transfer flexio_uart_transfer_t

Define FlexIO UART transfer structure.

typedef struct _flexio_uart_handle flexio_uart_handle_t
typedef void (*flexio_uart_transfer_callback_t)(FLEXIO_UART_Type *base, flexio_uart_handle_t *handle, status_t status, void *userData)

FlexIO UART transfer callback function.

UART_RETRY_TIMES

Retry times for waiting flag.

struct _flexio_uart_type
#include <fsl_flexio_uart.h>

Define FlexIO UART access structure typedef.

Public Members

FLEXIO_Type *flexioBase

FlexIO base pointer.

uint8_t TxPinIndex

Pin select for UART_Tx.

uint8_t RxPinIndex

Pin select for UART_Rx.

uint8_t shifterIndex[2]

Shifter index used in FlexIO UART.

uint8_t timerIndex[2]

Timer index used in FlexIO UART.

struct _flexio_uart_config
#include <fsl_flexio_uart.h>

Define FlexIO UART user configuration structure.

Public Members

bool enableUart

Enable/disable FlexIO UART TX & RX.

bool enableInDoze

Enable/disable FlexIO operation in doze mode

bool enableInDebug

Enable/disable FlexIO operation in debug mode

bool enableFastAccess

Enable/disable fast access to FlexIO registers, fast access requires the FlexIO clock to be at least twice the frequency of the bus clock.

uint32_t baudRate_Bps

Baud rate in Bps.

flexio_uart_bit_count_per_char_t bitCountPerChar

number of bits, 7/8/9 -bit

struct _flexio_uart_transfer
#include <fsl_flexio_uart.h>

Define FlexIO UART transfer structure.

Public Members

size_t dataSize

Transfer size

struct _flexio_uart_handle
#include <fsl_flexio_uart.h>

Define FLEXIO UART handle structure.

Public Members

const uint8_t *volatile txData

Address of remaining data to send.

volatile size_t txDataSize

Size of the remaining data to send.

uint8_t *volatile rxData

Address of remaining data to receive.

volatile size_t rxDataSize

Size of the remaining data to receive.

size_t txDataSizeAll

Total bytes to be sent.

size_t rxDataSizeAll

Total bytes to be received.

uint8_t *rxRingBuffer

Start address of the receiver ring buffer.

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.

flexio_uart_transfer_callback_t callback

Callback function.

void *userData

UART callback function parameter.

volatile uint8_t txState

TX transfer state.

volatile uint8_t rxState

RX transfer state

union __unnamed71__

Public Members

uint8_t *data

The buffer of data to be transfer.

uint8_t *rxData

The buffer to receive data.

const uint8_t *txData

The buffer of data to be sent.

FREQME: Frequency Measurement

GDET

status_t GDET_Init(GDET_Type *base)

Initialize GDET.

This function initializes GDET block and setting.

Parameters:
  • base – GDET peripheral base address

Returns:

Status of the init operation

void GDET_Deinit(GDET_Type *base)

Deinitialize GDET.

This function deinitializes GDET secure counter.

Parameters:
  • base – GDET peripheral base address

status_t GDET_Enable(GDET_Type *base)

Enable GDET.

This function enables GDET and interrupts.

Parameters:
  • base – GDET peripheral base address

Returns:

Status of the enable operation

status_t GDET_Disable(GDET_Type *base)

Disable GDET.

This function disables GDET and interrupts.

Parameters:
  • base – GDET peripheral base address

Returns:

Status of the disable operation

status_t GDET_IsolateOn(GDET_Type *base)

Turn on GDET isolation.

This function turns on isolation of GDET peripheral

Parameters:
  • base – GDET peripheral base address

Returns:

Status of the operation

status_t GDET_IsolateOff(GDET_Type *base)

Turn off GDET isolation.

This function turns off isolation of GDET peripheral

Parameters:
  • base – GDET peripheral base address

Returns:

Status of the operation

status_t GDET_ReconfigureVoltageMode(GDET_Type *base, gdet_core_voltage_t voltage)

Change expected core voltage.

This function changes core voltage which Glitch detector expect.

Parameters:
  • base – GDET peripheral base address

  • voltage – Expected core voltage

Returns:

Status of the GDET reconfiguration operation

FSL_GDET_DRIVER_VERSION

Defines GDET driver version 2.1.0.

Change log:

  • Version 2.1.0

    • Update for multiple instances

    • Fix bug in isolation off API

    • Add enable and disable APIs

  • 2.0.1

    • Fix MISRA in GDET_ReconfigureVoltageMode()

  • Version 2.0.0

    • initial version

typedef uint32_t gdet_core_voltage_t

GDET Core Voltage.

These constants are used to define core voltage argument to be used with GDET_ReconfigureVoltageMode(). Different SoC may support various volatages, refer to documentation.

void GDET_DriverIRQHandler(void)
kGDET_0_9v

Voltage (0.9V)

kGDET_1_0v

Voltage (1.0V)

kGDET_1_1v

Voltage (1.1V)

Glitch Detect

GLIKEY

GLIKEY

Values:

enumerator kStatus_GLIKEY_LockedError

GLIKEY status for locked SFR registers (unexpected) .

enumerator kStatus_GLIKEY_NotLocked

GLIKEY status for unlocked SFR registers.

enumerator kStatus_GLIKEY_Locked

GLIKEY status for locked SFR registers.

enumerator kStatus_GLIKEY_DisabledError

GLIKEY status for disabled error.

FSL_GLIKEY_DRIVER_VERSION

Defines GLIKEY driver version 2.0.1.

Change log:

  • Version 2.0.1

    • Implement INIT state recovery from the LOCKED state after a reset when the previous index was locked.

  • Version 2.0.0

    • Initial version

GLIKEY_CODEWORD_STEP1
GLIKEY_CODEWORD_STEP2
GLIKEY_CODEWORD_STEP3
GLIKEY_CODEWORD_STEP4
GLIKEY_CODEWORD_STEP5
GLIKEY_CODEWORD_STEP6
GLIKEY_CODEWORD_STEP7
GLIKEY_CODEWORD_STEP_EN
GLIKEY_FSM_WR_DIS
GLIKEY_FSM_INIT
GLIKEY_FSM_STEP1
GLIKEY_FSM_STEP2
GLIKEY_FSM_STEP3
GLIKEY_FSM_STEP4
GLIKEY_FSM_LOCKED
GLIKEY_FSM_WR_EN
GLIKEY_FSM_SSR_RESET
uint32_t GLIKEY_GetStatus(GLIKEY_Type *base)

Retreives the current status of Glikey.

Parameters:
  • base[in] The base address of the Glikey instance

Returns:

Glikey status information

status_t GLIKEY_IsLocked(GLIKEY_Type *base)

Get if Glikey is locked.

This operation returns the locking status of Glikey.

Return values:
  • kStatus_GLIKEY_Locked – if locked

  • kStatus_GLIKEY_NotLocked – if unlocked

Returns:

Status

status_t GLIKEY_CheckLock(GLIKEY_Type *base)

Check if Glikey is locked.

This operation returns the locking status of Glikey.

Return values:
  • kStatus_GLIKEY_LockedError – if locked

  • kStatus_GLIKEY_NotLocked – if unlocked

Returns:

Status kStatus_Success if success

status_t GLIKEY_SyncReset(GLIKEY_Type *base)

Perform a synchronous reset of Glikey.

This function performs a synchrounous reset of the Glikey. This results in:

  • Glikey will return to the INIT state, unless it is in the LOCK state

Parameters:
  • base[in] The base address of the Glikey instance

Returns:

Status kStatus_Success if success Possible errors: kStatus_GLIKEY_LockedError

status_t GLIKEY_SetIntEnable(GLIKEY_Type *base, uint32_t value)

Set interrupt enable flag of Glikey.

Parameters:
  • base[in] The base address of the Glikey instance

  • value[in] Value to set the interrupt enable flag to, see #[TODO: add reference to constants]

Returns:

Status kStatus_Success if success Possible errors: kStatus_GLIKEY_LockedError

status_t GLIKEY_GetIntEnable(GLIKEY_Type *base, uint32_t *value)

Get interrupt enable flag of Glikey.

Parameters:
  • base[in] The base address of the Glikey instance

  • value[out] Pointer which will be filled with the interrupt enable status, see #[TODO: add reference to constants]

Returns:

Status kStatus_Success if success

status_t GLIKEY_ClearIntStatus(GLIKEY_Type *base)

Clear the interrupt status flag of Glikey.

Parameters:
  • base[in] The base address of the Glikey instance

Returns:

Status kStatus_Success if success Possible errors: kStatus_GLIKEY_LockedError

status_t GLIKEY_SetIntStatus(GLIKEY_Type *base)

Set the interrupt status flag of Glikey.

Parameters:
  • base[in] The base address of the Glikey instance

Returns:

Status kStatus_Success if success Possible errors: kStatus_GLIKEY_LockedError

status_t GLIKEY_Lock(GLIKEY_Type *base)

Lock Glikey SFR (Special Function Registers) interface.

This operation locks the Glikey SFR interface if it is not locked yet.

Parameters:
  • base[in] The base address of the Glikey instance

Returns:

Status kStatus_Success if success

status_t GLIKEY_LockIndex(GLIKEY_Type *base)

Lock Glikey index.

This operation is used to lock a Glikey index. It can only be executed from the WR_EN state, executing it from any other state will result in Glikey entering WR_DIS state. When this happens Glikey requires a reset (synchrous or asynchronous) to go back to INIT state. If the Glikey SFR lock is active this operation will return an error.

Parameters:
  • base[in] The base address of the Glikey instance

Returns:

Status kStatus_Success if success Possible errors: kStatus_GLIKEY_LockedError, kStatus_GLIKEY_DisabledError

status_t GLIKEY_IsIndexLocked(GLIKEY_Type *base, uint32_t index)

Check if Glikey index is locked.

This operation returns the locking status of Glikey index.

Parameters:
  • base[in] The base address of the Glikey instance

  • index[in] The index of the Glikey instance

Returns:

kStatus_GLIKEY_Locked if locked, kStatus_GLIKEY_NotLocked if unlocked Possible errors: kStatus_Fail

status_t GLIKEY_StartEnable(GLIKEY_Type *base, uint32_t index)

Start Glikey enable.

This operation is used to set a new index and start a the sequence to enable it. It needs to be started from the INIT state. If the new index is already locked Glikey will go to LOCKED state, otherwise it will go to STEP1 state. If this operation is used when Glikey is in any state other than INIT Glikey will go to WR_DIS state. It can only recover from this state through a reset (synchrounous or asyncrhonous). If the Glikey SFR lock is active this operation will return an error.

Parameters:
  • base[in] The base address of the Glikey instance

  • index[in] The index of the Glikey instance

Returns:

Status kStatus_Success if success Possible errors: kStatus_GLIKEY_LockedError, kStatus_Fail

status_t GLIKEY_ContinueEnable(GLIKEY_Type *base, uint32_t codeword)

Continue Glikey enable.

This operation is used to progress through the different states of the state machine, starting from STEP1 until the state WR_EN is reached. Each next state of the state machine can only be reached by providing the right codeword to this function. If anything goes wrong the state machine will go to WR_DIS state and can only recover from it through a reset (synchrous or asynchronous). If the Glikey SFR lock is active this operation will return an error.

Parameters:
  • base[in] The base address of the Glikey instance

  • codeword[in] Encoded word for progressing to next FSM state (see GLIKEY_CODEWORD_STEPx/EN)

Returns:

Status kStatus_Success if success Possible errors: kStatus_GLIKEY_LockedError, kStatus_Fail, kStatus_GLIKEY_DisabledError

status_t GLIKEY_EndOperation(GLIKEY_Type *base)

End Glikey operation.

This operation is used to end a Glikey operation. It can only be executed from the WR_EN, LOCKED and RESET states. Executing it from any other state will result in Glikey entering WR_DIS state. When this happens Glikey requires a reset (synchrous or asynchronous) to go back to INIT state. After this operation Glikey will go to INIT state or stay in LOCKED state when the index was locked. If the Glikey SFR lock is active this operation will return an error.

Parameters:
  • base[in] The base address of the Glikey instance

Returns:

A code-flow protected error code (see nxpCsslFlowProtection)

Returns:

Status kStatus_Success if success, kStatus_GLIKEY_Locked if index is still locked Possible errors: kStatus_GLIKEY_LockedError, kStatus_GLIKEY_DisabledError

status_t GLIKEY_ResetIndex(GLIKEY_Type *base, uint32_t index)

Reset Glikey index.

This operation is used to reset a Glikey index. It can only be executed from the INIT state, executing it from any other state will result in Glikey entering WR_DIS state. When this happens Glikey requires a reset (synchrous or asynchronous) to go back to INIT state. If the Glikey SFR lock is active or the index is locked this operation will return an error.

Returns:

A code-flow protected error code (see nxpCsslFlowProtection)

Returns:

Status kStatus_Success if success, kStatus_GLIKEY_Locked if index is still locked Possible errors: kStatus_GLIKEY_LockedError, kStatus_GLIKEY_DisabledError

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

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

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.

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.

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.

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

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.

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

I3C: I3C Driver

FSL_I3C_DRIVER_VERSION

I3C driver version.

I3C status return codes.

Values:

enumerator kStatus_I3C_Busy

The master is already performing a transfer.

enumerator kStatus_I3C_Idle

The slave driver is idle.

enumerator kStatus_I3C_Nak

The slave device sent a NAK in response to an address.

enumerator kStatus_I3C_WriteAbort

The slave device sent a NAK in response to a write.

enumerator kStatus_I3C_Term

The master terminates slave read.

enumerator kStatus_I3C_HdrParityError

Parity error from DDR read.

enumerator kStatus_I3C_CrcError

CRC error from DDR read.

enumerator kStatus_I3C_ReadFifoError

Read from M/SRDATAB register when FIFO empty.

enumerator kStatus_I3C_WriteFifoError

Write to M/SWDATAB register when FIFO full.

enumerator kStatus_I3C_MsgError

Message SDR/DDR mismatch or read/write message in wrong state

enumerator kStatus_I3C_InvalidReq

Invalid use of request.

enumerator kStatus_I3C_Timeout

The module has stalled too long in a frame.

enumerator kStatus_I3C_SlaveCountExceed

The I3C slave count has exceed the definition in I3C_MAX_DEVCNT.

enumerator kStatus_I3C_IBIWon

The I3C slave event IBI or MR or HJ won the arbitration on a header address.

enumerator kStatus_I3C_OverrunError

Slave internal from-bus buffer/FIFO overrun.

enumerator kStatus_I3C_UnderrunError

Slave internal to-bus buffer/FIFO underrun

enumerator kStatus_I3C_UnderrunNak

Slave internal from-bus buffer/FIFO underrun and NACK error

enumerator kStatus_I3C_InvalidStart

Slave invalid start flag

enumerator kStatus_I3C_SdrParityError

SDR parity error

enumerator kStatus_I3C_S0S1Error

S0 or S1 error

enum _i3c_hdr_mode

I3C HDR modes.

Values:

enumerator kI3C_HDRModeNone
enumerator kI3C_HDRModeDDR
enumerator kI3C_HDRModeTSP
enumerator kI3C_HDRModeTSL
typedef enum _i3c_hdr_mode i3c_hdr_mode_t

I3C HDR modes.

typedef struct _i3c_device_info i3c_device_info_t

I3C device information.

I3C_RETRY_TIMES

Timeout times for waiting flag.

I3C_MAX_DEVCNT
I3C_IBI_BUFF_SIZE
struct _i3c_device_info
#include <fsl_i3c.h>

I3C device information.

Public Members

uint8_t dynamicAddr

Device dynamic address.

uint8_t staticAddr

Static address.

uint8_t dcr

Device characteristics register information.

uint8_t bcr

Bus characteristics register information.

uint16_t vendorID

Device vendor ID(manufacture ID).

uint32_t partNumber

Device part number info

uint16_t maxReadLength

Maximum read length.

uint16_t maxWriteLength

Maximum write length.

uint8_t hdrMode

Support hdr mode, could be OR logic in i3c_hdr_mode.

I3C Common Driver

typedef struct _i3c_config i3c_config_t

Structure with settings to initialize the I3C module, could both initialize master and slave functionality.

This structure holds configuration settings for the I3C peripheral. To initialize this structure to reasonable defaults, call the I3C_GetDefaultConfig() function and pass a pointer to your configuration structure instance.

The configuration structure can be made constant so it resides in flash.

uint32_t I3C_GetInstance(I3C_Type *base)

Get which instance current I3C is used.

Parameters:
  • base – The I3C peripheral base address.

void I3C_GetDefaultConfig(i3c_config_t *config)

Provides a default configuration for the I3C peripheral, the configuration covers both master functionality and slave functionality.

This function provides the following default configuration for I3C:

config->enableMaster                 = kI3C_MasterCapable;
config->disableTimeout               = false;
config->hKeep                        = kI3C_MasterHighKeeperNone;
config->enableOpenDrainStop          = true;
config->enableOpenDrainHigh          = true;
config->baudRate_Hz.i2cBaud          = 400000U;
config->baudRate_Hz.i3cPushPullBaud  = 12500000U;
config->baudRate_Hz.i3cOpenDrainBaud = 2500000U;
config->masterDynamicAddress         = 0x0AU;
config->slowClock_Hz                 = 1000000U;
config->enableSlave                  = true;
config->vendorID                     = 0x11BU;
config->enableRandomPart             = false;
config->partNumber                   = 0;
config->dcr                          = 0;
config->bcr = 0;
config->hdrMode             = (uint8_t)kI3C_HDRModeDDR;
config->nakAllRequest       = false;
config->ignoreS0S1Error     = false;
config->offline             = false;
config->matchSlaveStartStop = false;

After calling this function, you can override any settings in order to customize the configuration, prior to initializing the common I3C driver with I3C_Init().

Parameters:
  • config[out] User provided configuration structure for default values. Refer to i3c_config_t.

void I3C_Init(I3C_Type *base, const i3c_config_t *config, uint32_t sourceClock_Hz)

Initializes the I3C peripheral. This function enables the peripheral clock and initializes the I3C peripheral as described by the user provided configuration. This will initialize both the master peripheral and slave peripheral so that I3C module could work as pure master, pure slave or secondary master, etc. A software reset is performed prior to configuration.

Parameters:
  • base – The I3C peripheral base address.

  • config – User provided peripheral configuration. Use I3C_GetDefaultConfig() to get a set of defaults that you can override.

  • sourceClock_Hz – Frequency in Hertz of the I3C functional clock. Used to calculate the baud rate divisors, filter widths, and timeout periods.

struct _i3c_config
#include <fsl_i3c.h>

Structure with settings to initialize the I3C module, could both initialize master and slave functionality.

This structure holds configuration settings for the I3C peripheral. To initialize this structure to reasonable defaults, call the I3C_GetDefaultConfig() function and pass a pointer to your configuration structure instance.

The configuration structure can be made constant so it resides in flash.

Public Members

i3c_master_enable_t enableMaster

Enable master mode.

bool disableTimeout

Whether to disable timeout to prevent the ERRWARN.

i3c_master_hkeep_t hKeep

High keeper mode setting.

bool enableOpenDrainStop

Whether to emit open-drain speed STOP.

bool enableOpenDrainHigh

Enable Open-Drain High to be 1 PPBAUD count for i3c messages, or 1 ODBAUD.

i3c_baudrate_hz_t baudRate_Hz

Desired baud rate settings.

uint8_t masterDynamicAddress

Main master dynamic address configuration.

uint32_t maxWriteLength

Maximum write length.

uint32_t maxReadLength

Maximum read length.

bool enableSlave

Whether to enable slave.

uint8_t staticAddr

Static address.

uint16_t vendorID

Device vendor ID(manufacture ID).

uint32_t partNumber

Device part number info

uint8_t dcr

Device characteristics register information.

uint8_t bcr

Bus characteristics register information.

uint8_t hdrMode

Support hdr mode, could be OR logic in enumeration:i3c_hdr_mode_t.

bool nakAllRequest

Whether to reply NAK to all requests except broadcast CCC.

bool ignoreS0S1Error

Whether to ignore S0/S1 error in SDR mode.

bool offline

Whether to wait 60 us of bus quiet or HDR request to ensure slave track SDR mode safely.

bool matchSlaveStartStop

Whether to assert start/stop status only the time slave is addressed.

I3C Master Driver

void I3C_MasterGetDefaultConfig(i3c_master_config_t *masterConfig)

Provides a default configuration for the I3C master peripheral.

This function provides the following default configuration for the I3C master peripheral:

masterConfig->enableMaster            = kI3C_MasterOn;
masterConfig->disableTimeout          = false;
masterConfig->hKeep                   = kI3C_MasterHighKeeperNone;
masterConfig->enableOpenDrainStop     = true;
masterConfig->enableOpenDrainHigh     = true;
masterConfig->baudRate_Hz             = 100000U;
masterConfig->busType                 = kI3C_TypeI2C;

After calling this function, you can override any settings in order to customize the configuration, prior to initializing the master driver with I3C_MasterInit().

Parameters:
  • masterConfig[out] User provided configuration structure for default values. Refer to i3c_master_config_t.

void I3C_MasterInit(I3C_Type *base, const i3c_master_config_t *masterConfig, uint32_t sourceClock_Hz)

Initializes the I3C master peripheral.

This function enables the peripheral clock and initializes the I3C master peripheral as described by the user provided configuration. A software reset is performed prior to configuration.

Parameters:
  • base – The I3C peripheral base address.

  • masterConfig – User provided peripheral configuration. Use I3C_MasterGetDefaultConfig() to get a set of defaults that you can override.

  • sourceClock_Hz – Frequency in Hertz of the I3C functional clock. Used to calculate the baud rate divisors, filter widths, and timeout periods.

void I3C_MasterDeinit(I3C_Type *base)

Deinitializes the I3C master peripheral.

This function disables the I3C master peripheral and gates the clock. It also performs a software reset to restore the peripheral to reset conditions.

Parameters:
  • base – The I3C peripheral base address.

status_t I3C_MasterCheckAndClearError(I3C_Type *base, uint32_t status)
status_t I3C_MasterWaitForCtrlDone(I3C_Type *base, bool waitIdle)
status_t I3C_CheckForBusyBus(I3C_Type *base)
static inline void I3C_MasterEnable(I3C_Type *base, i3c_master_enable_t enable)

Set I3C module master mode.

Parameters:
  • base – The I3C peripheral base address.

  • enable – Enable master mode.

void I3C_SlaveGetDefaultConfig(i3c_slave_config_t *slaveConfig)

Provides a default configuration for the I3C slave peripheral.

This function provides the following default configuration for the I3C slave peripheral:

slaveConfig->enableslave             = true;

After calling this function, you can override any settings in order to customize the configuration, prior to initializing the slave driver with I3C_SlaveInit().

Parameters:
  • slaveConfig[out] User provided configuration structure for default values. Refer to i3c_slave_config_t.

void I3C_SlaveInit(I3C_Type *base, const i3c_slave_config_t *slaveConfig, uint32_t slowClock_Hz)

Initializes the I3C slave peripheral.

This function enables the peripheral clock and initializes the I3C slave peripheral as described by the user provided configuration.

Parameters:
  • base – The I3C peripheral base address.

  • slaveConfig – User provided peripheral configuration. Use I3C_SlaveGetDefaultConfig() to get a set of defaults that you can override.

  • slowClock_Hz – Frequency in Hertz of the I3C slow clock. Used to calculate the bus match condition values. If FSL_FEATURE_I3C_HAS_NO_SCONFIG_BAMATCH defines as 1, this parameter is useless.

void I3C_SlaveDeinit(I3C_Type *base)

Deinitializes the I3C slave peripheral.

This function disables the I3C slave peripheral and gates the clock.

Parameters:
  • base – The I3C peripheral base address.

static inline void I3C_SlaveEnable(I3C_Type *base, bool isEnable)

Enable/Disable Slave.

Parameters:
  • base – The I3C peripheral base address.

  • isEnable – Enable or disable.

static inline uint32_t I3C_MasterGetStatusFlags(I3C_Type *base)

Gets the I3C master status flags.

A bit mask with the state of all I3C master status flags is returned. For each flag, the corresponding bit in the return value is set if the flag is asserted.

See also

_i3c_master_flags

Parameters:
  • base – The I3C 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 I3C_MasterClearStatusFlags(I3C_Type *base, uint32_t statusMask)

Clears the I3C master status flag state.

The following status register flags can be cleared:

  • kI3C_MasterSlaveStartFlag

  • kI3C_MasterControlDoneFlag

  • kI3C_MasterCompleteFlag

  • kI3C_MasterArbitrationWonFlag

  • kI3C_MasterSlave2MasterFlag

Attempts to clear other flags has no effect.

See also

_i3c_master_flags.

Parameters:
  • base – The I3C peripheral base address.

  • statusMask – A bitmask of status flags that are to be cleared. The mask is composed of _i3c_master_flags enumerators OR’d together. You may pass the result of a previous call to I3C_MasterGetStatusFlags().

static inline uint32_t I3C_MasterGetErrorStatusFlags(I3C_Type *base)

Gets the I3C master error status flags.

A bit mask with the state of all I3C master error status flags is returned. For each flag, the corresponding bit in the return value is set if the flag is asserted.

See also

_i3c_master_error_flags

Parameters:
  • base – The I3C peripheral base address.

Returns:

State of the error status flags:

  • 1: related status flag is set.

  • 0: related status flag is not set.

static inline void I3C_MasterClearErrorStatusFlags(I3C_Type *base, uint32_t statusMask)

Clears the I3C master error status flag state.

See also

_i3c_master_error_flags.

Parameters:
  • base – The I3C peripheral base address.

  • statusMask – A bitmask of error status flags that are to be cleared. The mask is composed of _i3c_master_error_flags enumerators OR’d together. You may pass the result of a previous call to I3C_MasterGetStatusFlags().

i3c_master_state_t I3C_MasterGetState(I3C_Type *base)

Gets the I3C master state.

Parameters:
  • base – The I3C peripheral base address.

Returns:

I3C master state.

static inline uint32_t I3C_SlaveGetStatusFlags(I3C_Type *base)

Gets the I3C slave status flags.

A bit mask with the state of all I3C slave status flags is returned. For each flag, the corresponding bit in the return value is set if the flag is asserted.

See also

_i3c_slave_flags

Parameters:
  • base – The I3C 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 I3C_SlaveClearStatusFlags(I3C_Type *base, uint32_t statusMask)

Clears the I3C slave status flag state.

The following status register flags can be cleared:

  • kI3C_SlaveBusStartFlag

  • kI3C_SlaveMatchedFlag

  • kI3C_SlaveBusStopFlag

Attempts to clear other flags has no effect.

See also

_i3c_slave_flags.

Parameters:
  • base – The I3C peripheral base address.

  • statusMask – A bitmask of status flags that are to be cleared. The mask is composed of _i3c_slave_flags enumerators OR’d together. You may pass the result of a previous call to I3C_SlaveGetStatusFlags().

static inline uint32_t I3C_SlaveGetErrorStatusFlags(I3C_Type *base)

Gets the I3C slave error status flags.

A bit mask with the state of all I3C slave error status flags is returned. For each flag, the corresponding bit in the return value is set if the flag is asserted.

See also

_i3c_slave_error_flags

Parameters:
  • base – The I3C peripheral base address.

Returns:

State of the error status flags:

  • 1: related status flag is set.

  • 0: related status flag is not set.

static inline void I3C_SlaveClearErrorStatusFlags(I3C_Type *base, uint32_t statusMask)

Clears the I3C slave error status flag state.

See also

_i3c_slave_error_flags.

Parameters:
  • base – The I3C peripheral base address.

  • statusMask – A bitmask of error status flags that are to be cleared. The mask is composed of _i3c_slave_error_flags enumerators OR’d together. You may pass the result of a previous call to I3C_SlaveGetErrorStatusFlags().

i3c_slave_activity_state_t I3C_SlaveGetActivityState(I3C_Type *base)

Gets the I3C slave state.

Parameters:
  • base – The I3C peripheral base address.

Returns:

I3C slave activity state, refer i3c_slave_activity_state_t.

status_t I3C_SlaveCheckAndClearError(I3C_Type *base, uint32_t status)
static inline void I3C_MasterEnableInterrupts(I3C_Type *base, uint32_t interruptMask)

Enables the I3C master interrupt requests.

All flags except kI3C_MasterBetweenFlag and kI3C_MasterNackDetectFlag can be enabled as interrupts.

Parameters:
  • base – The I3C peripheral base address.

  • interruptMask – Bit mask of interrupts to enable. See _i3c_master_flags for the set of constants that should be OR’d together to form the bit mask.

static inline void I3C_MasterDisableInterrupts(I3C_Type *base, uint32_t interruptMask)

Disables the I3C master interrupt requests.

All flags except kI3C_MasterBetweenFlag and kI3C_MasterNackDetectFlag can be enabled as interrupts.

Parameters:
  • base – The I3C peripheral base address.

  • interruptMask – Bit mask of interrupts to disable. See _i3c_master_flags for the set of constants that should be OR’d together to form the bit mask.

static inline uint32_t I3C_MasterGetEnabledInterrupts(I3C_Type *base)

Returns the set of currently enabled I3C master interrupt requests.

Parameters:
  • base – The I3C peripheral base address.

Returns:

A bitmask composed of _i3c_master_flags enumerators OR’d together to indicate the set of enabled interrupts.

static inline uint32_t I3C_MasterGetPendingInterrupts(I3C_Type *base)

Returns the set of pending I3C master interrupt requests.

Parameters:
  • base – The I3C peripheral base address.

Returns:

A bitmask composed of _i3c_master_flags enumerators OR’d together to indicate the set of pending interrupts.

static inline void I3C_SlaveEnableInterrupts(I3C_Type *base, uint32_t interruptMask)

Enables the I3C slave interrupt requests.

Only below flags can be enabled as interrupts.

  • kI3C_SlaveBusStartFlag

  • kI3C_SlaveMatchedFlag

  • kI3C_SlaveBusStopFlag

  • kI3C_SlaveRxReadyFlag

  • kI3C_SlaveTxReadyFlag

  • kI3C_SlaveDynamicAddrChangedFlag

  • kI3C_SlaveReceivedCCCFlag

  • kI3C_SlaveErrorFlag

  • kI3C_SlaveHDRCommandMatchFlag

  • kI3C_SlaveCCCHandledFlag

  • kI3C_SlaveEventSentFlag

Parameters:
  • base – The I3C peripheral base address.

  • interruptMask – Bit mask of interrupts to enable. See _i3c_slave_flags for the set of constants that should be OR’d together to form the bit mask.

static inline void I3C_SlaveDisableInterrupts(I3C_Type *base, uint32_t interruptMask)

Disables the I3C slave interrupt requests.

Only below flags can be disabled as interrupts.

  • kI3C_SlaveBusStartFlag

  • kI3C_SlaveMatchedFlag

  • kI3C_SlaveBusStopFlag

  • kI3C_SlaveRxReadyFlag

  • kI3C_SlaveTxReadyFlag

  • kI3C_SlaveDynamicAddrChangedFlag

  • kI3C_SlaveReceivedCCCFlag

  • kI3C_SlaveErrorFlag

  • kI3C_SlaveHDRCommandMatchFlag

  • kI3C_SlaveCCCHandledFlag

  • kI3C_SlaveEventSentFlag

Parameters:
  • base – The I3C peripheral base address.

  • interruptMask – Bit mask of interrupts to disable. See _i3c_slave_flags for the set of constants that should be OR’d together to form the bit mask.

static inline uint32_t I3C_SlaveGetEnabledInterrupts(I3C_Type *base)

Returns the set of currently enabled I3C slave interrupt requests.

Parameters:
  • base – The I3C peripheral base address.

Returns:

A bitmask composed of _i3c_slave_flags enumerators OR’d together to indicate the set of enabled interrupts.

static inline uint32_t I3C_SlaveGetPendingInterrupts(I3C_Type *base)

Returns the set of pending I3C slave interrupt requests.

Parameters:
  • base – The I3C peripheral base address.

Returns:

A bitmask composed of _i3c_slave_flags enumerators OR’d together to indicate the set of pending interrupts.

static inline void I3C_MasterEnableDMA(I3C_Type *base, bool enableTx, bool enableRx, uint32_t width)

Enables or disables I3C master DMA requests.

Parameters:
  • base – The I3C 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.

  • width – DMA read/write unit in bytes.

static inline uint32_t I3C_MasterGetTxFifoAddress(I3C_Type *base, uint32_t width)

Gets I3C master transmit data register address for DMA transfer.

Parameters:
  • base – The I3C peripheral base address.

  • width – DMA read/write unit in bytes.

Returns:

The I3C Master Transmit Data Register address.

static inline uint32_t I3C_MasterGetRxFifoAddress(I3C_Type *base, uint32_t width)

Gets I3C master receive data register address for DMA transfer.

Parameters:
  • base – The I3C peripheral base address.

  • width – DMA read/write unit in bytes.

Returns:

The I3C Master Receive Data Register address.

static inline void I3C_SlaveEnableDMA(I3C_Type *base, bool enableTx, bool enableRx, uint32_t width)

Enables or disables I3C slave DMA requests.

Parameters:
  • base – The I3C 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.

  • width – DMA read/write unit in bytes.

static inline uint32_t I3C_SlaveGetTxFifoAddress(I3C_Type *base, uint32_t width)

Gets I3C slave transmit data register address for DMA transfer.

Parameters:
  • base – The I3C peripheral base address.

  • width – DMA read/write unit in bytes.

Returns:

The I3C Slave Transmit Data Register address.

static inline uint32_t I3C_SlaveGetRxFifoAddress(I3C_Type *base, uint32_t width)

Gets I3C slave receive data register address for DMA transfer.

Parameters:
  • base – The I3C peripheral base address.

  • width – DMA read/write unit in bytes.

Returns:

The I3C Slave Receive Data Register address.

static inline void I3C_MasterSetWatermarks(I3C_Type *base, i3c_tx_trigger_level_t txLvl, i3c_rx_trigger_level_t rxLvl, bool flushTx, bool flushRx)

Sets the watermarks for I3C master FIFOs.

Parameters:
  • base – The I3C peripheral base address.

  • txLvl – Transmit FIFO watermark level. The kI3C_MasterTxReadyFlag flag is set whenever the number of words in the transmit FIFO reaches txLvl.

  • rxLvl – Receive FIFO watermark level. The kI3C_MasterRxReadyFlag flag is set whenever the number of words in the receive FIFO reaches rxLvl.

  • flushTx – true if TX FIFO is to be cleared, otherwise TX FIFO remains unchanged.

  • flushRx – true if RX FIFO is to be cleared, otherwise RX FIFO remains unchanged.

static inline void I3C_MasterGetFifoCounts(I3C_Type *base, size_t *rxCount, size_t *txCount)

Gets the current number of bytes in the I3C master FIFOs.

Parameters:
  • base – The I3C peripheral base address.

  • txCount[out] Pointer through which the current number of bytes in the transmit FIFO is returned. Pass NULL if this value is not required.

  • rxCount[out] Pointer through which the current number of bytes in the receive FIFO is returned. Pass NULL if this value is not required.

static inline void I3C_SlaveSetWatermarks(I3C_Type *base, i3c_tx_trigger_level_t txLvl, i3c_rx_trigger_level_t rxLvl, bool flushTx, bool flushRx)

Sets the watermarks for I3C slave FIFOs.

Parameters:
  • base – The I3C peripheral base address.

  • txLvl – Transmit FIFO watermark level. The kI3C_SlaveTxReadyFlag flag is set whenever the number of words in the transmit FIFO reaches txLvl.

  • rxLvl – Receive FIFO watermark level. The kI3C_SlaveRxReadyFlag flag is set whenever the number of words in the receive FIFO reaches rxLvl.

  • flushTx – true if TX FIFO is to be cleared, otherwise TX FIFO remains unchanged.

  • flushRx – true if RX FIFO is to be cleared, otherwise RX FIFO remains unchanged.

static inline void I3C_SlaveGetFifoCounts(I3C_Type *base, size_t *rxCount, size_t *txCount)

Gets the current number of bytes in the I3C slave FIFOs.

Parameters:
  • base – The I3C peripheral base address.

  • txCount[out] Pointer through which the current number of bytes in the transmit FIFO is returned. Pass NULL if this value is not required.

  • rxCount[out] Pointer through which the current number of bytes in the receive FIFO is returned. Pass NULL if this value is not required.

void I3C_MasterSetBaudRate(I3C_Type *base, const i3c_baudrate_hz_t *baudRate_Hz, uint32_t sourceClock_Hz)

Sets the I3C bus frequency for master transactions.

The I3C 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.

Parameters:
  • base – The I3C peripheral base address.

  • baudRate_Hz – Pointer to structure of requested bus frequency in Hertz.

  • sourceClock_Hz – I3C functional clock frequency in Hertz.

static inline bool I3C_MasterGetBusIdleState(I3C_Type *base)

Returns whether the bus is idle.

Requires the master mode to be enabled.

Parameters:
  • base – The I3C peripheral base address.

Return values:
  • true – Bus is busy.

  • false – Bus is idle.

status_t I3C_MasterStartWithRxSize(I3C_Type *base, i3c_bus_type_t type, uint8_t address, i3c_direction_t dir, uint8_t rxSize)

Sends a START signal and slave address on the I2C/I3C bus, receive size is also specified in the call.

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 a 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 I3C peripheral base address.

  • type – The bus type to use in this transaction.

  • address – 7-bit slave device address, in bits [6:0].

  • dir – Master transfer direction, either kI3C_Read or kI3C_Write. This parameter is used to set the R/w bit (bit 0) in the transmitted slave address.

  • rxSize – Read terminate size for the followed read transfer, limit to 255 bytes.

Return values:
  • kStatus_Success – START signal and address were successfully enqueued in the transmit FIFO.

  • kStatus_I3C_Busy – Another master is currently utilizing the bus.

status_t I3C_MasterStart(I3C_Type *base, i3c_bus_type_t type, uint8_t address, i3c_direction_t dir)

Sends a START signal and slave address on the I2C/I3C 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 I3C peripheral base address.

  • type – The bus type to use in this transaction.

  • address – 7-bit slave device address, in bits [6:0].

  • dir – Master transfer direction, either kI3C_Read or kI3C_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_I3C_Busy – Another master is currently utilizing the bus.

status_t I3C_MasterRepeatedStartWithRxSize(I3C_Type *base, i3c_bus_type_t type, uint8_t address, i3c_direction_t dir, uint8_t rxSize)

Sends a repeated START signal and slave address on the I2C/I3C bus, receive size is also specified in the call.

This function is used to send a Repeated START signal when a transfer is already in progress. Like I3C_MasterStart(), it also sends the specified 7-bit address. Call this API also configures the read terminate size for the following read transfer. For example, set the rxSize = 2, the following read transfer will be terminated after two bytes of data received. Write transfer will not be affected by the rxSize configuration.

Note

This function exists primarily to maintain compatible APIs between I3C and I2C drivers, as well as to better document the intent of code that uses these APIs.

Parameters:
  • base – The I3C peripheral base address.

  • type – The bus type to use in this transaction.

  • address – 7-bit slave device address, in bits [6:0].

  • dir – Master transfer direction, either kI3C_Read or kI3C_Write. This parameter is used to set the R/w bit (bit 0) in the transmitted slave address.

  • rxSize – Read terminate size for the followed read transfer, limit to 255 bytes.

Return values:

kStatus_Success – Repeated START signal and address were successfully enqueued in the transmit FIFO.

static inline status_t I3C_MasterRepeatedStart(I3C_Type *base, i3c_bus_type_t type, uint8_t address, i3c_direction_t dir)

Sends a repeated START signal and slave address on the I2C/I3C bus.

This function is used to send a Repeated START signal when a transfer is already in progress. Like I3C_MasterStart(), it also sends the specified 7-bit address.

Note

This function exists primarily to maintain compatible APIs between I3C and I2C drivers, as well as to better document the intent of code that uses these APIs.

Parameters:
  • base – The I3C peripheral base address.

  • type – The bus type to use in this transaction.

  • address – 7-bit slave device address, in bits [6:0].

  • dir – Master transfer direction, either kI3C_Read or kI3C_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.

status_t I3C_MasterSend(I3C_Type *base, const void *txBuff, size_t txSize, uint32_t flags)

Performs a polling send transfer on the I2C/I3C 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_I3C_Nak.

Parameters:
  • base – The I3C peripheral base address.

  • txBuff – The pointer to the data to be transferred.

  • txSize – The length in bytes of the data to be transferred.

  • flags – Bit mask of options for the transfer. See enumeration _i3c_master_transfer_flags for available options.

Return values:
  • kStatus_Success – Data was sent successfully.

  • kStatus_I3C_Busy – Another master is currently utilizing the bus.

  • kStatus_I3C_Timeout – The module has stalled too long in a frame.

  • kStatus_I3C_Nak – The slave device sent a NAK in response to an address.

  • kStatus_I3C_WriteAbort – The slave device sent a NAK in response to a write.

  • kStatus_I3C_MsgError – Message SDR/DDR mismatch or read/write message in wrong state.

  • kStatus_I3C_WriteFifoError – Write to M/SWDATAB register when FIFO full.

  • kStatus_I3C_InvalidReq – Invalid use of request.

status_t I3C_MasterReceive(I3C_Type *base, void *rxBuff, size_t rxSize, uint32_t flags)

Performs a polling receive transfer on the I2C/I3C bus.

Parameters:
  • base – The I3C peripheral base address.

  • rxBuff – The pointer to the data to be transferred.

  • rxSize – The length in bytes of the data to be transferred.

  • flags – Bit mask of options for the transfer. See enumeration _i3c_master_transfer_flags for available options.

Return values:
  • kStatus_Success – Data was received successfully.

  • kStatus_I3C_Busy – Another master is currently utilizing the bus.

  • kStatus_I3C_Timeout – The module has stalled too long in a frame.

  • kStatus_I3C_Term – The master terminates slave read.

  • kStatus_I3C_HdrParityError – Parity error from DDR read.

  • kStatus_I3C_CrcError – CRC error from DDR read.

  • kStatus_I3C_MsgError – Message SDR/DDR mismatch or read/write message in wrong state.

  • kStatus_I3C_ReadFifoError – Read from M/SRDATAB register when FIFO empty.

  • kStatus_I3C_InvalidReq – Invalid use of request.

status_t I3C_MasterStop(I3C_Type *base)

Sends a STOP signal on the I2C/I3C bus.

This function does not return until the STOP signal is seen on the bus, or an error occurs.

Parameters:
  • base – The I3C peripheral base address.

Return values:
  • kStatus_Success – The STOP signal was successfully sent on the bus and the transaction terminated.

  • kStatus_I3C_Busy – Another master is currently utilizing the bus.

  • kStatus_I3C_Timeout – The module has stalled too long in a frame.

  • kStatus_I3C_InvalidReq – Invalid use of request.

void I3C_MasterEmitRequest(I3C_Type *base, i3c_bus_request_t masterReq)

I3C master emit request.

Parameters:
  • base – The I3C peripheral base address.

  • masterReq – I3C master request of type i3c_bus_request_t

static inline void I3C_MasterEmitIBIResponse(I3C_Type *base, i3c_ibi_response_t ibiResponse)

I3C master emit request.

Parameters:
  • base – The I3C peripheral base address.

  • ibiResponse – I3C master emit IBI response of type i3c_ibi_response_t

void I3C_MasterRegisterIBI(I3C_Type *base, i3c_register_ibi_addr_t *ibiRule)

I3C master register IBI rule.

Parameters:
  • base – The I3C peripheral base address.

  • ibiRule – Pointer to ibi rule description of type i3c_register_ibi_addr_t

void I3C_MasterGetIBIRules(I3C_Type *base, i3c_register_ibi_addr_t *ibiRule)

I3C master get IBI rule.

Parameters:
  • base – The I3C peripheral base address.

  • ibiRule – Pointer to store the read out ibi rule description.

i3c_ibi_type_t I3C_GetIBIType(I3C_Type *base)

I3C master get IBI Type.

Parameters:
  • base – The I3C peripheral base address.

Return values:

i3c_ibi_type_t – Type of i3c_ibi_type_t.

static inline uint8_t I3C_GetIBIAddress(I3C_Type *base)

I3C master get IBI Address.

Parameters:
  • base – The I3C peripheral base address.

Return values:

The – 8-bit IBI address.

status_t I3C_MasterProcessDAASpecifiedBaudrate(I3C_Type *base, uint8_t *addressList, uint32_t count, i3c_master_daa_baudrate_t *daaBaudRate)

Performs a DAA in the i3c bus with specified temporary baud rate.

Parameters:
  • base – The I3C peripheral base address.

  • addressList – The pointer for address list which is used to do DAA.

  • count – The address count in the address list.

  • daaBaudRate – The temporary baud rate in DAA process, NULL for using initial setting. The initial setting is set back between the completion of the DAA and the return of this function.

Return values:
  • kStatus_Success – The transaction was started successfully.

  • kStatus_I3C_Busy – Either another master is currently utilizing the bus, or a non-blocking transaction is already in progress.

  • kStatus_I3C_SlaveCountExceed – The I3C slave count has exceed the definition in I3C_MAX_DEVCNT.

static inline status_t I3C_MasterProcessDAA(I3C_Type *base, uint8_t *addressList, uint32_t count)

Performs a DAA in the i3c bus.

Parameters:
  • base – The I3C peripheral base address.

  • addressList – The pointer for address list which is used to do DAA.

  • count – The address count in the address list. The initial setting is set back between the completion of the DAA and the return of this function.

Return values:
  • kStatus_Success – The transaction was started successfully.

  • kStatus_I3C_Busy – Either another master is currently utilizing the bus, or a non-blocking transaction is already in progress.

  • kStatus_I3C_SlaveCountExceed – The I3C slave count has exceed the definition in I3C_MAX_DEVCNT.

i3c_device_info_t *I3C_MasterGetDeviceListAfterDAA(I3C_Type *base, uint8_t *count)

Get device information list after DAA process is done.

Parameters:
  • base – The I3C peripheral base address.

  • count[out] The pointer to store the available device count.

Returns:

Pointer to the i3c_device_info_t array.

void I3C_MasterClearDeviceCount(I3C_Type *base)

Clear the global device count which represents current devices number on the bus. When user resets all dynamic addresses on the bus, should call this API.

Parameters:
  • base – The I3C peripheral base address.

status_t I3C_MasterTransferBlocking(I3C_Type *base, i3c_master_transfer_t *transfer)

Performs a master polling transfer on the I2C/I3C bus.

Note

The API does not return until the transfer succeeds or fails due to error happens during transfer.

Parameters:
  • base – The I3C peripheral base address.

  • transfer – Pointer to the transfer structure.

Return values:
  • kStatus_Success – Data was received successfully.

  • kStatus_I3C_Busy – Another master is currently utilizing the bus.

  • kStatus_I3C_IBIWon – The I3C slave event IBI or MR or HJ won the arbitration on a header address.

  • kStatus_I3C_Timeout – The module has stalled too long in a frame.

  • kStatus_I3C_Nak – The slave device sent a NAK in response to an address.

  • kStatus_I3C_WriteAbort – The slave device sent a NAK in response to a write.

  • kStatus_I3C_Term – The master terminates slave read.

  • kStatus_I3C_HdrParityError – Parity error from DDR read.

  • kStatus_I3C_CrcError – CRC error from DDR read.

  • kStatus_I3C_MsgError – Message SDR/DDR mismatch or read/write message in wrong state.

  • kStatus_I3C_ReadFifoError – Read from M/SRDATAB register when FIFO empty.

  • kStatus_I3C_WriteFifoError – Write to M/SWDATAB register when FIFO full.

  • kStatus_I3C_InvalidReq – Invalid use of request.

status_t I3C_SlaveSend(I3C_Type *base, const void *txBuff, size_t txSize)

Performs a polling send transfer on the I3C bus.

Parameters:
  • base – The I3C peripheral base address.

  • txBuff – The pointer to the data to be transferred.

  • txSize – The length in bytes of the data to be transferred.

Returns:

Error or success status returned by API.

status_t I3C_SlaveReceive(I3C_Type *base, void *rxBuff, size_t rxSize)

Performs a polling receive transfer on the I3C bus.

Parameters:
  • base – The I3C peripheral base address.

  • rxBuff – The pointer to the data to be transferred.

  • rxSize – The length in bytes of the data to be transferred.

Returns:

Error or success status returned by API.

void I3C_MasterTransferCreateHandle(I3C_Type *base, i3c_master_handle_t *handle, const i3c_master_transfer_callback_t *callback, void *userData)

Creates a new handle for the I3C 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 I3C_MasterTransferAbort() API shall be called.

Note

The function also enables the NVIC IRQ for the input I3C. Need to notice that on some SoCs the I3C IRQ is connected to INTMUX, in this case user needs to enable the associated INTMUX IRQ in application.

Parameters:
  • base – The I3C peripheral base address.

  • handle[out] Pointer to the I3C master driver handle.

  • callback – User provided pointer to the asynchronous callback function.

  • userData – User provided pointer to the application callback data.

status_t I3C_MasterTransferNonBlocking(I3C_Type *base, i3c_master_handle_t *handle, i3c_master_transfer_t *transfer)

Performs a non-blocking transaction on the I2C/I3C bus.

Parameters:
  • base – The I3C peripheral base address.

  • handle – Pointer to the I3C master driver handle.

  • transfer – The pointer to the transfer descriptor.

Return values:
  • kStatus_Success – The transaction was started successfully.

  • kStatus_I3C_Busy – Either another master is currently utilizing the bus, or a non-blocking transaction is already in progress.

status_t I3C_MasterTransferGetCount(I3C_Type *base, i3c_master_handle_t *handle, size_t *count)

Returns number of bytes transferred so far.

Parameters:
  • base – The I3C peripheral base address.

  • handle – Pointer to the I3C 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 I3C_MasterTransferAbort(I3C_Type *base, i3c_master_handle_t *handle)

Terminates a non-blocking I3C master transmission early.

Note

It is not safe to call this function from an IRQ handler that has a higher priority than the I3C peripheral’s IRQ priority.

Parameters:
  • base – The I3C peripheral base address.

  • handle – Pointer to the I3C master driver handle.

Return values:
  • kStatus_Success – A transaction was successfully aborted.

  • kStatus_I3C_Idle – There is not a non-blocking transaction currently in progress.

void I3C_MasterTransferHandleIRQ(I3C_Type *base, void *intHandle)

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 I3C peripheral base address.

  • intHandle – Pointer to the I3C master driver handle.

enum _i3c_master_flags

I3C master peripheral flags.

The following status register flags can be cleared:

  • kI3C_MasterSlaveStartFlag

  • kI3C_MasterControlDoneFlag

  • kI3C_MasterCompleteFlag

  • kI3C_MasterArbitrationWonFlag

  • kI3C_MasterSlave2MasterFlag

All flags except kI3C_MasterBetweenFlag and kI3C_MasterNackDetectFlag can be enabled as interrupts.

Note

These enums are meant to be OR’d together to form a bit mask.

Values:

enumerator kI3C_MasterBetweenFlag

Between messages/DAAs flag

enumerator kI3C_MasterNackDetectFlag

NACK detected flag

enumerator kI3C_MasterSlaveStartFlag

Slave request start flag

enumerator kI3C_MasterControlDoneFlag

Master request complete flag

enumerator kI3C_MasterCompleteFlag

Transfer complete flag

enumerator kI3C_MasterRxReadyFlag

Rx data ready in Rx buffer flag

enumerator kI3C_MasterTxReadyFlag

Tx buffer ready for Tx data flag

enumerator kI3C_MasterArbitrationWonFlag

Header address won arbitration flag

enumerator kI3C_MasterErrorFlag

Error occurred flag

enumerator kI3C_MasterSlave2MasterFlag

Switch from slave to master flag

enumerator kI3C_MasterClearFlags
enum _i3c_master_error_flags

I3C master error flags to indicate the causes.

Note

These enums are meant to be OR’d together to form a bit mask.

Values:

enumerator kI3C_MasterErrorNackFlag

Slave NACKed the last address

enumerator kI3C_MasterErrorWriteAbortFlag

Slave NACKed the write data

enumerator kI3C_MasterErrorParityFlag

Parity error from DDR read

enumerator kI3C_MasterErrorCrcFlag

CRC error from DDR read

enumerator kI3C_MasterErrorReadFlag

Read from MRDATAB register when FIFO empty

enumerator kI3C_MasterErrorWriteFlag

Write to MWDATAB register when FIFO full

enumerator kI3C_MasterErrorMsgFlag

Message SDR/DDR mismatch or read/write message in wrong state

enumerator kI3C_MasterErrorInvalidReqFlag

Invalid use of request

enumerator kI3C_MasterErrorTimeoutFlag

The module has stalled too long in a frame

enumerator kI3C_MasterAllErrorFlags

All error flags

enum _i3c_master_state

I3C working master state.

Values:

enumerator kI3C_MasterStateIdle

Bus stopped.

enumerator kI3C_MasterStateSlvReq

Bus stopped but slave holding SDA low.

enumerator kI3C_MasterStateMsgSdr

In SDR Message mode from using MWMSG_SDR.

enumerator kI3C_MasterStateNormAct

In normal active SDR mode.

enumerator kI3C_MasterStateDdr

In DDR Message mode.

enumerator kI3C_MasterStateDaa

In ENTDAA mode.

enumerator kI3C_MasterStateIbiAck

Waiting on IBI ACK/NACK decision.

enumerator kI3C_MasterStateIbiRcv

Receiving IBI.

enum _i3c_master_enable

I3C master enable configuration.

Values:

enumerator kI3C_MasterOff

Master off.

enumerator kI3C_MasterOn

Master on.

enumerator kI3C_MasterCapable

Master capable.

enum _i3c_master_hkeep

I3C high keeper configuration.

Values:

enumerator kI3C_MasterHighKeeperNone

Use PUR to hold SCL high.

enumerator kI3C_MasterHighKeeperWiredIn

Use pin_HK controls.

enumerator kI3C_MasterPassiveSDA

Hi-Z for Bus Free and hold SDA.

enumerator kI3C_MasterPassiveSDASCL

Hi-Z both for Bus Free, and can Hi-Z SDA for hold.

enum _i3c_bus_request

Emits the requested operation when doing in pieces vs. by message.

Values:

enumerator kI3C_RequestNone

No request.

enumerator kI3C_RequestEmitStartAddr

Request to emit start and address on bus.

enumerator kI3C_RequestEmitStop

Request to emit stop on bus.

enumerator kI3C_RequestIbiAckNack

Manual IBI ACK or NACK.

enumerator kI3C_RequestProcessDAA

Process DAA.

enumerator kI3C_RequestForceExit

Request to force exit.

enumerator kI3C_RequestAutoIbi

Hold in stopped state, but Auto-emit START,7E.

enum _i3c_bus_type

Bus type with EmitStartAddr.

Values:

enumerator kI3C_TypeI3CSdr

SDR mode of I3C.

enumerator kI3C_TypeI2C

Standard i2c protocol.

enumerator kI3C_TypeI3CDdr

HDR-DDR mode of I3C.

enum _i3c_ibi_response

IBI response.

Values:

enumerator kI3C_IbiRespAck

ACK with no mandatory byte.

enumerator kI3C_IbiRespNack

NACK.

enumerator kI3C_IbiRespAckMandatory

ACK with mandatory byte.

enumerator kI3C_IbiRespManual

Reserved.

enum _i3c_ibi_type

IBI type.

Values:

enumerator kI3C_IbiNormal

In-band interrupt.

enumerator kI3C_IbiHotJoin

slave hot join.

enumerator kI3C_IbiMasterRequest

slave master ship request.

enum _i3c_ibi_state

IBI state.

Values:

enumerator kI3C_IbiReady

In-band interrupt ready state, ready for user to handle.

enumerator kI3C_IbiDataBuffNeed

In-band interrupt need data buffer for data receive.

enumerator kI3C_IbiAckNackPending

In-band interrupt Ack/Nack pending for decision.

enum _i3c_direction

Direction of master and slave transfers.

Values:

enumerator kI3C_Write

Master transmit.

enumerator kI3C_Read

Master receive.

enum _i3c_tx_trigger_level

Watermark of TX int/dma trigger level.

Values:

enumerator kI3C_TxTriggerOnEmpty

Trigger on empty.

enumerator kI3C_TxTriggerUntilOneQuarterOrLess

Trigger on 1/4 full or less.

enumerator kI3C_TxTriggerUntilOneHalfOrLess

Trigger on 1/2 full or less.

enumerator kI3C_TxTriggerUntilOneLessThanFull

Trigger on 1 less than full or less.

enum _i3c_rx_trigger_level

Watermark of RX int/dma trigger level.

Values:

enumerator kI3C_RxTriggerOnNotEmpty

Trigger on not empty.

enumerator kI3C_RxTriggerUntilOneQuarterOrMore

Trigger on 1/4 full or more.

enumerator kI3C_RxTriggerUntilOneHalfOrMore

Trigger on 1/2 full or more.

enumerator kI3C_RxTriggerUntilThreeQuarterOrMore

Trigger on 3/4 full or more.

enum _i3c_rx_term_ops

I3C master read termination operations.

Values:

enumerator kI3C_RxTermDisable

Master doesn’t terminate read, used for CCC transfer.

enumerator kI3C_RxAutoTerm

Master auto terminate read after receiving specified bytes(<=255).

enumerator kI3C_RxTermLastByte

Master terminates read at any time after START, no length limitation.

enum _i3c_start_scl_delay

I3C start SCL delay options.

Values:

enumerator kI3C_NoDelay

No delay.

enumerator kI3C_IncreaseSclHalfPeriod

Increases SCL clock period by 1/2.

enumerator kI3C_IncreaseSclOnePeriod

Increases SCL clock period by 1.

enumerator kI3C_IncreaseSclOneAndHalfPeriod

Increases SCL clock period by 1 1/2

enum _i3c_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 _i3c_master_transfer::flags field.

Values:

enumerator kI3C_TransferDefaultFlag

Transfer starts with a start signal, stops with a stop signal.

enumerator kI3C_TransferNoStartFlag

Don’t send a start condition, address, and sub address

enumerator kI3C_TransferRepeatedStartFlag

Send a repeated start condition

enumerator kI3C_TransferNoStopFlag

Don’t send a stop condition.

enumerator kI3C_TransferWordsFlag

Transfer in words, else transfer in bytes.

enumerator kI3C_TransferDisableRxTermFlag

Disable Rx termination. Note: It’s for I3C CCC transfer.

enumerator kI3C_TransferRxAutoTermFlag

Set Rx auto-termination. Note: It’s adaptive based on Rx size(<=255 bytes) except in I3C_MasterReceive.

enumerator kI3C_TransferStartWithBroadcastAddr

Start transfer with 0x7E, then read/write data with device address.

typedef enum _i3c_master_state i3c_master_state_t

I3C working master state.

typedef enum _i3c_master_enable i3c_master_enable_t

I3C master enable configuration.

typedef enum _i3c_master_hkeep i3c_master_hkeep_t

I3C high keeper configuration.

typedef enum _i3c_bus_request i3c_bus_request_t

Emits the requested operation when doing in pieces vs. by message.

typedef enum _i3c_bus_type i3c_bus_type_t

Bus type with EmitStartAddr.

typedef enum _i3c_ibi_response i3c_ibi_response_t

IBI response.

typedef enum _i3c_ibi_type i3c_ibi_type_t

IBI type.

typedef enum _i3c_ibi_state i3c_ibi_state_t

IBI state.

typedef enum _i3c_direction i3c_direction_t

Direction of master and slave transfers.

typedef enum _i3c_tx_trigger_level i3c_tx_trigger_level_t

Watermark of TX int/dma trigger level.

typedef enum _i3c_rx_trigger_level i3c_rx_trigger_level_t

Watermark of RX int/dma trigger level.

typedef enum _i3c_rx_term_ops i3c_rx_term_ops_t

I3C master read termination operations.

typedef enum _i3c_start_scl_delay i3c_start_scl_delay_t

I3C start SCL delay options.

typedef struct _i3c_register_ibi_addr i3c_register_ibi_addr_t

Structure with setting master IBI rules and slave registry.

typedef struct _i3c_baudrate i3c_baudrate_hz_t

Structure with I3C baudrate settings.

typedef struct _i3c_master_daa_baudrate i3c_master_daa_baudrate_t

I3C DAA baud rate configuration.

typedef struct _i3c_master_config i3c_master_config_t

Structure with settings to initialize the I3C master module.

This structure holds configuration settings for the I3C peripheral. To initialize this structure to reasonable defaults, call the I3C_MasterGetDefaultConfig() function and pass a pointer to your configuration structure instance.

The configuration structure can be made constant so it resides in flash.

typedef struct _i3c_master_transfer i3c_master_transfer_t
typedef struct _i3c_master_handle i3c_master_handle_t
typedef struct _i3c_master_transfer_callback i3c_master_transfer_callback_t

i3c master callback functions.

typedef void (*i3c_master_isr_t)(I3C_Type *base, void *handle)

Typedef for master interrupt handler.

struct _i3c_register_ibi_addr
#include <fsl_i3c.h>

Structure with setting master IBI rules and slave registry.

Public Members

uint8_t address[5]

Address array for registry.

bool ibiHasPayload

Whether the address array has mandatory IBI byte.

struct _i3c_baudrate
#include <fsl_i3c.h>

Structure with I3C baudrate settings.

Public Members

uint32_t i2cBaud

Desired I2C baud rate in Hertz.

uint32_t i3cPushPullBaud

Desired I3C push-pull baud rate in Hertz.

uint32_t i3cOpenDrainBaud

Desired I3C open-drain baud rate in Hertz.

struct _i3c_master_daa_baudrate
#include <fsl_i3c.h>

I3C DAA baud rate configuration.

Public Members

uint32_t sourceClock_Hz

FCLK, function clock in Hertz.

uint32_t i3cPushPullBaud

Desired I3C push-pull baud rate in Hertz.

uint32_t i3cOpenDrainBaud

Desired I3C open-drain baud rate in Hertz.

struct _i3c_master_config
#include <fsl_i3c.h>

Structure with settings to initialize the I3C master module.

This structure holds configuration settings for the I3C peripheral. To initialize this structure to reasonable defaults, call the I3C_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

i3c_master_enable_t enableMaster

Enable master mode.

bool disableTimeout

Whether to disable timeout to prevent the ERRWARN.

i3c_master_hkeep_t hKeep

High keeper mode setting.

bool enableOpenDrainStop

Whether to emit open-drain speed STOP.

bool enableOpenDrainHigh

Enable Open-Drain High to be 1 PPBAUD count for i3c messages, or 1 ODBAUD.

i3c_baudrate_hz_t baudRate_Hz

Desired baud rate settings.

struct _i3c_master_transfer_callback
#include <fsl_i3c.h>

i3c master callback functions.

Public Members

void (*slave2Master)(I3C_Type *base, void *userData)

Transfer complete callback

void (*ibiCallback)(I3C_Type *base, i3c_master_handle_t *handle, i3c_ibi_type_t ibiType, i3c_ibi_state_t ibiState)

IBI event callback

void (*transferComplete)(I3C_Type *base, i3c_master_handle_t *handle, status_t completionStatus, void *userData)

Transfer complete callback

struct _i3c_master_transfer
#include <fsl_i3c.h>

Non-blocking transfer descriptor structure.

This structure is used to pass transaction parameters to the I3C_MasterTransferNonBlocking() API.

Public Members

uint32_t flags

Bit mask of options for the transfer. See enumeration _i3c_master_transfer_flags for available options. Set to 0 or kI3C_TransferDefaultFlag for normal transfers.

uint8_t slaveAddress

The 7-bit slave address.

i3c_direction_t direction

Either kI3C_Read or kI3C_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.

i3c_bus_type_t busType

bus type.

i3c_ibi_response_t ibiResponse

ibi response during transfer.

struct _i3c_master_handle
#include <fsl_i3c.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.

uint32_t remainingBytes

Remaining byte count in current state.

i3c_rx_term_ops_t rxTermOps

Read termination operation.

i3c_master_transfer_t transfer

Copy of the current transfer info.

uint8_t ibiAddress

Slave address which request IBI.

uint8_t *ibiBuff

Pointer to IBI buffer to keep ibi bytes.

size_t ibiPayloadSize

IBI payload size.

i3c_ibi_type_t ibiType

IBI type.

i3c_master_transfer_callback_t callback

Callback functions pointer.

void *userData

Application data passed to callback.

I3C Master DMA Driver

void I3C_MasterTransferCreateHandleEDMA(I3C_Type *base, i3c_master_edma_handle_t *handle, const i3c_master_edma_callback_t *callback, void *userData, edma_handle_t *rxDmaHandle, edma_handle_t *txDmaHandle)

Create a new handle for the I3C 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 I3C_MasterTransferAbortDMA() API shall be called.

For devices where the I3C send and receive DMA requests are OR’d together, the txDmaHandle parameter is ignored and may be set to NULL.

Parameters:
  • base – The I3C peripheral base address.

  • handle – Pointer to the I3C master driver handle.

  • callback – User provided pointer to the asynchronous callback function.

  • userData – User provided pointer to the application callback data.

  • rxDmaHandle – Handle for the DMA receive channel. Created by the user prior to calling this function.

  • txDmaHandle – Handle for the DMA transmit channel. Created by the user prior to calling this function.

status_t I3C_MasterTransferEDMA(I3C_Type *base, i3c_master_edma_handle_t *handle, i3c_master_transfer_t *transfer)

Performs a non-blocking DMA-based transaction on the I3C bus.

The callback specified when the handle was created is invoked when the transaction has completed.

Parameters:
  • base – The I3C peripheral base address.

  • handle – Pointer to the I3C master driver handle.

  • transfer – The pointer to the transfer descriptor.

Return values:
  • kStatus_Success – The transaction was started successfully.

  • kStatus_I3C_Busy – Either another master is currently utilizing the bus, or another DMA transaction is already in progress.

status_t I3C_MasterTransferGetCountEDMA(I3C_Type *base, i3c_master_edma_handle_t *handle, size_t *count)

Returns number of bytes transferred so far.

Parameters:
  • base – The I3C peripheral base address.

  • handle – Pointer to the I3C 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.

void I3C_MasterTransferAbortEDMA(I3C_Type *base, i3c_master_edma_handle_t *handle)

Terminates a non-blocking I3C master transmission early.

Note

It is not safe to call this function from an IRQ handler that has a higher priority than the DMA peripheral’s IRQ priority.

Parameters:
  • base – The I3C peripheral base address.

  • handle – Pointer to the I3C master driver handle.

void I3C_MasterTransferEDMAHandleIRQ(I3C_Type *base, void *i3cHandle)

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 I3C peripheral base address.

  • i3cHandle – Pointer to the I3C master DMA driver handle.

typedef struct _i3c_master_edma_handle i3c_master_edma_handle_t
typedef struct _i3c_master_edma_callback i3c_master_edma_callback_t

i3c master callback functions.

struct _i3c_master_edma_callback
#include <fsl_i3c_edma.h>

i3c master callback functions.

Public Members

void (*slave2Master)(I3C_Type *base, void *userData)

Transfer complete callback

void (*ibiCallback)(I3C_Type *base, i3c_master_edma_handle_t *handle, i3c_ibi_type_t ibiType, i3c_ibi_state_t ibiState)

IBI event callback

void (*transferComplete)(I3C_Type *base, i3c_master_edma_handle_t *handle, status_t status, void *userData)

Transfer complete callback

struct _i3c_master_edma_handle
#include <fsl_i3c_edma.h>

Driver handle for master EDMA APIs.

Note

The contents of this structure are private and subject to change.

Public Members

I3C_Type *base

I3C base pointer.

uint8_t state

Transfer state machine current state.

uint32_t transferCount

Indicates progress of the transfer

uint8_t subaddressBuffer[4]

Saving subaddress command.

uint8_t subaddressCount

Saving command count.

i3c_master_transfer_t transfer

Copy of the current transfer info.

i3c_master_edma_callback_t callback

Callback function pointer.

void *userData

Application data passed to callback.

edma_handle_t *rxDmaHandle

Handle for receive DMA channel.

edma_handle_t *txDmaHandle

Handle for transmit DMA channel.

uint8_t ibiAddress

Slave address which request IBI.

uint8_t *ibiBuff

Pointer to IBI buffer to keep ibi bytes.

size_t ibiPayloadSize

IBI payload size.

i3c_ibi_type_t ibiType

IBI type.

I3C Slave Driver

void I3C_SlaveGetDefaultConfig(i3c_slave_config_t *slaveConfig)

Provides a default configuration for the I3C slave peripheral.

This function provides the following default configuration for the I3C slave peripheral:

slaveConfig->enableslave             = true;

After calling this function, you can override any settings in order to customize the configuration, prior to initializing the slave driver with I3C_SlaveInit().

Parameters:
  • slaveConfig[out] User provided configuration structure for default values. Refer to i3c_slave_config_t.

void I3C_SlaveInit(I3C_Type *base, const i3c_slave_config_t *slaveConfig, uint32_t slowClock_Hz)

Initializes the I3C slave peripheral.

This function enables the peripheral clock and initializes the I3C slave peripheral as described by the user provided configuration.

Parameters:
  • base – The I3C peripheral base address.

  • slaveConfig – User provided peripheral configuration. Use I3C_SlaveGetDefaultConfig() to get a set of defaults that you can override.

  • slowClock_Hz – Frequency in Hertz of the I3C slow clock. Used to calculate the bus match condition values. If FSL_FEATURE_I3C_HAS_NO_SCONFIG_BAMATCH defines as 1, this parameter is useless.

void I3C_SlaveDeinit(I3C_Type *base)

Deinitializes the I3C slave peripheral.

This function disables the I3C slave peripheral and gates the clock.

Parameters:
  • base – The I3C peripheral base address.

static inline void I3C_SlaveEnable(I3C_Type *base, bool isEnable)

Enable/Disable Slave.

Parameters:
  • base – The I3C peripheral base address.

  • isEnable – Enable or disable.

static inline uint32_t I3C_SlaveGetStatusFlags(I3C_Type *base)

Gets the I3C slave status flags.

A bit mask with the state of all I3C slave status flags is returned. For each flag, the corresponding bit in the return value is set if the flag is asserted.

See also

_i3c_slave_flags

Parameters:
  • base – The I3C 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 I3C_SlaveClearStatusFlags(I3C_Type *base, uint32_t statusMask)

Clears the I3C slave status flag state.

The following status register flags can be cleared:

  • kI3C_SlaveBusStartFlag

  • kI3C_SlaveMatchedFlag

  • kI3C_SlaveBusStopFlag

Attempts to clear other flags has no effect.

See also

_i3c_slave_flags.

Parameters:
  • base – The I3C peripheral base address.

  • statusMask – A bitmask of status flags that are to be cleared. The mask is composed of _i3c_slave_flags enumerators OR’d together. You may pass the result of a previous call to I3C_SlaveGetStatusFlags().

static inline uint32_t I3C_SlaveGetErrorStatusFlags(I3C_Type *base)

Gets the I3C slave error status flags.

A bit mask with the state of all I3C slave error status flags is returned. For each flag, the corresponding bit in the return value is set if the flag is asserted.

See also

_i3c_slave_error_flags

Parameters:
  • base – The I3C peripheral base address.

Returns:

State of the error status flags:

  • 1: related status flag is set.

  • 0: related status flag is not set.

static inline void I3C_SlaveClearErrorStatusFlags(I3C_Type *base, uint32_t statusMask)

Clears the I3C slave error status flag state.

See also

_i3c_slave_error_flags.

Parameters:
  • base – The I3C peripheral base address.

  • statusMask – A bitmask of error status flags that are to be cleared. The mask is composed of _i3c_slave_error_flags enumerators OR’d together. You may pass the result of a previous call to I3C_SlaveGetErrorStatusFlags().

i3c_slave_activity_state_t I3C_SlaveGetActivityState(I3C_Type *base)

Gets the I3C slave state.

Parameters:
  • base – The I3C peripheral base address.

Returns:

I3C slave activity state, refer i3c_slave_activity_state_t.

status_t I3C_SlaveCheckAndClearError(I3C_Type *base, uint32_t status)
static inline void I3C_SlaveEnableInterrupts(I3C_Type *base, uint32_t interruptMask)

Enables the I3C slave interrupt requests.

Only below flags can be enabled as interrupts.

  • kI3C_SlaveBusStartFlag

  • kI3C_SlaveMatchedFlag

  • kI3C_SlaveBusStopFlag

  • kI3C_SlaveRxReadyFlag

  • kI3C_SlaveTxReadyFlag

  • kI3C_SlaveDynamicAddrChangedFlag

  • kI3C_SlaveReceivedCCCFlag

  • kI3C_SlaveErrorFlag

  • kI3C_SlaveHDRCommandMatchFlag

  • kI3C_SlaveCCCHandledFlag

  • kI3C_SlaveEventSentFlag

Parameters:
  • base – The I3C peripheral base address.

  • interruptMask – Bit mask of interrupts to enable. See _i3c_slave_flags for the set of constants that should be OR’d together to form the bit mask.

static inline void I3C_SlaveDisableInterrupts(I3C_Type *base, uint32_t interruptMask)

Disables the I3C slave interrupt requests.

Only below flags can be disabled as interrupts.

  • kI3C_SlaveBusStartFlag

  • kI3C_SlaveMatchedFlag

  • kI3C_SlaveBusStopFlag

  • kI3C_SlaveRxReadyFlag

  • kI3C_SlaveTxReadyFlag

  • kI3C_SlaveDynamicAddrChangedFlag

  • kI3C_SlaveReceivedCCCFlag

  • kI3C_SlaveErrorFlag

  • kI3C_SlaveHDRCommandMatchFlag

  • kI3C_SlaveCCCHandledFlag

  • kI3C_SlaveEventSentFlag

Parameters:
  • base – The I3C peripheral base address.

  • interruptMask – Bit mask of interrupts to disable. See _i3c_slave_flags for the set of constants that should be OR’d together to form the bit mask.

static inline uint32_t I3C_SlaveGetEnabledInterrupts(I3C_Type *base)

Returns the set of currently enabled I3C slave interrupt requests.

Parameters:
  • base – The I3C peripheral base address.

Returns:

A bitmask composed of _i3c_slave_flags enumerators OR’d together to indicate the set of enabled interrupts.

static inline uint32_t I3C_SlaveGetPendingInterrupts(I3C_Type *base)

Returns the set of pending I3C slave interrupt requests.

Parameters:
  • base – The I3C peripheral base address.

Returns:

A bitmask composed of _i3c_slave_flags enumerators OR’d together to indicate the set of pending interrupts.

static inline void I3C_SlaveEnableDMA(I3C_Type *base, bool enableTx, bool enableRx, uint32_t width)

Enables or disables I3C slave DMA requests.

Parameters:
  • base – The I3C 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.

  • width – DMA read/write unit in bytes.

static inline uint32_t I3C_SlaveGetTxFifoAddress(I3C_Type *base, uint32_t width)

Gets I3C slave transmit data register address for DMA transfer.

Parameters:
  • base – The I3C peripheral base address.

  • width – DMA read/write unit in bytes.

Returns:

The I3C Slave Transmit Data Register address.

static inline uint32_t I3C_SlaveGetRxFifoAddress(I3C_Type *base, uint32_t width)

Gets I3C slave receive data register address for DMA transfer.

Parameters:
  • base – The I3C peripheral base address.

  • width – DMA read/write unit in bytes.

Returns:

The I3C Slave Receive Data Register address.

static inline void I3C_SlaveSetWatermarks(I3C_Type *base, i3c_tx_trigger_level_t txLvl, i3c_rx_trigger_level_t rxLvl, bool flushTx, bool flushRx)

Sets the watermarks for I3C slave FIFOs.

Parameters:
  • base – The I3C peripheral base address.

  • txLvl – Transmit FIFO watermark level. The kI3C_SlaveTxReadyFlag flag is set whenever the number of words in the transmit FIFO reaches txLvl.

  • rxLvl – Receive FIFO watermark level. The kI3C_SlaveRxReadyFlag flag is set whenever the number of words in the receive FIFO reaches rxLvl.

  • flushTx – true if TX FIFO is to be cleared, otherwise TX FIFO remains unchanged.

  • flushRx – true if RX FIFO is to be cleared, otherwise RX FIFO remains unchanged.

static inline void I3C_SlaveGetFifoCounts(I3C_Type *base, size_t *rxCount, size_t *txCount)

Gets the current number of bytes in the I3C slave FIFOs.

Parameters:
  • base – The I3C peripheral base address.

  • txCount[out] Pointer through which the current number of bytes in the transmit FIFO is returned. Pass NULL if this value is not required.

  • rxCount[out] Pointer through which the current number of bytes in the receive FIFO is returned. Pass NULL if this value is not required.

status_t I3C_SlaveSend(I3C_Type *base, const void *txBuff, size_t txSize)

Performs a polling send transfer on the I3C bus.

Parameters:
  • base – The I3C peripheral base address.

  • txBuff – The pointer to the data to be transferred.

  • txSize – The length in bytes of the data to be transferred.

Returns:

Error or success status returned by API.

status_t I3C_SlaveReceive(I3C_Type *base, void *rxBuff, size_t rxSize)

Performs a polling receive transfer on the I3C bus.

Parameters:
  • base – The I3C peripheral base address.

  • rxBuff – The pointer to the data to be transferred.

  • rxSize – The length in bytes of the data to be transferred.

Returns:

Error or success status returned by API.

void I3C_SlaveTransferCreateHandle(I3C_Type *base, i3c_slave_handle_t *handle, i3c_slave_transfer_callback_t callback, void *userData)

Creates a new handle for the I3C 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 I3C_SlaveTransferAbort() API shall be called.

Note

The function also enables the NVIC IRQ for the input I3C. Need to notice that on some SoCs the I3C IRQ is connected to INTMUX, in this case user needs to enable the associated INTMUX IRQ in application.

Parameters:
  • base – The I3C peripheral base address.

  • handle[out] Pointer to the I3C slave driver handle.

  • callback – User provided pointer to the asynchronous callback function.

  • userData – User provided pointer to the application callback data.

status_t I3C_SlaveTransferNonBlocking(I3C_Type *base, i3c_slave_handle_t *handle, uint32_t eventMask)

Starts accepting slave transfers.

Call this API after calling I2C_SlaveInit() and I3C_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 I3C_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 i3c_slave_transfer_event_t enumerators for the events you wish to receive. The kI3C_SlaveTransmitEvent and kI3C_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 kI3C_SlaveAllEvents constant is provided as a convenient way to enable all events.

Parameters:
  • base – The I3C peripheral base address.

  • handle – Pointer to struct: _i3c_slave_handle structure which stores the transfer state.

  • eventMask – Bit mask formed by OR’ing together i3c_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 kI3C_SlaveAllEvents to enable all events.

Return values:
  • kStatus_Success – Slave transfers were successfully started.

  • kStatus_I3C_Busy – Slave transfers have already been started on this handle.

status_t I3C_SlaveTransferGetCount(I3C_Type *base, i3c_slave_handle_t *handle, size_t *count)

Gets the slave transfer status during a non-blocking transfer.

Parameters:
  • base – The I3C 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 I3C_SlaveTransferAbort(I3C_Type *base, i3c_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 I3C peripheral base address.

  • handle – Pointer to struct: _i3c_slave_handle structure which stores the transfer state.

Return values:
  • kStatus_Success

  • kStatus_I3C_Idle

void I3C_SlaveTransferHandleIRQ(I3C_Type *base, void *intHandle)

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 I3C peripheral base address.

  • intHandle – Pointer to struct: _i3c_slave_handle structure which stores the transfer state.

enum _i3c_slave_flags

I3C slave peripheral flags.

The following status register flags can be cleared:

  • kI3C_SlaveBusStartFlag

  • kI3C_SlaveMatchedFlag

  • kI3C_SlaveBusStopFlag

Only below flags can be enabled as interrupts.

  • kI3C_SlaveBusStartFlag

  • kI3C_SlaveMatchedFlag

  • kI3C_SlaveBusStopFlag

  • kI3C_SlaveRxReadyFlag

  • kI3C_SlaveTxReadyFlag

  • kI3C_SlaveDynamicAddrChangedFlag

  • kI3C_SlaveReceivedCCCFlag

  • kI3C_SlaveErrorFlag

  • kI3C_SlaveHDRCommandMatchFlag

  • kI3C_SlaveCCCHandledFlag

  • kI3C_SlaveEventSentFlag

Note

These enums are meant to be OR’d together to form a bit mask.

Values:

enumerator kI3C_SlaveNotStopFlag

Slave status not stop flag

enumerator kI3C_SlaveMessageFlag

Slave status message, indicating slave is listening to the bus traffic or responding

enumerator kI3C_SlaveRequiredReadFlag

Slave status required, either is master doing SDR read from slave, or is IBI pushing out.

enumerator kI3C_SlaveRequiredWriteFlag

Slave status request write, master is doing SDR write to slave, except slave in ENTDAA mode

enumerator kI3C_SlaveBusDAAFlag

I3C bus is in ENTDAA mode

enumerator kI3C_SlaveBusHDRModeFlag

I3C bus is in HDR mode

enumerator kI3C_SlaveBusStartFlag

Start/Re-start event is seen since the bus was last cleared

enumerator kI3C_SlaveMatchedFlag

Slave address(dynamic/static) matched since last cleared

enumerator kI3C_SlaveBusStopFlag

Stop event is seen since the bus was last cleared

enumerator kI3C_SlaveRxReadyFlag

Rx data ready in rx buffer flag

enumerator kI3C_SlaveTxReadyFlag

Tx buffer ready for Tx data flag

enumerator kI3C_SlaveDynamicAddrChangedFlag

Slave dynamic address has been assigned, re-assigned, or lost

enumerator kI3C_SlaveReceivedCCCFlag

Slave received Common command code

enumerator kI3C_SlaveErrorFlag

Error occurred flag

enumerator kI3C_SlaveHDRCommandMatchFlag

High data rate command match

enumerator kI3C_SlaveCCCHandledFlag

Slave received Common command code is handled by I3C module

enumerator kI3C_SlaveEventSentFlag

Slave IBI/P2P/MR/HJ event has been sent

enumerator kI3C_SlaveIbiDisableFlag

Slave in band interrupt is disabled.

enumerator kI3C_SlaveMasterRequestDisabledFlag

Slave master request is disabled.

enumerator kI3C_SlaveHotJoinDisabledFlag

Slave Hot-Join is disabled.

enumerator kI3C_SlaveClearFlags

All flags which are cleared by the driver upon starting a transfer.

enumerator kI3C_SlaveAllIrqFlags
enum _i3c_slave_error_flags

I3C slave error flags to indicate the causes.

Note

These enums are meant to be OR’d together to form a bit mask.

Values:

enumerator kI3C_SlaveErrorOverrunFlag

Slave internal from-bus buffer/FIFO overrun.

enumerator kI3C_SlaveErrorUnderrunFlag

Slave internal to-bus buffer/FIFO underrun

enumerator kI3C_SlaveErrorUnderrunNakFlag

Slave internal from-bus buffer/FIFO underrun and NACK error

enumerator kI3C_SlaveErrorTermFlag

Terminate error from master

enumerator kI3C_SlaveErrorInvalidStartFlag

Slave invalid start flag

enumerator kI3C_SlaveErrorSdrParityFlag

SDR parity error

enumerator kI3C_SlaveErrorHdrParityFlag

HDR parity error

enumerator kI3C_SlaveErrorHdrCRCFlag

HDR-DDR CRC error

enumerator kI3C_SlaveErrorS0S1Flag

S0 or S1 error

enumerator kI3C_SlaveErrorOverreadFlag

Over-read error

enumerator kI3C_SlaveErrorOverwriteFlag

Over-write error

enum _i3c_slave_event

I3C slave.event.

Values:

enumerator kI3C_SlaveEventNormal

Normal mode.

enumerator kI3C_SlaveEventIBI

In band interrupt event.

enumerator kI3C_SlaveEventMasterReq

Master request event.

enumerator kI3C_SlaveEventHotJoinReq

Hot-join event.

enum _i3c_slave_activity_state

I3C slave.activity state.

Values:

enumerator kI3C_SlaveNoLatency

Normal bus operation

enumerator kI3C_SlaveLatency1Ms

1ms of latency.

enumerator kI3C_SlaveLatency100Ms

100ms of latency.

enumerator kI3C_SlaveLatency10S

10s latency.

enum _i3c_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 I3C_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 kI3C_SlaveAddressMatchEvent

Received the slave address after a start or repeated start.

enumerator kI3C_SlaveTransmitEvent

Callback is requested to provide data to transmit (slave-transmitter role).

enumerator kI3C_SlaveReceiveEvent

Callback is requested to provide a buffer in which to place received data (slave-receiver role).

enumerator kI3C_SlaveRequiredTransmitEvent

Callback is requested to provide a buffer in which to place received data (slave-receiver role).

enumerator kI3C_SlaveStartEvent

A start/repeated start was detected.

enumerator kI3C_SlaveHDRCommandMatchEvent

Slave Match HDR Command.

enumerator kI3C_SlaveCompletionEvent

A stop was detected, completing the transfer.

enumerator kI3C_SlaveRequestSentEvent

Slave request event sent.

enumerator kI3C_SlaveReceivedCCCEvent

Slave received CCC event, need to handle by application.

enumerator kI3C_SlaveAllEvents

Bit mask of all available events.

typedef enum _i3c_slave_event i3c_slave_event_t

I3C slave.event.

typedef enum _i3c_slave_activity_state i3c_slave_activity_state_t

I3C slave.activity state.

typedef struct _i3c_slave_config i3c_slave_config_t

Structure with settings to initialize the I3C slave module.

This structure holds configuration settings for the I3C peripheral. To initialize this structure to reasonable defaults, call the I3C_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 _i3c_slave_transfer_event i3c_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 I3C_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 _i3c_slave_transfer i3c_slave_transfer_t

I3C slave transfer structure.

typedef struct _i3c_slave_handle i3c_slave_handle_t
typedef void (*i3c_slave_transfer_callback_t)(I3C_Type *base, i3c_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 I3C_SlaveSetCallback() function after you have created a handle.

Param base:

Base address for the I3C 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.

typedef void (*i3c_slave_isr_t)(I3C_Type *base, void *handle)

Typedef for slave interrupt handler.

struct _i3c_slave_config
#include <fsl_i3c.h>

Structure with settings to initialize the I3C slave module.

This structure holds configuration settings for the I3C peripheral. To initialize this structure to reasonable defaults, call the I3C_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

Whether to enable slave.

uint8_t staticAddr

Static address.

uint16_t vendorID

Device vendor ID(manufacture ID).

uint32_t partNumber

Device part number info

uint8_t dcr

Device characteristics register information.

uint8_t bcr

Bus characteristics register information.

uint8_t hdrMode

Support hdr mode, could be OR logic in enumeration:i3c_hdr_mode_t.

bool nakAllRequest

Whether to reply NAK to all requests except broadcast CCC.

bool ignoreS0S1Error

Whether to ignore S0/S1 error in SDR mode.

bool offline

Whether to wait 60 us of bus quiet or HDR request to ensure slave track SDR mode safely.

bool matchSlaveStartStop

Whether to assert start/stop status only the time slave is addressed.

uint32_t maxWriteLength

Maximum write length.

uint32_t maxReadLength

Maximum read length.

struct _i3c_slave_transfer
#include <fsl_i3c.h>

I3C slave transfer structure.

Public Members

uint32_t event

Reason the callback is being invoked.

uint8_t *txData

Transfer buffer

size_t txDataSize

Transfer size

uint8_t *rxData

Transfer buffer

size_t rxDataSize

Transfer size

status_t completionStatus

Success or error code describing how the transfer completed. Only applies for kI3C_SlaveCompletionEvent.

size_t transferredCount

Number of bytes actually transferred since start or last repeated start.

struct _i3c_slave_handle
#include <fsl_i3c.h>

I3C slave handle structure.

Note

The contents of this structure are private and subject to change.

Public Members

i3c_slave_transfer_t transfer

I3C 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.

i3c_slave_transfer_callback_t callback

Callback function called at transfer event.

void *userData

Callback parameter passed to callback.

uint8_t txFifoSize

Tx Fifo size

I3C Slave DMA Driver

void I3C_SlaveTransferCreateHandleEDMA(I3C_Type *base, i3c_slave_edma_handle_t *handle, i3c_slave_edma_callback_t callback, void *userData, edma_handle_t *rxDmaHandle, edma_handle_t *txDmaHandle)

Create a new handle for the I3C slave 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 I3C_SlaveTransferAbortDMA() API shall be called.

For devices where the I3C send and receive DMA requests are OR’d together, the txDmaHandle parameter is ignored and may be set to NULL.

Parameters:
  • base – The I3C peripheral base address.

  • handle – Pointer to the I3C slave driver handle.

  • callback – User provided pointer to the asynchronous callback function.

  • userData – User provided pointer to the application callback data.

  • rxDmaHandle – Handle for the DMA receive channel. Created by the user prior to calling this function.

  • txDmaHandle – Handle for the DMA transmit channel. Created by the user prior to calling this function.

status_t I3C_SlaveTransferEDMA(I3C_Type *base, i3c_slave_edma_handle_t *handle, i3c_slave_edma_transfer_t *transfer, uint32_t eventMask)

Prepares for a non-blocking DMA-based transaction on the I3C bus.

The API will do DMA configuration according to the input transfer descriptor, and the data will be transferred when there’s bus master requesting transfer from/to this slave. So the timing of call to this API need be aligned with master application to ensure the transfer is executed as expected. Callback specified when the handle was created is invoked when the transaction has completed.

Parameters:
  • base – The I3C peripheral base address.

  • handle – Pointer to the I3C slave driver handle.

  • transfer – The pointer to the transfer descriptor.

  • eventMask – Bit mask formed by OR’ing together i3c_slave_transfer_event_t enumerators to specify which events to send to the callback. The transmit and receive events is not allowed to be enabled.

Return values:
  • kStatus_Success – The transaction was started successfully.

  • kStatus_I3C_Busy – Either another master is currently utilizing the bus, or another DMA transaction is already in progress.

  • kStatus_Fail – The transaction can’t be set.

void I3C_SlaveTransferAbortEDMA(I3C_Type *base, i3c_slave_edma_handle_t *handle)

Abort a slave edma non-blocking transfer in a early time.

Parameters:
  • base – I3C peripheral base address

  • handle – pointer to i3c_slave_edma_handle_t structure

void I3C_SlaveTransferEDMAHandleIRQ(I3C_Type *base, void *i3cHandle)

Reusable routine to handle slave 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 I3C peripheral base address.

  • i3cHandle – Pointer to the I3C slave DMA driver handle.

typedef struct _i3c_slave_edma_handle i3c_slave_edma_handle_t
typedef struct _i3c_slave_edma_transfer i3c_slave_edma_transfer_t

I3C slave transfer structure.

typedef void (*i3c_slave_edma_callback_t)(I3C_Type *base, i3c_slave_edma_transfer_t *transfer, void *userData)

Slave event callback function pointer type.

This callback is used only for the slave DMA transfer API.

Param base:

Base address for the I3C instance on which the event occurred.

Param handle:

Pointer to slave DMA transfer handle.

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 _i3c_slave_edma_transfer
#include <fsl_i3c_edma.h>

I3C slave transfer structure.

Public Members

uint32_t event

Reason the callback is being invoked.

uint8_t *txData

Transfer buffer

size_t txDataSize

Transfer size

uint8_t *rxData

Transfer buffer

size_t rxDataSize

Transfer size

status_t completionStatus

Success or error code describing how the transfer completed. Only applies for kI3C_SlaveCompletionEvent.

struct _i3c_slave_edma_handle
#include <fsl_i3c_edma.h>

I3C slave edma handle structure.

Note

The contents of this structure are private and subject to change.

Public Members

I3C_Type *base

I3C base pointer.

i3c_slave_edma_transfer_t transfer

I3C 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.

i3c_slave_edma_callback_t callback

Callback function called at transfer event.

edma_handle_t *rxDmaHandle

Handle for receive DMA channel.

edma_handle_t *txDmaHandle

Handle for transmit DMA channel.

void *userData

Callback parameter passed to callback.

INPUTMUX: Input Multiplexing Driver

FSL_INPUTMUX_DRIVER_VERSION

Group interrupt driver version for SDK.

enum _inputmux_connection_t

INPUTMUX connections type.

Values:

enumerator kINPUTMUX_GpioPort8Pin0ToPintsel
enumerator kINPUTMUX_GpioPort8Pin1ToPintsel
enumerator kINPUTMUX_GpioPort8Pin2ToPintsel
enumerator kINPUTMUX_GpioPort8Pin3ToPintsel
enumerator kINPUTMUX_GpioPort8Pin4ToPintsel
enumerator kINPUTMUX_GpioPort8Pin5ToPintsel
enumerator kINPUTMUX_GpioPort8Pin6ToPintsel
enumerator kINPUTMUX_GpioPort8Pin7ToPintsel
enumerator kINPUTMUX_GpioPort8Pin8ToPintsel
enumerator kINPUTMUX_GpioPort8Pin9ToPintsel
enumerator kINPUTMUX_GpioPort8Pin10ToPintsel
enumerator kINPUTMUX_GpioPort8Pin11ToPintsel
enumerator kINPUTMUX_GpioPort8Pin12ToPintsel
enumerator kINPUTMUX_GpioPort8Pin13ToPintsel
enumerator kINPUTMUX_GpioPort8Pin14ToPintsel
enumerator kINPUTMUX_GpioPort8Pin15ToPintsel
enumerator kINPUTMUX_GpioPort8Pin16ToPintsel
enumerator kINPUTMUX_GpioPort8Pin17ToPintsel
enumerator kINPUTMUX_GpioPort8Pin18ToPintsel
enumerator kINPUTMUX_GpioPort8Pin19ToPintsel
enumerator kINPUTMUX_GpioPort8Pin20ToPintsel
enumerator kINPUTMUX_GpioPort8Pin21ToPintsel
enumerator kINPUTMUX_GpioPort8Pin22ToPintsel
enumerator kINPUTMUX_GpioPort8Pin23ToPintsel
enumerator kINPUTMUX_GpioPort8Pin24ToPintsel
enumerator kINPUTMUX_GpioPort8Pin25ToPintsel
enumerator kINPUTMUX_GpioPort8Pin26ToPintsel
enumerator kINPUTMUX_GpioPort8Pin27ToPintsel
enumerator kINPUTMUX_GpioPort8Pin28ToPintsel
enumerator kINPUTMUX_GpioPort8Pin29ToPintsel
enumerator kINPUTMUX_GpioPort8Pin30ToPintsel
enumerator kINPUTMUX_GpioPort8Pin31ToPintsel
enumerator kINPUTMUX_GpioPort10Pin0ToPintsel
enumerator kINPUTMUX_GpioPort10Pin1ToPintsel
enumerator kINPUTMUX_GpioPort10Pin2ToPintsel
enumerator kINPUTMUX_GpioPort10Pin3ToPintsel
enumerator kINPUTMUX_GpioPort10Pin4ToPintsel
enumerator kINPUTMUX_GpioPort10Pin5ToPintsel
enumerator kINPUTMUX_GpioPort10Pin6ToPintsel
enumerator kINPUTMUX_GpioPort10Pin7ToPintsel
enumerator kINPUTMUX_GpioPort10Pin8ToPintsel
enumerator kINPUTMUX_GpioPort10Pin9ToPintsel
enumerator kINPUTMUX_GpioPort10Pin10ToPintsel
enumerator kINPUTMUX_GpioPort10Pin11ToPintsel
enumerator kINPUTMUX_GpioPort10Pin12ToPintsel
enumerator kINPUTMUX_GpioPort10Pin13ToPintsel
enumerator kINPUTMUX_GpioPort10Pin14ToPintsel
enumerator kINPUTMUX_GpioPort10Pin15ToPintsel
enumerator kINPUTMUX_GpioPort10Pin16ToPintsel
enumerator kINPUTMUX_GpioPort10Pin17ToPintsel

DSP Interrupt.

enumerator kINPUTMUX_Flexcomm17ToDspInterrupt
enumerator kINPUTMUX_Flexcomm18ToDspInterrupt
enumerator kINPUTMUX_Flexcomm19ToDspInterrupt
enumerator kINPUTMUX_Flexcomm20ToDspInterrupt
enumerator kINPUTMUX_Pmc1ToDspInterrupt
enumerator kINPUTMUX_Gpio8Irq0ToDspInterrupt
enumerator kINPUTMUX_Gpio8Irq1ToDspInterrupt
enumerator kINPUTMUX_Gpio9Irq0ToDspInterrupt
enumerator kINPUTMUX_Gpio9Irq1ToDspInterrupt
enumerator kINPUTMUX_Gpio10Irq0ToDspInterrupt
enumerator kINPUTMUX_Gpio10Irq1ToDspInterrupt
enumerator kINPUTMUX_Wdt2ToDspInterrupt
enumerator kINPUTMUX_Wdt3ToDspInterrupt
enumerator kINPUTMUX_Mu0BToDspInterrupt
enumerator kINPUTMUX_Mu3BToDspInterrupt
enumerator kINPUTMUX_Utick1ToDspInterrupt
enumerator kINPUTMUX_Mrt1ToDspInterrupt
enumerator kINPUTMUX_OsEventTimerToDspInterrupt
enumerator kINPUTMUX_Ctimer5ToDspInterrupt
enumerator kINPUTMUX_Ctimer6ToDspInterrupt
enumerator kINPUTMUX_Ctimer7ToDspInterrupt
enumerator kINPUTMUX_Rtc1AlarmToDspInterrupt
enumerator kINPUTMUX_Rtc1WakeupToDspInterrupt
enumerator kINPUTMUX_I3c2ToDspInterrupt
enumerator kINPUTMUX_I3c3ToDspInterrupt
enumerator kINPUTMUX_MicfilToDspInterrupt
enumerator kINPUTMUX_HwvadToDspInterrupt
enumerator kINPUTMUX_Dma2Irq0ToDspInterrupt
enumerator kINPUTMUX_Dma2Irq1ToDspInterrupt
enumerator kINPUTMUX_Dma2Irq2ToDspInterrupt
enumerator kINPUTMUX_Dma2Irq3ToDspInterrupt
enumerator kINPUTMUX_Dma2Irq4ToDspInterrupt
enumerator kINPUTMUX_Dma2Irq5ToDspInterrupt
enumerator kINPUTMUX_Dma2Irq6ToDspInterrupt
enumerator kINPUTMUX_Dma2Irq7ToDspInterrupt
enumerator kINPUTMUX_Dma3Irq0ToDspInterrupt
enumerator kINPUTMUX_Dma3Irq1ToDspInterrupt
enumerator kINPUTMUX_Dma3Irq2ToDspInterrupt
enumerator kINPUTMUX_Dma3Irq3ToDspInterrupt
enumerator kINPUTMUX_Dma3Irq4ToDspInterrupt
enumerator kINPUTMUX_Dma3Irq5ToDspInterrupt
enumerator kINPUTMUX_Dma3Irq6ToDspInterrupt
enumerator kINPUTMUX_Dma3Irq7ToDspInterrupt
enumerator kINPUTMUX_GpioInt0ToDspInterrupt
enumerator kINPUTMUX_GpioInt1ToDspInterrupt
enumerator kINPUTMUX_GpioInt2ToDspInterrupt
enumerator kINPUTMUX_GpioInt3ToDspInterrupt
enumerator kINPUTMUX_Sai3ToDspInterrupt
enumerator kINPUTMUX_CtInp0ToFlexcomm17
enumerator kINPUTMUX_CtInp1ToFlexcomm17
enumerator kINPUTMUX_CtInp2ToFlexcomm17
enumerator kINPUTMUX_CtInp3ToFlexcomm17
enumerator kINPUTMUX_Ct5Mat3ToFlexcomm17
enumerator kINPUTMUX_Ct6Mat3ToFlexcomm17
enumerator kINPUTMUX_Ct7Mat3ToFlexcomm17
enumerator kINPUTMUX_GpioInt1BMatchToFlexcomm17
enumerator kINPUTMUX_Cmp0OutToFlexcomm17
enumerator kINPUTMUX_Rtc0IrqToFlexcomm17
enumerator kINPUTMUX_CtInp0ToFlexcomm18
enumerator kINPUTMUX_CtInp1ToFlexcomm18
enumerator kINPUTMUX_CtInp2ToFlexcomm18
enumerator kINPUTMUX_CtInp3ToFlexcomm18
enumerator kINPUTMUX_Ct5Mat3ToFlexcomm18
enumerator kINPUTMUX_Ct6Mat3ToFlexcomm18
enumerator kINPUTMUX_Ct7Mat3ToFlexcomm18
enumerator kINPUTMUX_GpioInt1BMatchToFlexcomm18
enumerator kINPUTMUX_Cmp0OutToFlexcomm18
enumerator kINPUTMUX_Rtc0IrqToFlexcomm18
enumerator kINPUTMUX_CtInp0ToFlexcomm19
enumerator kINPUTMUX_CtInp1ToFlexcomm19
enumerator kINPUTMUX_CtInp2ToFlexcomm19
enumerator kINPUTMUX_CtInp3ToFlexcomm19
enumerator kINPUTMUX_Ct5Mat3ToFlexcomm19
enumerator kINPUTMUX_Ct6Mat3ToFlexcomm19
enumerator kINPUTMUX_Ct7Mat3ToFlexcomm19
enumerator kINPUTMUX_GpioInt1BMatchToFlexcomm19
enumerator kINPUTMUX_Cmp0OutToFlexcomm19
enumerator kINPUTMUX_Rtc0IrqToFlexcomm19
enumerator kINPUTMUX_CtInp0ToFlexcomm20
enumerator kINPUTMUX_CtInp1ToFlexcomm20
enumerator kINPUTMUX_CtInp2ToFlexcomm20
enumerator kINPUTMUX_CtInp3ToFlexcomm20
enumerator kINPUTMUX_Ct5Mat3ToFlexcomm20
enumerator kINPUTMUX_Ct6Mat3ToFlexcomm20
enumerator kINPUTMUX_Ct7Mat3ToFlexcomm20
enumerator kINPUTMUX_GpioInt1BMatchToFlexcomm20
enumerator kINPUTMUX_Cmp0OutToFlexcomm20
enumerator kINPUTMUX_Rtc0IrqToFlexcomm20
enumerator kINPUTMUX_Gpio0Irq0ToAdc0
enumerator kINPUTMUX_Gpio1Irq0ToAdc0
enumerator kINPUTMUX_Gpio2Irq0ToAdc0
enumerator kINPUTMUX_Gpio3Irq0ToAdc0
enumerator kINPUTMUX_Gpio4Irq0ToAdc0
enumerator kINPUTMUX_Gpio5Irq0ToAdc0
enumerator kINPUTMUX_Gpio6Irq0ToAdc0
enumerator kINPUTMUX_Gpio7Irq0ToAdc0
enumerator kINPUTMUX_Gpio8Irq0ToAdc0
enumerator kINPUTMUX_Gpio9Irq0ToAdc0
enumerator kINPUTMUX_Gpio10Irq0ToAdc0
enumerator kINPUTMUX_Sct0Out4ToAdc0
enumerator kINPUTMUX_Sct0Out5ToAdc0
enumerator kINPUTMUX_Sct0Out9ToAdc0
enumerator kINPUTMUX_Ct0Mat3ToAdc0
enumerator kINPUTMUX_Ct1Mat3ToAdc0
enumerator kINPUTMUX_Ct2Mat3ToAdc0
enumerator kINPUTMUX_Ct3Mat3ToAdc0
enumerator kINPUTMUX_Ct4Mat3ToAdc0
enumerator kINPUTMUX_Ct5Mat3ToAdc0
enumerator kINPUTMUX_Ct6Mat3ToAdc0
enumerator kINPUTMUX_Ct7Mat3ToAdc0
enumerator kINPUTMUX_Cmp0OutToAdc0
enumerator kINPUTMUX_Cpu0TxevToAdc0
enumerator kINPUTMUX_Cpu1TxevToAdc0
enumerator kINPUTMUX_EzhvOutToAdc0
enumerator kINPUTMUX_GpioInt0BmatchToAdc0
enumerator kINPUTMUX_GpioInt1BmatchToAdc0

CTmier5 capture input mux.

enumerator kINPUTMUX_CtInp0ToTimer5CaptureChannels
enumerator kINPUTMUX_CtInp1ToTimer5CaptureChannels
enumerator kINPUTMUX_CtInp2ToTimer5CaptureChannels
enumerator kINPUTMUX_CtInp3ToTimer5CaptureChannels
enumerator kINPUTMUX_CtInp4ToTimer5CaptureChannels
enumerator kINPUTMUX_CtInp5ToTimer5CaptureChannels
enumerator kINPUTMUX_CtInp6ToTimer5CaptureChannels
enumerator kINPUTMUX_CtInp7ToTimer5CaptureChannels
enumerator kINPUTMUX_CtInp8ToTimer5CaptureChannels
enumerator kINPUTMUX_CtInp9ToTimer5CaptureChannels
enumerator kINPUTMUX_Sai3TxSyncToTimer5CaptureChannels
enumerator kINPUTMUX_Sai3RxSyncToTimer5CaptureChannels
enumerator kINPUTMUX_Cmp0OutToTimer5CaptureChannels
enumerator kINPUTMUX_Adc0Tcomp0ToTimer5CaptureChannels
enumerator kINPUTMUX_Adc0Tcomp1ToTimer5CaptureChannels

CTmier6 capture input mux.

enumerator kINPUTMUX_CtInp0ToTimer6CaptureChannels
enumerator kINPUTMUX_CtInp1ToTimer6CaptureChannels
enumerator kINPUTMUX_CtInp2ToTimer6CaptureChannels
enumerator kINPUTMUX_CtInp3ToTimer6CaptureChannels
enumerator kINPUTMUX_CtInp4ToTimer6CaptureChannels
enumerator kINPUTMUX_CtInp5ToTimer6CaptureChannels
enumerator kINPUTMUX_CtInp6ToTimer6CaptureChannels
enumerator kINPUTMUX_CtInp7ToTimer6CaptureChannels
enumerator kINPUTMUX_CtInp8ToTimer6CaptureChannels
enumerator kINPUTMUX_CtInp9ToTimer6CaptureChannels
enumerator kINPUTMUX_Sai3TxSyncToTimer6CaptureChannels
enumerator kINPUTMUX_Sai3RxSyncToTimer6CaptureChannels
enumerator kINPUTMUX_Cmp0OutToTimer6CaptureChannels
enumerator kINPUTMUX_Adc0Tcomp0ToTimer6CaptureChannels
enumerator kINPUTMUX_Adc0Tcomp1ToTimer6CaptureChannels

CTmier7 capture input mux.

enumerator kINPUTMUX_CtInp0ToTimer7CaptureChannels
enumerator kINPUTMUX_CtInp1ToTimer7CaptureChannels
enumerator kINPUTMUX_CtInp2ToTimer7CaptureChannels
enumerator kINPUTMUX_CtInp3ToTimer7CaptureChannels
enumerator kINPUTMUX_CtInp4ToTimer7CaptureChannels
enumerator kINPUTMUX_CtInp5ToTimer7CaptureChannels
enumerator kINPUTMUX_CtInp6ToTimer7CaptureChannels
enumerator kINPUTMUX_CtInp7ToTimer7CaptureChannels
enumerator kINPUTMUX_CtInp8ToTimer7CaptureChannels
enumerator kINPUTMUX_CtInp9ToTimer7CaptureChannels
enumerator kINPUTMUX_Sai3TxSyncToTimer7CaptureChannels
enumerator kINPUTMUX_Sai3RxSyncToTimer7CaptureChannels
enumerator kINPUTMUX_Cmp0OutToTimer7CaptureChannels
enumerator kINPUTMUX_Adc0Tcomp0ToTimer7CaptureChannels
enumerator kINPUTMUX_Adc0Tcomp1ToTimer7CaptureChannels

CTmier5 input trigger.

enumerator kINPUTMUX_CtInp0ToTimer5Trigger
enumerator kINPUTMUX_CtInp1ToTimer5Trigger
enumerator kINPUTMUX_CtInp2ToTimer5Trigger
enumerator kINPUTMUX_CtInp3ToTimer5Trigger
enumerator kINPUTMUX_CtInp4ToTimer5Trigger
enumerator kINPUTMUX_CtInp5ToTimer5Trigger
enumerator kINPUTMUX_CtInp6ToTimer5Trigger
enumerator kINPUTMUX_CtInp7ToTimer5Trigger
enumerator kINPUTMUX_CtInp8ToTimer5Trigger
enumerator kINPUTMUX_CtInp9ToTimer5Trigger
enumerator kINPUTMUX_Sai3TxSyncToTimer5Trigger
enumerator kINPUTMUX_Sai3RxSyncToTimer5Trigger
enumerator kINPUTMUX_Cmp0OutToTimer5Trigger
enumerator kINPUTMUX_Adc0Tcomp0ToTimer5Trigger
enumerator kINPUTMUX_Adc0Tcomp1ToTimer5Trigger

CTmier6 input trigger.

enumerator kINPUTMUX_CtInp0ToTimer6Trigger
enumerator kINPUTMUX_CtInp1ToTimer6Trigger
enumerator kINPUTMUX_CtInp2ToTimer6Trigger
enumerator kINPUTMUX_CtInp3ToTimer6Trigger
enumerator kINPUTMUX_CtInp4ToTimer6Trigger
enumerator kINPUTMUX_CtInp5ToTimer6Trigger
enumerator kINPUTMUX_CtInp6ToTimer6Trigger
enumerator kINPUTMUX_CtInp7ToTimer6Trigger
enumerator kINPUTMUX_CtInp8ToTimer6Trigger
enumerator kINPUTMUX_CtInp9ToTimer6Trigger
enumerator kINPUTMUX_Sai3TxSyncToTimer6Trigger
enumerator kINPUTMUX_Sai3RxSyncToTimer6Trigger
enumerator kINPUTMUX_Cmp0OutToTimer6Trigger
enumerator kINPUTMUX_Adc0Tcomp0ToTimer6Trigger
enumerator kINPUTMUX_Adc0Tcomp1ToTimer6Trigger

CTmier7 input trigger.

enumerator kINPUTMUX_CtInp0ToTimer7Trigger
enumerator kINPUTMUX_CtInp1ToTimer7Trigger
enumerator kINPUTMUX_CtInp2ToTimer7Trigger
enumerator kINPUTMUX_CtInp3ToTimer7Trigger
enumerator kINPUTMUX_CtInp4ToTimer7Trigger
enumerator kINPUTMUX_CtInp5ToTimer7Trigger
enumerator kINPUTMUX_CtInp6ToTimer7Trigger
enumerator kINPUTMUX_CtInp7ToTimer7Trigger
enumerator kINPUTMUX_CtInp8ToTimer7Trigger
enumerator kINPUTMUX_CtInp9ToTimer7Trigger
enumerator kINPUTMUX_Sai3TxSyncToTimer7Trigger
enumerator kINPUTMUX_Sai3RxSyncToTimer7Trigger
enumerator kINPUTMUX_Cmp0OutToTimer7Trigger
enumerator kINPUTMUX_Adc0Tcomp0ToTimer7Trigger
enumerator kINPUTMUX_Adc0Tcomp1ToTimer7Trigger
typedef enum _inputmux_connection_t inputmux_connection_t

INPUTMUX connections type.

void INPUTMUX_Init(INPUTMUX_Type *base)

Initialize INPUTMUX peripheral.

This function enables the INPUTMUX clock.

Parameters:
  • base – Base address of the INPUTMUX peripheral.

Return values:

None.

void INPUTMUX_AttachSignal(INPUTMUX_Type *base, uint16_t index, inputmux_connection_t connection)

Attaches a signal.

This function attaches multiplexed signals from INPUTMUX to target signals. For example, to attach GPIO PORT0 Pin 5 to PINT peripheral, do the following:

INPUTMUX_AttachSignal(INPUTMUX, 2, kINPUTMUX_GpioPort0Pin5ToPintsel);
In this example, INTMUX has 8 registers for PINT, PINT_SEL0~PINT_SEL7. With parameter index specified as 2, this function configures register PINT_SEL2.

Parameters:
  • base – Base address of the INPUTMUX peripheral.

  • index – The serial number of destination register in the group of INPUTMUX registers with same name.

  • connection – Applies signal from source signals collection to target signal.

Return values:

None.

void INPUTMUX_Deinit(INPUTMUX_Type *base)

Deinitialize INPUTMUX peripheral.

This function disables the INPUTMUX clock.

Parameters:
  • base – Base address of the INPUTMUX peripheral.

Return values:

None.

PINTSEL_PMUX_ID

Periphinmux IDs.

DSP_INT_PMUX_ID
PMUX_SHIFT

Iopctl_driver

typedef struct _iopctl_group iopctl_group_t

Array of IOPCTL pin definitions passed to IOPCTL_SetPinMuxing() must be in this format.

__STATIC_INLINE void IOPCTL_PinMuxSet (uint8_t port, uint8_t pin, uint32_t modefunc)

Sets I/O Pad Control pin mux.

Parameters:
  • port – : Port to mux

  • pin – : Pin to mux

  • modefunc – : OR’ed values of type IOPCTL_*

Returns:

Nothing

__STATIC_INLINE void IOPCTL_SetPinMuxing (const iopctl_group_t *pinArray, uint32_t arrayLength)

Set all I/O Control pin muxing.

Parameters:
  • pinArray – : Pointer to array of pin mux selections

  • arrayLength – : Number of entries in pinArray

Returns:

Nothing

LPC_IOPCTL_DRIVER_VERSION

IOPCTL driver version 2.0.2.

IOPCTL_FUNC0

IOPCTL function and mode selection definitions.

Note

See the User Manual for specific modes and functions supported by the various pins. Selects pin function 0

IOPCTL_FUNC1

Selects pin function 1

IOPCTL_FUNC2

Selects pin function 2

IOPCTL_FUNC3

Selects pin function 3

IOPCTL_FUNC4

Selects pin function 4

IOPCTL_FUNC5

Selects pin function 5

IOPCTL_FUNC6

Selects pin function 6

IOPCTL_FUNC7

Selects pin function 7

IOPCTL_FUNC8

Selects pin function 8

IOPCTL_FUNC9

Selects pin function 9

IOPCTL_FUNC10

Selects pin function 10

IOPCTL_FUNC11

Selects pin function 11

IOPCTL_FUNC12

Selects pin function 12

IOPCTL_FUNC13

Selects pin function 13

IOPCTL_FUNC14

Selects pin function 14

IOPCTL_FUNC15

Selects pin function 15

IOPCTL_PUPD_EN

Enables Pullup / Pulldown

IOPCTL_PULLDOWN_EN

Selects pull-down function

IOPCTL_PULLUP_EN

Selects pull-up function

IOPCTL_INBUF_EN

Enables buffer function on input

IOPCTL_SLEW_RATE

Slew Rate Control

IOPCTL_ANAMUX_EN

Enables analog mux function by setting 0 to bit 7

IOPCTL_PSEDRAIN_EN

Enables pseudo output drain function

IOPCTL_INV_EN

Enables invert function on input

IOPCTL_DRIVE_100OHM

Selects transmitter current drive 100ohm

IOPCTL_DRIVE_66OHM

Selects transmitter current drive 66ohm

IOPCTL_DRIVE_50OHM

Selects transmitter current drive 50ohm

IOPCTL_DRIVE_33OHM

Selects transmitter current drive 33ohm

uint32_t port
uint32_t pin
uint32_t modefunc
FSL_COMPONENT_ID
struct _iopctl_group
#include <fsl_iopctl.h>

Array of IOPCTL pin definitions passed to IOPCTL_SetPinMuxing() must be in this format.

IRTC: IRTC Driver

status_t IRTC_Init(RTC_Type *base, const irtc_config_t *config)

Ungates the IRTC clock and configures the peripheral for basic operation.

This function initiates a soft-reset of the IRTC module, this has not effect on DST, calendaring, standby time and tamper detect registers.

Note

This API should be called at the beginning of the application using the IRTC driver.

Parameters:
  • base – IRTC peripheral base address

  • config – Pointer to user’s IRTC config structure.

Returns:

kStatus_Success If the driver is initialized successfully.

Returns:

kStatus_Fail if we cannot disable register write protection

Returns:

kStatus_InvalidArgument If the input parameters are wrong.

status_t IRTC_Deinit(RTC_Type *base)

Gate the IRTC clock.

Parameters:
  • base – IRTC peripheral base address

Returns:

kStatus_Success If the driver is initialized successfully.

Returns:

kStatus_InvalidArgument If the input parameters are wrong.

void IRTC_GetDefaultConfig(irtc_config_t *config)

Fill in the IRTC config struct with the default settings.

The default values are:

config->wakeupSelect = true;
config->timerStdMask = false;
config->alrmMatch = kRTC_MatchSecMinHr;

Parameters:
  • config – Pointer to user’s IRTC config structure.

void IRTC_GetDatetime(RTC_Type *base, irtc_datetime_t *datetime)

Gets the IRTC time and stores it in the given time structure.

Parameters:
  • base – IRTC peripheral base address

  • datetime – Pointer to structure where the date and time details are stored.

status_t IRTC_SetAlarm(RTC_Type *base, const irtc_datetime_t *alarmTime)

Sets the IRTC alarm time.

Note

weekDay field of alarmTime is not used during alarm match and should be set to 0

Parameters:
  • base – RTC peripheral base address

  • alarmTime – Pointer to structure where the alarm time is stored.

Returns:

kStatus_Success: success in setting the alarm kStatus_InvalidArgument: error in setting the alarm. Error occurs because the alarm datetime format is incorrect.

void IRTC_GetAlarm(RTC_Type *base, irtc_datetime_t *datetime)

Returns the IRTC alarm time.

Parameters:
  • base – RTC peripheral base address

  • datetime – Pointer to structure where the alarm date and time details are stored.

static inline void IRTC_EnableInterrupts(RTC_Type *base, uint32_t mask)

Enables the selected IRTC interrupts.

Parameters:
  • base – IRTC peripheral base address

  • mask – The interrupts to enable. This is a logical OR of members of the enumeration irtc_interrupt_enable_t

static inline void IRTC_DisableInterrupts(RTC_Type *base, uint32_t mask)

Disables the selected IRTC interrupts.

Parameters:
  • base – IRTC peripheral base address

  • mask – The interrupts to enable. This is a logical OR of members of the enumeration irtc_interrupt_enable_t

static inline uint32_t IRTC_GetEnabledInterrupts(RTC_Type *base)

Gets the enabled IRTC interrupts.

Parameters:
  • base – IRTC peripheral base address

Returns:

The enabled interrupts. This is the logical OR of members of the enumeration irtc_interrupt_enable_t

static inline uint32_t IRTC_GetStatusFlags(RTC_Type *base)

Gets the IRTC status flags.

Parameters:
  • base – IRTC peripheral base address

Returns:

The status flags. This is the logical OR of members of the enumeration irtc_status_flags_t

static inline void IRTC_ClearStatusFlags(RTC_Type *base, uint32_t mask)

Clears the IRTC status flags.

Parameters:
  • base – IRTC peripheral base address

  • mask – The status flags to clear. This is a logical OR of members of the enumeration irtc_status_flags_t

void IRTC_GetDaylightTime(RTC_Type *base, irtc_daylight_time_t *datetime)

Gets the IRTC daylight savings time and stores it in the given time structure.

Parameters:
  • base – IRTC peripheral base address

  • datetime – Pointer to a structure where the date and time details are stored.

static inline void IRTC_EnableSubsecondCounter(RTC_Type *base, bool enable)

Enable the RTC wake-up timer.

1HZ clock out selected via call to API IRTC_ConfigClockOut in order for the subsecond counter to synchronize with the RTC_SECONDS counter.

Parameters:
  • base – RTC peripheral base address

  • enable – Use/Un-use the sub-second counter.

    • true: Use RTC wake-up timer at the same time.

    • false: Un-use RTC wake-up timer, RTC only use the normal seconds timer by default.

static inline uint32_t IRTC_GetSubsecondCount(RTC_Type *base)

Read the actual RTC sub-second COUNT value.

Parameters:
  • base – RTC peripheral base address

Returns:

The actual RTC sub-second COUNT value.

static inline void IRTC_SetWakeupCount(RTC_Type *base, bool enable1kHzClk, uint32_t wakeupValue)

Set countdown value to the RTC wake timer counter register.

Parameters:
  • base – RTC peripheral base address

  • enable1kHzClk – Enable 1kHz clock source for the wake timer, else use the 32kHz clock.

  • wakeupValue – The value to be loaded into the WAKE register in wake timer counter.

static inline uint32_t IRTC_GetWakeupCount(RTC_Type *base)

Read the actual value from the WAKE register value in RTC wake timer.

Parameters:
  • base – RTC peripheral base address

Returns:

The actual value of the WAKE register value in wake timer counter.

FSL_IRTC_DRIVER_VERSION
enum _irtc_clock_select

IRTC clock select.

Values:

enumerator kIRTC_Clk16K

16.384 kHz clock is selected.

enumerator kIRTC_Clk32K

32.768 kHz clock is selected.

enum _irtc_interrupt_enable

List of IRTC interrupts.

Values:

enumerator kIRTC_AlarmInterruptEnable

Alarm Interrupt Enable

enumerator kIRTC_DayInterruptEnable

Days Interrupt Enable

enumerator kIRTC_HourInterruptEnable

Hours Interrupt Enable

enumerator kIRTC_MinInterruptEnable

Minutes Interrupt Enable

enumerator kIRTC_1hzInterruptEnable

1 Hz interval Interrupt Enable

enumerator kIRTC_2hzInterruptEnable

2 Hz interval Interrupt Enable

enumerator kIRTC_4hzInterruptEnable

4 Hz interval Interrupt Enable

enumerator kIRTC_8hzInterruptEnable

8 Hz interval Interrupt Enable

enumerator kIRTC_16hzInterruptEnable

16 Hz interval Interrupt Enable

enumerator kIRTC_32hzInterruptEnable

32 Hz interval Interrupt Enable

enumerator kIRTC_64hzInterruptEnable

64 Hz interval Interrupt Enable

enumerator kIRTC_128hzInterruptEnable

128 Hz interval Interrupt Enable

enumerator kIRTC_256hzInterruptEnable

256 Hz interval Interrupt Enable

enumerator kIRTC_512hzInterruptEnable

512 Hz interval Interrupt Enable

enumerator kIRTC_WakeTimerInterruptEnable

Wake timer Interrupt Enable

enumerator kIRTC_TamperQueueFullInterruptEnable

Tamper queue full Interrupt Enable

enum _irtc_status_flags

List of IRTC flags.

Values:

enumerator kIRTC_AlarmFlag

Alarm Status flag

enumerator kIRTC_DayFlag

Days Status flag

enumerator kIRTC_HourFlag

Hour Status flag

enumerator kIRTC_MinFlag

Minutes Status flag

enumerator kIRTC_1hzFlag

1 Hz interval status flag

enumerator kIRTC_2hzFlag

2 Hz interval status flag

enumerator kIRTC_4hzFlag

4 Hz interval status flag

enumerator kIRTC_8hzFlag

8 Hz interval status flag

enumerator kIRTC_16hzFlag

16 Hz interval status flag

enumerator kIRTC_32hzFlag

32 Hz interval status flag

enumerator kIRTC_64hzFlag

64 Hz interval status flag

enumerator kIRTC_128hzFlag

128 Hz interval status flag

enumerator kIRTC_256hzFlag

256 Hz interval status flag

enumerator kIRTC_512hzFlag

512 Hz interval status flag

enumerator kIRTC_InvalidFlag

Indicates if time/date counters are invalid

enumerator kIRTC_WriteProtFlag

Write protect enable status flag

enumerator kIRTC_BusErrFlag

Bus error flag

enumerator kIRTC_WakeTimerFlag

Wake timer status flag

enum _irtc_alarm_match

IRTC alarm match options.

Values:

enumerator kRTC_MatchSecMinHr

Only match second, minute and hour

enumerator kRTC_MatchSecMinHrDay

Only match second, minute, hour and day

enumerator kRTC_MatchSecMinHrDayMnth

Only match second, minute, hour, day and month

enumerator kRTC_MatchSecMinHrDayMnthYr

Only match second, minute, hour, day, month and year

enum _irtc_clockout_sel

IRTC clockout select.

Values:

enumerator kIRTC_ClkoutNo

No clock out

enumerator kIRTC_ClkoutFine1Hz

clock out fine 1Hz

enumerator kIRTC_Clkout32kHz

clock out 32.768kHz

enumerator kIRTC_ClkoutCoarse1Hz

clock out coarse 1Hz

typedef enum _irtc_clock_select irtc_clock_select_t

IRTC clock select.

typedef enum _irtc_interrupt_enable irtc_interrupt_enable_t

List of IRTC interrupts.

typedef enum _irtc_status_flags irtc_status_flags_t

List of IRTC flags.

typedef enum _irtc_alarm_match irtc_alarm_match_t

IRTC alarm match options.

typedef enum _irtc_clockout_sel irtc_clockout_sel_t

IRTC clockout select.

typedef struct _irtc_datetime irtc_datetime_t

Structure is used to hold the date and time.

typedef struct _irtc_daylight_time irtc_daylight_time_t

Structure is used to hold the daylight saving time.

typedef struct _irtc_config irtc_config_t

RTC config structure.

This structure holds the configuration settings for the RTC peripheral. To initialize this structure to reasonable defaults, call the IRTC_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 IRTC_SetWriteProtection(RTC_Type *base, bool lock)

Locks or unlocks IRTC registers for write access.

Note

When the registers are unlocked, they remain in unlocked state for 2 seconds, after which they are locked automatically. After power-on-reset, the registers come out unlocked and they are locked automatically 15 seconds after power on.

Parameters:
  • base – IRTC peripheral base address

  • lock – true: Lock IRTC registers; false: Unlock IRTC registers.

Returns:

kStatus_Success: if lock or unlock operation is successful kStatus_Fail: if lock or unlock operation fails even after multiple retry attempts

static inline void IRTC_Reset(RTC_Type *base)

Performs a software reset on the IRTC module.

Clears contents of alarm, interrupt (status and enable except tamper interrupt enable bit) registers, STATUS[CMP_DONE] and STATUS[BUS_ERR]. This has no effect on DST, calendaring, standby time and tamper detect registers.

Parameters:
  • base – IRTC peripheral base address

void IRTC_ConfigClockOut(RTC_Type *base, irtc_clockout_sel_t clkOut)

Select which clock to output from RTC.

Select which clock to output from RTC for other modules to use inside SoC, for example, RTC subsystem needs RTC to output 1HZ clock for sub-second counter.

Parameters:
  • base – IRTC peripheral base address

  • clkOut – select clock to use for output,

void IRTC_ConfigClockSelect(RTC_Type *base, irtc_clock_select_t clkSelect)

Select which clock is used by RTC.

Select which clock is used by RTC to output to the peripheral and divided to generate a 512 Hz clock and a 1 Hz clock.

Parameters:
  • base – IRTC peripheral base address

  • clkSelect – select clock used by RTC

static inline void IRTC_EnableClockOutputToPeripheral(RTC_Type *base, bool enable)

Determines whether the selected clock is output to other peripherals.

Determines whether the selected clock is output to other peripherals.

Parameters:
  • base – IRTC peripheral base address

  • enable – determine whether the selected clock is output to other peripherals

IRTC_STATUS_W1C_BITS
struct _irtc_datetime
#include <fsl_irtc.h>

Structure is used to hold the date and time.

Public Members

uint16_t year

Range from 1984 to 2239.

uint8_t month

Range from 1 to 12.

uint8_t day

Range from 1 to 31 (depending on month).

uint8_t weekDay

Range from 0(Sunday) to 6(Saturday).

uint8_t hour

Range from 0 to 23.

uint8_t minute

Range from 0 to 59.

uint8_t second

Range from 0 to 59.

struct _irtc_daylight_time
#include <fsl_irtc.h>

Structure is used to hold the daylight saving time.

Public Members

uint8_t startMonth

Range from 1 to 12

uint8_t endMonth

Range from 1 to 12

uint8_t startDay

Range from 1 to 31 (depending on month)

uint8_t endDay

Range from 1 to 31 (depending on month)

uint8_t startHour

Range from 0 to 23

uint8_t endHour

Range from 0 to 23

struct _irtc_config
#include <fsl_irtc.h>

RTC config structure.

This structure holds the configuration settings for the RTC peripheral. To initialize this structure to reasonable defaults, call the IRTC_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

irtc_alarm_match_t alrmMatch

Pick one option from enumeration :: irtc_alarm_match_t

irtc_clock_select_t clockSelect

Pick one option from enumeration :: irtc_clock_select_t

bool disableClockOutput

true: The selected clock is not output to other peripherals; false: The selected clock is output to other peripherals

Intrusion and Tamper Response Controller

ITRC

status_t ITRC_SetActionToEvent(ITRC_Type *base, itrc_out_signals_t out, itrc_input_signals_t in, itrc_lock_t lock, itrc_enable_t enable)

Set ITRC Action to Event.

This function sets input Event signal to corresponding output Action response signal.

Parameters:
  • base – ITRC peripheral base address

  • out – ITRC OUT signal action

  • in – ITRC IN signal event

  • lock – if set locks INx_SEL configuration. This can be cleared only by PMC Core reset.

  • enable – if set input Event will be selected for output Action, otherwise disable (if not already locked).

Returns:

kStatus_Success if success, kStatus_InvalidArgument otherwise

void ITRC_SetSWEvent0(ITRC_Type *base)

Trigger ITRC SW Event 0.

This funciton set SW_EVENT0 register with value !=0 which triggers ITRC SW Event 0.

Parameters:
  • base – ITRC peripheral base address

void ITRC_SetSWEvent1(ITRC_Type *base)

Trigger ITRC SW Event 1.

This funciton set SW_EVENT1 register with value !=0 which triggers ITRC SW Event 1.

Parameters:
  • base – ITRC peripheral base address

uint32_t ITRC_GetStatus(ITRC_Type *base)

Get ITRC Status.

This function returns ITRC register status.

Parameters:
  • base – ITRC peripheral base address

Returns:

Value of ITRC STATUS register

status_t ITRC_ClearStatus(ITRC_Type *base, uint32_t word)

Clear ITRC status.

This function clears corresponding ITRC event or action in STATUS register.

Parameters:
  • base – ITRC peripheral base address

  • word – 32bit word represent corresponding event/action in STATUS register to be cleared (see ITRC_STATUS_INx/OUTx_STATUS)

Returns:

kStatus_Success if success, kStatus_InvalidArgument otherwise

status_t ITRC_ClearAllStatus(ITRC_Type *base)

Clear All ITRC status.

This function clears all event and action status.

Parameters:
  • base – ITRC peripheral base address

Returns:

kStatus_Success if success

status_t ITRC_Init(ITRC_Type *base)

Initialize ITRC.

This function initializes ITRC by enabling IRQ.

Parameters:
  • base – ITRC peripheral base address

  • conf – ITRC configuration structure

Returns:

Status of the init operation

void ITRC_Deinit(ITRC_Type *base)

Deinitialize ITRC.

This function deinitializes ITRC by disabling IRQ.

Parameters:
  • base – ITRC peripheral base address

FSL_ITRC_DRIVER_VERSION

Defines ITRC driver version 2.4.0.

Change log:

  • Version 2.4.0

    • Rework the input signal definition for better flexibility

  • Version 2.3.0

    • Update names of kITRC_SwEvent1/2 to kITRC_SwEvent0/1 to align with RM

  • Version 2.2.0

    • Update driver to new version and input events

  • Version 2.1.0

    • Make SYSCON glitch platform dependent

  • Version 2.0.0

    • initial version

enum _itrc_input_signals

Values:

enum _itrc_lock

Values:

enumerator kITRC_Unlock
enumerator kITRC_Lock
enum _itrc_enable

Values:

enumerator kITRC_Enable
enumerator kITRC_Disable
enum _itrc_out_signals

Values:

enumerator kITRC_Irq
enumerator kITRC_ElsReset
enumerator kITRC_PufZeroize
enumerator kITRC_RamZeroize
enumerator kITRC_ChipReset
enumerator kITRC_TamperOut
enumerator kITRC_TamperOut1
typedef enum _itrc_input_signals itrc_input_signals_t
typedef enum _itrc_lock itrc_lock_t
typedef enum _itrc_enable itrc_enable_t
typedef enum _itrc_out_signals itrc_out_signals_t
void ITRC0_DriverIRQHandler(void)
ITRC_STATUS_IN2_STATUS_MASK
ITRC_STATUS_IN3_STATUS_MASK
ITRC_STATUS_IN9_STATUS_MASK
ITRC_STATUS1_IN17_STATUS_MASK
ITRC_STATUS1_IN19_STATUS_MASK
ITRC_STATUS1_IN24_21_STATUS_MASK
ITRC_STATUS1_IN32_25_STATUS_MASK
ITRC_STATUS1_IN46_STATUS_MASK
IN_0_15_EVENTS_MASK
OUT_ACTIONS_MASK
ITRC_OUT_COUNT
ITRC

JPEGDEC: JPEG decoder Driver

Error codes for the JPEG decoder driver.

Values:

enumerator kStatus_JPEGDEC_NotSupported

Unsupported pixel format or image resolution.

enum _jpegdec_pixel_format

JPEG decoding pixel format.

Values:

enumerator kJPEGDEC_PixelFormatYUV420

YUV420 format, Y at first plane, UV at second plane.

enumerator kJPEGDEC_PixelFormatYUV422

YUV422, 1 planar in the YUYV sequence.

enumerator kJPEGDEC_PixelFormatRGB

RGB packed format.

enumerator kJPEGDEC_PixelFormatYUV444

YUV444, 1 planar in the YUVYUV sequence.

enumerator kJPEGDEC_PixelFormatGray

8-bit or 12-bit gray scale.

enumerator kJPEGDEC_PixelFormatReserved

Reserved.

enumerator kJPEGDEC_PixelFormatYCCK

YCCK format.

enum _jpegdec_pixel_depth

JPEG decoding pixel depth.

Values:

enumerator kJPEGDEC_PixelDepth8Bit

8-bit per pixel.

enumerator kJPEGDEC_PixelDepth12Bit

12-bit per pixel.

enum _jpegdec_flags

Decoder slot Interrupt status and enable/disable flags.

Values:

enumerator kJPEGDEC_StreamBufferHalfDoneFlag

Slot’s bit stream buffer pointer has passed half the size.

enumerator kJPEGDEC_StreamBufferDoneFlag

Slot’s bit stream buffer pointer has finished.

enumerator kJPEGDEC_SwitchInFlag

Current slot is switched in.

enumerator kJPEGDEC_DecodeCompleteFlag

Current slot finished decoding.

enumerator kJPEGDEC_DecodeErrorFlag

Current slot has error during decoding.

enumerator kJPEGDEC_DescptReadErrorFlag

Descriptor read error when switching in current slot.

enumerator kJPEGDEC_BitReadErrorFlag

Read JPEG stream error.

enumerator kJPEGDEC_PixelWriteErrorFlag

Write decoded pixel error.

enumerator kJPEGDEC_ErrorFlags
enumerator kJPEGDEC_AllFlags
enum _jpegdec_slots

JPEG decoding Slot.

Values:

enumerator kJPEGDEC_Slot0

Decoding slot 0.

enumerator kJPEGDEC_Slot1

Decoding slot 1.

enumerator kJPEGDEC_Slot2

Decoding slot 2.

enumerator kJPEGDEC_Slot3

Decoding slot 3.

enum _jpegdec_endian_mode

JPEG stream data format.

Values:

enumerator kJPEGDEC_BigEndian

JPEG data format is big endian.

enumerator kJPEGDEC_LittleEndian

JPEG data format is little endian.

typedef enum _jpegdec_pixel_format jpegdec_pixel_format_t

JPEG decoding pixel format.

typedef enum _jpegdec_pixel_depth jpegdec_pixel_depth_t

JPEG decoding pixel depth.

typedef struct _jpegdec_decoder_config jpegdec_decoder_config_t

JPEG decoder configuration.

typedef struct _jpegdec_descpt jpegdec_descpt_t

JPEG decoder descriptor.

This structure is used to configure the linked decoding descriptor for one or more slots in Single Bit Stream Repeat mode or Context Switch mode.

typedef enum _jpegdec_endian_mode jpegdec_endian_mode_t

JPEG stream data format.

typedef struct _jpegdec_config jpegdec_config_t

Configuration for JPEG decoder.

FSL_JPEGDEC_DRIVER_VERSION

JPEG decoder driver version 2.0.0.

void JPEGDEC_GetDefaultConfig(jpegdec_config_t *config)

Gets the default configuration for JPEG decoder.

This function initializes the user configuration structure to default value. The default value are:

Example:

config->endianMode = kJPEGDEC_LittleEndian;
config->slots      = 0xFU;
config->enable     = true;
config->enableLp   = false;

Parameters:
  • config – Pointer to JPEG decoder configuration structure.

void JPEGDEC_Init(JPEG_DECODER_Type *base, const jpegdec_config_t *config)

Initializes the JPEG decoder.

The default configuration can be got by calling JPEGDEC_GetDefaultConfig.

Parameters:
  • base – JPEG decoder peripheral base address.

  • config – Pointer to JPEG decoder configuration structure.

void JPEGDEC_Deinit(JPEG_DECODER_Type *base)

Deinitializes the JPEG decoder.

Parameters:
  • base – JPEG decoder peripheral base address.

static inline void JPEGDEC_EnableInterrupts(JPEG_DECODER_Type *base, uint8_t slot, uint32_t mask)

Enables interrupts for certain slot.

Parameters:
  • base – JPEG decoder peripheral base address.

  • slot – Slot number.

  • mask – Interrupts mask formed by flags OR’ed together. _jpegdec_flags.

static inline void JPEGDEC_DisableInterrupts(JPEG_DECODER_Type *base, uint8_t slot, uint32_t mask)

Disables interrupts for certain slot.

Parameters:
  • base – JPEG decoder peripheral base address.

  • slot – Slot number.

  • mask – Interrupts mask formed by flags OR’ed together. _jpegdec_flags.

static inline uint32_t JPEGDEC_GetStatusFlags(JPEG_DECODER_Type *base, uint8_t slot)

Gets status flags for certain slot.

Parameters:
  • base – JPEG decoder peripheral base address.

  • slot – Slot number.

Returns:

Status flags asserted mask formed by flags OR’ed together. See “_jpegdec_flags”.

static inline void JPEGDEC_ClearStatusFlags(JPEG_DECODER_Type *base, uint8_t slot, uint32_t mask)

Clears status flags for certain slot.

Parameters:
  • base – JPEG decoder peripheral base address.

  • slot – Slot number.

  • mask – Status flags mask formed by flags OR’ed together. See “_jpegdec_flags”.

static inline void JPEGDEC_Enable(JPEG_DECODER_Type *base, bool enable)

Enables the JPEG decoder module.

Parameters:
  • base – JPEG decoder peripheral base address.

  • enable – True to enable, false to disable.

static inline void JPEGDEC_EnableLp(JPEG_DECODER_Type *base, bool enable)

Enables the JPEG decoder core to enter low power mode.

Parameters:
  • base – JPEG decoder peripheral base address.

  • enable – True to enable, false to disable.

static inline void JPEGDEC_Reset(JPEG_DECODER_Type *base)

Resets the JPEG decoder.

Parameters:
  • base – JPEG decoder peripheral base address.

static inline void JPEGDEC_StartDecode(JPEG_DECODER_Type *base)

Starts the JPEG decode.

After calling this API the JPEG decoder will start decoding on a frame basis. The decoding process stops after the frame decoding is complete and if there are no other valid descriptors available. Auto-clear.

Parameters:
  • base – JPEG decoder peripheral base address.

static inline void JPEGDEC_EnableSlots(JPEG_DECODER_Type *base, uint8_t slots)

Enables the JPEG decoding slot(s)

Parameters:
  • base – JPEG decoder peripheral base address.

  • slot – Masks of the enabled slot, _jpegdec_slots.

status_t JPEGDEC_GetActiveSlot(JPEG_DECODER_Type *base, uint8_t *slot)

Gets the current active slot.

Parameters:
  • base – JPEG decoder peripheral base address.

  • slot[out] Pointer to the variable that stores the enabled slot.

Return values:
  • kStatus_Success – Successfully get the current active slot.

  • kStatus_Fail – Current JPEG decoder is idle, no slot is active.

static inline void JPEGDEC_SetEndian(JPEG_DECODER_Type *base, jpegdec_endian_mode_t mode)

Sets the JPEG decoder endian mode for decoded data.

Parameters:
  • base – JPEG decoder peripheral base address.

  • mode – Endian mode.

void JPEGDEC_SetJpegBuffer(jpegdec_decoder_config_t *config, uint8_t *buffer, size_t length)

Sets the address and length of the JPEG image.

Parameters:
  • config[out] Decoder configuration.

  • data – Start address of the buffer of the raw JPEG image, shall be 8-byte aligned.

  • length – Size of the buffer.

void JPEGDEC_SetOutputBuffer(jpegdec_decoder_config_t *config, uint8_t *imageData0, uint8_t *imageData1)

Sets the address of the decoded data.

Parameters:
  • config[out] Decoder configuration.

  • imageData0 – Address of the output buffer0, shall be 16-byte aligned.

  • imageData1 – Address of the output buffer1, only used when output format is YUV420, shall be 16-byte aligned.

status_t JPEGDEC_ParseHeader(jpegdec_decoder_config_t *config)

Parses the JPEG header and stores the info in the decoder configuration structure.

Parameters:
  • config[out] Decoder configuration.

Return values:
  • kStatus_Success – Header parsing success.

  • kStatus_Fail – JPEG header parsing failed due corrupted header.

  • kStatus_JPEGDEC_NotSupported – Header parsing failed due to the image pixel format is not supported or image width/height is larger than 8k or image width/height is not 8-byte aligned.

void JPEGDEC_SetDecodeOption(jpegdec_decoder_config_t *config, uint16_t pitch, bool clearStreamBuf, bool autoStart)

Sets the decode option.

Parameters:
  • config[out] Decoder configuration.

  • pitch – Output buffer pitch.

  • clearStreamBuf – Set to true to clear the saved bit stream buffer, not used in single frame mode.

  • autoStart – Set to true to automatically start the decoding when this descriptor is switched on, not used in single frame mode.

void JPEGDEC_ConfigDecoder(JPEG_DECODER_Type *base, const jpegdec_decoder_config_t *config)

Sets JPEG decoder decoder configuration.

Call this API to set the decoder configuration and then call JPEGDEC_StartDecode to start decode. Need to enable at least one slot in jpegdec_config_t first.

Parameters:
  • base – JPEG decoder peripheral base address.

  • config – Decoder configuration.

void JPEGDEC_SetSlotNextDescpt(JPEG_DECODER_Type *base, uint8_t slot, jpegdec_descpt_t *descriptor)

Sets the address of the next decoder descriptor for certain slot.

Call this API to set the decoder descriptor for certain slot, and then call JPEGDEC_EnableSlotNextDescpt to enable the descriptor. If the decode configuration of this descriptor has enabled autoStart then decode will start automatically. Otherwise user has to call JPEGDEC_StartDecode manually. Need to enable the slot in jpegdec_config_t first.

Parameters:
  • base – JPEG decoder peripheral base address.

  • slot – Slot number.

  • descriptor – Pointer to the descriptor structure.

static inline void JPEGDEC_EnableSlotNextDescpt(JPEG_DECODER_Type *base, uint8_t slot)

Enables the next decoder descriptor for certain slot.

Call this API after calling JPEGDEC_SetSlotNextDescpt to set valid descriptor for certain slot. User can also call JPEGDEC_EnableLinkedDescpt before calling JPEGDEC_SetSlotNextDescpt, then the descriptor will be loaded automatically.

Parameters:
  • base – JPEG decoder peripheral base address.

  • slot – Slot number.

static inline void JPEGDEC_EnableLinkedDescpt(jpegdec_descpt_t *descriptor)

Enables the next linked descriptor.

Call this API before calling JPEGDEC_SetSlotNextDescpt, then the descriptor will be loaded automatically. Otherwise call JPEGDEC_EnableSlotNextDescpt after calling JPEGDEC_SetSlotNextDescpt.

Parameters:
  • descriptor[out] Pointer to the descriptor structure.

void JPEGDEC_DescptReset(jpegdec_descpt_t *descriptor)

Sets all fields to default values for the descriptor structure.

Note

This function enables the auto start feature.

Parameters:
  • descriptor – Pointer to the descriptor structure.

JPEGDEC_Type *core

Pointer to decoder core.

JPGDECWRP_Type *wrapper

Pointer to decoder wrapper.

uint32_t outBufAddr0

Base address for output frame buffer0. 16-byte aligned(4 LSBs are zero).

uint32_t outBufAddr1

Base address for output frame buffer1, only used for YUV420 second plane. 16-byte aligned(4 LSBs are zero).

uint32_t outBufPitch

Output buffer pitch.

uint32_t __pad0__

Reserved.

uint32_t jpegBufAddr

Base address of the JPEG stream buffer for decoding. 16-byte aligned(4 LSBs are

zero).

uint32_t jpegBufSize

Size of the JPEG stream buffer. 1k-byte aligned(10 LSBs are zero).

uint32_t height

Image height in pixel. Max supported is 8K(2000h), must be integer times of 8.

uint32_t __pad1__

Reserved.

uint32_t width

Image width in pixel. Max supported is 8K(2000h), must be integer times of 8.

uint32_t __pad2__

Reserved.

uint32_t __pad3__

Reserved.

uint32_t pixelDepth

Pixel depth, jpegdec_pixel_depth_t.

uint32_t pixelFormat

The image pixel format, jpegdec_pixel_format_t.

uint32_t clearStreamBuf

Set to true to clear the saved bit stream buffer.

uint32_t autoStart

Set to true to automatically start the decoding when this descriptor is switched on.

uint32_t __pad4__

Reserved.

uint32_t nextDescptAddr

Address of the next decoding descriptor.

jpegdec_decoder_config_t config

The decoding configuration for this descriptor.

bool enable

Enables the decode IP.

bool enableLp

Enables the core to enter low power mode.

jpegdec_endian_mode_t endianMode

Endian mode for the souce/decoded image.

uint8_t slots

Mask of enabled slots _jpegdec_slots.

JPEG_ALIGN_SIZE(size, align)
struct JPEG_DECODER_Type
#include <fsl_jpegdec.h>

JPEG decoder structure definition.

struct _jpegdec_decoder_config
#include <fsl_jpegdec.h>

JPEG decoder configuration.

struct _jpegdec_descpt
#include <fsl_jpegdec.h>

JPEG decoder descriptor.

This structure is used to configure the linked decoding descriptor for one or more slots in Single Bit Stream Repeat mode or Context Switch mode.

struct _jpegdec_config
#include <fsl_jpegdec.h>

Configuration for JPEG decoder.

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_L1DCACHE_ALIGN(var)

Macro to define a variable with L1 d-cache line size alignment

SDK_SIZEALIGN(var, alignbytes)

Macro to define a variable with L2 cache line size alignment

Macro to change a value to a given size aligned value

CACHE_LINE_DATA
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.

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.

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.

LCDIF: LCD interface

status_t LCDIF_Init(LCDIF_Type *base)

Initialize the LCDIF.

This function initializes the LCDIF to work.

Parameters:
  • base – LCDIF peripheral base address.

Return values:

kStatus_Success – Initialize successfully.

void LCDIF_Deinit(LCDIF_Type *base)

De-initialize the LCDIF.

This function disables the LCDIF peripheral clock.

Parameters:
  • base – LCDIF peripheral base address.

void LCDIF_DpiModeGetDefaultConfig(lcdif_dpi_config_t *config)

Get the default configuration for to initialize the LCDIF.

The default configuration value is:

config->panelWidth = 0;
config->panelHeight = 0;
config->hsw = 0;
config->hfp = 0;
config->hbp = 0;
config->vsw = 0;
config->vfp = 0;
config->vbp = 0;
config->polarityFlags = kLCDIF_VsyncActiveLow | kLCDIF_HsyncActiveLow | kLCDIF_DataEnableActiveHigh |
kLCDIF_DriveDataOnFallingClkEdge; config->format = kLCDIF_Output24Bit;
Parameters:
  • config – Pointer to the LCDIF configuration.

status_t LCDIF_DpiModeSetConfig(LCDIF_Type *base, uint8_t displayIndex, const lcdif_dpi_config_t *config)

Initialize the LCDIF to work in DPI mode.

This function configures the LCDIF DPI display.

Parameters:
  • base – LCDIF peripheral base address.

  • displayIndex – Display index.

  • config – Pointer to the configuration structure.

Return values:
  • kStatus_Success – Initialize successfully.

  • kStatus_InvalidArgument – Initialize failed because of invalid argument.

status_t LCDIF_DbiModeSetConfig(LCDIF_Type *base, uint8_t displayIndex, const lcdif_dbi_config_t *config)

Initialize the LCDIF to work in DBI mode.

This function configures the LCDIF DBI display.

Parameters:
  • base – LCDIF peripheral base address.

  • displayIndex – Display index.

  • config – Pointer to the configuration structure.

Return values:
  • kStatus_Success – Initialize successfully.

  • kStatus_InvalidArgument – Initialize failed because of invalid argument.

void LCDIF_DbiModeGetDefaultConfig(lcdif_dbi_config_t *config)

Get the default configuration to initialize the LCDIF DBI mode.

The default configuration value is:

config->swizzle         = kLCDIF_DbiOutSwizzleRGB;
config->format          = kLCDIF_DbiOutD8RGB332;
config->acTimeUnit      = 0;
config->type            = kLCDIF_DbiTypeA_ClockedE;
config->reversePolarity = false;
config->writeWRPeriod   = 3U;
config->writeWRAssert   = 0U;
config->writeCSAssert   = 0U;
config->writeWRDeassert = 0U;
config->writeCSDeassert = 0U;
config->typeCTas        = 1U;
config->typeCSCLTwrl    = 1U;
config->typeCSCLTwrh    = 1U;
Parameters:
  • config – Pointer to the LCDIF DBI configuration.

static inline void LCDIF_DbiReset(LCDIF_Type *base, uint8_t displayIndex)

Reset the DBI module.

Parameters:
  • displayIndex – Display index.

  • base – LCDIF peripheral base address.

static inline bool LCDIF_DbiIsTypeCFifoFull(LCDIF_Type *base, uint8_t displayIndex)

Check whether the FIFO is full in DBI mode type C.

Parameters:
  • base – LCDIF peripheral base address.

  • displayIndex – Display index.

Return values:
  • true – FIFO full.

  • false – FIFO not full.

void LCDIF_DbiSelectArea(LCDIF_Type *base, uint8_t displayIndex, uint16_t startX, uint16_t startY, uint16_t endX, uint16_t endY, bool isTiled)

Select the update area in DBI mode.

Parameters:
  • base – LCDIF peripheral base address.

  • displayIndex – Display index.

  • startX – X coordinate for start pixel.

  • startY – Y coordinate for start pixel.

  • endX – X coordinate for end pixel.

  • endY – Y coordinate for end pixel.

  • isTiled – true if the pixel data is tiled.

static inline void LCDIF_DbiSendCommand(LCDIF_Type *base, uint8_t displayIndex, uint8_t cmd)

Send command to DBI port.

Parameters:
  • base – LCDIF peripheral base address.

  • displayIndex – Display index.

  • cmd – the DBI command to send.

void LCDIF_DbiSendData(LCDIF_Type *base, uint8_t displayIndex, const uint8_t *data, uint32_t dataLen_Byte)

brief Send data to DBI port.

Can be used to send light weight data to panel. To send pixel data in frame buffer, use LCDIF_DbiWriteMem.

param base LCDIF peripheral base address. param displayIndex Display index. param data pointer to data buffer. param dataLen_Byte data buffer length in byte.

void LCDIF_DbiSendCommandAndData(LCDIF_Type *base, uint8_t displayIndex, uint8_t cmd, const uint8_t *data, uint32_t dataLen_Byte)

Send command followed by data to DBI port.

Parameters:
  • base – LCDIF peripheral base address.

  • displayIndex – Display index.

  • cmd – the DBI command to send.

  • data – pointer to data buffer.

  • dataLen_Byte – data buffer length in byte.

static inline void LCDIF_DbiWriteMem(LCDIF_Type *base, uint8_t displayIndex)

Send pixel data in frame buffer to panel controller memory.

This function starts sending the pixel data in frame buffer to panel controller, user can monitor interrupt kLCDIF_Display0FrameDoneInterrupt to know when then data sending finished.

Parameters:
  • base – LCDIF peripheral base address.

  • displayIndex – Display index.

void LCDIF_SetFrameBufferConfig(LCDIF_Type *base, uint8_t displayIndex, const lcdif_fb_config_t *config)

Configure the LCDIF frame buffer.

@Note: For LCDIF of version DC8000 there can be 3 layers in the pre-processing, compared with the older version. Apart from the video layer, there are also 2 overlay layers which shares the same configurations. Use this API to configure the legacy video layer, and use LCDIF_SetOverlayFrameBufferConfig to configure the overlay layers.

Parameters:
  • base – LCDIF peripheral base address.

  • displayIndex – Display index.

  • config – Pointer to the configuration structure.

void LCDIF_FrameBufferGetDefaultConfig(lcdif_fb_config_t *config)

Get default frame buffer configuration.

@Note: For LCDIF of version DC8000 there can be 3 layers in the pre-processing, compared with the older version. Apart from the video layer, there are also 2 overlay layers which shares the same configurations. Use this API to get the default configuration for all the 3 layers.

The default configuration is

config->enable = true;
config->enableGamma = false;
config->format = kLCDIF_PixelFormatRGB565;

Parameters:
  • config – Pointer to the configuration structure.

static inline void LCDIF_SetFrameBufferAddr(LCDIF_Type *base, uint8_t displayIndex, uint32_t address)

Set the frame buffer to LCDIF.

Note

The address must be 128 bytes aligned.

Parameters:
  • base – LCDIF peripheral base address.

  • displayIndex – Display index.

  • address – Frame buffer address.

void LCDIF_SetFrameBufferStride(LCDIF_Type *base, uint8_t displayIndex, uint32_t strideBytes)

Set the frame buffer stride.

Parameters:
  • base – LCDIF peripheral base address.

  • displayIndex – Display index.

  • strideBytes – The stride in byte.

static inline void LCDIF_SetFrameBufferUVAddr(LCDIF_Type *base, uint8_t displayIndex, uint32_t address)

Set the frame buffer to LCDIF for UV plane when the input format is YUV420.

Parameters:
  • base – LCDIF peripheral base address.

  • displayIndex – Display index.

  • address – Frame buffer address.

static inline void LCDIF_SetFrameBufferUVStride(LCDIF_Type *base, uint8_t displayIndex, uint32_t strideBytes)
void LCDIF_SetFrameBufferPosition(LCDIF_Type *base, uint8_t displayIndex, uint16_t topLeftX, uint16_t topLeftY, uint16_t width, uint16_t height)

Configure the video layer position.

@Note: For LCDIF of version DC8000 there can be 3 layers in the pre-processing, compared with the older version. Apart from the video layer, there are also 2 overlay layers which shares the same configurations. Use this API to configure the legacy video layer, and use LCDIF_SetOverlayLayerPosition to configure the overlay layers.

Parameters:
  • base – LCDIF peripheral base address.

  • displayIndex – Display index.

  • topLeftX – The x value of thr top-left coordinate.

  • topLeftY – The y value of thr top-left coordinate.

  • width – The width of the layer.

  • height – The height of the layer.

void LCDIF_SetOverlayLayerConfig(LCDIF_Type *base, uint8_t displayIndex, const lcdif_fb_config_t *config, uint8_t layerIndex)

Configure the overlay layers for LCDIF frame buffer.

@Note: For LCDIF of version DC8000 there can be 3 layers in the pre-processing, compared with the older version. Apart from the video layer, there are also 2 overlay layers which shares the same configurations. Use this API to configure the overlay layers, and use LCDIF_SetFrameBufferConfig to configure the legacy video layer.

Parameters:
  • base – LCDIF peripheral base address.

  • displayIndex – Display index.

  • config – Pointer to the configuration structure.

  • layerIndex – Pointer to the configuration structure.

void LCDIF_SetOverlayLayerPosition(LCDIF_Type *base, uint8_t displayIndex, uint16_t topLeftX, uint16_t topLeftY, uint16_t width, uint16_t height, uint8_t layerIndex)

Configure the overlay layer position.

@Note: For LCDIF of version DC8000 there can be 3 layers in the pre-processing, compared with the older version. Apart from the video layer, there are also 2 overlay layers which shares the same configurations. Use this API to configure the overlay layers, and use LCDIF_SetFrameBufferPosition to configure the legacy video layer.

Parameters:
  • base – LCDIF peripheral base address.

  • displayIndex – Display index.

  • topLeftX – The x value of thr top-left coordinate.

  • topLeftY – The y value of thr top-left coordinate.

  • width – The width of the layer.

  • height – The height of the layer.

  • layerIndex – Pointer to the configuration structure.

void LCDIF_SetOverlayLayerAddr(LCDIF_Type *base, uint8_t displayIndex, uint32_t address, uint8_t layerIndex)

Sets the frame buffer address for overlay layer.

Note

The address must be 64 bytes aligned.

Parameters:
  • base – LCDIF peripheral base address.

  • displayIndex – Display index.

  • address – Frame buffer address.

  • layerIndex – Which layer to configure.

void LCDIF_SetOverlayLayerStride(LCDIF_Type *base, uint8_t displayIndex, uint32_t strideBytes, uint8_t layerIndex)

Sets the frame buffer stride for overlay layer.

Parameters:
  • base – LCDIF peripheral base address.

  • displayIndex – Display index.

  • strideBytes – The stride in byte.

  • layerIndex – Which layer to configure.

static inline void LCDIF_SetOverlayLayerUVAddr(LCDIF_Type *base, uint8_t displayIndex, uint32_t address)

Sets the frame buffer address for overlay layer 0 for UV plane when the input format is YUV420.

Parameters:
  • base – LCDIF peripheral base address.

  • displayIndex – Display index.

  • address – Frame buffer address.

static inline void LCDIF_SetOverlayLayerUVStride(LCDIF_Type *base, uint8_t displayIndex, uint32_t strideBytes)
static inline void LCDIF_SetFrameBufferBackground(LCDIF_Type *base, uint8_t displayIndex, uint32_t color)

Sets the color for background layer.

Parameters:
  • base – LCDIF peripheral base address.

  • displayIndex – Display index.

  • color – Background color in ARGB8888 format.

status_t LCDIF_GetPorterDuffConfig(lcdif_porter_duff_blend_mode_t mode, lcdif_layer_alpha_blend_config_t *config)

brief Get the alpha blend configuration by porter duff blend mode.

param mode The blend mode. param config Pointer to the configuration. retval kStatus_Success Successfully get the configuration. retval kStatus_InvalidArgument The blend mode not supported.

void LCDIF_PanelGetDefaultConfig(lcdif_panel_config_t *config)

Gets default panel configuration.

The default configuration is

config->enable = true;
config->enableGamma = false;
config->order       = kLCDIF_VideoOverlay0Overlay1;
config->endian      = kLCDIF_NoSwap;

Parameters:
  • config – Pointer to the configuration structure.

void LCDIF_SetPanelConfig(LCDIF_Type *base, uint8_t displayIndex, const lcdif_panel_config_t *config)

Configure the LCDIF panel.

Parameters:
  • base – LCDIF peripheral base address.

  • displayIndex – Display index.

  • config – Pointer to the configuration structure.

static inline void LCDIF_SetLayerOrder(LCDIF_Type *base, uint8_t displayIndex, lcdif_layer_order_t order)

Sets the layer order for the color key and alpha blend precess.

Parameters:
  • base – LCDIF peripheral base address.

  • displayIndex – Display index.

  • order – The order of the 3 configurable layers.

static inline void LCDIF_SetEndianMode(LCDIF_Type *base, uint8_t displayIndex, lcdif_endian_mode_t mode)

Sets the endian mode.

Parameters:
  • base – LCDIF peripheral base address.

  • displayIndex – Display index.

  • mode – The byte order for the endian mode.

static inline void LCDIF_EnableUpdate(LCDIF_Type *base, bool enable)

Enables the module to update the new set of configuration in the next frame’s VBLANK.

Parameters:
  • base – LCDIF peripheral base address.

  • enable – True to enable, false to disable.

static inline void LCDIF_EnableGamma(LCDIF_Type *base, bool enable)

Enables the gamma correction.

Parameters:
  • base – LCDIF peripheral base address.

  • enable – True to enable, false to disable.

static inline void LCDIF_EnablePanel(LCDIF_Type *base, bool enable)

Enables the panel output.

When disables, all pixels will be black which allows a panel to have correct timing without any pixels.

Parameters:
  • base – LCDIF peripheral base address.

  • enable – True to enable, false to disable.

static inline void LCDIF_Start(LCDIF_Type *base)

Starts the interface mode transfer. Self-clear.

All registers will be copied to the working set and resets the pixel counter.

Parameters:
  • base – LCDIF peripheral base address.

static inline void LCDIF_Reset(LCDIF_Type *base)

Resets the module. Self-clear.

Parameters:
  • base – LCDIF peripheral base address.

static inline void LCDIF_SetUpdateReady(LCDIF_Type *base)

Set the update of the double buffer register ready.

Call this API after updating any double buffered register to let the change take effect in next v-blank.

Parameters:
  • base – LCDIF peripheral base address.

void LCDIF_SetDitherConfig(LCDIF_Type *base, uint8_t displayIndex, const lcdif_dither_config_t *config)

Set the dither configuration.

Parameters:
  • base – LCDIF peripheral base address.

  • displayIndex – Index to configure.

  • config – Pointer to the configuration structure.

void LCDIF_SetGammaData(LCDIF_Type *base, uint8_t displayIndex, uint16_t startIndex, const uint32_t *gamma, uint16_t gammaLen)

Set the gamma translation values to the LCDIF gamma table.

Parameters:
  • base – LCDIF peripheral base address.

  • displayIndex – Display index.

  • startIndex – Start index in the gamma table that the value will be set to.

  • gamma – The gamma values to set to the gamma table in LCDIF, could be defined using LCDIF_MAKE_GAMMA_VALUE.

  • gammaLen – The length of the gamma.

static inline void LCDIF_EnableInterrupts(LCDIF_Type *base, uint32_t mask)

Enables LCDIF interrupt requests.

Parameters:
  • base – LCDIF peripheral base address.

  • mask – The interrupts to enable, pass in as OR’ed value of _lcdif_interrupt.

static inline void LCDIF_DisableInterrupts(LCDIF_Type *base, uint32_t mask)

Disable LCDIF interrupt requests.

Parameters:
  • base – LCDIF peripheral base address.

  • mask – The interrupts to disable, pass in as OR’ed value of _lcdif_interrupt.

static inline uint32_t LCDIF_GetAndClearInterruptPendingFlags(LCDIF_Type *base)

Get and clear LCDIF interrupt pending status.

Note

The interrupt must be enabled, otherwise the interrupt flags will not assert.

Parameters:
  • base – LCDIF peripheral base address.

Returns:

The interrupt pending status.

void LCDIF_CursorGetDefaultConfig(lcdif_cursor_config_t *config)

Get the hardware cursor default configuration.

The default configuration values are:

config->enable = true;
config->format = kLCDIF_CursorMasked;
config->hotspotOffsetX = 0;
config->hotspotOffsetY = 0;
Parameters:
  • config – Pointer to the hardware cursor configuration structure.

void LCDIF_SetCursorConfig(LCDIF_Type *base, const lcdif_cursor_config_t *config)

Configure the cursor.

Parameters:
  • base – LCDIF peripheral base address.

  • config – Cursor configuration.

static inline void LCDIF_SetCursorHotspotPosition(LCDIF_Type *base, uint16_t x, uint16_t y)

Set the cursor hotspot postion.

Parameters:
  • base – LCDIF peripheral base address.

  • x – X coordinate of the hotspot, range 0 ~ 8191.

  • y – Y coordinate of the hotspot, range 0 ~ 8191.

static inline void LCDIF_SetCursorBufferAddress(LCDIF_Type *base, uint32_t address)

Set the cursor memory address.

Parameters:
  • base – LCDIF peripheral base address.

  • address – Memory address.

void LCDIF_SetCursorColor(LCDIF_Type *base, uint32_t background, uint32_t foreground)

Set the cursor color.

Parameters:
  • base – LCDIF peripheral base address.

  • background – Background color, could be defined use LCDIF_MAKE_CURSOR_COLOR

  • foreground – Foreground color, could be defined use LCDIF_MAKE_CURSOR_COLOR

FSL_LCDIF_DRIVER_VERSION
enum _lcdif_polarity_flags

LCDIF signal polarity flags.

Values:

enumerator kLCDIF_VsyncActiveLow

VSYNC active low.

enumerator kLCDIF_VsyncActiveHigh

VSYNC active high.

enumerator kLCDIF_HsyncActiveLow

HSYNC active low.

enumerator kLCDIF_HsyncActiveHigh

HSYNC active high.

enumerator kLCDIF_DataEnableActiveLow

Data enable line active low.

enumerator kLCDIF_DataEnableActiveHigh

Data enable line active high.

enumerator kLCDIF_DriveDataOnFallingClkEdge

Drive data on falling clock edge, capture data on rising clock edge.

enumerator kLCDIF_DriveDataOnRisingClkEdge

Drive data on falling clock edge, capture data on rising clock edge.

enum _lcdif_output_format

LCDIF DPI output format.

Values:

enumerator kLCDIF_Output16BitConfig1

16-bit configuration 1. RGB565: XXXXXXXX_RRRRRGGG_GGGBBBBB.

enumerator kLCDIF_Output16BitConfig2

16-bit configuration 2. RGB565: XXXRRRRR_XXGGGGGG_XXXBBBBB.

enumerator kLCDIF_Output16BitConfig3

16-bit configuration 3. RGB565: XXRRRRRX_XXGGGGGG_XXBBBBBX.

enumerator kLCDIF_Output18BitConfig1

18-bit configuration 1. RGB666: XXXXXXRR_RRRRGGGG_GGBBBBBB.

enumerator kLCDIF_Output18BitConfig2

18-bit configuration 2. RGB666: XXRRRRRR_XXGGGGGG_XXBBBBBB.

enumerator kLCDIF_Output24Bit

24-bit.

enum _lcdif_fb_format

LCDIF frame buffer pixel format.

Values:

enumerator kLCDIF_PixelFormatARGB4444

ARGB4444, 16-bit each pixel, 4-bit each element.

enumerator kLCDIF_PixelFormatARGB1555

ARGB1555, 16-bit each pixel, 5-bit each element.

enumerator kLCDIF_PixelFormatRGB565

RGB565, 16-bit each pixel.

enumerator kLCDIF_PixelFormatARGB8888

ARGB8888, 32-bit each pixel, 8-bit each element.

enumerator kLCDIF_PixelFormatRGB888

RGB888, 24-bit each pixel, 8-bit each element.

enumerator kLCDIF_PixelFormatARGB8565

ARGB8565, 24-bit each pixel.

enumerator kLCDIF_PixelFormatARGB8888Tiled

ARGB8888, 32-bit each pixel, 8-bit each element in tiled format, not supported in overlay layer 1.

enumerator kLCDIF_PixelFormatYUV422Tiled

YUV422, component order V-Y-U-Y, in tiled format, not supported in overlay layer 1.

enumerator kLCDIF_PixelFormatYUV420Tiled

YUV420, in tiled format, need 2 plane, not supported in overlay layer 1.

enumerator kLCDIF_PixelFormatRGB888Tiled

RGB888, 24-bit each pixel, 8-bit each element in tiled format, not supported in overlay layer 1.

enumerator kLCDIF_PixelFormatARGB8565Tiled

ARGB8565, 24-bit each pixel in tiled format, not supported in overlay layer 1.

enum _lcdif_layer_input_order

LCDIF layer input pixel order.

Values:

enumerator kLCDIF_PixelInputOrderARGB

Input order ARGB.

enumerator kLCDIF_PixelInputOrderRGBA

Input order RGBA.

enumerator kLCDIF_PixelInputOrderABGR

Input order ABGR.

enumerator kLCDIF_PixelInputOrderBGRA

Input order BGRA.

enum _lcdif_layer_rotate_flip

LCDIF layer rotation or flip configuration.

Values:

enumerator kLCDIF_Rotate0

Clock wise rotate 0 degree.

enumerator kLCDIF_Rotate90

Clock wise rotate 90 degree, not supported yet.

enumerator kLCDIF_Rotate180

Clock wise rotate 180 degree.

enumerator kLCDIF_Rotate270

Clock wise rotate 270 degree, not supported yet.

enumerator kLCDIF_FlipHorizontal

Horizontal flip.

enumerator kLCDIF_FlipVertical

Vertical flip.

enum _lcdif_layer_decompress_mode

LCDIF layer input data decompress mode.

Values:

enumerator kLCDIF_DecompressNone

Decompression disabled. The input is straight RGB/YUV data.

enumerator kLCDIF_DecompressDECNanoNoneSample

DECNano decompression with none sample.

enumerator kLCDIF_DecompressDECNanoHSample

DECNano decompression with horizontal sample.

enumerator kLCDIF_DecompressDECNanoHVSample

DECNano decompression with both horizontal and vertical sample.

enumerator kLCDIF_DecompressETC2

ETC2 decompression.

Alpha blend alpha component mode. .

Values:

enumerator kLCDIF_AlphaStraight

Use straight alpha, s0_alpha’ = s0_alpha.

enumerator kLCDIF_AlphaInversed

Use inversed alpha, s0_alpha’ = 0xFF - s0_alpha.

LCDIF layer global alpha mode for alpha blend. .

Values:

enumerator kLCDIF_AlphaLocal

Use the alpha(or inversed alpha) component directly.

enumerator kLCDIF_AlphaGlobal

Use the global alpha instead.

enumerator kLCDIF_AlphaScaled

Multiply the alpha(or inversed alpha) component by the global alpha.

Alpha blend factor mode. .

Values:

enumerator kLCDIF_AlphaFactorZero

Use 0 as the blending factor.

enumerator kLCDIF_AlphaFactorOne

Use 1 as the blending factor.

enumerator kLCDIF_AlphaFactorStraight

Use the modified alpha component(As’’ for source layer or Ad’’ for destination layer) as the blending factor.

enumerator kLCDIF_AlphaFactorInversed

Use the inversed alpha component(1-As’’ for source layer or 1-Ad’’ for destination layer) as the blending factor.

enum _lcdif_porter_duff_blend_mode

LCDIF Porter Duff blend mode. Note: don’t change the enum item value.

Values:

enumerator kLCDIF_PorterDuffSrc

Source Only

enumerator kLCDIF_PorterDuffAtop

Source Atop

enumerator kLCDIF_PorterDuffOver

Source Over

enumerator kLCDIF_PorterDuffIn

Source In.

enumerator kLCDIF_PorterDuffOut

Source Out.

enumerator kLCDIF_PorterDuffDst

Destination Only.

enumerator kLCDIF_PorterDuffDstAtop

Destination Atop.

enumerator kLCDIF_PorterDuffDstOver

Destination Over.

enumerator kLCDIF_PorterDuffDstIn

Destination In.

enumerator kLCDIF_PorterDuffDstOut

Destination Out.

enumerator kLCDIF_PorterDuffPlus

Clear.

enumerator kLCDIF_PorterDuffXor

XOR.

enumerator kLCDIF_PorterDuffClear

Clear.

enumerator kLCDIF_PorterDuffMax
enum _lcdif_layer_convert_standard

LCDIF Color space convert standard between RGB and YUV when the input format is tiled YUV.

Values:

enumerator kLCDIF_ConvertBT601

Use standard BT601.

enumerator kLCDIF_ConvertBT709

Use standard BT709.

enum _lcdif_layer_order

LCDIF the layer order from bottom to top.

There are 5 layers in total, apart from the background layer fixed in the bottom, and the cursor layer on top that does not participate in the color key and alpha blend, the order of the other 3 layers video/graphic layer, overlay layer 0 and 1 can be changed. During color key or alpha blend process, between 2 adjacent layers, the lower layer is considered as destination layer and the upper layer is considered as source layer. The precess is performed from bottom to top, after processing 2 layes, the generated new layer will be considered as destination layer then participate in the next process with the next upper layer.

Values:

enumerator kLCDIF_VideoOverlay0Overlay1

In the order of video, overlay0, overlay1.

enumerator kLCDIF_VideoOverlay1Overlay0

In the order of video, overlay1, overlay0.

enumerator kLCDIF_Overlay0VideoOverlay1

In the order of overlay0, video, overlay1.

enumerator kLCDIF_Overlay0Overlay1Video

In the order of overlay0, overlay1, video.

enumerator kLCDIF_Overlay1VideoOverlay0

In the order of overlay1, video, overlay0.

enumerator kLCDIF_Overlay1Overlay0Video

In the order of overlay1, overlay0, video.

enum _lcdif_endian_mode

LCDIF the pixel source endian mode.

Values:

enumerator kLCDIF_NoSwap

No swap.

enumerator kLCDIF_HalfWordSwap

16-bit boundary swap, from 0123 to 1032.

enumerator kLCDIF_WordSwap

32-bit boundary swap, from 0123 to 3210.

enum _lcdif_interrupt

LCDIF interrupt and status.

Values:

enumerator kLCDIF_Display0FrameDoneInterrupt

The last pixel of visible area in frame is shown.

enumerator kLCDIF_Display0DbiConfigErrorInterrupt

The DBI command is illegal.

enumerator kLCDIF_PanelUnderflowInterrupt

The AXI clock and pixel clock mismatch causing data supply insufficient.

enumerator kLCDIF_SoftwareResetDoneInterrupt

A software reset has completed.

enumerator kLCDIF_BusErrorInterrupt

An AXI bus transfer error occurrs.

enum _lcdif_cursor_format

LCDIF cursor format.

Values:

enumerator kLCDIF_CursorMasked

Masked format.

enumerator kLCDIF_CursorARGB8888

ARGB8888.

enum _lcdif_dbi_cmd_flag

LCDIF DBI command flag.

Values:

enumerator kLCDIF_DbiCmdAddress

Send address (or command).

enumerator kLCDIF_DbiCmdWriteMem

Start write memory.

enumerator kLCDIF_DbiCmdData

Send data.

enumerator kLCDIF_DbiCmdReadMem

Start read memory.

enum _lcdif_dbi_out_format

LCDIF DBI output format.

Values:

enumerator kLCDIF_DbiOutD8RGB332

8-bit data bus width, pixel RGB332. For type A or B. 1 pixel sent in 1 cycle.

enumerator kLCDIF_DbiOutD8RGB444

8-bit data bus width, pixel RGB444. For type A or B. 2 pixels sent in 3 cycles.

enumerator kLCDIF_DbiOutD8RGB565

8-bit data bus width, pixel RGB565. For type A or B. 1 pixel sent in 2 cycles.

enumerator kLCDIF_DbiOutD8RGB666

8-bit data bus width, pixel RGB666. For type A or B. 1 pixel sent in 3 cycles, data bus 2 LSB not used.

enumerator kLCDIF_DbiOutD8RGB888

8-bit data bus width, pixel RGB888. For type A or B. 1 pixel sent in 3 cycles.

enumerator kLCDIF_DbiOutD9RGB666

9-bit data bus width, pixel RGB666. For type A or B. 1 pixel sent in 2 cycles.

enumerator kLCDIF_DbiOutD16RGB332

16-bit data bus width, pixel RGB332. For type A or B. 2 pixels sent in 1 cycle.

enumerator kLCDIF_DbiOutD16RGB444

16-bit data bus width, pixel RGB444. For type A or B. 1 pixel sent in 1 cycle, data bus 4 MSB not used.

enumerator kLCDIF_DbiOutD16RGB565

16-bit data bus width, pixel RGB565. For type A or B. 1 pixel sent in 1 cycle.

enumerator kLCDIF_DbiOutD16RGB666Option1

16-bit data bus width, pixel RGB666. For type A or B. 2 pixels sent in 3 cycles.

enumerator kLCDIF_DbiOutD16RGB666Option2

16-bit data bus width, pixel RGB666. For type A or B. 1 pixel sent in 2 cycles.

enumerator kLCDIF_DbiOutD16RGB888Option1

16-bit data bus width, pixel RGB888. For type A or B. 2 pixels sent in 3 cycles.

enumerator kLCDIF_DbiOutD16RGB888Option2

16-bit data bus width, pixel RGB888. For type A or B. 1 pixel sent in 2 cycles.

enumerator kLCDIF_DbiOutD1RGB565Option1

1-bit data bus width, pixel RGB565. For type C option 1, use extra bit to distinguish Data and Command (DC).

enumerator kLCDIF_DbiOutD1RGB565Option2

1-bit data bus width, pixel RGB565. For type C option 2, use extra byte to distinguish Data and Command (DC).

enumerator kLCDIF_DbiOutD1RGB565Option3

1-bit data bus width, pixel RGB565. For type C option 3, use extra DC line to distinguish Data and Command (DC).

enumerator kLCDIF_DbiOutD1RG888Option1

1-bit data bus width, pixel RGB888. For type C option 1, use extra bit to distinguish Data and Command (DC).

enumerator kLCDIF_DbiOutD1RG888Option2

1-bit data bus width, pixel RGB888. For type C option 2, use extra byte to distinguish Data and Command (DC).

enumerator kLCDIF_DbiOutD1RG888Option3

1-bit data bus width, pixel RGB888. For type C option 3, use extra DC line to distinguish Data and Command (DC).

enum _lcdif_dbi_type

LCDIF DBI type.

Values:

enumerator kLCDIF_DbiTypeA_FixedE

Selects DBI type A fixed E mode, 68000, Motorola mode.

enumerator kLCDIF_DbiTypeA_ClockedE

Selects DBI Type A Clocked E mode, 68000, Motorola mode.

enumerator kLCDIF_DbiTypeB

Selects DBI type B, 8080, Intel mode.

enumerator kLCDIF_DbiTypeC

Selects DBI type C, SPI mode.

enum _lcdif_dbi_out_swizzle

LCDIF DBI output swizzle.

Values:

enumerator kLCDIF_DbiOutSwizzleRGB

RGB

enumerator kLCDIF_DbiOutSwizzleBGR

BGR

typedef enum _lcdif_output_format lcdif_output_format_t

LCDIF DPI output format.

typedef struct _lcdif_dpi_config lcdif_dpi_config_t

Configuration for LCDIF module to work in DBI mode.

typedef enum _lcdif_fb_format lcdif_fb_format_t

LCDIF frame buffer pixel format.

typedef enum _lcdif_layer_input_order lcdif_layer_input_order_t

LCDIF layer input pixel order.

typedef enum _lcdif_layer_rotate_flip lcdif_layer_rotate_flip_t

LCDIF layer rotation or flip configuration.

typedef struct _lcdif_layer_colorkey lcdif_layer_colorkey_t

LCDIF layer color key configuration.

typedef enum _lcdif_layer_decompress_mode lcdif_layer_decompress_mode_t

LCDIF layer input data decompress mode.

typedef enum _lcdif_porter_duff_blend_mode lcdif_porter_duff_blend_mode_t

LCDIF Porter Duff blend mode. Note: don’t change the enum item value.

typedef enum _lcdif_layer_convert_standard lcdif_layer_convert_standard_t

LCDIF Color space convert standard between RGB and YUV when the input format is tiled YUV.

typedef struct _lcdif_fb_config lcdif_fb_config_t

LCDIF frame buffer configuration.

For LCDIF of DC8000 version, there are 3 layers in the pre-processing, all shares the same frame buffer configuration.

typedef enum _lcdif_layer_order lcdif_layer_order_t

LCDIF the layer order from bottom to top.

There are 5 layers in total, apart from the background layer fixed in the bottom, and the cursor layer on top that does not participate in the color key and alpha blend, the order of the other 3 layers video/graphic layer, overlay layer 0 and 1 can be changed. During color key or alpha blend process, between 2 adjacent layers, the lower layer is considered as destination layer and the upper layer is considered as source layer. The precess is performed from bottom to top, after processing 2 layes, the generated new layer will be considered as destination layer then participate in the next process with the next upper layer.

typedef enum _lcdif_endian_mode lcdif_endian_mode_t

LCDIF the pixel source endian mode.

typedef struct _lcdif_panel_config lcdif_panel_config_t

LCDIF panel configuration.

typedef enum _lcdif_cursor_format lcdif_cursor_format_t

LCDIF cursor format.

typedef struct _lcdif_cursor_config lcdif_cursor_config_t

LCDIF cursor configuration.

typedef struct _lcdif_dither_config lcdif_dither_config_t

LCDIF dither configuration.

  1. Decide which bit of pixel color to enhance. This is configured by the lcdif_dither_config_t::redSize, lcdif_dither_config_t::greenSize, and lcdif_dither_config_t::blueSize. For example, setting redSize=6 means it is the 6th bit starting from the MSB that we want to enhance, in other words, it is the RedColor[2]bit from RedColor[7:0]. greenSize and blueSize function in the same way.

  2. Create the look-up table. a. The Look-Up Table includes 16 entries, 4 bits for each. b. The Look-Up Table provides a value U[3:0] through the index X[1:0] and Y[1:0]. c. The color value RedColor[3:0] is used to compare with this U[3:0]. d. If RedColor[3:0] > U[3:0], and RedColor[7:2] is not 6’b111111, then the final color value is: NewRedColor = RedColor[7:2] + 1’b1. e. If RedColor[3:0] <= U[3:0], then NewRedColor = RedColor[7:2].

typedef enum _lcdif_dbi_out_format lcdif_dbi_out_format_t

LCDIF DBI output format.

typedef enum _lcdif_dbi_type lcdif_dbi_type_t

LCDIF DBI type.

typedef enum _lcdif_dbi_out_swizzle lcdif_dbi_out_swizzle_t

LCDIF DBI output swizzle.

typedef struct _lcdif_dbi_config lcdif_dbi_config_t

LCDIF DBI configuration.

LCDIF_MAKE_CURSOR_COLOR(r, g, b)

Construct the cursor color, every element should be in the range of 0 ~ 255.

LCDIF_MAKE_GAMMA_VALUE(r, g, b)

Construct the gamma value set to LCDIF gamma table, every element should be in the range of 0~255.

LCDIF_MAKE_BACKGROUND_VALUE(a, r, g, b)

Construct the colour value for the background layer.

LCDIF_ALIGN_ADDR(addr, align)

Calculate the aligned address for LCDIF buffer.

LCDIF_FB_ALIGN

The frame buffer should be 128 byte aligned.

LCDIF_FB_UV_ALIGN
LCDIF_GAMMA_INDEX_MAX

Gamma index max value.

LCDIF_CURSOR_SIZE

The cursor size is 32 x 32.

LCDIF_FRAMEBUFFERCONFIG0_OUTPUT_MASK
LCDIF_ADDR_CPU_2_IP(addr)
struct _lcdif_dpi_config
#include <fsl_lcdif.h>

Configuration for LCDIF module to work in DBI mode.

Public Members

uint16_t panelWidth

Display panel width, pixels per line.

uint16_t panelHeight

Display panel height, how many lines per panel.

uint8_t hsw

HSYNC pulse width.

uint8_t hfp

Horizontal front porch.

uint8_t hbp

Horizontal back porch.

uint8_t vsw

VSYNC pulse width.

uint8_t vfp

Vrtical front porch.

uint8_t vbp

Vertical back porch.

uint32_t polarityFlags

OR’ed value of _lcdif_polarity_flags, used to contol the signal polarity.

lcdif_output_format_t format

DPI output format.

struct _lcdif_layer_colorkey
#include <fsl_lcdif.h>

LCDIF layer color key configuration.

Public Members

bool enable

Enable the color keying.

struct lcdif_layer_alpha_blend_config_t
#include <fsl_lcdif.h>

LCDIF frame buffer alpha blend configuration.

The alpha blending formula is C = Fs x Cs + Fd x Cd, and A = Fs x As’’ + Fd x Ad’’. C/A: generated final color/alpha component, Cs/Cd: original color component for source and destination layer, As’’/Ad’’: modified alpha component for source and destination layer, take As’’ as example, As’ = As or (1 - As), chosen by srcAlphaMode As’’ = As’ or Ags or (As’ x Ags), chosen by srcGlobalAlphaMode, Ags configured by srcGlobalAlpha Fs/Fd: blending factor for source/destination layer, take Fs as example, Fs = 0 or 1 or As’’ or (1 - As’’), chosen by srcFactorMode

Public Members

uint32_t enable

Enables or disables alpha blend configuration.

uint32_t srcAlphaMode

Use the straight(As) or inversed(1-As) alpha value for modified alpha for the source layer, see lcdif_layer_alpha_mode_t.

uint32_t srcGlobalAlphaMode

Source layer global alpha mode, see lcdif_layer_global_alpha_mode_t.

uint32_t srcFactorMode

Source layer blend factor mode, see lcdif_layer_alpha_factor_mode_t.

uint32_t useSrcAlpha

Set to true to use source alpha for the source blending factor, otherwise use the destination alpha.

uint32_t dstAlphaMode

Use the straight(Ad) or inversed(1-Ad) alpha value for modified alpha for the destination layer, see lcdif_layer_alpha_mode_t.

uint32_t dstGlobalAlphaMode

Destination layer global alpha mode, see lcdif_layer_global_alpha_mode_t.

uint32_t dstFactorMode

Destination layer blend factor mode, see lcdif_layer_alpha_factor_mode_t.

uint32_t useDstAlpha

Set to true to use destination alpha for the destination blending factor, otherwise use the source alpha.

uint32_t srcGlobalAlpha

Source layer global alpha value, 0~255.

uint32_t dstGlobalAlpha

Destination layer global alpha value, 0~255.

struct _lcdif_fb_config
#include <fsl_lcdif.h>

LCDIF frame buffer configuration.

For LCDIF of DC8000 version, there are 3 layers in the pre-processing, all shares the same frame buffer configuration.

Public Members

bool enable

Enable the layer output.

bool enableClear

Enable the color clear for this layer, onve enabled, the whole layer will be filled with the color configured in clearValue.

uint32_t clearValue

The value used for layer clear.

lcdif_fb_format_t format

Frame buffer output pixel format.

lcdif_layer_convert_standard_t standard

Color space convert standard, not used for overlay layer 1 since it does not support tile YUV input.

bool enableUVSwizzle

Swizzle the U/V components, not used for overlay layer 1 since it does not support tile YUV input.

lcdif_layer_input_order_t inOrder

Color component order of the input pixel.

lcdif_layer_colorkey_t colorkey

Color key configuration.

lcdif_layer_decompress_mode_t decompress

LCDIF layer input data decompress mode.

lcdif_layer_rotate_flip_t rotateFlipMode

LCDIF frame buffer rotation or flip configuration.

lcdif_layer_alpha_blend_config_t alpha

The alpha blending configuration.

uint16_t topLeftX

The x value of thr top-left coordinate.

uint16_t topLeftY

The y value of thr top-left coordinate.

uint16_t width

The width of the layer.

uint16_t height

The height of the layer.

struct _lcdif_panel_config
#include <fsl_lcdif.h>

LCDIF panel configuration.

Public Members

bool enable

Enable the frame buffer output.

bool enableGamma

Enable the gamma correction.

lcdif_layer_order_t order

Layer order.

lcdif_endian_mode_t endian

Pixel source endian mode.

struct _lcdif_cursor_config
#include <fsl_lcdif.h>

LCDIF cursor configuration.

Public Members

bool enable

Enable the cursor or not.

lcdif_cursor_format_t format

Cursor format.

uint8_t hotspotOffsetX

Offset of the hotspot to top left point, range 0 ~ 31

uint8_t hotspotOffsetY

Offset of the hotspot to top left point, range 0 ~ 31

struct _lcdif_dither_config
#include <fsl_lcdif.h>

LCDIF dither configuration.

  1. Decide which bit of pixel color to enhance. This is configured by the lcdif_dither_config_t::redSize, lcdif_dither_config_t::greenSize, and lcdif_dither_config_t::blueSize. For example, setting redSize=6 means it is the 6th bit starting from the MSB that we want to enhance, in other words, it is the RedColor[2]bit from RedColor[7:0]. greenSize and blueSize function in the same way.

  2. Create the look-up table. a. The Look-Up Table includes 16 entries, 4 bits for each. b. The Look-Up Table provides a value U[3:0] through the index X[1:0] and Y[1:0]. c. The color value RedColor[3:0] is used to compare with this U[3:0]. d. If RedColor[3:0] > U[3:0], and RedColor[7:2] is not 6’b111111, then the final color value is: NewRedColor = RedColor[7:2] + 1’b1. e. If RedColor[3:0] <= U[3:0], then NewRedColor = RedColor[7:2].

Public Members

bool enable

Enable or not.

uint32_t low

Low part of the look up table.

uint32_t high

High part of the look up table.

struct _lcdif_dbi_config
#include <fsl_lcdif.h>

LCDIF DBI configuration.

Public Members

lcdif_dbi_out_swizzle_t swizzle

Swizzle.

lcdif_dbi_out_format_t format

Output format.

uint8_t acTimeUnit

Time unit for AC characteristics.

lcdif_dbi_type_t type

DBI type.

bool reversePolarity

Reverse the DC pin polarity.

uint16_t writeWRPeriod

WR signal period, Cycle number = writeWRPeriod * (acTimeUnit + 1), must be no less than 3. Only for type A and type b.

uint8_t writeWRAssert

Cycle number = writeWRAssert * (acTimeUnit + 1), only for type A and type B. With kLCDIF_DbiTypeA_FixedE: Not used. With kLCDIF_DbiTypeA_ClockedE: Time to assert E. With kLCDIF_DbiTypeB: Time to assert WRX.

uint8_t writeCSAssert

Cycle number = writeCSAssert * (acTimeUnit + 1), only for type A and type B. With kLCDIF_DbiTypeA_FixedE: Time to assert CSX. With kLCDIF_DbiTypeA_ClockedE: Not used. With kLCDIF_DbiTypeB: Time to assert CSX.

uint16_t writeWRDeassert

Cycle number = writeWRDeassert * (acTimeUnit + 1), only for type A and type B. With kLCDIF_DbiTypeA_FixedE: Not used. With kLCDIF_DbiTypeA_ClockedE: Time to de-assert E. With kLCDIF_DbiTypeB: Time to de-assert WRX.

uint16_t writeCSDeassert

Cycle number = writeCSDeassert * (acTimeUnit + 1), only for type A and type B. With kLCDIF_DbiTypeA_FixedE: Time to de-assert CSX. With kLCDIF_DbiTypeA_ClockedE: Not used. With kLCDIF_DbiTypeB: Time to de-assert CSX.

uint8_t typeCTas

How many sdaClk cycles in Tas phase, only for Type C option 3, at least 1.

uint8_t typeCSCLTwrl

How many sdaClk cycles in Twrl phase, only for Type C, at least 1.

uint8_t typeCSCLTwrh

How many sdaClk cycles in Twrh phase, only for Type C, at least 1.

LPADC: 12-bit SAR Analog-to-Digital Converter Driver

void LPADC_Init(ADC_Type *base, const lpadc_config_t *config)

Initializes the LPADC module.

Parameters:
  • base – LPADC peripheral base address.

  • config – Pointer to configuration structure. See “lpadc_config_t”.

void LPADC_GetDefaultConfig(lpadc_config_t *config)

Gets an available pre-defined settings for initial configuration.

This function initializes the converter configuration structure with an available settings. The default values are:

config->enableInDozeMode        = true;
config->enableAnalogPreliminary = false;
config->powerUpDelay            = 0x80;
config->referenceVoltageSource  = kLPADC_ReferenceVoltageAlt1;
config->powerLevelMode          = kLPADC_PowerLevelAlt1;
config->triggerPriorityPolicy   = kLPADC_TriggerPriorityPreemptImmediately;
config->enableConvPause         = false;
config->convPauseDelay          = 0U;
config->FIFOWatermark           = 0U;

Parameters:
  • config – Pointer to configuration structure.

void LPADC_Deinit(ADC_Type *base)

De-initializes the LPADC module.

Parameters:
  • base – LPADC peripheral base address.

static inline void LPADC_Enable(ADC_Type *base, bool enable)

Switch on/off the LPADC module.

Parameters:
  • base – LPADC peripheral base address.

  • enable – switcher to the module.

static inline void LPADC_DoResetFIFO(ADC_Type *base)

Do reset the conversion FIFO.

Parameters:
  • base – LPADC peripheral base address.

static inline void LPADC_DoResetConfig(ADC_Type *base)

Do reset the module’s configuration.

Reset all ADC internal logic and registers, except the Control Register (ADCx_CTRL).

Parameters:
  • base – LPADC peripheral base address.

static inline uint32_t LPADC_GetStatusFlags(ADC_Type *base)

Get status flags.

Parameters:
  • base – LPADC peripheral base address.

Returns:

status flags’ mask. See to _lpadc_status_flags.

static inline void LPADC_ClearStatusFlags(ADC_Type *base, uint32_t mask)

Clear status flags.

Only the flags can be cleared by writing ADCx_STATUS register would be cleared by this API.

Parameters:
  • base – LPADC peripheral base address.

  • mask – Mask value for flags to be cleared. See to _lpadc_status_flags.

static inline uint32_t LPADC_GetTriggerStatusFlags(ADC_Type *base)

Get trigger status flags to indicate which trigger sequences have been completed or interrupted by a high priority trigger exception.

Parameters:
  • base – LPADC peripheral base address.

Returns:

The OR’ed value of _lpadc_trigger_status_flags.

static inline void LPADC_ClearTriggerStatusFlags(ADC_Type *base, uint32_t mask)

Clear trigger status flags.

Parameters:
  • base – LPADC peripheral base address.

  • mask – The mask of trigger status flags to be cleared, should be the OR’ed value of _lpadc_trigger_status_flags.

static inline void LPADC_EnableInterrupts(ADC_Type *base, uint32_t mask)

Enable interrupts.

Parameters:
  • base – LPADC peripheral base address.

  • mask – Mask value for interrupt events. See to _lpadc_interrupt_enable.

static inline void LPADC_DisableInterrupts(ADC_Type *base, uint32_t mask)

Disable interrupts.

Parameters:
  • base – LPADC peripheral base address.

  • mask – Mask value for interrupt events. See to _lpadc_interrupt_enable.

static inline void LPADC_EnableFIFOWatermarkDMA(ADC_Type *base, bool enable)

Switch on/off the DMA trigger for FIFO watermark event.

Parameters:
  • base – LPADC peripheral base address.

  • enable – Switcher to the event.

static inline uint32_t LPADC_GetConvResultCount(ADC_Type *base)

Get the count of result kept in conversion FIFO.

Parameters:
  • base – LPADC peripheral base address.

Returns:

The count of result kept in conversion FIFO.

bool LPADC_GetConvResult(ADC_Type *base, lpadc_conv_result_t *result)

Get the result in conversion FIFO.

Parameters:
  • base – LPADC peripheral base address.

  • result – Pointer to structure variable that keeps the conversion result in conversion FIFO.

Returns:

Status whether FIFO entry is valid.

void LPADC_GetConvResultBlocking(ADC_Type *base, lpadc_conv_result_t *result)

Get the result in conversion FIFO using blocking method.

Parameters:
  • base – LPADC peripheral base address.

  • result – Pointer to structure variable that keeps the conversion result in conversion FIFO.

void LPADC_SetConvTriggerConfig(ADC_Type *base, uint32_t triggerId, const lpadc_conv_trigger_config_t *config)

Configure the conversion trigger source.

Each programmable trigger can launch the conversion command in command buffer.

Parameters:
  • base – LPADC peripheral base address.

  • triggerId – ID for each trigger. Typically, the available value range is from 0.

  • config – Pointer to configuration structure. See to lpadc_conv_trigger_config_t.

void LPADC_GetDefaultConvTriggerConfig(lpadc_conv_trigger_config_t *config)

Gets an available pre-defined settings for trigger’s configuration.

This function initializes the trigger’s configuration structure with an available settings. The default values are:

config->targetCommandId        = 0U;
config->delayPower             = 0U;
config->priority               = 0U;
config->channelAFIFOSelect     = 0U;
config->channelBFIFOSelect     = 0U;
config->enableHardwareTrigger  = false;

Parameters:
  • config – Pointer to configuration structure.

static inline void LPADC_DoSoftwareTrigger(ADC_Type *base, uint32_t triggerIdMask)

Do software trigger to conversion command.

Parameters:
  • base – LPADC peripheral base address.

  • triggerIdMask – Mask value for software trigger indexes, which count from zero.

static inline void LPADC_EnableHardwareTriggerCommandSelection(ADC_Type *base, uint32_t triggerId, bool enable)

Enable hardware trigger command selection.

This function will use the hardware trigger command from ADC_ETC.The trigger command is then defined by ADC hardware trigger command selection field in ADC_ETC- >TRIGx_CHAINy_z_n[CSEL].

Parameters:
  • base – LPADC peripheral base address.

  • triggerId – ID for each trigger. Typically, the available value range is from 0.

  • enable – True to enable or flase to disable.

void LPADC_SetConvCommandConfig(ADC_Type *base, uint32_t commandId, const lpadc_conv_command_config_t *config)

Configure conversion command.

Note

The number of compare value register on different chips is different, that is mean in some chips, some command buffers do not have the compare functionality.

Parameters:
  • base – LPADC peripheral base address.

  • commandId – ID for command in command buffer. Typically, the available value range is 1 - 15.

  • config – Pointer to configuration structure. See to lpadc_conv_command_config_t.

void LPADC_GetDefaultConvCommandConfig(lpadc_conv_command_config_t *config)

Gets an available pre-defined settings for conversion command’s configuration.

This function initializes the conversion command’s configuration structure with an available settings. The default values are:

config->sampleScaleMode            = kLPADC_SampleFullScale;
config->channelBScaleMode          = kLPADC_SampleFullScale;
config->sampleChannelMode          = kLPADC_SampleChannelSingleEndSideA;
config->channelNumber              = 0U;
config->channelBNumber             = 0U;
config->chainedNextCommandNumber   = 0U;
config->enableAutoChannelIncrement = false;
config->loopCount                  = 0U;
config->hardwareAverageMode        = kLPADC_HardwareAverageCount1;
config->sampleTimeMode             = kLPADC_SampleTimeADCK3;
config->hardwareCompareMode        = kLPADC_HardwareCompareDisabled;
config->hardwareCompareValueHigh   = 0U;
config->hardwareCompareValueLow    = 0U;
config->conversionResolutionMode   = kLPADC_ConversionResolutionStandard;
config->enableWaitTrigger          = false;
config->enableChannelB             = false;

Parameters:
  • config – Pointer to configuration structure.

void LPADC_EnableCalibration(ADC_Type *base, bool enable)

Enable the calibration function.

When CALOFS is set, the ADC is configured to perform a calibration function anytime the ADC executes a conversion. Any channel selected is ignored and the value returned in the RESFIFO is a signed value between -31 and 31. -32 is not a valid and is never a returned value. Software should copy the lower 6- bits of the conversion result stored in the RESFIFO after a completed calibration conversion to the OFSTRIM field. The OFSTRIM field is used in normal operation for offset correction.

Parameters:
  • base – LPADC peripheral base address.

  • enable – switcher to the calibration function.

static inline void LPADC_SetOffsetValue(ADC_Type *base, uint32_t value)

Set proper offset value to trim ADC.

To minimize the offset during normal operation, software should read the conversion result from the RESFIFO calibration operation and write the lower 6 bits to the OFSTRIM register.

Parameters:
  • base – LPADC peripheral base address.

  • value – Setting offset value.

void LPADC_DoAutoCalibration(ADC_Type *base)

Do auto calibration.

Calibration function should be executed before using converter in application. It used the software trigger and a dummy conversion, get the offset and write them into the OFSTRIM register. It called some of functional API including: -LPADC_EnableCalibration(…) -LPADC_LPADC_SetOffsetValue(…) -LPADC_SetConvCommandConfig(…) -LPADC_SetConvTriggerConfig(…)

Parameters:
  • base – LPADC peripheral base address.

  • base – LPADC peripheral base address.

static inline void LPADC_EnableOffsetCalibration(ADC_Type *base, bool enable)

Enable the offset calibration function.

Parameters:
  • base – LPADC peripheral base address.

  • enable – switcher to the calibration function.

static inline void LPADC_SetOffsetCalibrationMode(ADC_Type *base, lpadc_offset_calibration_mode_t mode)

Set offset calibration mode.

Parameters:
  • base – LPADC peripheral base address.

  • mode – set offset calibration mode.see to lpadc_offset_calibration_mode_t .

void LPADC_DoOffsetCalibration(ADC_Type *base)

Do offset calibration.

Parameters:
  • base – LPADC peripheral base address.

void LPADC_PrepareAutoCalibration(ADC_Type *base)

Prepare auto calibration, LPADC_FinishAutoCalibration has to be called before using the LPADC. LPADC_DoAutoCalibration has been split in two API to avoid to be stuck too long in the function.

Parameters:
  • base – LPADC peripheral base address.

void LPADC_FinishAutoCalibration(ADC_Type *base)

Finish auto calibration start with LPADC_PrepareAutoCalibration.

Note

This feature is used for LPADC with CTRL[CALOFSMODE].

Parameters:
  • base – LPADC peripheral base address.

void LPADC_GetCalibrationValue(ADC_Type *base, lpadc_calibration_value_t *ptrCalibrationValue)

Get calibration value into the memory which is defined by invoker.

Note

Please note the ADC will be disabled temporary.

Note

This function should be used after finish calibration.

Parameters:
  • base – LPADC peripheral base address.

  • ptrCalibrationValue – Pointer to lpadc_calibration_value_t structure, this memory block should be always powered on even in low power modes.

void LPADC_SetCalibrationValue(ADC_Type *base, const lpadc_calibration_value_t *ptrCalibrationValue)

Set calibration value into ADC calibration registers.

Note

Please note the ADC will be disabled temporary.

Parameters:
  • base – LPADC peripheral base address.

  • ptrCalibrationValue – Pointer to lpadc_calibration_value_t structure which contains ADC’s calibration value.

FSL_LPADC_DRIVER_VERSION

LPADC driver version 2.9.1.

enum _lpadc_status_flags

Define hardware flags of the module.

Values:

enumerator kLPADC_ResultFIFO0OverflowFlag

Indicates that more data has been written to the Result FIFO 0 than it can hold.

enumerator kLPADC_ResultFIFO0ReadyFlag

Indicates when the number of valid datawords in the result FIFO 0 is greater than the setting watermark level.

enumerator kLPADC_TriggerExceptionFlag

Indicates that a trigger exception event has occurred.

enumerator kLPADC_TriggerCompletionFlag

Indicates that a trigger completion event has occurred.

enumerator kLPADC_CalibrationReadyFlag

Indicates that the calibration process is done.

enumerator kLPADC_ActiveFlag

Indicates that the ADC is in active state.

enumerator kLPADC_ResultFIFOOverflowFlag

To compilitable with old version, do not recommend using this, please use kLPADC_ResultFIFO0OverflowFlag as instead.

enumerator kLPADC_ResultFIFOReadyFlag

To compilitable with old version, do not recommend using this, please use kLPADC_ResultFIFO0ReadyFlag as instead.

enum _lpadc_interrupt_enable

Define interrupt switchers of the module.

Note: LPADC of different chips supports different number of trigger sources, please check the Reference Manual for details.

Values:

enumerator kLPADC_ResultFIFO0OverflowInterruptEnable

Configures ADC to generate overflow interrupt requests when FOF0 flag is asserted.

enumerator kLPADC_FIFO0WatermarkInterruptEnable

Configures ADC to generate watermark interrupt requests when RDY0 flag is asserted.

enumerator kLPADC_ResultFIFOOverflowInterruptEnable

To compilitable with old version, do not recommend using this, please use kLPADC_ResultFIFO0OverflowInterruptEnable as instead.

enumerator kLPADC_FIFOWatermarkInterruptEnable

To compilitable with old version, do not recommend using this, please use kLPADC_FIFO0WatermarkInterruptEnable as instead.

enumerator kLPADC_TriggerExceptionInterruptEnable

Configures ADC to generate trigger exception interrupt.

enumerator kLPADC_Trigger0CompletionInterruptEnable

Configures ADC to generate interrupt when trigger 0 completion.

enumerator kLPADC_Trigger1CompletionInterruptEnable

Configures ADC to generate interrupt when trigger 1 completion.

enumerator kLPADC_Trigger2CompletionInterruptEnable

Configures ADC to generate interrupt when trigger 2 completion.

enumerator kLPADC_Trigger3CompletionInterruptEnable

Configures ADC to generate interrupt when trigger 3 completion.

enumerator kLPADC_Trigger4CompletionInterruptEnable

Configures ADC to generate interrupt when trigger 4 completion.

enumerator kLPADC_Trigger5CompletionInterruptEnable

Configures ADC to generate interrupt when trigger 5 completion.

enumerator kLPADC_Trigger6CompletionInterruptEnable

Configures ADC to generate interrupt when trigger 6 completion.

enumerator kLPADC_Trigger7CompletionInterruptEnable

Configures ADC to generate interrupt when trigger 7 completion.

enumerator kLPADC_Trigger8CompletionInterruptEnable

Configures ADC to generate interrupt when trigger 8 completion.

enumerator kLPADC_Trigger9CompletionInterruptEnable

Configures ADC to generate interrupt when trigger 9 completion.

enumerator kLPADC_Trigger10CompletionInterruptEnable

Configures ADC to generate interrupt when trigger 10 completion.

enumerator kLPADC_Trigger11CompletionInterruptEnable

Configures ADC to generate interrupt when trigger 11 completion.

enumerator kLPADC_Trigger12CompletionInterruptEnable

Configures ADC to generate interrupt when trigger 12 completion.

enumerator kLPADC_Trigger13CompletionInterruptEnable

Configures ADC to generate interrupt when trigger 13 completion.

enumerator kLPADC_Trigger14CompletionInterruptEnable

Configures ADC to generate interrupt when trigger 14 completion.

enumerator kLPADC_Trigger15CompletionInterruptEnable

Configures ADC to generate interrupt when trigger 15 completion.

enum _lpadc_trigger_status_flags

The enumerator of lpadc trigger status flags, including interrupted flags and completed flags.

Note: LPADC of different chips supports different number of trigger sources, please check the Reference Manual for details.

Values:

enumerator kLPADC_Trigger0InterruptedFlag

Trigger 0 is interrupted by a high priority exception.

enumerator kLPADC_Trigger1InterruptedFlag

Trigger 1 is interrupted by a high priority exception.

enumerator kLPADC_Trigger2InterruptedFlag

Trigger 2 is interrupted by a high priority exception.

enumerator kLPADC_Trigger3InterruptedFlag

Trigger 3 is interrupted by a high priority exception.

enumerator kLPADC_Trigger4InterruptedFlag

Trigger 4 is interrupted by a high priority exception.

enumerator kLPADC_Trigger5InterruptedFlag

Trigger 5 is interrupted by a high priority exception.

enumerator kLPADC_Trigger6InterruptedFlag

Trigger 6 is interrupted by a high priority exception.

enumerator kLPADC_Trigger7InterruptedFlag

Trigger 7 is interrupted by a high priority exception.

enumerator kLPADC_Trigger8InterruptedFlag

Trigger 8 is interrupted by a high priority exception.

enumerator kLPADC_Trigger9InterruptedFlag

Trigger 9 is interrupted by a high priority exception.

enumerator kLPADC_Trigger10InterruptedFlag

Trigger 10 is interrupted by a high priority exception.

enumerator kLPADC_Trigger11InterruptedFlag

Trigger 11 is interrupted by a high priority exception.

enumerator kLPADC_Trigger12InterruptedFlag

Trigger 12 is interrupted by a high priority exception.

enumerator kLPADC_Trigger13InterruptedFlag

Trigger 13 is interrupted by a high priority exception.

enumerator kLPADC_Trigger14InterruptedFlag

Trigger 14 is interrupted by a high priority exception.

enumerator kLPADC_Trigger15InterruptedFlag

Trigger 15 is interrupted by a high priority exception.

enumerator kLPADC_Trigger0CompletedFlag

Trigger 0 is completed and trigger 0 has enabled completion interrupts.

enumerator kLPADC_Trigger1CompletedFlag

Trigger 1 is completed and trigger 1 has enabled completion interrupts.

enumerator kLPADC_Trigger2CompletedFlag

Trigger 2 is completed and trigger 2 has enabled completion interrupts.

enumerator kLPADC_Trigger3CompletedFlag

Trigger 3 is completed and trigger 3 has enabled completion interrupts.

enumerator kLPADC_Trigger4CompletedFlag

Trigger 4 is completed and trigger 4 has enabled completion interrupts.

enumerator kLPADC_Trigger5CompletedFlag

Trigger 5 is completed and trigger 5 has enabled completion interrupts.

enumerator kLPADC_Trigger6CompletedFlag

Trigger 6 is completed and trigger 6 has enabled completion interrupts.

enumerator kLPADC_Trigger7CompletedFlag

Trigger 7 is completed and trigger 7 has enabled completion interrupts.

enumerator kLPADC_Trigger8CompletedFlag

Trigger 8 is completed and trigger 8 has enabled completion interrupts.

enumerator kLPADC_Trigger9CompletedFlag

Trigger 9 is completed and trigger 9 has enabled completion interrupts.

enumerator kLPADC_Trigger10CompletedFlag

Trigger 10 is completed and trigger 10 has enabled completion interrupts.

enumerator kLPADC_Trigger11CompletedFlag

Trigger 11 is completed and trigger 11 has enabled completion interrupts.

enumerator kLPADC_Trigger12CompletedFlag

Trigger 12 is completed and trigger 12 has enabled completion interrupts.

enumerator kLPADC_Trigger13CompletedFlag

Trigger 13 is completed and trigger 13 has enabled completion interrupts.

enumerator kLPADC_Trigger14CompletedFlag

Trigger 14 is completed and trigger 14 has enabled completion interrupts.

enumerator kLPADC_Trigger15CompletedFlag

Trigger 15 is completed and trigger 15 has enabled completion interrupts.

enum _lpadc_sample_scale_mode

Define enumeration of sample scale mode.

The sample scale mode is used to reduce the selected ADC analog channel input voltage level by a factor. The maximum possible voltage on the ADC channel input should be considered when selecting a scale mode to ensure that the reducing factor always results voltage level at or below the VREFH reference. This reducing capability allows conversion of analog inputs higher than VREFH. A-side and B-side channel inputs are both scaled using the scale mode.

Values:

enumerator kLPADC_SamplePartScale

Use divided input voltage signal. (For scale select,please refer to the reference manual).

enumerator kLPADC_SampleFullScale

Full scale (Factor of 1).

enum _lpadc_sample_channel_mode

Define enumeration of channel sample mode.

The channel sample mode configures the channel with single-end/differential/dual-single-end, side A/B.

Values:

enumerator kLPADC_SampleChannelSingleEndSideA

Single-end mode, only A-side channel is converted.

enumerator kLPADC_SampleChannelSingleEndSideB

Single-end mode, only B-side channel is converted.

enumerator kLPADC_SampleChannelDiffBothSideAB

Differential mode, the ADC result is (CHnA-CHnB).

enumerator kLPADC_SampleChannelDiffBothSideBA

Differential mode, the ADC result is (CHnB-CHnA).

enumerator kLPADC_SampleChannelDiffBothSide

Differential mode, the ADC result is (CHnA-CHnB).

enumerator kLPADC_SampleChannelDualSingleEndBothSide

Dual-Single-Ended Mode. Both A side and B side channels are converted independently.

enum _lpadc_hardware_average_mode

Define enumeration of hardware average selection.

It Selects how many ADC conversions are averaged to create the ADC result. An internal storage buffer is used to capture temporary results while the averaging iterations are executed.

Note

Some enumerator values are not available on some devices, mainly depends on the size of AVGS field in CMDH register.

Values:

enumerator kLPADC_HardwareAverageCount1

Single conversion.

enumerator kLPADC_HardwareAverageCount2

2 conversions averaged.

enumerator kLPADC_HardwareAverageCount4

4 conversions averaged.

enumerator kLPADC_HardwareAverageCount8

8 conversions averaged.

enumerator kLPADC_HardwareAverageCount16

16 conversions averaged.

enumerator kLPADC_HardwareAverageCount32

32 conversions averaged.

enumerator kLPADC_HardwareAverageCount64

64 conversions averaged.

enumerator kLPADC_HardwareAverageCount128

128 conversions averaged.

enum _lpadc_sample_time_mode

Define enumeration of sample time selection.

The shortest sample time maximizes conversion speed for lower impedance inputs. Extending sample time allows higher impedance inputs to be accurately sampled. Longer sample times can also be used to lower overall power consumption when command looping and sequencing is configured and high conversion rates are not required.

Values:

enumerator kLPADC_SampleTimeADCK3

3 ADCK cycles total sample time.

enumerator kLPADC_SampleTimeADCK5

5 ADCK cycles total sample time.

enumerator kLPADC_SampleTimeADCK7

7 ADCK cycles total sample time.

enumerator kLPADC_SampleTimeADCK11

11 ADCK cycles total sample time.

enumerator kLPADC_SampleTimeADCK19

19 ADCK cycles total sample time.

enumerator kLPADC_SampleTimeADCK35

35 ADCK cycles total sample time.

enumerator kLPADC_SampleTimeADCK67

69 ADCK cycles total sample time.

enumerator kLPADC_SampleTimeADCK131

131 ADCK cycles total sample time.

enum _lpadc_hardware_compare_mode

Define enumeration of hardware compare mode.

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 kLPADC_HardwareCompareDisabled

Compare disabled.

enumerator kLPADC_HardwareCompareStoreOnTrue

Compare enabled. Store on true.

enumerator kLPADC_HardwareCompareRepeatUntilTrue

Compare enabled. Repeat channel acquisition until true.

enum _lpadc_conversion_resolution_mode

Define enumeration of conversion resolution mode.

Configure the resolution bit in specific conversion type. For detailed resolution accuracy, see to lpadc_sample_channel_mode_t

Values:

enumerator kLPADC_ConversionResolutionStandard

Standard resolution. Single-ended 12-bit conversion, Differential 13-bit conversion with 2’s complement output.

enumerator kLPADC_ConversionResolutionHigh

High resolution. Single-ended 16-bit conversion; Differential 16-bit conversion with 2’s complement output.

enum _lpadc_conversion_average_mode

Define enumeration of conversion averages mode.

Configure the converion average number for auto-calibration.

Note

Some enumerator values are not available on some devices, mainly depends on the size of CAL_AVGS field in CTRL register.

Values:

enumerator kLPADC_ConversionAverage1

Single conversion.

enumerator kLPADC_ConversionAverage2

2 conversions averaged.

enumerator kLPADC_ConversionAverage4

4 conversions averaged.

enumerator kLPADC_ConversionAverage8

8 conversions averaged.

enumerator kLPADC_ConversionAverage16

16 conversions averaged.

enumerator kLPADC_ConversionAverage32

32 conversions averaged.

enumerator kLPADC_ConversionAverage64

64 conversions averaged.

enumerator kLPADC_ConversionAverage128

128 conversions averaged.

enum _lpadc_reference_voltage_mode

Define enumeration of reference voltage source.

For detail information, need to check the SoC’s specification.

Values:

enumerator kLPADC_ReferenceVoltageAlt1

Option 1 setting.

enumerator kLPADC_ReferenceVoltageAlt2

Option 2 setting.

enumerator kLPADC_ReferenceVoltageAlt3

Option 3 setting.

enum _lpadc_power_level_mode

Define enumeration of power configuration.

Configures the ADC for power and performance. In the highest power setting the highest conversion rates will be possible. Refer to the device data sheet for power and performance capabilities for each setting.

Values:

enumerator kLPADC_PowerLevelAlt1

Lowest power setting.

enumerator kLPADC_PowerLevelAlt2

Next lowest power setting.

enumerator kLPADC_PowerLevelAlt3

enumerator kLPADC_PowerLevelAlt4

Highest power setting.

enum _lpadc_offset_calibration_mode

Define enumeration of offset calibration mode.

Values:

enumerator kLPADC_OffsetCalibration12bitMode

12 bit offset calibration mode.

enumerator kLPADC_OffsetCalibration16bitMode

16 bit offset calibration mode.

enum _lpadc_trigger_priority_policy

Define enumeration of trigger priority policy.

This selection controls how higher priority triggers are handled.

Note

kLPADC_TriggerPriorityPreemptSubsequently is not available on some devices, mainly depends on the size of TPRICTRL field in CFG register.

Values:

enumerator kLPADC_ConvPreemptImmediatelyNotAutoResumed

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 kLPADC_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 kLPADC_ConvPreemptImmediatelyAutoRestarted

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 kLPADC_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 kLPADC_ConvPreemptImmediatelyAutoResumed

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 kLPADC_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 kLPADC_TriggerPriorityPreemptImmediately

Legacy support is not recommended as it only ensures compatibility with older versions.

enumerator kLPADC_TriggerPriorityPreemptSoftly

Legacy support is not recommended as it only ensures compatibility with older versions.

enumerator kLPADC_TriggerPriorityExceptionDisabled

High priority trigger exception disabled.

typedef enum _lpadc_sample_scale_mode lpadc_sample_scale_mode_t

Define enumeration of sample scale mode.

The sample scale mode is used to reduce the selected ADC analog channel input voltage level by a factor. The maximum possible voltage on the ADC channel input should be considered when selecting a scale mode to ensure that the reducing factor always results voltage level at or below the VREFH reference. This reducing capability allows conversion of analog inputs higher than VREFH. A-side and B-side channel inputs are both scaled using the scale mode.

typedef enum _lpadc_sample_channel_mode lpadc_sample_channel_mode_t

Define enumeration of channel sample mode.

The channel sample mode configures the channel with single-end/differential/dual-single-end, side A/B.

typedef enum _lpadc_hardware_average_mode lpadc_hardware_average_mode_t

Define enumeration of hardware average selection.

It Selects how many ADC conversions are averaged to create the ADC result. An internal storage buffer is used to capture temporary results while the averaging iterations are executed.

Note

Some enumerator values are not available on some devices, mainly depends on the size of AVGS field in CMDH register.

typedef enum _lpadc_sample_time_mode lpadc_sample_time_mode_t

Define enumeration of sample time selection.

The shortest sample time maximizes conversion speed for lower impedance inputs. Extending sample time allows higher impedance inputs to be accurately sampled. Longer sample times can also be used to lower overall power consumption when command looping and sequencing is configured and high conversion rates are not required.

typedef enum _lpadc_hardware_compare_mode lpadc_hardware_compare_mode_t

Define enumeration of hardware compare mode.

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 _lpadc_conversion_resolution_mode lpadc_conversion_resolution_mode_t

Define enumeration of conversion resolution mode.

Configure the resolution bit in specific conversion type. For detailed resolution accuracy, see to lpadc_sample_channel_mode_t

typedef enum _lpadc_conversion_average_mode lpadc_conversion_average_mode_t

Define enumeration of conversion averages mode.

Configure the converion average number for auto-calibration.

Note

Some enumerator values are not available on some devices, mainly depends on the size of CAL_AVGS field in CTRL register.

typedef enum _lpadc_reference_voltage_mode lpadc_reference_voltage_source_t

Define enumeration of reference voltage source.

For detail information, need to check the SoC’s specification.

typedef enum _lpadc_power_level_mode lpadc_power_level_mode_t

Define enumeration of power configuration.

Configures the ADC for power and performance. In the highest power setting the highest conversion rates will be possible. Refer to the device data sheet for power and performance capabilities for each setting.

typedef enum _lpadc_offset_calibration_mode lpadc_offset_calibration_mode_t

Define enumeration of offset calibration mode.

typedef enum _lpadc_trigger_priority_policy lpadc_trigger_priority_policy_t

Define enumeration of trigger priority policy.

This selection controls how higher priority triggers are handled.

Note

kLPADC_TriggerPriorityPreemptSubsequently is not available on some devices, mainly depends on the size of TPRICTRL field in CFG register.

typedef struct _lpadc_calibration_value lpadc_calibration_value_t

A structure of calibration value.

LPADC_GET_ACTIVE_COMMAND_STATUS(statusVal)

Define the MACRO function to get command status from status value.

The statusVal is the return value from LPADC_GetStatusFlags().

LPADC_GET_ACTIVE_TRIGGER_STATUE(statusVal)

Define the MACRO function to get trigger status from status value.

The statusVal is the return value from LPADC_GetStatusFlags().

struct lpadc_config_t
#include <fsl_lpadc.h>

LPADC global configuration.

This structure would used to keep the settings for initialization.

Public Members

bool enableInternalClock

Enables the internally generated clock source. The clock source is used in clock selection logic at the chip level and is optionally used for the ADC clock source.

bool enableVref1LowVoltage

If voltage reference option1 input is below 1.8V, it should be “true”. If voltage reference option1 input is above 1.8V, it should be “false”.

bool enableInDozeMode

Control system transition to Stop and Wait power modes while ADC is converting. When enabled in Doze mode, immediate entries to Wait or Stop are allowed. When disabled, the ADC will wait for the current averaging iteration/FIFO storage to complete before acknowledging stop or wait mode entry.

lpadc_conversion_average_mode_t conversionAverageMode

Auto-Calibration Averages.

bool enableAnalogPreliminary

ADC analog circuits are pre-enabled and ready to execute conversions without startup delays(at the cost of higher DC current consumption).

uint32_t powerUpDelay

When the analog circuits are not pre-enabled, the ADC analog circuits are only powered while the ADC is active and there is a counted delay defined by this field after an initial trigger transitions the ADC from its Idle state to allow time for the analog circuits to stabilize. The startup delay count of (powerUpDelay * 4) ADCK cycles must result in a longer delay than the analog startup time.

lpadc_reference_voltage_source_t referenceVoltageSource

Selects the voltage reference high used for conversions.

lpadc_power_level_mode_t powerLevelMode

Power Configuration Selection.

lpadc_trigger_priority_policy_t triggerPriorityPolicy

Control how higher priority triggers are handled, see to lpadc_trigger_priority_policy_t.

bool enableConvPause

Enables the ADC pausing function. When enabled, a programmable delay is inserted during command execution sequencing between LOOP iterations, between commands in a sequence, and between conversions when command is executing in “Compare Until True” configuration.

uint32_t convPauseDelay

Controls the duration of pausing during command execution sequencing. The pause delay is a count of (convPauseDelay*4) ADCK cycles. Only available when ADC pausing function is enabled. The available value range is in 9-bit.

uint32_t FIFOWatermark

FIFOWatermark is a programmable threshold setting. When the number of datawords stored in the ADC Result FIFO is greater than the value in this field, the ready flag would be asserted to indicate stored data has reached the programmable threshold.

struct lpadc_conv_command_config_t
#include <fsl_lpadc.h>

Define structure to keep the configuration for conversion command.

Public Members

lpadc_sample_scale_mode_t sampleScaleMode

Sample scale mode.

lpadc_sample_scale_mode_t channelBScaleMode

Alternate channe B Scale mode.

lpadc_sample_channel_mode_t sampleChannelMode

Channel sample mode.

uint32_t channelNumber

Channel number, select the channel or channel pair.

uint32_t channelBNumber

Alternate Channel B number, select the channel.

uint32_t chainedNextCommandNumber

Selects the next command to be executed after this command completes. 1-15 is available, 0 is to terminate the chain after this command.

bool enableAutoChannelIncrement

Loop with increment: when disabled, the “loopCount” field selects the number of times the selected channel is converted consecutively; when enabled, the “loopCount” field defines how many consecutive channels are converted as part of the command execution.

uint32_t loopCount

Selects how many times this command executes before finish and transition to the next command or Idle state. Command executes LOOP+1 times. 0-15 is available.

lpadc_hardware_average_mode_t hardwareAverageMode

Hardware average selection.

lpadc_sample_time_mode_t sampleTimeMode

Sample time selection.

lpadc_hardware_compare_mode_t hardwareCompareMode

Hardware compare selection.

uint32_t hardwareCompareValueHigh

Compare Value High. The available value range is in 16-bit.

uint32_t hardwareCompareValueLow

Compare Value Low. The available value range is in 16-bit.

lpadc_conversion_resolution_mode_t conversionResolutionMode

Conversion resolution mode.

bool enableWaitTrigger

Wait for trigger assertion before execution: when disabled, this command will be automatically executed; when enabled, the active trigger must be asserted again before executing this command.

struct lpadc_conv_trigger_config_t
#include <fsl_lpadc.h>

Define structure to keep the configuration for conversion trigger.

Public Members

uint32_t targetCommandId

Select the command from command buffer to execute upon detect of the associated trigger event.

uint32_t delayPower

Select the trigger delay duration to wait at the start of servicing a trigger event. When this field is clear, then no delay is incurred. When this field is set to a non-zero value, the duration for the delay is 2^delayPower ADCK cycles. The available value range is 4-bit.

uint32_t priority

Sets the priority of the associated trigger source. If two or more triggers have the same priority level setting, the lower order trigger event has the higher priority. The lower value for this field is for the higher priority, the available value range is 1-bit.

bool enableHardwareTrigger

Enable hardware trigger source to initiate conversion on the rising edge of the input trigger source or not. THe software trigger is always available.

struct lpadc_conv_result_t
#include <fsl_lpadc.h>

Define the structure to keep the conversion result.

Public Members

uint32_t commandIdSource

Indicate the command buffer being executed that generated this result.

uint32_t loopCountIndex

Indicate the loop count value during command execution that generated this result.

uint32_t triggerIdSource

Indicate the trigger source that initiated a conversion and generated this result.

uint16_t convValue

Data result.

struct _lpadc_calibration_value
#include <fsl_lpadc.h>

A structure of calibration value.

Lpc_freqme

void FREQME_Init(FREQME_Type *base, const freq_measure_config_t *config)

Initialize freqme module, set operate mode, operate mode attribute and initialize measurement cycle.

Parameters:
  • base – FREQME peripheral base address.

  • config – The pointer to module basic configuration, please refer to freq_measure_config_t.

void FREQME_GetDefaultConfig(freq_measure_config_t *config)

Get default configuration.

config->operateMode = kFREQME_FreqMeasurementMode;
config->operateModeAttribute.refClkScaleFactor = 0U;
config->enableContinuousMode                   = false;
config->startMeasurement                       = false;
Parameters:
  • config – The pointer to module basic configuration, please refer to freq_measure_config_t.

static inline void FREQME_StartMeasurementCycle(FREQME_Type *base)

Start frequency or pulse width measurement process.

Parameters:
  • base – FREQME peripheral base address.

static inline void FREQME_TerminateMeasurementCycle(FREQME_Type *base)

Force the termination of any measurement cycle currently in progress and resets RESULT or just reset RESULT if the module in idle state.

Parameters:
  • base – FREQME peripheral base address.

static inline void FREQME_EnableContinuousMode(FREQME_Type *base, bool enable)

Enable/disable Continuous mode.

Parameters:
  • base – FREQME peripheral base address.

  • enable – Used to enable/disable continuous mode,

    • true Enable Continuous mode.

    • false Disable Continuous mode.

static inline bool FREQME_CheckContinuousMode(FREQME_Type *base)

Check whether continuous mode is enabled.

Parameters:
  • base – FREQME peripheral base address.

Return values:
  • True – Continuous mode is enabled, the measurement is performed continuously.

  • False – Continuous mode is disabled.

static inline void FREQME_SetOperateMode(FREQME_Type *base, freqme_operate_mode_t operateMode)

Set operate mode of freqme module.

Parameters:
  • base – FREQME peripheral base address.

  • operateMode – The operate mode to be set, please refer to freqme_operate_mode_t.

static inline bool FREQME_CheckOperateMode(FREQME_Type *base)

Check module’s operate mode.

Parameters:
  • base – FREQME peripheral base address.

Return values:
  • True – Pulse width measurement mode.

  • False – Frequency measurement mode.

static inline void FREQME_SetMinExpectedValue(FREQME_Type *base, uint32_t minValue)

Set the minimum expected value for the measurement result.

Parameters:
  • base – FREQME peripheral base address.

  • minValue – The minimum value to set, please note that this value is 31 bits width.

static inline void FREQME_SetMaxExpectedValue(FREQME_Type *base, uint32_t maxValue)

Set the maximum expected value for the measurement result.

Parameters:
  • base – FREQME peripheral base address.

  • maxValue – The maximum value to set, please note that this value is 31 bits width.

uint32_t FREQME_CalculateTargetClkFreq(FREQME_Type *base, uint32_t refClkFrequency)

Calculate the frequency of selected target clock。

Note

The formula: Ftarget = (RESULT - 2) * Freference / 2 ^ REF_SCALE.

Note

This function only useful when the operate mode is selected as frequency measurement mode.

Parameters:
  • base – FREQME peripheral base address.

  • refClkFrequency – The frequency of reference clock.

Returns:

The frequency of target clock the unit is Hz, if the output result is 0, please check the module’s operate mode.

static inline uint8_t FREQME_GetReferenceClkScaleValue(FREQME_Type *base)

Get reference clock scaling factor.

Parameters:
  • base – FREQME peripheral base address.

Returns:

Reference clock scaling factor, the reference count cycle is 2 ^ ref_scale.

static inline void FREQME_SetPulsePolarity(FREQME_Type *base, freqme_pulse_polarity_t pulsePolarity)

Set pulse polarity when operate mode is selected as Pulse Width Measurement mode.

Parameters:
  • base – FREQME peripheral base address.

  • pulsePolarity – The pulse polarity to be set, please refer to freqme_pulse_polarity_t.

static inline bool FREQME_CheckPulsePolarity(FREQME_Type *base)

Check pulse polarity when the operate mode is selected as pulse width measurement mode.

Parameters:
  • base – FREQME peripheral base address.

Return values:
  • True – Low period.

  • False – High period.

static inline uint32_t FREQME_GetMeasurementResult(FREQME_Type *base)

Get measurement result, if operate mode is selected as pulse width measurement mode this function can be used to calculate pulse width.

Note

Pulse width = counter result / Frequency of target clock.

Parameters:
  • base – FREQME peripheral base address.

Returns:

Measurement result.

static inline uint32_t FREQME_GetInterruptStatusFlags(FREQME_Type *base)

Get interrupt status flags, such as overflow interrupt status flag, underflow interrupt status flag, and so on.

Parameters:
  • base – FREQME peripheral base address.

Returns:

Current interrupt status flags, should be the OR’ed value of _freqme_interrupt_status_flags.

static inline void FREQME_ClearInterruptStatusFlags(FREQME_Type *base, uint32_t statusFlags)

Clear interrupt status flags.

Parameters:
  • base – FREQME peripheral base address.

  • statusFlags – The combination of interrupt status flags to clear, should be the OR’ed value of _freqme_interrupt_status_flags.

static inline void FREQME_EnableInterrupts(FREQME_Type *base, uint32_t masks)

Enable interrupts, such as result ready interrupt, overflow interrupt and so on.

Parameters:
  • base – FREQME peripheral base address.

  • masks – The mask of interrupts to enable, should be the OR’ed value of _freqme_interrupt_enable.

static inline void FREQME_DisableInterrupts(FREQME_Type *base, uint32_t masks)

Disable interrupts, such as result ready interrupt, overflow interrupt and so on.

Parameters:
  • base – FREQME peripheral base address.

  • masks – The mask of interrupts to disable, should be the OR’ed value of _freqme_interrupt_enable.

FSL_FREQME_DRIVER_VERSION

FREQME driver version 2.1.2.

enum _freqme_interrupt_status_flags

The enumeration of interrupt status flags. .

Values:

enumerator kFREQME_UnderflowInterruptStatusFlag

Indicate the measurement is just done and the result is less than minimun value.

enumerator kFREQME_OverflowInterruptStatusFlag

Indicate the measurement is just done and the result is greater than maximum value.

enumerator kFREQME_ReadyInterruptStatusFlag

Indicate the measurement is just done and the result is ready to read.

enumerator kFREQME_AllInterruptStatusFlags

All interrupt status flags.

enum _freqme_interrupt_enable

The enumeration of interrupts, including underflow interrupt, overflow interrupt, and result ready interrupt. .

Values:

enumerator kFREQME_UnderflowInterruptEnable

Enable interrupt when the result is less than minimum value.

enumerator kFREQME_OverflowInterruptEnable

Enable interrupt when the result is greater than maximum value.

enumerator kFREQME_ReadyInterruptEnable

Enable interrupt when a measurement completes and the result is ready.

enum _freqme_operate_mode

FREQME module operate mode enumeration, including frequency measurement mode and pulse width measurement mode.

Values:

enumerator kFREQME_FreqMeasurementMode

The module works in the frequency measurement mode.

enumerator kFREOME_PulseWidthMeasurementMode

The module works in the pulse width measurement mode.

enum _freqme_pulse_polarity

The enumeration of pulse polarity.

Values:

enumerator kFREQME_PulseHighPeriod

Select high period of the reference clock.

enumerator kFREQME_PulseLowPeriod

Select low period of the reference clock.

typedef enum _freqme_operate_mode freqme_operate_mode_t

FREQME module operate mode enumeration, including frequency measurement mode and pulse width measurement mode.

typedef enum _freqme_pulse_polarity freqme_pulse_polarity_t

The enumeration of pulse polarity.

typedef union _freqme_mode_attribute freqme_mode_attribute_t

The union of operate mode attribute.

Note

If the operate mode is selected as frequency measurement mode the member refClkScaleFactor should be used, if the operate mode is selected as pulse width measurement mode the member pulsePolarity should be used.

typedef struct _freq_measure_config freq_measure_config_t

The structure of freqme module basic configuration, including operate mode, operate mode attribute and so on.

union _freqme_mode_attribute
#include <fsl_freqme.h>

The union of operate mode attribute.

Note

If the operate mode is selected as frequency measurement mode the member refClkScaleFactor should be used, if the operate mode is selected as pulse width measurement mode the member pulsePolarity should be used.

Public Members

uint8_t refClkScaleFactor

Only useful in frequency measurement operate mode, used to set the reference clock counter scaling factor.

freqme_pulse_polarity_t pulsePolarity

Only Useful in pulse width measurement operate mode, used to set period polarity.

struct _freq_measure_config
#include <fsl_freqme.h>

The structure of freqme module basic configuration, including operate mode, operate mode attribute and so on.

Public Members

freqme_operate_mode_t operateMode

Select operate mode, please refer to freqme_operate_mode_t.

freqme_mode_attribute_t operateModeAttribute

Used to set the attribute of the selected operate mode, if the operate mode is selected as kFREQME_FreqMeasurementMode set freqme_mode_attribute_t::refClkScaleFactor, if operate mode is selected as kFREOME_PulseWidthMeasurementMode, please set freqme_mode_attribute_t::pulsePolarity.

bool enableContinuousMode

Enable/disable continuous mode, if continuous mode is enable, the measurement is performed continuously and the result for the last completed measurement is available in the result register.

LPFLEXCOMM: LPFLEXCOMM Driver

LPFLEXCOMM Driver

FSL_LP_FLEXCOMM_DRIVER_VERSION

FlexCOMM driver version.

enum LP_FLEXCOMM_PERIPH_T

LP_FLEXCOMM peripheral modes.

Values:

enumerator LP_FLEXCOMM_PERIPH_NONE

No peripheral

enumerator LP_FLEXCOMM_PERIPH_LPUART

LPUART peripheral

enumerator LP_FLEXCOMM_PERIPH_LPSPI

LPSPI Peripheral

enumerator LP_FLEXCOMM_PERIPH_LPI2C

LPI2C Peripheral

enumerator LP_FLEXCOMM_PERIPH_LPI2CAndLPUART

LPI2C and LPUART Peripheral

enum _lpflexcomm_interrupt_flag

LP_FLEXCOMM interrupt source flags.

Values:

enumerator kLPFLEXCOMM_I2cSlaveInterruptFlag
enumerator kLPFLEXCOMM_I2cMasterInterruptFlag
enumerator kLPFLEXCOMM_SpiInterruptFlag
enumerator kLPFLEXCOMM_UartRxInterruptFlag
enumerator kLPFLEXCOMM_UartTxInterruptFlag
enumerator kLPFLEXCOMM_AllInterruptFlag
typedef void (*lpflexcomm_irq_handler_t)(uint32_t instance, void *handle)

Typedef for interrupt handler.

IRQn_Type const kFlexcommIrqs[]

Array with IRQ number for each LP_FLEXCOMM module.

uint32_t LP_FLEXCOMM_GetInstance(void *base)

Returns instance number for LP_FLEXCOMM module with given base address.

uint32_t LP_FLEXCOMM_GetBaseAddress(uint32_t instance)

Returns for LP_FLEXCOMM base address.

uint32_t LP_FLEXCOMM_GetInterruptStatus(uint32_t instance)

brief Returns for LP_FLEXCOMM interrupt source,see _lpflexcomm_interrupt_flag.

status_t LP_FLEXCOMM_Init(uint32_t instance, LP_FLEXCOMM_PERIPH_T periph)

Initializes LP_FLEXCOMM and selects peripheral mode according to the second parameter.

void LP_FLEXCOMM_Deinit(uint32_t instance)

Deinitializes LP_FLEXCOMM.

void LP_FLEXCOMM_SetIRQHandler(uint32_t instance, lpflexcomm_irq_handler_t handler, void *lpflexcommHandle, LP_FLEXCOMM_PERIPH_T periph)

Sets IRQ handler for given LP_FLEXCOMM module. It is used by drivers register IRQ handler according to LP_FLEXCOMM mode.

LPI2C: Low Power Inter-Integrated Circuit Driver

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.

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)
status_t LPI2C_CheckForBusyBus(LPI2C_Type *base)
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.

Return values:
  • kStatus_Success – A transaction was successfully aborted.

  • kStatus_LPI2C_Idle – There is not a non-blocking transaction currently in progress.

void LPI2C_MasterTransferHandleIRQ(uint32_t instance, 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:
  • instance – The LPI2C instance.

  • 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.

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)

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

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

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

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.

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
typedef struct _lpi2c_master_handle lpi2c_master_handle_t
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 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)(uint32_t instance, 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.

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.

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.

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.

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.

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
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 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.

Return values:
  • kStatus_Success

  • kStatus_LPI2C_Idle

void LPI2C_SlaveTransferHandleIRQ(uint32_t instance, void *lpi2cSlaveHandle)

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:
  • instance – The LPI2C instance.

  • lpi2cSlaveHandle – 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.

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. When this event is set, the driver will no longer decide to reply to ack/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.

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
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.

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.

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.

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.

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.

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(uint32_t instance, lpspi_master_handle_t *handle)

LPSPI Master IRQ handler function.

This function processes the LPSPI transmit and receive IRQ.

Parameters:
  • instance – LPSPI instance.

  • 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(uint32_t instance, lpspi_slave_handle_t *handle)

LPSPI Slave IRQ handler function.

This function processes the LPSPI transmit and receives an IRQ.

Parameters:
  • instance – LPSPI instance index.

  • handle – pointer to lpspi_slave_handle_t structure which stores the transfer state.

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.

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

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.

enum _lpspi_dma_enable

LPSPI DMA source.

Values:

enumerator kLPSPI_TxDmaEnable

Transmit data DMA enable

enumerator kLPSPI_RxDmaEnable

Receive data DMA enable

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.

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]

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)

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).

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)

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.

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.

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.

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.

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.

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

enum _lpspi_pcs_function_config

LPSPI cs function configuration.

Values:

enumerator kLPSPI_PcsAsCs

PCS pin select as cs function

enumerator kLPSPI_PcsAsData

PCS pin select as date function

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]

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.

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_MasterWidth1

LPSPI master width shift macro, internal used LPSPI master transfer 1bit

enumerator kLPSPI_MasterWidth2

LPSPI master width shift macro, internal used LPSPI master transfer 2bit

enumerator kLPSPI_MasterWidth4

LPSPI master width shift macro, internal used LPSPI master transfer 4bit

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).

  1. 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.

  2. 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.

  3. 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.

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).

  1. 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.

  2. 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.

  3. 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.

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.

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_pcs_function_config lpspi_pcs_function_config_t

LPSPI cs function 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_MASTER_WIDTH_SHIFT

LPSPI master width shift macro, internal used

LPSPI_MASTER_WIDTH_MASK

LPSPI master width shift mask, 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_pcs_function_config_t pcsFunc

Configures cs pins function.

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.

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).

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.

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.

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.

LPSPI eDMA Driver

FSL_LPSPI_EDMA_DRIVER_VERSION

LPSPI EDMA driver version.

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

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

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

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_NoiseErrorInRxDataRegFlag, kLPUART_ParityErrorInRxDataRegFlag, 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 the enumeration _uart_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 uint32_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 parameter receivedBytes 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(uint32_t instance, void *irqHandle)

LPUART IRQ handle function.

This function handles the LPUART transmit and receive IRQ request.

Parameters:
  • instance – LPUART instance.

  • 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.

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.

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

enum _lpuart_data_bits

LPUART data bits count.

Values:

enumerator kLPUART_EightDataBits

Eight data bit

enumerator kLPUART_SevenDataBits

Seven data bit

enum _lpuart_stop_bit_count

LPUART stop bit count.

Values:

enumerator kLPUART_OneStopBit

One stop bit

enumerator kLPUART_TwoStopBit

Two stop bits

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.

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

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.

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.

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_CtsStateChangeInterruptEnable

Change of state on CTS_B pin. bit 0

enumerator kLPUART_DsrStateChangeInterruptEnable

Change of state on DSR_B pin. bit 1

enumerator kLPUART_RinStateChangeInterruptEnable

Change of state on RIN_B pin. bit 2

enumerator kLPUART_DcdStateChangeInterruptEnable

Change of state on DCD_B pin. bit 3

enumerator kLPUART_RxActiveEdgeInterruptEnable

Receive Active Edge. bit 6

enumerator kLPUART_LinBreakInterruptEnable

LIN break detect. bit 7

enumerator kLPUART_RxFifoUnderflowInterruptEnable

Receive FIFO Underflow. bit 8

enumerator kLPUART_TxFifoOverflowInterruptEnable

Transmit FIFO Overflow. bit 9

enumerator kLPUART_RxCounter0TimeoutInterruptEnable

Receiver counter0 timeout. bit 10

enumerator kLPUART_RxCounter1TimeoutInterruptEnable

Receiver counter1 timeout. bit 11

enumerator kLPUART_TxCounter0TimeoutInterruptEnable

Transmitter counter0 timeout. bit 12

enumerator kLPUART_TxCounter1TimeoutInterruptEnable

Transmitter counter1 timeout. bit 13

enumerator kLPUART_DataMatch2InterruptEnable

The next character to be read from LPUART_DATA matches MA2. bit 14

enumerator kLPUART_DataMatch1InterruptEnable

The next character to be read from LPUART_DATA matches MA1. bit 15

enumerator kLPUART_IdleLineInterruptEnable

Idle line. bit 20

enumerator kLPUART_RxDataRegFullInterruptEnable

Receiver data register full. bit 21

enumerator kLPUART_TransmissionCompleteInterruptEnable

Transmission complete. bit 22

enumerator kLPUART_TxDataRegEmptyInterruptEnable

Transmit data register empty. bit 23

enumerator kLPUART_ParityErrorInterruptEnable

Parity error flag. bit 24

enumerator kLPUART_FramingErrorInterruptEnable

Framing error flag. bit 25

enumerator kLPUART_NoiseErrorInterruptEnable

Noise error flag. bit 26

enumerator kLPUART_RxOverrunInterruptEnable

Receiver Overrun. bit 27

enumerator kLPUART_AllInterruptEnable
enum _lpuart_flags

LPUART status flags.

This provides constants for the LPUART status flags for use in the LPUART functions.

Values:

enumerator kLPUART_RxFifoUnderflowFlag

RXUF bit, sets if receive buffer underflow occurred. bit 0

enumerator kLPUART_TxFifoOverflowFlag

TXOF bit, sets if transmit buffer overflow occurred. bit 1

enumerator kLPUART_RxFifoEmptyFlag

RXEMPT bit, sets if receive buffer is empty. bit 6

enumerator kLPUART_TxFifoEmptyFlag

TXEMPT bit, sets if transmit buffer is empty. bit 7

enumerator kLPUART_CtsStateChangeFlag

Change of state on CTS_B pin. bit 2

enumerator kLPUART_DsrStateChangeFlag

Change of state on DSR_B pin. bit 3

enumerator kLPUART_RinStateChangeFlag

Change of state on RIN_B pin. bit 4

enumerator kLPUART_DcdStateChangeFlag

Change of state on DCD_B pin. bit 5

enumerator kLPUART_RxCounter0TimeoutFlag

Receiver counter0 timeout. bit 10

enumerator kLPUART_RxCounter1TimeoutFlag

Receiver counter1 timeout. bit 11

enumerator kLPUART_TxCounter0TimeoutFlag

Transmitter counter0 timeout. bit 12

enumerator kLPUART_TxCounter1TimeoutFlag

Transmitter counter1 timeout. bit 13

enumerator kLPUART_DataMatch2Flag

The next character to be read from LPUART_DATA matches MA2. bit 14

enumerator kLPUART_DataMatch1Flag

The next character to be read from LPUART_DATA matches MA1. bit 15

enumerator kLPUART_ParityErrorFlag

If parity enabled, sets upon parity error detection. bit 16

enumerator kLPUART_FramingErrorFlag

Frame error flag, sets if logic 0 was detected where stop bit expected. bit 17

enumerator kLPUART_NoiseErrorFlag

Receive takes 3 samples of each received bit. If any of these samples differ, noise flag sets. bit 18

enumerator kLPUART_RxOverrunFlag

Receive Overrun, sets when new data is received before data is read from receive register. bit 19

enumerator kLPUART_IdleLineFlag

Idle line detect flag, sets when idle line detected. bit 20

enumerator kLPUART_RxDataRegFullFlag

Receive data register full flag, sets when the receive data buffer is full. bit 21

enumerator kLPUART_TransmissionCompleteFlag

Transmission complete flag, sets when transmission activity complete. bit 22

enumerator kLPUART_TxDataRegEmptyFlag

Transmit data register empty flag, sets when transmit buffer is empty. bit 23

enumerator kLPUART_RxActiveFlag

Receiver Active Flag (RAF), sets at beginning of valid start. bit 24

enumerator kLPUART_RxActiveEdgeFlag

Receive pin active edge interrupt flag, sets when active edge detected. bit 30

enumerator kLPUART_LinBreakFlag

LIN break detect interrupt flag, sets when LIN break char detected and LIN circuit enabled. bit 31

enumerator kLPUART_AllClearFlags
enumerator kLPUART_AllFlags
enum _lpuart_timeout_condition

LPUART timeout condition. This structure defines the conditions when the counter timeout occur.

Values:

enumerator kLPUART_TimeoutAfterCharacters

Timeout occurs when the number of characters specified by timeoutValue are received.

enumerator kLPUART_TimeoutAfterIdle

Timeout occurs when rx/tx remains idle for timeoutValue of bit clocks after idle condition is detected.

enumerator kLPUART_TimeoutAfterNext

Timeout occurs when rx/tx remains idle for timeoutValue of bit clocks after next character is received/transmitted.

enumerator kLPUART_TimeoutAfterIdleBeforeExtended

Timeout occurs when tx/rx is idle for larger than timeoutValue of bit clocks and smaller than tx/rx extended timeout value.

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 enum _lpuart_timeout_condition lpuart_timeout_condition_t

LPUART timeout condition. This structure defines the conditions when the counter timeout occur.

typedef struct _lpuart_timeout_counter_config lpuart_timeout_counter_config_t

LPUART timeout counter configuration structure.

typedef struct _lpuart_timeout_config lpuart_timeout_config_t

LPUART timeout configuration structure.

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_irq_handler_t)(uint32_t instance, void *handle)
const IRQn_Type s_lpuartIRQ[]
UART_RETRY_TIMES

Retry times for waiting flag.

struct _lpuart_timeout_counter_config
#include <fsl_lpuart.h>

LPUART timeout counter configuration structure.

Public Members

bool enableCounter

Eneble the timeout counter.

lpuart_timeout_condition_t timeoutCondition

Timeout condition.

uint16_t timeoutValue

Timeout value.

struct _lpuart_timeout_config
#include <fsl_lpuart.h>

LPUART timeout configuration structure.

Public Members

uint16_t rxExtendedTimeoutValue

The number of bits since the last stop bit that is required for an idle condition to be detected. Enable this will disable rxIdleType and rxIdleConfig. Set to 0 to disable.

uint16_t txExtendedTimeoutValue

The transmitter idle time in number of bits (baud rate) whenever an idle character is queued through the transmit FIFO.

lpuart_timeout_counter_config_t rxCounter0

Rx counter 0 configuration.

lpuart_timeout_counter_config_t rxCounter1

Rx counter 1 configuration.

lpuart_timeout_counter_config_t txCounter0

Tx counter 0 configuration.

lpuart_timeout_counter_config_t txCounter1

Tx counter 1 configuration.

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.

lpuart_timeout_config_t timeoutConfig

Timeout configuration.

bool enableSingleWire

Use TXD pin as the source for the receiver. When enabled the TXD pin should be configured as open drain.

uint8_t rtsDelay

Delay the negation of RTS by the configured number of bit clocks.

bool enableTx

Enable TX

bool enableRx

Enable RX

struct _lpuart_transfer
#include <fsl_lpuart.h>

LPUART transfer structure.

Public Members

size_t dataSize

The byte count to be transfer.

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

union __unnamed78__

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.

union __unnamed80__

Public Members

const uint8_t *volatile txData

Address of remaining data to send.

const uint16_t *volatile txData16

Address of remaining data to send.

union __unnamed82__

Public Members

uint8_t *volatile rxData

Address of remaining data to receive.

uint16_t *volatile rxData16

Address of remaining data to receive.

union __unnamed84__

Public Members

uint8_t *rxRingBuffer

Start address of the receiver ring buffer.

uint16_t *rxRingBuffer16

Start address of the receiver ring buffer.

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(uint32_t instance, 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:
  • instance – LPUART peripheral index.

  • 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

MIPI DSI Driver

void DSI_Init(MIPI_DSI_HOST_Type *base, const dsi_config_t *config)

Initializes an MIPI DSI host with the user configuration.

This function initializes the MIPI DSI host with the configuration, it should be called first before other MIPI DSI driver functions.

Parameters:
  • base – MIPI DSI host peripheral base address.

  • config – Pointer to a user-defined configuration structure.

void DSI_Deinit(MIPI_DSI_HOST_Type *base)

Deinitializes an MIPI DSI host.

This function should be called after all bother MIPI DSI driver functions.

Parameters:
  • base – MIPI DSI host peripheral base address.

void DSI_GetDefaultConfig(dsi_config_t *config)

Get the default configuration to initialize the MIPI DSI host.

The default value is:

config->numLanes = 4;
config->enableNonContinuousHsClk = false;
config->enableTxUlps = false;
config->autoInsertEoTp = true;
config->numExtraEoTp = 0;
config->htxTo_ByteClk = 0;
config->lrxHostTo_ByteClk = 0;
config->btaTo_ByteClk = 0;

Parameters:
  • config – Pointer to a user-defined configuration structure.

void DSI_SetDpiConfig(MIPI_DSI_HOST_Type *base, const dsi_dpi_config_t *config, uint8_t numLanes, uint32_t dpiPixelClkFreq_Hz, uint32_t dsiHsBitClkFreq_Hz)

Configure the DPI interface core.

This function sets the DPI interface configuration, it should be used in video mode.

Parameters:
  • base – MIPI DSI host peripheral base address.

  • config – Pointer to the DPI interface configuration.

  • numLanes – Lane number, should be same with the setting in dsi_dpi_config_t.

  • dpiPixelClkFreq_Hz – The DPI pixel clock frequency in Hz.

  • dsiHsBitClkFreq_Hz – The DSI high speed bit clock frequency in Hz. It is the same with DPHY PLL output.

uint32_t DSI_InitDphy(MIPI_DSI_HOST_Type *base, const dsi_dphy_config_t *config, uint32_t refClkFreq_Hz)

Initializes the D-PHY.

This function configures the D-PHY timing and setups the D-PHY PLL based on user configuration. The configuration structure could be got by the function DSI_GetDphyDefaultConfig.

For some platforms there is not dedicated D-PHY PLL, indicated by the macro FSL_FEATURE_MIPI_DSI_NO_DPHY_PLL. For these platforms, the refClkFreq_Hz is useless.

Parameters:
  • base – MIPI DSI host peripheral base address.

  • config – Pointer to the D-PHY configuration.

  • refClkFreq_Hz – The REFCLK frequency in Hz.

Returns:

The actual D-PHY PLL output frequency. If could not configure the PLL to the target frequency, the return value is 0.

void DSI_DeinitDphy(MIPI_DSI_HOST_Type *base)

Deinitializes the D-PHY.

Power down the D-PHY PLL and shut down D-PHY.

Parameters:
  • base – MIPI DSI host peripheral base address.

void DSI_GetDphyDefaultConfig(dsi_dphy_config_t *config, uint32_t txHsBitClk_Hz, uint32_t txEscClk_Hz)

Get the default D-PHY configuration.

Gets the default D-PHY configuration, the timing parameters are set according to D-PHY specification. User could use the configuration directly, or change some parameters according to the special device.

Parameters:
  • config – Pointer to the D-PHY configuration.

  • txHsBitClk_Hz – High speed bit clock in Hz.

  • txEscClk_Hz – Esc clock in Hz.

static inline void DSI_SetUlpsStatus(MIPI_DSI_HOST_Type *base, uint8_t ulpsStatus)

Sets the ULPS status for one clock lane and 4 data lanes.

Use status in _dsi_ulps_status as OR’ed mask value for ulpsStatus. Release the lanes from ULPS state before transfer.

Parameters:
  • base – MIPI DSI host peripheral base address.

  • ulpsStatus – The ULPS status to set to the bus.

static inline uint8_t DSI_GetUlpsStatus(MIPI_DSI_HOST_Type *base)

Gets the ULPS status for one clock lane and 4 data lanes.

Parameters:
  • base – MIPI DSI host peripheral base address.

Returns:

The current ULPS status.

static inline void DSI_EnableInterrupts(MIPI_DSI_HOST_Type *base, uint32_t intGroup1, uint32_t intGroup2)

Enable the interrupts.

The interrupts to enable are passed in as OR’ed mask value of _dsi_interrupt.

Parameters:
  • base – MIPI DSI host peripheral base address.

  • intGroup1 – Interrupts to enable in group 1.

  • intGroup2 – Interrupts to enable in group 2.

static inline void DSI_DisableInterrupts(MIPI_DSI_HOST_Type *base, uint32_t intGroup1, uint32_t intGroup2)

Disable the interrupts.

The interrupts to disable are passed in as OR’ed mask value of _dsi_interrupt.

Parameters:
  • base – MIPI DSI host peripheral base address.

  • intGroup1 – Interrupts to disable in group 1.

  • intGroup2 – Interrupts to disable in group 2.

static inline void DSI_GetAndClearInterruptStatus(MIPI_DSI_HOST_Type *base, uint32_t *intGroup1, uint32_t *intGroup2)

Get and clear the interrupt status.

Parameters:
  • base – MIPI DSI host peripheral base address.

  • intGroup1 – Group 1 interrupt status.

  • intGroup2 – Group 2 interrupt status.

static inline void DSI_SetDbiPixelFormat(MIPI_DSI_HOST_Type *base, dsi_dbi_pixel_format_t format)

brief Configure the DBI pixel format.

param base MIPI DSI host peripheral base address. param format of the pixel.

static inline void DSI_SetDbiPixelFifoSendLevel(MIPI_DSI_HOST_Type *base, uint16_t sendLevel)

Configure the DBI pixel FIFO send level.

This controls the level at which the DBI Host bridge begins sending pixels

Parameters:
  • base – MIPI DSI host peripheral base address.

  • sendLevel – Send level value set to register.

static inline void DSI_SetDbiPixelPayloadSize(MIPI_DSI_HOST_Type *base, uint16_t payloadSize)

Configure the DBI pixel payload size.

Configures maximum number of pixels that should be sent as one DSI packet. Recommended to be evenly divisible by the line size (in pixels).

Parameters:
  • base – MIPI DSI host peripheral base address.

  • payloadSize – Payload size value set to register.

void DSI_SetApbPacketControl(MIPI_DSI_HOST_Type *base, uint16_t wordCount, uint8_t virtualChannel, dsi_tx_data_type_t dataType, uint8_t flags)

Configure the APB packet to send.

This function configures the next APB packet transfer. After configuration, the packet transfer could be started with function DSI_SendApbPacket. If the packet is long packet, Use DSI_WriteApbTxPayload to fill the payload before start transfer.

Parameters:
  • base – MIPI DSI host peripheral base address.

  • wordCount – For long packet, this is the byte count of the payload. For short packet, this is (data1 << 8) | data0.

  • virtualChannel – Virtual channel.

  • dataType – The packet data type, (DI).

  • flags – The transfer control flags, see _dsi_transfer_flags.

void DSI_WriteApbTxPayload(MIPI_DSI_HOST_Type *base, const uint8_t *payload, uint16_t payloadSize)

Fill the long APB packet payload.

Write the long packet payload to TX FIFO.

Parameters:
  • base – MIPI DSI host peripheral base address.

  • payload – Pointer to the payload.

  • payloadSize – Payload size in byte.

void DSI_WriteApbTxPayloadExt(MIPI_DSI_HOST_Type *base, const uint8_t *payload, uint16_t payloadSize, bool sendDcsCmd, uint8_t dcsCmd)

Extended function to fill the payload to TX FIFO.

Write the long packet payload to TX FIFO. This function could be used in two ways

  1. Include the DCS command in parameter payload. In this case, the DCS command is the first byte of payload. The parameter sendDcsCmd is set to false, the dcsCmd is not used. This function is the same as DSI_WriteApbTxPayload when used in this way.

  2. The DCS command in not in parameter payload, but specified by parameter dcsCmd. In this case, the parameter sendDcsCmd is set to true, the dcsCmd is the DCS command to send. The payload is sent after dcsCmd.

Parameters:
  • base – MIPI DSI host peripheral base address.

  • payload – Pointer to the payload.

  • payloadSize – Payload size in byte.

  • sendDcsCmd – If set to true, the DCS command is specified by dcsCmd, otherwise the DCS command is included in the payload.

  • dcsCmd – The DCS command to send, only used when sendDCSCmd is true.

void DSI_ReadApbRxPayload(MIPI_DSI_HOST_Type *base, uint8_t *payload, uint16_t payloadSize)

Read the long APB packet payload.

Read the long packet payload from RX FIFO. This function reads directly but does not check the RX FIFO status. Upper layer should make sure there are available data.

Parameters:
  • base – MIPI DSI host peripheral base address.

  • payload – Pointer to the payload.

  • payloadSize – Payload size in byte.

static inline void DSI_SendApbPacket(MIPI_DSI_HOST_Type *base)

Trigger the controller to send out APB packet.

Send the packet set by DSI_SetApbPacketControl.

Parameters:
  • base – MIPI DSI host peripheral base address.

static inline uint32_t DSI_GetApbStatus(MIPI_DSI_HOST_Type *base)

Get the APB status.

The return value is OR’ed value of _dsi_apb_status.

Parameters:
  • base – MIPI DSI host peripheral base address.

Returns:

The APB status.

static inline uint32_t DSI_GetRxErrorStatus(MIPI_DSI_HOST_Type *base)

Get the error status during data transfer.

The return value is OR’ed value of _dsi_rx_error_status.

Parameters:
  • base – MIPI DSI host peripheral base address.

Returns:

The error status.

static inline uint8_t DSI_GetEccRxErrorPosition(uint32_t rxErrorStatus)

Get the one-bit RX ECC error position.

When one-bit ECC RX error detected using DSI_GetRxErrorStatus, this function could be used to get the error bit position.

uint8_t eccErrorPos;
uint32_t rxErrorStatus = DSI_GetRxErrorStatus(MIPI_DSI);
if (kDSI_RxErrorEccOneBit & rxErrorStatus)
{
    eccErrorPos = DSI_GetEccRxErrorPosition(rxErrorStatus);
}
Parameters:
  • rxErrorStatus – The error status returned by DSI_GetRxErrorStatus.

Returns:

The 1-bit ECC error position.

static inline uint32_t DSI_GetAndClearHostStatus(MIPI_DSI_HOST_Type *base)

Get and clear the DSI host status.

The host status are returned as mask value of _dsi_host_status.

Parameters:
  • base – MIPI DSI host peripheral base address.

Returns:

The DSI host status.

static inline uint32_t DSI_GetRxPacketHeader(MIPI_DSI_HOST_Type *base)

Get the RX packet header.

Parameters:
  • base – MIPI DSI host peripheral base address.

Returns:

The RX packet header.

static inline dsi_rx_data_type_t DSI_GetRxPacketType(uint32_t rxPktHeader)

Extract the RX packet type from the packet header.

Extract the RX packet type from the packet header get by DSI_GetRxPacketHeader.

Parameters:
  • rxPktHeader – The RX packet header get by DSI_GetRxPacketHeader.

Returns:

The RX packet type.

static inline uint16_t DSI_GetRxPacketWordCount(uint32_t rxPktHeader)

Extract the RX packet word count from the packet header.

Extract the RX packet word count from the packet header get by DSI_GetRxPacketHeader.

Parameters:
  • rxPktHeader – The RX packet header get by DSI_GetRxPacketHeader.

Returns:

For long packet, return the payload word count (byte). For short packet, return the (data0 << 8) | data1.

static inline uint8_t DSI_GetRxPacketVirtualChannel(uint32_t rxPktHeader)

Extract the RX packet virtual channel from the packet header.

Extract the RX packet virtual channel from the packet header get by DSI_GetRxPacketHeader.

Parameters:
  • rxPktHeader – The RX packet header get by DSI_GetRxPacketHeader.

Returns:

The virtual channel.

status_t DSI_TransferBlocking(MIPI_DSI_HOST_Type *base, dsi_transfer_t *xfer)

APB data transfer using blocking method.

Perform APB data transfer using blocking method. This function waits until all data send or received, or timeout happens.

When using this API to read data, the actually read data count could be got from xfer->rxDataSize.

Parameters:
  • base – MIPI DSI host peripheral base address.

  • xfer – Pointer to the transfer structure.

Return values:
  • kStatus_Success – Data transfer finished with no error.

  • kStatus_Timeout – Transfer failed because of timeout.

  • kStatus_DSI_RxDataError – RX data error, user could use DSI_GetRxErrorStatus to check the error details.

  • kStatus_DSI_ErrorReportReceived – Error Report packet received, user could use DSI_GetAndClearHostStatus to check the error report status.

  • kStatus_DSI_NotSupported – Transfer format not supported.

  • kStatus_DSI_Fail – Transfer failed for other reasons.

status_t DSI_TransferCreateHandle(MIPI_DSI_HOST_Type *base, dsi_handle_t *handle, dsi_callback_t callback, void *userData)

Create the MIPI DSI handle.

This function initializes the MIPI DSI handle which can be used for other transactional APIs.

Parameters:
  • base – MIPI DSI host peripheral base address.

  • handle – Handle pointer.

  • callback – Callback function.

  • userData – User data.

status_t DSI_TransferNonBlocking(MIPI_DSI_HOST_Type *base, dsi_handle_t *handle, dsi_transfer_t *xfer)

APB data transfer using interrupt method.

Perform APB data transfer using interrupt method, when transfer finished, upper layer could be informed through callback function.

When using this API to read data, the actually read data count could be got from handle->xfer->rxDataSize after read finished.

Parameters:
  • base – MIPI DSI host peripheral base address.

  • handle – pointer to dsi_handle_t structure which stores the transfer state.

  • xfer – Pointer to the transfer structure.

Return values:
  • kStatus_Success – Data transfer started successfully.

  • kStatus_DSI_Busy – Failed to start transfer because DSI is busy with pervious transfer.

  • kStatus_DSI_NotSupported – Transfer format not supported.

void DSI_TransferAbort(MIPI_DSI_HOST_Type *base, dsi_handle_t *handle)

Abort current APB data transfer.

Parameters:
  • base – MIPI DSI host peripheral base address.

  • handle – pointer to dsi_handle_t structure which stores the transfer state.

void DSI_TransferHandleIRQ(MIPI_DSI_HOST_Type *base, dsi_handle_t *handle)

Interrupt handler for the DSI.

Parameters:
  • base – MIPI DSI host peripheral base address.

  • handle – pointer to dsi_handle_t structure which stores the transfer state.

FSL_MIPI_DSI_DRIVER_VERSION

Error codes for the MIPI DSI driver.

Values:

enumerator kStatus_DSI_Busy

DSI is busy.

enumerator kStatus_DSI_RxDataError

Read data error.

enumerator kStatus_DSI_ErrorReportReceived

Error report package received.

enumerator kStatus_DSI_NotSupported

The transfer type not supported.

enum _dsi_dbi_pixel_format

MIPI DBI pixel format.

Values:

enumerator kDSI_DbiNoMapping

No pixel to bit mapping.

enumerator kDSI_DbiRGB888

Send data to interface as RGB888 format.

enumerator kDSI_DbiRGB666

Send data to interface as RGB666 format.

enumerator kDSI_DbiRGB565

Send data to interface as RGB565 format.

enumerator kDSI_DbiRGB444

Send data to interface as RGB444 format.

enumerator kDSI_DbiRGB332

Send data to interface as RGB332 format.

enum _dsi_dpi_color_coding

MIPI DPI interface color coding.

Values:

enumerator kDSI_Dpi16BitConfig1

16-bit configuration 1. RGB565: XXXXXXXX_RRRRRGGG_GGGBBBBB.

enumerator kDSI_Dpi16BitConfig2

16-bit configuration 2. RGB565: XXXRRRRR_XXGGGGGG_XXXBBBBB.

enumerator kDSI_Dpi16BitConfig3

16-bit configuration 3. RGB565: XXRRRRRX_XXGGGGGG_XXBBBBBX.

enumerator kDSI_Dpi18BitConfig1

18-bit configuration 1. RGB666: XXXXXXRR_RRRRGGGG_GGBBBBBB.

enumerator kDSI_Dpi18BitConfig2

18-bit configuration 2. RGB666: XXRRRRRR_XXGGGGGG_XXBBBBBB.

enumerator kDSI_Dpi24Bit

24-bit.

enum _dsi_dpi_pixel_packet

MIPI DSI pixel packet type send through DPI interface.

Values:

enumerator kDSI_PixelPacket16Bit

16 bit RGB565.

enumerator kDSI_PixelPacket18Bit

18 bit RGB666 packed.

enumerator kDSI_PixelPacket18BitLoosely

18 bit RGB666 loosely packed into three bytes.

enumerator kDSI_PixelPacket24Bit

24 bit RGB888, each pixel uses three bytes.

_dsi_dpi_polarity_flag DPI signal polarity.

Values:

enumerator kDSI_DpiVsyncActiveLow

VSYNC active low.

enumerator kDSI_DpiHsyncActiveLow

HSYNC active low.

enumerator kDSI_DpiVsyncActiveHigh

VSYNC active high.

enumerator kDSI_DpiHsyncActiveHigh

HSYNC active high.

enum _dsi_dpi_video_mode

DPI video mode.

Values:

enumerator kDSI_DpiNonBurstWithSyncPulse

Non-Burst mode with Sync Pulses.

enumerator kDSI_DpiNonBurstWithSyncEvent

Non-Burst mode with Sync Events.

enumerator kDSI_DpiBurst

Burst mode.

enum _dsi_dpi_bllp_mode

Behavior in BLLP (Blanking or Low-Power Interval).

Values:

enumerator kDSI_DpiBllpLowPower

LP mode used in BLLP periods.

enumerator kDSI_DpiBllpBlanking

Blanking packets used in BLLP periods.

enumerator kDSI_DpiBllpNull

Null packets used in BLLP periods.

_dsi_apb_status Status of APB to packet interface.

Values:

enumerator kDSI_ApbNotIdle

State machine not idle

enumerator kDSI_ApbTxDone

Tx packet done

enumerator kDSI_ApbRxControl

DPHY direction 0 - tx had control, 1 - rx has control

enumerator kDSI_ApbTxOverflow

TX fifo overflow

enumerator kDSI_ApbTxUnderflow

TX fifo underflow

enumerator kDSI_ApbRxOverflow

RX fifo overflow

enumerator kDSI_ApbRxUnderflow

RX fifo underflow

enumerator kDSI_ApbRxHeaderReceived

RX packet header has been received

enumerator kDSI_ApbRxPacketReceived

All RX packet payload data has been received

_dsi_rx_error_status Host receive error status.

Values:

enumerator kDSI_RxErrorEccOneBit

ECC single bit error detected.

enumerator kDSI_RxErrorEccMultiBit

ECC multi bit error detected.

enumerator kDSI_RxErrorCrc

CRC error detected.

enumerator kDSI_RxErrorHtxTo

High Speed forward TX timeout detected.

enumerator kDSI_RxErrorLrxTo

Reverse Low power data receive timeout detected.

enumerator kDSI_RxErrorBtaTo

BTA timeout detected.

enum _dsi_host_status

DSI host controller status (status_out)

Values:

enumerator kDSI_HostSoTError

SoT error from peripheral error report.

enumerator kDSI_HostSoTSyncError

SoT Sync error from peripheral error report.

enumerator kDSI_HostEoTSyncError

EoT Sync error from peripheral error report.

enumerator kDSI_HostEscEntryCmdError

Escape Mode Entry Command Error from peripheral error report.

enumerator kDSI_HostLpTxSyncError

Low-power transmit Sync Error from peripheral error report.

enumerator kDSI_HostPeriphToError

Peripheral timeout error from peripheral error report.

enumerator kDSI_HostFalseControlError

False control error from peripheral error report.

enumerator kDSI_HostContentionDetected

Contention detected from peripheral error report.

enumerator kDSI_HostEccErrorOneBit

Single bit ECC error (corrected) from peripheral error report.

enumerator kDSI_HostEccErrorMultiBit

Multi bit ECC error (not corrected) from peripheral error report.

enumerator kDSI_HostChecksumError

Checksum error from peripheral error report.

enumerator kDSI_HostInvalidDataType

DSI data type not recognized.

enumerator kDSI_HostInvalidVcId

DSI VC ID invalid.

enumerator kDSI_HostInvalidTxLength

Invalid transmission length.

enumerator kDSI_HostProtocalViolation

DSI protocal violation.

enumerator kDSI_HostResetTriggerReceived

Reset trigger received.

enumerator kDSI_HostTearTriggerReceived

Tear effect trigger receive.

enumerator kDSI_HostAckTriggerReceived

Acknowledge trigger message received.

_dsi_ulps_status Status of APB to packet interface.

Values:

enumerator kDSI_ClockLaneUlpsEnable

Clock lane in ULPS mode.

enumerator kDSI_DataLane0UlpsEnable

Data lane 0 in ULPS mode.

enumerator kDSI_DataLane1UlpsEnable

Data lane 1 in ULPS mode.

enumerator kDSI_DataLane2UlpsEnable

Data lane 2 in ULPS mode.

enumerator kDSI_DataLane3UlpsEnable

Data lane 3 in ULPS mode.

_dsi_interrupt DSI interrupt.

Values:

enumerator kDSI_InterruptGroup1ApbNotIdle

State machine not idle

enumerator kDSI_InterruptGroup1ApbTxDone

Tx packet done

enumerator kDSI_InterruptGroup1ApbRxControl

DPHY direction 0 - tx control, 1 - rx control

enumerator kDSI_InterruptGroup1ApbTxOverflow

TX fifo overflow

enumerator kDSI_InterruptGroup1ApbTxUnderflow

TX fifo underflow

enumerator kDSI_InterruptGroup1ApbRxOverflow

RX fifo overflow

enumerator kDSI_InterruptGroup1ApbRxUnderflow

RX fifo underflow

enumerator kDSI_InterruptGroup1ApbRxHeaderReceived

RX packet header has been received

enumerator kDSI_InterruptGroup1ApbRxPacketReceived

All RX packet payload data has been received

enumerator kDSI_InterruptGroup1SoTError

SoT error from peripheral error report.

enumerator kDSI_InterruptGroup1SoTSyncError

SoT Sync error from peripheral error report.

enumerator kDSI_InterruptGroup1EoTSyncError

EoT Sync error from peripheral error report.

enumerator kDSI_InterruptGroup1EscEntryCmdError

Escape Mode Entry Command Error from peripheral error report.

enumerator kDSI_InterruptGroup1LpTxSyncError

Low-power transmit Sync Error from peripheral error report.

enumerator kDSI_InterruptGroup1PeriphToError

Peripheral timeout error from peripheral error report.

enumerator kDSI_InterruptGroup1FalseControlError

False control error from peripheral error report.

enumerator kDSI_InterruptGroup1ContentionDetected

Contention detected from peripheral error report.

enumerator kDSI_InterruptGroup1EccErrorOneBit

Single bit ECC error (corrected) from peripheral error report.

enumerator kDSI_InterruptGroup1EccErrorMultiBit

Multi bit ECC error (not corrected) from peripheral error report.

enumerator kDSI_InterruptGroup1ChecksumError

Checksum error from peripheral error report.

enumerator kDSI_InterruptGroup1InvalidDataType

DSI data type not recognized.

enumerator kDSI_InterruptGroup1InvalidVcId

DSI VC ID invalid.

enumerator kDSI_InterruptGroup1InvalidTxLength

Invalid transmission length.

enumerator kDSI_InterruptGroup1ProtocalViolation

DSI protocal violation.

enumerator kDSI_InterruptGroup1ResetTriggerReceived

Reset trigger received.

enumerator kDSI_InterruptGroup1TearTriggerReceived

Tear effect trigger receive.

enumerator kDSI_InterruptGroup1AckTriggerReceived

Acknowledge trigger message received.

enumerator kDSI_InterruptGroup1HtxTo

High speed TX timeout.

enumerator kDSI_InterruptGroup1LrxTo

Low power RX timeout.

enumerator kDSI_InterruptGroup1BtaTo

Host BTA timeout.

enumerator kDSI_InterruptGroup2EccOneBit

Sinle bit ECC error.

enumerator kDSI_InterruptGroup2EccMultiBit

Multi bit ECC error.

enumerator kDSI_InterruptGroup2CrcError

CRC error.

enum _dsi_tx_data_type

DSI TX data type.

Values:

enumerator kDSI_TxDataVsyncStart

V Sync start.

enumerator kDSI_TxDataVsyncEnd

V Sync end.

enumerator kDSI_TxDataHsyncStart

H Sync start.

enumerator kDSI_TxDataHsyncEnd

H Sync end.

enumerator kDSI_TxDataEoTp

End of transmission packet.

enumerator kDSI_TxDataCmOff

Color mode off.

enumerator kDSI_TxDataCmOn

Color mode on.

enumerator kDSI_TxDataShutDownPeriph

Shut down peripheral.

enumerator kDSI_TxDataTurnOnPeriph

Turn on peripheral.

enumerator kDSI_TxDataGenShortWrNoParam

Generic Short WRITE, no parameters.

enumerator kDSI_TxDataGenShortWrOneParam

Generic Short WRITE, one parameter.

enumerator kDSI_TxDataGenShortWrTwoParam

Generic Short WRITE, two parameter.

enumerator kDSI_TxDataGenShortRdNoParam

Generic Short READ, no parameters.

enumerator kDSI_TxDataGenShortRdOneParam

Generic Short READ, one parameter.

enumerator kDSI_TxDataGenShortRdTwoParam

Generic Short READ, two parameter.

enumerator kDSI_TxDataDcsShortWrNoParam

DCS Short WRITE, no parameters.

enumerator kDSI_TxDataDcsShortWrOneParam

DCS Short WRITE, one parameter.

enumerator kDSI_TxDataDcsShortRdNoParam

DCS Short READ, no parameters.

enumerator kDSI_TxDataSetMaxReturnPktSize

Set the Maximum Return Packet Size.

enumerator kDSI_TxDataNull

Null Packet, no data.

enumerator kDSI_TxDataBlanking

Blanking Packet, no data.

enumerator kDSI_TxDataGenLongWr

Generic long write.

enumerator kDSI_TxDataDcsLongWr

DCS Long Write/write_LUT Command Packet.

enumerator kDSI_TxDataLooselyPackedPixel20BitYCbCr

Loosely Packed Pixel Stream, 20-bit YCbCr, 4:2:2 Format.

enumerator kDSI_TxDataPackedPixel24BitYCbCr

Packed Pixel Stream, 24-bit YCbCr, 4:2:2 Format.

enumerator kDSI_TxDataPackedPixel16BitYCbCr

Packed Pixel Stream, 16-bit YCbCr, 4:2:2 Format.

enumerator kDSI_TxDataPackedPixel30BitRGB

Packed Pixel Stream, 30-bit RGB, 10-10-10 Format.

enumerator kDSI_TxDataPackedPixel36BitRGB

Packed Pixel Stream, 36-bit RGB, 12-12-12 Format.

enumerator kDSI_TxDataPackedPixel12BitYCrCb

Packed Pixel Stream, 12-bit YCbCr, 4:2:0 Format.

enumerator kDSI_TxDataPackedPixel16BitRGB

Packed Pixel Stream, 16-bit RGB, 5-6-5 Format.

enumerator kDSI_TxDataPackedPixel18BitRGB

Packed Pixel Stream, 18-bit RGB, 6-6-6 Format.

enumerator kDSI_TxDataLooselyPackedPixel18BitRGB

Loosely Packed Pixel Stream, 18-bit RGB, 6-6-6 Format.

enumerator kDSI_TxDataPackedPixel24BitRGB

Packed Pixel Stream, 24-bit RGB, 8-8-8 Format.

enum _dsi_rx_data_type

DSI RX data type.

Values:

enumerator kDSI_RxDataAckAndErrorReport

Acknowledge and Error Report

enumerator kDSI_RxDataEoTp

End of Transmission packet.

enumerator kDSI_RxDataGenShortRdResponseOneByte

Generic Short READ Response, 1 byte returned.

enumerator kDSI_RxDataGenShortRdResponseTwoByte

Generic Short READ Response, 2 byte returned.

enumerator kDSI_RxDataGenLongRdResponse

Generic Long READ Response.

enumerator kDSI_RxDataDcsLongRdResponse

DCS Long READ Response.

enumerator kDSI_RxDataDcsShortRdResponseOneByte

DCS Short READ Response, 1 byte returned.

enumerator kDSI_RxDataDcsShortRdResponseTwoByte

DCS Short READ Response, 2 byte returned.

_dsi_transfer_flags DSI transfer control flags.

Values:

enumerator kDSI_TransferUseHighSpeed

Use high speed mode or not.

enumerator kDSI_TransferPerformBTA

Perform BTA or not.

typedef enum _dsi_dbi_pixel_format dsi_dbi_pixel_format_t

MIPI DBI pixel format.

typedef struct _dsi_config dsi_config_t

MIPI DSI controller configuration.

typedef enum _dsi_dpi_color_coding dsi_dpi_color_coding_t

MIPI DPI interface color coding.

typedef enum _dsi_dpi_pixel_packet dsi_dpi_pixel_packet_t

MIPI DSI pixel packet type send through DPI interface.

typedef enum _dsi_dpi_video_mode dsi_dpi_video_mode_t

DPI video mode.

typedef enum _dsi_dpi_bllp_mode dsi_dpi_bllp_mode_t

Behavior in BLLP (Blanking or Low-Power Interval).

typedef struct _dsi_dpi_config dsi_dpi_config_t

MIPI DSI controller DPI interface configuration.

typedef struct _dsi_dphy_config dsi_dphy_config_t

MIPI DSI D-PHY configuration.

typedef enum _dsi_tx_data_type dsi_tx_data_type_t

DSI TX data type.

typedef enum _dsi_rx_data_type dsi_rx_data_type_t

DSI RX data type.

typedef struct _dsi_transfer dsi_transfer_t

Structure for the data transfer.

typedef struct _dsi_handle dsi_handle_t

MIPI DSI transfer handle.

typedef void (*dsi_callback_t)(MIPI_DSI_HOST_Type *base, dsi_handle_t *handle, status_t status, void *userData)

MIPI DSI callback for finished transfer.

When transfer finished, one of these status values will be passed to the user:

  • kStatus_Success Data transfer finished with no error.

  • kStatus_Timeout Transfer failed because of timeout.

  • kStatus_DSI_RxDataError RX data error, user could use DSI_GetRxErrorStatus to check the error details.

  • kStatus_DSI_ErrorReportReceived Error Report packet received, user could use DSI_GetAndClearHostStatus to check the error report status.

  • kStatus_Fail Transfer failed for other reasons.

FSL_DSI_TX_MAX_PAYLOAD_BYTE
FSL_DSI_RX_MAX_PAYLOAD_BYTE
struct _dsi_config
#include <fsl_mipi_dsi.h>

MIPI DSI controller configuration.

Public Members

uint8_t numLanes

Number of lanes.

bool enableNonContinuousHsClk

In enabled, the high speed clock will enter low power mode between transmissions.

bool enableTxUlps

Enable the TX ULPS.

bool autoInsertEoTp

Insert an EoTp short package when switching from HS to LP.

uint8_t numExtraEoTp

How many extra EoTp to send after the end of a packet.

uint32_t htxTo_ByteClk

HS TX timeout count (HTX_TO) in byte clock.

uint32_t lrxHostTo_ByteClk

LP RX host timeout count (LRX-H_TO) in byte clock.

uint32_t btaTo_ByteClk

Bus turn around timeout count (TA_TO) in byte clock.

struct _dsi_dpi_config
#include <fsl_mipi_dsi.h>

MIPI DSI controller DPI interface configuration.

Public Members

uint16_t pixelPayloadSize

Maximum number of pixels that should be sent as one DSI packet. Recommended that the line size (in pixels) is evenly divisible by this parameter.

dsi_dpi_color_coding_t dpiColorCoding

DPI color coding.

dsi_dpi_pixel_packet_t pixelPacket

Pixel packet format.

dsi_dpi_video_mode_t videoMode

Video mode.

dsi_dpi_bllp_mode_t bllpMode

Behavior in BLLP.

uint8_t polarityFlags

OR’ed value of _dsi_dpi_polarity_flag controls signal polarity.

uint16_t hfp

Horizontal front porch, in dpi pixel clock.

uint16_t hbp

Horizontal back porch, in dpi pixel clock.

uint16_t hsw

Horizontal sync width, in dpi pixel clock.

uint8_t vfp

Number of lines in vertical front porch.

uint8_t vbp

Number of lines in vertical back porch.

uint16_t panelHeight

Line number in vertical active area.

uint8_t virtualChannel

Virtual channel.

struct _dsi_dphy_config
#include <fsl_mipi_dsi.h>

MIPI DSI D-PHY configuration.

Public Members

uint32_t txHsBitClk_Hz

The generated HS TX bit clock in Hz.

uint8_t tClkPre_ByteClk

TLPX + TCLK-PREPARE + TCLK-ZERO + TCLK-PRE in byte clock. Set how long the controller will wait after enabling clock lane for HS before enabling data lanes for HS.

uint8_t tClkPost_ByteClk

TCLK-POST + T_CLK-TRAIL in byte clock. Set how long the controller will wait before putting clock lane into LP mode after data lanes detected in stop state.

uint8_t tHsExit_ByteClk

THS-EXIT in byte clock. Set how long the controller will wait after the clock lane has been put into LP mode before enabling clock lane for HS again.

uint32_t tWakeup_EscClk

Number of clk_esc clock periods to keep a clock or data lane in Mark-1 state after exiting ULPS.

uint8_t tHsPrepare_HalfEscClk

THS-PREPARE in clk_esc/2. Set how long to drive the LP-00 state before HS transmissions, available values are 2, 3, 4, 5.

uint8_t tClkPrepare_HalfEscClk

TCLK-PREPARE in clk_esc/2. Set how long to drive the LP-00 state before HS transmissions, available values are 2, 3.

uint8_t tHsZero_ByteClk

THS-ZERO in clk_byte. Set how long that controller drives data lane HS-0 state before transmit the Sync sequence. Available values are 6, 7, …, 37.

uint8_t tClkZero_ByteClk

TCLK-ZERO in clk_byte. Set how long that controller drives clock lane HS-0 state before transmit the Sync sequence. Available values are 3, 4, …, 66.

uint8_t tHsTrail_ByteClk

THS-TRAIL + 4*UI in clk_byte. Set the time of the flipped differential state after last payload data bit of HS transmission burst. Available values are 0, 1, …, 15.

uint8_t tClkTrail_ByteClk

TCLK-TRAIL + 4*UI in clk_byte. Set the time of the flipped differential state after last payload data bit of HS transmission burst. Available values are 0, 1, …, 15.

struct _dsi_transfer
#include <fsl_mipi_dsi.h>

Structure for the data transfer.

Public Members

uint8_t virtualChannel

Virtual channel.

dsi_tx_data_type_t txDataType

TX data type.

uint8_t flags

Flags to control the transfer, see _dsi_transfer_flags.

const uint8_t *txData

The TX data buffer.

uint8_t *rxData

The RX data buffer.

uint16_t txDataSize

Size of the TX data.

uint16_t rxDataSize

Size of the RX data.

bool sendDscCmd

If set to true, the DCS command is specified by dscCmd, otherwise the DCS command is included in the txData.

uint8_t dscCmd

The DCS command to send, only valid when sendDscCmd is true.

struct _dsi_handle
#include <fsl_mipi_dsi.h>

MIPI DSI transfer handle structure.

Public Members

volatile bool isBusy

MIPI DSI is busy with APB data transfer.

dsi_transfer_t xfer

Transfer information.

dsi_callback_t callback

DSI callback

void *userData

Callback parameter

MIPI_DSI: MIPI DSI Host Controller

MMU: Memory Map Unit

void MMU_Init(MMU_Type *base, const mmu_config_t *config)

Initialize MMU:

  1. Enable MMU clock;

  2. Define the basic unit that is used in the memory map;

  3. Configure valid address range;

  4. Fill LUT SRAM;

  5. Enable MMU remap function.

Parameters:
  • base – MMU peripheral base address.

  • config – Pointer to the user defined variable in type of mmu_config_t.

void MMU_Deinit(MMU_Type *base)

De-initialize MMU:

  1. Disable MMU remap function;

  2. Reset MMU logic;

  3. Disable MMU clock.

Parameters:
  • base

void MMU_GetDefaultConfig(mmu_config_t *config)

Get default configurations of MMU module.

config->unitSize = kMMU_UnitSize4KB;
config->pageMode = kMMU_1PageMode;
config->invalidAddrMode = kMMU_InvalidAddrRespondError;
config->baseAddr    = 0x0UL;
config->maxAddr     = 0x0UL;
config->operationToWrite = kMMU_LUTBurstWrite;
config->ptrLutWord       = NULL;
config->countOfWordToWrite = 0U;
config->startPointer = 0U;
Parameters:
  • config – Pointer to the user defined variable in type of mmu_config_t.

void MMU_SetupSimpleMap(MMU_Type *base, uint32_t virt, uint32_t phys)

Map one physical unit to the virtual unit.

Parameters:
  • base – MMU peripheral base address.

  • virt – The unit-aligned virtual address.

  • phys – The unit-aligned virtual address.

void MMU_TearDownSimpleMap(MMU_Type *base, uint32_t virt)

Remove mapping for one unit of provided virtual address.

Parameters:
  • base – MMU peripheral base address.

  • virt – The unit-aligned virtual address.

void MMU_SetupRegionMap(MMU_Type *base, uint32_t virt, uint32_t phys, size_t regionSize)

Map a region of physical memory into the virtual address space.

Parameters:
  • base – MMU peripheral base address.

  • virt – The unit-aligned destination virtual address to map.

  • phys – The unit-aligned source physical address to map.

  • regionSize – Unit-aligned size of mapped memory region in bytes.

void MMU_TearDownRegionMap(MMU_Type *base, uint32_t virt, size_t regionSize)

Remove mapping for a provided virtual address region.

Parameters:
  • base – MMU peripheral base address.

  • virt – The unit-aligned virtual address.

  • regionSize – The unit-aligned size of region in bytes.

void MMU_RemapRegion(MMU_Type *base, uint32_t oldVirt, uint32_t newVirt, size_t regionSize)

Remap old virtual region into new address.

Parameters:
  • base – MMU peripheral base address.

  • oldVirt – The unit-aligned old virtual address.

  • newVirt – The unit-aligned new virtual address.

  • regionSize – The unit-aligned size of region in bytes.

void MMU_MoveRegion(MMU_Type *base, uint32_t oldVirt, uint32_t newVirt, uint32_t newPhys, size_t regionSize)

Physically move region of memory, with copy.

Maps a region of physical memory into the new virtual address space, and copy region of size from the old virtual address space. The new virtual memory region is mapped from physical memory starting newPhys of size regionSize.

Parameters:
  • base – MMU peripheral base address.

  • oldVirt – Unit-aligned old virtual region address.

  • newVirt – Unit-aligned new virtual region address.

  • newPhys – Unit-aligned new physical region address which will map to new virtual region address.

  • regionSize – Unit-aligned size of region in bytes.

void MMU_SetupArrayMap(MMU_Type *base, uint32_t *ptrVirts, uint32_t *ptrPhys, uint32_t count)

Map an array of physical memory address into an array of virtual memory address.

Parameters:
  • base – MMU peripheral base address.

  • ptrVirts – Pointer to the array which contain unit-aligned virtual address.

  • ptrPhys – Pointer to the array which contain unit-aligned physical address.

  • count – Count of array elements.

void MMU_TearDownArrayMap(MMU_Type *base, uint32_t *ptrVirts, uint32_t count)

Remove mapping of an array of virtual address.

Parameters:
  • base – MMU peripheral base address.

  • ptrVirts – Pointer to the array which contains unit-aligned virtual address.

  • count – Count of array elements.

void MMU_MoveArray(MMU_Type *base, uint32_t *ptrOldVirts, uint32_t *ptrNewVirts, uint32_t *ptrNewPhys, uint32_t count)

Physical move array of memory, with copy.

Maps an array of physical memory into the new array of virtual address space( ptrNewVirts ), and copy an unit size of data from old array of virtual address to new array of virtual address.

Parameters:
  • base – MMU peripheral base address.

  • ptrOldVirts – Pointer to the array which contain old unit-aligned virtual address.

  • ptrNewVirts – Pointer to the array which contain new unit-aligned virtual address.

  • ptrNewPhys – Pointer to the array which contain new unit-aligned physical address.

  • count – Count of array elements.

void MMU_GetPhyAddr(MMU_Type *base, uint32_t virt, uint32_t *ptrPtrs)

Get mapped physical address from input virtual address.

Parameters:
  • base – MMU peripheral base address.

  • virt – The virtual address.

  • ptrPtrs[out] Pointer to the variable to store mapped physical address.

static inline void MMU_EnableMemoryMap(MMU_Type *base, bool enable)

Enable/disable memory map.

Parameters:
  • base – MMU peripheral base address.

  • enable – Used to enable/disable memory map:

    • true Enable memory map, the addresses of the AHB transaction are remapped by looking up LUT SRAM.

    • false Disable memory map, the AHB transaction passes through MMU without address remapping.

static inline void MMU_UpdateUnitSize(MMU_Type *base, mmu_unit_size_t unitSize)

Update the basic size of the unit that is used in the memory map.

Parameters:
  • base – MMU peripheral base address.

  • unitSize – Used to specify the basic size of unit in type of mmu_unit_size_t.

void MMU_DoSoftwareReset(MMU_Type *base)

Trigger a software reset to reset the MMU logic.

Parameters:
  • base – MMU peripheral base address.

static inline void MMU_UpdateValidAddressRange(MMU_Type *base, uint16_t baseAddr, uint16_t maxAddr)

Update the valid address range.

To set AHB address from 0x51000000UL to 0x511FFFFF are valid:
MMU_UpdateValidAddressRange(MMU0, 0x5100U, 0x511FU);

Note

Both baseAddr and maxAddr mean the upper 16 bits of a valid address.

Parameters:
  • base – MMU peripheral base address.

  • baseAddr – Upper 16 bits of valid range’s base address.

  • maxAddr – Upper 16 bits of valid range’s maximum address.

static inline void MMU_ChangePageOption(MMU_Type *base, mmu_page_option_t pageOpt)

Change page mode, the MMU module supports #kMMU_1PageMode and #kMMU_4PageMode.

Parameters:
  • base – MMU peripheral base address.

  • pageMode – Page mode to use, please refer to mmu_page_option_t.

void MMU_UpdateLUTBlocking(MMU_Type *base, uint16_t startPointer, mmu_lut_word_t *ptrLutWord, uint16_t countOfWords, mmu_lut_write_operation_t writeOperation)

Use the blocking method to update LUT SRAM with user-defined words.

Note

This function only return when all words that #ptrLutWord refers are set into LUT SRAM.

Note

This function supports both single write and burst write described in RM, please note that burst write is only useful when to fill continuous value into continuous addresses.

Note

startPointer + countOfWords should not exceed the maximum size of LUT SRAM(8192).

Fill continuous values into continuous addresses (E.g: initialize LUT SRAM address 2 and 3 with value 0x12 and 0x13)
             mmu_lut_word_t    startLutWord = {
                 .mappedValue = 0x12U;
                 .valid = 1U;
            };
             MMU_UpdateLUTBlocking(MMU0, 2U, &startLutWord, 2U, kMMU_LUTBurstWrite);
Fill discontinuous values into continuous addresses(E.g: initialize LUT SRAM address 2 and 3 with value 0x12 and
0x34) mmu_lut_word_t lutWordArray[2] = {
                 {
                     .mappedValue = 0x12U;
                     .valid      = 1U;
                 },
                 {
                     .mappedValue = 0x34U;
                     .valid      = 1U;
                 },
             };
             MMU_UpdateLUTBlocking(MMU0, 2U, lutWordArray, 2U,kMMU_LUTSingleWrite);
Fill discontinuous values into discontinuous addresses(E.g: initialize LUT SRAM address 2 and 5 with value 0x12 and
0x34)): mmu_lut_word_t addr2LutWord = { .mappedValue = 0x12U; .valid      = 1U;
             };
             MMU_UpdateLUTBlocking(MMU0, 2U, &addr2LutWord, 1U, kMMU_LUTSingleWrite);

             mmu_lut_word_t addr5LutWord = {
                 .mappedValue = 0x34U;
                 .valid      = 1U;
             };
             MMU_UpdateLUTBlocking(MMU0, 5U, &addr5LutWord, 1U, kMMU_LUTSingleWrite);

Parameters:
  • base – MMU peripheral base address.

  • startPointer – Start pointer of LUT SRAM to fill new mapping words, range from 0 to 8191.

  • ptrLutWord – Pointer to new lut words: if writeOperation is selected as kMMU_LUTBurstWrite this parameter should be a pointer to the variable which represents the first LUT word to set; if writeOperation is selected as kMMU_LUTSingleWrite this parameter can be set as a pointer to the array that contains all new LUT words to set or set as a pointer to one variable when only want to update one word into LUT’s specific pointer.

  • countOfWord – Count to new word to update into LUT SRAM, range from 1 to 8192.

  • writeOperation – Specify the write operation, the meaning of #ptrLutWord is different for different write operations.

void MMU_ReadLUT(MMU_Type *base, uint16_t startPointer, mmu_lut_word_t *ptrWordReadBuffer, uint16_t count)

Read the specified number of LUT content from the specified pointer into the user-defined buffer.

Note

#startPointer + #count should not exceed maximum size of LUT SRAM(8192).

Parameters:
  • base – MMU peripheral base address.

  • startPointer – Specify start address to read in LUT SRAM, range from 0 to 8191.

  • ptrWordReadBuffer – Pointer of a buffer that record read out words.

  • count – Specify number of continuous address in LUT SRAM to read, range from 1 to 8192.

void MMU_TriggerLUTVerificationBlocking(MMU_Type *base, uint16_t startPointer, mmu_lut_word_t goldenWordToCheck, uint16_t count)

Trigger the specified number of read operations from LUT SRAM, compare with the input golden word, the read address and golden data are increased automatically each time.

Note

This function only return when all read-verify operations are complete.

Parameters:
  • base – MMU peripheral base address.

  • startPointer – The pointer of LUT SRAM which start to check, range from 0 to 8191.

  • goldenWordToCheck – The first golden word to check, in following read-verify operation, the golden data will increase automatically.

  • count – Specify number of continuous address in LUT SRAM to check, range from 1 to 8192.

static inline void MMU_LockLUT(MMU_Type *base)

Lock LUT SRAM to avoid an accidental update.

Note

If locked, writing to LUT SRAM will trigger kMMU_LockErrorFlag.

Parameters:
  • base – MMU peripheral base address.

static inline void MMU_UnlockLUT(MMU_Type *base)

Unlock LUT SRAM.

Note

To update LUT SRAM, please ensure LUT is unlocked.

Parameters:
  • base – MMU peripheral base address.

static inline uint32_t MMU_GetStatusFlags(MMU_Type *base)

Get status flags.

Parameters:
  • base – MMU peripheral base address.

Returns:

All status flags asserted, should be the OR’ed value of mmu_status_flags_t.

static inline void MMU_ClearStatusFlags(MMU_Type *base, uint32_t mask)

Clear status flags.

Parameters:
  • base – MMU peripheral base address.

  • mask – The mask of flags to clear, should be the OR’ed value of mmu_status_flags_t.

static inline uint16_t MMU_GetIPSReadErrorAddress(MMU_Type *base)

Get the LUT SRAM address when an error is detected for the IPS read operation (including IPS read parity error and read-verify mismatch error).

Parameters:
  • base – MMU peripheral base address.

Returns:

The pointer in LUT SRAM, range from 0 to 8191.

void MMU_GetAHBErrorRecord(MMU_Type *base, mmu_ahb_error_record_t *ptrRecord)

Get a record of AHB information when an error happens.

Parameters:
  • base – MMU peripheral base address.

  • ptrRecord – Pointer to user-defined mmu_ahb_error_record_t variable which used to store current AHB error information.

Returns:

The record of AHB information when an error happens, please refer to mmu_ahb_error_record_t for details.

static inline bool MMU_CheckMMUBusy(MMU_Type *base)

Check if MMU is in the Busy state.

Note

There are some possible reasons to make MMU is busy state:

  • Initialization sequence

  • Burst-write operation

  • Read-verify operation

Parameters:
  • base – MMU peripheral base address.

Return values:
  • false – MMU not in the busy state.

  • true – MMU is in the busy state, wait for it is not busy before taking an action.

static inline void MMU_EnableInterrupts(MMU_Type *base, uint32_t mask)

Enabled interrupts.

Parameters:
  • base – MMU peripheral base address.

  • mask – Mask of interrupts to enable, should be the OR’ed value of mmu_interrupt_enable_t.

static inline void MMU_DisableInterrupts(MMU_Type *base, uint32_t mask)

Disable interrupts.

Parameters:
  • base – MMU peripheral base address.

  • mask – Mask of interrupts to disable, should be the OR’ed value of mmu_interrupt_enable_t.

FSL_MMU_DRIVER_VERSION

mmu driver version 2.0.0.

enum _mmu_status_flags

The enumeration of MMU status flags,.

Values:

enumerator kMMU_BusyFlag

MMU is in Busy state, wait for it to clear before taking action.

enumerator kMMU_LUTInvalidFlag

Indicate whether the valid bit in the access address is 0, which means the access operation is invalid in LUT.

enumerator kMMU_AddressInvalidFlag

The AHB access address is out of the valid address range.

enumerator kMMU_ParityErrorFlag

A parity error is detected in the access address.

enumerator kMMU_LockErrorFlag

A lock error is detected when writing to LUT SRAM.

enumerator kMMU_IpsReadErrorFlag

Indicate whether an IPS read error is detected when read LUT SRAM, including IPS read parity error and read-verify mismatch error.

enumerator kMMU_AllFlags

All flags.

enum _mmu_interrupt_enable

The enumeration of MMU interrupts,.

Values:

enumerator kMMU_LUTInvalidInterruptEnable

Enable the interrupt for kMMU_LUTInvalidFlag.

enumerator kMMU_AddressInvalidInterruptEnable

Enable the interrupt for kMMU_AddressInvalidFlag.

enumerator kMMU_ParityErrorInterruptEnable

Enable the interrupt for kMMU_ParityErrorFlag.

enumerator kMMU_LockErrorInterruptEnable

Enable the interrupt for kMMU_LockErrorFlag.

enumerator kMMU_IpsReadErrorInterruptEnable

Enable the interrupt for kMMU_IpsReadErrorFlag.

enumerator kMMU_AllInterruptsEnable

Enable all interrupts.

enum _mmu_unit_size

The enumeration of unit size, available selections are 4KB, 8KB, 16KB, 32KB, and 64KB.

Values:

enumerator kMMU_UnitSize4KB

Specify the basic size of unit is 4KB.

enumerator kMMU_UnitSize8KB

Specify the basic size of unit is 8KB.

enumerator kMMU_UnitSize16KB

Specify the basic size of unit is 16KB.

enumerator kMMU_UnitSize32KB

Specify the basic size of unit is 32KB.

enumerator kMMU_UnitSize64KB

Specify the basic size of unit is 64KB.

enum _mmu_ahb_access_type

The enumeration of AHB access type, available selections are read access and write access.

Values:

enumerator kMMU_ReadAccess

The access type of the AHB transfer is read.

enumerator kMMU_WriteAccess

The access type of the AHB transfer is write.

enum _mmu_ahb_error_type

The enumeration of error type in case of AHB transfer, available selections are LUT invalid error, address invalid error, and parity error.

Values:

enumerator kMMU_LUTInvalidError

The error type information of the transfer is LUT invalid error.

enumerator kMMU_AddrInvalidError

The error type information of the transfer is address invalid error.

enumerator kMMU_ParityError

The error type information of the transfer is parity error.

enum _mmu_page_option

The MMU module supports two different page mode: 1 page mode and 4 pages mode.

Note

In 4 pages mode, each page contains 2K word. Different page can contain different mapping schema.

Values:

enumerator kMMU_PageOpt_1Page

MMU takes LUT SRAM as 1 page for address remapping.

enumerator kMMU_PageOpt_4Page_Low2KWordSelected

MMU takes LUT SRAM as 4 pages for address remapping, in this page mode the whole LUT is divided into 4 pages, use LUT SRAM low 2K words for address remapping.

enumerator kMMU_PageOpt_4Page_MidLow2KWordSelected

MMU takes LUT SRAM as 4 pages for address remapping, in this page mode the whole LUT is divided into 4 pages, use LUT SRAM mid-low 2K words for address remapping.

enumerator kMMU_PageOpt_4Page_MidHigh2KWordSelected

MMU takes LUT SRAM as 4 pages for address remapping, in this page mode the whole LUT is divided into 4 pages, use LUT SRAM mid-high 2K words for address remapping.

enumerator kMMU_PageOpt_4Page_High2KWordSelected

MMU takes LUT SRAM as 4 pages for address remapping, in this page mode the whole LUT is divided into 4 pages, use LUT SRAM mid-low 2K words for address remapping.

enum _mmu_lut_write_operation

The enumeration of LUT SRAM write operation, both burst-write and single-write are supported.

Values:

enumerator kMMU_LUTSingleWrite

In this operation, words to write in consequent LUT pointer may not consequent. It is possible to write discontinuous value into discontinuous address.

enumerator kMMU_LUTBurstWrite

In this operation, words to write in consequence LUT pointer must be consequent. write continuous value into continuous address.

enum _mmu_invalid_address_mode

The behavior when an invalid address is detected is programmable.

Values:

enumerator kMMU_InvalidAddrRespondError

MMU responds with a transfer error when a invalid address is detected.

enumerator kMMU_InvalidAddrAllowed

MMU allows transfer when an invalid address is detected.

typedef enum _mmu_unit_size mmu_unit_size_t

The enumeration of unit size, available selections are 4KB, 8KB, 16KB, 32KB, and 64KB.

typedef enum _mmu_ahb_access_type mmu_ahb_access_type_t

The enumeration of AHB access type, available selections are read access and write access.

typedef enum _mmu_ahb_error_type mmu_ahb_error_type_t

The enumeration of error type in case of AHB transfer, available selections are LUT invalid error, address invalid error, and parity error.

typedef enum _mmu_page_option mmu_page_option_t

The MMU module supports two different page mode: 1 page mode and 4 pages mode.

Note

In 4 pages mode, each page contains 2K word. Different page can contain different mapping schema.

typedef enum _mmu_lut_write_operation mmu_lut_write_operation_t

The enumeration of LUT SRAM write operation, both burst-write and single-write are supported.

typedef enum _mmu_invalid_address_mode mmu_invalid_address_mode_t

The behavior when an invalid address is detected is programmable.

typedef struct _mmu_ahb_error_record mmu_ahb_error_record_t

The record of AHB information when an error happens.

typedef struct _mmu_lut_word mmu_lut_word_t

The word in LUT SRAM, there are 8K words exist in LUT SRAM.

typedef struct _mmu_config mmu_config_t

The structure used to initialize the MMU instance includes unit size, page mode, address range, and LUT content.

mmu_unit_size_t g_selectedUnitSize
mmu_page_option_t g_selectedPageOpt
MMU_NUM_OF_UNIT_SIZE
MMU_PAGE_OPT_MASK
MMU_PAGE_OPT_SHIFT
MMU_PAGE_OPT(x)
struct _mmu_ahb_error_record
#include <fsl_mmu.h>

The record of AHB information when an error happens.

Public Members

uint32_t masterId

Indicate the master ID of the transfer.

uint32_t protectionInfo

Indicate the protection information of the transfer.

mmu_ahb_access_type_t accessType

Indicate the access type of the transfer.

mmu_ahb_error_type_t errorType

Indicate the error type of the transfer.

uint32_t failAddr

Indicates the LUT address where an erro happens.

struct _mmu_lut_word
#include <fsl_mmu.h>

The word in LUT SRAM, there are 8K words exist in LUT SRAM.

Public Members

uint16_t mappedValue

The mapped value to set, should be index of unit in valid address range not specific AHB address.

uint16_t valid

Specify whether the mapped value is valid: 1b1 means valid, 1b0 means invalid.

struct _mmu_config
#include <fsl_mmu.h>

The structure used to initialize the MMU instance includes unit size, page mode, address range, and LUT content.

Public Members

mmu_unit_size_t unitSize

Specify the basic size of unit that is used in the memory map.

mmu_page_option_t pageOpt

Specify the behavior of page option.

mmu_invalid_address_mode_t invalidAddrMode

Specify MMU behavior when an invalid address is detected.

uint16_t baseAddr

Upper 16 bits of valid range’s base address.

uint16_t maxAddr

Upper 16 bits of valid range’s maximum address.

uint32_t *ptrPhyAddrArray

Pointer to the physical address array used for array mapping.

uint32_t *ptrVirtualAddrArray

Pointer to the virtual address array used for array mapping.

uint16_t countOfAddr

Count of array elements

bool enableMMP

Enable/disable memory map feature, once enabled all AHB access to corresponding address are remapped by LUT SRAM.

MRT: Multi-Rate Timer

void MRT_Init(MRT_Type *base, const mrt_config_t *config)

Ungates the MRT clock and configures the peripheral for basic operation.

Note

This API should be called at the beginning of the application using the MRT driver.

Parameters:
  • base – Multi-Rate timer peripheral base address

  • config – Pointer to user’s MRT config structure. If MRT has MULTITASK bit field in MODCFG reigster, param config is useless.

void MRT_Deinit(MRT_Type *base)

Gate the MRT clock.

Parameters:
  • base – Multi-Rate timer peripheral base address

static inline void MRT_GetDefaultConfig(mrt_config_t *config)

Fill in the MRT config struct with the default settings.

The default values are:

config->enableMultiTask = false;

Parameters:
  • config – Pointer to user’s MRT config structure.

static inline void MRT_SetupChannelMode(MRT_Type *base, mrt_chnl_t channel, const mrt_timer_mode_t mode)

Sets up an MRT channel mode.

Parameters:
  • base – Multi-Rate timer peripheral base address

  • channel – Channel that is being configured.

  • mode – Timer mode to use for the channel.

static inline void MRT_EnableInterrupts(MRT_Type *base, mrt_chnl_t channel, uint32_t mask)

Enables the MRT interrupt.

Parameters:
  • base – Multi-Rate timer peripheral base address

  • channel – Timer channel number

  • mask – The interrupts to enable. This is a logical OR of members of the enumeration mrt_interrupt_enable_t

static inline void MRT_DisableInterrupts(MRT_Type *base, mrt_chnl_t channel, uint32_t mask)

Disables the selected MRT interrupt.

Parameters:
  • base – Multi-Rate timer peripheral base address

  • channel – Timer channel number

  • mask – The interrupts to disable. This is a logical OR of members of the enumeration mrt_interrupt_enable_t

static inline uint32_t MRT_GetEnabledInterrupts(MRT_Type *base, mrt_chnl_t channel)

Gets the enabled MRT interrupts.

Parameters:
  • base – Multi-Rate timer peripheral base address

  • channel – Timer channel number

Returns:

The enabled interrupts. This is the logical OR of members of the enumeration mrt_interrupt_enable_t

static inline uint32_t MRT_GetStatusFlags(MRT_Type *base, mrt_chnl_t channel)

Gets the MRT status flags.

Parameters:
  • base – Multi-Rate timer peripheral base address

  • channel – Timer channel number

Returns:

The status flags. This is the logical OR of members of the enumeration mrt_status_flags_t

static inline void MRT_ClearStatusFlags(MRT_Type *base, mrt_chnl_t channel, uint32_t mask)

Clears the MRT status flags.

Parameters:
  • base – Multi-Rate timer peripheral base address

  • channel – Timer channel number

  • mask – The status flags to clear. This is a logical OR of members of the enumeration mrt_status_flags_t

void MRT_UpdateTimerPeriod(MRT_Type *base, mrt_chnl_t channel, uint32_t count, bool immediateLoad)

Used to update the timer period in units of count.

The new value will be immediately loaded or will be loaded at the end of the current time interval. For one-shot interrupt mode the new value will be immediately loaded.

Note

User can call the utility macros provided in fsl_common.h to convert to ticks

Parameters:
  • base – Multi-Rate timer peripheral base address

  • channel – Timer channel number

  • count – Timer period in units of ticks

  • immediateLoad – true: Load the new value immediately into the TIMER register; false: Load the new value at the end of current timer interval

static inline uint32_t MRT_GetCurrentTimerCount(MRT_Type *base, mrt_chnl_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 – Multi-Rate timer peripheral base address

  • channel – Timer channel number

Returns:

Current timer counting value in ticks

static inline void MRT_StartTimer(MRT_Type *base, mrt_chnl_t channel, uint32_t count)

Starts the timer counting.

After calling this function, timers load period value, counts down to 0 and depending on the timer mode it will either load the respective start value again or stop.

Note

User can call the utility macros provided in fsl_common.h to convert to ticks

Parameters:
  • base – Multi-Rate timer peripheral base address

  • channel – Timer channel number.

  • count – Timer period in units of ticks. Count can contain the LOAD bit, which control the force load feature.

static inline void MRT_StopTimer(MRT_Type *base, mrt_chnl_t channel)

Stops the timer counting.

This function stops the timer from counting.

Parameters:
  • base – Multi-Rate timer peripheral base address

  • channel – Timer channel number.

static inline uint32_t MRT_GetIdleChannel(MRT_Type *base)

Find the available channel.

This function returns the lowest available channel number.

Parameters:
  • base – Multi-Rate timer peripheral base address

static inline void MRT_ReleaseChannel(MRT_Type *base, mrt_chnl_t channel)

Release the channel when the timer is using the multi-task mode.

In multi-task mode, the INUSE flags allow more control over when MRT channels are released for further use. The user can hold on to a channel acquired by calling MRT_GetIdleChannel() for as long as it is needed and release it by calling this function. This removes the need to ask for an available channel for every use.

Parameters:
  • base – Multi-Rate timer peripheral base address

  • channel – Timer channel number.

FSL_MRT_DRIVER_VERSION
enum _mrt_chnl

List of MRT channels.

Values:

enumerator kMRT_Channel_0

MRT channel number 0

enumerator kMRT_Channel_1

MRT channel number 1

enumerator kMRT_Channel_2

MRT channel number 2

enumerator kMRT_Channel_3

MRT channel number 3

enum _mrt_timer_mode

List of MRT timer modes.

Values:

enumerator kMRT_RepeatMode

Repeat Interrupt mode

enumerator kMRT_OneShotMode

One-shot Interrupt mode

enumerator kMRT_OneShotStallMode

One-shot stall mode

enum _mrt_interrupt_enable

List of MRT interrupts.

Values:

enumerator kMRT_TimerInterruptEnable

Timer interrupt enable

enum _mrt_status_flags

List of MRT status flags.

Values:

enumerator kMRT_TimerInterruptFlag

Timer interrupt flag

enumerator kMRT_TimerRunFlag

Indicates state of the timer

typedef enum _mrt_chnl mrt_chnl_t

List of MRT channels.

typedef enum _mrt_timer_mode mrt_timer_mode_t

List of MRT timer modes.

typedef enum _mrt_interrupt_enable mrt_interrupt_enable_t

List of MRT interrupts.

typedef enum _mrt_status_flags mrt_status_flags_t

List of MRT status flags.

typedef struct _mrt_config mrt_config_t

MRT configuration structure.

This structure holds the configuration settings for the MRT peripheral. To initialize this structure to reasonable defaults, call the MRT_GetDefaultConfig() function and pass a pointer to your config structure instance.

The config struct can be made const so it resides in flash

struct _mrt_config
#include <fsl_mrt.h>

MRT configuration structure.

This structure holds the configuration settings for the MRT peripheral. To initialize this structure to reasonable defaults, call the MRT_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

bool enableMultiTask

true: Timers run in multi-task mode; false: Timers run in hardware status mode

MU: Messaging Unit

uint32_t MU_GetInstance(MU_Type *base)

Get the MU instance index.

Parameters:
  • base – MU peripheral base address.

Returns:

MU instance index.

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 flag kMU_FlagsUpdatingFlag is cleared by hardware. During the flags updating period, the flags cannot be changed. The upper layer should make sure the status flag kMU_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 flag kMU_FlagsUpdatingFlag is cleared by hardware. During the flags updating period, the flags cannot be changed. This function waits for the MU status flag kMU_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.

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);
}

If there are more than 4 general purpose interrupts, use MU_GetGeneralPurposeStatusFlags.

Parameters:
  • base – MU peripheral base address.

Returns:

Bit mask of the MU status flags, see _mu_status_flags.

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 flags)

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);

If there are more than 4 general purpose interrupts, use MU_ClearGeneralPurposeStatusFlags.

Parameters:
  • base – MU peripheral base address.

  • flags – Bit mask of the MU status flags. See _mu_status_flags. Only the following flags can be cleared by software, other flags are cleared by hardware:

    • kMU_GenInt0Flag

    • kMU_GenInt1Flag

    • kMU_GenInt2Flag

    • kMU_GenInt3Flag

    • kMU_MuResetInterruptFlag

    • #kMU_OtherSideEnterRunInterruptFlag

    • #kMU_OtherSideEnterHaltInterruptFlag

    • #kMU_OtherSideEnterWaitInterruptFlag

    • #kMU_OtherSideEnterStopInterruptFlag

    • #kMU_OtherSideEnterPowerDownInterruptFlag

    • #kMU_ResetAssertInterruptFlag

    • #kMU_HardwareResetInterruptFlag

static inline void MU_EnableInterrupts(MU_Type *base, uint32_t interrupts)

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);

If there are more than 4 general purpose interrupts, use MU_EnableGeneralPurposeInterrupts.

Parameters:
  • base – MU peripheral base address.

  • interrupts – Bit mask of the MU interrupts. See _mu_interrupt_enable.

static inline void MU_DisableInterrupts(MU_Type *base, uint32_t interrupts)

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);

If there are more than 4 general purpose interrupts, use MU_DisableGeneralPurposeInterrupts.

Parameters:
  • base – MU peripheral base address.

  • interrupts – Bit mask of the MU interrupts. See _mu_interrupt_enable.

status_t MU_TriggerInterrupts(MU_Type *base, uint32_t interrupts)

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.
}

If there are more than 4 general purpose interrupts, use MU_TriggerGeneralPurposeInterrupts.

Parameters:
  • base – MU peripheral base address.

  • interrupts – 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.

static inline void MU_EnableGeneralPurposeInterrupts(MU_Type *base, uint32_t interrupts)

Enables the MU general purpose interrupts.

This function enables the MU general purpose interrupts. The interrupts to enable should be passed in as bit mask of mu_general_purpose_interrupt_t. The function MU_EnableInterrupts only support general interrupt 0~3, this function supports all general interrupts.

For example, to enable general purpose interrupt 0 and 3, use like this:

MU_EnableGeneralPurposeInterrupts(MU, kMU_GeneralPurposeInterrupt0 | kMU_GeneralPurposeInterrupt3);

Parameters:
  • base – MU peripheral base address.

  • interrupts – Bit mask of the MU general purpose interrupts, see mu_general_purpose_interrupt_t.

static inline void MU_DisableGeneralPurposeInterrupts(MU_Type *base, uint32_t interrupts)

Disables the MU general purpose interrupts.

This function disables the MU general purpose interrupts. The interrupts to disable should be passed in as bit mask of mu_general_purpose_interrupt_t. The function MU_DisableInterrupts only support general interrupt 0~3, this function supports all general interrupts.

For example, to disable general purpose interrupt 0 and 3, use like this:

MU_EnableGeneralPurposeInterrupts(MU, kMU_GeneralPurposeInterrupt0 | kMU_GeneralPurposeInterrupt3);

Parameters:
  • base – MU peripheral base address.

  • interrupts – Bit mask of the MU general purpose interrupts. see mu_general_purpose_interrupt_t.

static inline uint32_t MU_GetGeneralPurposeStatusFlags(MU_Type *base)

Gets the MU general purpose interrupt status flags.

This function returns the bit mask of the MU general purpose interrupt status flags. MU_GetStatusFlags can only get general purpose interrupt status 0~3, this function can get all general purpose interrupts status.

This example shows to check whether general purpose interrupt 0 and 3 happened.

uint32_t flags;
flags = MU_GetGeneralPurposeStatusFlags(base);
if (kMU_GeneralPurposeInterrupt0 & flags)
{
}
if (kMU_GeneralPurposeInterrupt3 & flags)
{
}
Parameters:
  • base – MU peripheral base address.

Returns:

Bit mask of the MU general purpose interrupt status flags.

static inline void MU_ClearGeneralPurposeStatusFlags(MU_Type *base, uint32_t flags)

Clear the MU general purpose interrupt status flags.

This function clears the specific MU general purpose interrupt status flags. The flags to clear should be passed in as bit mask. mu_general_purpose_interrupt_t_mu_status_flags.

Example to clear general purpose interrupt 0 and general interrupt 1 pending flags.

MU_ClearGeneralPurposeStatusFlags(base, kMU_GeneralPurposeInterrupt0 | kMU_GeneralPurposeInterrupt1);

Parameters:
  • base – MU peripheral base address.

  • flags – Bit mask of the MU general purpose interrupt status flags. See mu_general_purpose_interrupt_t.

static inline uint32_t MU_GetRxStatusFlags(MU_Type *base)

Return the RX status flags in reverse numerical order.

This function return the RX status flags in reverse order. Note: RFn bits of SR[3-0](mu status register) are mapped in ascending numerical order: RF0 -> SR[0] RF1 -> SR[1] RF2 -> SR[2] RF3 -> SR[3] This function will return these bits in reverse numerical order(RF3->RF1) to comply with MU_GetRxStatusFlags() of mu driver. See MU_GetRxStatusFlags() from drivers/mu/fsl_mu.h

status_reg = MU_GetRxStatusFlags(base);
Parameters:
  • base – MU peripheral base address.

Returns:

MU RX status flags in reverse order

status_t MU_TriggerGeneralPurposeInterrupts(MU_Type *base, uint32_t interrupts)

Triggers general purpose interrupts to the other core.

This function triggers the specific general purpose interrupts to the other core. The interrupts to trigger are passed in as bit mask. See mu_general_purpose_interrupt_t. 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.

status_t status;
status = MU_TriggerGeneralPurposeInterrupts(base, kMU_GeneralPurposeInterrupt0 | kMU_GeneralPurposeInterrupt2);

if (kStatus_Success != status)
{
     Previous general purpose interrupt 0 or general purpose interrupt 2
     has not been processed by the other core.
}
Parameters:
  • base – MU peripheral base address.

  • interrupts – Bit mask of the interrupts to trigger. See mu_general_purpose_interrupt_t.

Return values:
  • kStatus_Success – Interrupts have been triggered successfully.

  • kStatus_Fail – Previous interrupts have not been accepted.

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.

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.

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

MU_HardwareResetOtherCore(MU_A, true, false, bootMode);
In this example, the core at MU side B will reset with the specified boot mode.

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);

Note

The feature waitReset, holdReset, and bootMode might be not supported for some platforms. waitReset is only available for platforms that FSL_FEATURE_MU_NO_CORE_STATUS not defined as 1 and FSL_FEATURE_MU_HAS_RESET_ASSERT_INT not defined as 0. holdReset is only available for platforms that FSL_FEATURE_MU_HAS_RSTH not defined as 0. bootMode is only available for platforms that FSL_FEATURE_MU_HAS_BOOT not defined as 0.

Parameters:
  • base – MU peripheral base address.

  • waitReset – Wait the other core enters reset. Only work when there is CSSR0[RAIP]

    • 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. Only work when there is CCR0[RSTH]

    • 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.

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_RxFullPendingFlag

Any RX full flag is pending.

enumerator kMU_TxEmptyPendingFlag

Any TX empty flag is pending.

enumerator kMU_GenIntPendingFlag

Any general interrupt flag is pending.

enumerator kMU_EventPendingFlag

MU event pending.

enumerator kMU_FlagsUpdatingFlag

MU flags update is on-going.

enumerator kMU_MuInResetFlag

MU of any side is in reset.

enumerator kMU_MuResetInterruptFlag

The other side initializes MU reset.

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_MuResetInterruptEnable

The other side initializes MU reset.

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.

enum _mu_msg_reg_index

MU message register index.

Values:

enumerator kMU_MsgReg0

Message register 0.

enumerator kMU_MsgReg1

Message register 1.

enumerator kMU_MsgReg2

Message register 2.

enumerator kMU_MsgReg3

Message register 3.

enum _mu_general_purpose_interrupt

MU general purpose interrupts.

Values:

enumerator kMU_GeneralPurposeInterrupt0

General purpose interrupt 0

enumerator kMU_GeneralPurposeInterrupt1

General purpose interrupt 1

enumerator kMU_GeneralPurposeInterrupt2

General purpose interrupt 2

enumerator kMU_GeneralPurposeInterrupt3

General purpose interrupt 3

typedef enum _mu_msg_reg_index mu_msg_reg_index_t

MU message register index.

typedef enum _mu_general_purpose_interrupt mu_general_purpose_interrupt_t

MU general purpose interrupts.

MU_CORE_INTR(intr)
MU_MISC_INTR(intr)
MU_TX_INTR(intr)
MU_RX_INTR(intr)
MU_GI_INTR(intr)
MU_GET_CORE_INTR(intrs)
MU_GET_TX_INTR(intrs)
MU_GET_RX_INTR(intrs)
MU_GET_GI_INTR(intrs)
MU_CORE_FLAG(flag)
MU_STAT_FLAG(flag)
MU_TX_FLAG(flag)
MU_RX_FLAG(flag)
MU_GI_FLAG(flag)
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)

This type defines status return values used by NBOOT functions that are not easily

kStatus_NBOOT_Success

Operation completed successfully.

kStatus_NBOOT_Fail

Operation failed.

kStatus_NBOOT_InvalidArgument

Invalid argument passed to the function.

kStatus_NBOOT_RequestTimeout

Operation timed out.

kStatus_NBOOT_KeyNotLoaded

The requested key is not loaded.

kStatus_NBOOT_AuthFail

Authentication failed.

kStatus_NBOOT_OperationNotAvaialable

Operation not available on this HW.

kStatus_NBOOT_KeyNotAvailable

Key is not avaialble.

kStatus_NBOOT_IvCounterOverflow

Overflow of IV counter (PRINCE/IPED).

kStatus_NBOOT_SelftestFail

FIPS self-test failure.

kStatus_NBOOT_InvalidDataFormat

Invalid data format for example antipole

kStatus_NBOOT_IskCertUserDataTooBig

Size of User data in ISK certificate is greater than 96 bytes

kStatus_NBOOT_IskCertSignatureOffsetTooSmall

Signature offset in ISK certificate is smaller than expected

kStatus_NBOOT_MemcpyFail

Unexpected error detected during nboot_memcpy()

OSTIMER: OS Event Timer Driver

void OSTIMER_Init(OSTIMER_Type *base)

Initializes an OSTIMER by turning its bus clock on.

void OSTIMER_Deinit(OSTIMER_Type *base)

Deinitializes a OSTIMER instance.

This function shuts down OSTIMER bus clock

Parameters:
  • base – OSTIMER peripheral base address.

uint64_t OSTIMER_GrayToDecimal(uint64_t gray)

Translate the value from gray-code to decimal.

Parameters:
  • gray – The gray value input.

Returns:

The decimal value.

static inline uint64_t OSTIMER_DecimalToGray(uint64_t dec)

Translate the value from decimal to gray-code.

Parameters:
  • dec – The decimal value.

Returns:

The gray code of the input value.

uint32_t OSTIMER_GetStatusFlags(OSTIMER_Type *base)

Get OSTIMER status Flags.

This returns the status flag. Currently, only match interrupt flag can be got.

Parameters:
  • base – OSTIMER peripheral base address.

Returns:

status register value

void OSTIMER_ClearStatusFlags(OSTIMER_Type *base, uint32_t mask)

Clear Status Interrupt Flags.

This clears intrrupt status flag. Currently, only match interrupt flag can be cleared.

Parameters:
  • base – OSTIMER peripheral base address.

  • mask – Clear bit mask.

Returns:

none

status_t OSTIMER_SetMatchRawValue(OSTIMER_Type *base, uint64_t count, ostimer_callback_t cb)

Set the match raw value for OSTIMER.

This function will set a match value for OSTIMER with an optional callback. And this callback will be called while the data in dedicated pair match register is equals to the value of central EVTIMER. Please note that, the data format is gray-code, if decimal data was desired, please using OSTIMER_SetMatchValue().

Parameters:
  • base – OSTIMER peripheral base address.

  • count – OSTIMER timer match value.(Value is gray-code format)

  • cb – OSTIMER callback (can be left as NULL if none, otherwise should be a void func(void)).

Return values:
  • kStatus_Success – - Set match raw value and enable interrupt Successfully.

  • kStatus_Fail – - Set match raw value fail.

status_t OSTIMER_SetMatchValue(OSTIMER_Type *base, uint64_t count, ostimer_callback_t cb)

Set the match value for OSTIMER.

This function will set a match value for OSTIMER with an optional callback. And this callback will be called while the data in dedicated pair match register is equals to the value of central OS TIMER.

Parameters:
  • base – OSTIMER peripheral base address.

  • count – OSTIMER timer match value.(Value is decimal format, and this value will be translate to Gray code internally.)

  • cb – OSTIMER callback (can be left as NULL if none, otherwise should be a void func(void)).

Return values:
  • kStatus_Success – - Set match value and enable interrupt Successfully.

  • kStatus_Fail – - Set match value fail.

static inline void OSTIMER_SetMatchRegister(OSTIMER_Type *base, uint64_t value)

Set value to OSTIMER MATCH register directly.

This function writes the input value to OSTIMER MATCH register directly, it does not touch any other registers. Note that, the data format is gray-code. The function OSTIMER_DecimalToGray could convert decimal value to gray code.

Parameters:
  • base – OSTIMER peripheral base address.

  • value – OSTIMER timer match value (Value is gray-code format).

static inline void OSTIMER_EnableMatchInterrupt(OSTIMER_Type *base)

Enable the OSTIMER counter match interrupt.

Enable the timer counter match interrupt. The interrupt happens when OSTIMER counter matches the value in MATCH registers.

Parameters:
  • base – OSTIMER peripheral base address.

static inline void OSTIMER_DisableMatchInterrupt(OSTIMER_Type *base)

Disable the OSTIMER counter match interrupt.

Disable the timer counter match interrupt. The interrupt happens when OSTIMER counter matches the value in MATCH registers.

Parameters:
  • base – OSTIMER peripheral base address.

static inline uint64_t OSTIMER_GetCurrentTimerRawValue(OSTIMER_Type *base)

Get current timer raw count value from OSTIMER.

This function will get a gray code type timer count value from OS timer register. The raw value of timer count is gray code format.

Parameters:
  • base – OSTIMER peripheral base address.

Returns:

Raw value of OSTIMER, gray code format.

uint64_t OSTIMER_GetCurrentTimerValue(OSTIMER_Type *base)

Get current timer count value from OSTIMER.

This function will get a decimal timer count value. The RAW value of timer count is gray code format, will be translated to decimal data internally.

Parameters:
  • base – OSTIMER peripheral base address.

Returns:

Value of OSTIMER which will be formated to decimal value.

static inline uint64_t OSTIMER_GetCaptureRawValue(OSTIMER_Type *base)

Get the capture value from OSTIMER.

This function will get a captured gray-code value from OSTIMER. The Raw value of timer capture is gray code format.

Parameters:
  • base – OSTIMER peripheral base address.

Returns:

Raw value of capture register, data format is gray code.

uint64_t OSTIMER_GetCaptureValue(OSTIMER_Type *base)

Get the capture value from OSTIMER.

This function will get a capture decimal-value from OSTIMER. The RAW value of timer capture is gray code format, will be translated to decimal data internally.

Parameters:
  • base – OSTIMER peripheral base address.

Returns:

Value of capture register, data format is decimal.

void OSTIMER_HandleIRQ(OSTIMER_Type *base, ostimer_callback_t cb)

OS timer interrupt Service Handler.

This function handles the interrupt and refers to the callback array in the driver to callback user (as per request in OSTIMER_SetMatchValue()). if no user callback is scheduled, the interrupt will simply be cleared.

Parameters:
  • base – OS timer peripheral base address.

  • cb – callback scheduled for this instance of OS timer

Returns:

none

FSL_OSTIMER_DRIVER_VERSION

OSTIMER driver version.

enum _ostimer_flags

OSTIMER status flags.

Values:

enumerator kOSTIMER_MatchInterruptFlag

Match interrupt flag bit, sets if the match value was reached.

typedef void (*ostimer_callback_t)(void)

ostimer callback function.

PDM: Microphone Interface

PDM Driver

void PDM_Init(PDM_Type *base, const pdm_config_t *config)

Initializes the PDM peripheral.

Ungates the PDM clock, resets the module, and configures PDM with a configuration structure. The configuration structure can be custom filled or set with default values by PDM_GetDefaultConfig().

Note

This API should be called at the beginning of the application to use the PDM driver. Otherwise, accessing the PDM module can cause a hard fault because the clock is not enabled.

Parameters:
  • base – PDM base pointer

  • config – PDM configuration structure.

void PDM_Deinit(PDM_Type *base)

De-initializes the PDM peripheral.

This API gates the PDM clock. The PDM module can’t operate unless PDM_Init is called to enable the clock.

Parameters:
  • base – PDM base pointer

static inline void PDM_Reset(PDM_Type *base)

Resets the PDM module.

Parameters:
  • base – PDM base pointer

static inline void PDM_Enable(PDM_Type *base, bool enable)

Enables/disables PDM interface.

Parameters:
  • base – PDM base pointer

  • enable – True means PDM interface is enabled, false means PDM interface is disabled.

static inline void PDM_EnableDebugMode(PDM_Type *base, bool enable)

Enables/disables debug mode for PDM. The PDM interface cannot enter debug mode once in Disable/Low Leakage or Low Power mode.

Parameters:
  • base – PDM base pointer

  • enable – True means PDM interface enter debug mode, false means PDM interface in normal mode.

static inline void PDM_EnableInDebugMode(PDM_Type *base, bool enable)

Enables/disables PDM interface in debug mode.

Parameters:
  • base – PDM base pointer

  • enable – True means PDM interface is enabled debug mode, false means PDM interface is disabled after after completing the current frame in debug mode.

static inline void PDM_EnterLowLeakageMode(PDM_Type *base, bool enable)

Enables/disables PDM interface disable/Low Leakage mode.

Parameters:
  • base – PDM base pointer

  • enable – True means PDM interface is in disable/low leakage mode, False means PDM interface is in normal mode.

static inline void PDM_EnableChannel(PDM_Type *base, uint8_t channel, bool enable)

Enables/disables the PDM channel.

Parameters:
  • base – PDM base pointer

  • channel – PDM channel number need to enable or disable.

  • enable – True means enable PDM channel, false means disable.

void PDM_SetChannelConfig(PDM_Type *base, uint32_t channel, const pdm_channel_config_t *config)

PDM one channel configurations.

Parameters:
  • base – PDM base pointer

  • config – PDM channel configurations.

  • channel – channel number. after completing the current frame in debug mode.

status_t PDM_SetSampleRateConfig(PDM_Type *base, uint32_t sourceClock_HZ, uint32_t sampleRate_HZ)

PDM set sample rate.

Note

This function is depend on the configuration of the PDM and PDM channel, so the correct call sequence is

PDM_Init(base, pdmConfig)
PDM_SetChannelConfig(base, channel, &channelConfig)
PDM_SetSampleRateConfig(base, source, sampleRate)

Parameters:
  • base – PDM base pointer

  • sourceClock_HZ – PDM source clock frequency.

  • sampleRate_HZ – PDM sample rate.

status_t PDM_SetSampleRate(PDM_Type *base, uint32_t enableChannelMask, pdm_df_quality_mode_t qualityMode, uint8_t osr, uint32_t clkDiv)

PDM set sample rate.

Deprecated:

Do not use this function. It has been superceded by PDM_SetSampleRateConfig

Parameters:
  • base – PDM base pointer

  • enableChannelMask – PDM channel enable mask.

  • qualityMode – quality mode.

  • osr – cic oversample rate

  • clkDiv – clock divider

uint32_t PDM_GetInstance(PDM_Type *base)

Get the instance number for PDM.

Parameters:
  • base – PDM base pointer.

static inline uint32_t PDM_GetStatus(PDM_Type *base)

Gets the PDM internal status flag. Use the Status Mask in _pdm_internal_status to get the status value needed.

Parameters:
  • base – PDM base pointer

Returns:

PDM status flag value.

static inline uint32_t PDM_GetFifoStatus(PDM_Type *base)

Gets the PDM FIFO status flag. Use the Status Mask in _pdm_fifo_status to get the status value needed.

Parameters:
  • base – PDM base pointer

Returns:

FIFO status.

static inline uint32_t PDM_GetRangeStatus(PDM_Type *base)

Gets the PDM Range status flag. Use the Status Mask in _pdm_range_status to get the status value needed.

Parameters:
  • base – PDM base pointer

Returns:

output status.

static inline void PDM_ClearStatus(PDM_Type *base, uint32_t mask)

Clears the PDM Tx status.

Parameters:
  • base – PDM base pointer

  • mask – State mask. It can be a combination of the status between kPDM_StatusFrequencyLow and kPDM_StatusCh7FifoDataAvaliable.

static inline void PDM_ClearFIFOStatus(PDM_Type *base, uint32_t mask)

Clears the PDM Tx status.

Parameters:
  • base – PDM base pointer

  • mask – State mask.It can be a combination of the status in _pdm_fifo_status.

static inline void PDM_ClearRangeStatus(PDM_Type *base, uint32_t mask)

Clears the PDM range status.

Parameters:
  • base – PDM base pointer

  • mask – State mask. It can be a combination of the status in _pdm_range_status.

void PDM_EnableInterrupts(PDM_Type *base, uint32_t mask)

Enables the PDM interrupt requests.

Parameters:
  • base – PDM base pointer

  • mask – interrupt source The parameter can be a combination of the following sources if defined.

    • kPDM_ErrorInterruptEnable

    • kPDM_FIFOInterruptEnable

static inline void PDM_DisableInterrupts(PDM_Type *base, uint32_t mask)

Disables the PDM interrupt requests.

Parameters:
  • base – PDM base pointer

  • mask – interrupt source The parameter can be a combination of the following sources if defined.

    • kPDM_ErrorInterruptEnable

    • kPDM_FIFOInterruptEnable

static inline void PDM_EnableDMA(PDM_Type *base, bool enable)

Enables/disables the PDM DMA requests.

Parameters:
  • base – PDM base pointer

  • enable – True means enable DMA, false means disable DMA.

static inline uint32_t PDM_GetDataRegisterAddress(PDM_Type *base, uint32_t channel)

Gets the PDM data register address.

This API is used to provide a transfer address for the PDM DMA transfer configuration.

Parameters:
  • base – PDM base pointer.

  • channel – Which data channel used.

Returns:

data register address.

void PDM_ReadFifo(PDM_Type *base, uint32_t startChannel, uint32_t channelNums, void *buffer, size_t size, uint32_t dataWidth)

PDM read fifo.

Note

: This function support 16 bit only for IP version that only supports 16bit.

Parameters:
  • base – PDM base pointer.

  • startChannel – start channel number.

  • channelNums – total enabled channelnums.

  • buffer – received buffer address.

  • size – number of samples to read.

  • dataWidth – sample width.

void PDM_SetChannelGain(PDM_Type *base, uint32_t channel, pdm_df_output_gain_t gain)

Set the PDM channel gain.

Please note for different quality mode, the valid gain value is different, reference RM for detail.

Parameters:
  • base – PDM base pointer.

  • channel – PDM channel index.

  • gain – channel gain, the register gain value range is 0 - 15.

void PDM_SetHwvadConfig(PDM_Type *base, const pdm_hwvad_config_t *config)

Configure voice activity detector.

Parameters:
  • base – PDM base pointer

  • config – Voice activity detector configure structure pointer .

static inline void PDM_ForceHwvadOutputDisable(PDM_Type *base, bool enable)

PDM hwvad force output disable.

Parameters:
  • base – PDM base pointer

  • enable – true is output force disable, false is output not force.

static inline void PDM_ResetHwvad(PDM_Type *base)

PDM hwvad reset. It will reset VADNDATA register and will clean all internal buffers, should be called when the PDM isn’t running.

Parameters:
  • base – PDM base pointer

static inline void PDM_EnableHwvad(PDM_Type *base, bool enable)

Enable/Disable Voice activity detector. Should be called when the PDM isn’t running.

Parameters:
  • base – PDM base pointer.

  • enable – True means enable voice activity detector, false means disable.

static inline void PDM_EnableHwvadInterrupts(PDM_Type *base, uint32_t mask)

Enables the PDM Voice Detector interrupt requests.

Parameters:
  • base – PDM base pointer

  • mask – interrupt source The parameter can be a combination of the following sources if defined.

    • kPDM_HWVADErrorInterruptEnable

    • kPDM_HWVADInterruptEnable

static inline void PDM_DisableHwvadInterrupts(PDM_Type *base, uint32_t mask)

Disables the PDM Voice Detector interrupt requests.

Parameters:
  • base – PDM base pointer

  • mask – interrupt source The parameter can be a combination of the following sources if defined.

    • kPDM_HWVADErrorInterruptEnable

    • kPDM_HWVADInterruptEnable

static inline void PDM_ClearHwvadInterruptStatusFlags(PDM_Type *base, uint32_t mask)

Clears the PDM voice activity detector status flags.

Parameters:
  • base – PDM base pointer

  • mask – State mask,reference _pdm_hwvad_int_status.

static inline uint32_t PDM_GetHwvadInterruptStatusFlags(PDM_Type *base)

Clears the PDM voice activity detector status flags.

Parameters:
  • base – PDM base pointer

Returns:

status, reference _pdm_hwvad_int_status

static inline uint32_t PDM_GetHwvadInitialFlag(PDM_Type *base)

Get the PDM voice activity detector initial flags.

Parameters:
  • base – PDM base pointer

Returns:

initial flag.

static inline void PDM_EnableHwvadSignalFilter(PDM_Type *base, bool enable)

Enables/disables voice activity detector signal filter.

Parameters:
  • base – PDM base pointer

  • enable – True means enable signal filter, false means disable.

void PDM_SetHwvadSignalFilterConfig(PDM_Type *base, bool enableMaxBlock, uint32_t signalGain)

Configure voice activity detector signal filter.

Parameters:
  • base – PDM base pointer

  • enableMaxBlock – If signal maximum block enabled.

  • signalGain – Gain value for the signal energy.

void PDM_SetHwvadNoiseFilterConfig(PDM_Type *base, const pdm_hwvad_noise_filter_t *config)

Configure voice activity detector noise filter.

Parameters:
  • base – PDM base pointer

  • config – Voice activity detector noise filter configure structure pointer .

static inline void PDM_EnableHwvadZeroCrossDetector(PDM_Type *base, bool enable)

Enables/disables voice activity detector zero cross detector.

Parameters:
  • base – PDM base pointer

  • enable – True means enable zero cross detector, false means disable.

void PDM_SetHwvadZeroCrossDetectorConfig(PDM_Type *base, const pdm_hwvad_zero_cross_detector_t *config)

Configure voice activity detector zero cross detector.

Parameters:
  • base – PDM base pointer

  • config – Voice activity detector zero cross detector configure structure pointer .

static inline uint16_t PDM_GetNoiseData(PDM_Type *base)

Reads noise data.

Parameters:
  • base – PDM base pointer.

Returns:

Data in PDM noise data register.

static inline void PDM_SetHwvadInternalFilterStatus(PDM_Type *base, pdm_hwvad_filter_status_t status)

set hwvad internal filter status . Note: filter initial status should be asserted for two more cycles, then set it to normal operation.

Parameters:
  • base – PDM base pointer.

  • status – internal filter status.

void PDM_SetHwvadInEnvelopeBasedMode(PDM_Type *base, const pdm_hwvad_config_t *hwvadConfig, const pdm_hwvad_noise_filter_t *noiseConfig, const pdm_hwvad_zero_cross_detector_t *zcdConfig, uint32_t signalGain)

set HWVAD in envelope based mode . Recommand configurations,

   static const pdm_hwvad_config_t hwvadConfig = {
     .channel           = 0,
     .initializeTime    = 10U,
     .cicOverSampleRate = 0U,
     .inputGain         = 0U,
     .frameTime         = 10U,
     .cutOffFreq        = kPDM_HwvadHpfBypassed,
     .enableFrameEnergy = false,
     .enablePreFilter   = true,
};

   static const pdm_hwvad_noise_filter_t noiseFilterConfig = {
     .enableAutoNoiseFilter = false,
     .enableNoiseMin        = true,
     .enableNoiseDecimation = true,
     .noiseFilterAdjustment = 0U,
     .noiseGain             = 7U,
     .enableNoiseDetectOR   = true,
   };

Parameters:
  • base – PDM base pointer.

  • hwvadConfig – internal filter status.

  • noiseConfig – Voice activity detector noise filter configure structure pointer.

  • zcdConfig – Voice activity detector zero cross detector configure structure pointer .

  • signalGain – signal gain value.

void PDM_SetHwvadInEnergyBasedMode(PDM_Type *base, const pdm_hwvad_config_t *hwvadConfig, const pdm_hwvad_noise_filter_t *noiseConfig, const pdm_hwvad_zero_cross_detector_t *zcdConfig, uint32_t signalGain)

brief set HWVAD in energy based mode . Recommand configurations, code static const pdm_hwvad_config_t hwvadConfig = { .channel = 0, .initializeTime = 10U, .cicOverSampleRate = 0U, .inputGain = 0U, .frameTime = 10U, .cutOffFreq = kPDM_HwvadHpfBypassed, .enableFrameEnergy = true, .enablePreFilter = true, };

static const pdm_hwvad_noise_filter_t noiseFilterConfig = { .enableAutoNoiseFilter = true, .enableNoiseMin = false, .enableNoiseDecimation = false, .noiseFilterAdjustment = 0U, .noiseGain = 7U, .enableNoiseDetectOR = false, }; code param base PDM base pointer. param hwvadConfig internal filter status. param noiseConfig Voice activity detector noise filter configure structure pointer. param zcdConfig Voice activity detector zero cross detector configure structure pointer . param signalGain signal gain value, signal gain value should be properly according to application.

void PDM_EnableHwvadInterruptCallback(PDM_Type *base, pdm_hwvad_callback_t vadCallback, void *userData, bool enable)

Enable/Disable hwvad callback.

This function enable/disable the hwvad interrupt for the selected PDM peripheral.

Parameters:
  • base – Base address of the PDM peripheral.

  • vadCallback – callback Pointer to store callback function, should be NULL when disable.

  • userData – user data.

  • enable – true is enable, false is disable.

Return values:

None.

void PDM_TransferCreateHandle(PDM_Type *base, pdm_handle_t *handle, pdm_transfer_callback_t callback, void *userData)

Initializes the PDM handle.

This function initializes the handle for the PDM transactional APIs. Call this function once to get the handle initialized.

Parameters:
  • base – PDM base pointer.

  • handle – PDM handle pointer.

  • callback – Pointer to the user callback function.

  • userData – User parameter passed to the callback function.

status_t PDM_TransferSetChannelConfig(PDM_Type *base, pdm_handle_t *handle, uint32_t channel, const pdm_channel_config_t *config, uint32_t format)

PDM set channel transfer config.

Parameters:
  • base – PDM base pointer.

  • handle – PDM handle pointer.

  • channel – PDM channel.

  • config – channel config.

  • format – data format, support data width configurations,_pdm_data_width.

Return values:

kStatus_PDM_ChannelConfig_Failed – or kStatus_Success.

status_t PDM_TransferReceiveNonBlocking(PDM_Type *base, pdm_handle_t *handle, pdm_transfer_t *xfer)

Performs an interrupt non-blocking receive transfer on PDM.

Note

This API returns immediately after the transfer initiates. Call the PDM_RxGetTransferStatusIRQ to poll the transfer status and check whether the transfer is finished. If the return status is not kStatus_PDM_Busy, the transfer is finished.

Parameters:
  • base – PDM base pointer

  • handle – Pointer to the pdm_handle_t structure which stores the transfer state.

  • xfer – Pointer to the pdm_transfer_t structure.

Return values:
  • kStatus_Success – Successfully started the data receive.

  • kStatus_PDM_Busy – Previous receive still not finished.

void PDM_TransferAbortReceive(PDM_Type *base, pdm_handle_t *handle)

Aborts the current IRQ receive.

Note

This API can be called when an interrupt non-blocking transfer initiates to abort the transfer early.

Parameters:
  • base – PDM base pointer

  • handle – Pointer to the pdm_handle_t structure which stores the transfer state.

void PDM_TransferHandleIRQ(PDM_Type *base, pdm_handle_t *handle)

Tx interrupt handler.

Parameters:
  • base – PDM base pointer.

  • handle – Pointer to the pdm_handle_t structure.

FSL_PDM_DRIVER_VERSION

Version 2.9.1

PDM return status.

Values:

enumerator kStatus_PDM_Busy

PDM is busy.

enumerator kStatus_PDM_CLK_LOW

PDM clock frequency low

enumerator kStatus_PDM_FIFO_ERROR

PDM FIFO underrun or overflow

enumerator kStatus_PDM_QueueFull

PDM FIFO underrun or overflow

enumerator kStatus_PDM_Idle

PDM is idle

enumerator kStatus_PDM_Output_ERROR

PDM is output error

enumerator kStatus_PDM_ChannelConfig_Failed

PDM channel config failed

enumerator kStatus_PDM_HWVAD_VoiceDetected

PDM hwvad voice detected

enumerator kStatus_PDM_HWVAD_Error

PDM hwvad error

enum _pdm_interrupt_enable

The PDM interrupt enable flag.

Values:

enumerator kPDM_ErrorInterruptEnable

PDM channel error interrupt enable.

enumerator kPDM_FIFOInterruptEnable

PDM channel FIFO interrupt

enum _pdm_internal_status

The PDM status.

Values:

enumerator kPDM_StatusDfBusyFlag

Decimation filter is busy processing data

enumerator kPDM_StatusFrequencyLow

Mic app clock frequency not high enough

enumerator kPDM_StatusCh0FifoDataAvaliable

channel 0 fifo data reached watermark level

enumerator kPDM_StatusCh1FifoDataAvaliable

channel 1 fifo data reached watermark level

enumerator kPDM_StatusCh2FifoDataAvaliable

channel 2 fifo data reached watermark level

enumerator kPDM_StatusCh3FifoDataAvaliable

channel 3 fifo data reached watermark level

enum _pdm_channel_enable_mask

PDM channel enable mask.

Values:

enumerator kPDM_EnableChannel0

channgel 0 enable mask

enumerator kPDM_EnableChannel1

channgel 1 enable mask

enumerator kPDM_EnableChannel2

channgel 2 enable mask

enumerator kPDM_EnableChannel3

channgel 3 enable mask

enumerator kPDM_EnableChannelAll
enum _pdm_fifo_status

The PDM fifo status.

Values:

enumerator kPDM_FifoStatusUnderflowCh0

channel0 fifo status underflow

enumerator kPDM_FifoStatusUnderflowCh1

channel1 fifo status underflow

enumerator kPDM_FifoStatusUnderflowCh2

channel2 fifo status underflow

enumerator kPDM_FifoStatusUnderflowCh3

channel3 fifo status underflow

enumerator kPDM_FifoStatusOverflowCh0

channel0 fifo status overflow

enumerator kPDM_FifoStatusOverflowCh1

channel1 fifo status overflow

enumerator kPDM_FifoStatusOverflowCh2

channel2 fifo status overflow

enumerator kPDM_FifoStatusOverflowCh3

channel3 fifo status overflow

enum _pdm_range_status

The PDM output status.

Values:

enumerator kPDM_RangeStatusUnderFlowCh0

channel0 range status underflow

enumerator kPDM_RangeStatusUnderFlowCh1

channel1 range status underflow

enumerator kPDM_RangeStatusUnderFlowCh2

channel2 range status underflow

enumerator kPDM_RangeStatusUnderFlowCh3

channel3 range status underflow

enumerator kPDM_RangeStatusOverFlowCh0

channel0 range status overflow

enumerator kPDM_RangeStatusOverFlowCh1

channel1 range status overflow

enumerator kPDM_RangeStatusOverFlowCh2

channel2 range status overflow

enumerator kPDM_RangeStatusOverFlowCh3

channel3 range status overflow

enum _pdm_dc_remover

PDM DC remover configurations.

Values:

enumerator kPDM_DcRemoverCutOff20Hz

DC remover cut off 20HZ

enumerator kPDM_DcRemoverCutOff13Hz

DC remover cut off 13.3HZ

enumerator kPDM_DcRemoverCutOff40Hz

DC remover cut off 40HZ

enumerator kPDM_DcRemoverBypass

DC remover bypass

enum _pdm_df_quality_mode

PDM decimation filter quality mode.

Values:

enumerator kPDM_QualityModeMedium

quality mode memdium

enumerator kPDM_QualityModeHigh

quality mode high

enumerator kPDM_QualityModeLow

quality mode low

enumerator kPDM_QualityModeVeryLow0

quality mode very low0

enumerator kPDM_QualityModeVeryLow1

quality mode very low1

enumerator kPDM_QualityModeVeryLow2

quality mode very low2

enum _pdm_qulaity_mode_k_factor

PDM quality mode K factor.

Values:

enumerator kPDM_QualityModeHighKFactor

high quality mode K factor = 1 / 2

enumerator kPDM_QualityModeMediumKFactor

medium/very low0 quality mode K factor = 2 / 2

enumerator kPDM_QualityModeLowKFactor

low/very low1 quality mode K factor = 4 / 2

enumerator kPDM_QualityModeVeryLow2KFactor

very low2 quality mode K factor = 8 / 2

enum _pdm_df_output_gain

PDM decimation filter output gain.

Values:

enumerator kPDM_DfOutputGain0

Decimation filter output gain 0

enumerator kPDM_DfOutputGain1

Decimation filter output gain 1

enumerator kPDM_DfOutputGain2

Decimation filter output gain 2

enumerator kPDM_DfOutputGain3

Decimation filter output gain 3

enumerator kPDM_DfOutputGain4

Decimation filter output gain 4

enumerator kPDM_DfOutputGain5

Decimation filter output gain 5

enumerator kPDM_DfOutputGain6

Decimation filter output gain 6

enumerator kPDM_DfOutputGain7

Decimation filter output gain 7

enumerator kPDM_DfOutputGain8

Decimation filter output gain 8

enumerator kPDM_DfOutputGain9

Decimation filter output gain 9

enumerator kPDM_DfOutputGain10

Decimation filter output gain 10

enumerator kPDM_DfOutputGain11

Decimation filter output gain 11

enumerator kPDM_DfOutputGain12

Decimation filter output gain 12

enumerator kPDM_DfOutputGain13

Decimation filter output gain 13

enumerator kPDM_DfOutputGain14

Decimation filter output gain 14

enumerator kPDM_DfOutputGain15

Decimation filter output gain 15

enum _pdm_data_width

PDM data width.

Values:

enumerator kPDM_DataWwidth24

PDM data width 24bit

enumerator kPDM_DataWwidth32

PDM data width 32bit

enum _pdm_hwvad_interrupt_enable

PDM voice activity detector interrupt type.

Values:

enumerator kPDM_HwvadErrorInterruptEnable

PDM channel HWVAD error interrupt enable.

enumerator kPDM_HwvadInterruptEnable

PDM channel HWVAD interrupt

enum _pdm_hwvad_int_status

The PDM hwvad interrupt status flag.

Values:

enumerator kPDM_HwvadStatusInputSaturation

HWVAD saturation condition

enumerator kPDM_HwvadStatusVoiceDetectFlag

HWVAD voice detect interrupt triggered

enum _pdm_hwvad_hpf_config

High pass filter configure cut-off frequency.

Values:

enumerator kPDM_HwvadHpfBypassed

High-pass filter bypass

enumerator kPDM_HwvadHpfCutOffFreq1750Hz

High-pass filter cut off frequency 1750HZ

enumerator kPDM_HwvadHpfCutOffFreq215Hz

High-pass filter cut off frequency 215HZ

enumerator kPDM_HwvadHpfCutOffFreq102Hz

High-pass filter cut off frequency 102HZ

enum _pdm_hwvad_filter_status

HWVAD internal filter status.

Values:

enumerator kPDM_HwvadInternalFilterNormalOperation

internal filter ready for normal operation

enumerator kPDM_HwvadInternalFilterInitial

interla filter are initial

enum _pdm_hwvad_zcd_result

PDM voice activity detector zero cross detector result.

Values:

enumerator kPDM_HwvadResultOREnergyBasedDetection

zero cross detector result will be OR with energy based detection

enumerator kPDM_HwvadResultANDEnergyBasedDetection

zero cross detector result will be AND with energy based detection

typedef enum _pdm_dc_remover pdm_dc_remover_t

PDM DC remover configurations.

typedef enum _pdm_df_quality_mode pdm_df_quality_mode_t

PDM decimation filter quality mode.

typedef enum _pdm_df_output_gain pdm_df_output_gain_t

PDM decimation filter output gain.

typedef struct _pdm_channel_config pdm_channel_config_t

PDM channel configurations.

typedef struct _pdm_config pdm_config_t

PDM user configuration structure.

typedef enum _pdm_hwvad_hpf_config pdm_hwvad_hpf_config_t

High pass filter configure cut-off frequency.

typedef enum _pdm_hwvad_filter_status pdm_hwvad_filter_status_t

HWVAD internal filter status.

typedef struct _pdm_hwvad_config pdm_hwvad_config_t

PDM voice activity detector user configuration structure.

typedef struct _pdm_hwvad_noise_filter pdm_hwvad_noise_filter_t

PDM voice activity detector noise filter user configuration structure.

typedef enum _pdm_hwvad_zcd_result pdm_hwvad_zcd_result_t

PDM voice activity detector zero cross detector result.

typedef struct _pdm_hwvad_zero_cross_detector pdm_hwvad_zero_cross_detector_t

PDM voice activity detector zero cross detector configuration structure.

typedef struct _pdm_transfer pdm_transfer_t

PDM SDMA transfer structure.

typedef struct _pdm_handle pdm_handle_t

PDM handle.

typedef void (*pdm_transfer_callback_t)(PDM_Type *base, pdm_handle_t *handle, status_t status, void *userData)

PDM transfer callback prototype.

typedef void (*pdm_hwvad_callback_t)(status_t status, void *userData)

PDM HWVAD callback prototype.

typedef struct _pdm_hwvad_notification pdm_hwvad_notification_t

PDM HWVAD notification structure.

PDM_XFER_QUEUE_SIZE

PDM XFER QUEUE SIZE.

struct _pdm_channel_config
#include <fsl_pdm.h>

PDM channel configurations.

Public Members

pdm_dc_remover_t outputCutOffFreq

PDM output DC remover cut off frequency

pdm_df_output_gain_t gain

Decimation Filter Output Gain

struct _pdm_config
#include <fsl_pdm.h>

PDM user configuration structure.

Public Members

bool enableDoze

This module will enter disable/low leakage mode if DOZEN is active with ipg_doze is asserted

bool enableFilterBypass

Switchable bypass path for the decimation filter

uint8_t fifoWatermark

Watermark value for FIFO

pdm_df_quality_mode_t qualityMode

Quality mode

uint8_t cicOverSampleRate

CIC filter over sampling rate

struct _pdm_hwvad_config
#include <fsl_pdm.h>

PDM voice activity detector user configuration structure.

Public Members

uint8_t channel

Which channel uses voice activity detector

uint8_t initializeTime

Number of frames or samples to initialize voice activity detector.

uint8_t cicOverSampleRate

CIC filter over sampling rate

uint8_t inputGain

Voice activity detector input gain

uint32_t frameTime

Voice activity frame time

pdm_hwvad_hpf_config_t cutOffFreq

High pass filter cut off frequency

bool enableFrameEnergy

If frame energy enabled, true means enable

bool enablePreFilter

If pre-filter enabled

struct _pdm_hwvad_noise_filter
#include <fsl_pdm.h>

PDM voice activity detector noise filter user configuration structure.

Public Members

bool enableAutoNoiseFilter

If noise fileter automatically activated, true means enable

bool enableNoiseMin

If Noise minimum block enabled, true means enabled

bool enableNoiseDecimation

If enable noise input decimation

bool enableNoiseDetectOR

Enables a OR logic in the output of minimum noise estimator block

uint32_t noiseFilterAdjustment

The adjustment value of the noise filter

uint32_t noiseGain

Gain value for the noise energy or envelope estimated

struct _pdm_hwvad_zero_cross_detector
#include <fsl_pdm.h>

PDM voice activity detector zero cross detector configuration structure.

Public Members

bool enableAutoThreshold

If ZCD auto-threshold enabled, true means enabled.

pdm_hwvad_zcd_result_t zcdAnd

Is ZCD result is AND’ed with energy-based detection, false means OR’ed

uint32_t threshold

The adjustment value of the noise filter

uint32_t adjustmentThreshold

Gain value for the noise energy or envelope estimated

struct _pdm_transfer
#include <fsl_pdm.h>

PDM SDMA transfer structure.

Public Members

volatile uint8_t *data

Data start address to transfer.

volatile size_t dataSize

Total Transfer bytes size.

struct _pdm_hwvad_notification
#include <fsl_pdm.h>

PDM HWVAD notification structure.

struct _pdm_handle
#include <fsl_pdm.h>

PDM handle structure.

Public Members

uint32_t state

Transfer status

pdm_transfer_callback_t callback

Callback function called at transfer event

void *userData

Callback parameter passed to callback function

pdm_transfer_t pdmQueue[(4U)]

Transfer queue storing queued transfer

size_t transferSize[(4U)]

Data bytes need to transfer

volatile uint8_t queueUser

Index for user to queue transfer

volatile uint8_t queueDriver

Index for driver to get the transfer data and size

uint32_t format

data format

uint8_t watermark

Watermark value

uint8_t startChannel

end channel

uint8_t channelNums

Enabled channel number

PDM EDMA Driver

void PDM_TransferInstallEDMATCDMemory(pdm_edma_handle_t *handle, void *tcdAddr, size_t tcdNum)

Install EDMA descriptor memory.

Parameters:
  • handle – Pointer to EDMA channel transfer handle.

  • tcdAddr – EDMA head descriptor address.

  • tcdNum – EDMA link descriptor address.

void PDM_TransferCreateHandleEDMA(PDM_Type *base, pdm_edma_handle_t *handle, pdm_edma_callback_t callback, void *userData, edma_handle_t *dmaHandle)

Initializes the PDM Rx eDMA handle.

This function initializes the PDM slave DMA handle, which can be used for other PDM master transactional APIs. Usually, for a specified PDM instance, call this API once to get the initialized handle.

Parameters:
  • base – PDM base pointer.

  • handle – PDM eDMA handle pointer.

  • callback – Pointer to user callback function.

  • userData – User parameter passed to the callback function.

  • dmaHandle – eDMA handle pointer, this handle shall be static allocated by users.

void PDM_TransferSetMultiChannelInterleaveType(pdm_edma_handle_t *handle, pdm_edma_multi_channel_interleave_t multiChannelInterleaveType)

Initializes the multi PDM channel interleave type.

This function initializes the PDM DMA handle member interleaveType, it shall be called only when application would like to use type kPDM_EDMAMultiChannelInterleavePerChannelBlock, since the default interleaveType is kPDM_EDMAMultiChannelInterleavePerChannelSample always

Parameters:
  • handle – PDM eDMA handle pointer.

  • multiChannelInterleaveType – Multi channel interleave type.

void PDM_TransferSetChannelConfigEDMA(PDM_Type *base, pdm_edma_handle_t *handle, uint32_t channel, const pdm_channel_config_t *config)

Configures the PDM channel.

Parameters:
  • base – PDM base pointer.

  • handle – PDM eDMA handle pointer.

  • channel – channel index.

  • config – pdm channel configurations.

status_t PDM_TransferReceiveEDMA(PDM_Type *base, pdm_edma_handle_t *handle, pdm_edma_transfer_t *xfer)

Performs a non-blocking PDM receive using eDMA.

Mcaro MCUX_SDK_PDM_EDMA_PDM_ENABLE_INTERNAL can control whether PDM is enabled internally or externally.

  1. Scatter gather case: This functio support dynamic scatter gather and staic scatter gather, a. for the dynamic scatter gather case: Application should call PDM_TransferReceiveEDMA function continuously to make sure new receive request is submit before the previous one finish. b. for the static scatter gather case: Application should use the link transfer feature and make sure a loop link transfer is provided, such as:

    pdm_edma_transfer_t pdmXfer[2] =
     {
         {
         .data  = s_buffer,
         .dataSize = BUFFER_SIZE,
         .linkTransfer = &pdmXfer[1],
         },
    
         {
         .data  = &s_buffer[BUFFER_SIZE],
         .dataSize = BUFFER_SIZE,
         .linkTransfer = &pdmXfer[0]
         },
     };
    

  2. Multi channel case: This function support receive multi pdm channel data, for example, if two channel is requested,

    PDM_TransferSetChannelConfigEDMA(DEMO_PDM, &s_pdmRxHandle_0, DEMO_PDM_ENABLE_CHANNEL_0, &channelConfig);
    PDM_TransferSetChannelConfigEDMA(DEMO_PDM, &s_pdmRxHandle_0, DEMO_PDM_ENABLE_CHANNEL_1, &channelConfig);
    PDM_TransferReceiveEDMA(DEMO_PDM, &s_pdmRxHandle_0, pdmXfer);
    
    The output data will be formatted as below if handle->interleaveType =

Note

This interface returns immediately after the transfer initiates. Call the PDM_GetReceiveRemainingBytes to poll the transfer status and check whether the PDM transfer is finished.

void PDM_TransferTerminateReceiveEDMA(PDM_Type *base, pdm_edma_handle_t *handle)

Terminate all PDM receive.

This function will clear all transfer slots buffered in the pdm queue. If users only want to abort the current transfer slot, please call PDM_TransferAbortReceiveEDMA.

Parameters:
  • base – PDM base pointer.

  • handle – PDM eDMA handle pointer.

void PDM_TransferAbortReceiveEDMA(PDM_Type *base, pdm_edma_handle_t *handle)

Aborts a PDM receive using eDMA.

This function only aborts the current transfer slots, the other transfer slots’ information still kept in the handler. If users want to terminate all transfer slots, just call PDM_TransferTerminateReceiveEDMA.

Parameters:
  • base – PDM base pointer

  • handle – PDM eDMA handle pointer.

status_t PDM_TransferGetReceiveCountEDMA(PDM_Type *base, pdm_edma_handle_t *handle, size_t *count)

Gets byte count received by PDM.

Parameters:
  • base – PDM base pointer

  • handle – PDM eDMA handle pointer.

  • count – Bytes count received by PDM.

Return values:
  • kStatus_Success – Succeed get the transfer count.

  • kStatus_NoTransferInProgress – There is no non-blocking transaction in progress.

FSL_PDM_EDMA_DRIVER_VERSION

Version 2.6.3

enum _pdm_edma_multi_channel_interleave

pdm multi channel interleave type

Values:

enumerator kPDM_EDMAMultiChannelInterleavePerChannelSample
enumerator kPDM_EDMAMultiChannelInterleavePerChannelBlock
typedef struct _pdm_edma_handle pdm_edma_handle_t

PDM edma handler.

typedef enum _pdm_edma_multi_channel_interleave pdm_edma_multi_channel_interleave_t

pdm multi channel interleave type

typedef struct _pdm_edma_transfer pdm_edma_transfer_t

PDM edma transfer.

typedef void (*pdm_edma_callback_t)(PDM_Type *base, pdm_edma_handle_t *handle, status_t status, void *userData)

PDM eDMA transfer callback function for finish and error.

MCUX_SDK_PDM_EDMA_PDM_ENABLE_INTERNAL

the PDM enable position When calling PDM_TransferReceiveEDMA

struct _pdm_edma_transfer
#include <fsl_pdm_edma.h>

PDM edma transfer.

Public Members

volatile uint8_t *data

Data start address to transfer.

volatile size_t dataSize

Total Transfer bytes size.

struct _pdm_edma_transfer *linkTransfer

linked transfer configurations

struct _pdm_edma_handle
#include <fsl_pdm_edma.h>

PDM DMA transfer handle, users should not touch the content of the handle.

Public Members

edma_handle_t *dmaHandle

DMA handler for PDM send

uint8_t count

The transfer data count in a DMA request

uint32_t receivedBytes

total transfer count

uint32_t state

Internal state for PDM eDMA transfer

pdm_edma_callback_t callback

Callback for users while transfer finish or error occurs

bool isLoopTransfer

loop transfer

void *userData

User callback parameter

edma_tcd_t *tcd

TCD pool for eDMA transfer.

uint32_t tcdNum

TCD number

uint32_t tcdUser

Index for user to queue transfer.

uint32_t tcdDriver

Index for driver to get the transfer data and size

volatile uint32_t tcdUsedNum

Index for user to queue transfer.

pdm_edma_multi_channel_interleave_t interleaveType

multi channel transfer interleave type

uint8_t endChannel

The last enabled channel

uint8_t channelNums

total channel numbers

PINT: Pin Interrupt and Pattern Match Driver

FSL_PINT_DRIVER_VERSION
enum _pint_pin_enable

PINT Pin Interrupt enable type.

Values:

enumerator kPINT_PinIntEnableNone

Do not generate Pin Interrupt

enumerator kPINT_PinIntEnableRiseEdge

Generate Pin Interrupt on rising edge

enumerator kPINT_PinIntEnableFallEdge

Generate Pin Interrupt on falling edge

enumerator kPINT_PinIntEnableBothEdges

Generate Pin Interrupt on both edges

enumerator kPINT_PinIntEnableLowLevel

Generate Pin Interrupt on low level

enumerator kPINT_PinIntEnableHighLevel

Generate Pin Interrupt on high level

enum _pint_int

PINT Pin Interrupt type.

Values:

enumerator kPINT_PinInt0

Pin Interrupt 0

enum _pint_pmatch_input_src

PINT Pattern Match bit slice input source type.

Values:

enumerator kPINT_PatternMatchInp0Src

Input source 0

enumerator kPINT_PatternMatchInp1Src

Input source 1

enumerator kPINT_PatternMatchInp2Src

Input source 2

enumerator kPINT_PatternMatchInp3Src

Input source 3

enumerator kPINT_PatternMatchInp4Src

Input source 4

enumerator kPINT_PatternMatchInp5Src

Input source 5

enumerator kPINT_PatternMatchInp6Src

Input source 6

enumerator kPINT_PatternMatchInp7Src

Input source 7

enumerator kPINT_SecPatternMatchInp0Src

Input source 0

enumerator kPINT_SecPatternMatchInp1Src

Input source 1

enum _pint_pmatch_bslice

PINT Pattern Match bit slice type.

Values:

enumerator kPINT_PatternMatchBSlice0

Bit slice 0

enum _pint_pmatch_bslice_cfg

PINT Pattern Match configuration type.

Values:

enumerator kPINT_PatternMatchAlways

Always Contributes to product term match

enumerator kPINT_PatternMatchStickyRise

Sticky Rising edge

enumerator kPINT_PatternMatchStickyFall

Sticky Falling edge

enumerator kPINT_PatternMatchStickyBothEdges

Sticky Rising or Falling edge

enumerator kPINT_PatternMatchHigh

High level

enumerator kPINT_PatternMatchLow

Low level

enumerator kPINT_PatternMatchNever

Never contributes to product term match

enumerator kPINT_PatternMatchBothEdges

Either rising or falling edge

typedef enum _pint_pin_enable pint_pin_enable_t

PINT Pin Interrupt enable type.

typedef enum _pint_int pint_pin_int_t

PINT Pin Interrupt type.

typedef enum _pint_pmatch_input_src pint_pmatch_input_src_t

PINT Pattern Match bit slice input source type.

typedef enum _pint_pmatch_bslice pint_pmatch_bslice_t

PINT Pattern Match bit slice type.

typedef enum _pint_pmatch_bslice_cfg pint_pmatch_bslice_cfg_t

PINT Pattern Match configuration type.

typedef void (*pint_cb_t)(pint_pin_int_t pintr, uint32_t pmatch_status)

PINT Callback function.

typedef struct _pint_pmatch_cfg pint_pmatch_cfg_t
void PINT_Init(PINT_Type *base)

Initialize PINT peripheral.

This function initializes the PINT peripheral and enables the clock.

Parameters:
  • base – Base address of the PINT peripheral.

Return values:

None.

void PINT_PinInterruptConfig(PINT_Type *base, pint_pin_int_t intr, pint_pin_enable_t enable, pint_cb_t callback)

Configure PINT peripheral pin interrupt.

This function configures a given pin interrupt.

Parameters:
  • base – Base address of the PINT peripheral.

  • intr – Pin interrupt.

  • enable – Selects detection logic.

  • callback – Callback.

Return values:

None.

void PINT_PinInterruptGetConfig(PINT_Type *base, pint_pin_int_t pintr, pint_pin_enable_t *enable, pint_cb_t *callback)

Get PINT peripheral pin interrupt configuration.

This function returns the configuration of a given pin interrupt.

Parameters:
  • base – Base address of the PINT peripheral.

  • pintr – Pin interrupt.

  • enable – Pointer to store the detection logic.

  • callback – Callback.

Return values:

None.

void PINT_PinInterruptClrStatus(PINT_Type *base, pint_pin_int_t pintr)

Clear Selected pin interrupt status only when the pin was triggered by edge-sensitive.

This function clears the selected pin interrupt status.

Parameters:
  • base – Base address of the PINT peripheral.

  • pintr – Pin interrupt.

Return values:

None.

static inline uint32_t PINT_PinInterruptGetStatus(PINT_Type *base, pint_pin_int_t pintr)

Get Selected pin interrupt status.

This function returns the selected pin interrupt status.

Parameters:
  • base – Base address of the PINT peripheral.

  • pintr – Pin interrupt.

Return values:

status – = 0 No pin interrupt request. = 1 Selected Pin interrupt request active.

void PINT_PinInterruptClrStatusAll(PINT_Type *base)

Clear all pin interrupts status only when pins were triggered by edge-sensitive.

This function clears the status of all pin interrupts.

Parameters:
  • base – Base address of the PINT peripheral.

Return values:

None.

static inline uint32_t PINT_PinInterruptGetStatusAll(PINT_Type *base)

Get all pin interrupts status.

This function returns the status of all pin interrupts.

Parameters:
  • base – Base address of the PINT peripheral.

Return values:

status – Each bit position indicates the status of corresponding pin interrupt. = 0 No pin interrupt request. = 1 Pin interrupt request active.

static inline void PINT_PinInterruptClrFallFlag(PINT_Type *base, pint_pin_int_t pintr)

Clear Selected pin interrupt fall flag.

This function clears the selected pin interrupt fall flag.

Parameters:
  • base – Base address of the PINT peripheral.

  • pintr – Pin interrupt.

Return values:

None.

static inline uint32_t PINT_PinInterruptGetFallFlag(PINT_Type *base, pint_pin_int_t pintr)

Get selected pin interrupt fall flag.

This function returns the selected pin interrupt fall flag.

Parameters:
  • base – Base address of the PINT peripheral.

  • pintr – Pin interrupt.

Return values:

flag – = 0 Falling edge has not been detected. = 1 Falling edge has been detected.

static inline void PINT_PinInterruptClrFallFlagAll(PINT_Type *base)

Clear all pin interrupt fall flags.

This function clears the fall flag for all pin interrupts.

Parameters:
  • base – Base address of the PINT peripheral.

Return values:

None.

static inline uint32_t PINT_PinInterruptGetFallFlagAll(PINT_Type *base)

Get all pin interrupt fall flags.

This function returns the fall flag of all pin interrupts.

Parameters:
  • base – Base address of the PINT peripheral.

Return values:

flags – Each bit position indicates the falling edge detection of the corresponding pin interrupt. 0 Falling edge has not been detected. = 1 Falling edge has been detected.

static inline void PINT_PinInterruptClrRiseFlag(PINT_Type *base, pint_pin_int_t pintr)

Clear Selected pin interrupt rise flag.

This function clears the selected pin interrupt rise flag.

Parameters:
  • base – Base address of the PINT peripheral.

  • pintr – Pin interrupt.

Return values:

None.

static inline uint32_t PINT_PinInterruptGetRiseFlag(PINT_Type *base, pint_pin_int_t pintr)

Get selected pin interrupt rise flag.

This function returns the selected pin interrupt rise flag.

Parameters:
  • base – Base address of the PINT peripheral.

  • pintr – Pin interrupt.

Return values:

flag – = 0 Rising edge has not been detected. = 1 Rising edge has been detected.

static inline void PINT_PinInterruptClrRiseFlagAll(PINT_Type *base)

Clear all pin interrupt rise flags.

This function clears the rise flag for all pin interrupts.

Parameters:
  • base – Base address of the PINT peripheral.

Return values:

None.

static inline uint32_t PINT_PinInterruptGetRiseFlagAll(PINT_Type *base)

Get all pin interrupt rise flags.

This function returns the rise flag of all pin interrupts.

Parameters:
  • base – Base address of the PINT peripheral.

Return values:

flags – Each bit position indicates the rising edge detection of the corresponding pin interrupt. 0 Rising edge has not been detected. = 1 Rising edge has been detected.

void PINT_PatternMatchConfig(PINT_Type *base, pint_pmatch_bslice_t bslice, pint_pmatch_cfg_t *cfg)

Configure PINT pattern match.

This function configures a given pattern match bit slice.

Parameters:
  • base – Base address of the PINT peripheral.

  • bslice – Pattern match bit slice number.

  • cfg – Pointer to bit slice configuration.

Return values:

None.

void PINT_PatternMatchGetConfig(PINT_Type *base, pint_pmatch_bslice_t bslice, pint_pmatch_cfg_t *cfg)

Get PINT pattern match configuration.

This function returns the configuration of a given pattern match bit slice.

Parameters:
  • base – Base address of the PINT peripheral.

  • bslice – Pattern match bit slice number.

  • cfg – Pointer to bit slice configuration.

Return values:

None.

static inline uint32_t PINT_PatternMatchGetStatus(PINT_Type *base, pint_pmatch_bslice_t bslice)

Get pattern match bit slice status.

This function returns the status of selected bit slice.

Parameters:
  • base – Base address of the PINT peripheral.

  • bslice – Pattern match bit slice number.

Return values:

status – = 0 Match has not been detected. = 1 Match has been detected.

static inline uint32_t PINT_PatternMatchGetStatusAll(PINT_Type *base)

Get status of all pattern match bit slices.

This function returns the status of all bit slices.

Parameters:
  • base – Base address of the PINT peripheral.

Return values:

status – Each bit position indicates the match status of corresponding bit slice. = 0 Match has not been detected. = 1 Match has been detected.

uint32_t PINT_PatternMatchResetDetectLogic(PINT_Type *base)

Reset pattern match detection logic.

This function resets the pattern match detection logic if any of the product term is matching.

Parameters:
  • base – Base address of the PINT peripheral.

Return values:

pmstatus – Each bit position indicates the match status of corresponding bit slice. = 0 Match was detected. = 1 Match was not detected.

static inline void PINT_PatternMatchEnable(PINT_Type *base)

Enable pattern match function.

This function enables the pattern match function.

Parameters:
  • base – Base address of the PINT peripheral.

Return values:

None.

static inline void PINT_PatternMatchDisable(PINT_Type *base)

Disable pattern match function.

This function disables the pattern match function.

Parameters:
  • base – Base address of the PINT peripheral.

Return values:

None.

static inline void PINT_PatternMatchEnableRXEV(PINT_Type *base)

Enable RXEV output.

This function enables the pattern match RXEV output.

Parameters:
  • base – Base address of the PINT peripheral.

Return values:

None.

static inline void PINT_PatternMatchDisableRXEV(PINT_Type *base)

Disable RXEV output.

This function disables the pattern match RXEV output.

Parameters:
  • base – Base address of the PINT peripheral.

Return values:

None.

void PINT_EnableCallback(PINT_Type *base)

Enable callback.

This function enables the interrupt for the selected PINT peripheral. Although the pin(s) are monitored as soon as they are enabled, the callback function is not enabled until this function is called.

Parameters:
  • base – Base address of the PINT peripheral.

Return values:

None.

void PINT_DisableCallback(PINT_Type *base)

Disable callback.

This function disables the interrupt for the selected PINT peripheral. Although the pins are still being monitored but the callback function is not called.

Parameters:
  • base – Base address of the peripheral.

Return values:

None.

void PINT_Deinit(PINT_Type *base)

Deinitialize PINT peripheral.

This function disables the PINT clock.

Parameters:
  • base – Base address of the PINT peripheral.

Return values:

None.

void PINT_EnableCallbackByIndex(PINT_Type *base, pint_pin_int_t pintIdx)

enable callback by pin index.

This function enables callback by pin index instead of enabling all pins.

Parameters:
  • base – Base address of the peripheral.

  • pintIdx – pin index.

Return values:

None.

void PINT_DisableCallbackByIndex(PINT_Type *base, pint_pin_int_t pintIdx)

disable callback by pin index.

This function disables callback by pin index instead of disabling all pins.

Parameters:
  • base – Base address of the peripheral.

  • pintIdx – pin index.

Return values:

None.

PININT_BITSLICE_SRC_START
PININT_BITSLICE_SRC_MASK
PININT_BITSLICE_CFG_START
PININT_BITSLICE_CFG_MASK
PININT_BITSLICE_ENDP_MASK
PINT_PIN_INT_LEVEL
PINT_PIN_INT_EDGE
PINT_PIN_INT_FALL_OR_HIGH_LEVEL
PINT_PIN_INT_RISE
PINT_PIN_RISE_EDGE
PINT_PIN_FALL_EDGE
PINT_PIN_BOTH_EDGE
PINT_PIN_LOW_LEVEL
PINT_PIN_HIGH_LEVEL
struct _pint_pmatch_cfg
#include <fsl_pint.h>

PNGDEC: PNG decoder Driver

Error codes for the PNGDEC driver.

Values:

enumerator kStatus_PNGDEC_NotSupported

Interlace data chunk is not supported.

enumerator kStatus_PNGDEC_WidthTooLarge

The image width is larger than 1024.

enum _pngdec_interrupt_enable

Interrupt enable/disable mask.

Values:

enumerator kPNGDEC_ChecksumErrorFlag

ADLER-32 checksum error status and interrupt enable.

enumerator kPNGDEC_CrcErrorFlag

CRC error status and interrupt enable.

enumerator kPNGDEC_HeaderErrorFlag

Header error status and interrupt enable.

enumerator kPNGDEC_BtypeErrorFlag

B type error status and interrupt enable. TODO

enumerator kPNGDEC_ZlibHeaderErrorFlag

Zlib header error status and interrupt enable.

enumerator kPNGDEC_BitDepthErrorFlag

Bit depth error status and interrupt enable. Bit depth less than 8 bit not supported.

enumerator kPNGDEC_InterlaceErrorFlag

Interlace error status and interrupt enable. Interlace is not supported.

enumerator kPNGDEC_WidthErrorFlag

Width error status and interrupt enable. Max image width 1024.

enumerator kPNGDEC_EncodeDataDoneFlag

Data encoding done status and interrupt enable.

enumerator kPNGDEC_DecodePixelDoneFlag

Pixel data decoding done status and interrupt enable.

enumerator kPNGDEC_DecodeAncillaryDoneFlag

Ancillary data decoding done status and interrupt enable.

enumerator kPNGDEC_ErrorFlags
enum _pngdec_endian_mode

PNG decode endian mode.

Values:

enumerator kPNGDEC_LittleEndian

Little endian.

enumerator kPNGDEC_BigEndian

Big endian.

enum _pngdec_color_type

PNG color type.

Values:

enumerator kPNGDEC_PixelFormatY8

8-bit monochrome(gray scale).

enumerator kPNGDEC_PixelFormatYA88

16-bit monochrome(gray scale) with alpha.

enumerator kPNGDEC_PixelFormatRGB888

24-bit RGB true color, 8-bit each palette.

enumerator kPNGDEC_PixelFormatRGBA8888

32-bit RGBA true color with alpha, 8-bit each palette.

enumerator kPNGDEC_PixelFormatRGB16_16_16

48-bit RGB true color, 16-bit each palette.

enumerator kPNGDEC_PixelFormatRGBA16_16_16_16

64-bit RGBA true color with alpha, 16-bit each palette.

enumerator kPNGDEC_PixelFormatLUT8

8-bit Indexed Color.

typedef enum _pngdec_endian_mode pngdec_endian_mode_t

PNG decode endian mode.

typedef struct _pngdec_config pngdec_config_t

Configuration for PNGDEC.

typedef enum _pngdec_color_type pngdec_color_type_t

PNG color type.

typedef struct _pngdec_image pngdec_image_t

The decoded image info structure.

FSL_PNGDEC_DRIVER_VERSION

PNGDEC driver version 2.0.0.

void PNGDEC_Init(PNGDEC_Type *base, const pngdec_config_t *config)

Initializes the PNGDEC.

The default configuration can be got by calling PNGDEC_GetDefaultConfig().

Parameters:
  • base – PNGDEC peripheral base address.

  • config – Pointer to PNGDEC configuration structure.

void PNGDEC_Deinit(PNGDEC_Type *base)

Deinitializes the PNGDEC.

Parameters:
  • base – PNGDEC peripheral base address.

void PNGDEC_GetDefaultConfig(pngdec_config_t *config)

Gets the default configuration for PNGDEC.

This function initializes the user configuration structure to default value. The default value are:

Example:

config->enableAncillary = false;
config->enable = false;

Parameters:
  • config – Pointer to PNGDEC configuration structure.

static inline void PNGDEC_EnableInterrupts(PNGDEC_Type *base, uint32_t mask)

Enables interrupts.

Parameters:
  • base – PNGDEC peripheral base address.

  • mask – Interrupts mask. See “_pngdec_interrupt_enable”.

static inline void PNGDEC_DisableInterrupts(PNGDEC_Type *base, uint32_t mask)

Disables interrupts.

Parameters:
  • base – PNGDEC peripheral base address.

  • mask – Interrupts mask. See “_pngdec_interrupt_enable”.

static inline uint32_t PNGDEC_GetStatusFlags(PNGDEC_Type *base)

Gets status flags.

Parameters:
  • base – PNGDEC peripheral base address.

Returns:

Status flags asserted mask. See “_pngdec_status_flags”.

static inline void PNGDEC_ClearStatusFlags(PNGDEC_Type *base, uint32_t mask)

Clears status flags.

Parameters:
  • base – PNGDEC peripheral base address.

  • mask – Status flags mask. See “_pngdec_status_flags”.

static inline void PNGDEC_Reset(PNGDEC_Type *base)

Resets the PNGDEC code and DMA logic.

Parameters:
  • base – PNGDEC peripheral base address.

static inline void PNGDEC_Enable(PNGDEC_Type *base, bool enable)

Enables or disables the PNGDEC.

Parameters:
  • base – PNGDEC peripheral base address.

  • enable – True to enable the PNGDEC.

static inline void PNGDEC_EnableAncillary(PNGDEC_Type *base, bool enable)

Enables or disables the PNGDEC ancillary drop.

Parameters:
  • base – PNGDEC peripheral base address.

  • enable – True to enable the PNGDEC ancillary drop.

static inline void PNGDEC_StartDecode(PNGDEC_Type *base)

Starts the PNG decode.

Parameters:
  • base – PNGDEC peripheral base address.

void PNGDEC_SetPngBuffer(PNGDEC_Type *base, uint8_t *buffer, size_t length)

Sets the address and length of the raw PNG image.

Parameters:
  • base – PNGDEC peripheral base address.

  • data – Start address of the buffer of the raw PNG image, shall be 8-byte aligned.

  • length – Size of the buffer.

static inline void PNGDEC_SetOutputBuffer(PNGDEC_Type *base, uint8_t *imageData, uint8_t *ancillaryData)

Sets the address of the decoded data.

Parameters:
  • base – PNGDEC peripheral base address.

  • imageData – Start address of the buffer for the decoded image data, shall be 8-byte aligned.

  • ancillaryData – Start address of the buffer for the decoded ancillary data, shall be 8-byte aligned.

status_t PNGDEC_ParseHeader(pngdec_image_t *image, uint8_t *pngBuf)

Parses the PNG header and stores the info in the decoded image info structure.

Parameters:
  • image – Pointer to PNGDEC decoded image info structure.

  • pngBuf – Pointer to PNG file buffer.

Return values:
  • kStatus_Success – Header parsing success.

  • kStatus_Fail – PNG header parsing failed due corrupted header.

  • kStatus_PNGDEC_WidthTooLarge – Header parsing failed due to the image width is larger than 1024.

  • kStatus_PNGDEC_NotSupported – Header parsing failed due to the image is interlaced or the bit depth is less than 8.

status_t PNGDEC_Decode(PNGDEC_Type *base, pngdec_image_t *image, uint32_t *status)

Decodes the PNG image.

This function performs the PNG decoding in blocking way and stores the decoded info in decoded image info structure.

Parameters:
  • base – PNGDEC peripheral base address.

  • image – Pointer to PNGDEC decoded image info structure.

  • status – Pointer to decoded status. When retval is kStatus_Fail, Checksum/Crc/Header/Btype/ZlibHeader error may occur due to PNG file corruption, user can check which error(s) occured if necessary.

Return values:
  • kStatus_Success – PNG decoding success.

  • kStatus_Fail – PNG decoding failed due to CRC/header/B type/Alder error or invalid PNG file.

  • kStatus_PNGDEC_WidthTooLarge – PNG decoding failed due to the image width is larger than 1024.

  • kStatus_PNGDEC_NotSupported – PNG decoding failed due to the image is interlaced or the bit depth is less than 8.

bool enableAncillary

Enable ancillary data drop.

bool enable

Enables the decode IP.

uint32_t width

Decoded image width.

uint32_t height

Decoded image height.

pngdec_color_type_t colorType

Color type for the generated image.

uint8_t *imageData

Pointer to the buffer for decoded image data.

uint8_t *ancillaryData

Pointer to the buffer for decoded ancillary data.

uint32_t ancillaryLength

Length of the ancillary data.

struct _pngdec_config
#include <fsl_pngdec.h>

Configuration for PNGDEC.

struct _pngdec_image
#include <fsl_pngdec.h>

The decoded image info structure.

Power Driver

enum pd_bits

Power down control bits defined in SLEEPCON and PMC.

Values:

enumerator kPDRUNCFG_SHUT_SENSEP_MAINCLK

The Private Part in VDD1_SENSE Main Clock Shut Off.

enumerator kPDRUNCFG_SHUT_SENSES_MAINCLK

The Shared Part in VDD1_SENSE Main Clock Shut Off.

enumerator kPDRUNCFG_SHUT_RAM0_CLK

Main Clock of RAM Arbiter 0 Shut Off.

enumerator kPDRUNCFG_SHUT_RAM1_CLK

Main Clock of RAM Arbiter 1 shut off.

enumerator kPDRUNCFG_SHUT_COMNN_MAINCLK

VDDN_COM Domain Main Clock Shut Off.

enumerator kPDRUNCFG_SHUT_MEDIA_MAINCLK

VDD2_MEDIA and VDDN_MEDIA Domains Main Clock of Shut Off.

enumerator kPDRUNCFG_PD_SYSXTAL

Xtal Oscillator Power Down.

enumerator kPDRUNCFG_PD_FRO2

FRO2 Power Down.

enumerator kPDRUNCFG_PD_LPOSC

LPOSC Power Down.

enumerator kPDRUNCFG_PD_PLLANA

Main PLL Analog Function Power Down.

enumerator kPDRUNCFG_PD_PLLLDO

Main PLL Internal Regulator Power Down.

enumerator kPDRUNCFG_PD_AUDPLLANA

Audio PLL Analog Function Power Down.

enumerator kPDRUNCFG_PD_AUDPLLLDO

Audio PLL Internal Regulator Power Down.

enumerator kPDRUNCFG_PD_ADC0

ADC0 Power Down, 1 - Applies gating.

enumerator kPDRUNCFG_GATE_FRO2

FRO2 Gating, 1 - Applies gating.

enumerator kPDRUNCFG_DSR_VDD2N_MEDIA

Power Switch and DSR Enable for the VDD2_MEDIA and VDDN_MEDIA domains.

enumerator kPDRUNCFG_DSR_VDDN_COM

Power Switch and DSR Enable for the VDDN_COM domain.

enumerator kPDRUNCFG_PD_VDD2_DSP

Power switch for the HiFi4 DSP.

enumerator kPDRUNCFG_PD_VDD2_MIPI

Power Switch for the MIPI PHY.

enumerator kPDRUNCFG_LP_DCDC

DCDC Low-Power Mode.

enumerator kPDRUNCFG_PD_RBB_VDD1

Power Down RBB in VDD1.

enumerator kPDRUNCFG_PD_AFBB_VDD1

Power Down AFBB in VDD1 Domain.

enumerator kPDRUNCFG_PD_RBB_VDD2

Power Down RBB in VDD2 Domain.

enumerator kPDRUNCFG_PD_AFBB_VDD2

Power Down AFBB in VDD2 Domain.

enumerator kPDRUNCFG_PD_RBB_VDDN

Power Down RBB in VDDN Domain.

enumerator kPDRUNCFG_PD_AFBB_VDDN

Power Down RBB in VDDN Domain.

enumerator kPDRUNCFG_PD_SRAM_RBB_VDD1

Power Down SRAM RBB in VDD1 Domain.

enumerator kPDRUNCFG_PD_SRAM_RBB_VDD2

Power Down SRAM RBB in VDD2 Domain.

enumerator kPDRUNCFG_PD_SRAM_AFBB_VDD2

Power Down SRAM AFBB in VDD2 Domain.

enumerator kPDRUNCFG_PD_PMC_TEMPSNS

Power Down PMC Temperature Sensor.

enumerator kPDRUNCFG_LP_PMCREF

PMC References in Low-Power Mode.

enumerator kPDRUNCFG_PD_HVD1V8

HVD Power Down.

enumerator kPDRUNCFG_LP_POR_VDD1

POR Low-Power Mode in VDD1 Domain.

enumerator kPDRUNCFG_LP_LVD_VDD1

LVD Low-Power Mode in VDD1 Domain.

enumerator kPDRUNCFG_PD_HVD_VDD1

Power Down HVD in VDD1 Domain.

enumerator kPDRUNCFG_PD_AGDET_VDD1

Power Down AGDET in VDD1 Domain.

enumerator kPDRUNCFG_LP_POR_VDD2

POR Low-Power Mode in VDD2 Domain.

enumerator kPDRUNCFG_LP_LVD_VDD2

LVD Low-Power Mode in VDD2 Domain.

enumerator kPDRUNCFG_PD_HVD_VDD2

Power Down HVD in VDD2 Domain.

enumerator kPDRUNCFG_PD_AGDET_VDD2

Power Down AGDET in VDD2 Domain.

enumerator kPDRUNCFG_LP_POR_VDDN

POR Low-Power Mode in VDDN Domain.

enumerator kPDRUNCFG_LP_LVD_VDDN

LVD Low-Power Mode in VDDN Domain.

enumerator kPDRUNCFG_PD_HVD_VDDN

Power Down HVD in VDDN Domain.

enumerator kPDRUNCFG_PD_OTP

Power Down OTP.

enumerator kPDRUNCFG_PD_ROM

Power Down ROM.

enumerator kPDRUNCFG_APD_SRAM1

RAM Partition 1 Array Power Down.

enumerator kPDRUNCFG_APD_SRAM2

RAM Partition 2 Array Power Down.

enumerator kPDRUNCFG_APD_SRAM3

RAM Partition 3 Array Power Down.

enumerator kPDRUNCFG_APD_SRAM4

RAM Partition 4 Array Power Down.

enumerator kPDRUNCFG_APD_SRAM5

RAM Partition 5 Array Power Down.

enumerator kPDRUNCFG_APD_SRAM6

RAM Partition 6 Array Power Down.

enumerator kPDRUNCFG_APD_SRAM7

RAM Partition 7 Array Power Down.

enumerator kPDRUNCFG_APD_SRAM8

RAM Partition 8 Array Power Down.

enumerator kPDRUNCFG_APD_SRAM9

RAM Partition 9 Array Power Down.

enumerator kPDRUNCFG_APD_SRAM10

RAM Partition 10 Array Power Down.

enumerator kPDRUNCFG_APD_SRAM11

RAM Partition 11 Array Power Down.

enumerator kPDRUNCFG_APD_SRAM12

RAM Partition 12 Array Power Down.

enumerator kPDRUNCFG_APD_SRAM13

RAM Partition 13 Array Power Down.

enumerator kPDRUNCFG_APD_SRAM14

RAM Partition 14 Array Power Down.

enumerator kPDRUNCFG_APD_SRAM15

RAM Partition 15 Array Power Down.

enumerator kPDRUNCFG_APD_SRAM16

RAM Partition 16 Array Power Down.

enumerator kPDRUNCFG_APD_SRAM17

RAM Partition 17 Array Power Down.

enumerator kPDRUNCFG_APD_SRAM18

RAM Partition 18 Array Power Down.

enumerator kPDRUNCFG_APD_SRAM19

RAM Partition 19 Array Power Down.

enumerator kPDRUNCFG_APD_SRAM20

RAM Partition 20 Array Power Down.

enumerator kPDRUNCFG_APD_SRAM21

RAM Partition 21 Array Power Down.

enumerator kPDRUNCFG_APD_SRAM22

RAM Partition 22 Array Power Down.

enumerator kPDRUNCFG_APD_SRAM23

RAM Partition 23 Array Power Down.

enumerator kPDRUNCFG_APD_SRAM24

RAM Partition 24 Array Power Down.

enumerator kPDRUNCFG_APD_SRAM25

RAM Partition 25 Array Power Down.

enumerator kPDRUNCFG_APD_SRAM26

RAM Partition 26 Array Power Down.

enumerator kPDRUNCFG_APD_SRAM27

RAM Partition 27 Array Power Down.

enumerator kPDRUNCFG_APD_SRAM28

RAM Partition 28 Array Power Down.

enumerator kPDRUNCFG_APD_SRAM29

RAM Partition 29 Array Power Down.

enumerator kPDRUNCFG_PPD_SRAM1

RAM Partition 1 Periphery Power Down.

enumerator kPDRUNCFG_PPD_SRAM2

RAM Partition 2 Periphery Power Down.

enumerator kPDRUNCFG_PPD_SRAM3

RAM Partition 3 Periphery Power Down.

enumerator kPDRUNCFG_PPD_SRAM4

RAM Partition 4 Periphery Power Down.

enumerator kPDRUNCFG_PPD_SRAM5

RAM Partition 5 Periphery Power Down.

enumerator kPDRUNCFG_PPD_SRAM6

RAM Partition 6 Periphery Power Down.

enumerator kPDRUNCFG_PPD_SRAM7

RAM Partition 7 Periphery Power Down.

enumerator kPDRUNCFG_PPD_SRAM8

RAM Partition 8 Periphery Power Down.

enumerator kPDRUNCFG_PPD_SRAM9

RAM Partition 9 Periphery Power Down.

enumerator kPDRUNCFG_PPD_SRAM10

RAM Partition 10 Periphery Power Down.

enumerator kPDRUNCFG_PPD_SRAM11

RAM Partition 11 Periphery Power Down.

enumerator kPDRUNCFG_PPD_SRAM12

RAM Partition 12 Periphery Power Down.

enumerator kPDRUNCFG_PPD_SRAM13

RAM Partition 13 Periphery Power Down.

enumerator kPDRUNCFG_PPD_SRAM14

RAM Partition 14 Periphery Power Down.

enumerator kPDRUNCFG_PPD_SRAM15

RAM Partition 15 Periphery Power Down.

enumerator kPDRUNCFG_PPD_SRAM16

RAM Partition 16 Periphery Power Down.

enumerator kPDRUNCFG_PPD_SRAM17

RAM Partition 17 Periphery Power Down.

enumerator kPDRUNCFG_PPD_SRAM18

RAM Partition 18 Periphery Power Down.

enumerator kPDRUNCFG_PPD_SRAM19

RAM Partition 19 Periphery Power Down.

enumerator kPDRUNCFG_PPD_SRAM20

RAM Partition 20 Periphery Power Down.

enumerator kPDRUNCFG_PPD_SRAM21

RAM Partition 21 Periphery Power Down.

enumerator kPDRUNCFG_PPD_SRAM22

RAM Partition 22 Periphery Power Down.

enumerator kPDRUNCFG_PPD_SRAM23

RAM Partition 23 Periphery Power Down.

enumerator kPDRUNCFG_PPD_SRAM24

RAM Partition 24 Periphery Power Down.

enumerator kPDRUNCFG_PPD_SRAM25

RAM Partition 25 Periphery Power Down.

enumerator kPDRUNCFG_PPD_SRAM26

RAM Partition 26 Periphery Power Down.

enumerator kPDRUNCFG_PPD_SRAM27

RAM Partition 27 Periphery Power Down.

enumerator kPDRUNCFG_PPD_SRAM28

RAM Partition 28 Periphery Power Down.

enumerator kPDRUNCFG_PPD_SRAM29

RAM Partition 29 Periphery Power Down.

enumerator kPDRUNCFG_APD_SDHC0_SRAM

uSDHC0 SRAM array Power Down.

enumerator kPDRUNCFG_APD_SDHC1_SRAM

uSDHC1 SRAM array Power Down.

enumerator kPDRUNCFG_APD_USB0_SRAM

USB0 SRAM array Power Down.

enumerator kPDRUNCFG_APD_USB1_SRAM

USB1 SRAM array Power Down.

enumerator kPDRUNCFG_APD_JPEGDEC

Powers down JPEGDEC RAMs array.

enumerator kPDRUNCFG_APD_PNGDEC

Powers down PNGDEC RAMs array.

enumerator kPDRUNCFG_APD_MIPIDSI

Powers down MIPI PHY RAMs array.

enumerator kPDRUNCFG_APD_GPU

Powers down VGPU RAMs array.

enumerator kPDRUNCFG_APD_DMA2_3

Powers down DMA2 and DMA3 RAMs array.

enumerator kPDRUNCFG_APD_DMA0_1_PKC_ETF

Powers down DMA0-1, PKC, and ETF RAMs array.

enumerator kPDRUNCFG_APD_CPU0_CODE_CACHE

Powers down CPU0 code cache RAMs array.

enumerator kPDRUNCFG_APD_CPU0_SYSTEM_CACHE

Powers down CPU0 system cache RAMs array.

enumerator kPDRUNCFG_APD_DSP_ICACHE

Powers down HiFi4 instruction cache RAMs array.

enumerator kPDRUNCFG_APD_DSP_DCACHE

Powers down HiFi4 data cache RAMs array.

enumerator kPDRUNCFG_APD_DSP_ITCM

Powers down HiFi4 instruction TCM RAMs array.

enumerator kPDRUNCFG_APD_DSP_DTCM

Powers down HiFi4 data TCM RAMs array.

enumerator kPDRUNCFG_APD_EZHV_TCM

Powers down EZH-V TCM RAMs array.

enumerator kPDRUNCFG_APD_NPU

Powers down NPU RAMs array.

enumerator kPDRUNCFG_APD_XSPI0

Powers down XSPI0, MMU0, and cache RAMs array.

enumerator kPDRUNCFG_APD_XSPI1

Powers down XSPI1, MMU1, and cache RAMs array.

enumerator kPDRUNCFG_APD_XSPI2

Powers down XSPI2 and MMU2 RAMs array.

enumerator kPDRUNCFG_APD_LCDIF

Powers down LCDIF controller RAMs array.

enumerator kPDRUNCFG_APD_OCOTP

Powers down OCOTP shadow RAMs array.

enumerator kPDRUNCFG_PPD_SDHC0_SRAM

Powers down uSDHC0 RAMs periphery.

enumerator kPDRUNCFG_PPD_SDHC1_SRAM

Powers down uSDHC1 RAMs periphery.

enumerator kPDRUNCFG_PPD_USB0_SRAM

Powers down USB0 RAMs periphery.

enumerator kPDRUNCFG_PPD_USB1_SRAM

Powers down USB1 RAMs periphery.

enumerator kPDRUNCFG_PPD_JPEGDEC

Powers down JPEGDEC RAMs periphery.

enumerator kPDRUNCFG_PPD_PNGDEC

Powers down PNGDEC RAMs periphery.

enumerator kPDRUNCFG_PPD_MIPIDSI

Powers down MIPI PHY RAMs periphery.

enumerator kPDRUNCFG_PPD_GPU

Powers down VGPU RAMs periphery.

enumerator kPDRUNCFG_PPD_DMA2_3

Powers down DMA2 and DMA3 RAMs periphery.

enumerator kPDRUNCFG_PPD_DMA0_1_PKC_ETF

Powers down DMA0-1, PKC, and ETF RAMs periphery.

enumerator kPDRUNCFG_PPD_CPU0_CODE_CACHE

Powers down CPU0 code cache RAMs periphery.

enumerator kPDRUNCFG_PPD_CPU0_SYSTEM_CACHE

Powers down CPU0 system cache RAMs periphery.

enumerator kPDRUNCFG_PPD_DSP_ICACHE

Powers down HiFi4 instruction cache RAMs periphery.

enumerator kPDRUNCFG_PPD_DSP_DCACHE

Powers down HiFi4 data cache RAMs periphery.

enumerator kPDRUNCFG_PPD_DSP_ITCM

Powers down HiFi4 instruction TCM RAMs periphery.

enumerator kPDRUNCFG_PPD_DSP_DTCM

Powers down HiFi4 data TCM RAMs periphery.

enumerator kPDRUNCFG_PPD_EZHV_TCM

Powers down EZH-V TCM RAMs periphery.

enumerator kPDRUNCFG_PPD_NPU

Powers down NPU RAMs periphery.

enumerator kPDRUNCFG_PPD_XSPI0

Powers down XSPI0, MMU0, and cache RAMs periphery.

enumerator kPDRUNCFG_PPD_XSPI1

Powers down XSPI1, MMU1, and cache RAMs periphery.

enumerator kPDRUNCFG_PPD_XSPI2

Powers down XSPI2 and MMU2 RAMs periphery.

enumerator kPDRUNCFG_PPD_LCDIF

Powers down LCDIF controller RAMs periphery.

enumerator kPDRUNCFG_PPD_OCOTP

Powers down OCOTP shadow RAMs periphery.

enumerator kPDRUNCFG_ForceUnsigned
enum lp_bits

low power control bits for modules. Bits used for modules to requesting low-power.

Values:

enumerator kPower_VGPU_LPREQ

VGPU low power request.

enumerator kPower_EZHV_STOP

EZHV stop request.

enumerator kPower_EZHV_HALT

EZHV halt request.

enumerator kPower_EZHV_EXIT_WAIT

EZHV exit wait request.

enumerator kPower_XSPI2_STOP

XSPI2 stop request.

enumerator kPower_LPSPI14_B_LPREQ

LPSPI14 bus low power request.

enumerator kPower_LPSPI14_F_LPREQ

LPSPI14 function low power request.

enumerator kPower_LPSPI16_B_LPREQ

LPSPI16 bus low power request.

enumerator kPower_LPSPI16_F_LPREQ

LPSPI16 function low power request.

enumerator kPower_FLEXIO_B_LPREQ

FLEXIO bus low power request.

enumerator kPower_FLEXIO_F_LPREQ

FLEXIO function low power request.

enumerator kPower_NIC0_LPREQ

NIC0 low power request.

enumerator kPower_NIC1_LPREQ

NIC1 low power request.

enumerator kPower_ADC0_STOP

ADC0 stop request.

enumerator kPower_ACMP0_STOP

ACMP0 stop request.

enumerator kPower_MICFIL_STOP

MICFIL stop request.

enumerator kPower_LPI2C15_B_LPREQ

LPI2C15 bus low power request.

enumerator kPower_LPI2C15_F_LPREQ

LPI2C15 function low power request.

enumerator kPower_GDET3_LPREQ

GDET3 low power request.

enumerator kPower_RTC_STOP

RTC0 and RTC1 stop request.

enumerator kPower_EDMA2_STOP

EDMA2 stop request.

enumerator kPower_EDMA3_STOP

EDMA3 stop request.

enumerator kPower_FC17_B_LPREQ

LP_FLEXCOMM17 bus low power request.

enumerator kPower_FC18_B_LPREQ

LP_FLEXCOMM18 bus low power request.

enumerator kPower_FC19_B_LPREQ

LP_FLEXCOMM19 bus low power request.

enumerator kPower_FC20_B_LPREQ

LP_FLEXCOMM20 bus low power request.

enumerator kPower_FC17_F_LPREQ

LP_FLEXCOMM17 function low power request.

enumerator kPower_FC18_F_LPREQ

LP_FLEXCOMM18 function low power request.

enumerator kPower_FC19_F_LPREQ

LP_FLEXCOMM19 function low power request.

enumerator kPower_FC20_F_LPREQ

LP_FLEXCOMM20 function low power request.

enumerator kPower_SAI3_LPREQ

SAI3 low power request.

enumerator kPower_GPIO8_LPREQ

GPIO8 low power request.

enumerator kPower_GPIO9_LPREQ

GPIO9 low power request.

enumerator kPower_GPIO10_LPREQ

GPIO10 low power request.

enumerator kPower_I3C2_STOP

I3C2 low power request.

enumerator kPower_I3C3_STOP

I3C3 low power request.

enum _pmic_mode_reg

PMIC mode pin configuration API parameter.

Values:

enumerator kCfg_Run

PDRUNCFG0 register offset.

enumerator kCfg_Sleep

PDSLEEPCFG0 register offset.

enum _power_mode_config

Power mode configuration API parameter.

Values:

enumerator kPower_Sleep

Sleep mode.

enumerator kPower_DeepSleep

Deep Sleep mode.

enumerator kPower_DeepSleepRetention

Deep Sleep Retention(DSR) mode.

enumerator kPower_DeepPowerDown

Deep Power Down(DPD) mode.

enumerator kPower_FullDeepPowerDown

Full Deep Power Down(FDPD) mode.

enum _power_hwwake_src

DMA Wakeup sources.

Values:

enumerator kPower_HWWakeSrcFlexio

Enables DMA to wakeup by FLEXIO DMA request.

enumerator kPower_HWWakeSrcLpFlexcomm

Enables DMA to wakeup by LP_FLEXCOMM0-13(CPU0), LP_FLEXCOMM17-20(CPU1) DMA request.

enumerator kPower_HWWakeSrcSai

Enables DMA to wakeup by SAI0-2(CPU0), SAI3(CPU1) request.

enum _power_shared_resource_mask

Definition for shared resources.

Values:

enumerator kPower_MaskAdc0

ADC0 mask.

enumerator kPower_MaskAcmp0

ACMP0 mask.

enumerator kPower_MaskMicfil

MICFIL mask.

enumerator kPower_MaskLpi2c15

LPI2C15 mask.

enumerator kPower_MaskGdet3

GDET3 mask.

enumerator kPower_MaskRtc

RTC mask.

enumerator kPower_MaskVgpu

VGPU mask.

enumerator kPower_MaskEzhv

EZHV mask.

enumerator kPower_MaskXspi2

XSPI2 mask.

enumerator kPower_MaskLpspi14

LPSPI14 mask.

enumerator kPower_MaskLpspi16

LPSPI16 mask.

enumerator kPower_MaskFlexio

FlexIO mask.

enumerator kPower_MaskNic0

NIC0 mask.

enumerator kPower_MaskNic1

NIC1 mask.

enumerator kPower_MaskAll

Mask all shared modules.

enum _power_pad_vrange_val

pad voltage range value for the 3V capable IOs. To reduce power the IOs can be configured for 1.8V or 3.3V operation, powering down the detector, but requiring the application to restrict the IO supply voltage to the selected range.

Values:

enumerator kPadVol_Continuous

Continuous mode, VDDE detector on.

enumerator kPadVol_171_198

Voltage from 1.71V to 1.98V. supply detector off.

enumerator kPadVol_300_360

Voltage from 3.00V to 3.60V. supply detector off.

enum _body_bias_domain

Body Bias domain definition.

Values:

enumerator kPower_BodyBiasVdd2Sram

VDD2 domain RAMs.

enumerator kPower_BodyBiasVdd1Sram

VDD1 domain RAMs.

enumerator kPower_BodyBiasVddn

VDDN domain.

enumerator kPower_BodyBiasVdd2

VDD2 domain.

enumerator kPower_BodyBiasVdd1

VDD1 domain.

enum _power_regulator

Regulator definition for Regulator and LVD configuration.

Values:

enumerator kRegulator_DCDC

DCDC used for VDDN.

enumerator kRegulator_Vdd2LDO

VDD2 LDO.

enumerator kRegulator_Vdd1LDO

VDD1 LDO.

enum _power_ldo_mode

LDO mode definition.

Values:

enumerator kPower_LDOMode_Bypass

LDO Bypass mode.

enumerator kPower_LDOMode_HP

LDO High Power mode.

enumerator kPower_LDOMode_LP

LDO Low Power mode.

enum _power_dcdc_mode

DCDC mode definition.

Values:

enumerator kPower_DCDCMode_HP

LDO High Power mode.

enumerator kPower_DCDCMode_LP

LDO Low Power mode.

enum _power_vdd_src

VDDN, VDD1 or VDD2 supply source.

Values:

enumerator kVddSrc_PMC

Supplied by onchip regulator in PMC, DCDC for VDDN, LDO1 for VDD1, LDO2 for VDD2.

enumerator kVddSrc_PMIC

Supplied by external PMIC.

typedef enum pd_bits pd_bit_t

Power down control bits defined in SLEEPCON and PMC.

typedef enum lp_bits lp_bit_t

low power control bits for modules. Bits used for modules to requesting low-power.

typedef enum _pmic_mode_reg pmic_mode_reg_t

PMIC mode pin configuration API parameter.

typedef enum _power_mode_config power_mode_cfg_t

Power mode configuration API parameter.

typedef enum _power_pad_vrange_val power_pad_vrange_val_t

pad voltage range value for the 3V capable IOs. To reduce power the IOs can be configured for 1.8V or 3.3V operation, powering down the detector, but requiring the application to restrict the IO supply voltage to the selected range.

typedef enum _power_regulator power_regulator_t

Regulator definition for Regulator and LVD configuration.

typedef union _power_regulator_voltage power_regulator_voltage_t

Regulator voltage configuraton. Configure the regulator voltage in uV.

typedef enum _power_vdd_src power_vdd_src_t

VDDN, VDD1 or VDD2 supply source.

typedef union _power_lvd_voltage power_lvd_voltage_t

LVD voltage configuraton. Configure the LVD voltage in uV. Falling trip = 0.5V + 10 mV * bitfield value.

void POWER_EnablePD(pd_bit_t en)

API to enable PDRUNCFG bit in the SLEEPCON and PMC. Note that enabling the bit powers down the peripheral.

Parameters:
  • en – peripheral for which to enable the PDRUNCFG bit

void POWER_DisablePD(pd_bit_t en)

API to disable PDRUNCFG bit in the SLEEPCON and PMC. Note that disabling the bit powers up the peripheral.

Parameters:
  • en – peripheral for which to disable the PDRUNCFG bit

status_t POWER_ModuleEnterLPRequest(lp_bit_t en)

API to request a module entering low power. This API send low power/stop requests to a module and wait the acknowledgement from the module. For peripherals that are being used by a domain, using this low power request handshake is recommended to make sure the module is fully stopped before the module is powered down or clock gated.

Parameters:
  • en – peripheral for which to enable the low power request.

Returns:

kStatus_Success for succeed, kStatus_Timeout for tiemout.

void POWER_ModuleExitLPRequest(lp_bit_t en)

API to negate low power/stop requests to a module(module resume regular operation).

Parameters:
  • en – peripheral for which to disable the low power request.

void POWER_SetPmicMode(uint32_t mode, pmic_mode_reg_t reg)

Set PMIC_MODE pins configure value.

Parameters:
  • mode – : PMIC MODE pin value. This field is aggregated low.

  • reg – : PDSLEEPCFG0 or PDRUNCFG0 register offset

Returns:

PMIC_MODE pins value in PDSLEEPCFG0

uint32_t POWER_GetPmicMode(pmic_mode_reg_t reg)

Get PMIC_MODE pins configure value.

Parameters:
  • reg – : PDSLEEPCFG0 or PDRUNCFG0 register offset

Returns:

PMIC_MODE pins value in PDSLEEPCFG0 or PDRUNCFG0

static inline void POWER_EnableDeepSleep(void)

API to enable deep sleep bit in the ARM Core.

static inline void POWER_DisableDeepSleep(void)

API to disable deep sleep bit in the ARM Core.

void POWER_ApplyPD(void)

API to apply updated PMC PDRUNCFG bits in the Sysctl0.

void POWER_ClearEventFlags(uint32_t statusMask)

Clears the PMC event flags state.

Parameters:
  • statusMask – : A bitmask of event flags that are to be cleared.

uint32_t POWER_GetEventFlags(void)

Get the PMC event flags state.

Returns:

PMC FLAGS register value

void POWER_EnableInterrupts(uint32_t interruptMask)

Enable the PMC interrupt requests.

Parameters:
  • interruptMask – : A bitmask of interrupts to enable.

void POWER_DisableInterrupts(uint32_t interruptMask)

Disable the PMC interrupt requests.

Parameters:
  • interruptMask – : A bitmask of interrupts to disable.

void POWER_EnableResets(uint32_t resetMask)

Enable the PMC reset requests.

Parameters:
  • resetMask – : A bitmask of Reset to enable, refer to PMC CTRL register descritpion in RM.

void POWER_DisableResets(uint32_t resetMask)

Disable the PMC reset requests.

Parameters:
  • resetMask – : A bitmask of Reset to disable, refer to PMC CTRL register descritpion in RM.

void EnableDeepSleepIRQ(IRQn_Type interrupt)

Enable specific interrupt for wake-up from deep-sleep mode. Enable the interrupt for wake-up from deep sleep mode. Some interrupts are typically used in sleep mode only and will not occur during deep-sleep mode because relevant clocks are stopped. However, it is possible to enable those clocks (significantly increasing power consumption in the reduced power mode), making these wake-ups possible.

Note

This function also enables the interrupt in the NVIC (EnableIRQ() is called internally).

Parameters:
  • interrupt – The IRQ number.

void DisableDeepSleepIRQ(IRQn_Type interrupt)

Disable specific interrupt for wake-up from deep-sleep mode. Disable the interrupt for wake-up from deep sleep mode. Some interrupts are typically used in sleep mode only and will not occur during deep-sleep mode because relevant clocks are stopped. However, it is possible to enable those clocks (significantly increasing power consumption in the reduced power mode), making these wake-ups possible.

Note

This function also disables the interrupt in the NVIC (DisableIRQ() is called internally).

Parameters:
  • interrupt – The IRQ number.

void POWER_EnableDMAHWWake(uint32_t sources)

Enable specific DMA channels to generate a wake-up from deep-sleep mode. DMA wakeup is an automatic hardware mechanism that handles DMA transactions for selected modules without the need for core processing. Software can configure individual DMA channels to generate a wakeup when they receive a DMA request. The DMA wakeup triggers an exit from Deep Sleep mode except the core, which remains sleeping.

Parameters:
  • sources – The bits mask for eDMA wakeup sources. Refers _power_hwwake_src.

void POWER_DisableDMAHWWake(uint32_t sources)

Disable specific DMA channels to generate a wake-up from deep-sleep mode. Disable the DMA channels for wake-up from deep sleep mode.

Parameters:
  • sources – The bits mask for eDMA wakeup sources. Refers _power_hwwake_src.

void POWER_EnableAutoWake(uint16_t ticks)

Configure PMC for auto wakeup.This feature allows PMC to wake up some amount of time after the domain enters Deep Sleep. The timer is clocked by PMC’s internal 16 MHz clock. If both timers in compute and sense are enabled at the same time, wake-up will occur after BOTH timers time out (i.e. the max timeout value between the two is used).

Parameters:
  • ticks – : The ticks of 16MHz PMC internal clock to wait before waking up the domain after it goes to DeepSleep.

void POWER_EnableLPRequestMask(uint32_t mask)

Enable low power request masking for shared modules. Enabling the mask will relinquish the caller domain’s control over the module, and give the other domain exclusive control over low-power requests to the module. NOTE, The masking of a shared module must NOT be disabled in both Compute and Sense domain.

Parameters:
  • mask – An OR’d bitmask of shared modules to be masked from low power request, ref _power_shared_resource_mask and SLEEPCON SHARED_MASK0 register in the RM. DeepSleep.

void POWER_DisableLPRequestMask(uint32_t mask)

Disable low power request masking for shared modules. Disabling the mask means this domain will own the module. Only one domain should own each shared module.

Parameters:
  • mask – An OR’d bitmask of shared modules to be enabled from low power request, ref _power_shared_resource_mask and SLEEPCON SHARED_MASK0 register in the RM. DeepSleep.

void POWER_EnableRunAFBB(uint32_t mask)

Enable AFBB mode for various domains in active mode. Note, users should call POWER_ApplyPD() to make the change take effect.

Parameters:
  • mask – : A bitmask of domains to enable AFBB mode, refer to _body_bias_domain and PMC PDRUNCFG0 register descritpion in RM.

void POWER_EnableRunRBB(uint32_t mask)

Enable RBB mode for various domains in active mode. This function should only be used when one CPU will not be making use of one of the voltage domains.Configuring the unused voltages for RBB will allow the other domain to have full control of the body bias mode for the voltages even when both domains are in run mode. Note, users should call POWER_ApplyPD() to make the change take effect.

Parameters:
  • mask – : A bitmask of domains to enable RBB mode, refer to _body_bias_domain and PMC PDRUNCFG0 register descritpion in RM.

void POWER_EnableSleepRBB(uint32_t mask)

Enable RBB mode for various domains in deep sleep mode.

Parameters:
  • mask – : A bitmask of domains to enable RBB mode, refer to _body_bias_domain and PMC PDSLEEPCFG0 register descritpion in RM.

void POWER_EnableRunNBB(uint32_t mask)

Enable NBB mode for various domains in active mode. NBB can be a lower power option than RBB if the domain enters and exits low-power modes frequently since the wells don’t charge and discharge as much on every entry/exit.

Parameters:
  • mask – : A bitmask of domains to enable NBB mode, refer to _body_bias_domain and PMC PDRUNCFG0 register descritpion in RM.

void POWER_EnableSleepNBB(uint32_t mask)

Enable NBB mode for various domains in deep sleep mode. NBB can be a lower power option than RBB if the domain enters and exits low-power modes frequently since the wells don’t charge and discharge as much on every entry/exit.

Parameters:
  • mask – : A bitmask of domains to enable NBB mode, refer to _body_bias_domain and PMC PDSLEEPCFG0 register descritpion in RM.

uint32_t POWER_CalcVoltLevel(power_regulator_t regulator, uint32_t maxFreqHz, uint32_t miniVoltUV)

Get the minimum operative(active) voltage for VDD1 or VDD2 with the given maximum main clock frequency in the domain.

Parameters:
  • maxFreqHz – the maxiumum main clock frequency in Hz will be used for the domain.

  • miniVoltUV – the minimum voltage in microvolt(uV) for VDD1 or VDD2. Should <= 1100000uV, 0 means use the main clock frequency to calculate voltage.

Returns:

the calculated operative voltage in uV. 0xFFFFFFFFU means exceeded max supported value.

status_t POWER_ConfigRegulatorSetpointsForFreq(power_regulator_t regulator, uint32_t *maxFreqHz, uint32_t *miniVoltUV, uint32_t startPoint, uint32_t num)

Configure the setpoint operation for on-chip regulators(LDO1/LDO2) and LVD. This function can configure both the target output voltages and LVD to suitable values per the desired frequency for the specific setpoints. The setpoint that is actually selected is controlled by the aggregated value of PDRUNCFG[xxx_VSEL] and PDSLEEPCFG0[xxx_VSEL]. Use the POWER_SelectRunSetpoint() or POWER_SelectSleepSetpoint() to configure the setpoint selections. The voltage selected for each regulator must also be in ascending order (VSEL0 <= VSEL1 <= VSEL2 <= VSEL3).

Parameters:
  • maxFreqHz – the maxiumum main clock frequency in Hz will be used for the domain. 0 means use the miniVolt defined value and can be used to configure setpoint for DeepSleep.

  • miniVolt – the minimum voltage in microvolt(uV) for VDD1 or VDD2. Should <= 1100000uV, 0 means use the main clock frequency to calculate voltage.

  • startPoint – the start setpoint to be configured.

  • num – the count of setpoints to be configured, the startPoint+num should not larger than 4.

Returns:

kStatus_Success for successful configuration, kStatus_InvalidArgument for wrong parameter.

status_t POWER_ConfigRegulatorSetpoints(power_regulator_t regulator, const power_regulator_voltage_t *volt, const power_lvd_voltage_t *lvd)

Configure the setpoint operation for on-chip regulators and LVD. This function can configure both the target output voltages and LVD levels for each setpoint. The setpoint that is actually selected is controlled by the aggregated value of PDRUNCFG[xxx_VSEL] and PDSLEEPCFG0[xxx_VSEL]. Use the POWER_SelectRunSetpoint() or POWER_SelectSleepSetpoint() to configure the setpoint selections. The voltages selected for each regulator must also be in ascending order (VSEL0 <= VSEL1 <= VSEL2 <= VSEL3). The voltages selected for each LVD must also be in ascending order (LVL0 <= LVL1 <= LVL2 <= LVL3).

NOTE, Only valid regulator for sense domain is VDD1 LDO. Note, LDOVDD1VSEL and LVDVDD1CTRL are shared between the compute and sense domains. There is no aggregation to combine the values. Whichever domain wrote the register last determines the value. It is recommended that only one domain be used to configure VDD1 setpoints.

const power_regulator_voltage_t regulator = {
  .LDO.vsel0 = 700000,
  .LDO.vsel1 = 800000,
  .LDO.vsel2 = 900000,
  .LDO.vsel3 = 1000000,
};
const power_lvd_voltage_t lvd = {
  .VDD12.lvl0 = 600000,
  .VDD12.lvl1 = 700000,
  .VDD12.lvl2 = 800000,
  .VDD12.lvl3 = 900000,
};

ret = POWER_ConfigRegulatorSetpoints(kRegulator_Vdd1LDO, &regulator, &lvd);

Parameters:
  • regulator – which regulator or power domain to configure, refer to power_regulator_t.

  • volt – regulator configuration pointer, refer to power_regulator_voltage_t. Note, only two setpoints are available for DCDC.

  • lvd – LVD voltage configuration, refer to power_lvd_voltage_t.

Returns:

kStatus_Success for succeed, kStatus_InvalidArgument for wrong arguments.

status_t POWER_ConfigLvdSetpoints(power_regulator_t regulator, const power_lvd_voltage_t *lvd)

Configure the setpoint operation for LVD. This function can configure LVD levels for each setpoint. The setpoint that is actually selected is controlled by the aggregated value of PDRUNCFG[xxx_VSEL] and PDSLEEPCFG0[xxx_VSEL]. Use the POWER_SelectRunSetpoint() or POWER_SelectSleepSetpoint() to configure the setpoint selections. The voltages selected for each LVD must be in ascending order (LVL0 <= LVL1 <= LVL2 <= LVL3).

NOTE, Only valid regulator for sense domain is VDD1 LDO. Note, LDOVDD1VSEL and LVDVDD1CTRL are shared between the compute and sense domains. There is no aggregation to combine the values. Whichever domain wrote the register last determines the value. It is recommended that only one domain be used to configure VDD1 setpoints.

const power_lvd_voltage_t lvd = {
  .VDD12.lvl0 = 600000,
  .VDD12.lvl1 = 700000,
  .VDD12.lvl2 = 800000,
  .VDD12.lvl3 = 900000,
};

ret = POWER_ConfigLvdSetpoints(kRegulator_Vdd1LDO, &lvd);

Parameters:
  • regulator – which regulator or power domain to configure, refer to power_regulator_t.

  • lvd – LVD voltage configuration, refer to power_lvd_voltage_t.

Returns:

kStatus_Success for succeed, kStatus_InvalidArgument for wrong arguments.

void POWER_GetLvdSetpoints(power_regulator_t regulator, power_lvd_voltage_t *lvd)

Get the LVD setpoints configurations. This function can get the LVD levels for each setpoint. The setpoint that is actually selected is controlled by the aggregated value of PDRUNCFG[xxx_VSEL] and PDSLEEPCFG0[xxx_VSEL].

NOTE, Only valid regulator for sense domain is VDD1 LDO.

Parameters:
  • regulator – which regulator or power domain to get, refer to power_regulator_t.

  • lvd – LVD voltage configuration, refer to power_lvd_voltage_t.

void POWER_SelectRunSetpoint(power_regulator_t regulator, uint32_t setpoint)

Select the setpoint(target voltage and LVD threshold) for active mode. The requests from the compute and sense domains are aggregated, so depending on the other domain’s configuration the setpoint might not change or might change later (when the other domain also requests a setpoint change). Note, users should call POWER_ApplyPD() to make the change take effect.

Parameters:
  • regulator – which regulator or power domain to configure, refer to power_regulator_t.

  • setpoint – select which setpoint is used. Valid options for DCDC are 0-1. Valid options for VDD1/VDD2 are 0-3.

void POWER_SelectSleepSetpoint(power_regulator_t regulator, uint32_t setpoint)

Select setpoint(target voltage and LVD threshold) in Deep Sleep (or lower) mode. Use POWER_ConfigRegulatorSetpoints() to change the target voltage and/or LVD threshold value corresponding to each setpoint. The requests from the compute and sense domains are aggregated,.

Parameters:
  • regulator – which regulator or power domain to configure, refer to power_regulator_t.

  • setpoint – select which setpoint is used. Valid options for DCDC are 0-1. Valid options for VDD1/VDD2 are 0-3.

void POWER_SetRunRegulatorMode(power_regulator_t regulator, uint32_t mode)

Set the on-chip regulator mode in Run/Active mode. The requests from the compute and sense domains are aggregated.

Parameters:
  • regulator – which regulator or power domain to configure, refer to power_regulator_t.

  • mode – set the workmode. Refer to _power_dcdc_mode for available DCDC modes, refer to _power_ldo_mode for LDO available modes.

void POWER_SetSleepRegulatorMode(power_regulator_t regulator, uint32_t mode)

Set the on-chip regulator mode in Deep Sleep mode. The requests from the compute and sense domains are aggregated.

Parameters:
  • regulator – which regulator or power domain to configure, refer to power_regulator_t.

  • mode – set the workmode. Refer to _power_dcdc_mode for available DCDC modes, refer to _power_ldo_mode for LDO available modes.

void POWER_ResetIOBank(uint32_t mask)

Reset the IO bank. Sets the IO bank reset which tristates the ports. Intended to be used prior to powering off the VDDIO supplies.

Parameters:
  • mask – A bitmask of IO Banks to be reseted, power_io_bank_t and PMC PADCFG register. The register reset by cold reset.

void POWER_IOBankIsolationHold(uint32_t mask)

IO Bank Isolation Hold. Maintains IO bank isolation state after wake-up from FDSR/DPD modes. If clear, the IO bank’s state will be retained during FDSR & DPD modes, but will be controllable after wake-up. If set, the IO bank will remain in retain mode until ISOCTRL cleared by software.

Parameters:
  • mask – A bitmask of IO Banks to be set, power_io_bank_t and PMC PADCFG register. The register reset by cold reset.

void POWER_IOBankClearIsolationHold(uint32_t mask)

Clear the IO bank Isolation Hold and regain state control. This bit cannot be cleared if associated domain is not powered.

Parameters:
  • mask – A bitmask of IO Banks to be clear, power_io_bank_t and PMC PADCFG register. The register reset by cold reset.

void POWER_EnterSleep(void)

Configures and enters in SLEEP low power mode.

void POWER_EnterDeepSleep(const uint32_t exclude_from_pd[7])

PMC Deep Sleep function call.

NOTE, the body bias and DCDC, LDO configurations in PMC_PDSLEECFG0 is not covered by this API, please use POWER_EnableSleepRBB or POWER_EnableSleepNBB and POWER_SelectSleepSetpoint for those settings.

NOTE, the MAINPLL and AUDIO PLL need special power up sequence, so it can’t be power down/on automatically during the mode change. Application need turn off the PLL before the low power mode entry and re-initialize the PLL after wakeup.

Parameters:
  • exclude_from_pd – Bit mask of the SLEEPCON_SLEEPCFG and PMC_PDSLEEPCFG0 ~ PMC_PDSLEEPCFG5 that needs to be powered on during Deep Sleep mode. The configuration for PMC from Compute domain and Sense domain are aggregated, and the higher power mode always wins.

void POWER_RequestDSR(const uint32_t exclude_from_pd[7])

Sense domain requests entering Deep Sleep Retention mode API. Deep Sleep Retention (DSR) mode is a deeper low power state than Deep Sleep mode. DSR mode allows significant portions of the chip to be powered-down while maintaining some level of state retention. The Sense domain can enter DSR mode only when all other domains are in DSR mode. If the condition is false, the sense domain will be in a shallower power mode(Deep sleep mode).

NOTE, the body bias and DCDC, LDO configurations in PMC_PDSLEECFG0 is not covered by this API, please use POWER_EnableSleepRBB or POWER_EnableSleepNBB and POWER_SelectSleepSetpoint for those settings.

Parameters:
  • exclude_from_pd – Bit mask of the SLEEPCON_SLEEPCFG and PMC_PDSLEEPCFG0 ~ PMC_PDSLEEPCFG5 that needs to be powered on(bits cleared) during the power mode. The configuration for PMC from Compute domain and Sense domain are aggregated, and the higher power mode always wins.

void POWER_RequestDeepPowerDown(const uint32_t exclude_from_pd[7])

The domain requests to enter Deep Power Down mode. The Deep Power Down and Full Deep Power Down can occur only when both domains signal their intent to enter these lower power modes. The configuration for PMC from Compute domain and Sense domain are aggregated, and the higher power mode always wins.

Parameters:
  • exclude_from_pd – Bit mask of the SLEEPCON_SLEEPCFG and PMC_PDSLEEPCFG0 ~ PMC_PDSLEEPCFG5 that needs to be powered on during Deep Power Down.

void POWER_RequestFullDeepPowerDown(const uint32_t exclude_from_pd[7])

The domain requests to enter Full Deep Power Down mode. The Deep Power Down and Full Deep Power Down can occur only when both domains signal their intent to enter these lower power modes. The configuration for PMC from Compute domain and Sense domain are aggregated, and the higher power mode always wins.

Parameters:
  • exclude_from_pd – Bit mask of the SLEEPCON_SLEEPCFG and PMC_PDSLEEPCFG0 ~ PMC_PDSLEEPCFG5 that needs to be powered on during Deep Power Down.

void POWER_EnterPowerMode(power_mode_cfg_t mode, const uint32_t exclude_from_pd[7])

Power Library API to request entering different power mode. This API is used for requesting entering the target mode, the final SOC power mode depends on hardware aggregation. Note, the Sense domain can enter DSR mode only when Compute domain is in DSR. The SOC enters DPD or FDPD when both domain requested entering DPD or FDPD.

Parameters:
  • mode – Power mode to enter.

  • exclude_from_pd – Bit mask of the SLEEPCON_SLEEPCFG and PMC_PDSLEEPCFG0 ~ PMC_PDSLEEPCFG5 that needs to be powered on during power mode selected.

uint32_t POWER_GetLibVersion(void)

Power Library API to return the library version.

Returns:

version number of the power library

FSL_POWER_DRIVER_VERSION

power driver version 2.4.0.

POWER_DEFAULT_PMICMODE_DS
POWER_DEFAULT_PMICMODE_DSR
POWER_DEFAULT_PMICMODE_DPD
POWER_DEFAULT_PMICMODE_FDPD
MAKE_PD_BITS(reg, slot)
GET_PD_REG_FROM_BITS(bit)
SLEEPCON_RCFG
PMC_PDRCFG0
PMC_PDRCFG1
PMC_PDRCFG2
PMC_PDRCFG3
PMC_PDRCFG4
PMC_PDRCFG5
SHA_MED_CCTRL0_OFFSET
SHA_MED_TCTRL0_OFFSET
SHA_SEN_TCTRL0_OFFSET
PRIVATE_CCTRL0_OFFSET
PRIVATE_TCTRL0_OFFSET
PRIVATE_TCTRL1_OFFSET
PRIVATE_TCTRL2_OFFSET
SHA_MED_CSTAT0_OFFSET
SHA_MEDSEN_TSTAT0_OFFSET
PRIVATE_CSTAT0_OFFSET
PRIVATE_TSTAT0_OFFSET
PRIVATE_TSTAT1_OFFSET
POWER_LP_REQ_CTRL_REG_OFFSET
POWER_LP_REQ_STATE_REG_OFFSET
POWER_LP_REQ_STATE_BIT_OFFSET
POWER_MAKE_LP_BITS(ctrl_reg, ctrl_bit, state_reg, state_bit)
GET_LP_CTRL_REG_FROM_BITS(bit)
GET_LP_CTRL_BIT_FROM_BITS(bit)
GET_LP_STATE_REG_FROM_BITS(bit)
GET_LP_STATE_BIT_FROM_BITS(bit)
uint32_t vsel0

DCDC VSEL0. Voltage = 0.5 V + 6.25 mV * value of vsel0. Maximum value = 1150000uV.

uint32_t vsel1

DCDC VSEL1. Voltage = 0.5 V + 6.25 mV * value of vsel1. Maximum value = 1150000uV.

struct _power_regulator_voltage DCDC
uint32_t vsel0

LDO VSEL0. Voltage = 0.45 V + 12.5 mV * vsel0. Maximum value = 1150000uV.

uint32_t vsel1

LDO VSEL1. Voltage = 0.45 V + 12.5 mV * vsel1. Maximum value = 1150000uV.

uint32_t vsel2

LDO VSEL2. Voltage = 0.45 V + 12.5 mV * vsel2. Maximum value = 1150000uV.

uint32_t vsel3

LDO VSEL3. Voltage = 0.45 V + 12.5 mV * vsel3. Maximum value = 1150000uV.

struct _power_regulator_voltage LDO
uint32_t vsel[4]
uint32_t lvl0

VDDN LVD level0, uV.

uint32_t lvl1

VDDN LVD level1, uV.

struct _power_lvd_voltage VDDN
uint32_t lvl0

VDD1/2 LVD level0, uV.

uint32_t lvl1

VDD1/2 LVD level1, uV.

uint32_t lvl2

VDD1/2 LVD level2, uV.

uint32_t lvl3

VDD1/2 LVD level3, uV.

struct _power_lvd_voltage VDD12
uint32_t lvl[4]
union _power_regulator_voltage
#include <fsl_power.h>

Regulator voltage configuraton. Configure the regulator voltage in uV.

union _power_lvd_voltage
#include <fsl_power.h>

LVD voltage configuraton. Configure the LVD voltage in uV. Falling trip = 0.5V + 10 mV * bitfield value.

struct DCDC

Public Members

uint32_t vsel0

DCDC VSEL0. Voltage = 0.5 V + 6.25 mV * value of vsel0. Maximum value = 1150000uV.

uint32_t vsel1

DCDC VSEL1. Voltage = 0.5 V + 6.25 mV * value of vsel1. Maximum value = 1150000uV.

struct LDO

Public Members

uint32_t vsel0

LDO VSEL0. Voltage = 0.45 V + 12.5 mV * vsel0. Maximum value = 1150000uV.

uint32_t vsel1

LDO VSEL1. Voltage = 0.45 V + 12.5 mV * vsel1. Maximum value = 1150000uV.

uint32_t vsel2

LDO VSEL2. Voltage = 0.45 V + 12.5 mV * vsel2. Maximum value = 1150000uV.

uint32_t vsel3

LDO VSEL3. Voltage = 0.45 V + 12.5 mV * vsel3. Maximum value = 1150000uV.

struct VDDN

Public Members

uint32_t lvl0

VDDN LVD level0, uV.

uint32_t lvl1

VDDN LVD level1, uV.

struct VDD12

Public Members

uint32_t lvl0

VDD1/2 LVD level0, uV.

uint32_t lvl1

VDD1/2 LVD level1, uV.

uint32_t lvl2

VDD1/2 LVD level2, uV.

uint32_t lvl3

VDD1/2 LVD level3, uV.

PUF: Physical Unclonable Function

Puf_v3_driver

FSL_PUF_V3_DRIVER_VERSION

PUFv3 driver version. Version 2.0.3.

Current version: 2.0.3

Change log:

  • 2.0.3

    • Update for various PUF CTRL wrapper

  • 2.0.2

    • Fix MISRA issue in driver.

  • 2.0.1

    • Fix PUF initialization issue and update driver to reflect SoC header changes.

  • 2.0.0

    • Initial version.

Values:

enumerator kStatus_PUF_OperationNotAllowed
enumerator kStatus_PUF_AcNotForThisProductPhase1
enumerator kStatus_PUF_AcNotForThisProductPhase2
enumerator kStatus_PUF_AcCorruptedPhase1
enumerator kStatus_PUF_AcCorruptedPhase2
enumerator kStatus_PUF_AcAuthFailedPhase1
enumerator kStatus_PUF_NBOOT_AcAuthFailedPhase2
enumerator kStatus_PUF_QualityVerificationFail
enumerator kStatus_PUF_ContextIncorrect
enumerator kStatus_PUF_DestinationNotAllowed
enumerator kStatus_PUF_Failure
typedef uint32_t puf_endianness_t
typedef uint32_t puf_key_dest_t
typedef uint32_t puf_key_scope_t
typedef uint32_t puf_result_code_t
typedef uint32_t puf_sec_level_t
puf_endianness_t dataEndianness
uint8_t CKGATING
puf_key_scope_t keyScopeStarted
puf_key_scope_t keyScopeEnrolled
uint32_t userCtx0
uint32_t userCtx1
void PUF_GetDefaultConfig(puf_config_t *conf)

brief Sets the default configuration of PUF

This function initialize PUF config structure to default values.

Parameters:
  • conf – PUF configuration structure

status_t PUF_Init(PUF_Type *base, puf_config_t *conf)

brief Initialize PUF

This function enables power to PUF block and waits until the block initializes.

Parameters:
  • conf – PUF configuration structure

Returns:

Status of the init operation

void PUF_Deinit(PUF_Type *base, puf_config_t *conf)

brief Denitialize PUF

This function disables power to PUF SRAM and peripheral clock.

Parameters:
  • base – PUF peripheral base address

  • conf – PUF configuration structure

status_t PUF_Enroll(PUF_Type *base, uint8_t *activationCode, size_t activationCodeSize, uint8_t *score)

brief Enroll PUF

This function derives a digital fingerprint, generates the corresponding Activation Code (AC) and returns it to be stored in an NVM or a file. This step needs to be performed only once for each device. This function may be permanently disallowed by a fuse.

Parameters:
  • base – PUF peripheral base address

  • activationCode[out] Word aligned address of the resulting activation code.

  • activationCodeSize – Size of the activationCode buffer in bytes. Shall be FSL_FEATURE_PUF_ACTIVATION_CODE_SIZE bytes.

  • score – Value of the PUF Score that was obtained during the enroll operation.

Returns:

Status of enroll operation.

status_t PUF_Start(PUF_Type *base, const uint8_t *activationCode, size_t activationCodeSize, uint8_t *score)

brief Start PUF

The Activation Code generated during the Enroll operation is used to reconstruct the digital fingerprint. This needs to be done after every power-up and reset.

Parameters:
  • base – PUF peripheral base address

  • activationCode[in] Word aligned address of the input activation code.

  • activationCodeSize – Size of the activationCode buffer in bytes. Shall be FSL_FEATURE_PUF_ACTIVATION_CODE_SIZE bytes.

  • score – Value of the PUF Score that was obtained during the start operation. return Status of start operation.

status_t PUF_Stop(PUF_Type *base)

brief Stop PUF

The Stop operation removes all key material from PUF flipflops and PUF SRAM, and sets PUF to the Stopped state.

Parameters:
  • base – PUF peripheral base address

Returns:

Status of stop operation.

status_t PUF_GetKey(PUF_Type *base, puf_key_ctx_t *keyCtx, puf_key_dest_t keyDest, uint8_t *key, size_t keySize)

brief PUF Get Key

The Get Key operation derives a key from the intrinsic PUF key and externally provided context.

Parameters:
  • base – PUF peripheral base address

  • keyCtx – PUF key context struct

  • keyDest – output destination of the derived PUF key

  • key[out] Word aligned address of output key (only used when kPUF_KeyDestRegister).

  • keySize – Size of the derived key in bytes.

Returns:

Status of get key operation.

status_t PUF_WrapGeneratedRandom(PUF_Type *base, puf_key_ctx_t *keyCtx, size_t keySize, uint8_t *keyCode, size_t keyCodeSize)

brief PUF Wrap generated random

The Wrap Generated Random operation wraps a random key into a Key Code (KC).

Parameters:
  • base – PUF peripheral base address

  • keyCtx – PUF key context struct

  • keySize – Size of the key to be generated in bytes.

  • keyCode[out] Word aligned address of the resulting key code.

  • keyCodeSize – Size of the output keycode in bytes.

Returns:

Status of wrap generated random operation.

status_t PUF_Wrap(PUF_Type *base, puf_key_ctx_t *keyCtx, uint8_t *userKey, size_t userKeySize, uint8_t *keyCode, size_t keyCodeSize)

brief PUF Wrap user key

The Wrap operation wraps a user defined key into a Key Code (KC).

Parameters:
  • base – PUF peripheral base address

  • keyCtx – PUF key context struct.

  • userKey – Word aligned address of input user key.

  • userKeySize – Size of the key to be wrapped in bytes.

  • keyCode[out] Word aligned address of the resulting key code.

  • keyCodeSize – Size of the output keycode in bytes.

Returns:

Status of wrap operation.

status_t PUF_Unwrap(PUF_Type *base, puf_key_dest_t keyDest, uint8_t *keyCode, size_t keyCodeSize, uint8_t *key, size_t keySize)

brief PUF Unwrap user key

The unwrap operation unwraps the key from a previously created Key Code (KC)

Parameters:
  • base – PUF peripheral base address

  • keyDest – output destination of the unwraped PUF key

  • keyCode[in] Word aligned address of the input key code.

  • keyCodeSize – Size of the input keycode in bytes.

  • key – Word aligned address of output key (only used when kPUF_KeyDestRegister).

  • keySize – Size of the key to be generated in bytes.

Returns:

Status of unwrap operation.

status_t PUF_GenerateRandom(PUF_Type *base, uint8_t *data, size_t size)

brief Generate Random

The Generate Random operation outputs the requested amount of random data as specified in a provided context.

Parameters:
  • base – PUF peripheral base address

  • size – Size of random data to be genarated in bytes.

Returns:

Status of generate random operation.

status_t PUF_Zeroize(PUF_Type *base)

brief Zeroize PUF

This function clears all PUF internal logic and puts the PUF to zeroized state.

Parameters:
  • base – PUF peripheral base address

Returns:

Status of the zeroize operation.

status_t PUF_Test(PUF_Type *base, uint8_t *score)

brief Test PUF

With the Test PUF operation, diagnostics about the PUF quality is collected and presented in a PUF score.

Parameters:
  • base – PUF peripheral base address

  • score – Value of the PUF Score that was obtained during the enroll operation.

Returns:

Status of the test operation.

static inline void PUF_BlockCommand(PUF_Type *base, uint32_t mask)

Blocks specified PUF commands.

This function blocks PUF commands specified by mask parameter.

Parameters:
  • base – PUF peripheral base address

  • mask – Mask of parameters which should be blocked until power-cycle.

Returns:

Status of the test operation.

status_t PUF_SetLock(PUF_Type *base, puf_sec_level_t securityLevel)

brief Set lock of PUF operation

Lock the security level of PUF block until key generate, wrap or unwrap operation is completed. Note: Only security level defined in SEC_LOCK register can use PUFv3 or change its security level. Default setting after leaving ROM is Secure-Privilege

Parameters:
  • base – PUF peripheral base address

  • securityLevel – Security level of PUF block.

Returns:

Status of the test operation.

status_t PUF_SetCtxMask(PUF_Type *base, uint32_t appCtxMask)

brief Set App Context mask

This function sets Application defined context mask used in conjunction with key user context 2. Whenever bit in this register is 1, corresponding bit in user context 2 provided during key code creation should be zero only.

This register is only modifiable by task running at secure-privilege level.

Parameters:
  • base – PUF peripheral base address

  • appCtxMask – Value of the Application defined context mask.

Returns:

Status of the test operation.

kPUF_EndianLittle
kPUF_EndianBig
kPUF_KeyDestRegister
kPUF_KeyDestKeyBus
kPUF_KeyDestInvalid
kPUF_KeyAllowRegister
kPUF_KeyAllowKeyBus
kPUF_KeyAllowAll
kPUF_ResultOK
kPUF_AcNotForThisProductPhase1
kPUF_AcNotForThisProductPhase2
kPUF_AcCorruptedPhase1
kPUF_AcCorruptedPhase2
kPUF_AcAuthFailedPhase1
kPUF_AcAuthFailedPhase2
kPUF_QualityVerificationFail
kPUF_ContextIncorrect
kPUF_DestinationNotAllowed
kPUF_Failure
kPUF_NonsecureUser
kPUF_NonsecurePrivilege
kPUF_SecureUser
kPUF_SecurePrivilege
PUF_ACTIVATION_CODE_SIZE
PUF_GET_KEY_CODE_SIZE_FOR_KEY_SIZE(x)
SEC_LOCK_PATTERN
struct puf_config_t
#include <fsl_puf_v3.h>
struct puf_key_ctx_t
#include <fsl_puf_v3.h>

Reset Driver

enum _rstctl_reset_source

Enumeration for system reset status bits.

Defines the enumeration for system reset status bits in SYSRSTSTAT register

Values:

enumerator kRSTCTL_SourceVddPor

VDD Power-On Reset(POR)

enumerator kRSTCTL_SourcePad

PPAD Reset

enumerator kRSTCTL_SourceIspAp

ISP_AP reset Reset

enumerator kRSTCTL_SourceItrcSw

ITRC_SW (Intrusion and Tamper Response Controller SW) Reset

enumerator kRSTCTL_SourceCpu0

VDD2_COMP Core Reset

enumerator kRSTCTL_SourceCpu1

VDD1_SENSE Core Reset

enumerator kRSTCTL_SourceWwdt0

WatchDog Timer 0 Reset

enumerator kRSTCTL_SourceWwdt1

WatchDog Timer 1 Reset

enumerator kRSTCTL_SourceWwdt2

WatchDog Timer 2 Reset

enumerator kRSTCTL_SourceWwdt3

WatchDog Timer 3 Reset

enumerator kRSTCTL_SourceCdog0

Code WatchDog Timer 0 Reset

enumerator kRSTCTL_SourceCdog1

Code WatchDog Timer 1 Reset

enumerator kRSTCTL_SourceCdog2

Code WatchDog Timer 2 Reset

enumerator kRSTCTL_SourceCdog3

Code WatchDog Timer 3 Reset

enumerator kRSTCTL_SourceCdog4

Code WatchDog Timer 4 Reset

enumerator kRSTCTL_SourceAll
enum _RSTCTL_RSTn

Enumeration for peripheral reset control bits.

Defines the enumeration for peripheral reset control bits in RSTCLTx registers

Values:

enumerator kIOPCTL0_RST_SHIFT_RSTn

IOPCTL0 reset control

enumerator kELS_RST_SHIFT_RSTn

ELS S50 reset control

enumerator kDMA0_RST_SHIFT_RSTn

eDMA0 reset control

enumerator kDMA1_RST_SHIFT_RSTn

eDMA1 reset control

enumerator kPKC_RST_SHIFT_RSTn

PKC reset control

enumerator kXSPI0_RST_SHIFT_RSTn

XSPI0 reset control

enumerator kXSPI1_RST_SHIFT_RSTn

XSPI1 reset control

enumerator kGPIO0_RST_SHIFT_RSTn

GPIO0 reset control

enumerator kGPIO1_RST_SHIFT_RSTn

GPIO1 reset control

enumerator kGPIO2_RST_SHIFT_RSTn

GPIO2 reset control

enumerator kGPIO3_RST_SHIFT_RSTn

GPIO3 reset control

enumerator kGPIO4_RST_SHIFT_RSTn

GPIO4 reset control

enumerator kGPIO5_RST_SHIFT_RSTn

GPIO5 reset control

enumerator kGPIO6_RST_SHIFT_RSTn

GPIO6 reset control

enumerator kGPIO7_RST_SHIFT_RSTn

GPIO7 reset control

enumerator kSCT0_RST_SHIFT_RSTn

SCT0 reset control

enumerator kFC0_RST_SHIFT_RSTn

LP_FLEXCOMM0 reset control

enumerator kFC1_RST_SHIFT_RSTn

LP_FLEXCOMM1 reset control

enumerator kFC2_RST_SHIFT_RSTn

LP_FLEXCOMM2 reset control

enumerator kFC3_RST_SHIFT_RSTn

LP_FLEXCOMM3 reset control

enumerator kFC4_RST_SHIFT_RSTn

LP_FLEXCOMM4 reset control

enumerator kFC5_RST_SHIFT_RSTn

LP_FLEXCOMM5 reset control

enumerator kFC6_RST_SHIFT_RSTn

LP_FLEXCOMM6 reset control

enumerator kFC7_RST_SHIFT_RSTn

LP_FLEXCOMM7 reset control

enumerator kFC8_RST_SHIFT_RSTn

LP_FLEXCOMM8 reset control

enumerator kFC9_RST_SHIFT_RSTn

LP_FLEXCOMM9 reset control

enumerator kFC10_RST_SHIFT_RSTn

LP_FLEXCOMM10 reset control

enumerator kFC11_RST_SHIFT_RSTn

LP_FLEXCOMM11 reset control

enumerator kFC12_RST_SHIFT_RSTn

LP_FLEXCOMM12 reset control

enumerator kFC13_RST_SHIFT_RSTn

LP_FLEXCOMM13 reset control

enumerator kSAI0_RST_SHIFT_RSTn

SAI0 reset control

enumerator kSAI1_RST_SHIFT_RSTn

SAI1 reset control

enumerator kSAI2_RST_SHIFT_RSTn

SAI2 reset control

enumerator kI3C0_RST_SHIFT_RSTn

I3C0 reset control

enumerator kI3C1_RST_SHIFT_RSTn

I3C1 reset control

enumerator kCRC0_RST_SHIFT_RSTn

CRC0 reset control

enumerator kCTIMER0_RST_SHIFT_RSTn

CTIMER0 reset control

enumerator kCTIMER1_RST_SHIFT_RSTn

CTIMER1 reset control

enumerator kCTIMER2_RST_SHIFT_RSTn

CTIMER2 reset control

enumerator kCTIMER3_RST_SHIFT_RSTn

CTIMER3 reset control

enumerator kCTIMER4_RST_SHIFT_RSTn

CTIMER4 reset control

enumerator kMRT0_RST_SHIFT_RSTn

MRT0 reset control

enumerator kUTICK0_RST_SHIFT_RSTn

UTICK0 reset control

enumerator kSEMA424_RST_SHIFT_RSTn

SEMA42_4 reset control

enumerator kMU4_RST_SHIFT_RSTn

MU4 reset control

enumerator kSYSPM2_RST_SHIFT_RSTn

SYSPM_XSPI0 reset control

enumerator kSYSPM3_RST_SHIFT_RSTn

SYSPM_XSPI1 reset control

enumerator kSAFO_SGI_RST_SHIFT_RSTn

SAFO_SGI reset control

enumerator kINPUTMUX0_RST_SHIFT_RSTn

INPUTMUX0 reset control

enumerator kFREQME_RST_SHIFT_RSTn

FREQME0 reset control

enumerator kSYSPM0_RST_SHIFT_RSTn

SYSPM_PC reset control

enumerator kSYSPM1_RST_SHIFT_RSTn

SYSPM_PS reset control

enumerator kNPU0_RST_SHIFT_RSTn

NPU0 reset control

enumerator kHIFI4_RST_SHIFT_RSTn

HiFi4 reset control

enumerator kHIFI4_DEBUG_RST_SHIFT_RSTn

HiFi4 Debug reset control

enumerator kHIFI1_RST_SHIFT_RSTn

HiFi1 reset control

enumerator kHIFI1_DEBUG_RST_SHIFT_RSTn

HiFi1 Debug reset control

enumerator kDMA2_RST_SHIFT_RSTn

eDMA2 reset control

enumerator kDMA3_RST_SHIFT_RSTn

eDMA3 reset control

enumerator kFC17_RST_SHIFT_RSTn

LP_FLEXCOMM17 reset control

enumerator kFC18_RST_SHIFT_RSTn

LP_FLEXCOMM18 reset control

enumerator kFC19_RST_SHIFT_RSTn

LP_FLEXCOMM19 reset control

enumerator kFC20_RST_SHIFT_RSTn

LP_FLEXCOMM20 reset control

enumerator kSAI3_RST_SHIFT_RSTn

SAI3 reset control

enumerator kI3C2_RST_SHIFT_RSTn

I3C2 reset control

enumerator kI3C3_RST_SHIFT_RSTn

I3C3 reset control

enumerator kGPIO8_RST_SHIFT_RSTn

GPIO8 reset control

enumerator kGPIO9_RST_SHIFT_RSTn

GPIO9 reset control

enumerator kGPIO10_RST_SHIFT_RSTn

GPIO10 reset control

enumerator kCTIMER5_RST_SHIFT_RSTn

CTIMER5 reset control

enumerator kCTIMER6_RST_SHIFT_RSTn

CTIMER6 reset control

enumerator kCTIMER7_RST_SHIFT_RSTn

CTIMER7 reset control

enumerator kMRT1_RST_SHIFT_RSTn

MRT1 reset control

enumerator kUTICK1_RST_SHIFT_RSTn

UTICK1 reset control

enumerator kMU3_RST_SHIFT_RSTn

MU3 reset control

enumerator kSEMA423_RST_SHIFT_RSTn

SEMA42_3 reset control

enumerator kPVT1_RST_SHIFT_RSTn

PVT1 reset control

enumerator kIOPCTL2_RST_SHIFT_RSTn

IOPCTL2 reset control

enumerator kIOPCTL1_RST_SHIFT_RSTn

IOPCTL1 reset control

enumerator kCPU1_RST_SHIFT_RSTn

CPU1 reset control

enumerator kMU0_RST_SHIFT_RSTn

MU0 reset control

enumerator kMU1_RST_SHIFT_RSTn

MU1 reset control

enumerator kMU2_RST_SHIFT_RSTn

MU2 reset control

enumerator kSEMA420_RST_SHIFT_RSTn

SEMA42_0 reset control

enumerator kADC0_RST_SHIFT_RSTn

ADC0 reset control

enumerator kSDADC0_RST_SHIFT_RSTn

SDADC0 reset control

enumerator kACMP0_RST_SHIFT_RSTn

ACMP0 reset control

enumerator kPDM_RST_SHIFT_RSTn

MICFIL/PDM reset control

enumerator kINPUTMUX1_RST_SHIFT_RSTn

INPUTMUX1 reset control

enumerator kLPI2C15_RST_SHIFT_RSTn

LPI2C15 reset control

enumerator kVGPU_RST_SHIFT_RSTn

VGPU reset control

enumerator kLCDIF_RST_SHIFT_RSTn

LCDIF reset control

enumerator kMIPI_DSI_CTRL_RST_SHIFT_RSTn

MIPIDSI reset control

enumerator kEZHV_RST_SHIFT_RSTn

EZHV reset control

enumerator kJPEGDEC_RST_SHIFT_RSTn

JPEGDEC reset control

enumerator kPNGDEC_RST_SHIFT_RSTn

PNGDEC reset control

enumerator kXSPI2_RST_SHIFT_RSTn

XSPI2 and MMU2 reset control

enumerator kLPSPI14_RST_SHIFT_RSTn

LPSPI14 reset control

enumerator kLPSPI16_RST_SHIFT_RSTn

LPSPI16 reset control

enumerator kFLEXIO0_RST_SHIFT_RSTn

FLEXIO0 reset control

enumerator kUSB0_RST_SHIFT_RSTn

USB0 reset control

enumerator kUSBPHY0_RST_SHIFT_RSTn

USBPHY0 reset control

enumerator kUSB1_RST_SHIFT_RSTn

USB1 reset control

enumerator kUSDHC0_RST_SHIFT_RSTn

USDHC0 reset control

enumerator kUSDHC1_RST_SHIFT_RSTn

USDHC1 reset control

Flash device current running mode.

Values:

enumerator kFlashInstMode_ExtendedSpi
enumerator kFlashInstMode_0_4_4_SDR
enumerator kFlashInstMode_0_4_4_DDR
enumerator kFlashInstMode_DPI_SDR
enumerator kFlashInstMode_DPI_DDR
enumerator kFlashInstMode_QPI_SDR
enumerator kFlashInstMode_QPI_DDR
enumerator kFlashInstMode_OPI_SDR
enumerator kFlashInstMode_OPI_DDR

flash reset sequence of standard SPI mode.

Values:

enumerator kRestoreSeqence_None
enumerator kRestoreSeqence_QPI_4_0xFFs
enumerator kRestoreSeqence_QPI_Mode_0x00
enumerator kRestoreSeqence_Send_F0
enumerator kRestoreSeqence_Send_66_99
enumerator kRestoreSeqence_Send_6699_9966
enumerator kRestoreSeqence_Send_06_FF
enumerator kRestoreSeqence_QPI_5_0xFFs
enumerator kRestoreSeqence_Send_QPI_8_0xFFs
enumerator kRestoreSeqence_Wakep_0xAB
enumerator kRestoreSeqence_Wakep_0xAB_54
typedef enum _rstctl_reset_source rstctl_reset_source_t

Enumeration for system reset status bits.

Defines the enumeration for system reset status bits in SYSRSTSTAT register

typedef enum _RSTCTL_RSTn RSTCTL_RSTn_t

Enumeration for peripheral reset control bits.

Defines the enumeration for peripheral reset control bits in RSTCLTx registers

typedef union _FLASH_run_context_t FLASH_run_context_t

Flash context.

Defines the flash context parameter used by ROM.

typedef RSTCTL_RSTn_t reset_ip_name_t

IP reset handle.

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.

static inline uint32_t RESET_GetPreviousResetSources(void)

Gets the reset source status which caused a previous reset.

This function gets the status of the latest reset event. Use source masks defined in the rstctl_reset_source_t to get the desired source status.

Returns:

All reset source status bit map.

static inline void RESET_ClearResetSources(uint32_t sourceMasks)

Clears the reset source status.

This function clears the system reset flags indicated by source masks.

Parameters:
  • sourceMasks – reset source status bit map

static inline uint32_t RESET_GetDomainResetStatus(void)

Gets the reset status of domains.

This function gets the reset status of domains.

Returns:

All reset source status bit map.

FSL_RESET_DRIVER_VERSION

reset driver version 2.1.0.

RST_CTL0_PSCCTL0

Reset control registers index.

RST_CTL0_PSCCTL1
RST_CTL0_PSCCTL2
RST_CTL0_PSCCTL3
RST_CTL0_PSCCTL4
RST_CTL0_PSCCTL5
RST_CTL1_PSCCTL0
RST_CTL2_PSCCTL0
RST_CTL3_PSCCTL0
RST_CTL3_PSCCTL1
RST_CTL4_PSCCTL0
RST_CTL4_PSCCTL1
ADC_RSTS

Array initializers with peripheral reset bits

SDADC_RSTS
CRC_RSTS
CTIMER_RSTS
MIPI_DSI_RSTS
LCDIF_RSTS
LP_FLEXCOMM_RSTS
FLEXIO_RSTS
FREQME_RSTS_N
XSPI_RSTS
GPIO_RSTS
I3C_RSTS
MRT_RSTS
PINT_RSTS
PNGDEC_RSTS
JPEGDEC_RSTS
SCT_RSTS
SEMA42_RSTS
SAI_RSTS
USDHC_RSTS
UTICK_RSTS
uint8_t reseverd0

Reserved.

uint8_t current_mode

Flash device current running mode.

uint8_t reserved1

Reserved.

uint8_t restore_sequence

Flash reset sequence of standard SPI mode.

struct _FLASH_run_context_t B
uint32_t U
union _FLASH_run_context_t
#include <fsl_reset.h>

Flash context.

Defines the flash context parameter used by ROM.

struct B

Public Members

uint8_t reseverd0

Reserved.

uint8_t current_mode

Flash device current running mode.

uint8_t reserved1

Reserved.

uint8_t restore_sequence

Flash reset sequence of standard SPI mode.

Runbootloader

typedef struct _user_app_boot_invoke_option user_app_boot_invoke_option_t
void bootloader_user_entry(void *arg)

Run the Bootloader API to force into the ISP mode base on the user arg.

Parameters:
  • arg – Indicates API prototype fields definition. Refer to the above user_app_boot_invoke_option_t structure

uint32_t bootloader_version(void)

Get Bootloader version.

Return values:

Bootloader – version.

const char *bootloader_copyright(void)

Get Bootloader Copyright.

Return values:

Pointer – to Bootloader copyright header

uint32_t reserved0
uint32_t recovery_boot_cfg0
uint32_t recovery_boot_cfg1
uint32_t reserved1
uint32_t instance
uint32_t boot_interface
uint32_t mode
uint32_t tag
struct _user_app_boot_invoke_option B
uint32_t U
union _user_app_boot_invoke_option option
struct _user_app_boot_invoke_option
#include <fsl_romapi.h>
union option

Public Members

struct _user_app_boot_invoke_option B
uint32_t U
struct B

SAI: Serial Audio Interface

SAI Driver

void SAI_Init(I2S_Type *base)

Initializes the SAI peripheral.

This API gates the SAI clock. The SAI module can’t operate unless SAI_Init is called to enable the clock.

Parameters:
  • base – SAI base pointer.

void SAI_Deinit(I2S_Type *base)

De-initializes the SAI peripheral.

This API gates the SAI clock. The SAI module can’t operate unless SAI_TxInit or SAI_RxInit is called to enable the clock.

Parameters:
  • base – SAI base pointer.

void SAI_TxReset(I2S_Type *base)

Resets the SAI Tx.

This function enables the software reset and FIFO reset of SAI Tx. After reset, clear the reset bit.

Parameters:
  • base – SAI base pointer

void SAI_RxReset(I2S_Type *base)

Resets the SAI Rx.

This function enables the software reset and FIFO reset of SAI Rx. After reset, clear the reset bit.

Parameters:
  • base – SAI base pointer

void SAI_TxEnable(I2S_Type *base, bool enable)

Enables/disables the SAI Tx.

Parameters:
  • base – SAI base pointer.

  • enable – True means enable SAI Tx, false means disable.

void SAI_RxEnable(I2S_Type *base, bool enable)

Enables/disables the SAI Rx.

Parameters:
  • base – SAI base pointer.

  • enable – True means enable SAI Rx, false means disable.

static inline void SAI_TxSetBitClockDirection(I2S_Type *base, sai_master_slave_t masterSlave)

Set Rx bit clock direction.

Select bit clock direction, master or slave.

Parameters:
  • base – SAI base pointer.

  • masterSlave – reference sai_master_slave_t.

static inline void SAI_RxSetBitClockDirection(I2S_Type *base, sai_master_slave_t masterSlave)

Set Rx bit clock direction.

Select bit clock direction, master or slave.

Parameters:
  • base – SAI base pointer.

  • masterSlave – reference sai_master_slave_t.

static inline void SAI_RxSetFrameSyncDirection(I2S_Type *base, sai_master_slave_t masterSlave)

Set Rx frame sync direction.

Select frame sync direction, master or slave.

Parameters:
  • base – SAI base pointer.

  • masterSlave – reference sai_master_slave_t.

static inline void SAI_TxSetFrameSyncDirection(I2S_Type *base, sai_master_slave_t masterSlave)

Set Tx frame sync direction.

Select frame sync direction, master or slave.

Parameters:
  • base – SAI base pointer.

  • masterSlave – reference sai_master_slave_t.

void SAI_TxSetBitClockRate(I2S_Type *base, uint32_t sourceClockHz, uint32_t sampleRate, uint32_t bitWidth, uint32_t channelNumbers)

Transmitter bit clock rate configurations.

Parameters:
  • base – SAI base pointer.

  • sourceClockHz – Bit clock source frequency.

  • sampleRate – Audio data sample rate.

  • bitWidth – Audio data bitWidth.

  • channelNumbers – Audio channel numbers.

void SAI_RxSetBitClockRate(I2S_Type *base, uint32_t sourceClockHz, uint32_t sampleRate, uint32_t bitWidth, uint32_t channelNumbers)

Receiver bit clock rate configurations.

Parameters:
  • base – SAI base pointer.

  • sourceClockHz – Bit clock source frequency.

  • sampleRate – Audio data sample rate.

  • bitWidth – Audio data bitWidth.

  • channelNumbers – Audio channel numbers.

void SAI_TxSetBitclockConfig(I2S_Type *base, sai_master_slave_t masterSlave, sai_bit_clock_t *config)

Transmitter Bit clock configurations.

Parameters:
  • base – SAI base pointer.

  • masterSlave – master or slave.

  • config – bit clock other configurations, can be NULL in slave mode.

void SAI_RxSetBitclockConfig(I2S_Type *base, sai_master_slave_t masterSlave, sai_bit_clock_t *config)

Receiver Bit clock configurations.

Parameters:
  • base – SAI base pointer.

  • masterSlave – master or slave.

  • config – bit clock other configurations, can be NULL in slave mode.

void SAI_SetMasterClockConfig(I2S_Type *base, sai_master_clock_t *config)

Master clock configurations.

Parameters:
  • base – SAI base pointer.

  • config – master clock configurations.

void SAI_TxSetFifoConfig(I2S_Type *base, sai_fifo_t *config)

SAI transmitter fifo configurations.

Parameters:
  • base – SAI base pointer.

  • config – fifo configurations.

void SAI_RxSetFifoConfig(I2S_Type *base, sai_fifo_t *config)

SAI receiver fifo configurations.

Parameters:
  • base – SAI base pointer.

  • config – fifo configurations.

void SAI_TxSetFrameSyncConfig(I2S_Type *base, sai_master_slave_t masterSlave, sai_frame_sync_t *config)

SAI transmitter Frame sync configurations.

Parameters:
  • base – SAI base pointer.

  • masterSlave – master or slave.

  • config – frame sync configurations, can be NULL in slave mode.

void SAI_RxSetFrameSyncConfig(I2S_Type *base, sai_master_slave_t masterSlave, sai_frame_sync_t *config)

SAI receiver Frame sync configurations.

Parameters:
  • base – SAI base pointer.

  • masterSlave – master or slave.

  • config – frame sync configurations, can be NULL in slave mode.

void SAI_TxSetSerialDataConfig(I2S_Type *base, sai_serial_data_t *config)

SAI transmitter Serial data configurations.

Parameters:
  • base – SAI base pointer.

  • config – serial data configurations.

void SAI_RxSetSerialDataConfig(I2S_Type *base, sai_serial_data_t *config)

SAI receiver Serial data configurations.

Parameters:
  • base – SAI base pointer.

  • config – serial data configurations.

void SAI_TxSetConfig(I2S_Type *base, sai_transceiver_t *config)

SAI transmitter configurations.

Parameters:
  • base – SAI base pointer.

  • config – transmitter configurations.

void SAI_RxSetConfig(I2S_Type *base, sai_transceiver_t *config)

SAI receiver configurations.

Parameters:
  • base – SAI base pointer.

  • config – receiver configurations.

void SAI_GetClassicI2SConfig(sai_transceiver_t *config, sai_word_width_t bitWidth, sai_mono_stereo_t mode, uint32_t saiChannelMask)

Get classic I2S mode configurations.

Parameters:
  • config – transceiver configurations.

  • bitWidth – audio data bitWidth.

  • mode – audio data channel.

  • saiChannelMask – mask value of the channel to be enable.

void SAI_GetLeftJustifiedConfig(sai_transceiver_t *config, sai_word_width_t bitWidth, sai_mono_stereo_t mode, uint32_t saiChannelMask)

Get left justified mode configurations.

Parameters:
  • config – transceiver configurations.

  • bitWidth – audio data bitWidth.

  • mode – audio data channel.

  • saiChannelMask – mask value of the channel to be enable.

void SAI_GetRightJustifiedConfig(sai_transceiver_t *config, sai_word_width_t bitWidth, sai_mono_stereo_t mode, uint32_t saiChannelMask)

Get right justified mode configurations.

Parameters:
  • config – transceiver configurations.

  • bitWidth – audio data bitWidth.

  • mode – audio data channel.

  • saiChannelMask – mask value of the channel to be enable.

void SAI_GetTDMConfig(sai_transceiver_t *config, sai_frame_sync_len_t frameSyncWidth, sai_word_width_t bitWidth, uint32_t dataWordNum, uint32_t saiChannelMask)

Get TDM mode configurations.

Parameters:
  • config – transceiver configurations.

  • frameSyncWidth – length of frame sync.

  • bitWidth – audio data word width.

  • dataWordNum – word number in one frame.

  • saiChannelMask – mask value of the channel to be enable.

void SAI_GetDSPConfig(sai_transceiver_t *config, sai_frame_sync_len_t frameSyncWidth, sai_word_width_t bitWidth, sai_mono_stereo_t mode, uint32_t saiChannelMask)

Get DSP mode configurations.

DSP/PCM MODE B configuration flow for TX. RX is similiar but uses SAI_RxSetConfig instead of SAI_TxSetConfig:

SAI_GetDSPConfig(config, kSAI_FrameSyncLenOneBitClk, bitWidth, kSAI_Stereo, channelMask)
SAI_TxSetConfig(base, config)

Note

DSP mode is also called PCM mode which support MODE A and MODE B, DSP/PCM MODE A configuration flow. RX is similiar but uses SAI_RxSetConfig instead of SAI_TxSetConfig:

SAI_GetDSPConfig(config, kSAI_FrameSyncLenOneBitClk, bitWidth, kSAI_Stereo, channelMask)
config->frameSync.frameSyncEarly    = true;
SAI_TxSetConfig(base, config)

Parameters:
  • config – transceiver configurations.

  • frameSyncWidth – length of frame sync.

  • bitWidth – audio data bitWidth.

  • mode – audio data channel.

  • saiChannelMask – mask value of the channel to enable.

static inline uint32_t SAI_TxGetStatusFlag(I2S_Type *base)

Gets the SAI Tx status flag state.

Parameters:
  • base – SAI base pointer

Returns:

SAI Tx status flag value. Use the Status Mask to get the status value needed.

static inline void SAI_TxClearStatusFlags(I2S_Type *base, uint32_t mask)

Clears the SAI Tx status flag state.

Parameters:
  • base – SAI base pointer

  • mask – State mask. It can be a combination of the following source if defined:

    • kSAI_WordStartFlag

    • kSAI_SyncErrorFlag

    • kSAI_FIFOErrorFlag

static inline uint32_t SAI_RxGetStatusFlag(I2S_Type *base)

Gets the SAI Tx status flag state.

Parameters:
  • base – SAI base pointer

Returns:

SAI Rx status flag value. Use the Status Mask to get the status value needed.

static inline void SAI_RxClearStatusFlags(I2S_Type *base, uint32_t mask)

Clears the SAI Rx status flag state.

Parameters:
  • base – SAI base pointer

  • mask – State mask. It can be a combination of the following sources if defined.

    • kSAI_WordStartFlag

    • kSAI_SyncErrorFlag

    • kSAI_FIFOErrorFlag

void SAI_TxSoftwareReset(I2S_Type *base, sai_reset_type_t resetType)

Do software reset or FIFO reset .

FIFO reset means clear all the data in the FIFO, and make the FIFO pointer both to 0. Software reset means clear the Tx internal logic, including the bit clock, frame count etc. But software reset will not clear any configuration registers like TCR1~TCR5. This function will also clear all the error flags such as FIFO error, sync error etc.

Parameters:
  • base – SAI base pointer

  • resetType – Reset type, FIFO reset or software reset

void SAI_RxSoftwareReset(I2S_Type *base, sai_reset_type_t resetType)

Do software reset or FIFO reset .

FIFO reset means clear all the data in the FIFO, and make the FIFO pointer both to 0. Software reset means clear the Rx internal logic, including the bit clock, frame count etc. But software reset will not clear any configuration registers like RCR1~RCR5. This function will also clear all the error flags such as FIFO error, sync error etc.

Parameters:
  • base – SAI base pointer

  • resetType – Reset type, FIFO reset or software reset

void SAI_TxSetChannelFIFOMask(I2S_Type *base, uint8_t mask)

Set the Tx channel FIFO enable mask.

Parameters:
  • base – SAI base pointer

  • mask – Channel enable mask, 0 means all channel FIFO disabled, 1 means channel 0 enabled, 3 means both channel 0 and channel 1 enabled.

void SAI_RxSetChannelFIFOMask(I2S_Type *base, uint8_t mask)

Set the Rx channel FIFO enable mask.

Parameters:
  • base – SAI base pointer

  • mask – Channel enable mask, 0 means all channel FIFO disabled, 1 means channel 0 enabled, 3 means both channel 0 and channel 1 enabled.

void SAI_TxSetDataOrder(I2S_Type *base, sai_data_order_t order)

Set the Tx data order.

Parameters:
  • base – SAI base pointer

  • order – Data order MSB or LSB

void SAI_RxSetDataOrder(I2S_Type *base, sai_data_order_t order)

Set the Rx data order.

Parameters:
  • base – SAI base pointer

  • order – Data order MSB or LSB

void SAI_TxSetBitClockPolarity(I2S_Type *base, sai_clock_polarity_t polarity)

Set the Tx data order.

Parameters:
  • base – SAI base pointer

  • polarity

void SAI_RxSetBitClockPolarity(I2S_Type *base, sai_clock_polarity_t polarity)

Set the Rx data order.

Parameters:
  • base – SAI base pointer

  • polarity

void SAI_TxSetFrameSyncPolarity(I2S_Type *base, sai_clock_polarity_t polarity)

Set the Tx data order.

Parameters:
  • base – SAI base pointer

  • polarity

void SAI_RxSetFrameSyncPolarity(I2S_Type *base, sai_clock_polarity_t polarity)

Set the Rx data order.

Parameters:
  • base – SAI base pointer

  • polarity

void SAI_TxSetFIFOPacking(I2S_Type *base, sai_fifo_packing_t pack)

Set Tx FIFO packing feature.

Parameters:
  • base – SAI base pointer.

  • pack – FIFO pack type. It is element of sai_fifo_packing_t.

void SAI_RxSetFIFOPacking(I2S_Type *base, sai_fifo_packing_t pack)

Set Rx FIFO packing feature.

Parameters:
  • base – SAI base pointer.

  • pack – FIFO pack type. It is element of sai_fifo_packing_t.

static inline void SAI_TxSetFIFOErrorContinue(I2S_Type *base, bool isEnabled)

Set Tx FIFO error continue.

FIFO error continue mode means SAI will keep running while FIFO error occurred. If this feature not enabled, SAI will hang and users need to clear FEF flag in TCSR register.

Parameters:
  • base – SAI base pointer.

  • isEnabled – Is FIFO error continue enabled, true means enable, false means disable.

static inline void SAI_RxSetFIFOErrorContinue(I2S_Type *base, bool isEnabled)

Set Rx FIFO error continue.

FIFO error continue mode means SAI will keep running while FIFO error occurred. If this feature not enabled, SAI will hang and users need to clear FEF flag in RCSR register.

Parameters:
  • base – SAI base pointer.

  • isEnabled – Is FIFO error continue enabled, true means enable, false means disable.

static inline void SAI_TxEnableInterrupts(I2S_Type *base, uint32_t mask)

Enables the SAI Tx interrupt requests.

Parameters:
  • base – SAI base pointer

  • mask – interrupt source The parameter can be a combination of the following sources if defined.

    • kSAI_WordStartInterruptEnable

    • kSAI_SyncErrorInterruptEnable

    • kSAI_FIFOWarningInterruptEnable

    • kSAI_FIFORequestInterruptEnable

    • kSAI_FIFOErrorInterruptEnable

static inline void SAI_RxEnableInterrupts(I2S_Type *base, uint32_t mask)

Enables the SAI Rx interrupt requests.

Parameters:
  • base – SAI base pointer

  • mask – interrupt source The parameter can be a combination of the following sources if defined.

    • kSAI_WordStartInterruptEnable

    • kSAI_SyncErrorInterruptEnable

    • kSAI_FIFOWarningInterruptEnable

    • kSAI_FIFORequestInterruptEnable

    • kSAI_FIFOErrorInterruptEnable

static inline void SAI_TxDisableInterrupts(I2S_Type *base, uint32_t mask)

Disables the SAI Tx interrupt requests.

Parameters:
  • base – SAI base pointer

  • mask – interrupt source The parameter can be a combination of the following sources if defined.

    • kSAI_WordStartInterruptEnable

    • kSAI_SyncErrorInterruptEnable

    • kSAI_FIFOWarningInterruptEnable

    • kSAI_FIFORequestInterruptEnable

    • kSAI_FIFOErrorInterruptEnable

static inline void SAI_RxDisableInterrupts(I2S_Type *base, uint32_t mask)

Disables the SAI Rx interrupt requests.

Parameters:
  • base – SAI base pointer

  • mask – interrupt source The parameter can be a combination of the following sources if defined.

    • kSAI_WordStartInterruptEnable

    • kSAI_SyncErrorInterruptEnable

    • kSAI_FIFOWarningInterruptEnable

    • kSAI_FIFORequestInterruptEnable

    • kSAI_FIFOErrorInterruptEnable

static inline void SAI_TxEnableDMA(I2S_Type *base, uint32_t mask, bool enable)

Enables/disables the SAI Tx DMA requests.

Parameters:
  • base – SAI base pointer

  • mask – DMA source The parameter can be combination of the following sources if defined.

    • kSAI_FIFOWarningDMAEnable

    • kSAI_FIFORequestDMAEnable

  • enable – True means enable DMA, false means disable DMA.

static inline void SAI_RxEnableDMA(I2S_Type *base, uint32_t mask, bool enable)

Enables/disables the SAI Rx DMA requests.

Parameters:
  • base – SAI base pointer

  • mask – DMA source The parameter can be a combination of the following sources if defined.

    • kSAI_FIFOWarningDMAEnable

    • kSAI_FIFORequestDMAEnable

  • enable – True means enable DMA, false means disable DMA.

static inline uintptr_t SAI_TxGetDataRegisterAddress(I2S_Type *base, uint32_t channel)

Gets the SAI Tx data register address.

This API is used to provide a transfer address for the SAI DMA transfer configuration.

Parameters:
  • base – SAI base pointer.

  • channel – Which data channel used.

Returns:

data register address.

static inline uintptr_t SAI_RxGetDataRegisterAddress(I2S_Type *base, uint32_t channel)

Gets the SAI Rx data register address.

This API is used to provide a transfer address for the SAI DMA transfer configuration.

Parameters:
  • base – SAI base pointer.

  • channel – Which data channel used.

Returns:

data register address.

void SAI_WriteBlocking(I2S_Type *base, uint32_t channel, uint32_t bitWidth, uint8_t *buffer, uint32_t size)

Sends data using a blocking method.

Note

This function blocks by polling until data is ready to be sent.

Parameters:
  • base – SAI base pointer.

  • channel – Data channel used.

  • bitWidth – How many bits in an audio word; usually 8/16/24/32 bits.

  • buffer – Pointer to the data to be written.

  • size – Bytes to be written.

void SAI_WriteMultiChannelBlocking(I2S_Type *base, uint32_t channel, uint32_t channelMask, uint32_t bitWidth, uint8_t *buffer, uint32_t size)

Sends data to multi channel using a blocking method.

Note

This function blocks by polling until data is ready to be sent.

Parameters:
  • base – SAI base pointer.

  • channel – Data channel used.

  • channelMask – channel mask.

  • bitWidth – How many bits in an audio word; usually 8/16/24/32 bits.

  • buffer – Pointer to the data to be written.

  • size – Bytes to be written.

static inline void SAI_WriteData(I2S_Type *base, uint32_t channel, uint32_t data)

Writes data into SAI FIFO.

Parameters:
  • base – SAI base pointer.

  • channel – Data channel used.

  • data – Data needs to be written.

void SAI_ReadBlocking(I2S_Type *base, uint32_t channel, uint32_t bitWidth, uint8_t *buffer, uint32_t size)

Receives data using a blocking method.

Note

This function blocks by polling until data is ready to be sent.

Parameters:
  • base – SAI base pointer.

  • channel – Data channel used.

  • bitWidth – How many bits in an audio word; usually 8/16/24/32 bits.

  • buffer – Pointer to the data to be read.

  • size – Bytes to be read.

void SAI_ReadMultiChannelBlocking(I2S_Type *base, uint32_t channel, uint32_t channelMask, uint32_t bitWidth, uint8_t *buffer, uint32_t size)

Receives multi channel data using a blocking method.

Note

This function blocks by polling until data is ready to be sent.

Parameters:
  • base – SAI base pointer.

  • channel – Data channel used.

  • channelMask – channel mask.

  • bitWidth – How many bits in an audio word; usually 8/16/24/32 bits.

  • buffer – Pointer to the data to be read.

  • size – Bytes to be read.

static inline uint32_t SAI_ReadData(I2S_Type *base, uint32_t channel)

Reads data from the SAI FIFO.

Parameters:
  • base – SAI base pointer.

  • channel – Data channel used.

Returns:

Data in SAI FIFO.

void SAI_TransferTxCreateHandle(I2S_Type *base, sai_handle_t *handle, sai_transfer_callback_t callback, void *userData)

Initializes the SAI Tx handle.

This function initializes the Tx handle for the SAI Tx transactional APIs. Call this function once to get the handle initialized.

Parameters:
  • base – SAI base pointer

  • handle – SAI handle pointer.

  • callback – Pointer to the user callback function.

  • userData – User parameter passed to the callback function

void SAI_TransferRxCreateHandle(I2S_Type *base, sai_handle_t *handle, sai_transfer_callback_t callback, void *userData)

Initializes the SAI Rx handle.

This function initializes the Rx handle for the SAI Rx transactional APIs. Call this function once to get the handle initialized.

Parameters:
  • base – SAI base pointer.

  • handle – SAI handle pointer.

  • callback – Pointer to the user callback function.

  • userData – User parameter passed to the callback function.

void SAI_TransferTxSetConfig(I2S_Type *base, sai_handle_t *handle, sai_transceiver_t *config)

SAI transmitter transfer configurations.

This function initializes the Tx, include bit clock, frame sync, master clock, serial data and fifo configurations.

Parameters:
  • base – SAI base pointer.

  • handle – SAI handle pointer.

  • config – tranmitter configurations.

void SAI_TransferRxSetConfig(I2S_Type *base, sai_handle_t *handle, sai_transceiver_t *config)

SAI receiver transfer configurations.

This function initializes the Rx, include bit clock, frame sync, master clock, serial data and fifo configurations.

Parameters:
  • base – SAI base pointer.

  • handle – SAI handle pointer.

  • config – receiver configurations.

status_t SAI_TransferSendNonBlocking(I2S_Type *base, sai_handle_t *handle, sai_transfer_t *xfer)

Performs an interrupt non-blocking send transfer on SAI.

Note

This API returns immediately after the transfer initiates. Call the SAI_TxGetTransferStatusIRQ to poll the transfer status and check whether the transfer is finished. If the return status is not kStatus_SAI_Busy, the transfer is finished.

Parameters:
  • base – SAI base pointer.

  • handle – Pointer to the sai_handle_t structure which stores the transfer state.

  • xfer – Pointer to the sai_transfer_t structure.

Return values:
  • kStatus_Success – Successfully started the data receive.

  • kStatus_SAI_TxBusy – Previous receive still not finished.

  • kStatus_InvalidArgument – The input parameter is invalid.

status_t SAI_TransferReceiveNonBlocking(I2S_Type *base, sai_handle_t *handle, sai_transfer_t *xfer)

Performs an interrupt non-blocking receive transfer on SAI.

Note

This API returns immediately after the transfer initiates. Call the SAI_RxGetTransferStatusIRQ to poll the transfer status and check whether the transfer is finished. If the return status is not kStatus_SAI_Busy, the transfer is finished.

Parameters:
  • base – SAI base pointer

  • handle – Pointer to the sai_handle_t structure which stores the transfer state.

  • xfer – Pointer to the sai_transfer_t structure.

Return values:
  • kStatus_Success – Successfully started the data receive.

  • kStatus_SAI_RxBusy – Previous receive still not finished.

  • kStatus_InvalidArgument – The input parameter is invalid.

status_t SAI_TransferGetSendCount(I2S_Type *base, sai_handle_t *handle, size_t *count)

Gets a set byte count.

Parameters:
  • base – SAI base pointer.

  • handle – Pointer to the sai_handle_t structure which stores the transfer state.

  • count – Bytes count sent.

Return values:
  • kStatus_Success – Succeed get the transfer count.

  • kStatus_NoTransferInProgress – There is not a non-blocking transaction currently in progress.

status_t SAI_TransferGetReceiveCount(I2S_Type *base, sai_handle_t *handle, size_t *count)

Gets a received byte count.

Parameters:
  • base – SAI base pointer.

  • handle – Pointer to the sai_handle_t structure which stores the transfer state.

  • count – Bytes count received.

Return values:
  • kStatus_Success – Succeed get the transfer count.

  • kStatus_NoTransferInProgress – There is not a non-blocking transaction currently in progress.

void SAI_TransferAbortSend(I2S_Type *base, sai_handle_t *handle)

Aborts the current send.

Note

This API can be called any time when an interrupt non-blocking transfer initiates to abort the transfer early.

Parameters:
  • base – SAI base pointer.

  • handle – Pointer to the sai_handle_t structure which stores the transfer state.

void SAI_TransferAbortReceive(I2S_Type *base, sai_handle_t *handle)

Aborts the current IRQ receive.

Note

This API can be called when an interrupt non-blocking transfer initiates to abort the transfer early.

Parameters:
  • base – SAI base pointer

  • handle – Pointer to the sai_handle_t structure which stores the transfer state.

void SAI_TransferTerminateSend(I2S_Type *base, sai_handle_t *handle)

Terminate all SAI send.

This function will clear all transfer slots buffered in the sai queue. If users only want to abort the current transfer slot, please call SAI_TransferAbortSend.

Parameters:
  • base – SAI base pointer.

  • handle – SAI eDMA handle pointer.

void SAI_TransferTerminateReceive(I2S_Type *base, sai_handle_t *handle)

Terminate all SAI receive.

This function will clear all transfer slots buffered in the sai queue. If users only want to abort the current transfer slot, please call SAI_TransferAbortReceive.

Parameters:
  • base – SAI base pointer.

  • handle – SAI eDMA handle pointer.

void SAI_TransferTxHandleIRQ(I2S_Type *base, sai_handle_t *handle)

Tx interrupt handler.

Parameters:
  • base – SAI base pointer.

  • handle – Pointer to the sai_handle_t structure.

void SAI_TransferRxHandleIRQ(I2S_Type *base, sai_handle_t *handle)

Tx interrupt handler.

Parameters:
  • base – SAI base pointer.

  • handle – Pointer to the sai_handle_t structure.

FSL_SAI_DRIVER_VERSION

Version 2.4.4

_sai_status_t, SAI return status.

Values:

enumerator kStatus_SAI_TxBusy

SAI Tx is busy.

enumerator kStatus_SAI_RxBusy

SAI Rx is busy.

enumerator kStatus_SAI_TxError

SAI Tx FIFO error.

enumerator kStatus_SAI_RxError

SAI Rx FIFO error.

enumerator kStatus_SAI_QueueFull

SAI transfer queue is full.

enumerator kStatus_SAI_TxIdle

SAI Tx is idle

enumerator kStatus_SAI_RxIdle

SAI Rx is idle

_sai_channel_mask,.sai channel mask value, actual channel numbers is depend soc specific

Values:

enumerator kSAI_Channel0Mask

channel 0 mask value

enumerator kSAI_Channel1Mask

channel 1 mask value

enumerator kSAI_Channel2Mask

channel 2 mask value

enumerator kSAI_Channel3Mask

channel 3 mask value

enumerator kSAI_Channel4Mask

channel 4 mask value

enumerator kSAI_Channel5Mask

channel 5 mask value

enumerator kSAI_Channel6Mask

channel 6 mask value

enumerator kSAI_Channel7Mask

channel 7 mask value

enum _sai_protocol

Define the SAI bus type.

Values:

enumerator kSAI_BusLeftJustified

Uses left justified format.

enumerator kSAI_BusRightJustified

Uses right justified format.

enumerator kSAI_BusI2S

Uses I2S format.

enumerator kSAI_BusPCMA

Uses I2S PCM A format.

enumerator kSAI_BusPCMB

Uses I2S PCM B format.

enum _sai_master_slave

Master or slave mode.

Values:

enumerator kSAI_Master

Master mode include bclk and frame sync

enumerator kSAI_Slave

Slave mode include bclk and frame sync

enumerator kSAI_Bclk_Master_FrameSync_Slave

bclk in master mode, frame sync in slave mode

enumerator kSAI_Bclk_Slave_FrameSync_Master

bclk in slave mode, frame sync in master mode

enum _sai_mono_stereo

Mono or stereo audio format.

Values:

enumerator kSAI_Stereo

Stereo sound.

enumerator kSAI_MonoRight

Only Right channel have sound.

enumerator kSAI_MonoLeft

Only left channel have sound.

enum _sai_data_order

SAI data order, MSB or LSB.

Values:

enumerator kSAI_DataLSB

LSB bit transferred first

enumerator kSAI_DataMSB

MSB bit transferred first

enum _sai_clock_polarity

SAI clock polarity, active high or low.

Values:

enumerator kSAI_PolarityActiveHigh

Drive outputs on rising edge

enumerator kSAI_PolarityActiveLow

Drive outputs on falling edge

enumerator kSAI_SampleOnFallingEdge

Sample inputs on falling edge

enumerator kSAI_SampleOnRisingEdge

Sample inputs on rising edge

enum _sai_sync_mode

Synchronous or asynchronous mode.

Values:

enumerator kSAI_ModeAsync

Asynchronous mode

enumerator kSAI_ModeSync

Synchronous mode (with receiver or transmit)

enumerator kSAI_ModeSyncWithOtherTx

Synchronous with another SAI transmit

enumerator kSAI_ModeSyncWithOtherRx

Synchronous with another SAI receiver

enum _sai_bclk_source

Bit clock source.

Values:

enumerator kSAI_BclkSourceBusclk

Bit clock using bus clock

enumerator kSAI_BclkSourceMclkOption1

Bit clock MCLK option 1

enumerator kSAI_BclkSourceMclkOption2

Bit clock MCLK option2

enumerator kSAI_BclkSourceMclkOption3

Bit clock MCLK option3

enumerator kSAI_BclkSourceMclkDiv

Bit clock using master clock divider

enumerator kSAI_BclkSourceOtherSai0

Bit clock from other SAI device

enumerator kSAI_BclkSourceOtherSai1

Bit clock from other SAI device

_sai_interrupt_enable_t, The SAI interrupt enable flag

Values:

enumerator kSAI_WordStartInterruptEnable

Word start flag, means the first word in a frame detected

enumerator kSAI_SyncErrorInterruptEnable

Sync error flag, means the sync error is detected

enumerator kSAI_FIFOWarningInterruptEnable

FIFO warning flag, means the FIFO is empty

enumerator kSAI_FIFOErrorInterruptEnable

FIFO error flag

enumerator kSAI_FIFORequestInterruptEnable

FIFO request, means reached watermark

_sai_dma_enable_t, The DMA request sources

Values:

enumerator kSAI_FIFOWarningDMAEnable

FIFO warning caused by the DMA request

enumerator kSAI_FIFORequestDMAEnable

FIFO request caused by the DMA request

_sai_flags, The SAI status flag

Values:

enumerator kSAI_WordStartFlag

Word start flag, means the first word in a frame detected

enumerator kSAI_SyncErrorFlag

Sync error flag, means the sync error is detected

enumerator kSAI_FIFOErrorFlag

FIFO error flag

enumerator kSAI_FIFORequestFlag

FIFO request flag.

enumerator kSAI_FIFOWarningFlag

FIFO warning flag

enum _sai_reset_type

The reset type.

Values:

enumerator kSAI_ResetTypeSoftware

Software reset, reset the logic state

enumerator kSAI_ResetTypeFIFO

FIFO reset, reset the FIFO read and write pointer

enumerator kSAI_ResetAll

All reset.

enum _sai_fifo_packing

The SAI packing mode The mode includes 8 bit and 16 bit packing.

Values:

enumerator kSAI_FifoPackingDisabled

Packing disabled

enumerator kSAI_FifoPacking8bit

8 bit packing enabled

enumerator kSAI_FifoPacking16bit

16bit packing enabled

enum _sai_sample_rate

Audio sample rate.

Values:

enumerator kSAI_SampleRate8KHz

Sample rate 8000 Hz

enumerator kSAI_SampleRate11025Hz

Sample rate 11025 Hz

enumerator kSAI_SampleRate12KHz

Sample rate 12000 Hz

enumerator kSAI_SampleRate16KHz

Sample rate 16000 Hz

enumerator kSAI_SampleRate22050Hz

Sample rate 22050 Hz

enumerator kSAI_SampleRate24KHz

Sample rate 24000 Hz

enumerator kSAI_SampleRate32KHz

Sample rate 32000 Hz

enumerator kSAI_SampleRate44100Hz

Sample rate 44100 Hz

enumerator kSAI_SampleRate48KHz

Sample rate 48000 Hz

enumerator kSAI_SampleRate96KHz

Sample rate 96000 Hz

enumerator kSAI_SampleRate192KHz

Sample rate 192000 Hz

enumerator kSAI_SampleRate384KHz

Sample rate 384000 Hz

enum _sai_word_width

Audio word width.

Values:

enumerator kSAI_WordWidth8bits

Audio data width 8 bits

enumerator kSAI_WordWidth16bits

Audio data width 16 bits

enumerator kSAI_WordWidth24bits

Audio data width 24 bits

enumerator kSAI_WordWidth32bits

Audio data width 32 bits

enum _sai_data_pin_state

sai data pin state definition

Values:

enumerator kSAI_DataPinStateTriState

transmit data pins are tri-stated when slots are masked or channels are disabled

enumerator kSAI_DataPinStateOutputZero

transmit data pins are never tri-stated and will output zero when slots are masked or channel disabled

enum _sai_fifo_combine

sai fifo combine mode definition

Values:

enumerator kSAI_FifoCombineDisabled

sai TX/RX fifo combine mode disabled

enumerator kSAI_FifoCombineModeEnabledOnRead

sai TX fifo combine mode enabled on FIFO reads

enumerator kSAI_FifoCombineModeEnabledOnWrite

sai TX fifo combine mode enabled on FIFO write

enumerator kSAI_RxFifoCombineModeEnabledOnWrite

sai RX fifo combine mode enabled on FIFO write

enumerator kSAI_RXFifoCombineModeEnabledOnRead

sai RX fifo combine mode enabled on FIFO reads

enumerator kSAI_FifoCombineModeEnabledOnReadWrite

sai TX/RX fifo combined mode enabled on FIFO read/writes

enum _sai_transceiver_type

sai transceiver type

Values:

enumerator kSAI_Transmitter

sai transmitter

enumerator kSAI_Receiver

sai receiver

enum _sai_frame_sync_len

sai frame sync len

Values:

enumerator kSAI_FrameSyncLenOneBitClk

1 bit clock frame sync len for DSP mode

enumerator kSAI_FrameSyncLenPerWordWidth

Frame sync length decided by word width

typedef enum _sai_protocol sai_protocol_t

Define the SAI bus type.

typedef enum _sai_master_slave sai_master_slave_t

Master or slave mode.

typedef enum _sai_mono_stereo sai_mono_stereo_t

Mono or stereo audio format.

typedef enum _sai_data_order sai_data_order_t

SAI data order, MSB or LSB.

typedef enum _sai_clock_polarity sai_clock_polarity_t

SAI clock polarity, active high or low.

typedef enum _sai_sync_mode sai_sync_mode_t

Synchronous or asynchronous mode.

typedef enum _sai_bclk_source sai_bclk_source_t

Bit clock source.

typedef enum _sai_reset_type sai_reset_type_t

The reset type.

typedef enum _sai_fifo_packing sai_fifo_packing_t

The SAI packing mode The mode includes 8 bit and 16 bit packing.

typedef struct _sai_config sai_config_t

SAI user configuration structure.

typedef enum _sai_sample_rate sai_sample_rate_t

Audio sample rate.

typedef enum _sai_word_width sai_word_width_t

Audio word width.

typedef enum _sai_data_pin_state sai_data_pin_state_t

sai data pin state definition

typedef enum _sai_fifo_combine sai_fifo_combine_t

sai fifo combine mode definition

typedef enum _sai_transceiver_type sai_transceiver_type_t

sai transceiver type

typedef enum _sai_frame_sync_len sai_frame_sync_len_t

sai frame sync len

typedef struct _sai_transfer_format sai_transfer_format_t

sai transfer format

typedef struct _sai_master_clock sai_master_clock_t

master clock configurations

typedef struct _sai_fifo sai_fifo_t

sai fifo configurations

typedef struct _sai_bit_clock sai_bit_clock_t

sai bit clock configurations

typedef struct _sai_frame_sync sai_frame_sync_t

sai frame sync configurations

typedef struct _sai_serial_data sai_serial_data_t

sai serial data configurations

typedef struct _sai_transceiver sai_transceiver_t

sai transceiver configurations

typedef struct _sai_transfer sai_transfer_t

SAI transfer structure.

typedef struct _sai_handle sai_handle_t
typedef void (*sai_transfer_callback_t)(I2S_Type *base, sai_handle_t *handle, status_t status, void *userData)

SAI transfer callback prototype.

SAI_XFER_QUEUE_SIZE

SAI transfer queue size, user can refine it according to use case.

FSL_SAI_HAS_FIFO_EXTEND_FEATURE

sai fifo feature

struct _sai_config
#include <fsl_sai.h>

SAI user configuration structure.

Public Members

sai_protocol_t protocol

Audio bus protocol in SAI

sai_sync_mode_t syncMode

SAI sync mode, control Tx/Rx clock sync

bool mclkOutputEnable

Master clock output enable, true means master clock divider enabled

sai_bclk_source_t bclkSource

Bit Clock source

sai_master_slave_t masterSlave

Master or slave

struct _sai_transfer_format
#include <fsl_sai.h>

sai transfer format

Public Members

uint32_t sampleRate_Hz

Sample rate of audio data

uint32_t bitWidth

Data length of audio data, usually 8/16/24/32 bits

sai_mono_stereo_t stereo

Mono or stereo

uint32_t masterClockHz

Master clock frequency in Hz

uint8_t watermark

Watermark value

uint8_t channel

Transfer start channel

uint8_t channelMask

enabled channel mask value, reference _sai_channel_mask

uint8_t endChannel

end channel number

uint8_t channelNums

Total enabled channel numbers

sai_protocol_t protocol

Which audio protocol used

bool isFrameSyncCompact

True means Frame sync length is configurable according to bitWidth, false means frame sync length is 64 times of bit clock.

struct _sai_master_clock
#include <fsl_sai.h>

master clock configurations

Public Members

bool mclkOutputEnable

master clock output enable

uint32_t mclkHz

target mclk frequency

uint32_t mclkSourceClkHz

mclk source frequency

struct _sai_fifo
#include <fsl_sai.h>

sai fifo configurations

Public Members

bool fifoContinueOneError

fifo continues when error occur

sai_fifo_combine_t fifoCombine

fifo combine mode

sai_fifo_packing_t fifoPacking

fifo packing mode

uint8_t fifoWatermark

fifo watermark

struct _sai_bit_clock
#include <fsl_sai.h>

sai bit clock configurations

Public Members

bool bclkSrcSwap

bit clock source swap

bool bclkInputDelay

bit clock actually used by the transmitter is delayed by the pad output delay, this has effect of decreasing the data input setup time, but increasing the data output valid time .

sai_clock_polarity_t bclkPolarity

bit clock polarity

sai_bclk_source_t bclkSource

bit Clock source

struct _sai_frame_sync
#include <fsl_sai.h>

sai frame sync configurations

Public Members

uint8_t frameSyncWidth

frame sync width in number of bit clocks

bool frameSyncEarly

TRUE is frame sync assert one bit before the first bit of frame FALSE is frame sync assert with the first bit of the frame

bool frameSyncGenerateOnDemand

internal frame sync is generated when FIFO waring flag is clear

sai_clock_polarity_t frameSyncPolarity

frame sync polarity

struct _sai_serial_data
#include <fsl_sai.h>

sai serial data configurations

Public Members

sai_data_pin_state_t dataMode

sai data pin state when slots masked or channel disabled

sai_data_order_t dataOrder

configure whether the LSB or MSB is transmitted first

uint8_t dataWord0Length

configure the number of bits in the first word in each frame

uint8_t dataWordNLength

configure the number of bits in the each word in each frame, except the first word

uint8_t dataWordLength

used to record the data length for dma transfer

uint8_t dataFirstBitShifted

Configure the bit index for the first bit transmitted for each word in the frame

uint8_t dataWordNum

configure the number of words in each frame

uint32_t dataMaskedWord

configure whether the transmit word is masked

struct _sai_transceiver
#include <fsl_sai.h>

sai transceiver configurations

Public Members

sai_serial_data_t serialData

serial data configurations

sai_frame_sync_t frameSync

ws configurations

sai_bit_clock_t bitClock

bit clock configurations

sai_fifo_t fifo

fifo configurations

sai_master_slave_t masterSlave

transceiver is master or slave

sai_sync_mode_t syncMode

transceiver sync mode

uint8_t startChannel

Transfer start channel

uint8_t channelMask

enabled channel mask value, reference _sai_channel_mask

uint8_t endChannel

end channel number

uint8_t channelNums

Total enabled channel numbers

struct _sai_transfer
#include <fsl_sai.h>

SAI transfer structure.

Public Members

uint8_t *data

Data start address to transfer.

size_t dataSize

Transfer size.

struct _sai_handle
#include <fsl_sai.h>

SAI handle structure.

Public Members

I2S_Type *base

base address

uint32_t state

Transfer status

sai_transfer_callback_t callback

Callback function called at transfer event

void *userData

Callback parameter passed to callback function

uint8_t bitWidth

Bit width for transfer, 8/16/24/32 bits

uint8_t channel

Transfer start channel

uint8_t channelMask

enabled channel mask value, refernece _sai_channel_mask

uint8_t endChannel

end channel number

uint8_t channelNums

Total enabled channel numbers

sai_transfer_t saiQueue[(4U)]

Transfer queue storing queued transfer

size_t transferSize[(4U)]

Data bytes need to transfer

volatile uint8_t queueUser

Index for user to queue transfer

volatile uint8_t queueDriver

Index for driver to get the transfer data and size

uint8_t watermark

Watermark value

SAI EDMA Driver

void SAI_TransferTxCreateHandleEDMA(I2S_Type *base, sai_edma_handle_t *handle, sai_edma_callback_t callback, void *userData, edma_handle_t *txDmaHandle)

Initializes the SAI eDMA handle.

This function initializes the SAI master DMA handle, which can be used for other SAI master transactional APIs. Usually, for a specified SAI instance, call this API once to get the initialized handle.

Parameters:
  • base – SAI base pointer.

  • handle – SAI eDMA handle pointer.

  • callback – Pointer to user callback function.

  • userData – User parameter passed to the callback function.

  • txDmaHandle – eDMA handle pointer, this handle shall be static allocated by users.

void SAI_TransferRxCreateHandleEDMA(I2S_Type *base, sai_edma_handle_t *handle, sai_edma_callback_t callback, void *userData, edma_handle_t *rxDmaHandle)

Initializes the SAI Rx eDMA handle.

This function initializes the SAI slave DMA handle, which can be used for other SAI master transactional APIs. Usually, for a specified SAI instance, call this API once to get the initialized handle.

Parameters:
  • base – SAI base pointer.

  • handle – SAI eDMA handle pointer.

  • callback – Pointer to user callback function.

  • userData – User parameter passed to the callback function.

  • rxDmaHandle – eDMA handle pointer, this handle shall be static allocated by users.

void SAI_TransferSetInterleaveType(sai_edma_handle_t *handle, sai_edma_interleave_t interleaveType)

Initializes the SAI interleave type.

This function initializes the SAI DMA handle member interleaveType, it shall be called only when application would like to use type kSAI_EDMAInterleavePerChannelBlock, since the default interleaveType is kSAI_EDMAInterleavePerChannelSample always

Parameters:
  • handle – SAI eDMA handle pointer.

  • interleaveType – Multi channel interleave type.

void SAI_TransferTxSetConfigEDMA(I2S_Type *base, sai_edma_handle_t *handle, sai_transceiver_t *saiConfig)

Configures the SAI Tx.

Note

SAI eDMA supports data transfer in a multiple SAI channels if the FIFO Combine feature is supported. To activate the multi-channel transfer enable SAI channels by filling the channelMask of sai_transceiver_t with the corresponding values of _sai_channel_mask enum, enable the FIFO Combine mode by assigning kSAI_FifoCombineModeEnabledOnWrite to the fifoCombine member of sai_fifo_combine_t which is a member of sai_transceiver_t. This is an example of multi-channel data transfer configuration step.

sai_transceiver_t config;
SAI_GetClassicI2SConfig(&config, kSAI_WordWidth16bits, kSAI_Stereo, kSAI_Channel0Mask|kSAI_Channel1Mask);
config.fifo.fifoCombine = kSAI_FifoCombineModeEnabledOnWrite;
SAI_TransferTxSetConfigEDMA(I2S0, &edmaHandle, &config);

Parameters:
  • base – SAI base pointer.

  • handle – SAI eDMA handle pointer.

  • saiConfig – sai configurations.

void SAI_TransferRxSetConfigEDMA(I2S_Type *base, sai_edma_handle_t *handle, sai_transceiver_t *saiConfig)

Configures the SAI Rx.

Note

SAI eDMA supports data transfer in a multiple SAI channels if the FIFO Combine feature is supported. To activate the multi-channel transfer enable SAI channels by filling the channelMask of sai_transceiver_t with the corresponding values of _sai_channel_mask enum, enable the FIFO Combine mode by assigning kSAI_FifoCombineModeEnabledOnRead to the fifoCombine member of sai_fifo_combine_t which is a member of sai_transceiver_t. This is an example of multi-channel data transfer configuration step.

sai_transceiver_t config;
SAI_GetClassicI2SConfig(&config, kSAI_WordWidth16bits, kSAI_Stereo, kSAI_Channel0Mask|kSAI_Channel1Mask);
config.fifo.fifoCombine = kSAI_FifoCombineModeEnabledOnRead;
SAI_TransferRxSetConfigEDMA(I2S0, &edmaHandle, &config);

Parameters:
  • base – SAI base pointer.

  • handle – SAI eDMA handle pointer.

  • saiConfig – sai configurations.

status_t SAI_TransferSendEDMA(I2S_Type *base, sai_edma_handle_t *handle, sai_transfer_t *xfer)

Performs a non-blocking SAI transfer using DMA.

This function support multi channel transfer,

  1. for the sai IP support fifo combine mode, application should enable the fifo combine mode, no limitation on channel numbers

  2. for the sai IP not support fifo combine mode, sai edma provide another solution which using EDMA modulo feature, but support 2 or 4 channels only.

Note

This interface returns immediately after the transfer initiates. Call SAI_GetTransferStatus to poll the transfer status and check whether the SAI transfer is finished.

Parameters:
  • base – SAI base pointer.

  • handle – SAI eDMA handle pointer.

  • xfer – Pointer to the DMA transfer structure.

Return values:
  • kStatus_Success – Start a SAI eDMA send successfully.

  • kStatus_InvalidArgument – The input argument is invalid.

  • kStatus_TxBusy – SAI is busy sending data.

status_t SAI_TransferReceiveEDMA(I2S_Type *base, sai_edma_handle_t *handle, sai_transfer_t *xfer)

Performs a non-blocking SAI receive using eDMA.

This function support multi channel transfer,

  1. for the sai IP support fifo combine mode, application should enable the fifo combine mode, no limitation on channel numbers

  2. for the sai IP not support fifo combine mode, sai edma provide another solution which using EDMA modulo feature, but support 2 or 4 channels only.

Note

This interface returns immediately after the transfer initiates. Call the SAI_GetReceiveRemainingBytes to poll the transfer status and check whether the SAI transfer is finished.

Parameters:
  • base – SAI base pointer

  • handle – SAI eDMA handle pointer.

  • xfer – Pointer to DMA transfer structure.

Return values:
  • kStatus_Success – Start a SAI eDMA receive successfully.

  • kStatus_InvalidArgument – The input argument is invalid.

  • kStatus_RxBusy – SAI is busy receiving data.

status_t SAI_TransferSendLoopEDMA(I2S_Type *base, sai_edma_handle_t *handle, sai_transfer_t *xfer, uint32_t loopTransferCount)

Performs a non-blocking SAI loop transfer using eDMA.

Once the loop transfer start, application can use function SAI_TransferAbortSendEDMA to stop the loop transfer.

Note

This function support loop transfer only,such as A->B->…->A, application must be aware of that the more counts of the loop transfer, then more tcd memory required, as the function use the tcd pool in sai_edma_handle_t, so application could redefine the SAI_XFER_QUEUE_SIZE to determine the proper TCD pool size. This function support one sai channel only.

Parameters:
  • base – SAI base pointer.

  • handle – SAI eDMA handle pointer.

  • xfer – Pointer to the DMA transfer structure, should be a array with elements counts >=1(loopTransferCount).

  • loopTransferCount – the counts of xfer array.

Return values:
  • kStatus_Success – Start a SAI eDMA send successfully.

  • kStatus_InvalidArgument – The input argument is invalid.

status_t SAI_TransferReceiveLoopEDMA(I2S_Type *base, sai_edma_handle_t *handle, sai_transfer_t *xfer, uint32_t loopTransferCount)

Performs a non-blocking SAI loop transfer using eDMA.

Once the loop transfer start, application can use function SAI_TransferAbortReceiveEDMA to stop the loop transfer.

Note

This function support loop transfer only,such as A->B->…->A, application must be aware of that the more counts of the loop transfer, then more tcd memory required, as the function use the tcd pool in sai_edma_handle_t, so application could redefine the SAI_XFER_QUEUE_SIZE to determine the proper TCD pool size. This function support one sai channel only.

Parameters:
  • base – SAI base pointer.

  • handle – SAI eDMA handle pointer.

  • xfer – Pointer to the DMA transfer structure, should be a array with elements counts >=1(loopTransferCount).

  • loopTransferCount – the counts of xfer array.

Return values:
  • kStatus_Success – Start a SAI eDMA receive successfully.

  • kStatus_InvalidArgument – The input argument is invalid.

void SAI_TransferTerminateSendEDMA(I2S_Type *base, sai_edma_handle_t *handle)

Terminate all SAI send.

This function will clear all transfer slots buffered in the sai queue. If users only want to abort the current transfer slot, please call SAI_TransferAbortSendEDMA.

Parameters:
  • base – SAI base pointer.

  • handle – SAI eDMA handle pointer.

void SAI_TransferTerminateReceiveEDMA(I2S_Type *base, sai_edma_handle_t *handle)

Terminate all SAI receive.

This function will clear all transfer slots buffered in the sai queue. If users only want to abort the current transfer slot, please call SAI_TransferAbortReceiveEDMA.

Parameters:
  • base – SAI base pointer.

  • handle – SAI eDMA handle pointer.

void SAI_TransferAbortSendEDMA(I2S_Type *base, sai_edma_handle_t *handle)

Aborts a SAI transfer using eDMA.

This function only aborts the current transfer slots, the other transfer slots’ information still kept in the handler. If users want to terminate all transfer slots, just call SAI_TransferTerminateSendEDMA.

Parameters:
  • base – SAI base pointer.

  • handle – SAI eDMA handle pointer.

void SAI_TransferAbortReceiveEDMA(I2S_Type *base, sai_edma_handle_t *handle)

Aborts a SAI receive using eDMA.

This function only aborts the current transfer slots, the other transfer slots’ information still kept in the handler. If users want to terminate all transfer slots, just call SAI_TransferTerminateReceiveEDMA.

Parameters:
  • base – SAI base pointer

  • handle – SAI eDMA handle pointer.

status_t SAI_TransferGetSendCountEDMA(I2S_Type *base, sai_edma_handle_t *handle, size_t *count)

Gets byte count sent by SAI.

Parameters:
  • base – SAI base pointer.

  • handle – SAI eDMA handle pointer.

  • count – Bytes count sent by SAI.

Return values:
  • kStatus_Success – Succeed get the transfer count.

  • kStatus_NoTransferInProgress – There is no non-blocking transaction in progress.

status_t SAI_TransferGetReceiveCountEDMA(I2S_Type *base, sai_edma_handle_t *handle, size_t *count)

Gets byte count received by SAI.

Parameters:
  • base – SAI base pointer

  • handle – SAI eDMA handle pointer.

  • count – Bytes count received by SAI.

Return values:
  • kStatus_Success – Succeed get the transfer count.

  • kStatus_NoTransferInProgress – There is no non-blocking transaction in progress.

uint32_t SAI_TransferGetValidTransferSlotsEDMA(I2S_Type *base, sai_edma_handle_t *handle)

Gets valid transfer slot.

This function can be used to query the valid transfer request slot that the application can submit. It should be called in the critical section, that means the application could call it in the corresponding callback function or disable IRQ before calling it in the application, otherwise, the returned value may not correct.

Parameters:
  • base – SAI base pointer

  • handle – SAI eDMA handle pointer.

Return values:

valid – slot count that application submit.

FSL_SAI_EDMA_DRIVER_VERSION

Version 2.7.1

enum _sai_edma_interleave

sai interleave type

Values:

enumerator kSAI_EDMAInterleavePerChannelSample
enumerator kSAI_EDMAInterleavePerChannelBlock
typedef struct sai_edma_handle sai_edma_handle_t
typedef void (*sai_edma_callback_t)(I2S_Type *base, sai_edma_handle_t *handle, status_t status, void *userData)

SAI eDMA transfer callback function for finish and error.

typedef enum _sai_edma_interleave sai_edma_interleave_t

sai interleave type

struct sai_edma_handle
#include <fsl_sai_edma.h>

SAI DMA transfer handle, users should not touch the content of the handle.

Public Members

edma_handle_t *dmaHandle

DMA handler for SAI send

uint8_t nbytes

eDMA minor byte transfer count initially configured.

uint8_t bytesPerFrame

Bytes in a frame

uint8_t channelMask

Enabled channel mask value, reference _sai_channel_mask

uint8_t channelNums

total enabled channel nums

uint8_t channel

Which data channel

uint8_t count

The transfer data count in a DMA request

uint32_t state

Internal state for SAI eDMA transfer

sai_edma_callback_t callback

Callback for users while transfer finish or error occurs

void *userData

User callback parameter

uint8_t tcd[((4U) + 1U) * sizeof(edma_tcd_t)]

TCD pool for eDMA transfer.

sai_transfer_t saiQueue[(4U)]

Transfer queue storing queued transfer.

size_t transferSize[(4U)]

Data bytes need to transfer

sai_edma_interleave_t interleaveType

Transfer interleave type

volatile uint8_t queueUser

Index for user to queue transfer.

volatile uint8_t queueDriver

Index for driver to get the transfer data and size

Sbloader

enum _sectionType

sb3 section definitions

section type

Values:

enumerator kSectionNone

end or invalid

enumerator kSectionDataRange
enumerator kSectionDiffUpdate
enumerator kSectionDDRConfig
enumerator kSectionRegister

Values:

enumerator kFwVerChk_Id_none
enumerator kFwVerChk_Id_nonsecure
enumerator kFwVerChk_Id_secure
enum _loader_command_sb3

loader command enum

Values:

enumerator kSB3_CmdInvalid
enumerator kSB3_CmdErase
enumerator kSB3_CmdLoad
enumerator kSB3_CmdExecute
enumerator kSB3_CmdCall
enumerator kSB3_CmdProgramFuse
enumerator kSB3_CmdProgramIFR
enumerator kSB3_CmdLoadCmac
enumerator kSB3_CmdCopy
enumerator kSB3_CmdLoadHashLocking
enumerator kSB3_CmdLoadKeyBlob
enumerator kSB3_CmdConfigMem
enumerator kSB3_CmdFillMem
enumerator kSB3_CmdFwVerCheck
enum kb_operation_t

Details of the operation to be performed by the ROM.

The kRomAuthenticateImage operation requires the entire signed image to be available to the application.

Values:

enumerator kRomAuthenticateImage

Authenticate a signed image.

enumerator kRomLoadImage

Load SB file.

enumerator kRomOperationCount
typedef uint8_t chunk_v3_t[16]
typedef struct _ldr_buf ldr_buf_t
typedef struct _ldr_Context_v3 ldr_Context_v3_t

Provides forward reference to the loader context definition.

typedef status_t (*pLdrFnc_v3_t)(ldr_Context_v3_t *content)

Function pointer definition for all loader action functions.

typedef enum _sectionType section_type_t

sb3 section definitions

section type

typedef struct range_header sb3_data_range_header_t

section data range structure

typedef struct range_header_expansion sb3_data_range_expansion_t
typedef struct copy_memory_expansion sb3_copy_memory_expansion_t
typedef struct copy sb3_copy_memory_t
typedef struct load_keyblob sb3_load_keyblob_t
typedef struct fill_memory_expansion sb3_fill_memory_expansion_t
typedef struct fill_memory sb3_fill_memory_t
typedef struct config_memory sb3_config_memory_t
typedef struct fw_ver_check sb3_fw_ver_check_t
typedef struct section_header sb3_section_header_t

sb3 DATA section header format

typedef enum _loader_command_sb3 sb3_cmd_t

loader command enum

SB3_BYTES_PER_CHUNK

Defines the number of bytes in a cipher block (chunk). This is dictated by the encryption algorithm.

SB3_DATA_RANGE_HEADER_FLAGS_ERASE_MASK

bit 0

SB3_DATA_RANGE_HEADER_FLAGS_LOAD_MASK

bit 1

SBLOADER_V3_CMD_SET_ALL

The all of the allowed command.

SBLOADER_V3_CMD_SET_IN_ISP_MODE

The allowed command set in ISP mode.

SBLOADER_V3_CMD_SET_IN_REC_MODE

The allowed command set in recovery mode.

SB3_DATA_BUFFER_SIZE_IN_BYTE
struct _ldr_buf
#include <fsl_sbloader_v3.h>
struct range_header
#include <fsl_sbloader_v3.h>

section data range structure

struct range_header_expansion
#include <fsl_sbloader_v3.h>
struct copy_memory_expansion
#include <fsl_sbloader_v3.h>
struct copy
#include <fsl_sbloader_v3.h>
struct load_keyblob
#include <fsl_sbloader_v3.h>
struct fill_memory_expansion
#include <fsl_sbloader_v3.h>

Public Members

uint32_t pattern

word to be used as pattern

struct fill_memory
#include <fsl_sbloader_v3.h>
struct config_memory
#include <fsl_sbloader_v3.h>

Public Members

uint32_t address

address of config blob

struct fw_ver_check
#include <fsl_sbloader_v3.h>
struct section_header
#include <fsl_sbloader_v3.h>

sb3 DATA section header format

struct kb_region_t
#include <fsl_sbloader_v3.h>

Memory region definition.

struct kb_load_sb_t
#include <fsl_sbloader_v3.h>
struct kb_authenticate_t
#include <fsl_sbloader_v3.h>
struct kb_options_t
#include <fsl_sbloader_v3.h>

Public Members

uint32_t version

Should be set to #kKbootApiVersion.

uint8_t *buffer

Caller-provided buffer used by Kboot.

struct _ldr_Context_v3
#include <fsl_sbloader_v3.h>

Loader context definition.

Public Members

pLdrFnc_v3_t Action

pointer to loader action function

uint32_t block_size

size of each block in bytes

uint32_t block_data_size

data size in bytes (NBOOT_SB3_CHUNK_SIZE_IN_BYTES)

uint32_t block_data_total

data max size in bytes (block_size * data_size

uint32_t block_buffer_size

block0 and block size

uint32_t processedBlocks

will be used for both block0 and blockx

bool in_data_block

data block offset in a block. in progress of handling a data block within a block

bool in_data_section

in progress of handling a data section within a data block

bool in_data_range

in progress of handling a data range within a data section

uint32_t commandSet

support command set during sb file handling

uint8_t data_buffer[(MAX(128, NBOOT_KEY_BLOB_SIZE_IN_BYTE_MAX))]

temporary data buffer

kb_options_t fromAPI

options from ROM API

union __unnamed92__

Public Members

kb_authenticate_t authenticate

Settings for #kKbootAuthenticate operation.

kb_load_sb_t loadSB

Settings for #kKbootLoadSB operation.

SCTimer: SCTimer/PWM (SCT)

status_t SCTIMER_Init(SCT_Type *base, const sctimer_config_t *config)

Ungates the SCTimer clock and configures the peripheral for basic operation.

Note

This API should be called at the beginning of the application using the SCTimer driver.

Parameters:
  • base – SCTimer peripheral base address

  • config – Pointer to the user configuration structure.

Returns:

kStatus_Success indicates success; Else indicates failure.

void SCTIMER_Deinit(SCT_Type *base)

Gates the SCTimer clock.

Parameters:
  • base – SCTimer peripheral base address

void SCTIMER_GetDefaultConfig(sctimer_config_t *config)

Fills in the SCTimer configuration structure with the default settings.

The default values are:

config->enableCounterUnify = true;
config->clockMode = kSCTIMER_System_ClockMode;
config->clockSelect = kSCTIMER_Clock_On_Rise_Input_0;
config->enableBidirection_l = false;
config->enableBidirection_h = false;
config->prescale_l = 0U;
config->prescale_h = 0U;
config->outInitState = 0U;
config->inputsync  = 0xFU;

Parameters:
  • config – Pointer to the user configuration structure.

status_t SCTIMER_SetupPwm(SCT_Type *base, const sctimer_pwm_signal_param_t *pwmParams, sctimer_pwm_mode_t mode, uint32_t pwmFreq_Hz, uint32_t srcClock_Hz, uint32_t *event)

Configures the PWM signal parameters.

Call this function to configure the PWM signal period, mode, duty cycle, and edge. This function will create 2 events; one of the events will trigger on match with the pulse value and the other will trigger when the counter matches the PWM period. The PWM period event is also used as a limit event to reset the counter or change direction. Both events are enabled for the same state. The state number can be retrieved by calling the function SCTIMER_GetCurrentStateNumber(). The counter is set to operate as one 32-bit counter (unify bit is set to 1). The counter operates in bi-directional mode when generating a center-aligned PWM.

Note

When setting PWM output from multiple output pins, they all should use the same PWM mode i.e all PWM’s should be either edge-aligned or center-aligned. When using this API, the PWM signal frequency of all the initialized channels must be the same. Otherwise all the initialized channels’ PWM signal frequency is equal to the last call to the API’s pwmFreq_Hz.

Parameters:
  • base – SCTimer peripheral base address

  • pwmParams – PWM parameters to configure the output

  • mode – PWM operation mode, options available in enumeration sctimer_pwm_mode_t

  • pwmFreq_Hz – PWM signal frequency in Hz

  • srcClock_Hz – SCTimer counter clock in Hz

  • event – Pointer to a variable where the PWM period event number is stored

Returns:

kStatus_Success on success kStatus_Fail If we have hit the limit in terms of number of events created or if an incorrect PWM dutycylce is passed in.

void SCTIMER_UpdatePwmDutycycle(SCT_Type *base, sctimer_out_t output, uint8_t dutyCyclePercent, uint32_t event)

Updates the duty cycle of an active PWM signal.

Before calling this function, the counter is set to operate as one 32-bit counter (unify bit is set to 1).

Parameters:
  • base – SCTimer peripheral base address

  • output – The output to configure

  • dutyCyclePercent – New PWM pulse width; the value should be between 1 to 100

  • event – Event number associated with this PWM signal. This was returned to the user by the function SCTIMER_SetupPwm().

static inline void SCTIMER_EnableInterrupts(SCT_Type *base, uint32_t mask)

Enables the selected SCTimer interrupts.

Parameters:
  • base – SCTimer peripheral base address

  • mask – The interrupts to enable. This is a logical OR of members of the enumeration sctimer_interrupt_enable_t

static inline void SCTIMER_DisableInterrupts(SCT_Type *base, uint32_t mask)

Disables the selected SCTimer interrupts.

Parameters:
  • base – SCTimer peripheral base address

  • mask – The interrupts to enable. This is a logical OR of members of the enumeration sctimer_interrupt_enable_t

static inline uint32_t SCTIMER_GetEnabledInterrupts(SCT_Type *base)

Gets the enabled SCTimer interrupts.

Parameters:
  • base – SCTimer peripheral base address

Returns:

The enabled interrupts. This is the logical OR of members of the enumeration sctimer_interrupt_enable_t

static inline uint32_t SCTIMER_GetStatusFlags(SCT_Type *base)

Gets the SCTimer status flags.

Parameters:
  • base – SCTimer peripheral base address

Returns:

The status flags. This is the logical OR of members of the enumeration sctimer_status_flags_t

static inline void SCTIMER_ClearStatusFlags(SCT_Type *base, uint32_t mask)

Clears the SCTimer status flags.

Parameters:
  • base – SCTimer peripheral base address

  • mask – The status flags to clear. This is a logical OR of members of the enumeration sctimer_status_flags_t

static inline void SCTIMER_StartTimer(SCT_Type *base, uint32_t countertoStart)

Starts the SCTimer counter.

Note

In 16-bit mode, we can enable both Counter_L and Counter_H, In 32-bit mode, we only can select Counter_U.

Parameters:
  • base – SCTimer peripheral base address

  • countertoStart – The SCTimer counters to enable. This is a logical OR of members of the enumeration sctimer_counter_t.

static inline void SCTIMER_StopTimer(SCT_Type *base, uint32_t countertoStop)

Halts the SCTimer counter.

Parameters:
  • base – SCTimer peripheral base address

  • countertoStop – The SCTimer counters to stop. This is a logical OR of members of the enumeration sctimer_counter_t.

status_t SCTIMER_CreateAndScheduleEvent(SCT_Type *base, sctimer_event_t howToMonitor, uint32_t matchValue, uint32_t whichIO, sctimer_counter_t whichCounter, uint32_t *event)

Create an event that is triggered on a match or IO and schedule in current state.

This function will configure an event using the options provided by the user. If the event type uses the counter match, then the function will set the user provided match value into a match register and put this match register number into the event control register. The event is enabled for the current state and the event number is increased by one at the end. The function returns the event number; this event number can be used to configure actions to be done when this event is triggered.

Parameters:
  • base – SCTimer peripheral base address

  • howToMonitor – Event type; options are available in the enumeration sctimer_interrupt_enable_t

  • matchValue – The match value that will be programmed to a match register

  • whichIO – The input or output that will be involved in event triggering. This field is ignored if the event type is “match only”

  • whichCounter – SCTimer counter to use. In 16-bit mode, we can select Counter_L and Counter_H, In 32-bit mode, we can select Counter_U.

  • event – Pointer to a variable where the new event number is stored

Returns:

kStatus_Success on success kStatus_Error if we have hit the limit in terms of number of events created or if we have reached the limit in terms of number of match registers

void SCTIMER_ScheduleEvent(SCT_Type *base, uint32_t event)

Enable an event in the current state.

This function will allow the event passed in to trigger in the current state. The event must be created earlier by either calling the function SCTIMER_SetupPwm() or function SCTIMER_CreateAndScheduleEvent() .

Parameters:
  • base – SCTimer peripheral base address

  • event – Event number to enable in the current state

status_t SCTIMER_IncreaseState(SCT_Type *base)

Increase the state by 1.

All future events created by calling the function SCTIMER_ScheduleEvent() will be enabled in this new state.

Parameters:
  • base – SCTimer peripheral base address

Returns:

kStatus_Success on success kStatus_Error if we have hit the limit in terms of states used

uint32_t SCTIMER_GetCurrentState(SCT_Type *base)

Provides the current state.

User can use this to set the next state by calling the function SCTIMER_SetupNextStateAction().

Parameters:
  • base – SCTimer peripheral base address

Returns:

The current state

static inline void SCTIMER_SetCounterState(SCT_Type *base, sctimer_counter_t whichCounter, uint32_t state)

Set the counter current state.

The function is to set the state variable bit field of STATE register. Writing to the STATE_L, STATE_H, or unified register is only allowed when the corresponding counter is halted (HALT bits are set to 1 in the CTRL register).

Parameters:
  • base – SCTimer peripheral base address

  • whichCounter – SCTimer counter to use. In 16-bit mode, we can select Counter_L and Counter_H, In 32-bit mode, we can select Counter_U.

  • state – The counter current state number (only support range from 0~31).

static inline uint16_t SCTIMER_GetCounterState(SCT_Type *base, sctimer_counter_t whichCounter)

Get the counter current state value.

The function is to get the state variable bit field of STATE register.

Parameters:
  • base – SCTimer peripheral base address

  • whichCounter – SCTimer counter to use. In 16-bit mode, we can select Counter_L and Counter_H, In 32-bit mode, we can select Counter_U.

Returns:

The the counter current state value.

status_t SCTIMER_SetupCaptureAction(SCT_Type *base, sctimer_counter_t whichCounter, uint32_t *captureRegister, uint32_t event)

Setup capture of the counter value on trigger of a selected event.

Parameters:
  • base – SCTimer peripheral base address

  • whichCounter – SCTimer counter to use. In 16-bit mode, we can select Counter_L and Counter_H, In 32-bit mode, we can select Counter_U.

  • captureRegister – Pointer to a variable where the capture register number will be returned. User can read the captured value from this register when the specified event is triggered.

  • event – Event number that will trigger the capture

Returns:

kStatus_Success on success kStatus_Error if we have hit the limit in terms of number of match/capture registers available

void SCTIMER_SetCallback(SCT_Type *base, sctimer_event_callback_t callback, uint32_t event)

Receive noticification when the event trigger an interrupt.

If the interrupt for the event is enabled by the user, then a callback can be registered which will be invoked when the event is triggered

Parameters:
  • base – SCTimer peripheral base address

  • event – Event number that will trigger the interrupt

  • callback – Function to invoke when the event is triggered

static inline void SCTIMER_SetupStateLdMethodAction(SCT_Type *base, uint32_t event, bool fgLoad)

Change the load method of transition to the specified state.

Change the load method of transition, it will be triggered by the event number that is passed in by the user.

Parameters:
  • base – SCTimer peripheral base address

  • event – Event number that will change the method to trigger the state transition

  • fgLoad – The method to load highest-numbered event occurring for that state to the STATE register.

    • true: Load the STATEV value to STATE when the event occurs to be the next state.

    • false: Add the STATEV value to STATE when the event occurs to be the next state.

static inline void SCTIMER_SetupNextStateActionwithLdMethod(SCT_Type *base, uint32_t nextState, uint32_t event, bool fgLoad)

Transition to the specified state with Load method.

This transition will be triggered by the event number that is passed in by the user, the method decide how to load the highest-numbered event occurring for that state to the STATE register.

Parameters:
  • base – SCTimer peripheral base address

  • nextState – The next state SCTimer will transition to

  • event – Event number that will trigger the state transition

  • fgLoad – The method to load the highest-numbered event occurring for that state to the STATE register.

    • true: Load the STATEV value to STATE when the event occurs to be the next state.

    • false: Add the STATEV value to STATE when the event occurs to be the next state.

static inline void SCTIMER_SetupNextStateAction(SCT_Type *base, uint32_t nextState, uint32_t event)

Transition to the specified state.

Deprecated:

Do not use this function. It has been superceded by SCTIMER_SetupNextStateActionwithLdMethod

This transition will be triggered by the event number that is passed in by the user.

Parameters:
  • base – SCTimer peripheral base address

  • nextState – The next state SCTimer will transition to

  • event – Event number that will trigger the state transition

static inline void SCTIMER_SetupEventActiveDirection(SCT_Type *base, sctimer_event_active_direction_t activeDirection, uint32_t event)

Setup event active direction when the counters are operating in BIDIR mode.

Parameters:
  • base – SCTimer peripheral base address

  • activeDirection – Event generation active direction, see sctimer_event_active_direction_t.

  • event – Event number that need setup the active direction.

static inline void SCTIMER_SetupOutputSetAction(SCT_Type *base, uint32_t whichIO, uint32_t event)

Set the Output.

This output will be set when the event number that is passed in by the user is triggered.

Parameters:
  • base – SCTimer peripheral base address

  • whichIO – The output to set

  • event – Event number that will trigger the output change

static inline void SCTIMER_SetupOutputClearAction(SCT_Type *base, uint32_t whichIO, uint32_t event)

Clear the Output.

This output will be cleared when the event number that is passed in by the user is triggered.

Parameters:
  • base – SCTimer peripheral base address

  • whichIO – The output to clear

  • event – Event number that will trigger the output change

void SCTIMER_SetupOutputToggleAction(SCT_Type *base, uint32_t whichIO, uint32_t event)

Toggle the output level.

This change in the output level is triggered by the event number that is passed in by the user.

Parameters:
  • base – SCTimer peripheral base address

  • whichIO – The output to toggle

  • event – Event number that will trigger the output change

static inline void SCTIMER_SetupCounterLimitAction(SCT_Type *base, sctimer_counter_t whichCounter, uint32_t event)

Limit the running counter.

The counter is limited when the event number that is passed in by the user is triggered.

Parameters:
  • base – SCTimer peripheral base address

  • whichCounter – SCTimer counter to use. In 16-bit mode, we can select Counter_L and Counter_H, In 32-bit mode, we can select Counter_U.

  • event – Event number that will trigger the counter to be limited

static inline void SCTIMER_SetupCounterStopAction(SCT_Type *base, sctimer_counter_t whichCounter, uint32_t event)

Stop the running counter.

The counter is stopped when the event number that is passed in by the user is triggered.

Parameters:
  • base – SCTimer peripheral base address

  • whichCounter – SCTimer counter to use. In 16-bit mode, we can select Counter_L and Counter_H, In 32-bit mode, we can select Counter_U.

  • event – Event number that will trigger the counter to be stopped

static inline void SCTIMER_SetupCounterStartAction(SCT_Type *base, sctimer_counter_t whichCounter, uint32_t event)

Re-start the stopped counter.

The counter will re-start when the event number that is passed in by the user is triggered.

Parameters:
  • base – SCTimer peripheral base address

  • whichCounter – SCTimer counter to use. In 16-bit mode, we can select Counter_L and Counter_H, In 32-bit mode, we can select Counter_U.

  • event – Event number that will trigger the counter to re-start

static inline void SCTIMER_SetupCounterHaltAction(SCT_Type *base, sctimer_counter_t whichCounter, uint32_t event)

Halt the running counter.

The counter is disabled (halted) when the event number that is passed in by the user is triggered. When the counter is halted, all further events are disabled. The HALT condition can only be removed by calling the SCTIMER_StartTimer() function.

Parameters:
  • base – SCTimer peripheral base address

  • whichCounter – SCTimer counter to use. In 16-bit mode, we can select Counter_L and Counter_H, In 32-bit mode, we can select Counter_U.

  • event – Event number that will trigger the counter to be halted

static inline void SCTIMER_SetupDmaTriggerAction(SCT_Type *base, uint32_t dmaNumber, uint32_t event)

Generate a DMA request.

DMA request will be triggered by the event number that is passed in by the user.

Parameters:
  • base – SCTimer peripheral base address

  • dmaNumber – The DMA request to generate

  • event – Event number that will trigger the DMA request

static inline void SCTIMER_SetCOUNTValue(SCT_Type *base, sctimer_counter_t whichCounter, uint32_t value)

Set the value of counter.

The function is to set the value of Count register, Writing to the COUNT_L, COUNT_H, or unified register is only allowed when the corresponding counter is halted (HALT bits are set to 1 in the CTRL register).

Parameters:
  • base – SCTimer peripheral base address

  • whichCounter – SCTimer counter to use. In 16-bit mode, we can select Counter_L and Counter_H, In 32-bit mode, we can select Counter_U.

  • value – the counter value update to the COUNT register.

static inline uint32_t SCTIMER_GetCOUNTValue(SCT_Type *base, sctimer_counter_t whichCounter)

Get the value of counter.

The function is to read the value of Count register, software can read the counter registers at any time..

Parameters:
  • base – SCTimer peripheral base address

  • whichCounter – SCTimer counter to use. In 16-bit mode, we can select Counter_L and Counter_H, In 32-bit mode, we can select Counter_U.

Returns:

The value of counter selected.

static inline void SCTIMER_SetEventInState(SCT_Type *base, uint32_t event, uint32_t state)

Set the state mask bit field of EV_STATE register.

Parameters:
  • base – SCTimer peripheral base address

  • event – The EV_STATE register be set.

  • state – The state value in which the event is enabled to occur.

static inline void SCTIMER_ClearEventInState(SCT_Type *base, uint32_t event, uint32_t state)

Clear the state mask bit field of EV_STATE register.

Parameters:
  • base – SCTimer peripheral base address

  • event – The EV_STATE register be clear.

  • state – The state value in which the event is disabled to occur.

static inline bool SCTIMER_GetEventInState(SCT_Type *base, uint32_t event, uint32_t state)

Get the state mask bit field of EV_STATE register.

Note

This function is to check whether the event is enabled in a specific state.

Parameters:
  • base – SCTimer peripheral base address

  • event – The EV_STATE register be read.

  • state – The state value.

Returns:

The the state mask bit field of EV_STATE register.

  • true: The event is enable in state.

  • false: The event is disable in state.

static inline uint32_t SCTIMER_GetCaptureValue(SCT_Type *base, sctimer_counter_t whichCounter, uint8_t capChannel)

Get the value of capture register.

This function returns the captured value upon occurrence of the events selected by the corresponding Capture Control registers occurred.

Parameters:
  • base – SCTimer peripheral base address

  • whichCounter – SCTimer counter to use. In 16-bit mode, we can select Counter_L and Counter_H, In 32-bit mode, we can select Counter_U.

  • capChannel – SCTimer capture register of capture channel.

Returns:

The SCTimer counter value at which this register was last captured.

void SCTIMER_EventHandleIRQ(SCT_Type *base)

SCTimer interrupt handler.

Parameters:
  • base – SCTimer peripheral base address.

FSL_SCTIMER_DRIVER_VERSION

Version

enum _sctimer_pwm_mode

SCTimer PWM operation modes.

Values:

enumerator kSCTIMER_EdgeAlignedPwm

Edge-aligned PWM

enumerator kSCTIMER_CenterAlignedPwm

Center-aligned PWM

enum _sctimer_counter

SCTimer counters type.

Values:

enumerator kSCTIMER_Counter_L

16-bit Low counter.

enumerator kSCTIMER_Counter_H

16-bit High counter.

enumerator kSCTIMER_Counter_U

32-bit Unified counter.

enum _sctimer_input

List of SCTimer input pins.

Values:

enumerator kSCTIMER_Input_0

SCTIMER input 0

enumerator kSCTIMER_Input_1

SCTIMER input 1

enumerator kSCTIMER_Input_2

SCTIMER input 2

enumerator kSCTIMER_Input_3

SCTIMER input 3

enumerator kSCTIMER_Input_4

SCTIMER input 4

enumerator kSCTIMER_Input_5

SCTIMER input 5

enumerator kSCTIMER_Input_6

SCTIMER input 6

enumerator kSCTIMER_Input_7

SCTIMER input 7

enum _sctimer_out

List of SCTimer output pins.

Values:

enumerator kSCTIMER_Out_0

SCTIMER output 0

enumerator kSCTIMER_Out_1

SCTIMER output 1

enumerator kSCTIMER_Out_2

SCTIMER output 2

enumerator kSCTIMER_Out_3

SCTIMER output 3

enumerator kSCTIMER_Out_4

SCTIMER output 4

enumerator kSCTIMER_Out_5

SCTIMER output 5

enumerator kSCTIMER_Out_6

SCTIMER output 6

enumerator kSCTIMER_Out_7

SCTIMER output 7

enumerator kSCTIMER_Out_8

SCTIMER output 8

enumerator kSCTIMER_Out_9

SCTIMER output 9

enum _sctimer_pwm_level_select

SCTimer PWM output pulse mode: high-true, low-true or no output.

Values:

enumerator kSCTIMER_LowTrue

Low true pulses

enumerator kSCTIMER_HighTrue

High true pulses

enum _sctimer_clock_mode

SCTimer clock mode options.

Values:

enumerator kSCTIMER_System_ClockMode

System Clock Mode

enumerator kSCTIMER_Sampled_ClockMode

Sampled System Clock Mode

enumerator kSCTIMER_Input_ClockMode

SCT Input Clock Mode

enumerator kSCTIMER_Asynchronous_ClockMode

Asynchronous Mode

enum _sctimer_clock_select

SCTimer clock select options.

Values:

enumerator kSCTIMER_Clock_On_Rise_Input_0

Rising edges on input 0

enumerator kSCTIMER_Clock_On_Fall_Input_0

Falling edges on input 0

enumerator kSCTIMER_Clock_On_Rise_Input_1

Rising edges on input 1

enumerator kSCTIMER_Clock_On_Fall_Input_1

Falling edges on input 1

enumerator kSCTIMER_Clock_On_Rise_Input_2

Rising edges on input 2

enumerator kSCTIMER_Clock_On_Fall_Input_2

Falling edges on input 2

enumerator kSCTIMER_Clock_On_Rise_Input_3

Rising edges on input 3

enumerator kSCTIMER_Clock_On_Fall_Input_3

Falling edges on input 3

enumerator kSCTIMER_Clock_On_Rise_Input_4

Rising edges on input 4

enumerator kSCTIMER_Clock_On_Fall_Input_4

Falling edges on input 4

enumerator kSCTIMER_Clock_On_Rise_Input_5

Rising edges on input 5

enumerator kSCTIMER_Clock_On_Fall_Input_5

Falling edges on input 5

enumerator kSCTIMER_Clock_On_Rise_Input_6

Rising edges on input 6

enumerator kSCTIMER_Clock_On_Fall_Input_6

Falling edges on input 6

enumerator kSCTIMER_Clock_On_Rise_Input_7

Rising edges on input 7

enumerator kSCTIMER_Clock_On_Fall_Input_7

Falling edges on input 7

enum _sctimer_conflict_resolution

SCTimer output conflict resolution options.

Specifies what action should be taken if multiple events dictate that a given output should be both set and cleared at the same time

Values:

enumerator kSCTIMER_ResolveNone

No change

enumerator kSCTIMER_ResolveSet

Set output

enumerator kSCTIMER_ResolveClear

Clear output

enumerator kSCTIMER_ResolveToggle

Toggle output

enum _sctimer_event_active_direction

List of SCTimer event generation active direction when the counters are operating in BIDIR mode.

Values:

enumerator kSCTIMER_ActiveIndependent

This event is triggered regardless of the count direction.

enumerator kSCTIMER_ActiveInCountUp

This event is triggered only during up-counting when BIDIR = 1.

enumerator kSCTIMER_ActiveInCountDown

This event is triggered only during down-counting when BIDIR = 1.

enum _sctimer_event

List of SCTimer event types.

Values:

enumerator kSCTIMER_InputLowOrMatchEvent
enumerator kSCTIMER_InputRiseOrMatchEvent
enumerator kSCTIMER_InputFallOrMatchEvent
enumerator kSCTIMER_InputHighOrMatchEvent
enumerator kSCTIMER_MatchEventOnly
enumerator kSCTIMER_InputLowEvent
enumerator kSCTIMER_InputRiseEvent
enumerator kSCTIMER_InputFallEvent
enumerator kSCTIMER_InputHighEvent
enumerator kSCTIMER_InputLowAndMatchEvent
enumerator kSCTIMER_InputRiseAndMatchEvent
enumerator kSCTIMER_InputFallAndMatchEvent
enumerator kSCTIMER_InputHighAndMatchEvent
enumerator kSCTIMER_OutputLowOrMatchEvent
enumerator kSCTIMER_OutputRiseOrMatchEvent
enumerator kSCTIMER_OutputFallOrMatchEvent
enumerator kSCTIMER_OutputHighOrMatchEvent
enumerator kSCTIMER_OutputLowEvent
enumerator kSCTIMER_OutputRiseEvent
enumerator kSCTIMER_OutputFallEvent
enumerator kSCTIMER_OutputHighEvent
enumerator kSCTIMER_OutputLowAndMatchEvent
enumerator kSCTIMER_OutputRiseAndMatchEvent
enumerator kSCTIMER_OutputFallAndMatchEvent
enumerator kSCTIMER_OutputHighAndMatchEvent
enum _sctimer_interrupt_enable

List of SCTimer interrupts.

Values:

enumerator kSCTIMER_Event0InterruptEnable

Event 0 interrupt

enumerator kSCTIMER_Event1InterruptEnable

Event 1 interrupt

enumerator kSCTIMER_Event2InterruptEnable

Event 2 interrupt

enumerator kSCTIMER_Event3InterruptEnable

Event 3 interrupt

enumerator kSCTIMER_Event4InterruptEnable

Event 4 interrupt

enumerator kSCTIMER_Event5InterruptEnable

Event 5 interrupt

enumerator kSCTIMER_Event6InterruptEnable

Event 6 interrupt

enumerator kSCTIMER_Event7InterruptEnable

Event 7 interrupt

enumerator kSCTIMER_Event8InterruptEnable

Event 8 interrupt

enumerator kSCTIMER_Event9InterruptEnable

Event 9 interrupt

enumerator kSCTIMER_Event10InterruptEnable

Event 10 interrupt

enumerator kSCTIMER_Event11InterruptEnable

Event 11 interrupt

enumerator kSCTIMER_Event12InterruptEnable

Event 12 interrupt

enum _sctimer_status_flags

List of SCTimer flags.

Values:

enumerator kSCTIMER_Event0Flag

Event 0 Flag

enumerator kSCTIMER_Event1Flag

Event 1 Flag

enumerator kSCTIMER_Event2Flag

Event 2 Flag

enumerator kSCTIMER_Event3Flag

Event 3 Flag

enumerator kSCTIMER_Event4Flag

Event 4 Flag

enumerator kSCTIMER_Event5Flag

Event 5 Flag

enumerator kSCTIMER_Event6Flag

Event 6 Flag

enumerator kSCTIMER_Event7Flag

Event 7 Flag

enumerator kSCTIMER_Event8Flag

Event 8 Flag

enumerator kSCTIMER_Event9Flag

Event 9 Flag

enumerator kSCTIMER_Event10Flag

Event 10 Flag

enumerator kSCTIMER_Event11Flag

Event 11 Flag

enumerator kSCTIMER_Event12Flag

Event 12 Flag

enumerator kSCTIMER_BusErrorLFlag

Bus error due to write when L counter was not halted

enumerator kSCTIMER_BusErrorHFlag

Bus error due to write when H counter was not halted

typedef enum _sctimer_pwm_mode sctimer_pwm_mode_t

SCTimer PWM operation modes.

typedef enum _sctimer_counter sctimer_counter_t

SCTimer counters type.

typedef enum _sctimer_input sctimer_input_t

List of SCTimer input pins.

typedef enum _sctimer_out sctimer_out_t

List of SCTimer output pins.

typedef enum _sctimer_pwm_level_select sctimer_pwm_level_select_t

SCTimer PWM output pulse mode: high-true, low-true or no output.

typedef struct _sctimer_pwm_signal_param sctimer_pwm_signal_param_t

Options to configure a SCTimer PWM signal.

typedef enum _sctimer_clock_mode sctimer_clock_mode_t

SCTimer clock mode options.

typedef enum _sctimer_clock_select sctimer_clock_select_t

SCTimer clock select options.

typedef enum _sctimer_conflict_resolution sctimer_conflict_resolution_t

SCTimer output conflict resolution options.

Specifies what action should be taken if multiple events dictate that a given output should be both set and cleared at the same time

typedef enum _sctimer_event_active_direction sctimer_event_active_direction_t

List of SCTimer event generation active direction when the counters are operating in BIDIR mode.

typedef enum _sctimer_event sctimer_event_t

List of SCTimer event types.

typedef void (*sctimer_event_callback_t)(void)

SCTimer callback typedef.

typedef enum _sctimer_interrupt_enable sctimer_interrupt_enable_t

List of SCTimer interrupts.

typedef enum _sctimer_status_flags sctimer_status_flags_t

List of SCTimer flags.

typedef struct _sctimer_config sctimer_config_t

SCTimer configuration structure.

This structure holds the configuration settings for the SCTimer peripheral. To initialize this structure to reasonable defaults, call the SCTMR_GetDefaultConfig() function and pass a pointer to the configuration structure instance.

The configuration structure can be made constant so as to reside in flash.

SCT_EV_STATE_STATEMSKn(x)
struct _sctimer_pwm_signal_param
#include <fsl_sctimer.h>

Options to configure a SCTimer PWM signal.

Public Members

sctimer_out_t output

The output pin to use to generate the PWM signal

sctimer_pwm_level_select_t level

PWM output active level select.

uint8_t dutyCyclePercent

PWM pulse width, value should be between 0 to 100 0 = always inactive signal (0% duty cycle) 100 = always active signal (100% duty cycle).

struct _sctimer_config
#include <fsl_sctimer.h>

SCTimer configuration structure.

This structure holds the configuration settings for the SCTimer peripheral. To initialize this structure to reasonable defaults, call the SCTMR_GetDefaultConfig() function and pass a pointer to the configuration structure instance.

The configuration structure can be made constant so as to reside in flash.

Public Members

bool enableCounterUnify

true: SCT operates as a unified 32-bit counter; false: SCT operates as two 16-bit counters. User can use the 16-bit low counter and the 16-bit high counters at the same time; for Hardware limit, user can not use unified 32-bit counter and any 16-bit low/high counter at the same time.

sctimer_clock_mode_t clockMode

SCT clock mode value

sctimer_clock_select_t clockSelect

SCT clock select value

bool enableBidirection_l

true: Up-down count mode for the L or unified counter false: Up count mode only for the L or unified counter

bool enableBidirection_h

true: Up-down count mode for the H or unified counter false: Up count mode only for the H or unified counter. This field is used only if the enableCounterUnify is set to false

uint8_t prescale_l

Prescale value to produce the L or unified counter clock

uint8_t prescale_h

Prescale value to produce the H counter clock. This field is used only if the enableCounterUnify is set to false

uint8_t outInitState

Defines the initial output value

uint8_t inputsync

SCT INSYNC value, INSYNC field in the CONFIG register, from bit9 to bit 16. it is used to define synchronization for input N: bit 9 = input 0 bit 10 = input 1 bit 11 = input 2 bit 12 = input 3 All other bits are reserved (bit13 ~bit 16). How User to set the the value for the member inputsync. IE: delay for input0, and input 1, bypasses for input 2 and input 3 MACRO definition in user level. #define INPUTSYNC0 (0U) #define INPUTSYNC1 (1U) #define INPUTSYNC2 (2U) #define INPUTSYNC3 (3U) User Code. sctimerInfo.inputsync = (1 << INPUTSYNC2) | (1 << INPUTSYNC3);

SDADC: SDADC Module

void SDADC_GetDefaultConfig(sdadc_config_t *config)

This function is used to get available predefined configurations for the SDADC initialization.

Parameters:
  • config – Pointer to the SDADC configuration structure, please refer to sdadc_config_t for details.

void SDADC_Init(SDADC_Type *base, const sdadc_config_t *config)

This function is used to initialize the SDADC.

Parameters:
  • base – SDADC peripheral base address.

  • config – Pointer to the SDADC configuration structure, please refer to sdadc_config_t for details.

void SDADC_Deinit(SDADC_Type *base, const sdadc_config_t *config)

This function is used to de-initialize the SDADC.

Parameters:
  • base – SDADC peripheral base address.

  • config – Pointer to the SDADC configuration structure, please refer to sdadc_config_t for details.

void SDADC_DoInitPowerUp(SDADC_Type *base, sdadc_config_t *config, uint32_t clock)

This function is used to power up the SDADC in the initialization state.

Parameters:
  • base – SDADC peripheral base address.

  • config – Pointer to the SDADC configuration structure, please refer to sdadc_config_t for details.

  • clock – Core clock frequency with Hz.

static inline void SDADC_ControlModulatorPowerEnable(SDADC_Type *base, sdadc_channel_number_t number, sdadc_channel_type_t type, bool enable)

This function is used to enable or disable SDADC specific channel’s P-Side or/and N-Side sigma-delta modulator power.

Parameters:
  • base – SDADC peripheral base address.

  • number – channel number, refer sdadc_channel_number_t for details.

  • type – channel type, refer sdadc_channel_type_t for details.

  • enable – Decides whether to enable or disable.

    • true Enable

    • false Disable

static inline void SDADC_ControlReferencePowerEnable(SDADC_Type *base, bool enable)

This function is used to enable or disable the reference power.

Parameters:
  • base – SDADC peripheral base address.

  • enable – Indicates enable or disable the reference power.

    • true Enable

    • false Disable

static inline void SDADC_ConfigureReferenceMode(SDADC_Type *base, sdadc_ref_mode_t referenceMode)

This function is used to configure the reference mode.

Note

Setting the reference to fast charge mode is mainly used during startup where fast startup is required, the current consumption in this mode is the largest, so, it is recommended to switch to other modes to minimize current consumption. If the ADC works on the single-end mode, recommend switching to the low-noise mode, if the ADC works on the differential mode, recommend switching to the retain mode.

Parameters:
  • base – SDADC peripheral base address.

  • referenceMode – Reference mode to be configured, see sdadc_ref_mode_t for details.

static inline void SDADC_ControlLdoPowerEnable(SDADC_Type *base, bool enable)

This function is used to enable or disable the LDO power.

Parameters:
  • base – SDADC peripheral base address.

  • enable – Indicates enable or disable the LDO power.

    • true Enable

    • false Disable

static inline void SDADC_ConfigureLdoDriveCapability(SDADC_Type *base, sdadc_ldo_drive_capability_t capability)

This function is used to configure the drive capability.

Parameters:
  • base – SDADC peripheral base address.

  • capability – SDADC LDO drive capability to be set, see sdadc_ldo_drive_capability_t for details.

static inline void SDADC_ConfigureChannelMode(SDADC_Type *base, sdadc_channel_number_t number, sdadc_channel_mode_t mode)

This function is used to configure the channel mode.

Parameters:
  • base – SDADC peripheral base address.

  • number – channel number, refer sdadc_channel_number_t for details.

  • mode – channel mode, refer sdadc_channel_mode_t for details.

static inline void SDADC_ControlDacCompensationEnable(SDADC_Type *base, sdadc_channel_number_t number, sdadc_channel_type_t type, bool enable)

This function is used to enable or disable the DAC compensation function.

Parameters:
  • base – SDADC peripheral base address.

  • number – channel number, refer sdadc_channel_number_t for details.

  • type – channel type, refer sdadc_channel_type_t for details.

  • enable – Decides whether to enable or disable.

    • true Enable

    • false Disable

static inline void SDADC_ControlModulatorDcLoopEnable(SDADC_Type *base, sdadc_channel_number_t number, sdadc_channel_type_t type, bool enable)

This function is used to enable or disable the modulator DC Loop function.

Parameters:
  • base – SDADC peripheral base address.

  • number – channel number, refer sdadc_channel_number_t for details.

  • type – channel type, refer sdadc_channel_type_t for details.

  • enable – Decides whether to enable or disable.

    • true Enable

    • false Disable

static inline void SDADC_ControlDecimatorDcFilterEnable(SDADC_Type *base, sdadc_channel_number_t number, sdadc_channel_type_t type, bool enable)

This function is used to enable or disable the decimator DC Filter function.

Parameters:
  • base – SDADC peripheral base address.

  • number – channel number, refer sdadc_channel_number_t for details.

  • type – channel type, refer sdadc_channel_type_t for details.

  • enable – Decides whether to enable or disable.

    • true Enable

    • false Disable

static inline void SDADC_ControlDecimatorOutputInvertEnable(SDADC_Type *base, sdadc_channel_number_t number, sdadc_channel_type_t type, bool enable)

This function is used to enable or disable the decimator output invert.

Parameters:
  • base – SDADC peripheral base address.

  • number – channel number, refer sdadc_channel_number_t for details.

  • type – channel type, refer sdadc_channel_type_t for details.

  • enable – Decides whether to enable or disable.

    • true Enable

    • false Disable

static inline void SDADC_ConfigureDecimatorVolume(SDADC_Type *base, sdadc_channel_number_t number, sdadc_channel_type_t type, sdadc_volume_control_t volume)

This function is used to configure the decimator volume.

Parameters:
  • base – SDADC peripheral base address.

  • number – channel number, refer sdadc_channel_number_t for details.

  • type – channel type, refer sdadc_channel_type_t for details.

  • volume – Volume level, see sdadc_volume_control_t for details.

static inline void SDADC_ConfigureDecimatorSampleRate(SDADC_Type *base, sdadc_channel_number_t number, sdadc_channel_type_t type, sdadc_sample_rate_t sampleRate)

This function is used to configure the decimator sample rate.

Parameters:
  • base – SDADC peripheral base address.

  • number – channel number, refer sdadc_channel_number_t for details.

  • type – channel type, refer sdadc_channel_type_t for details.

  • sampleRate – Sample rate, see sdadc_sample_rate_t for details.

static inline void SDADC_ConfigureDitherAmplitude(SDADC_Type *base, sdadc_channel_number_t number, uint8_t ditherAmplitude)

This function is used to set the dither amplitude.

In the ADC conversion process, adding dither can improve the ADC dynamic performance, but too large a dither will cause the input signal to overflow, the user needs to set the appropriate dither amplitude according to their own needs.

Parameters:
  • base – SDADC peripheral base address.

  • number – channel number, refer sdadc_channel_number_t for details.

  • ditherAmplitude – The dither amplitude that will be introduced, the range is from 000b to 111b, 000b means disable the dither.

static inline void SDADC_ControlModulatorReset(SDADC_Type *base, sdadc_channel_number_t number, sdadc_channel_type_t type, bool reset)

This function is used to reset or release reset for the SDADC specific channel’s P-Side or N-Side sigma-delta modulator.

Note

Needs to be reset for at least 15us after start-up, and then release the reset.

Parameters:
  • base – SDADC peripheral base address.

  • number – channel number, refer sdadc_channel_number_t for details.

  • type – channel type, refer sdadc_channel_type_t for details.

  • reset – Indicates reset or release reset for the sigma-delta modulator.

    • true Reset

    • false Release reset

static inline void SDADC_ControlDecimatorReset(SDADC_Type *base, sdadc_channel_number_t number, sdadc_channel_type_t type, bool reset)

This function is used to reset or release reset for the SDADC channeln’s P-Side or/and N-Side decimator.

Parameters:
  • base – SDADC peripheral base address.

  • number – channel number, refer sdadc_channel_number_t for details.

  • type – channel type, refer sdadc_channel_type_t for details.

  • reset – Indicates reset or release reset for the decimator.

    • true Reset

    • false Release reset

static inline void SDADC_ConfigureModulatorDcLoopReset(SDADC_Type *base, sdadc_channel_number_t number, sdadc_channel_type_t type, bool reset)

This function is used to reset or release reset for the SDADC channeln’s P-Side or/and N-Side madulator DC Loop.

Parameters:
  • base – SDADC peripheral base address.

  • number – channel number, refer sdadc_channel_number_t for details.

  • type – channel type, refer sdadc_channel_type_t for details.

  • reset – Indicates whether reset or release reset for the madulator DC Loop.

    • true Reset

    • false Release reset

static inline void SDADC_ControlGlobalFifoIntEnable(SDADC_Type *base, bool enable)

This function is used to enable or disable the global FIFO full interrupt.

Parameters:
  • base – SDADC peripheral base address.

  • enable – Indicates whether enable or disable the global FIFO full interrupt.

    • true Enable interrupt

    • false Disable interrupt

static inline bool SDADC_CheckGlobalFifoInterrupted(SDADC_Type *base)

This function is used to check whether the FIFO full interrupt has occurred.

Parameters:
  • base – SDADC peripheral base address.

Returns:

The FIFO full interrupt status flag.

  • true The FIFO full interrupt has occurred.

  • false The FIFO full interrupt has not occurred.

static inline void SDADC_ClearGlobalFifoIntStatusFlag(SDADC_Type *base)

This function is used to clear the FIFO full interrupt status flag.

Parameters:
  • base – SDADC peripheral base address.

static inline void SDADC_ControlFifoIntEnable(SDADC_Type *base, uint32_t mask, bool enable)

This function is used to enable or disable the FIFO full interrupt.

Parameters:
  • base – SDADC peripheral base address.

  • mask – Mask value to enable or disable interrupt, please refer to _sdadc_fifo_int_enable for details.

  • enable – Indicates enable or disable the FIFO full interrupt.

    • true Enable interrupt

    • false Disable interrupt

static inline void SDADC_ControlFifoWatermarkEnable(SDADC_Type *base, uint32_t mask, bool enable)

This function is used to enable or disable the FIFO watermark.

Parameters:
  • base – SDADC peripheral base address.

  • mask – Mask value to enable or disable watermark, please refer to _sdadc_fifo_watermark_enable for details.

  • enable – Indicates enable or disable the FIFO watermark.

    • true Enable watermark

    • false Disable watermark

static inline uint8_t SDADC_GetFifoIntStatusFlags(SDADC_Type *base)

This function is used to get the FIFO full interrupt status flags.

Parameters:
  • base – SDADC peripheral base address.

Returns:

Status flags of the FIFO full interrupt.

static inline uint8_t SDADC_GetFifoWatermarkStatusFlags(SDADC_Type *base)

This function is used to get the FIFO watermark status flags.

Parameters:
  • base – SDADC peripheral base address.

Returns:

Status flags of the FIFO watermark.

static inline void SDADC_ConfigureFifoWatermark(SDADC_Type *base, sdadc_channel_number_t number, sdadc_channel_type_t type, sdadc_watermark_t waterMark)

This function is used to configure FIFO watermark.

Parameters:
  • base – SDADC peripheral base address.

  • number – channel number, refer sdadc_channel_number_t for details.

  • type – channel type, refer sdadc_channel_type_t for details.

  • waterMark – WaterMark value, see sdadc_watermark_t for details.

static inline void SDADC_ControlFifoReadWriteReset(SDADC_Type *base, sdadc_channel_number_t number, sdadc_channel_type_t type, sdadc_fifo_reset_operation_t operation)

This function is used to reset the specific channel side FIFO’s read or/and write pointer.

Parameters:
  • base – SDADC peripheral base address.

  • number – channel number, refer sdadc_channel_number_t for details.

  • type – channel type, refer sdadc_channel_type_t for details.

  • operation – Indicates which reset operation to do, refer sdadc_fifo_reset_operation_t for details.

static inline uint8_t SDADC_GetConvChannelFifoAvailableEntries(SDADC_Type *base, sdadc_channel_number_t number, sdadc_channel_type_t type)

This function is used to get the specific channel side FIFO’s available entries.

Note

In the differential mode, the bit stream is converted to 24bit data (FIFO_x_P[23:0]) by the P-Side decimator, the output of N-Side decimator (FIFO_x_N[23:0]) is not valid.

Parameters:
  • base – SDADC peripheral base address.

  • number – channel number, refer sdadc_channel_number_t for details.

  • type – channel type, refer sdadc_channel_type_t for details.

Returns:

The available entries of the specified FIFO, note that only the lower 5 bits of the returned data are valid.

static inline uint32_t SDADC_GetConvChannelFifoRawData(SDADC_Type *base, sdadc_channel_number_t number, sdadc_channel_type_t type)

This function is used to get the specific channel side FIFO’s raw data.

Note

In the differential mode, the bit stream is converted to 24bit data (FIFO_x_P[23:0]) by the P-Side decimator, the output of N-Side decimator (FIFO_x_N[23:0]) is not valid. So the type that needs to be passed in in differential mode is kSDADC_Channel_PSide_Type.

Parameters:
  • base – SDADC peripheral base address.

  • number – channel number, refer sdadc_channel_number_t for details.

  • type – channel type, refer sdadc_channel_type_t for details.

Returns:

The raw data of the specified FIFO.

void SDADC_CopyConvChannelFifoToBuffer(SDADC_Type *base, sdadc_channel_group *group, uint8_t count, void *buffer)

This function is used to copy specific conversion channels’ data from FIFO to buffer.

Note

This function will copy all 16 entries in the specified FIFO.

Parameters:
  • base – SDADC peripheral base address.

  • group – Indicates which group of channels data to obtain.

  • count – Indicates how many channels in the specified group.

  • buffer – The buffer which stores conversion data.

FSL_SDADC_DRIVER_VERSION

SDADC driver version 2.0.1.

enum _sdadc_fifo_int_enable

This enumeration provides the mask for the SDADC channel P-Side and N-Side FIFO full interrupt enable/disable.

Values:

enumerator kSDADC_Channel0_PSide_FifoFullIntEnable
enumerator kSDADC_Channel0_NSide_FifoFullIntEnable
enumerator kSDADC_Channel1_PSide_FifoFullIntEnable
enumerator kSDADC_Channel1_NSide_FifoFullIntEnable
enumerator kSDADC_Channel2_PSide_FifoFullIntEnable
enumerator kSDADC_Channel2_NSide_FifoFullIntEnable
enumerator kSDADC_Channel3_PSide_FifoFullIntEnable
enumerator kSDADC_Channel3_NSide_FifoFullIntEnable
enum _sdadc_fifo_watermark_enable

This enumeration provides the mask for the SDADC channel P-Side and N-Side FIFO watermark enable/disable.

Values:

enumerator kSDADC_Channel0_PSide_FifoWatermarkEnable
enumerator kSDADC_Channel0_NSide_FifoWatermarkEnable
enumerator kSDADC_Channel1_PSide_FifoWatermarkEnable
enumerator kSDADC_Channel1_NSide_FifoWatermarkEnable
enumerator kSDADC_Channel2_PSide_FifoWatermarkEnable
enumerator kSDADC_Channel2_NSide_FifoWatermarkEnable
enumerator kSDADC_Channel3_PSide_FifoWatermarkEnable
enumerator kSDADC_Channel3_NSide_FifoWatermarkEnable
enum _sdadc_fifo_int_status_flag

This enumeration provides the mask for the SDADC channel P-Side and N-Side FIFO full interrupt status flag.

Values:

enumerator kSDADC_Channel0_PSide_FifoFullIntStatusFlag
enumerator kSDADC_Channel0_NSide_FifoFullIntStatusFlag
enumerator kSDADC_Channel1_PSide_FifoFullIntStatusFlag
enumerator kSDADC_Channel1_NSide_FifoFullIntStatusFlag
enumerator kSDADC_Channel2_PSide_FifoFullIntStatusFlag
enumerator kSDADC_Channel2_NSide_FifoFullIntStatusFlag
enumerator kSDADC_Channel3_PSide_FifoFullIntStatusFlag
enumerator kSDADC_Channel3_NSide_FifoFullIntStatusFlag
enum _sdadc_fifo_watermark_status_flag

This enumeration provides the mask for the SDADC channel P-Side and N-Side FIFO watermark status flag.

Values:

enumerator kSDADC_Channel0_PSide_FifoWatermarkStatusFlag
enumerator kSDADC_Channel0_NSide_FifoWatermarkStatusFlag
enumerator kSDADC_Channel1_PSide_FifoWatermarkStatusFlag
enumerator kSDADC_Channel1_NSide_FifoWatermarkStatusFlag
enumerator kSDADC_Channel2_PSide_FifoWatermarkStatusFlag
enumerator kSDADC_Channel2_NSide_FifoWatermarkStatusFlag
enumerator kSDADC_Channel3_PSide_FifoWatermarkStatusFlag
enumerator kSDADC_Channel3_NSide_FifoWatermarkStatusFlag
enum _sdadc_channel_mode

This enumeration provides the selection of the SDADC channel mode.

Values:

enumerator kSDADC_SingleEnd_Mode

Single-end mode.

enumerator kSDADC_Differential_Mode

Differential mode.

enum _sdadc_channel_number

This enumeration provides the selection of the SDADC channel number.

Values:

enumerator kSDADC_Channel0

SDADC channel 0.

enumerator kSDADC_Channel1

SDADC channel 1.

enumerator kSDADC_Channel2

SDADC channel 2.

enumerator kSDADC_Channel3

SDADC channel 3.

enum _sdadc_channel_type

This enumeration provides the selection of the SDADC channel type.

Values:

enumerator kSDADC_Channel_NSide_Type

N-side selected.

enumerator kSDADC_Channel_PSide_Type

P-side selected.

enumerator kSDADC_Channel_NandPSide_Type

N- and P-side selected.

enum _sdadc_decimator_sample_rate

This enumeration provides the selection of the SDADC decimator sample rate.

Values:

enumerator kSDADC_DecimatorSampleRate48kHz

48kHz decimator sample rate.

enumerator kSDADC_DecimatorSampleRate32kHz

32kHz decimator sample rate.

enumerator kSDADC_DecimatorSampleRate16kHz

16kHz decimator sample rate.

enum _sdadc_ldo_drive_capability

This enumeration provides the selection of the SDADC LDO drive capability.

Values:

enumerator kSDADC_LdoLowPower

To drive 1 single-end mode or 1 differential mode SDADC.

enumerator kSDADC_LdoHighPower

To drive more than 1 SDADC

enum _sdadc_ref_mode

This enumeration provides the selection of the SDADC reference mode.

The SDADC reference module has four modes, these modes are controlled via REF_CTL register ‘fast_ref_enable’ and ‘pwr_fast_ref_enable’ bitfields. 1.Retain mode: pwr_fast_ref_enable = 0b, fast_ref_enable = 0b. 2.Low noise mode: pwr_fast_ref_enable = 0b, fast_ref_enable = 1b. 3.Low power mode: pwr_fast_ref_enable = 1b, fast_ref_enable = 0b. 4.Fast charge mode: pwr_fast_ref_enable = 1b, fast_ref_enable = 1b.

Values:

enumerator kSDADC_RefRetainMode

Reference in retain mode.

enumerator kSDADC_RefLowNoiseMode

Reference in low noise mode.

enumerator kSDADC_RefLowPowerMode

Reference in low power mode.

enumerator kSDADC_RefFastChargeMode

Reference in fast charge mode.

enum _sdadc_fifo_reset_operation

This enumeration provides the selection of the SDADC FIFO write or/and read operation.

Values:

enumerator kSDADC_FifoWriteReset

FIFO write reset.

enumerator kSDADC_FifoReadReset

FIFO read reset.

enumerator kSDADC_FifoWriteAndReadReset

FIFO write and read reset.

typedef enum _sdadc_channel_mode sdadc_channel_mode_t

This enumeration provides the selection of the SDADC channel mode.

typedef enum _sdadc_channel_number sdadc_channel_number_t

This enumeration provides the selection of the SDADC channel number.

typedef enum _sdadc_channel_type sdadc_channel_type_t

This enumeration provides the selection of the SDADC channel type.

typedef enum _sdadc_decimator_sample_rate sdadc_decimator_sample_rate_t

This enumeration provides the selection of the SDADC decimator sample rate.

typedef enum _sdadc_ldo_drive_capability sdadc_ldo_drive_capability_t

This enumeration provides the selection of the SDADC LDO drive capability.

typedef enum _sdadc_ref_mode sdadc_ref_mode_t

This enumeration provides the selection of the SDADC reference mode.

The SDADC reference module has four modes, these modes are controlled via REF_CTL register ‘fast_ref_enable’ and ‘pwr_fast_ref_enable’ bitfields. 1.Retain mode: pwr_fast_ref_enable = 0b, fast_ref_enable = 0b. 2.Low noise mode: pwr_fast_ref_enable = 0b, fast_ref_enable = 1b. 3.Low power mode: pwr_fast_ref_enable = 1b, fast_ref_enable = 0b. 4.Fast charge mode: pwr_fast_ref_enable = 1b, fast_ref_enable = 1b.

typedef enum _sdadc_fifo_reset_operation sdadc_fifo_reset_operation_t

This enumeration provides the selection of the SDADC FIFO write or/and read operation.

typedef struct _sdadc_volume sdadc_volume_control_t

This structure is used to configure the decimator volume (gain).

Note

The gain setting is not applicable for the channel N-Side when executing the differential mode. For the specific gain setting value please refer to the reference manual.

typedef struct _sdadc_sample_rate sdadc_sample_rate_t

This structure is used to configure the decimator sample rate.

typedef struct _sdadc_watermark sdadc_watermark_t

This structure is used to configure the FIFO watermark.

Note

In the differential mode, the bitstream is converted to 24bit data (FIFO_x_P[23:0]) by P-Side decimator, the output of N-Side decimator (FIFO_x_N[23:0]) is not valid.

typedef struct _sdadc_channel_config sdadc_channel_config_t

This structure is used to configure the SDADC channels.

typedef struct _sdadc_config sdadc_config_t

This structure is used to configure the SDADC module.

typedef struct _sdadc_channel_group sdadc_channel_group

This structure is used to construct channel groups.

SDADC_DECIMATOR_VOL_CTRL_P_MASK(offset)

Macros are used to configure decimator volume.

SDADC_DECIMATOR_VOL_CTRL_P_SHIFT(offset)
SDADC_DECIMATOR_VOL_CTRL_P(volume, offset)
SDADC_DECIMATOR_VOL_CTRL_N_MASK(offset)
SDADC_DECIMATOR_VOL_CTRL_N_SHIFT(offset)
SDADC_DECIMATOR_VOL_CTRL_N(volume, offset)
SDADC_DECIMATOR_SET_SPEED_P_MASK(offset)

Macros are used to configure decimator sample rate.

SDADC_DECIMATOR_SET_SPEED_P_SHIFT(offset)
SDADC_DECIMATOR_SET_SPEED_P(rate, offset)
SDADC_DECIMATOR_SET_SPEED_N_MASK(offset)
SDADC_DECIMATOR_SET_SPEED_N_SHIFT(offset)
SDADC_DECIMATOR_SET_SPEED_N(rate, offset)
SDADC_ADC_CTL_2_SET_DITHER_MASK(offset)

Macros are used to configure the dither amplitude.

SDADC_ADC_CTL_2_SET_DITHER_SHIFT(offset)
SDADC_ADC_CTL_2_SET_DITHER(val, offset)
SDADC_FIFO_WATERMARK_CTL_P_MASK(offset)

Macros are used to configure FIFO watermark.

SDADC_FIFO_WATERMARK_CTL_P_SHIFT(offset)
SDADC_FIFO_WATERMARK_CTL_P(watermark, offset)
SDADC_FIFO_WATERMARK_CTL_N_MASK(offset)
SDADC_FIFO_WATERMARK_CTL_N_SHIFT(offset)
SDADC_FIFO_WATERMARK_CTL_N(watermark, offset)
SDADC_FIFO_WATERMARK_STATUS_MASK

Macros are used for FIFO operations.

SDADC_FIFO_WATERMARK_STATUS_SHIFT
SDADC_FIFO_FULL_INT_STATUS_MASK
SDADC_FIFO_FULL_INT_STATUS_SHIFT
SDADC_FIFO_MASK
SDADC_FIFO_SHIFT
SDADC_FIFO_ENTRIES_AVAIL_MASK
SDADC_FIFO_DEPTH
SDADC_FIFO_WIDTH
struct _sdadc_volume
#include <fsl_sdadc.h>

This structure is used to configure the decimator volume (gain).

Note

The gain setting is not applicable for the channel N-Side when executing the differential mode. For the specific gain setting value please refer to the reference manual.

Public Members

uint8_t pSideVolume

Sets the gain for the P-Side decimator.

uint8_t nSideVolume

Sets the gain for the N-Side decimator.

struct _sdadc_sample_rate
#include <fsl_sdadc.h>

This structure is used to configure the decimator sample rate.

Public Members

sdadc_decimator_sample_rate_t pSideSampleRate

Sets the P-Side decimator sample rate.

sdadc_decimator_sample_rate_t nSideSampleRate

Sets the N-Side decimator sample rate.

struct _sdadc_watermark
#include <fsl_sdadc.h>

This structure is used to configure the FIFO watermark.

Note

In the differential mode, the bitstream is converted to 24bit data (FIFO_x_P[23:0]) by P-Side decimator, the output of N-Side decimator (FIFO_x_N[23:0]) is not valid.

Public Members

uint8_t pSideWatermark

Sets the channel N-Side FIFO watermark.

uint8_t nSideWatermark

Sets the channel P-Side FIFO watermark.

struct _sdadc_channel_config
#include <fsl_sdadc.h>

This structure is used to configure the SDADC channels.

Public Members

sdadc_channel_mode_t mode

Sets channel mode.

sdadc_channel_number_t number

Sets channel number.

sdadc_channel_type_t type

Sets channel type.

sdadc_volume_control_t volume

Sets N- and P-side decimator volume.

sdadc_sample_rate_t samplerate

Sets N- and P-side decimator samplerate.

sdadc_watermark_t watermark

Sets N- and P-side FIFO watermark.

bool enableDacCompensation

Decides whether to enable the compensation feature for the ADCp[3:0] or/and ADCn[3:0] in the single-end mode, is used to avoid large data-dependent ripple on LDO output which will impact the ADC performance.

bool enableDCLoop

In some cases of the single-end mode, the microphone output is connected directly to ADC input without the coupling capacitor, DC Loop is activated to regulate input common-mode voltage of the ADCp[3:0] or/and ADCn[3:0]. In the single-end mode, there is the possibility to connect MEMS or JFET microphone directly to the input (DC-coupled). In this configuration, DC Loop mode needs to be activated to establish the correct common mode input voltage level at the input pin. The DC Loop function should disabled in the differential mode.

bool enableDcFilter

Decides whether to enable the decimator DC Filter to remove DC components.

bool enablePolarityInvert

Decides whether to enable the polarity invert function, for example: if the input to ADC is a pure sinus signal, then if the polarity invert is enabled, the decimation output will be a sinus signal 180 out of phase with the input.

struct _sdadc_config
#include <fsl_sdadc.h>

This structure is used to configure the SDADC module.

Public Members

uint8_t channelCount

Indicates how many channels to execute the conversion.

sdadc_channel_config_t *channelConfig

SDADC channels configuration.

struct _sdadc_channel_group
#include <fsl_sdadc.h>

This structure is used to construct channel groups.

Public Members

sdadc_channel_number_t number

Channel number.

sdadc_channel_type_t type

Channel type.

SEMA42: Hardware Semaphores Driver

FSL_SEMA42_DRIVER_VERSION

SEMA42 driver version.

SEMA42 status return codes.

Values:

enumerator kStatus_SEMA42_Busy

SEMA42 gate has been locked by other processor.

enumerator kStatus_SEMA42_Reseting

SEMA42 gate reseting is ongoing.

enum _sema42_gate_status

SEMA42 gate lock status.

Values:

enumerator kSEMA42_Unlocked

The gate is unlocked.

enumerator kSEMA42_LockedByProc0

The gate is locked by processor 0.

enumerator kSEMA42_LockedByProc1

The gate is locked by processor 1.

enumerator kSEMA42_LockedByProc2

The gate is locked by processor 2.

enumerator kSEMA42_LockedByProc3

The gate is locked by processor 3.

enumerator kSEMA42_LockedByProc4

The gate is locked by processor 4.

enumerator kSEMA42_LockedByProc5

The gate is locked by processor 5.

enumerator kSEMA42_LockedByProc6

The gate is locked by processor 6.

enumerator kSEMA42_LockedByProc7

The gate is locked by processor 7.

enumerator kSEMA42_LockedByProc8

The gate is locked by processor 8.

enumerator kSEMA42_LockedByProc9

The gate is locked by processor 9.

enumerator kSEMA42_LockedByProc10

The gate is locked by processor 10.

enumerator kSEMA42_LockedByProc11

The gate is locked by processor 11.

enumerator kSEMA42_LockedByProc12

The gate is locked by processor 12.

enumerator kSEMA42_LockedByProc13

The gate is locked by processor 13.

enumerator kSEMA42_LockedByProc14

The gate is locked by processor 14.

typedef enum _sema42_gate_status sema42_gate_status_t

SEMA42 gate lock status.

void SEMA42_Init(SEMA42_Type *base)

Initializes the SEMA42 module.

This function initializes the SEMA42 module. It only enables the clock but does not reset the gates because the module might be used by other processors at the same time. To reset the gates, call either SEMA42_ResetGate or SEMA42_ResetAllGates function.

Parameters:
  • base – SEMA42 peripheral base address.

void SEMA42_Deinit(SEMA42_Type *base)

De-initializes the SEMA42 module.

This function de-initializes the SEMA42 module. It only disables the clock.

Parameters:
  • base – SEMA42 peripheral base address.

status_t SEMA42_TryLock(SEMA42_Type *base, uint8_t gateNum, uint8_t procNum)

Tries to lock the SEMA42 gate.

This function tries to lock the specific SEMA42 gate. If the gate has been locked by another processor, this function returns an error code.

Parameters:
  • base – SEMA42 peripheral base address.

  • gateNum – Gate number to lock.

  • procNum – Current processor number.

Return values:
  • kStatus_Success – Lock the sema42 gate successfully.

  • kStatus_SEMA42_Busy – Sema42 gate has been locked by another processor.

void SEMA42_Lock(SEMA42_Type *base, uint8_t gateNum, uint8_t procNum)

Locks the SEMA42 gate.

This function locks the specific SEMA42 gate. If the gate has been locked by other processors, this function waits until it is unlocked and then lock it.

Parameters:
  • base – SEMA42 peripheral base address.

  • gateNum – Gate number to lock.

  • procNum – Current processor number.

static inline void SEMA42_Unlock(SEMA42_Type *base, uint8_t gateNum)

Unlocks the SEMA42 gate.

This function unlocks the specific SEMA42 gate. It only writes unlock value to the SEMA42 gate register. However, it does not check whether the SEMA42 gate is locked by the current processor or not. As a result, if the SEMA42 gate is not locked by the current processor, this function has no effect.

Parameters:
  • base – SEMA42 peripheral base address.

  • gateNum – Gate number to unlock.

static inline sema42_gate_status_t SEMA42_GetGateStatus(SEMA42_Type *base, uint8_t gateNum)

Gets the status of the SEMA42 gate.

This function checks the lock status of a specific SEMA42 gate.

Parameters:
  • base – SEMA42 peripheral base address.

  • gateNum – Gate number.

Returns:

status Current status.

status_t SEMA42_ResetGate(SEMA42_Type *base, uint8_t gateNum)

Resets the SEMA42 gate to an unlocked status.

This function resets a SEMA42 gate to an unlocked status.

Parameters:
  • base – SEMA42 peripheral base address.

  • gateNum – Gate number.

Return values:
  • kStatus_Success – SEMA42 gate is reset successfully.

  • kStatus_SEMA42_Reseting – Some other reset process is ongoing.

static inline status_t SEMA42_ResetAllGates(SEMA42_Type *base)

Resets all SEMA42 gates to an unlocked status.

This function resets all SEMA42 gate to an unlocked status.

Parameters:
  • base – SEMA42 peripheral base address.

Return values:
  • kStatus_Success – SEMA42 is reset successfully.

  • kStatus_SEMA42_Reseting – Some other reset process is ongoing.

SEMA42_GATE_NUM_RESET_ALL

The number to reset all SEMA42 gates.

SEMA42_GATEn(base, n)

SEMA42 gate n register address.

The SEMA42 gates are sorted in the order 3, 2, 1, 0, 7, 6, 5, 4, … not in the order 0, 1, 2, 3, 4, 5, 6, 7, … The macro SEMA42_GATEn gets the SEMA42 gate based on the gate index.

The input gate index is XOR’ed with 3U: 0 ^ 3 = 3 1 ^ 3 = 2 2 ^ 3 = 1 3 ^ 3 = 0 4 ^ 3 = 7 5 ^ 3 = 6 6 ^ 3 = 5 7 ^ 3 = 4 …

Soc_mipi_dsi

FSL_SOC_MIPI_DSI_DRIVER_VERSION

Driver version.

DSI_DPHY_PLL_VCO_MAX
DSI_DPHY_PLL_VCO_MIN
FSL_COMPONENT_ID

SYSPM: System Performance Monitor

FSL_SYSPM_DRIVER_VERSION

SYSPM driver version.

enum _syspm_monitor

syspm select control monitor

Values:

enumerator kSYSPM_Monitor0

Monitor 0

enum _syspm_event

syspm select event

Values:

enumerator kSYSPM_Event1

Event 1

enumerator kSYSPM_Event2

Event 2

enumerator kSYSPM_Event3

Event 3

enum _syspm_mode

syspm set count mode

Values:

enumerator kSYSPM_BothMode

count in both modes

enumerator kSYSPM_UserMode

count only in user mode

enumerator kSYSPM_PrivilegedMode

count only in privileged mode

enum _syspm_startstop_control

syspm start/stop control

Values:

enumerator kSYSPM_Idle

idle >

enumerator kSYSPM_LocalStop

local stop

enumerator kSYSPM_LocalStart

local start

enumerator KSYSPM_EnableTraceControl

enable global TSTART/TSTOP

enumerator kSYSPM_GlobalStart

global stop

enumerator kSYSPM_GlobalStop

global start

typedef enum _syspm_monitor syspm_monitor_t

syspm select control monitor

typedef enum _syspm_event syspm_event_t

syspm select event

typedef enum _syspm_mode syspm_mode_t

syspm set count mode

typedef enum _syspm_startstop_control syspm_startstop_control_t

syspm start/stop control

void SYSPM_Init(SYSPM_Type *base)

Initializes the SYSPM.

This function enables the SYSPM clock.

Parameters:
  • base – SYSPM peripheral base address.

void SYSPM_Deinit(SYSPM_Type *base)

Deinitializes the SYSPM.

This function disables the SYSPM clock.

Parameters:
  • base – SYSPM peripheral base address.

void SYSPM_SelectEvent(SYSPM_Type *base, syspm_monitor_t monitor, syspm_event_t event, uint8_t eventCode)

Select event counters.

Parameters:
  • base – SYSPM peripheral base address.

  • event – syspm select event, see to syspm_event_t.

  • eventCode – select which event to be counted in PMECTRx., see to table Events.

void SYSPM_ResetEvent(SYSPM_Type *base, syspm_monitor_t monitor, syspm_event_t event)

Reset event counters.

Parameters:
  • base – SYSPM peripheral base address.

  • monitor – syspm control monitor, see to syspm_monitor_t.

void SYSPM_ResetInstructionEvent(SYSPM_Type *base, syspm_monitor_t monitor)

Reset Instruction Counter.

Parameters:
  • base – SYSPM peripheral base address.

  • monitor – syspm control monitor, see to syspm_monitor_t.

void SYSPM_SetCountMode(SYSPM_Type *base, syspm_monitor_t monitor, syspm_mode_t mode)

Set count mode.

Parameters:
  • base – SYSPM peripheral base address.

  • monitor – syspm control monitor, see to syspm_monitor_t.

  • mode – syspm select counter mode, see to syspm_mode_t.

void SYSPM_SetStartStopControl(SYSPM_Type *base, syspm_monitor_t monitor, syspm_startstop_control_t ssc)

Set Start/Stop Control.

Parameters:
  • base – SYSPM peripheral base address.

  • monitor – syspm control monitor, see to syspm_monitor_t.

  • ssc – This 3-bit field provides a three-phase mechanism to start/stop the counters. It includes a prioritized scheme with local start > local stop > global start > global stop > conditional TSTART > TSTOP. The global and conditional start/stop affect all configured PM/PSAM module concurrently so counters are “coherent”. see to syspm_startstop_control_t

void SYSPM_DisableCounter(SYSPM_Type *base, syspm_monitor_t monitor)

Disable Counters if Stopped or Halted.

Parameters:
  • base – SYSPM peripheral base address.

  • monitor – syspm control monitor, see to syspm_monitor_t.

uint64_t SYSPM_GetEventCounter(SYSPM_Type *base, syspm_monitor_t monitor, syspm_event_t event)

This is the the 40-bits of eventx counter. The value in this register increments each time the event selected in PMCRx[SELEVTx] occurs.

Parameters:
  • base – SYSPM peripheral base address.

  • monitor – syspm control monitor, see to syspm_monitor_t.

  • event – syspm select event, see to syspm_event_t.

Returns:

get the the 40 bits of eventx counter.

uint64_t SYSPM_GetInstructionCounter(SYSPM_Type *base, syspm_monitor_t monitor)

This is the the 40-bits of instructionx counter. The value in this register increments each time the CPU count signals occurs.

Parameters:
  • base – SYSPM peripheral base address.

  • monitor – syspm control monitor, see to syspm_monitor_t.

Returns:

get the the 40 bits of instruction counter.

TRNG: True Random Number Generator

FSL_TRNG_DRIVER_VERSION

TRNG driver version 2.0.17.

Current version: 2.0.17

Change log:

  • version 2.0.17

    • Added support for RT700.

  • version 2.0.16

    • Added support for Dual oscillator mode.

  • version 2.0.15

    • Changed TRNG_USER_CONFIG_DEFAULT_XXX values according to latest reccomended by design team.

  • version 2.0.14

    • add support for RW610 and RW612

  • version 2.0.13

    • After deepsleep it might return error, added clearing bits in TRNG_GetRandomData() and generating new entropy.

    • Modified reloading entropy in TRNG_GetRandomData(), for some data length it doesn’t reloading entropy correctly.

  • version 2.0.12

    • For KW34A4_SERIES, KW35A4_SERIES, KW36A4_SERIES set TRNG_USER_CONFIG_DEFAULT_OSC_DIV to kTRNG_RingOscDiv8.

  • version 2.0.11

    • Add clearing pending errors in TRNG_Init().

  • version 2.0.10

    • Fixed doxygen issues.

  • version 2.0.9

    • Fix HIS_CCM metrics issues.

  • version 2.0.8

    • For K32L2A41A_SERIES set TRNG_USER_CONFIG_DEFAULT_OSC_DIV to kTRNG_RingOscDiv4.

  • version 2.0.7

    • Fix MISRA 2004 issue rule 12.5.

  • version 2.0.6

    • For KW35Z4_SERIES set TRNG_USER_CONFIG_DEFAULT_OSC_DIV to kTRNG_RingOscDiv8.

  • version 2.0.5

    • Add possibility to define default TRNG configuration by device specific preprocessor macros for FRQMIN, FRQMAX and OSCDIV.

  • version 2.0.4

    • Fix MISRA-2012 issues.

  • Version 2.0.3

    • update TRNG_Init to restart entropy generation

  • Version 2.0.2

    • fix MISRA issues

  • Version 2.0.1

    • add support for KL8x and KL28Z

    • update default OSCDIV for K81 to divide by 2

enum _trng_sample_mode

TRNG sample mode. Used by trng_config_t.

Values:

enumerator kTRNG_SampleModeVonNeumann

Use von Neumann data in both Entropy shifter and Statistical Checker.

enumerator kTRNG_SampleModeRaw

Use raw data into both Entropy shifter and Statistical Checker.

enumerator kTRNG_SampleModeVonNeumannRaw

Use von Neumann data in Entropy shifter. Use raw data into Statistical Checker.

enum _trng_clock_mode

TRNG clock mode. Used by trng_config_t.

Values:

enumerator kTRNG_ClockModeRingOscillator

Ring oscillator is used to operate the TRNG (default).

enumerator kTRNG_ClockModeSystem

System clock is used to operate the TRNG. This is for test use only, and indeterminate results may occur.

enum _trng_ring_osc_div

TRNG ring oscillator divide. Used by trng_config_t.

Values:

enumerator kTRNG_RingOscDiv0

Ring oscillator with no divide

enumerator kTRNG_RingOscDiv2

Ring oscillator divided-by-2.

enumerator kTRNG_RingOscDiv4

Ring oscillator divided-by-4.

enumerator kTRNG_RingOscDiv8

Ring oscillator divided-by-8.

enum trng_oscillator_mode_t

TRNG oscillator mode . Used by trng_config_t.

Values:

enumerator kTRNG_SingleOscillatorModeOsc1

Single oscillator mode, using OSC1 (default)

enumerator kTRNG_DualOscillatorMode

Dual oscillator mode

enumerator kTRNG_SingleOscillatorModeOsc2

Single oscillator mode, using OSC2

typedef enum _trng_sample_mode trng_sample_mode_t

TRNG sample mode. Used by trng_config_t.

typedef enum _trng_clock_mode trng_clock_mode_t

TRNG clock mode. Used by trng_config_t.

typedef enum _trng_ring_osc_div trng_ring_osc_div_t

TRNG ring oscillator divide. Used by trng_config_t.

typedef enum trng_oscillator_mode_t trng_oscillator_mode_t

TRNG oscillator mode . Used by trng_config_t.

typedef struct _trng_statistical_check_limit trng_statistical_check_limit_t

Data structure for definition of statistical check limits. Used by trng_config_t.

typedef struct _trng_user_config trng_config_t

Data structure for the TRNG initialization.

This structure initializes the TRNG by calling the TRNG_Init() function. It contains all TRNG configurations.

status_t TRNG_GetDefaultConfig(trng_config_t *userConfig)

Initializes the user configuration structure to default values.

This function initializes the configuration structure to default values. The default values are platform dependent.

Parameters:
  • userConfig – User configuration structure.

Returns:

If successful, returns the kStatus_TRNG_Success. Otherwise, it returns an error.

status_t TRNG_Init(TRNG_Type *base, const trng_config_t *userConfig)

Initializes the TRNG.

This function initializes the TRNG. When called, the TRNG entropy generation starts immediately.

Parameters:
  • base – TRNG base address

  • userConfig – Pointer to the initialization configuration structure.

Returns:

If successful, returns the kStatus_TRNG_Success. Otherwise, it returns an error.

void TRNG_Deinit(TRNG_Type *base)

Shuts down the TRNG.

This function shuts down the TRNG.

Parameters:
  • base – TRNG base address.

status_t TRNG_GetRandomData(TRNG_Type *base, void *data, size_t dataSize)

Gets random data.

This function gets random data from the TRNG.

Parameters:
  • base – TRNG base address.

  • data – Pointer address used to store random data.

  • dataSize – Size of the buffer pointed by the data parameter.

Returns:

random data

struct _trng_statistical_check_limit
#include <fsl_trng.h>

Data structure for definition of statistical check limits. Used by trng_config_t.

Public Members

uint32_t maximum

Maximum limit.

uint32_t minimum

Minimum limit.

struct _trng_user_config
#include <fsl_trng.h>

Data structure for the TRNG initialization.

This structure initializes the TRNG by calling the TRNG_Init() function. It contains all TRNG configurations.

Public Members

bool lock

Disable programmability of TRNG registers.

trng_clock_mode_t clockMode

Clock mode used to operate TRNG.

trng_ring_osc_div_t ringOscDiv

Ring oscillator divide used by TRNG.

trng_sample_mode_t sampleMode

Sample mode of the TRNG ring oscillator.

trng_oscillator_mode_t oscillatorMode

TRNG oscillator mode .

trng_ring_osc_div_t ringOsc2Div

Divider used for Ring oscillator 2.

uint16_t entropyDelay

Entropy Delay. Defines the length (in system clocks) of each Entropy sample taken.

uint16_t sampleSize

Sample Size. Defines the total number of Entropy samples that will be taken during Entropy generation.

uint16_t sparseBitLimit

Sparse Bit Limit which defines the maximum number of consecutive samples that may be discarded before an error is generated. This limit is used only for during von Neumann sampling (enabled by TRNG_HAL_SetSampleMode()). Samples are discarded if two consecutive raw samples are both 0 or both 1. If this discarding occurs for a long period of time, it indicates that there is insufficient Entropy.

uint8_t retryCount

Retry count. It defines the number of times a statistical check may fails during the TRNG Entropy Generation before generating an error.

uint8_t longRunMaxLimit

Largest allowable number of consecutive samples of all 1, or all 0, that is allowed during the Entropy generation.

trng_statistical_check_limit_t monobitLimit

Maximum and minimum limits for statistical check of number of ones/zero detected during entropy generation.

trng_statistical_check_limit_t runBit1Limit

Maximum and minimum limits for statistical check of number of runs of length 1 detected during entropy generation.

trng_statistical_check_limit_t runBit2Limit

Maximum and minimum limits for statistical check of number of runs of length 2 detected during entropy generation.

trng_statistical_check_limit_t runBit3Limit

Maximum and minimum limits for statistical check of number of runs of length 3 detected during entropy generation.

trng_statistical_check_limit_t runBit4Limit

Maximum and minimum limits for statistical check of number of runs of length 4 detected during entropy generation.

trng_statistical_check_limit_t runBit5Limit

Maximum and minimum limits for statistical check of number of runs of length 5 detected during entropy generation.

trng_statistical_check_limit_t runBit6PlusLimit

Maximum and minimum limits for statistical check of number of runs of length 6 or more detected during entropy generation.

trng_statistical_check_limit_t pokerLimit

Maximum and minimum limits for statistical check of “Poker Test”.

trng_statistical_check_limit_t frequencyCountLimit

Maximum and minimum limits for statistical check of entropy sample frequency count.

USDHC: Ultra Secured Digital Host Controller Driver

void USDHC_Init(USDHC_Type *base, const usdhc_config_t *config)

USDHC module initialization function.

Configures the USDHC according to the user configuration.

Example:

usdhc_config_t config;
config.cardDetectDat3 = false;
config.endianMode = kUSDHC_EndianModeLittle;
config.dmaMode = kUSDHC_DmaModeAdma2;
config.readWatermarkLevel = 128U;
config.writeWatermarkLevel = 128U;
USDHC_Init(USDHC, &config);

Parameters:
  • base – USDHC peripheral base address.

  • config – USDHC configuration information.

Return values:

kStatus_Success – Operate successfully.

void USDHC_Deinit(USDHC_Type *base)

Deinitializes the USDHC.

Parameters:
  • base – USDHC peripheral base address.

bool USDHC_Reset(USDHC_Type *base, uint32_t mask, uint32_t timeout)

Resets the USDHC.

Parameters:
  • base – USDHC peripheral base address.

  • mask – The reset type mask(_usdhc_reset).

  • timeout – Timeout for reset.

Return values:
  • true – Reset successfully.

  • false – Reset failed.

status_t USDHC_SetAdmaTableConfig(USDHC_Type *base, usdhc_adma_config_t *dmaConfig, usdhc_data_t *dataConfig, uint32_t flags)

Sets the DMA descriptor table configuration. A high level DMA descriptor configuration function.

Parameters:
  • base – USDHC peripheral base address.

  • dmaConfig – ADMA configuration

  • dataConfig – Data descriptor

  • flags – ADAM descriptor flag, used to indicate to create multiple or single descriptor, please refer to enum _usdhc_adma_flag.

Return values:
  • kStatus_OutOfRange – ADMA descriptor table length isn’t enough to describe data.

  • kStatus_Success – Operate successfully.

status_t USDHC_SetInternalDmaConfig(USDHC_Type *base, usdhc_adma_config_t *dmaConfig, const uint32_t *dataAddr, bool enAutoCmd23)

Internal DMA configuration. This function is used to config the USDHC DMA related registers.

Parameters:
  • base – USDHC peripheral base address.

  • dmaConfig – ADMA configuration.

  • dataAddr – Transfer data address, a simple DMA parameter, if ADMA is used, leave it to NULL.

  • enAutoCmd23 – Flag to indicate Auto CMD23 is enable or not, a simple DMA parameter, if ADMA is used, leave it to false.

Return values:
  • kStatus_OutOfRange – ADMA descriptor table length isn’t enough to describe data.

  • kStatus_Success – Operate successfully.

status_t USDHC_SetADMA2Descriptor(uint32_t *admaTable, uint32_t admaTableWords, const uint32_t *dataBufferAddr, uint32_t dataBytes, uint32_t flags)

Sets the ADMA2 descriptor table configuration.

Parameters:
  • admaTable – ADMA table address.

  • admaTableWords – ADMA table length.

  • dataBufferAddr – Data buffer address.

  • dataBytes – Data Data length.

  • flags – ADAM descriptor flag, used to indicate to create multiple or single descriptor, please refer to enum _usdhc_adma_flag.

Return values:
  • kStatus_OutOfRange – ADMA descriptor table length isn’t enough to describe data.

  • kStatus_Success – Operate successfully.

status_t USDHC_SetADMA1Descriptor(uint32_t *admaTable, uint32_t admaTableWords, const uint32_t *dataBufferAddr, uint32_t dataBytes, uint32_t flags)

Sets the ADMA1 descriptor table configuration.

Parameters:
  • admaTable – ADMA table address.

  • admaTableWords – ADMA table length.

  • dataBufferAddr – Data buffer address.

  • dataBytes – Data length.

  • flags – ADAM descriptor flag, used to indicate to create multiple or single descriptor, please refer to enum _usdhc_adma_flag.

Return values:
  • kStatus_OutOfRange – ADMA descriptor table length isn’t enough to describe data.

  • kStatus_Success – Operate successfully.

static inline void USDHC_EnableInternalDMA(USDHC_Type *base, bool enable)

Enables internal DMA.

Parameters:
  • base – USDHC peripheral base address.

  • enable – enable or disable flag

static inline void USDHC_EnableInterruptStatus(USDHC_Type *base, uint32_t mask)

Enables the interrupt status.

Parameters:
  • base – USDHC peripheral base address.

  • mask – Interrupt status flags mask(_usdhc_interrupt_status_flag).

static inline void USDHC_DisableInterruptStatus(USDHC_Type *base, uint32_t mask)

Disables the interrupt status.

Parameters:
  • base – USDHC peripheral base address.

  • mask – The interrupt status flags mask(_usdhc_interrupt_status_flag).

static inline void USDHC_EnableInterruptSignal(USDHC_Type *base, uint32_t mask)

Enables the interrupt signal corresponding to the interrupt status flag.

Parameters:
  • base – USDHC peripheral base address.

  • mask – The interrupt status flags mask(_usdhc_interrupt_status_flag).

static inline void USDHC_DisableInterruptSignal(USDHC_Type *base, uint32_t mask)

Disables the interrupt signal corresponding to the interrupt status flag.

Parameters:
  • base – USDHC peripheral base address.

  • mask – The interrupt status flags mask(_usdhc_interrupt_status_flag).

static inline uint32_t USDHC_GetEnabledInterruptStatusFlags(USDHC_Type *base)

Gets the enabled interrupt status.

Parameters:
  • base – USDHC peripheral base address.

Returns:

Current interrupt status flags mask(_usdhc_interrupt_status_flag).

static inline uint32_t USDHC_GetInterruptStatusFlags(USDHC_Type *base)

Gets the current interrupt status.

Parameters:
  • base – USDHC peripheral base address.

Returns:

Current interrupt status flags mask(_usdhc_interrupt_status_flag).

static inline void USDHC_ClearInterruptStatusFlags(USDHC_Type *base, uint32_t mask)

Clears a specified interrupt status. write 1 clears.

Parameters:
  • base – USDHC peripheral base address.

  • mask – The interrupt status flags mask(_usdhc_interrupt_status_flag).

static inline uint32_t USDHC_GetAutoCommand12ErrorStatusFlags(USDHC_Type *base)

Gets the status of auto command 12 error.

Parameters:
  • base – USDHC peripheral base address.

Returns:

Auto command 12 error status flags mask(_usdhc_auto_command12_error_status_flag).

static inline uint32_t USDHC_GetAdmaErrorStatusFlags(USDHC_Type *base)

Gets the status of the ADMA error.

Parameters:
  • base – USDHC peripheral base address.

Returns:

ADMA error status flags mask(_usdhc_adma_error_status_flag).

static inline uint32_t USDHC_GetPresentStatusFlags(USDHC_Type *base)

Gets a present status.

This function gets the present USDHC’s status except for an interrupt status and an error status.

Parameters:
  • base – USDHC peripheral base address.

Returns:

Present USDHC’s status flags mask(_usdhc_present_status_flag).

void USDHC_GetCapability(USDHC_Type *base, usdhc_capability_t *capability)

Gets the capability information.

Parameters:
  • base – USDHC peripheral base address.

  • capability – Structure to save capability information.

static inline void USDHC_ForceClockOn(USDHC_Type *base, bool enable)

Forces the card clock on.

Parameters:
  • base – USDHC peripheral base address.

  • enable – enable/disable flag

uint32_t USDHC_SetSdClock(USDHC_Type *base, uint32_t srcClock_Hz, uint32_t busClock_Hz)

Sets the SD bus clock frequency.

Parameters:
  • base – USDHC peripheral base address.

  • srcClock_Hz – USDHC source clock frequency united in Hz.

  • busClock_Hz – SD bus clock frequency united in Hz.

Returns:

The nearest frequency of busClock_Hz configured for SD bus.

bool USDHC_SetCardActive(USDHC_Type *base, uint32_t timeout)

Sends 80 clocks to the card to set it to the active state.

This function must be called each time the card is inserted to ensure that the card can receive the command correctly.

Parameters:
  • base – USDHC peripheral base address.

  • timeout – Timeout to initialize card.

Return values:
  • true – Set card active successfully.

  • false – Set card active failed.

static inline void USDHC_AssertHardwareReset(USDHC_Type *base, bool high)

Triggers a hardware reset.

Parameters:
  • base – USDHC peripheral base address.

  • high – 1 or 0 level

static inline void USDHC_SetDataBusWidth(USDHC_Type *base, usdhc_data_bus_width_t width)

Sets the data transfer width.

Parameters:
  • base – USDHC peripheral base address.

  • width – Data transfer width.

static inline void USDHC_WriteData(USDHC_Type *base, uint32_t data)

Fills the data port.

This function is used to implement the data transfer by Data Port instead of DMA.

Parameters:
  • base – USDHC peripheral base address.

  • data – The data about to be sent.

static inline uint32_t USDHC_ReadData(USDHC_Type *base)

Retrieves the data from the data port.

This function is used to implement the data transfer by Data Port instead of DMA.

Parameters:
  • base – USDHC peripheral base address.

Returns:

The data has been read.

void USDHC_SendCommand(USDHC_Type *base, usdhc_command_t *command)

Sends command function.

Parameters:
  • base – USDHC peripheral base address.

  • command – configuration

static inline void USDHC_EnableWakeupEvent(USDHC_Type *base, uint32_t mask, bool enable)

Enables or disables a wakeup event in low-power mode.

Parameters:
  • base – USDHC peripheral base address.

  • mask – Wakeup events mask(_usdhc_wakeup_event).

  • enable – True to enable, false to disable.

static inline void USDHC_CardDetectByData3(USDHC_Type *base, bool enable)

Detects card insert status.

Parameters:
  • base – USDHC peripheral base address.

  • enable – enable/disable flag

static inline bool USDHC_DetectCardInsert(USDHC_Type *base)

Detects card insert status.

Parameters:
  • base – USDHC peripheral base address.

static inline void USDHC_EnableSdioControl(USDHC_Type *base, uint32_t mask, bool enable)

Enables or disables the SDIO card control.

Parameters:
  • base – USDHC peripheral base address.

  • mask – SDIO card control flags mask(_usdhc_sdio_control_flag).

  • enable – True to enable, false to disable.

static inline void USDHC_SetContinueRequest(USDHC_Type *base)

Restarts a transaction which has stopped at the block GAP for the SDIO card.

Parameters:
  • base – USDHC peripheral base address.

static inline void USDHC_RequestStopAtBlockGap(USDHC_Type *base, bool enable)

Request stop at block gap function.

Parameters:
  • base – USDHC peripheral base address.

  • enable – True to stop at block gap, false to normal transfer.

void USDHC_SetMmcBootConfig(USDHC_Type *base, const usdhc_boot_config_t *config)

Configures the MMC boot feature.

Example:

usdhc_boot_config_t config;
config.ackTimeoutCount = 4;
config.bootMode = kUSDHC_BootModeNormal;
config.blockCount = 5;
config.enableBootAck = true;
config.enableBoot = true;
config.enableAutoStopAtBlockGap = true;
USDHC_SetMmcBootConfig(USDHC, &config);

Parameters:
  • base – USDHC peripheral base address.

  • config – The MMC boot configuration information.

static inline void USDHC_EnableMmcBoot(USDHC_Type *base, bool enable)

Enables or disables the mmc boot mode.

Parameters:
  • base – USDHC peripheral base address.

  • enable – True to enable, false to disable.

static inline void USDHC_SetForceEvent(USDHC_Type *base, uint32_t mask)

Forces generating events according to the given mask.

Parameters:
  • base – USDHC peripheral base address.

  • mask – The force events bit posistion (_usdhc_force_event).

static inline bool USDHC_RequestTuningForSDR50(USDHC_Type *base)

Checks the SDR50 mode request tuning bit. When this bit set, application shall perform tuning for SDR50 mode.

Parameters:
  • base – USDHC peripheral base address.

static inline bool USDHC_RequestReTuning(USDHC_Type *base)

Checks the request re-tuning bit. When this bit is set, user should do manual tuning or standard tuning function.

Parameters:
  • base – USDHC peripheral base address.

static inline void USDHC_EnableAutoTuning(USDHC_Type *base, bool enable)

The SDR104 mode auto tuning enable and disable. This function should be called after tuning function execute pass, auto tuning will handle by hardware.

Parameters:
  • base – USDHC peripheral base address.

  • enable – enable/disable flag

void USDHC_EnableAutoTuningForCmdAndData(USDHC_Type *base)

The auto tuning enbale for CMD/DATA line.

Parameters:
  • base – USDHC peripheral base address.

void USDHC_EnableManualTuning(USDHC_Type *base, bool enable)

Manual tuning trigger or abort. User should handle the tuning cmd and find the boundary of the delay then calucate a average value which will be configured to the CLK_TUNE_CTRL_STATUS This function should be called before function USDHC_AdjustDelayForManualTuning.

Parameters:
  • base – USDHC peripheral base address.

  • enable – tuning enable flag

static inline uint32_t USDHC_GetTuningDelayStatus(USDHC_Type *base)

Get the tuning delay cell setting.

Parameters:
  • base – USDHC peripheral base address.

Return values:

CLK – Tuning Control and Status register value.

status_t USDHC_SetTuningDelay(USDHC_Type *base, uint32_t preDelay, uint32_t outDelay, uint32_t postDelay)

The tuning delay cell setting.

Parameters:
  • base – USDHC peripheral base address.

  • preDelay – Set the number of delay cells on the feedback clock between the feedback clock and CLK_PRE.

  • outDelay – Set the number of delay cells on the feedback clock between CLK_PRE and CLK_OUT.

  • postDelay – Set the number of delay cells on the feedback clock between CLK_OUT and CLK_POST.

Return values:
  • kStatus_Fail – config the delay setting fail

  • kStatus_Success – config the delay setting success

status_t USDHC_AdjustDelayForManualTuning(USDHC_Type *base, uint32_t delay)

Adjusts delay for mannual tuning.

Deprecated:

Do not use this function. It has been superceded by USDHC_SetTuingDelay

Parameters:
  • base – USDHC peripheral base address.

  • delay – setting configuration

Return values:
  • kStatus_Fail – config the delay setting fail

  • kStatus_Success – config the delay setting success

static inline void USDHC_SetStandardTuningCounter(USDHC_Type *base, uint8_t counter)

set tuning counter tuning.

Parameters:
  • base – USDHC peripheral base address.

  • counter – tuning counter

Return values:
  • kStatus_Fail – config the delay setting fail

  • kStatus_Success – config the delay setting success

void USDHC_EnableStandardTuning(USDHC_Type *base, uint32_t tuningStartTap, uint32_t step, bool enable)

The enable standard tuning function. The standard tuning window and tuning counter using the default config tuning cmd is sent by the software, user need to check whether the tuning result can be used for SDR50, SDR104, and HS200 mode tuning.

Parameters:
  • base – USDHC peripheral base address.

  • tuningStartTap – start tap

  • step – tuning step

  • enable – enable/disable flag

static inline uint32_t USDHC_GetExecuteStdTuningStatus(USDHC_Type *base)

Gets execute STD tuning status.

Parameters:
  • base – USDHC peripheral base address.

static inline uint32_t USDHC_CheckStdTuningResult(USDHC_Type *base)

Checks STD tuning result.

Parameters:
  • base – USDHC peripheral base address.

static inline uint32_t USDHC_CheckTuningError(USDHC_Type *base)

Checks tuning error.

Parameters:
  • base – USDHC peripheral base address.

void USDHC_EnableDDRMode(USDHC_Type *base, bool enable, uint32_t nibblePos)

The enable/disable DDR mode.

Parameters:
  • base – USDHC peripheral base address.

  • enable – enable/disable flag

  • nibblePos – nibble position

static inline void USDHC_EnableHS400Mode(USDHC_Type *base, bool enable)

The enable/disable HS400 mode.

Parameters:
  • base – USDHC peripheral base address.

  • enable – enable/disable flag

static inline void USDHC_ResetStrobeDLL(USDHC_Type *base)

Resets the strobe DLL.

Parameters:
  • base – USDHC peripheral base address.

static inline void USDHC_EnableStrobeDLL(USDHC_Type *base, bool enable)

Enables/disables the strobe DLL.

Parameters:
  • base – USDHC peripheral base address.

  • enable – enable/disable flag

void USDHC_ConfigStrobeDLL(USDHC_Type *base, uint32_t delayTarget, uint32_t updateInterval)

Configs the strobe DLL delay target and update interval.

Parameters:
  • base – USDHC peripheral base address.

  • delayTarget – delay target

  • updateInterval – update interval

static inline void USDHC_SetStrobeDllOverride(USDHC_Type *base, uint32_t delayTaps)

Enables manual override for slave delay chain using STROBE_SLV_OVERRIDE_VAL.

Parameters:
  • base – USDHC peripheral base address.

  • delayTaps – Valid delay taps range from 1 - 128 taps. A value of 0 selects tap 1, and a value of 0x7F selects tap 128.

static inline uint32_t USDHC_GetStrobeDLLStatus(USDHC_Type *base)

Gets the strobe DLL status.

Parameters:
  • base – USDHC peripheral base address.

void USDHC_SetDataConfig(USDHC_Type *base, usdhc_transfer_direction_t dataDirection, uint32_t blockCount, uint32_t blockSize)

USDHC data configuration.

Parameters:
  • base – USDHC peripheral base address.

  • dataDirection – Data direction, tx or rx.

  • blockCount – Data block count.

  • blockSize – Data block size.

void USDHC_TransferCreateHandle(USDHC_Type *base, usdhc_handle_t *handle, const usdhc_transfer_callback_t *callback, void *userData)

Creates the USDHC handle.

Parameters:
  • base – USDHC peripheral base address.

  • handle – USDHC handle pointer.

  • callback – Structure pointer to contain all callback functions.

  • userData – Callback function parameter.

status_t USDHC_TransferNonBlocking(USDHC_Type *base, usdhc_handle_t *handle, usdhc_adma_config_t *dmaConfig, usdhc_transfer_t *transfer)

Transfers the command/data using an interrupt and an asynchronous method.

This function sends a command and data and returns immediately. It doesn’t wait for the transfer to complete or to encounter an error. The application must not call this API in multiple threads at the same time. Because of that this API doesn’t support the re-entry mechanism.

Note

Call API USDHC_TransferCreateHandle when calling this API.

Parameters:
  • base – USDHC peripheral base address.

  • handle – USDHC handle.

  • dmaConfig – ADMA configuration.

  • transfer – Transfer content.

Return values:
  • kStatus_InvalidArgument – Argument is invalid.

  • kStatus_USDHC_BusyTransferring – Busy transferring.

  • kStatus_USDHC_PrepareAdmaDescriptorFailed – Prepare ADMA descriptor failed.

  • kStatus_Success – Operate successfully.

status_t USDHC_TransferBlocking(USDHC_Type *base, usdhc_adma_config_t *dmaConfig, usdhc_transfer_t *transfer)

Transfers the command/data using a blocking method.

This function waits until the command response/data is received or the USDHC encounters an error by polling the status flag.

The application must not call this API in multiple threads at the same time. Because this API doesn’t support the re-entry mechanism.

Note

There is no need to call API USDHC_TransferCreateHandle when calling this API.

Parameters:
  • base – USDHC peripheral base address.

  • dmaConfig – adma configuration

  • transfer – Transfer content.

Return values:
  • kStatus_InvalidArgument – Argument is invalid.

  • kStatus_USDHC_PrepareAdmaDescriptorFailed – Prepare ADMA descriptor failed.

  • kStatus_USDHC_SendCommandFailed – Send command failed.

  • kStatus_USDHC_TransferDataFailed – Transfer data failed.

  • kStatus_Success – Operate successfully.

void USDHC_TransferHandleIRQ(USDHC_Type *base, usdhc_handle_t *handle)

IRQ handler for the USDHC.

This function deals with the IRQs on the given host controller.

Parameters:
  • base – USDHC peripheral base address.

  • handle – USDHC handle.

FSL_USDHC_DRIVER_VERSION

Driver version 2.8.4.

Enum _usdhc_status. USDHC status.

Values:

enumerator kStatus_USDHC_BusyTransferring

Transfer is on-going.

enumerator kStatus_USDHC_PrepareAdmaDescriptorFailed

Set DMA descriptor failed.

enumerator kStatus_USDHC_SendCommandFailed

Send command failed.

enumerator kStatus_USDHC_TransferDataFailed

Transfer data failed.

enumerator kStatus_USDHC_DMADataAddrNotAlign

Data address not aligned.

enumerator kStatus_USDHC_ReTuningRequest

Re-tuning request.

enumerator kStatus_USDHC_TuningError

Tuning error.

enumerator kStatus_USDHC_NotSupport

Not support.

enumerator kStatus_USDHC_TransferDataComplete

Transfer data complete.

enumerator kStatus_USDHC_SendCommandSuccess

Transfer command complete.

enumerator kStatus_USDHC_TransferDMAComplete

Transfer DMA complete.

Enum _usdhc_capability_flag. Host controller capabilities flag mask. .

Values:

enumerator kUSDHC_SupportAdmaFlag

Support ADMA.

enumerator kUSDHC_SupportHighSpeedFlag

Support high-speed.

enumerator kUSDHC_SupportDmaFlag

Support DMA.

enumerator kUSDHC_SupportSuspendResumeFlag

Support suspend/resume.

enumerator kUSDHC_SupportV330Flag

Support voltage 3.3V.

enumerator kUSDHC_SupportV300Flag

Support voltage 3.0V.

enumerator kUSDHC_Support4BitFlag

Flag in HTCAPBLT_MBL’s position, supporting 4-bit mode.

enumerator kUSDHC_Support8BitFlag

Flag in HTCAPBLT_MBL’s position, supporting 8-bit mode.

enumerator kUSDHC_SupportDDR50Flag

SD version 3.0 new feature, supporting DDR50 mode.

enumerator kUSDHC_SupportSDR104Flag

Support SDR104 mode.

enumerator kUSDHC_SupportSDR50Flag

Support SDR50 mode.

Enum _usdhc_wakeup_event. Wakeup event mask. .

Values:

enumerator kUSDHC_WakeupEventOnCardInt

Wakeup on card interrupt.

enumerator kUSDHC_WakeupEventOnCardInsert

Wakeup on card insertion.

enumerator kUSDHC_WakeupEventOnCardRemove

Wakeup on card removal.

enumerator kUSDHC_WakeupEventsAll

All wakeup events

Enum _usdhc_reset. Reset type mask. .

Values:

enumerator kUSDHC_ResetAll

Reset all except card detection.

enumerator kUSDHC_ResetCommand

Reset command line.

enumerator kUSDHC_ResetData

Reset data line.

enumerator kUSDHC_ResetTuning

Reset tuning circuit.

enumerator kUSDHC_ResetsAll

All reset types

Enum _usdhc_transfer_flag. Transfer flag mask.

Values:

enumerator kUSDHC_EnableDmaFlag

Enable DMA.

enumerator kUSDHC_CommandTypeSuspendFlag

Suspend command.

enumerator kUSDHC_CommandTypeResumeFlag

Resume command.

enumerator kUSDHC_CommandTypeAbortFlag

Abort command.

enumerator kUSDHC_EnableBlockCountFlag

Enable block count.

enumerator kUSDHC_EnableAutoCommand12Flag

Enable auto CMD12.

enumerator kUSDHC_DataReadFlag

Enable data read.

enumerator kUSDHC_MultipleBlockFlag

Multiple block data read/write.

enumerator kUSDHC_EnableAutoCommand23Flag

Enable auto CMD23.

enumerator kUSDHC_ResponseLength136Flag

136-bit response length.

enumerator kUSDHC_ResponseLength48Flag

48-bit response length.

enumerator kUSDHC_ResponseLength48BusyFlag

48-bit response length with busy status.

enumerator kUSDHC_EnableCrcCheckFlag

Enable CRC check.

enumerator kUSDHC_EnableIndexCheckFlag

Enable index check.

enumerator kUSDHC_DataPresentFlag

Data present flag.

Enum _usdhc_present_status_flag. Present status flag mask. .

Values:

enumerator kUSDHC_CommandInhibitFlag

Command inhibit.

enumerator kUSDHC_DataInhibitFlag

Data inhibit.

enumerator kUSDHC_DataLineActiveFlag

Data line active.

enumerator kUSDHC_SdClockStableFlag

SD bus clock stable.

enumerator kUSDHC_WriteTransferActiveFlag

Write transfer active.

enumerator kUSDHC_ReadTransferActiveFlag

Read transfer active.

enumerator kUSDHC_BufferWriteEnableFlag

Buffer write enable.

enumerator kUSDHC_BufferReadEnableFlag

Buffer read enable.

enumerator kUSDHC_ReTuningRequestFlag

Re-tuning request flag, only used for SDR104 mode.

enumerator kUSDHC_DelaySettingFinishedFlag

Delay setting finished flag.

enumerator kUSDHC_CardInsertedFlag

Card inserted.

enumerator kUSDHC_CommandLineLevelFlag

Command line signal level.

enumerator kUSDHC_Data0LineLevelFlag

Data0 line signal level.

enumerator kUSDHC_Data1LineLevelFlag

Data1 line signal level.

enumerator kUSDHC_Data2LineLevelFlag

Data2 line signal level.

enumerator kUSDHC_Data3LineLevelFlag

Data3 line signal level.

enumerator kUSDHC_Data4LineLevelFlag

Data4 line signal level.

enumerator kUSDHC_Data5LineLevelFlag

Data5 line signal level.

enumerator kUSDHC_Data6LineLevelFlag

Data6 line signal level.

enumerator kUSDHC_Data7LineLevelFlag

Data7 line signal level.

Enum _usdhc_interrupt_status_flag. Interrupt status flag mask. .

Values:

enumerator kUSDHC_CommandCompleteFlag

Command complete.

enumerator kUSDHC_DataCompleteFlag

Data complete.

enumerator kUSDHC_BlockGapEventFlag

Block gap event.

enumerator kUSDHC_DmaCompleteFlag

DMA interrupt.

enumerator kUSDHC_BufferWriteReadyFlag

Buffer write ready.

enumerator kUSDHC_BufferReadReadyFlag

Buffer read ready.

enumerator kUSDHC_CardInsertionFlag

Card inserted.

enumerator kUSDHC_CardRemovalFlag

Card removed.

enumerator kUSDHC_CardInterruptFlag

Card interrupt.

enumerator kUSDHC_ReTuningEventFlag

Re-Tuning event, only for SD3.0 SDR104 mode.

enumerator kUSDHC_TuningPassFlag

SDR104 mode tuning pass flag.

enumerator kUSDHC_TuningErrorFlag

SDR104 tuning error flag.

enumerator kUSDHC_CommandTimeoutFlag

Command timeout error.

enumerator kUSDHC_CommandCrcErrorFlag

Command CRC error.

enumerator kUSDHC_CommandEndBitErrorFlag

Command end bit error.

enumerator kUSDHC_CommandIndexErrorFlag

Command index error.

enumerator kUSDHC_DataTimeoutFlag

Data timeout error.

enumerator kUSDHC_DataCrcErrorFlag

Data CRC error.

enumerator kUSDHC_DataEndBitErrorFlag

Data end bit error.

enumerator kUSDHC_AutoCommand12ErrorFlag

Auto CMD12 error.

enumerator kUSDHC_DmaErrorFlag

DMA error.

enumerator kUSDHC_CommandErrorFlag

Command error

enumerator kUSDHC_DataErrorFlag

Data error

enumerator kUSDHC_ErrorFlag

All error

enumerator kUSDHC_DataFlag

Data interrupts

enumerator kUSDHC_DataDMAFlag

Data interrupts

enumerator kUSDHC_CommandFlag

Command interrupts

enumerator kUSDHC_CardDetectFlag

Card detection interrupts

enumerator kUSDHC_SDR104TuningFlag

SDR104 tuning flag.

enumerator kUSDHC_AllInterruptFlags

All flags mask

Enum _usdhc_auto_command12_error_status_flag. Auto CMD12 error status flag mask. .

Values:

enumerator kUSDHC_AutoCommand12NotExecutedFlag

Not executed error.

enumerator kUSDHC_AutoCommand12TimeoutFlag

Timeout error.

enumerator kUSDHC_AutoCommand12EndBitErrorFlag

End bit error.

enumerator kUSDHC_AutoCommand12CrcErrorFlag

CRC error.

enumerator kUSDHC_AutoCommand12IndexErrorFlag

Index error.

enumerator kUSDHC_AutoCommand12NotIssuedFlag

Not issued error.

Enum _usdhc_standard_tuning. Standard tuning flag.

Values:

enumerator kUSDHC_ExecuteTuning

Used to start tuning procedure.

enumerator kUSDHC_TuningSampleClockSel

When std_tuning_en bit is set, this bit is used to select sampleing clock.

Enum _usdhc_adma_error_status_flag. ADMA error status flag mask. .

Values:

enumerator kUSDHC_AdmaLenghMismatchFlag

Length mismatch error.

enumerator kUSDHC_AdmaDescriptorErrorFlag

Descriptor error.

Enum _usdhc_adma_error_state. ADMA error state.

This state is the detail state when ADMA error has occurred.

Values:

enumerator kUSDHC_AdmaErrorStateStopDma

Stop DMA, previous location set in the ADMA system address is errored address.

enumerator kUSDHC_AdmaErrorStateFetchDescriptor

Fetch descriptor, current location set in the ADMA system address is errored address.

enumerator kUSDHC_AdmaErrorStateChangeAddress

Change address, no DMA error has occurred.

enumerator kUSDHC_AdmaErrorStateTransferData

Transfer data, previous location set in the ADMA system address is errored address.

enumerator kUSDHC_AdmaErrorStateInvalidLength

Invalid length in ADMA descriptor.

enumerator kUSDHC_AdmaErrorStateInvalidDescriptor

Invalid descriptor fetched by ADMA.

enumerator kUSDHC_AdmaErrorState

ADMA error state

Enum _usdhc_force_event. Force event bit position. .

Values:

enumerator kUSDHC_ForceEventAutoCommand12NotExecuted

Auto CMD12 not executed error.

enumerator kUSDHC_ForceEventAutoCommand12Timeout

Auto CMD12 timeout error.

enumerator kUSDHC_ForceEventAutoCommand12CrcError

Auto CMD12 CRC error.

enumerator kUSDHC_ForceEventEndBitError

Auto CMD12 end bit error.

enumerator kUSDHC_ForceEventAutoCommand12IndexError

Auto CMD12 index error.

enumerator kUSDHC_ForceEventAutoCommand12NotIssued

Auto CMD12 not issued error.

enumerator kUSDHC_ForceEventCommandTimeout

Command timeout error.

enumerator kUSDHC_ForceEventCommandCrcError

Command CRC error.

enumerator kUSDHC_ForceEventCommandEndBitError

Command end bit error.

enumerator kUSDHC_ForceEventCommandIndexError

Command index error.

enumerator kUSDHC_ForceEventDataTimeout

Data timeout error.

enumerator kUSDHC_ForceEventDataCrcError

Data CRC error.

enumerator kUSDHC_ForceEventDataEndBitError

Data end bit error.

enumerator kUSDHC_ForceEventAutoCommand12Error

Auto CMD12 error.

enumerator kUSDHC_ForceEventCardInt

Card interrupt.

enumerator kUSDHC_ForceEventDmaError

Dma error.

enumerator kUSDHC_ForceEventTuningError

Tuning error.

enumerator kUSDHC_ForceEventsAll

All force event flags mask.

enum _usdhc_transfer_direction

Data transfer direction.

Values:

enumerator kUSDHC_TransferDirectionReceive

USDHC transfer direction receive.

enumerator kUSDHC_TransferDirectionSend

USDHC transfer direction send.

enum _usdhc_data_bus_width

Data transfer width.

Values:

enumerator kUSDHC_DataBusWidth1Bit

1-bit mode

enumerator kUSDHC_DataBusWidth4Bit

4-bit mode

enumerator kUSDHC_DataBusWidth8Bit

8-bit mode

enum _usdhc_endian_mode

Endian mode.

Values:

enumerator kUSDHC_EndianModeBig

Big endian mode.

enumerator kUSDHC_EndianModeHalfWordBig

Half word big endian mode.

enumerator kUSDHC_EndianModeLittle

Little endian mode.

enum _usdhc_dma_mode

DMA mode.

Values:

enumerator kUSDHC_DmaModeSimple

External DMA.

enumerator kUSDHC_DmaModeAdma1

ADMA1 is selected.

enumerator kUSDHC_DmaModeAdma2

ADMA2 is selected.

enumerator kUSDHC_ExternalDMA

External DMA mode selected.

Enum _usdhc_sdio_control_flag. SDIO control flag mask. .

Values:

enumerator kUSDHC_StopAtBlockGapFlag

Stop at block gap.

enumerator kUSDHC_ReadWaitControlFlag

Read wait control.

enumerator kUSDHC_InterruptAtBlockGapFlag

Interrupt at block gap.

enumerator kUSDHC_ReadDoneNo8CLK

Read done without 8 clk for block gap.

enumerator kUSDHC_ExactBlockNumberReadFlag

Exact block number read.

enum _usdhc_boot_mode

MMC card boot mode.

Values:

enumerator kUSDHC_BootModeNormal

Normal boot

enumerator kUSDHC_BootModeAlternative

Alternative boot

enum _usdhc_card_command_type

The command type.

Values:

enumerator kCARD_CommandTypeNormal

Normal command

enumerator kCARD_CommandTypeSuspend

Suspend command

enumerator kCARD_CommandTypeResume

Resume command

enumerator kCARD_CommandTypeAbort

Abort command

enumerator kCARD_CommandTypeEmpty

Empty command

enum _usdhc_card_response_type

The command response type.

Defines the command response type from card to host controller.

Values:

enumerator kCARD_ResponseTypeNone

Response type: none

enumerator kCARD_ResponseTypeR1

Response type: R1

enumerator kCARD_ResponseTypeR1b

Response type: R1b

enumerator kCARD_ResponseTypeR2

Response type: R2

enumerator kCARD_ResponseTypeR3

Response type: R3

enumerator kCARD_ResponseTypeR4

Response type: R4

enumerator kCARD_ResponseTypeR5

Response type: R5

enumerator kCARD_ResponseTypeR5b

Response type: R5b

enumerator kCARD_ResponseTypeR6

Response type: R6

enumerator kCARD_ResponseTypeR7

Response type: R7

Enum _usdhc_adma1_descriptor_flag. The mask for the control/status field in ADMA1 descriptor.

Values:

enumerator kUSDHC_Adma1DescriptorValidFlag

Valid flag.

enumerator kUSDHC_Adma1DescriptorEndFlag

End flag.

enumerator kUSDHC_Adma1DescriptorInterrupFlag

Interrupt flag.

enumerator kUSDHC_Adma1DescriptorActivity1Flag

Activity 1 flag.

enumerator kUSDHC_Adma1DescriptorActivity2Flag

Activity 2 flag.

enumerator kUSDHC_Adma1DescriptorTypeNop

No operation.

enumerator kUSDHC_Adma1DescriptorTypeTransfer

Transfer data.

enumerator kUSDHC_Adma1DescriptorTypeLink

Link descriptor.

enumerator kUSDHC_Adma1DescriptorTypeSetLength

Set data length.

Enum _usdhc_adma2_descriptor_flag. ADMA1 descriptor control and status mask.

Values:

enumerator kUSDHC_Adma2DescriptorValidFlag

Valid flag.

enumerator kUSDHC_Adma2DescriptorEndFlag

End flag.

enumerator kUSDHC_Adma2DescriptorInterruptFlag

Interrupt flag.

enumerator kUSDHC_Adma2DescriptorActivity1Flag

Activity 1 mask.

enumerator kUSDHC_Adma2DescriptorActivity2Flag

Activity 2 mask.

enumerator kUSDHC_Adma2DescriptorTypeNop

No operation.

enumerator kUSDHC_Adma2DescriptorTypeReserved

Reserved.

enumerator kUSDHC_Adma2DescriptorTypeTransfer

Transfer type.

enumerator kUSDHC_Adma2DescriptorTypeLink

Link type.

Enum _usdhc_adma_flag. ADMA descriptor configuration flag. .

Values:

enumerator kUSDHC_AdmaDescriptorSingleFlag

Try to finish the transfer in a single ADMA descriptor. If transfer size is bigger than one ADMA descriptor’s ability, new another descriptor for data transfer.

enumerator kUSDHC_AdmaDescriptorMultipleFlag

Create multiple ADMA descriptors within the ADMA table, this is used for mmc boot mode specifically, which need to modify the ADMA descriptor on the fly, so the flag should be used combining with stop at block gap feature.

enum _usdhc_burst_len

DMA transfer burst len config.

Values:

enumerator kUSDHC_EnBurstLenForINCR

Enable burst len for INCR.

enumerator kUSDHC_EnBurstLenForINCR4816

Enable burst len for INCR4/INCR8/INCR16.

enumerator kUSDHC_EnBurstLenForINCR4816WRAP

Enable burst len for INCR4/8/16 WRAP.

Enum _usdhc_transfer_data_type. Tansfer data type definition.

Values:

enumerator kUSDHC_TransferDataNormal

Transfer normal read/write data.

enumerator kUSDHC_TransferDataTuning

Transfer tuning data.

enumerator kUSDHC_TransferDataBoot

Transfer boot data.

enumerator kUSDHC_TransferDataBootcontinous

Transfer boot data continuously.

typedef enum _usdhc_transfer_direction usdhc_transfer_direction_t

Data transfer direction.

typedef enum _usdhc_data_bus_width usdhc_data_bus_width_t

Data transfer width.

typedef enum _usdhc_endian_mode usdhc_endian_mode_t

Endian mode.

typedef enum _usdhc_dma_mode usdhc_dma_mode_t

DMA mode.

typedef enum _usdhc_boot_mode usdhc_boot_mode_t

MMC card boot mode.

typedef enum _usdhc_card_command_type usdhc_card_command_type_t

The command type.

typedef enum _usdhc_card_response_type usdhc_card_response_type_t

The command response type.

Defines the command response type from card to host controller.

typedef enum _usdhc_burst_len usdhc_burst_len_t

DMA transfer burst len config.

typedef uint32_t usdhc_adma1_descriptor_t

Defines the ADMA1 descriptor structure.

typedef struct _usdhc_adma2_descriptor usdhc_adma2_descriptor_t

Defines the ADMA2 descriptor structure.

typedef struct _usdhc_capability usdhc_capability_t

USDHC capability information.

Defines a structure to save the capability information of USDHC.

typedef struct _usdhc_boot_config usdhc_boot_config_t

Data structure to configure the MMC boot feature.

typedef struct _usdhc_config usdhc_config_t

Data structure to initialize the USDHC.

typedef struct _usdhc_command usdhc_command_t

Card command descriptor.

Defines card command-related attribute.

typedef struct _usdhc_adma_config usdhc_adma_config_t

ADMA configuration.

typedef struct _usdhc_scatter_gather_data_list usdhc_scatter_gather_data_list_t

Card scatter gather data list.

Allow application register uncontinuous data buffer for data transfer.

typedef struct _usdhc_scatter_gather_data usdhc_scatter_gather_data_t

Card scatter gather data descriptor.

Defines a structure to contain data-related attribute. The ‘enableIgnoreError’ is used when upper card driver wants to ignore the error event to read/write all the data and not to stop read/write immediately when an error event happens. For example, bus testing procedure for MMC card.

typedef struct _usdhc_scatter_gather_transfer usdhc_scatter_gather_transfer_t

usdhc scatter gather transfer.

typedef struct _usdhc_data usdhc_data_t

Card data descriptor.

Defines a structure to contain data-related attribute. The ‘enableIgnoreError’ is used when upper card driver wants to ignore the error event to read/write all the data and not to stop read/write immediately when an error event happens. For example, bus testing procedure for MMC card.

typedef struct _usdhc_transfer usdhc_transfer_t

Transfer state.

typedef struct _usdhc_handle usdhc_handle_t

USDHC handle typedef.

typedef struct _usdhc_transfer_callback usdhc_transfer_callback_t

USDHC callback functions.

typedef status_t (*usdhc_transfer_function_t)(USDHC_Type *base, usdhc_transfer_t *content)

USDHC transfer function.

typedef struct _usdhc_host usdhc_host_t

USDHC host descriptor.

USDHC_MAX_BLOCK_COUNT

Maximum block count can be set one time.

FSL_USDHC_ENABLE_SCATTER_GATHER_TRANSFER

USDHC scatter gather feature control macro.

USDHC_ADMA1_ADDRESS_ALIGN

The alignment size for ADDRESS filed in ADMA1’s descriptor.

USDHC_ADMA1_LENGTH_ALIGN

The alignment size for LENGTH field in ADMA1’s descriptor.

USDHC_ADMA2_ADDRESS_ALIGN

The alignment size for ADDRESS field in ADMA2’s descriptor.

USDHC_ADMA2_LENGTH_ALIGN

The alignment size for LENGTH filed in ADMA2’s descriptor.

USDHC_ADMA1_DESCRIPTOR_ADDRESS_SHIFT

The bit shift for ADDRESS filed in ADMA1’s descriptor.

Address/page field

Reserved

Attribute

31 12

11 6

05

04

03

02

01

00

address or data length

000000

Act2

Act1

0

Int

End

Valid

Act2

Act1

Comment

31-28

27-12

0

0

No op

Don’t care

0

1

Set data length

0000

Data Length

1

0

Transfer data

Data address

1

1

Link descriptor

Descriptor address

USDHC_ADMA1_DESCRIPTOR_ADDRESS_MASK

The bit mask for ADDRESS field in ADMA1’s descriptor.

USDHC_ADMA1_DESCRIPTOR_LENGTH_SHIFT

The bit shift for LENGTH filed in ADMA1’s descriptor.

USDHC_ADMA1_DESCRIPTOR_LENGTH_MASK

The mask for LENGTH field in ADMA1’s descriptor.

USDHC_ADMA1_DESCRIPTOR_MAX_LENGTH_PER_ENTRY

The maximum value of LENGTH filed in ADMA1’s descriptor. Since the max transfer size ADMA1 support is 65535 which is indivisible by 4096, so to make sure a large data load transfer (>64KB) continuously (require the data address be always align with 4096), software will set the maximum data length for ADMA1 to (64 - 4)KB.

USDHC_ADMA2_DESCRIPTOR_LENGTH_SHIFT

The bit shift for LENGTH field in ADMA2’s descriptor.

Address field

Length

Reserved

Attribute

63 32

31 16

15 06

05

04

03

02

01

00

32-bit address

16-bit length

0000000000

Act2

Act1

0

Int

End

Valid

Act2

Act1

Comment

Operation

0

0

No op

Don’t care

0

1

Reserved

Read this line and go to next one

1

0

Transfer data

Transfer data with address and length set in this descriptor line

1

1

Link descriptor

Link to another descriptor

USDHC_ADMA2_DESCRIPTOR_LENGTH_MASK

The bit mask for LENGTH field in ADMA2’s descriptor.

USDHC_ADMA2_DESCRIPTOR_MAX_LENGTH_PER_ENTRY

The maximum value of LENGTH field in ADMA2’s descriptor.

struct _usdhc_adma2_descriptor
#include <fsl_usdhc.h>

Defines the ADMA2 descriptor structure.

Public Members

uint32_t attribute

The control and status field.

const uint32_t *address

The address field.

struct _usdhc_capability
#include <fsl_usdhc.h>

USDHC capability information.

Defines a structure to save the capability information of USDHC.

Public Members

uint32_t sdVersion

Support SD card/sdio version.

uint32_t mmcVersion

Support EMMC card version.

uint32_t maxBlockLength

Maximum block length united as byte.

uint32_t maxBlockCount

Maximum block count can be set one time.

uint32_t flags

Capability flags to indicate the support information(_usdhc_capability_flag).

struct _usdhc_boot_config
#include <fsl_usdhc.h>

Data structure to configure the MMC boot feature.

Public Members

uint32_t ackTimeoutCount

Timeout value for the boot ACK. The available range is 0 ~ 15.

usdhc_boot_mode_t bootMode

Boot mode selection.

uint32_t blockCount

Stop at block gap value of automatic mode. Available range is 0 ~ 65535.

size_t blockSize

Block size.

bool enableBootAck

Enable or disable boot ACK.

bool enableAutoStopAtBlockGap

Enable or disable auto stop at block gap function in boot period.

struct _usdhc_config
#include <fsl_usdhc.h>

Data structure to initialize the USDHC.

Public Members

uint32_t dataTimeout

Data timeout value.

usdhc_endian_mode_t endianMode

Endian mode.

uint8_t readWatermarkLevel

Watermark level for DMA read operation. Available range is 1 ~ 128.

uint8_t writeWatermarkLevel

Watermark level for DMA write operation. Available range is 1 ~ 128.

struct _usdhc_command
#include <fsl_usdhc.h>

Card command descriptor.

Defines card command-related attribute.

Public Members

uint32_t index

Command index.

uint32_t argument

Command argument.

usdhc_card_command_type_t type

Command type.

usdhc_card_response_type_t responseType

Command response type.

uint32_t response[4U]

Response for this command.

uint32_t responseErrorFlags

Response error flag, which need to check the command reponse.

uint32_t flags

Cmd flags.

struct _usdhc_adma_config
#include <fsl_usdhc.h>

ADMA configuration.

Public Members

usdhc_dma_mode_t dmaMode

DMA mode.

uint32_t *admaTable

ADMA table address, can’t be null if transfer way is ADMA1/ADMA2.

uint32_t admaTableWords

ADMA table length united as words, can’t be 0 if transfer way is ADMA1/ADMA2.

struct _usdhc_scatter_gather_data_list
#include <fsl_usdhc.h>

Card scatter gather data list.

Allow application register uncontinuous data buffer for data transfer.

struct _usdhc_scatter_gather_data
#include <fsl_usdhc.h>

Card scatter gather data descriptor.

Defines a structure to contain data-related attribute. The ‘enableIgnoreError’ is used when upper card driver wants to ignore the error event to read/write all the data and not to stop read/write immediately when an error event happens. For example, bus testing procedure for MMC card.

Public Members

bool enableAutoCommand12

Enable auto CMD12.

bool enableAutoCommand23

Enable auto CMD23.

bool enableIgnoreError

Enable to ignore error event to read/write all the data.

usdhc_transfer_direction_t dataDirection

data direction

uint8_t dataType

this is used to distinguish the normal/tuning/boot data.

size_t blockSize

Block size.

usdhc_scatter_gather_data_list_t sgData

scatter gather data

struct _usdhc_scatter_gather_transfer
#include <fsl_usdhc.h>

usdhc scatter gather transfer.

Public Members

usdhc_scatter_gather_data_t *data

Data to transfer.

usdhc_command_t *command

Command to send.

struct _usdhc_data
#include <fsl_usdhc.h>

Card data descriptor.

Defines a structure to contain data-related attribute. The ‘enableIgnoreError’ is used when upper card driver wants to ignore the error event to read/write all the data and not to stop read/write immediately when an error event happens. For example, bus testing procedure for MMC card.

Public Members

bool enableAutoCommand12

Enable auto CMD12.

bool enableAutoCommand23

Enable auto CMD23.

bool enableIgnoreError

Enable to ignore error event to read/write all the data.

uint8_t dataType

this is used to distinguish the normal/tuning/boot data.

size_t blockSize

Block size.

uint32_t blockCount

Block count.

uint32_t *rxData

Buffer to save data read.

const uint32_t *txData

Data buffer to write.

struct _usdhc_transfer
#include <fsl_usdhc.h>

Transfer state.

Public Members

usdhc_data_t *data

Data to transfer.

usdhc_command_t *command

Command to send.

struct _usdhc_transfer_callback
#include <fsl_usdhc.h>

USDHC callback functions.

Public Members

void (*CardInserted)(USDHC_Type *base, void *userData)

Card inserted occurs when DAT3/CD pin is for card detect

void (*CardRemoved)(USDHC_Type *base, void *userData)

Card removed occurs

void (*SdioInterrupt)(USDHC_Type *base, void *userData)

SDIO card interrupt occurs

void (*BlockGap)(USDHC_Type *base, void *userData)

stopped at block gap event

void (*TransferComplete)(USDHC_Type *base, usdhc_handle_t *handle, status_t status, void *userData)

Transfer complete callback.

void (*ReTuning)(USDHC_Type *base, void *userData)

Handle the re-tuning.

struct _usdhc_handle
#include <fsl_usdhc.h>

USDHC handle.

Defines the structure to save the USDHC state information and callback function.

Note

All the fields except interruptFlags and transferredWords must be allocated by the user.

Public Members

usdhc_data_t *volatile data

Transfer parameter. Data to transfer.

usdhc_command_t *volatile command

Transfer parameter. Command to send.

volatile uint32_t transferredWords

Transfer status. Words transferred by DATAPORT way.

usdhc_transfer_callback_t callback

Callback function.

void *userData

Parameter for transfer complete callback.

struct _usdhc_host
#include <fsl_usdhc.h>

USDHC host descriptor.

Public Members

USDHC_Type *base

USDHC peripheral base address.

uint32_t sourceClock_Hz

USDHC source clock frequency united in Hz.

usdhc_config_t config

USDHC configuration.

usdhc_capability_t capability

USDHC capability information.

usdhc_transfer_function_t transfer

USDHC transfer function.

UTICK: MictoTick Timer Driver

void UTICK_Init(UTICK_Type *base)

Initializes an UTICK by turning its bus clock on.

void UTICK_Deinit(UTICK_Type *base)

Deinitializes a UTICK instance.

This function shuts down Utick bus clock

Parameters:
  • base – UTICK peripheral base address.

uint32_t UTICK_GetStatusFlags(UTICK_Type *base)

Get Status Flags.

This returns the status flag

Parameters:
  • base – UTICK peripheral base address.

Returns:

status register value

void UTICK_ClearStatusFlags(UTICK_Type *base)

Clear Status Interrupt Flags.

This clears intr status flag

Parameters:
  • base – UTICK peripheral base address.

Returns:

none

void UTICK_SetTick(UTICK_Type *base, utick_mode_t mode, uint32_t count, utick_callback_t cb)

Starts UTICK.

This function starts a repeat/onetime countdown with an optional callback

Parameters:
  • base – UTICK peripheral base address.

  • mode – UTICK timer mode (ie kUTICK_onetime or kUTICK_repeat)

  • count – UTICK timer mode (ie kUTICK_onetime or kUTICK_repeat)

  • cb – UTICK callback (can be left as NULL if none, otherwise should be a void func(void))

Returns:

none

void UTICK_HandleIRQ(UTICK_Type *base, utick_callback_t cb)

UTICK Interrupt Service Handler.

This function handles the interrupt and refers to the callback array in the driver to callback user (as per request in UTICK_SetTick()). if no user callback is scheduled, the interrupt will simply be cleared.

Parameters:
  • base – UTICK peripheral base address.

  • cb – callback scheduled for this instance of UTICK

Returns:

none

FSL_UTICK_DRIVER_VERSION

UTICK driver version 2.0.5.

enum _utick_mode

UTICK timer operational mode.

Values:

enumerator kUTICK_Onetime

Trigger once

enumerator kUTICK_Repeat

Trigger repeatedly

typedef enum _utick_mode utick_mode_t

UTICK timer operational mode.

typedef void (*utick_callback_t)(void)

UTICK callback function.

WWDT: Windowed Watchdog Timer Driver

void WWDT_GetDefaultConfig(wwdt_config_t *config)

Initializes WWDT configure structure.

This function initializes the WWDT configure structure to default value. The default value are:

config->enableWwdt = true;
config->enableWatchdogReset = false;
config->enableWatchdogProtect = false;
config->enableLockOscillator = false;
config->windowValue = 0xFFFFFFU;
config->timeoutValue = 0xFFFFFFU;
config->warningValue = 0;

See also

wwdt_config_t

Parameters:
  • config – Pointer to WWDT config structure.

void WWDT_Init(WWDT_Type *base, const wwdt_config_t *config)

Initializes the WWDT.

This function initializes the WWDT. When called, the WWDT runs according to the configuration.

Example:

wwdt_config_t config;
WWDT_GetDefaultConfig(&config);
config.timeoutValue = 0x7ffU;
WWDT_Init(wwdt_base,&config);

Parameters:
  • base – WWDT peripheral base address

  • config – The configuration of WWDT

void WWDT_Deinit(WWDT_Type *base)

Shuts down the WWDT.

This function shuts down the WWDT.

Parameters:
  • base – WWDT peripheral base address

static inline void WWDT_Enable(WWDT_Type *base)

Enables the WWDT module.

This function write value into WWDT_MOD register to enable the WWDT, it is a write-once bit; once this bit is set to one and a watchdog feed is performed, the watchdog timer will run permanently.

Parameters:
  • base – WWDT peripheral base address

static inline void WWDT_Disable(WWDT_Type *base)

Disables the WWDT module.

Deprecated:

Do not use this function. It will be deleted in next release version, for once the bit field of WDEN written with a 1, it can not be re-written with a 0.

This function write value into WWDT_MOD register to disable the WWDT.

Parameters:
  • base – WWDT peripheral base address

static inline uint32_t WWDT_GetStatusFlags(WWDT_Type *base)

Gets all WWDT status flags.

This function gets all status flags.

Example for getting Timeout Flag:

uint32_t status;
status = WWDT_GetStatusFlags(wwdt_base) & kWWDT_TimeoutFlag;

Parameters:
  • base – WWDT peripheral base address

Returns:

The status flags. This is the logical OR of members of the enumeration _wwdt_status_flags_t

void WWDT_ClearStatusFlags(WWDT_Type *base, uint32_t mask)

Clear WWDT flag.

This function clears WWDT status flag.

Example for clearing warning flag:

WWDT_ClearStatusFlags(wwdt_base, kWWDT_WarningFlag);

Parameters:
  • base – WWDT peripheral base address

  • mask – The status flags to clear. This is a logical OR of members of the enumeration _wwdt_status_flags_t

static inline void WWDT_SetWarningValue(WWDT_Type *base, uint32_t warningValue)

Set the WWDT warning value.

The WDWARNINT register determines the watchdog timer counter value that will generate a watchdog interrupt. When the watchdog timer counter is no longer greater than the value defined by WARNINT, an interrupt will be generated after the subsequent WDCLK.

Parameters:
  • base – WWDT peripheral base address

  • warningValue – WWDT warning value.

static inline void WWDT_SetTimeoutValue(WWDT_Type *base, uint32_t timeoutCount)

Set the WWDT timeout value.

This function sets the timeout value. Every time a feed sequence occurs the value in the TC register is loaded into the Watchdog timer. Writing a value below 0xFF will cause 0xFF to be loaded into the TC register. Thus the minimum time-out interval is TWDCLK*256*4. If enableWatchdogProtect flag is true in wwdt_config_t config structure, any attempt to change the timeout value before the watchdog counter is below the warning and window values will cause a watchdog reset and set the WDTOF flag.

Parameters:
  • base – WWDT peripheral base address

  • timeoutCount – WWDT timeout value, count of WWDT clock tick.

static inline void WWDT_SetWindowValue(WWDT_Type *base, uint32_t windowValue)

Sets the WWDT window value.

The WINDOW register determines the highest TV value allowed when a watchdog feed is performed. If a feed sequence occurs when timer value is greater than the value in WINDOW, a watchdog event will occur. To disable windowing, set windowValue to 0xFFFFFF (maximum possible timer value) so windowing is not in effect.

Parameters:
  • base – WWDT peripheral base address

  • windowValue – WWDT window value.

void WWDT_Refresh(WWDT_Type *base)

Refreshes the WWDT timer.

This function feeds the WWDT. This function should be called before WWDT timer is in timeout. Otherwise, a reset is asserted.

Parameters:
  • base – WWDT peripheral base address

FSL_WWDT_DRIVER_VERSION

Defines WWDT driver version.

WWDT_FIRST_WORD_OF_REFRESH

First word of refresh sequence

WWDT_SECOND_WORD_OF_REFRESH

Second word of refresh sequence

enum _wwdt_status_flags_t

WWDT status flags.

This structure contains the WWDT status flags for use in the WWDT functions.

Values:

enumerator kWWDT_TimeoutFlag

Time-out flag, set when the timer times out

enumerator kWWDT_WarningFlag

Warning interrupt flag, set when timer is below the value WDWARNINT

typedef struct _wwdt_config wwdt_config_t

Describes WWDT configuration structure.

struct _wwdt_config
#include <fsl_wwdt.h>

Describes WWDT configuration structure.

Public Members

bool enableWwdt

Enables or disables WWDT

bool enableWatchdogReset

true: Watchdog timeout will cause a chip reset false: Watchdog timeout will not cause a chip reset

bool enableWatchdogProtect

true: Enable watchdog protect i.e timeout value can only be changed after counter is below warning & window values false: Disable watchdog protect; timeout value can be changed at any time

uint32_t windowValue

Window value, set this to 0xFFFFFF if windowing is not in effect

uint32_t timeoutValue

Timeout value

uint32_t warningValue

Watchdog time counter value that will generate a warning interrupt. Set this to 0 for no warning

uint32_t clockFreq_Hz

Watchdog clock source frequency.

CACHE: CACHE Memory Controller

uint32_t XCACHE_GetInstanceByAddr(uint32_t address)

brief Returns an instance number given physical memory address.

param address The physical memory address.

Returns:

XCACHE instance number starting from 0.

void XCACHE_EnableCache(XCACHE_Type *base)

Enables the cache.

Parameters:
  • base – XCACHE peripheral base address.

void XCACHE_DisableCache(XCACHE_Type *base)

Disables the cache.

Parameters:
  • base – XCACHE peripheral base address.

void XCACHE_InvalidateCache(XCACHE_Type *base)

Invalidates the cache.

Parameters:
  • base – XCACHE peripheral base address.

void XCACHE_InvalidateCacheByRange(uint32_t address, uint32_t size_byte)

Invalidates cache by range.

Note

Address and size should be aligned to “XCACHE_LINESIZE_BYTE”. The startAddr here will be forced to align to XCACHE_LINESIZE_BYTE if startAddr is not aligned. For the size_byte, application should make sure the alignment or make sure the right operation order if the size_byte is not aligned.

Parameters:
  • address – The physical address of cache.

  • size_byte – size of the memory to be invalidated, should be larger than 0, better to align with cache line size.

void XCACHE_CleanCache(XCACHE_Type *base)

Cleans the cache.

Parameters:
  • base – XCACHE peripheral base address.

void XCACHE_CleanCacheByRange(uint32_t address, uint32_t size_byte)

Cleans cache by range.

Note

Address and size should be aligned to “XCACHE_LINESIZE_BYTE”. The startAddr here will be forced to align to XCACHE_LINESIZE_BYTE if startAddr is not aligned. For the size_byte, application should make sure the alignment or make sure the right operation order if the size_byte is not aligned.

Parameters:
  • address – The physical address of cache.

  • size_byte – size of the memory to be cleaned, should be larger than 0, better to align with cache line size.

void XCACHE_CleanInvalidateCache(XCACHE_Type *base)

Cleans and invalidates the cache.

Parameters:
  • base – XCACHE peripheral base address.

void XCACHE_CleanInvalidateCacheByRange(uint32_t address, uint32_t size_byte)

Cleans and invalidate cache by range.

Note

Address and size should be aligned to “XCACHE_LINESIZE_BYTE”. The startAddr here will be forced to align to XCACHE_LINESIZE_BYTE if startAddr is not aligned. For the size_byte, application should make sure the alignment or make sure the right operation order if the size_byte is not aligned.

Parameters:
  • address – The physical address of cache.

  • size_byte – size of the memory to be Cleaned and Invalidated, should be larger than 0, better to align with cache line size.

static inline void ICACHE_InvalidateByRange(uint32_t address, uint32_t size_byte)

Invalidates instruction cache by range.

Note

Address and size should be aligned to XCACHE_LINESIZE_BYTE due to the cache operation unit FSL_FEATURE_XCACHE_LINESIZE_BYTE. The startAddr here will be forced to align to the cache line size if startAddr is not aligned. For the size_byte, application should make sure the alignment or make sure the right operation order if the size_byte is not aligned.

Parameters:
  • address – The physical address.

  • size_byte – size of the memory to be invalidated, should be larger than 0, better to align with cache line size.

static inline void DCACHE_InvalidateByRange(uint32_t address, uint32_t size_byte)

Invalidates data cache by range.

Note

Address and size should be aligned to XCACHE_LINESIZE_BYTE due to the cache operation unit FSL_FEATURE_XCACHE_LINESIZE_BYTE. The startAddr here will be forced to align to the cache line size if startAddr is not aligned. For the size_byte, application should make sure the alignment or make sure the right operation order if the size_byte is not aligned.

Parameters:
  • address – The physical address.

  • size_byte – size of the memory to be invalidated, should be larger than 0, better to align with cache line size.

static inline void DCACHE_CleanByRange(uint32_t address, uint32_t size_byte)

Clean data cache by range.

Note

Address and size should be aligned to XCACHE_LINESIZE_BYTE due to the cache operation unit FSL_FEATURE_XCACHE_LINESIZE_BYTE. The startAddr here will be forced to align to the cache line size if startAddr is not aligned. For the size_byte, application should make sure the alignment or make sure the right operation order if the size_byte is not aligned.

Parameters:
  • address – The physical address.

  • size_byte – size of the memory to be cleaned, should be larger than 0, better to align with cache line size.

static inline void DCACHE_CleanInvalidateByRange(uint32_t address, uint32_t size_byte)

Cleans and Invalidates data cache by range.

Note

Address and size should be aligned to XCACHE_LINESIZE_BYTE due to the cache operation unit FSL_FEATURE_XCACHE_LINESIZE_BYTE. The startAddr here will be forced to align to the cache line size if startAddr is not aligned. For the size_byte, application should make sure the alignment or make sure the right operation order if the size_byte is not aligned.

Parameters:
  • address – The physical address.

  • size_byte – size of the memory to be Cleaned and Invalidated, should be larger than 0, better to align with cache line size.

FSL_CACHE_DRIVER_VERSION

cache driver version.

XCACHE_LINESIZE_BYTE

cache line size.

XSPI: Serial Peripheral Interface Driver

Status structure of XSPI.

Values:

enumerator kStatus_XSPI_Busy

XSPI is Busy

enumerator kStatus_XSPI_IpCommandUsageError

XSPI Ip Command Usage Error

enumerator kStatus_XSPI_IpCommandtriggerError

XSPI Ip Command Trigger Error

enumerator kStatus_XSPI_IllegalInstructionError

XSPI Illegal Instruction Error

enumerator kStatus_XSPI_SequenceExecutionTimeout

XSPI Sequence Execution Timeout

enumerator kStatus_XSPI_FradCheckError

XSPI Frad Check Error

enumerator kStatus_XSPI_TgQueueWritingError

XSPI Tg Queue Writing Error

enumerator kStatus_XSPI_IpsBusTransError

XSPI Ip Bus Transfer Error

enumerator kStatus_XSPI_AhbReadAccessAsserted

AHB read access is asserted.

enumerator kStatus_XSPI_AhbWriteAccessAsserted

AHB write access is asserted.

enumerator kStatus_XSPI_IPAccessAsserted

IP access is asserted.

enumerator kStatus_XSPI_AhbSubBufferFactorError

Wrong sub buffer factor input.

enumerator kStatus_XSPI_RegWriteLocked

Fail to write register due to write operation is locked.

enumerator kStatus_XSPI_WaterMarkIllegal

The watermark value to set is not in multiple of 4 bytes.

enumerator kStatus_XSPI_PageProgramWaitFlagAsserted

The page program wait flag already asserted.

enumerator kStatus_XSPI_IpAccessAddrSettingInvalid

The input address for Ip access is invalid.

enumerator kStatus_XSPI_RxBufferEntriesCountError

The count of entries of RX buffer is incorrect.

enumerator kStatus_XSPI_IpAccessIPCRInvalid

Access attributes to write IPCR are not correct.

enumerator kStatus_XSPI_IpAccessNotGranted

IP request not granted by arbiter.

enumerator kStatus_XSPI_IpReadFinished

Finish IP read all data stored in buffer.

enumerator kStatus_XSPI_IpWriteFinished

Finish IP write operation.

enumerator kStatus_XSPI_TxBufferUnderrun

XSPI attempted to pull data when the TX buffer is empty.

enumerator kStatus_XSPI_ArbiterGranted

XSPI arbiter granted.

enum _xspi_lut_instr

CMD definition of XSPI, use to form LUT instruction, xspi_lut_instr_t.

Values:

enumerator kXSPI_Command_STOP

Stop execution, de-assert CS.

enumerator kXSPI_Command_SDR

Transmit Command code to Flash, using SDR mode.

enumerator kXSPI_Command_RADDR_SDR

Transmit Row Address to Flash, using SDR mode.

enumerator kXSPI_Command_DUMMY_SDR

Leave data lines un-driven by xSPI controller, using SDR mode.

enumerator kXSPI_Command_MODE_SDR

Transmit 8-bit Mode bits to Flash, using SDR mode.

enumerator kXSPI_Command_MODE2_SDR

Transmit 2-bit Mode bits to Flash, using SDR mode.

enumerator kXSPI_Command_MODE4_SDR

Transmit 4-bit Mode bits to Flash, using SDR mode.

enumerator kXSPI_Command_READ_SDR

Receive Read Data from Flash, using SDR mode.

enumerator kXSPI_Command_WRITE_SDR

Transmit Programming Data to Flash, using SDR mode.

enumerator kXSPI_Command_JMP_ON_CS

Stop execution, de-assert CS and save operand[7:0] as the instruction start pointer for next sequence

enumerator kXSPI_Command_RADDR_DDR

Transmit Row Address to Flash, using DDR mode.

enumerator kXSPI_Command_MODE_DDR

Transmit 8-bit Mode bits to Flash, using DDR mode.

enumerator kXSPI_Command_MODE2_DDR

Transmit 2-bit Mode bits to Flash, using DDR mode.

enumerator kXSPI_Command_MODE4_DDR

Transmit 4-bit Mode bits to Flash, using DDR mode.

enumerator kXSPI_Command_READ_DDR

Receive Read Data from Flash, using DDR mode.

enumerator kXSPI_Command_WRITE_DDR

Transmit Programming Data to Flash, using DDR mode.

enumerator kXSPI_Command_LEARN_DDR

Receive Read Data or Preamble bit from Flash, DDR mode.

enumerator kXSPI_Command_DDR

Transmit Command code to Flash, using DDR mode.

enumerator kXSPI_Command_CADDR_SDR

Transmit Column Address to Flash, using SDR mode.

enumerator kXSPI_Command_CADDR_DDR

Transmit Column Address to Flash, using DDR mode.

enumerator kXSPI_Command_JUMP_TO_SEQ

Jump the LUT sequence pointed to by the operand.

enum _xspi_pad

pad definition of XSPI, use to form LUT instruction.

Values:

enumerator kXSPI_1PAD

Transmit command/address and transmit/receive data only through DATA0/DATA1.

enumerator kXSPI_2PAD

Transmit command/address and transmit/receive data only through DATA[1:0].

enumerator kXSPI_4PAD

Transmit command/address and transmit/receive data only through DATA[3:0].

enumerator kXSPI_8PAD

Transmit command/address and transmit/receive data only through DATA[7:0].

enum _xspi_flags

XSPI interrupt status flags.

Deprecated:

For Error flag please use xspi_error_flag_t as instead, for cmd execution and arbitration flag please use xspi_cmd_execution_arbitration_flag_t as instead.

Values:

enumerator kXSPI_DataLearningFailedFlag

Data learning failed.

enumerator kXSPI_DllAbortFlag

DLL Abort.

enumerator kXSPI_DllUnlockFlag

This field is set whenever DLL unlock event occurs, irrespective of flash memory access.

enumerator kXSPI_TxBufferFillFlag

If the field remains cleared, the TX buffer can be considered as full.

enumerator kXSPI_TxBufferUnderrunFlag

This field is set if the module tries to pull data when the TX buffer is empty

enumerator kXSPI_RxBufferOverflowFlag

This field is set when no more data can be pushed into the RX buffer from the serial flash memory device.

enumerator kXSPI_RxBufferDrainFlag

This field is set if SR[RXWE] is asserted.

enumerator kXSPI_AhbAbortErrorFlag

This flag can be set when AHB transaction error

enumerator kXSPI_AhbIllegalTransactionErrorFlag
enumerator kXSPI_AhbIllegalBurstSizeErrorFlag

The total burst size is more than prefetch size.

enumerator kXSPI_AhbBufferOverflowFlag

The size of the AHB access exceed the size of the AHB buffer.

enumerator kXSPI_AhbPerformanceMonitorOverflowFlag

AHB performance hit or miss counter overflow.

enumerator kXSPI_AhbReadAddressErrorFlag

The master send an AHB read address to that buffer is not within the address range of any sub-buffers or the address within multiple sub-buffers.

enumerator kXSPI_IllegalInstructionErrorFlag

This field is set when an illegal instruction is encountered by the controller in any of the sequences.

enumerator kXSPI_IpCmdtriggerErrorFlag

Write access to Rx buffer control reg when IP-triggered command is executing.

enumerator kXSPI_PageProgramWaitFlag

Indicates assertion of the page-program wait flag after writing to flash memory.

enumerator kXSPI_IpCommandExecutionDoneFlag

Indicates XSPI has completed a running IP command.

enumerator kXSPI_SequenceExecutionTimeoutFlag

Sequence execution timeout.

enumerator kXSPI_FradMatchErrorFlag
enumerator kXSPI_Frad0AccessErrorFlag
enumerator kXSPI_Frad1AccessErrorFlag
enumerator kXSPI_Frad2AccessErrorFlag
enumerator kXSPI_Frad3AccessErrorFlag
enumerator kXSPI_Frad4AccessErrorFlag
enumerator kXSPI_Frad5AccessErrorFlag
enumerator kXSPI_Frad6AccessErrorFlag
enumerator kXSPI_Frad7AccessErrorFlag
enumerator kXSPI_FradnAccErrorFlag

ORed value of all frad error flag,.

enumerator kXSPI_IpsErrorFlag
enumerator kXSPI_Tg0SfarErrorFlag
enumerator kXSPI_Tg1SfarErrorFlag
enumerator kXSPI_TgnIpcrErrorFlag
enumerator kXSPI_LockRegErrorFlag
enumerator kXSPI_ArbLockTimeoutFlag
enumerator kXSPI_ArbWinEventFlag
enum _xspi_error_flag

The enumeration of error flags. .

Values:

enumerator kXSPI_ErrorNoFradMatch

The transaction address does not lie within the address range of any FRAD.

enumerator kXSPI_ErrorFrad0Access

The transaction address lies within the address range of the FRAD0 but it does not pass the access permission checks for the FRAD or the FRAD is under exclusive lock by another manager.

enumerator kXSPI_ErrorFrad1Access

The transaction address lies within the address range of the FRAD1 but it does not pass the access permission checks for the FRAD or the FRAD is under exclusive lock by another manager.

enumerator kXSPI_ErrorFrad2Access

The transaction address lies within the address range of the FRAD2 but it does not pass the access permission checks for the FRAD or the FRAD is under exclusive lock by another manager.

enumerator kXSPI_ErrorFrad3Access

The transaction address lies within the address range of the FRAD3 but it does not pass the access permission checks for the FRAD or the FRAD is under exclusive lock by another manager.

enumerator kXSPI_ErrorFrad4Access

The transaction address lies within the address range of the FRAD4 but it does not pass the access permission checks for the FRAD or the FRAD is under exclusive lock by another manager.

enumerator kXSPI_ErrorFrad5Access

The transaction address lies within the address range of the FRAD5 but it does not pass the access permission checks for the FRAD or the FRAD is under exclusive lock by another manager.

enumerator kXSPI_ErrorFrad6Access

The transaction address lies within the address range of the FRAD6 but it does not pass the access permission checks for the FRAD or the FRAD is under exclusive lock by another manager.

enumerator kXSPI_ErrorFrad7Access

The transaction address lies within the address range of the FRAD7 but it does not pass the access permission checks for the FRAD or the FRAD is under exclusive lock by another manager.

enumerator kXSPI_ErrorIpBusTransfer

A common error has occurred and XSPI has generated an IPS bus transfer error.

enumerator kXSPI_ErrorTg0Sfar

An SFAR write trigger an error while written to the TG0.

enumerator kXSPI_ErrorTg1Sfar

An SFAR write trigger an error while written to the TG1.

enumerator kXSPI_ErrorTg0Ipcr

An IPCR write trigger an error while written to the TG0.

enumerator kXSPI_ErrorTg1Ipcr

An IPCR write trigger an error while written to the TG1.

enumerator kXSPI_ErrorTimeout

A flash memory transaction has triggered a timeout error and has been terminated by SFP.

enumerator kXSPI_ArbitrationWin

The target group request was granted access.

enumerator kXSPI_ErrorArbitrationLock

Arbitration lock has timed out.

enumerator kXSPI_ErrorWriteLockedReg

An attempt to write a locked register.

enum _xspi_cmd_execution_arbitration_flag

The enumeration of cmd execution and arbitration. .

Values:

enumerator kXSPI_FlagIpCmdFinished

IP command transaction finished flag.

enumerator kXSPI_FlagAhbReadAddrError

Wrong AHB read address, XSPI return AHB error payload.

enumerator kXSPI_FlagAhbPerformanceMonitorOverflow

Buffer hit or miss counter overflow.

enumerator kXSPI_FlagIpCmdTriggerFail

Fail when set IP RX buffer watermark.

enumerator kXSPI_FlagPageProgramWait

Indicate assertion of the page-program wait flag after writing to flash memory.

enumerator kXSPI_FlagAhbBufferOverflow

The size of the AHB access exceeds the size of AHB buffer.

enumerator kXSPI_FlagAhbIllegalBurstSizeError

The total burst size of the AHB transacton is greater than the prefetch data size.

enumerator kXSPI_FlagAhbIllegalTransactionError

XSPI has not generated a response to the AHB bus due to an illegal transaction and expiration of the watchdog timer.

enumerator kXSPI_FlagAhbTransactionError

AHB transaction error.

enumerator kXSPI_FlagRxBufferWatermarkExceeded

The RX buffer watermark has been exceeded.

enumerator kXSPI_FlagRxBufferOverflow

The RX buffer cannot receive any more data from the SFM device.

enumerator kXSPI_FlagIllegalInstrError

The xspi encountered an illegal instruction in any sequence.

enumerator kXSPI_FlagDllUnlock

DLL unlock.

enumerator kXSPI_FlagTxBufferUnderRun

XSPI attempt to pull data when the TX buffer is empty.

enumerator kXSPI_FlagTxBufferFill

The TX buffer is filling.

enumerator kXSPI_FlagDllAbort

DLL terminate.

enumerator kXSPI_FlagDataLearningPatternFailure

The XSPI encountered a DATA_LEARN instruction in a sequence, but no sampling point is found for the data learning pattern.

enum _xspi_interrupt_enable

Values:

enumerator kXSPI_TransactionFinishIntEnable

Enable generation of an interrupt when an IP command transaction completes.

enumerator kXSPI_AhbReadAddrErrorIntEnable

Enable generation of an interrupt on occurrence of an AHB read address error.

enumerator kXSPI_AhbPerformanceMonitorOverflowIntEnable

Enable generation of an interrupt on a buffer hit or miss counter overflow.

enumerator kXSPI_IpCmdTrigFailErrorIntEnable

IP command trigger fail error interrupt enable.

enumerator kXSPI_PageProgramWaitIntEnable

Enable generation of an interrupt on page-program wait.

enumerator kXSPI_AhbBufferOverflowIntEnable

Enable generation of an interrupt on occurrence of an AHB buffer overflow.

enumerator kXSPI_AhbIllegalBurstSizeErrorIntEnable

Enable generation of an interrupt on occurrence of an AHB illegal burst size error.

enumerator kXSPI_AhbIllegalTransactionErrorIntEnable

Enable generation of an interrupt of an AHB illegal transaction error.

enumerator kXSPI_AhbAbortErrorIntEnable

Enable generation of an interrupt on occurrence of an AHB abort error.

enumerator kXSPI_RxBufferDrainIntEnable

Enable generation of an interrupt on occurrence of RX buffer drain.

enumerator kXSPI_RxBufferOverflowIntEnable

Enable generation of an interrupt on occurrence of RX buffer overflow.

enumerator kXSPI_IllegalInstrErrorIntEnable

Enable generation of an interrupt on occurrence of an illegal instruction error.

enumerator kXSPI_DllUnlockIntEnable

Enable generation of an interrupt on a DLL unlock event.

enumerator kXSPI_TxBufferUnderrunIntEnable

Enable generation of an interrupt on TX buffer underrun.

enumerator kXSPI_TxBufferFillIntEnable

Enable generation of an interrupt on TX buffer fill.

enumerator kXSPI_DataLearningPatternFailIntEnable

Enable generation of an interrupt on data learning pattern failure.

enumerator kXSPI_NoFradMatchErrorIntEnable

Enable the interrupt generated when the transaction address does not lie within the address range of any FRAD.

enumerator kXSPI_Frad0AccessErrorIntEnable

Enable the interrupt generated when the transaction address lies within the address range of the FRAD0 but it does not pass the access permission checks for the FRAD or the FRAD is under exclusive lock.

enumerator kXSPI_Frad1AccessErrorIntEnable

Enable the interrupt generated when the transaction address lies within the address range of the FRAD1 but it does not pass the access permission checks for the FRAD or the FRAD is under exclusive lock.

enumerator kXSPI_Frad2AccessErrorIntEnable

Enable the interrupt generated when the transaction address lies within the address range of the FRAD2 but it does not pass the access permission checks for the FRAD or the FRAD is under exclusive lock.

enumerator kXSPI_Frad3AccessErrorIntEnable

Enable the interrupt generated when the transaction address lies within the address range of the FRAD3 but it does not pass the access permission checks for the FRAD or the FRAD is under exclusive lock.

enumerator kXSPI_Frad4AccessErrorIntEnable

Enable the interrupt generated when the transaction address lies within the address range of the FRAD4 but it does not pass the access permission checks for the FRAD or the FRAD is under exclusive lock.

enumerator kXSPI_Frad5AccessErrorIntEnable

Enable the interrupt generated when the transaction address lies within the address range of the FRAD5 but it does not pass the access permission checks for the FRAD or the FRAD is under exclusive lock.

enumerator kXSPI_Frad6AccessErrorIntEnable

Enable the interrupt generated when the transaction address lies within the address range of the FRAD6 but it does not pass the access permission checks for the FRAD or the FRAD is under exclusive lock.

enumerator kXSPI_Frad7AccessErrorIntEnable

Enable the interrupt generated when the transaction address lies within the address range of the FRAD7 but it does not pass the access permission checks for the FRAD or the FRAD is under exclusive lock.

enumerator kXSPI_IpsErrIntEnable

Enable the interrupt generated when a common error has occurred an XSPI has generated an IPS bus transfer error.

enumerator kXSPI_Tg0SfarErrIntEnable

Enable the interrupt generated when an SFAR write triggers an error while being written to the target group 0.

enumerator kXSPI_Tg1SfarErrIntEnable

Enable the interrupt generated when an SFAR write triggers an error while being written to the target group 1.

enumerator kXSPI_Tg0IpcrErrIntEnable

Enable the interrupt generated when an IPCR write triggers an error while being written to the target group 0.

enumerator kXSPI_Tg1IpcrErrIntEnable

Enable the interrupt generated when an IPCR write triggers an error while being written to the target group 1.

enumerator kXSPI_TimeoutErrIntEnable

Enable the interrupt generated when a flash memory transaction triggers a timeout error and has been terminated by SFP.

enumerator kXSPI_ArbitrationWinIntEnable

Enable the interrupt generated when the target group queue request is granted access.

enumerator kXSPI_ArbitrationLockTimeoutErrIntEnable

Enable the interrupt generated when a flash memory transaction triggers a timeout error and has been terminated by SFP.

enumerator kXSPI_LockRegWriteErrIntEnable

Enable the interrupt generated by an attempt to write a locked register.

enum _xspi_external_signal

The enumeration of Idle signal drive IOFA[3] and IOFA[2].

Values:

enumerator XSPI_SignalIOFA2

Idle signal drive IOFA[2].

enumerator XSPI_SignalIOFA3

Idle signal drive IOFA[3].

enum _xspi_dll_mode

Dll Mode enumerations.

Values:

enumerator kXSPI_AutoUpdateMode

Dll mode : Auto update mode.

enumerator kXSPI_BypassMode

Dll mode : Bypass mode.

enum _xspi_sample_clk_source

The enumeration of sample clock source which is used to sample data from external devices.

Note

If external device support Data strobe signal, the sample clock should selected as kXSPI_SampleClkFromExternalDQS.

Values:

enumerator kXSPI_SampleClkFromNonInvertedFullySpeedDummyPadLoopback

Sample clock from non inverted fully speed dummy pad loopback.

enumerator kXSPI_SampleClkFromInvertedFullySpeedDummyPadLoopback

Sample clock from inverted fully speed dummy pad loopback.

enumerator kXSPI_SampleClkFromHalfSpeedDummyPadLoopback

Sample clock from half fully speed dummy pad loopback.

enumerator kXSPI_SampleClkFromDqsPadLoopback

Sample clock from Dqs pad loopback.

enumerator kXSPI_SampleClkFromExternalDQS

Sample clock from external DQS signal.

enum _xspi_data_learning_pad_select

The selection of data learning pad.

Values:

enumerator kXSPI_OnlyIO1

IO1 selected as pad to use for pattern matching IO.

enumerator kXSPI_BothIO1IO3

IO1 and IO3 selected as pad to use for pattern matching IO.

enum _xspi_device_addr_mode

External device’s address mode.

Values:

enumerator kXSPI_DeviceByteAddressable

Byte addressable.

enumerator kXSPI_Device2ByteAddressable

Two bytes addressable.

enumerator kXSPI_Device4ByteAddressable

Four bytes addressable.

enum _xspi_device_interface_type

The enumeration of external device’s interface type, hyper bus or SPI(including strandard and extended).

Note

Different interface result different settings.

Values:

enumerator kXSPI_StrandardExtendedSPI

External device follow SPI protocol, DQS_OUT_EN must be 0

enumerator kXSPI_HyperBus

External device follow hyper Bus protocol, DQS_OUT_EN must be 1

enum _xspi_hyper_bus_x16_mode

The enumeration of hyper bus X16 mode.

Values:

enumerator kXSPI_x16ModeDisable

X16 mode is disabled.

enumerator kXSPI_x16ModeEnabledOnlyData

X16 mode is enabled only for data.

enumerator kXSPI_x16ModeEnabledAddrCmdData

X16 mode is enabled for address, command, and data.

enum _xspi_ddr_data_aligned_clk

Enumeration defining the alignment modes of XSPI DDR data with respect to the internal reference clock.

Values:

enumerator kXSPI_DDRDataAlignedWithInternalRefClk

DDR data aligned with internal reference clock.

enumerator kXSPI_DDRDataAlignedWith2xInternalRefClk

DDR data aligned with 2X internal reference clock.

enum _xspi_command_type

Command type.

Values:

enumerator kXSPI_Command

XSPI operation: Only command, both TX and Rx buffer are ignored.

enumerator kXSPI_Config

XSPI operation: Configure device mode, the TX fifo size is fixed in LUT.

enumerator kXSPI_Read

XSPI operation: Read, only Rx Buffer is effective.

enumerator kXSPI_Write

XSPI operation: Read, only Tx Buffer is effective.

enum _xspi_mdad_mask_type

The enumeration of SFP MDAD mask type.

Values:

enumerator kXSPI_MdadMaskTypeAnd

Target master is mask & reference.

enumerator kXSPI_MdadMaskTypeOr

Target master is mask | reference.

enum _xspi_mdad_error_reason

The enumeration of MDAD error reasons.

Values:

enumerator kXSPI_ErrorOnlyDataSize

Error reason: Only Data size without required attributes.

enumerator kXSPI_ErrorOnlySeqId

Error reason: Only sequence ID without required attributes.

enumerator kXSPI_ErrorBothDataSizeSeqId

Error reason: Both Data size and sequence ID without required attributes.

enum _xspi_exclusive_access_lock_mode

Exclusive access lock.

Values:

enumerator kXSPI_ExclusiveAccessLockDisabled

Write permissions available for all masters based on their MDxACP evaluation.

enumerator kXSPI_ExclusiveAccessLockEnabled

Write permissions revoked for all domains, Any write transaction coming to this flash address will result in an error..

enumerator kXSPI_ExclusiveAccessLockExceptMasterId

Write permissions are revoked for all masters except the master ID specified by FRADn_WORD2[EALO] fields.

enum _xspi_secure_attribute

XSPI defines the secure attribute selection criteria for entry into descriptor queue…

Values:

enumerator kXSPI_AttributeMasterNonsecureOnly

Allow the bus attribute for this master to non-secure only

enumerator kXSPI_AttributeMasterSecureOnly

Allow the bus attribute for this master to secure only

enumerator kXSPI_AttributeMasterNonsecureSecureBoth

Allow the bus master’s attribute: Both secure and non-secure

enum _xspi_descriptor_lock

Descriptor lock.

Values:

enumerator kXSPI_DescriptorLockDisabled

Descriptor registers can be written by any master

enumerator kXSPI_DescriptorLockEnabledTillHardReset

FRAD descriptor is read-only till next hard reset.

enumerator kXSPI_DescriptorLockEnabledExceptMasterId

Descriptors are read-only. MDnACP fields can be programmed only by the master with ID matching the MID.

enumerator kXSPI_DescriptorLockEnabled

Descriptor registers are read-only.

enum _xspi_target_group

The enumeration of target group.

Values:

enumerator kXSPI_TargetGroup0

Target groupe queue 0

enumerator kXSPI_TargetGroup1

Target groupe queue 1

enum _xspi_subbuffer_division_factor

Subbuffer division factor.

Values:

enumerator kXSPI_Division0

division factor 0

enumerator kXSPI_Division2

division factor 2 subbuffer size/2

enumerator kXSPI_Division4

division factor 4 subbuffer size/4

enumerator kXSPI_Division8

division factor 8 subbuffer size/8

enumerator kXSPI_Division16

division factor 16 subbuffer size/16

enum _xspi_ahb_sub_buffer_status

The enumeration of sub buffer status, empty, full, or partially full.

Values:

enumerator kXSPI_AhbSubBufferEmpty

Current sub buffer is empty.

enumerator kXSPI_AhbSubBufferFull

Current sub buffer is full.

enumerator kXSPI_AhbSubBufferPartiallyFull

Current sub buffer contains some entries.

enum _xspi_ppw_flag_clear_policy

The enumeration of XSPI page program waiting flag clear policy.

Values:

enumerator kXSPI_SoftwareClearPPWFlag

Application should clear the flag manually, after check the WIP of external flag is cleared.

enumerator kXSPI_HardwareClearPPWFlag

The flag is cleared by hardware automatically, the variable in type of xspi_device_status_reg_info_t should be defined.

enum _xspi_ahb_split_size

XSPI AHB Split Size These bits are used to control the split size when split function is enabled BFGENCR[SPLITEN] is ‘1’.

Values:

enumerator kXSPI_AhbSplitSize8b

Enable AHB transaction split and split size is 8 bytes.

enumerator kXSPI_AhbSplitSize16b

Enable AHB transaction split and split size is 16 bytes.

enumerator kXSPI_AhbSplitSize32b

Enable AHB transaction split and split size is 32 bytes.

enumerator kXSPI_AhbSplitSize64b

Enable AHB transaction split and split size is 64 bytes.

enumerator kXSPI_AhbSplitSizeDisabled

Disable AHB Transaction Split feature.

enum _xspi_ahb_alignment

XSPI AHB access towards flash is broken if this AHB alignment boundary is crossed. This field is only supported XSPI0 XSPI1.

Values:

enumerator kXSPI_AhbAlignmentNoLimit

no limit

enumerator kXSPI_AhbAlignment256BLimit

256B limit

enumerator kXSPI_AhbAlignment512BLimit

512B limit

enumerator kXSPI_AhbAlignment1KBLimit

1KB limit

enum _xspi_ahb_request_suspend_state

The enumeration of AHB request suspend state.

Values:

enumerator kXSPI_AhbRequestNoSuspended

None of AHB request is suspended.

enumerator kXSPI_AhbRequestSuspended

The AHB request is suspended.

enumerator kXSPI_AhbRequestNotApplicable

The AHB request is not applicable.

enumerator kXSPI_AhbReqestResumed

The AHB request is resumed.

enum _xspi_otfad_prefetch_boundary

The enumeration of OTFAD prefetch address boundary.

Values:

enumerator kXSPI_OTFADPrefetchNoBoundary

No prefetch address boundary.

enumerator kXSPI_OTFADPrefetchBoundary1K

Prefetch address boundary is 1K.

enum _xspi_byte_order

Byte ordering endianness.

Values:

enumerator kXSPI_64BitBE

64 bit big endian

enumerator kXSPI_32BitLE

32 bit little endian

enumerator kXSPI_32BitBE

32 bit big endian

enumerator kXSPI_64BitLE

64 bit little endian

enum _xspi_cache64_policy

The enumeration of cache64 policy.

Values:

enumerator kXSPI_Cache64PolicyNonCacheable

Non-cacheable.

enumerator kXSPI_Cache64PolicyWriteThrough

Write through.

enumerator kXSPI_Cache64PolicyWriteBack

Write back.

typedef enum _xspi_lut_instr xspi_lut_instr_t

CMD definition of XSPI, use to form LUT instruction, xspi_lut_instr_t.

typedef enum _xspi_pad xspi_pad_t

pad definition of XSPI, use to form LUT instruction.

typedef enum _xspi_flags xspi_flags_t

XSPI interrupt status flags.

Deprecated:

For Error flag please use xspi_error_flag_t as instead, for cmd execution and arbitration flag please use xspi_cmd_execution_arbitration_flag_t as instead.

typedef struct _xspi_device_status_reg_info xspi_device_status_reg_info_t

The structure of external device’s status register information(location, priority).

Note

Only useful when AHB write to flash device is enabled, and use hardware to clear ppw flag.

typedef enum _xspi_dll_mode xspi_dll_mode_t

Dll Mode enumerations.

typedef union _xspi_dll_para xspi_dll_para_t

The union of user custommed DLL parameters, in case of kXSPI_BypassMode bypassModePara is used, in case of kXSPI_AutoUpdateMode autoUpdateModoPara is used.

typedef struct _xspi_dll_config xspi_dll_config_t

The structure of Delay-lock-loop configuration.

typedef enum _xspi_sample_clk_source xspi_sample_clk_source_t

The enumeration of sample clock source which is used to sample data from external devices.

Note

If external device support Data strobe signal, the sample clock should selected as kXSPI_SampleClkFromExternalDQS.

typedef enum _xspi_data_learning_pad_select xspi_data_learning_pad_select_t

The selection of data learning pad.

typedef struct _xspi_data_learning_config xspi_data_learning_config_t

The configuration of data learning.

Note

Data learning feature only supported in the DQS sampling method(kXSPI_SampleClkFromExternalDQS).

typedef struct _xspi_sample_clk_config xspi_sample_clk_config_t

Sample clock configuration, which used to sample data from external device.

typedef enum _xspi_device_addr_mode xspi_device_addr_mode_t

External device’s address mode.

typedef enum _xspi_device_interface_type xspi_device_interface_type_t

The enumeration of external device’s interface type, hyper bus or SPI(including strandard and extended).

Note

Different interface result different settings.

typedef enum _xspi_hyper_bus_x16_mode xspi_hyper_bus_x16_mode_t

The enumeration of hyper bus X16 mode.

typedef union _xspi_device_interface_settings xspi_device_interface_settings_t

The union of external device’s settings, if external device following hyper bus protocol #hyperBusSettings take effects, if external device following SPI protocol #strandardExtendedSPISettings take effects.

typedef enum _xspi_ddr_data_aligned_clk xspi_ddr_data_aligned_clk_t

Enumeration defining the alignment modes of XSPI DDR data with respect to the internal reference clock.

typedef struct _xspi_device_ddr_config xspi_device_ddr_config_t

The structure of device DDR configuration.

typedef struct _xspi_device_config xspi_device_config_t

External device configuration items.

typedef enum _xspi_command_type xspi_command_type_t

Command type.

typedef enum _xspi_mdad_mask_type xspi_mdad_mask_type_t

The enumeration of SFP MDAD mask type.

typedef enum _xspi_mdad_error_reason xspi_mdad_error_reason_t

The enumeration of MDAD error reasons.

typedef enum _xspi_exclusive_access_lock_mode xspi_exclusive_access_lock_mode_t

Exclusive access lock.

typedef enum _xspi_secure_attribute xspi_secure_attribute_t

XSPI defines the secure attribute selection criteria for entry into descriptor queue…

typedef struct _xspi_mdad_config xspi_mdad_config_t

MDAD configuration.

typedef struct _xspi_sfp_mdad_config xspi_sfp_mdad_config_t

The structure of SFP MDAD configurations for all target groups.

typedef enum _xspi_descriptor_lock xspi_descriptor_lock_t

Descriptor lock.

typedef struct _xspi_frad_config_t xspi_frad_config_t

FRAD configuration.

typedef struct _xspi_sfp_frad_config xspi_sfp_frad_config_t

The structure of SFP FRAD configurations.

typedef struct _xspi_frad_transaction_info xspi_frad_transaction_info_t

The structure of latest FRAD transaction information.

typedef struct _xspi_ip_access_config xspi_ip_access_config_t

Configurations of IP access(including IP read and write).

typedef enum _xspi_target_group xspi_target_group_t

The enumeration of target group.

typedef struct _xspi_tg_add_write_status xspi_tg_add_write_status_t

The status of latest target group address write operation.

typedef struct _xspi_transfer xspi_transfer_t

Transfer structure used for XSPI functional interface.

typedef struct _xspi_handle xspi_handle_t
typedef void (*xspi_transfer_callback_t)(XSPI_Type *base, xspi_handle_t *handle, status_t status, void *userData)

XSPI transfer callback function.

typedef enum _xspi_subbuffer_division_factor xspi_subbuffer_division_factor_t

Subbuffer division factor.

typedef struct _xspi_ahbBuffer_sub_buffer_config xspi_ahbBuffer_sub_buffer_config_t

The structure of sub-buffer configurations.

typedef struct _xspi_ahbBuffer_config xspi_ahbBuffer_config_t

Structure of AHB buffer configurations.

Note

When an AHB read access comes it is assigned to a buffer based on its master ID. Then it further assigned to a sub-buffer based on which sub-buffer address range this transaction lies into.

Note

When sub-buffer division is hit, in case of a buffer miss the controller will fetch the data equal to the size of that sub-buffer.

Note

If sub-buffer division is enabled for a buffer the hit/miss check is done at sub-buffer level. And if prefetch is enable, the prefetch takes place for individual sub-buffers.

typedef enum _xspi_ahb_sub_buffer_status xspi_ahb_sub_buffer_status_t

The enumeration of sub buffer status, empty, full, or partially full.

typedef struct _xspi_ahbBuffer_perf_monitor_result xspi_ahbBuffer_perf_monitor_result_t

The result of AHB buffer performance monitor, including buffer miss count and buffer hit count.

typedef enum _xspi_ppw_flag_clear_policy xspi_ppw_flag_clear_policy_t

The enumeration of XSPI page program waiting flag clear policy.

typedef struct _xspi_ahb_write_config xspi_ahb_write_config_t

The configuration of AHB write access.

typedef enum _xspi_ahb_split_size xspi_ahb_split_size_t

XSPI AHB Split Size These bits are used to control the split size when split function is enabled BFGENCR[SPLITEN] is ‘1’.

typedef enum _xspi_ahb_alignment xspi_ahb_alignment_t

XSPI AHB access towards flash is broken if this AHB alignment boundary is crossed. This field is only supported XSPI0 XSPI1.

typedef struct _xspi_ahb_access_config xspi_ahb_access_config_t

The structure of AHB access configurations, including AHB buffer settings, AHB Read Seq ID, AHB write settings.

typedef struct _xspi_ahb_read_error_info xspi_ahb_read_error_info_t

The structure of information when AHB read error occur.

typedef enum _xspi_ahb_request_suspend_state xspi_ahb_request_suspend_state_t

The enumeration of AHB request suspend state.

typedef struct _xspi_ahb_request_suspend_info xspi_ahb_request_suspend_info_t

The structure of information when AHB reqest is suspended.

typedef enum _xspi_otfad_prefetch_boundary xspi_otfad_prefetch_boundary_t

The enumeration of OTFAD prefetch address boundary.

typedef enum _xspi_byte_order xspi_byte_order_t

Byte ordering endianness.

typedef struct _xspi_config xspi_config_t

XSPI configuration structure.

typedef enum _xspi_cache64_policy xspi_cache64_policy_t

The enumeration of cache64 policy.

typedef struct _xspi_cache64_config xspi_cache64_region_config_t

The structure of cache64 configuration.

Region0 range from base address to region0TopAddr[28:10] + 0x3FF, region1 range from region0TopAddr[28:10] + 0x400 to region1TopAddr[28:10] + 0x3FF, region1TopAddr[28:10] + 0x400 to end address.

FSL_XSPI_DRIVER_VERSION
XSPI_LUT_SEQ(cmd0, pad0, op0, cmd1, pad1, op1)

Formula to form XSPI instructions in LUT table.

XSPI_TARGET_GROUP_COUNT
XSPI_SFP_FRAD_COUNT
XSPI_IP_RX_BUFFER_SIZE
XSPI_IP_TX_BUFFER_SIZE
uint32_t XSPI_GetInstance(XSPI_Type *base)

Get the instance number for XSPI.

Parameters:
  • base – XSPI base pointer.

status_t XSPI_CheckAndClearError(XSPI_Type *base, uint32_t status)

Check and clear IP command execution errors.

Parameters:
  • base – XSPI base pointer.

  • status – interrupt status.

void XSPI_Init(XSPI_Type *base, const xspi_config_t *ptrConfig)

Initializes the XSPI module and internal state.

This function configures the XSPI with the input configure parameters. Users should call this function before any XSPI operations.

Parameters:
  • base – XSPI peripheral base address.

  • ptrConfig – XSPI configure structure.

void XSPI_GetDefaultConfig(xspi_config_t *ptrConfig)

Gets default settings for XSPI.

Warning

The parameter devconfig will be removed in next release.

Parameters:
  • base – XSPI peripheral base address.

  • ptrConfig – XSPI configuration structure.

void XSPI_Deinit(XSPI_Type *base)

Deinitialize the XSPI module.

Clears the XSPI state and XSPI module registers.

Parameters:
  • base – XSPI peripheral base address.

  • devconfig – Flash configuration parameters.

void XSPI_UpdateLUT(XSPI_Type *base, uint8_t index, const uint32_t *cmd, uint8_t count)

Updates the LUT table.

Parameters:
  • base – XSPI peripheral base address.

  • index – From which index start to update. It could be any index of the LUT table, which also allows user to update command content inside a command. Each command consists of up to 10 instructions and occupy 5*32-bit memory.

  • cmd – Command sequence array.

  • count – Number of instruction-operand pairs

static inline void XSPI_SetOTFADPrefetchBoundary(XSPI_Type *base, xspi_otfad_prefetch_boundary_t boundary)

Set OTFAD prefetch boundary.

Parameters:
  • base – XSPI peripheral base address.

  • boundary – Prefetch boundary to set, in type of xspi_otfad_prefetch_boundary_t.

static inline void XSPI_UpdateByteOrder(XSPI_Type *base, xspi_byte_order_t byteOrder)
static inline void XSPI_EnableModule(XSPI_Type *base, bool enable)

Enable or disable the XSPI module.

Parameters:
  • base – XSPI peripheral base address.

  • enable – true means enable XSPI, false means disable.

static inline bool XSPI_CheckModuleEnabled(XSPI_Type *base)

Check if the XSPI module is enabled.

Parameters:
  • base – XSPI peripheral base address.

Return values:
  • true – XSPI module is enabled.

  • false – XSPI module is disabled.

void XSPI_ResetSfmAndAhbDomain(XSPI_Type *base)

Reset Serial flash memory domain and AHB domain at the same time.

Note

Resetting only the Serial flash memory domain and AHB domain may cause undesirable side effects.

Parameters:
  • base – XSPI peripheral base address.

static inline void XSPI_ResetTgQueue(XSPI_Type *base)

Reset IPS target group queue.

Parameters:
  • base – XSPI peripheral base address.

static inline void XSPI_SoftwareReset(XSPI_Type *base)

Software reset flash memory domain, AHB domain, and Target group at the same time.

Parameters:
  • base – XSPI peripheral base address.

static inline bool XSPI_CheckGlobalConfigLocked(XSPI_Type *base)

Check if write access to registers(MGC, MRC, MTO, SFP_ARB_TIMEOUT, SFP_LUT_ENn, LUTn, BFGENCR) is locked.

Parameters:
  • base – XSPI peripheral base address.

Return values:
  • false – Write access to listed registers is not locked.

  • true – Write access to listed registers is locked.

void XSPI_SetHyperBusX16Mode(XSPI_Type *base, xspi_hyper_bus_x16_mode_t x16Mode)

Set Hyper bus X16 mode.

Parameters:
  • base – XSPI peripheral base address.

  • x16Mode – Specify X16 mode.

status_t XSPI_UpdateDeviceAddrMode(XSPI_Type *base, xspi_device_addr_mode_t addrMode)

Update address mode to access external device.

Parameters:
  • base – XSPI peripheral base address.

  • addrMode – Specify the address mode to update.

Return values:
  • kStatus_XSPI_AhbReadAccessAsserted – Fail to update address mode due to AHB read access asserted.

  • kStatus_XSPI_IPAccessAsserted – Fail to update address mode due to a IP access already asserted.

  • kStatus_XSPI_AhbWriteAccessAsserted – Fail to update address mode due to AHB write access asserted.

  • kStatus_Success – Successfully to update address mode.

static inline void XSPI_EnableVariableLatency(XSPI_Type *base, bool enable)

Enable/disable variable latency for XSPI.

Note

Only useful for hyper bus device.

Note

It is application responsibility to enable variable latency for external hyper bus device(by change device’s register).

Parameters:
  • base – XSPI peripheral base address.

  • enable – Specify operation:

    • true Enable variable latency;

    • false Disable variable latency.

static inline void XSPI_EnableDozeMode(XSPI_Type *base, bool enable)

Enable/disable Doze mode for XSPI controller.

Note

Once doze mode is enabled, the XSPI controller will enter disable mode when system in low power modes.

Parameters:
  • base – XSPI peripheral base address

  • enable – Specify operation:

    • true Enable Doze mode;

    • false Disable Doze mode.

static inline void XSPI_SetSignalOutputValue(XSPI_Type *base, uint32_t signalMask, bool outputLogic)

Specify the logic level of the XSPI IOFA[3] and IOFA[2] output in the inactive state.

Parameters:
  • base – XSPI peripheral base address

  • signalMask – Should be the OR’ed value of _xspi_external_signal.

  • outputLogic – Output logic of selected signals,

    • false Output logic 0;

    • true Output logic 1.

static inline void XSPI_EnableInvertedSerialClockOutput(XSPI_Type *base, bool enable)

Enable/disable inverted serial clock output for XSPI controller.

Note

It is application responsibility to enable CLKn for external device(by change device’s register).

Parameters:
  • base[in] XSPI peripheral base address

  • enable[in] Enable/disable inverted serial clock output:

    • true Enable inverted serial clock output;

    • false Disable inverted serial clock output.

void XSPI_UpdateDllValue(XSPI_Type *base, xspi_dll_config_t *ptrDllConfig, bool enableDDR, bool enableX16Mode, uint32_t xspiRootClk)

Update DLL configuration.

Parameters:
  • base[in] XSPI peripheral base address.

  • ptrDllConfig[in] Pointer to the DLL configuration.

  • enableDDR[in] DDR mode is enabled or not.

  • enableX16Mode[in] X16 mode is enabled or not.

  • xspiRootClk[in] The frequency of xspi root clock, the unit is Hz.

status_t XSPI_SetDataLearningConfig(XSPI_Type *base, xspi_data_learning_config_t *ptrDataLearningConfig)

Set Data learning configurations.

Parameters:
  • base[in] XSPI peripheral base address.

  • ptrDataLearningConfig[in] Pointer to data learning configuration.

Return values:
  • kStatus_XSPI_AhbReadAccessAsserted – Fail to set data learning configuration due to AHB read access asserted.

  • kStatus_XSPI_IPAccessAsserted – Fail to set data learning configuration due to a IP access already asserted.

  • kStatus_XSPI_AhbWriteAccessAsserted – Fail to set data learning configuration due to AHB write access asserted.

  • kStatus_Success – Successfully to set Data learning configurations.

static inline bool XSPI_CheckDataLearningFailure(XSPI_Type *base)

Check if data learning failure has detected.

Parameters:
  • base[in] XSPI peripheral base address.

Return values:
  • true – Data learning has failed.

  • false – Data learning not fail.

static inline void XSPI_GetDataLearningEdgeMatchSignature(XSPI_Type *base, uint8_t *posEdgeMatch, uint8_t *negEdgeMatch)

Get data learning positive and negative edge match signature.

Parameters:
  • base[in] XSPI peripheral base address.

  • posEdgeMatch[out] Pointer to the memory to store positive edge match signature.

  • negEdgeMatch[out] Pointer to the memory to store negative edge match signature.

status_t XSPI_SetDeviceConfig(XSPI_Type *base, xspi_device_config_t *devConfig)

Set device configuration.

Parameters:
  • base[in] XSPI peripheral base address.

  • devConfig[in] Pointer to device configuration.

Return values:
  • kStatus_XSPI_AhbReadAccessAsserted – Fail to set device configuration due to AHB read access asserted.

  • kStatus_XSPI_IPAccessAsserted – Fail to set device configuration due to a IP access already asserted.

  • kStatus_XSPI_AhbWriteAccessAsserted – Fail to set device configuration due to AHB write access asserted.

  • kStatus_Success – Successfully to set device configurations.

static inline void XSPI_EnableInterrupts(XSPI_Type *base, uint64_t mask)

Enables the XSPI interrupts.

Parameters:
  • base – XSPI peripheral base address.

  • mask – XSPI interrupt source, should be the OR’ed value of xspi_interrupt_enable_t.

static inline void XSPI_DisableInterrupts(XSPI_Type *base, uint64_t mask)

Disables the XSPI interrupts.

Parameters:
  • base – XSPI peripheral base address.

  • mask – XSPI interrupt source, should be the OR’ed value of xspi_interrupt_enable_t.

static inline void XSPI_EnableTxDMA(XSPI_Type *base, bool enable)

Enables or disables XSPI IP Tx FIFO DMA requests.

Parameters:
  • base[in] XSPI peripheral base address.

  • enable[in] Enable flag for transmit DMA request. Pass true for enable, false for disable.

static inline void XSPI_EnableRxDMA(XSPI_Type *base, bool enable)

Enables or disables XSPI IP Rx FIFO DMA requests.

Parameters:
  • base[in] XSPI peripheral base address.

  • enable[in] Enable flag for receive DMA request. Pass true for enable, false for disable.

static inline uint32_t XSPI_GetTxFifoAddress(XSPI_Type *base)

Gets XSPI IP tx fifo address for DMA transfer.

Parameters:
  • base[in] XSPI peripheral base address.

Returns:

The tx fifo address.

static inline uint32_t XSPI_GetRxFifoAddress(XSPI_Type *base)

Gets XSPI IP rx fifo address for DMA transfer.

Parameters:
  • base[in] XSPI peripheral base address.

Returns:

The rx fifo address.

static inline uint32_t XSPI_GetErrorStatusFlags(XSPI_Type *base)

Get error status flags.

Parameters:
  • base – SPC peripheral base address.

Returns:

All asserted error status flags, should be the OR’ed value of XSPI_GetErrorStatusFlags.

static inline void XSPI_ClearErrorStatusFlags(XSPI_Type *base, uint32_t flags)

Clear input error status flags.

Parameters:
  • base – SPC peripheral base address.

  • flags – Error flags to clear, the OR’ed value of XSPI_GetErrorStatusFlags.

static inline uint32_t XSPI_GetInterruptStatusFlags(XSPI_Type *base)

Get the XSPI interrupt status flags.

Deprecated:

Please use XSPI_GetErrorStatusFlags() as instead.

Parameters:
  • base[in] XSPI peripheral base address.

Returns:

interrupt status flag, use status flag to AND xspi_flags_t could get the related status.

static inline bool XSPI_CheckIpRequestGranted(XSPI_Type *base)

Check if the IP access request was granted access if enable corresponding interrupt source, the XSPI IRQ will be asserted.

Parameters:
  • base[in] XSPI peripheral base address.

Return values:
  • true – Ip request granted.

  • false – Ip reqest not granted.

static inline bool XSPI_GetBusIdleStatus(XSPI_Type *base)

Return whether the bus is idle.

Parameters:
  • base[in] XSPI peripheral base address.

Return values:
  • true – Bus is idle.

  • false – Bus is busy.

static inline bool XSPI_CheckAhbReadAccessAsserted(XSPI_Type *base)

Check if AHB read access has been requested or is ongoing.

Parameters:
  • base[in] XSPI peripheral base address.

Return values:
  • true – AHB read access is requested or is ongoing.

  • false – AHB read access is not requested and is not ongoing.

static inline bool XSPI_CheckAhbWriteAccessAsserted(XSPI_Type *base)

Check if AHB write access has been requested or is ongoing.

Parameters:
  • base[in] XSPI peripheral base address.

Return values:
  • true – AHB read access is requested or is ongoing.

  • false – AHB read access is not requested and is not ongoing.

static inline uint32_t XSPI_GetCmdExecutionArbitrationStatusFlags(XSPI_Type *base)

Get asserted flags about SFM command execution and arbitration.

Parameters:
  • base[in] XSPI peripheral base address.

Returns:

The assert flags about SFM command execution and arbitration, should be the OR’ed value of xspi_cmd_execution_arbitration_flag_t.

static inline void XSPI_ClearCmdExecutionArbitrationStatusFlags(XSPI_Type *base, uint32_t flags)

Clear asserted flags about SFM command execution and arbitration.

Parameters:
  • base[in] XSPI peripheral base address.

  • flags[in] The mask of flags to clear, should be the OR’ed value of xspi_cmd_execution_arbitration_flag_t.

static inline void XSPI_ResetTxRxBuffer(XSPI_Type *base, bool txFifo, bool rxFifo)

Clear the XSPI IP TX/RX buffer logic.

Parameters:
  • base[in] XSPI peripheral base address.

  • txFifo[in] Pass true to reset TX FIFO.

  • rxFifo[in] Pass true to reset RX FIFO.

static inline void XSPI_ClearTxBuffer(XSPI_Type *base)

Clear TX buffer.

Parameters:
  • base[in] XSPI peripheral base address.

status_t XSPI_UpdateTxBufferWaterMark(XSPI_Type *base, uint32_t waterMark)

Update watermark for TX buffer.

Parameters:
  • base[in] XSPI peripheral base address.

  • waterMark[in] The watermark to set, the unit is byte, should be the multiple of 4 byte.

Return values:
  • kStatus_XSPI_IPAccessAsserted – Fail to update watermark for Tx buffer, due to IP access is asserted.

  • kStatus_XSPI_WaterMarkIllegal – Fail to update watermark for Tx buffer, due to input watermark is not the multiple of 4 bytes.

  • kStatus_Success – Successful to update watermark.

static inline bool XSPI_CheckTxBuffLockOpen(XSPI_Type *base)

Check if IP manager can write to TX buffer.

Parameters:
  • base[in] XSPI peripheral base address.

Return values:
  • true – Tx buffer lock is open.

  • false – Tx buffer lock is not open.

static inline void XSPI_WriteTxBuffer(XSPI_Type *base, uint32_t data)

Writes data into IPS TX Buffer.

Parameters:
  • base[in] XSPI peripheral base address

  • data[in] The data bytes to send.

static inline void XSPI_ClearRxBuffer(XSPI_Type *base)

Clear RX buffer.

Parameters:
  • base[in] XSPI peripheral base address.

static inline uint32_t XSPI_ReadRxBuffer(XSPI_Type *base, uint8_t fifoIndex)

Receive data from IPX RX FIFO.

Parameters:
  • base[in] XSPI peripheral base address

  • fifoIndex[in] Source fifo index.

Returns:

The data in the FIFO.

static inline void XSPI_TriggerRxBufferPopEvent(XSPI_Type *base)

Trigger a pop event for RX buffer pop event.

Note

Each pop event discard watermark + 1 enties from RX buffer.

Parameters:
  • base[in] XSPI peripheral base address.

status_t XSPI_UpdateRxBufferWaterMark(XSPI_Type *base, uint32_t waterMark)

Update watermark for RX buffer.

Set watermark as 4 bytes:
XSPI_UpdateRxBufferWaterMark(XSPI0, 4UL);
Set watermark as 8 bytes:
XSPI_UpdateRxBufferWaterMark(XSPI0, 8UL);
Parameters:
  • base[in] XSPI peripheral base address.

  • waterMark[in] Specify the number of bytes in the RX buffer which causes XSPI to assert the watermark exceeded flag, should be in multiple of 4 bytes.

Return values:
  • kStatus_XSPI_IPAccessAsserted – Fail to update watermark for Rx buffer, due to IP access is asserted.

  • kStatus_XSPI_WaterMarkIllegal – Fail to update watermark for Tx buffer, due to input watermark is not the multiple of 4 bytes.

  • kStatus_Success – Successful to update watermark.

static inline bool XSPI_CheckRxBufferWaterMarkExceed(XSPI_Type *base)

Check if RX buffer watermark is exceed.

Parameters:
  • base[in] XSPI peripheral base address.

Return values:
  • true – The RX buffer watermark has been excceded.

  • false – The RX buffer watermark has not been exceeded.

static inline uint32_t XSPI_GetRxBufferAvailableBytesCount(XSPI_Type *base)

Get RX buffer aviailable bytes count.

Parameters:
  • base[in] XSPI peripheral base address.

Returns:

The available counts if bytes in RX buffer.

static inline uint32_t XSPI_GetRxBufferRemovedBytesCount(XSPI_Type *base)

Get counts of bytes already removed from RX buffer.

Parameters:
  • base[in] XSPI peripheral base address.

Returns:

Counts of removed bytes.

void XSPI_SetSFPFradEALMode(XSPI_Type *base, xspi_exclusive_access_lock_mode_t ealMode, uint8_t fradId)

Set exclusive access lock mode for the specific frad..

Parameters:
  • base[in] XSPI peripheral base address.

  • ealMode[in] Specify the exclusive access lock mode.

  • fradId[in] Specify the frad.

void XSPI_UpdateSFPConfig(XSPI_Type *base, xspi_sfp_mdad_config_t *ptrSfpMdadConfig, xspi_sfp_frad_config_t *ptrSfpFradConfig)

Update SFP configurations, including MDAD configurations and FRAD configurations.

Parameters:
  • base[in] XSPI peripheral base address.

  • ptrMdadConfig[in] Pointer to the SFP MDAD configuration.

  • ptrFradConfig[in] Pointer to the SFP FRAD configuration.

static inline bool XSPI_CheckSFPFradEnabled(XSPI_Type *base)

Check if SFP FRAD check is enabled for IP write access.

Parameters:
  • base[in] XSPI peripheral base address.

Return values:
  • false – SFP FRAD check is disabled.

  • true – SFP FRAD check is enabled for IP write access.

xspi_mdad_error_reason_t XSPI_GetMdadErrorReason(XSPI_Type *base, xspi_target_group_t tgId)

Get MDAD check error reason for specific target group.

Parameters:
  • base[in] XSPI peripheral base address.

  • tgId[in] Specify the target group.

Returns:

The details of MDAD error reason, in type of xspi_mdad_error_reason_t.

void XSPI_GetFradLastTransactionsInfo(XSPI_Type *base, xspi_frad_transaction_info_t *ptrInfo, uint8_t fradId)

Get FARD latest transaction information.

Parameters:
  • base[in] XSPI peripheral base address.

  • ptrInfo[out] Pointer to the variable in type of xspi_frad_transaction_info_t to store information.

  • fradId[in] Specify the frad Id.

status_t XSPI_UpdateSFPArbitrationLockTimeoutCounter(XSPI_Type *base, uint32_t countValue)

Update SFP arbitration lock timeout counter.

Note

The SFP arbitration lock time out counter starts when Page program wait flag asserted.

Parameters:
  • base[in] XSPI peripheral base address.

  • countValue[in] The count value, specify the time in IPS clock cycles.

Return values:
  • kStatus_XSPI_RegWriteLocked – Write operation to related register is locked.

  • kStatus_Success – Success to update timeout counter.

void XSPI_ClearTgAddrWriteStatus(XSPI_Type *base, xspi_target_group_t tgId)

Clear address write status for specific target group.

Parameters:
  • base[in] XSPI peripheral base address.

  • tgId[in] Specify the target group to clear address write status.

void XSPI_GetTgAddrWriteStatus(XSPI_Type *base, xspi_target_group_t tgId, xspi_tg_add_write_status_t *ptrStatus)

Get address write status for specific target group.

Parameters:
  • base[in] XSPI peripheral base address.

  • tgId[in] Specify the target group.

  • ptrStatus[out] Pointer to the variable in type of xspi_tg_add_write_status_t to store address write status.

void XSPI_UnlockIpAccessArbitration(XSPI_Type *base, xspi_target_group_t tgId)

Unlock Ip access arbitration.

Parameters:
  • base[in] XSPI peripheral base address.

  • tgId[in] Specify the target group.

static inline bool XSPI_CheckIPAccessAsserted(XSPI_Type *base)

Check if IP access is asserted.

Parameters:
  • base[in] XSPI peripheral base address.

Return values:
  • false – The Access triggered by IP bus is not asserted.

  • true – The Access triggered by IP bus is asserted.

static inline void XSPI_ClearIPAccessSeqPointer(XSPI_Type *base)

Clear Ip access sequence pointer.

Parameters:
  • base[in] XSPI peripheral base address.

status_t XSPI_UpdateIPAccessTimeoutCounter(XSPI_Type *base, uint32_t countValue)

Update the count of SFP access timeout counter.

Note

The counter starts when any IP access pass SFP check(if enabled), and request is granted by XSPI arbiter and XSPI is IDLE.

Note

The counter does not start in case of IP access was granted by XSPI is not IDLE.

Parameters:
  • base – XSPI peripheral base address.

  • countValue – The count value, specify the time in IPS clock cycles.

Return values:
  • kStatus_XSPI_RegWriteLocked – Write operation to related register is locked.

  • kStatus_Success – Success to update timeout counter.

static inline bool XSPI_CheckIPAccessGranted(XSPI_Type *base)

Check if IP access is granted by XSPI arbitration.

Deprecated:

Use XSPI_CheckIpRequestGranted() as instead

Parameters:
  • base – XSPI peripheral base address.

Return values:
  • true – The IP access is granted arbitration.

  • false – No IP access is queued.

static inline bool XSPI_CheckIpWriteTriggered(XSPI_Type *base)

Check if IP write access is triggered.

Parameters:
  • base[in] XSPI peripheral base address.

Return values:
  • true – The IP write access is granted arbitration.

  • false – No IP write access is queued.

static inline bool XSPI_CheckIpReadTriggered(XSPI_Type *base)

Check if IP read access is triggered.

Parameters:
  • base[in] XSPI peripheral base address.

Return values:
  • true – The IP read access is granted arbitration.

  • false – No IP read access is queued.

static inline bool XSPI_CheckFSMValid(XSPI_Type *base)

Check if IPS transfer is granted arbitration or execution.

Note

The FSMSTAT[VLD] goes to 0 once the IPS transfer is completed and XSPI is IDLE.

Parameters:
  • base[in] XSPI peripheral base address.

Return values:
  • true – Valid, the IPS transfer is granted arbitration or execution.

  • false – Not valid, no IPS transfer is queued.

status_t XSPI_StartIpAccess(XSPI_Type *base, uint32_t addr, uint8_t seqIndex, size_t byteSize, xspi_target_group_t tgId, bool lockArbitration)

Start IP access(including read and write) in blocking way.

Parameters:
  • base[in] XSPI peripheral base address.

  • addr[in] Address of external device to read/write.

  • seqIndex[in] Sequence Id of the pre-programmed LUT.

  • byteSize[in] Size of data to read/write, the unit of byte.

  • tgId[in] Specify the target group used to write/read.

  • lockArbitration[in] Lock arbitration or not.

Return values:
  • kStatus_XSPI_IpAccessAddrSettingInvalid – Wrong Address input.

  • kStatus_XSPI_IpAccessIPCRInvalid – Wrong seqindex or bytesize input.

  • kStatus_Success – Success to start Ip access.

status_t XSPI_StartIpAccessNonBlocking(XSPI_Type *base, uint32_t addr, uint8_t seqIndex, size_t byteSize, xspi_target_group_t tgId, bool lockArbitration)

Start IP access in non-blocking way.

Parameters:
  • base[in] XSPI peripheral base address.

  • addr[in] Address of external device to read/write.

  • seqIndex[in] Sequence Id of the pre-programmed LUT.

  • byteSize[in] Size of data to transfer, the unit of byte.

  • tgId[in] Specify the target group to use.

  • lockArbitration[in] Lock arbitration or not.

Return values:
  • kStatus_Success – Success to start Ip access.

  • kStatus_XSPI_IpAccessIPCRInvalid – Invalid to set IPCR register.

  • kStatus_XSPI_IpAccessAddrSettingInvalid – Invalid to set SFAR register.

status_t XSPI_SetIpAccessConfig(XSPI_Type *base, xspi_ip_access_config_t *ptrIpAccessConfig)

Set IP access configurations, including SFP configurations, sfp arbitration lock timeout value, Ip access timeout value.

Parameters:
  • base[in] XSPI peripheral base address.

  • ptrIpAccessConfig[in] Pointer to the variable which contains Ip access configurations.

Return values:
  • kStatus_XSPI_RegWriteLocked – Write operation to related register is locked.

  • kStatus_Success – Success to update timeout counter.

status_t XSPI_WriteBlocking(XSPI_Type *base, uint8_t *buffer, size_t size)

Sends a buffer of data bytes using blocking method.

Note

This function blocks via polling until all bytes have been sent.

Parameters:
  • base[in] XSPI peripheral base address

  • buffer[in] Pointer to the buffer to send.

  • size[in] The number of data bytes to send

Return values:
  • kStatus_Success – write success without error

  • kStatus_XSPI_SequenceExecutionTimeout – sequence execution timeout

  • kStatus_XSPI_IpCommandSequenceError – IP command sequence error detected

  • kStatus_XSPI_IpCommandGrantTimeout – IP command grant timeout detected

status_t XSPI_ReadBlocking(XSPI_Type *base, uint8_t *buffer, size_t size)

Receives a buffer of data bytes using a blocking method.

Note

This function blocks via polling until all bytes have been sent.

Parameters:
  • base[in] XSPI peripheral base address

  • buffer[out] Pointer to the buffer to store read data.

  • size[in] The number of data bytes to receive

Return values:
  • kStatus_Success – read success without error

  • kStatus_XSPI_SequenceExecutionTimeout – sequence execution timeout

  • kStatus_XSPI_IpCommandSequenceError – IP command sequence error detected

  • kStatus_XSPI_IpCommandGrantTimeout – IP command grant timeout detected

status_t XSPI_TransferBlocking(XSPI_Type *base, xspi_transfer_t *xfer)

Execute command to transfer a buffer data bytes using a blocking method.

Note

In case of flash page program, if WEL(Write enable) automatically cleared after program operation, then WEL should be asserted before invoking this API and the transfer size should not bigger than page size.

Parameters:
  • base[in] XSPI peripheral base address

  • xfer[in] pointer to the transfer structure.

Return values:
  • kStatus_Success – command transfer success without error

  • kStatus_XSPI_SequenceExecutionTimeout – sequence execution timeout

  • kStatus_XSPI_IpCommandSequenceError – IP command sequence error detected

  • kStatus_XSPI_IpCommandGrantTimeout – IP command grant timeout detected

void XSPI_TransferCreateHandle(XSPI_Type *base, xspi_handle_t *handle, xspi_transfer_callback_t callback, void *userData)

Initialize the XSPI handle which is used in transactional functions.

Parameters:
  • base[in] XSPI peripheral base address.

  • handle[in] pointer to xspi_handle_t structure to store the transfer state.

  • callback[in] pointer to user callback function.

  • userData[in] user parameter passed to the callback function.

status_t XSPI_TransferNonBlocking(XSPI_Type *base, xspi_handle_t *handle, xspi_transfer_t *xfer)

Perform a interrupt non-blocking transfer on the XSPI bus.

Note

Calling the API returns immediately after transfer initiates. The user needs to call XSPI_GetTransferCount to poll the transfer status to check whether the transfer is finished. If the return status is not kStatus_XSPI_Busy, the transfer is finished. For XSPI_Read, the dataSize should be multiple of rx watermark level, or XSPI could not read data properly.

Parameters:
  • base[in] XSPI peripheral base address.

  • handle[in] pointer to xspi_handle_t structure which stores the transfer state.

  • xfer[in] pointer to xspi_transfer_t structure.

Return values:
  • kStatus_Success – Successfully start the data transmission.

  • kStatus_XSPI_Busy – Previous transmission still not finished.

status_t XSPI_TransferGetCount(XSPI_Type *base, xspi_handle_t *handle, size_t *count)

Get the master transfer status during a interrupt non-blocking transfer.

Parameters:
  • base[in] XSPI peripheral base address.

  • handle[in] pointer to xspi_handle_t structure which stores the transfer state.

  • count[out] Number of bytes transferred so far by the non-blocking transaction.

Return values:
  • kStatus_InvalidArgument – count is Invalid.

  • kStatus_Success – Successfully return the count.

void XSPI_TransferAbort(XSPI_Type *base, xspi_handle_t *handle)

Abort an interrupt non-blocking transfer early.

Note

This API can be called at any time when an interrupt non-blocking transfer initiates to abort the transfer early.

Parameters:
  • base[in] XSPI peripheral base address.

  • handle[in] pointer to xspi_handle_t structure which stores the transfer state

static inline void XSPI_ClearAhbBuffer(XSPI_Type *base)

Blocks to clear AHB buffer and abort ongoing prefetch transaction(if prefetch is enabled.)

Note

The function return only after all AHB buffer pointers are cleared.

Parameters:
  • base[in] XSPI peripheral base address.

status_t XSPI_EnableAhbBufferWriteFlush(XSPI_Type *base, bool enable)

Enable/disable the clearing of AHB read prefetch buffers when the same flash address is written by an AHB or IP command.

Parameters:
  • base[in] XSPI peripheral base address.

  • enable[in] Used to enable/disable write flush.

Return values:
  • kStatus_XSPI_AhbReadAccessAsserted – Fail due to an AHB read access already asserted.

  • kStatus_XSPI_AhbWriteAccessAsserted – Fail due to an AHB write access already asserted.

  • kStatus_Success – Successfully to enable/disable AHB buffer write flush.

status_t XSPI_SetAhbBufferConfig(XSPI_Type *base, xspi_ahbBuffer_config_t *ptrBuffer0Config, xspi_ahbBuffer_config_t *ptrBuffer1Config, xspi_ahbBuffer_config_t *ptrBuffer2Config, xspi_ahbBuffer_config_t *ptrBuffer3Config)

Set AHB buffer configurations.

Parameters:
  • base[in] XSPI peripheral base address.

  • ptrBuffer0Config[in] Pointer to the variable which contain buffer0 configurations.

  • ptrBuffer1Config[in] Pointer to the variable which contain buffer1 configurations.

  • ptrBuffer2Config[in] Pointer to the variable which contain buffer2 configurations.

  • ptrBuffer3Config[in] Pointer to the variable which contain buffer3 configurations.

Return values:
  • kStatus_XSPI_AhbReadAccessAsserted – Fail due to an AHB read access already asserted.

  • kStatus_XSPI_AhbWriteAccessAsserted – Fail due to an AHB write access already asserted.

  • kStatus_Success – Success to set AHB buffer configurations.

status_t XSPI_UpdateAhbBufferSize(XSPI_Type *base, uint16_t buf0Size, uint16_t buf1Size, uint16_t buf2Size, uint16_t buf3Size)

Set Buffer size for all 4 AHB buffers.

Parameters:
  • base[in] XSPI peripheral base address.

  • buf0Size[in] Specify size of AHB buffer0, range of 512, 256, 128, 64, 32, 16, 8, 4, 2, 0.

  • buf1Size[in] Specify size of AHB buffer1, range of 512, 256, 128, 64, 32, 16, 8, 4, 2, 0.

  • buf2Size[in] Specify size of AHB buffer2, range of 512, 256, 128, 64, 32, 16, 8, 4, 2, 0.

  • buf3Size[in] Specify size of AHB buffer3, range of 512, 256, 128, 64, 32, 16, 8, 4, 2, 0.

Return values:
  • kStatus_XSPI_AhbReadAccessAsserted – Fail due to an AHB read access already asserted.

  • kStatus_XSPI_AhbWriteAccessAsserted – Fail due to an AHB write access already asserted.

  • kStatus_Success – Success to set AHB buffer size.

xspi_ahb_sub_buffer_status_t XSPI_GetAhbSubBufferStatus(XSPI_Type *base, uint8_t ahbBufferId, uint8_t subBufferId)

Get status of AHB sub buffer.

Note

This function only useful when sub-division feature of the selected AHB buffer is enabled.

Parameters:
  • base[in] XSPI peripheral base address.

  • ahbBufferId[in] The Id of AHB buffer, range from 0 to 3.

  • subBufferId[in] The Id of AHB buffer sub division, range from 0 to 3.

Returns:

Current status of selected AHB sub buffer, in type of xspi_ahb_sub_buffer_status_t.

static inline void XSPI_StartAhbBufferPerfMonitor(XSPI_Type *base)

Start AHB buffer performance monitor.

Parameters:
  • base[in] XSPI peripheral base address.

void XSPI_EnableAhbBufferPerfMonitor(XSPI_Type *base, uint8_t ahbBufferId, uint8_t subBufferId)

Enable AHB buffer performance monitor for selected AHB buffer’s sub buffer.

Parameters:
  • base[in] XSPI peripheral base address.

  • ahbBufferId[in] Specify the selected AHB buffer.

  • subBufferId[in] Specify the selected sub-buffer.

static inline void XSPI_DisableAhbBufferPerfMonitor(XSPI_Type *base, uint8_t ahbBufferId)

Disable AHB buffer performance monitor for selected AHB buffer.

Parameters:
  • base[in] XSPI peripheral base address.

  • ahbBufferId[in] Specify the selected AHB buffer.

static inline void XSPI_StopAhbBufferPerfMonitor(XSPI_Type *base)

Stop AHB buffer performance monitor.

Parameters:
  • base[in] XSPI peripheral base address.

static inline void XSPI_GetAhbBufferPerfMonitorResult(XSPI_Type *base, uint8_t ahbBufferId, xspi_ahbBuffer_perf_monitor_result_t *ptrPerfMonitorResult)

Get AHB buffer performance monitor result.

Parameters:
  • base[in] XSPI peripheral base address.

  • ahbBufferId[in] Specify AHB buffer Id.

  • ptrPerfMonitorResult[out] Pointer to the variable to store selected AHB buffer’s performance monitor result.

static inline bool XSPI_CheckAhbBufferPerfMonitorTimeCounterOverflow(XSPI_Type *base)

Check if AHB buffer performance monitor timeout counter is overflow.

Parameters:
  • base – XSPI peripheral base address.

Return values:
  • false – AHB buffer performance monitor timeout counter is not overflow.

  • true – AHB buffer performance monitor timeout counter is overflow.

static inline bool XSPI_CheckAhbBufferPerfMonitorHitOverflow(XSPI_Type *base, uint8_t ahbBufferId)

Check if AHB buffer performance monitor buffer hit counter is overflow.

Parameters:
  • base[in] XSPI peripheral base address.

  • ahbBufferId[in] Specify the AHB buffer Id.

Return values:
  • false – Overflow not detected.

  • true – Overflow is detected.

static inline bool XSPI_CheckAhbBufferPerfMonitorMissOverflow(XSPI_Type *base, uint8_t ahbBufferId)

Check if AHB buffer performance monitor buffer miss counter is overflow.

Parameters:
  • base[in] XSPI peripheral base address.

  • ahbBufferId[in] Specify the AHB buffer Id.

Return values:
  • false – Overflow not detected.

  • true – Overflow is detected.

static inline uint32_t XSPI_GetAhbBufferPerfMonitorTimeCounter(XSPI_Type *base)

Get AHB buffer performance monitor timeout value.

Parameters:
  • base[in] XSPI peripheral base address.

Returns:

The value of time counter, in AHB clock cycles, since the performance monitor was running.

status_t XSPI_SetAhbAccessSplitSize(XSPI_Type *base, xspi_ahb_split_size_t ahbSplitSize)

Set AHB transaction(read/write) split size.

Note

For AHB write, if enable split feature(ahbSplitSize not set as kXSPI_AhbSplitSizeDisabled), XSPI will split one single AHB write burst into smaller bursts on external device side.

Note

For AHB read, if enable split feature, HW will realign the prefetch size to split size and in that way split a single read burst into smaller bursts.

Parameters:
  • base[in] XSPI peripheral base address.

  • ahbSplitSize[in] Specify the AHB split size.

Return values:
  • kStatus_XSPI_AhbReadAccessAsserted – Fail due to an AHB read access already asserted

  • kStatus_XSPI_AhbWriteAccessAsserted – Fail due to an AHB write access already asserted

  • kStatus_XSPI_RegWriteLocked – Fail due to write operation to related registers is locked.

  • kStatus_Success – Success to set AHB access split size.

status_t XSPI_SetAhbAccessBoundary(XSPI_Type *base, xspi_ahb_alignment_t alignment)

Set AHB transaction(read/write) boundary.

Note

For AHB write, XSPI keeps track of the start address and then compares it with the address of subsequent transaction receive on the AHB bus, when the input alignment is reached, XSPI negates AHB HREADY to block new accesses. This signal will be kept low until all the previous received write data is written to external memory and chip select is de-asserted. After that it allows next AHB write data to be received by making HREADY high thus ensuring that transaction is split at address boundary on external memory.

Note

For AHB read, XSPI checks the start address and end address to see if it is crossing the address boundary specified by input alignment. If the transaction crosses the address boundary, then it reduces the transaction size such that the data pre-fetch is stopped before the address boundary. Now if the AHB master is reading the data sequentially it will get buffer hits up to the input alignment boundary. When it reaches the next address boundary it will get a buffer miss and a new data pre-fetch will be launched towards the external memory device.

Parameters:
  • base[in] XSPI peripheral base address.

  • alignment[in] Specify the AHB alignment, in type of xspi_ahb_alignment_t.

Return values:
  • kStatus_XSPI_AhbReadAccessAsserted – Fail due to an AHB read access already asserted

  • kStatus_XSPI_AhbWriteAccessAsserted – Fail due to an AHB write access already asserted

  • kStatus_XSPI_RegWriteLocked – Fail due to write operation to related registers is locked.

  • kStatus_Success – Success to set AHB access boundary.

status_t XSPI_SetAhbReadDataSeqId(XSPI_Type *base, uint8_t seqId)

Set AHB read sequence Id.

Parameters:
  • base[in] XSPI peripheral base address.

  • seqId[in] Specify the sequence Id in LUT used for AHB read.

Return values:
  • kStatus_XSPI_AhbReadAccessAsserted – Fail due to an AHB read access already asserted

  • kStatus_XSPI_AhbWriteAccessAsserted – Fail due to an AHB write access already asserted

  • kStatus_XSPI_RegWriteLocked – Fail due to write operation to related registers is locked.

  • kStatus_Success – Success to set AHB read sequence Id.

status_t XSPI_SetAhbWriteDataSeqId(XSPI_Type *base, uint8_t seqId)

Set AHB write sequence Id.

Parameters:
  • base[in] XSPI peripheral base address.

  • seqId[in] Specify the sequence Id in LUT used for AHB write.

Return values:
  • kStatus_XSPI_AhbReadAccessAsserted – Fail due to an AHB read access already asserted

  • kStatus_XSPI_AhbWriteAccessAsserted – Fail due to an AHB write access already asserted

  • kStatus_XSPI_RegWriteLocked – Fail due to write operation to related registers is locked.

  • kStatus_Success – Success to set AHB write sequence Id.

status_t XSPI_UpdateAhbHreadyTimeOutValue(XSPI_Type *base, uint16_t timeoutValue)

Specify how long XSPI can hold HEADY low while waiting for response to an AHB transfer.

Note

If the specified time out value expired, an AHB illegal transaction error will be triggerred.

Parameters:
  • base[in] XSPI peripheral base address.

  • timeoutValue[in] In multiples of 50000 AHB clock cycles, default value is 3, it means waiting for 150000 AHB clock cycles.

Return values:
  • kStatus_XSPI_AhbReadAccessAsserted – Fail due to an AHB read access already asserted

  • kStatus_XSPI_AhbWriteAccessAsserted – Fail due to an AHB write access already asserted

  • kStatus_Success – Success to set AHB HREADY timeout value.

status_t XSPI_SetAhbErrorPayload(XSPI_Type *base, uint32_t highPayload, uint32_t lowPayload)

Pre-define error payload which will be provided on the read data bus when the HEADY timeout counter expires.

Note

If the incoming AHB read request master is not mapped to any of the AHB buffer, the XSPI will keep the AHB HREADY signal low and will provided this pre-defined error payload on the AHB read data bus when the HEADY timeout counter expires.

Parameters:
  • base[in] XSPI peripheral base address.

  • highPayload[in] High 32bits payload to set.

  • lowPayload[in] Low 32bits payload to set.

Return values:
  • kStatus_XSPI_AhbReadAccessAsserted – Fail due to an AHB read access already asserted

  • kStatus_XSPI_AhbWriteAccessAsserted – Fail due to an AHB write access already asserted

  • kStatus_Success – Success to set AHB HREADY timeout value.

xspi_ahb_read_error_info_t XSPI_ReturnAhbReadErrorInfo(XSPI_Type *base)

Return AHB read error information.

Parameters:
  • base[in] XSPI peripheral base address.

Returns:

Latest AHB read error information, in type of xspi_ahb_read_error_info_t.

static inline void XSPI_ClearAhbAccessSeqPointer(XSPI_Type *base)

Clear AHB access sequence pointer.

Parameters:
  • base[in] XSPI peripheral base address.

void XSPI_GetAhbRequestSuspendInfo(XSPI_Type *base, xspi_ahb_request_suspend_info_t *ptrSuspendInfo)

Get Ahb request suspend information if priority mechanism is enabled.

Parameters:
  • base[in] XSPI peripheral base address.

  • ptrSuspendInfo[out] Contain latest suspend info, the value may be 0xFF if the item is invalid in current suspend state.

static inline void XSPI_EnableAhbReadPrefetch(XSPI_Type *base, bool enable)

Enable/disable AHB Read Prefetch feature.

Parameters:
  • base[in] XSPI peripheral base address.

  • enable[in] Used to enable/disable AHB read prefetch:

    • false Disable AHB read prefetch;

    • true Enable AHB read prefetch.

status_t XSPI_BlockAccessAfterAhbWrite(XSPI_Type *base, bool blockSequentWrite, bool blockRead)

Block access(write and read) after the AHB write operation.

Note

If external flash support RWW, read should not be blocked:

XSPI_BlockAccessAfterAhbWrite(XSPI0, true, false);

Note

If either of access is blocked, the page program wait flag will be asserted after an AHB write sequence completed. The assertion of flag will lock the arbitration and all access to the external memory are blocked. And the internal “page wait time” counter starts(Invoke XSPI_UpdatePageWaitTimeCounter to update counter value). After this counter reaches the value, a read is triggered by the XSPI module to read external device’s status register(The seq id should be pre-defiend by XSPI_SetAhbReadStatusRegSeqId), and the value is stored in the XSPI internal regsiter. And there are two options(Invoke XSPI_SelectPPWFlagClearPolicy to select) to clear the asserted page program wait flag.

  1. Automatic cleared by XSPI hardware;

  2. Cleared by software.

Note

As soon as the page program wait flag is asserted, another counter(SFP arbitration

lock counter) also started, if the flag not cleared in desired counter value the arbitration lock timeout error will be generated.

Parameters:
  • base[in] XSPI peripheral base address.

  • blockSequentWrite[in] Block sequence write or not.

  • blockRead[in] Block read or not.

Return values:
  • kStatus_XSPI_AhbReadAccessAsserted – Fail due to an AHB read access already asserted

  • kStatus_XSPI_AhbWriteAccessAsserted – Fail due to an AHB write access already asserted

  • kStatus_Success – Success to set related registers..

status_t XSPI_SelectPPWFlagClearPolicy(XSPI_Type *base, xspi_ppw_flag_clear_policy_t policy)

Set Page program wait flag clear policy.

Note

If set as hardware policy, the device’s WIP information should be set by invoking XSPI_SetSFMStatusRegInfo()

Parameters:
  • base[in] XSPI peripheral base address.

  • policy[in] Specify the policy to clear page program wait flag.

Return values:
  • kStatus_XSPI_AhbReadAccessAsserted – Fail due to an AHB read access already asserted

  • kStatus_XSPI_AhbWriteAccessAsserted – Fail due to an AHB write access already asserted

  • kStatus_XSPI_RegWriteLocked – Fail due to write operation to related registers is locked.

  • kStatus_Success – Success to set PPW flag clear policy.

status_t XSPI_UpdatePageWaitTimeCounter(XSPI_Type *base, uint32_t countValue)

Update page wait timeout counter.

Parameters:
  • base[in] XSPI peripheral base address.

  • countValue[in] The value of counter, in AHB clock cycles.

Return values:
  • kStatus_XSPI_AhbReadAccessAsserted – Fail due to an AHB read access already asserted

  • kStatus_XSPI_AhbWriteAccessAsserted – Fail due to an AHB write access already asserted

  • kStatus_XSPI_PageProgramWaitFlagAsserted – Page program wait flag already asserted.

  • kStatus_Success – Successfully to update page wait timeout counter.

status_t XSPI_SetAhbReadStatusRegSeqId(XSPI_Type *base, uint8_t seqId)

Set AHB read status register sequence Id.

Note

The read status sequence only triggerred when the page wait time counter expired.

Parameters:
  • base[in] XSPI peripheral base address.

  • seqId[in] Specify the sequence Id in LUT used for AHB read status register.

Return values:
  • kStatus_XSPI_AhbReadAccessAsserted – Fail due to an AHB read access already asserted

  • kStatus_XSPI_AhbWriteAccessAsserted – Fail due to an AHB write access already asserted

  • kStatus_XSPI_RegWriteLocked – Fail due to write operation to related registers is locked.

  • kStatus_Success – Success to set AHB read status register sequence Id.

static inline uint16_t XSPI_GetSFMStatusRegValue(XSPI_Type *base)

Get external serial flash’s status register value.

Note

This function is only useful after the Page program wait flag is asserted due to either wait/read access is blocked after the AHB write operation.

Parameters:
  • base[in] XSPI peripheral base address.

Returns:

The status regsiter value of external device.

status_t XSPI_SetSFMStatusRegInfo(XSPI_Type *base, xspi_device_status_reg_info_t *ptrStatusRegInfo)

Set Serial flash memory status register information.

Parameters:
  • base[in] XSPI peripheral base address.

  • ptrStatusRegInfo[in] Pointer to the variable which contain status register information.

Return values:
  • kStatus_XSPI_AhbReadAccessAsserted – Fail due to an AHB read access already asserted

  • kStatus_XSPI_AhbWriteAccessAsserted – Fail due to an AHB write access already asserted

  • kStatus_XSPI_PageProgramWaitFlagAsserted – Page program wait flag already asserted.

  • kStatus_Success – Successfully to set status register information.

status_t XSPI_SetAhbAccessConfig(XSPI_Type *base, xspi_ahb_access_config_t *ptrAhbAccessConfig)

Set AHB access configuration.

Parameters:
  • base[in] XSPI peripheral base address.

  • ptrAhbAccessConfig[in] Pointer to the variable which contains AHB access configurations.

Return values:
  • kStatus_XSPI_AhbReadAccessAsserted – Fail due to an AHB read access already asserted

  • kStatus_XSPI_AhbWriteAccessAsserted – Fail due to an AHB write access already asserted

  • kStatus_XSPI_RegWriteLocked – Fail due to write operation to related registers is locked.

  • kStatus_Success – Success to set AHB read status register sequence Id.

void XSPI_Cache64_SetRegionConfig(CACHE64_POLSEL_Type *base, xspi_cache64_region_config_t *config)

Set policy of cache regions.

Parameters:
  • base – CACHE64_POLSEL peripheral base address.

  • config – Pointer to the structure xspi_cache64_region_config_t.

struct _xspi_device_status_reg_info
#include <fsl_xspi.h>

The structure of external device’s status register information(location, priority).

Note

Only useful when AHB write to flash device is enabled, and use hardware to clear ppw flag.

Public Members

uint8_t wipLocation

WIP bit field’s location.

bool upperHalfWordSelected

Specify which half word(upper or lower) is selected.

bool value1Expired

Specify the value to be check o selected wip location to determine if the page progame wait period is expired, true means expected value is 1, false means expected value is 0.

union _xspi_dll_para
#include <fsl_xspi.h>

The union of user custommed DLL parameters, in case of kXSPI_BypassMode bypassModePara is used, in case of kXSPI_AutoUpdateMode autoUpdateModoPara is used.

Public Members

struct _xspi_dll_para bypassModePara
struct _xspi_dll_para autoUpdateModoPara
struct _xspi_dll_config
#include <fsl_xspi.h>

The structure of Delay-lock-loop configuration.

Public Members

xspi_dll_mode_t dllMode

Dll mode auto update mode or bypass mode

bool useRefValue

Specify to use reference value or not, if the reference code do not satisfy the specific usecase, it is application’s responsibility to set custom parameters

  • true: following inputs are ignored, use the reference values provided by NXP as instead;

  • false: following inputs take effect.

xspi_dll_para_t dllCustomPara

User custommed parameter to configure DLL, different DLL mode corresponding to different parameters, please refer to the union xspi_dll_para_t.

uint8_t dllCustomDelayTapNum

User custommed number of delay elements for each delay tap.

bool enableCdl8

Enable course delay line 8.

struct _xspi_data_learning_config
#include <fsl_xspi.h>

The configuration of data learning.

Note

Data learning feature only supported in the DQS sampling method(kXSPI_SampleClkFromExternalDQS).

Public Members

uint32_t pattern

Pre-defiend pattern to match.

bool deviceSupported

Specify if external device support data learning feature.

xspi_data_learning_pad_select_t padSelected

Used to select pad which use for pattern matching IO.

struct _xspi_sample_clk_config
#include <fsl_xspi.h>

Sample clock configuration, which used to sample data from external device.

Public Members

xspi_sample_clk_source_t sampleClkSource

Specify the sample clock source.

bool enableDQSLatency

Enable DQS latency or not.

xspi_dll_config_t dllConfig

Specify the DLL configuration, to improve data accuracy, please adjust DLL settings based on specific use.

union _xspi_device_interface_settings
#include <fsl_xspi.h>

The union of external device’s settings, if external device following hyper bus protocol hyperBusSettings take effects, if external device following SPI protocol strandardExtendedSPISettings take effects.

Public Members

struct _xspi_device_interface_settings strandardExtendedSPISettings
struct _xspi_device_interface_settings hyperBusSettings
struct _xspi_device_ddr_config
#include <fsl_xspi.h>

The structure of device DDR configuration.

Public Members

bool enableDdr

Used to enable/disable DDR mode.

xspi_ddr_data_aligned_clk_t ddrDataAlignedClk

Specify the DDR data aligned clock.

bool enableByteSwapInOctalMode

Swap byte order in octal mode.

struct _xspi_device_config
#include <fsl_xspi.h>

External device configuration items.

Public Members

uint32_t xspiRootClk

XSPI serial root clock.

bool enableCknPad

Enable/disable clock on differential CKN pad for flash memory A.

xspi_device_interface_type_t deviceInterface

Type of external device’s interface: hyperBus or Strandard/Extended SPI.

xspi_device_interface_settings_t interfaceSettings

Settings of specified interface.

uint8_t CSHoldTime

CS line hold time.

uint8_t CSSetupTime

CS line setup time.

xspi_sample_clk_config_t sampleClkConfig

Configuration of sample clock.

xspi_device_ddr_config_t *ptrDeviceDdrConfig

Set as NULL to set device as SDR mode, to change to DDR mode, this member should be populated.

xspi_device_addr_mode_t addrMode

Address mode of external device.

uint8_t columnAddrWidth

Width of column address.

bool enableCASInterleaving

Usually enabled in dual-die device.

uint32_t deviceSize[XSPI_SFAD_COUNT2]

Size of external device, the unit is KB.

xspi_device_status_reg_info_t *ptrDeviceRegInfo

Pointer to the structure to store external device’s WIP register information, should set as NULL if AHB page write is not used or if AHB page write is used but use software policy to clear flag.

struct _xspi_mdad_config
#include <fsl_xspi.h>

MDAD configuration.

Public Members

bool assignIsValid

Specify if the MDAD configuration for the target group is valid

bool enableDescriptorLock

This field provides a means to make the MDAD descriptor read-only. Once written ‘1’ this field will remain ‘1’ until hard reset

uint8_t maskType

0b - ANDed mask 1b - ORed mask

uint8_t mask

Defines the 6-bit mask value for the ID-Match comparison

uint8_t masterIdReference

Specifies the reference value of the Master-ID for MID-comparison

xspi_secure_attribute_t secureAttribute

Defines the secure attribute selection criteria for entry into descriptor queue

struct _xspi_sfp_mdad_config
#include <fsl_xspi.h>

The structure of SFP MDAD configurations for all target groups.

Public Members

xspi_mdad_config_t tgMdad[(2U)]

Specify MDAD configurations for each target group.

struct _xspi_frad_config_t
#include <fsl_xspi.h>

FRAD configuration.

Public Members

uint32_t startAddress

Specifies the specific flash memory region starting address

uint32_t endAddress

Specifies the specific flash memory region end address

uint8_t tg0MasterAccess

This field define the access restrictions for respective Master Domain corresponding to this FRAD region. Access permissions are decided based on secure an privilege attributes of current transaction. Read access is not restricted.

bool assignIsValid

This field indicates whether the FRAD Descriptor for a specific flash region is valid.

xspi_descriptor_lock_t descriptorLock

This field enables masking of accidental write on FRAD registers. Lock is enabled/disabled by Secure/ Privileged master.

xspi_exclusive_access_lock_mode_t exclusiveAccessLock

This field provides exclusive write lock over a FRAD region based on MDnACP.

struct _xspi_sfp_frad_config
#include <fsl_xspi.h>

The structure of SFP FRAD configurations.

Public Members

xspi_frad_config_t fradConfig[(8U)]

Specify FRAD configuration for each item.

struct _xspi_frad_transaction_info
#include <fsl_xspi.h>

The structure of latest FRAD transaction information.

Public Members

uint32_t startAddr

Latest IP access start address.

uint8_t masterId

Latest IP access master Id.

bool isSecureAccess

Latest IP access is secure access or not.

bool isPrivilegeAccess

Latest IP access is privilege access or not.

bool isCompError

Indicates the error status of the flash region specific comparision check for the latest transaction.

bool isCompValid

Indicates availability of the result or status of a flash region-specific comparison check.

struct _xspi_ip_access_config
#include <fsl_xspi.h>

Configurations of IP access(including IP read and write).

Public Members

xspi_sfp_mdad_config_t *ptrSfpMdadConfig

Pointer to the variable in type of xspi_sfp_mdad_config_t to set SFP MDAD feature, set as NULL to disable SFP MDAD feature.

xspi_sfp_frad_config_t *ptrSfpFradConfig

Pointer to the variable in type of xspi_sfp_frad_config_t to set SFP FRAD feature, set as NULL to disable SFP FRAD

uint32_t sfpArbitrationLockTimeoutValue

Specify the time in IPS clock cycles before an unreleased arbitration triggers a timeout error.

uint32_t ipAccessTimeoutValue

Specify the maximum time in IPS clock cycles for XSPI to wait fro an ongoing write or read command to complete before terminating the command.

struct _xspi_tg_add_write_status
#include <fsl_xspi.h>

The status of latest target group address write operation.

Public Members

uint8_t managerId

Manager Id of TG address write operation.

bool secureWrite

TG address write operation is secure write.

bool privilegedWrite

TG address write operation is privileged.

struct _xspi_transfer
#include <fsl_xspi.h>

Transfer structure used for XSPI functional interface.

Public Members

uint32_t deviceAddress

Operation device address.

xspi_command_type_t cmdType

Execution command type.

uint8_t seqIndex

Sequence ID for command.

uint32_t *data

Data buffer.

size_t dataSize

Data size in bytes.

xspi_target_group_t targetGroup

Target group. include targetGroup[0] targetGroup[1]

struct _xspi_handle
#include <fsl_xspi.h>

Transfer handle structure for XSPI.

Public Members

uint32_t state

Internal state for XSPI transfer

uint8_t *data

Data buffer.

size_t dataSize

Remaining Data size in bytes.

size_t transferTotalSize

Total Data size in bytes.

xspi_transfer_callback_t completionCallback

Callback for users while transfer finish or error occurred

void *userData

XSPI callback function parameter.

size_t curTransferSize

Transfer size of current IP access.

struct _xspi_ahbBuffer_sub_buffer_config
#include <fsl_xspi.h>

The structure of sub-buffer configurations.

Public Members

xspi_subbuffer_division_factor_t divFactor

Specify the divide factor for current sub-buffer.

uint32_t startAddr

Specify the start address of current sub-buffer.

uint32_t endAddr

Specify the end address of current sub-buffer.

bool enableAhbMonitor

Enable/disable AHB performance monitor for current sub-buffer.

struct _xspi_ahbBuffer_config
#include <fsl_xspi.h>

Structure of AHB buffer configurations.

Note

When an AHB read access comes it is assigned to a buffer based on its master ID. Then it further assigned to a sub-buffer based on which sub-buffer address range this transaction lies into.

Note

When sub-buffer division is hit, in case of a buffer miss the controller will fetch the data equal to the size of that sub-buffer.

Note

If sub-buffer division is enabled for a buffer the hit/miss check is done at sub-buffer level. And if prefetch is enable, the prefetch takes place for individual sub-buffers.

Public Members

uint8_t masterId

Specify the ID of the AHB master to be associated with buffer.

xspi_ahbBuffer_sub_buffer_config_t *ptrSubBuffer0Config

Pointer to sub buffer0’s configuration.

xspi_ahbBuffer_sub_buffer_config_t *ptrSubBuffer1Config

Pointer to sub buffer1’s configuration.

xspi_ahbBuffer_sub_buffer_config_t *ptrSubBuffer2Config

Pointer to sub buffer2’s configuration.

xspi_ahbBuffer_sub_buffer_config_t *ptrSubBuffer3Config

Pointer to sub buffer3’s configuration.

struct _xspi_ahbBuffer_perf_monitor_result
#include <fsl_xspi.h>

The result of AHB buffer performance monitor, including buffer miss count and buffer hit count.

Public Members

uint16_t bufferMissCount

Count of AHB read buffer miss events.

uint16_t bufferHitCount

Count of AHB read buffer hit events.

struct _xspi_ahb_write_config
#include <fsl_xspi.h>

The configuration of AHB write access.

Public Members

bool blockSequenceWrite

Enable/disable sequence write operation after page program start.

bool blockRead

Enable/disable read operation after page program start, can be false for RWW extern device.

xspi_ppw_flag_clear_policy_t policy

Specify the policy to clear ppw flag, hardware or software.

uint32_t pageWaitTimeoutValue

Specify, in AHB clock cycles, how long XSPI waits before triggering a read of the device status register, only useful in hardare policy.

uint8_t AWRSeqIndex

Specify the sequence index for AHB write.

uint8_t ARDSRSeqIndex

Specify the sequence index for AHB read status, only useful if either sequence write or read is blocked.

struct _xspi_ahb_access_config
#include <fsl_xspi.h>

The structure of AHB access configurations, including AHB buffer settings, AHB Read Seq ID, AHB write settings.

Public Members

xspi_ahbBuffer_config_t buffer[4]

AHB buffer size.

uint8_t ARDSeqIndex

Specify the sequence index for AHB read data.

bool enableAHBPrefetch

Enable/disable AHB read prefetch feature, when enabled, XSPI will fetch more data than current AHB burst.

bool enableAHBBufferWriteFlush

Set true to enable flush of AHB buffer, due to either AHB write or IP access to avoid stable data in AHB buffer.

xspi_ahb_split_size_t ahbSplitSize

Specify ahb split size, set as kXSPI_AhbSplitSizeDisabled if do not want to use this feature.

xspi_ahb_alignment_t ahbAlignment

AHB access towards flash is broken if this AHB alignment boundary is crossed, only support XSPI0 XSPI1

xspi_ahb_write_config_t *ptrAhbWriteConfig

Set as NULL if AHB write feature is not used.

struct _xspi_ahb_read_error_info
#include <fsl_xspi.h>

The structure of information when AHB read error occur.

Public Members

uint32_t errorAddr

AHB read error address.

uint8_t errMasterId

AHB read error master Id.

struct _xspi_ahb_request_suspend_info
#include <fsl_xspi.h>

The structure of information when AHB reqest is suspended.

Public Members

xspi_ahb_request_suspend_state_t state

Current AHB request state.

uint8_t subBufferId

Suspended AHB request’s sub buffer Id.

uint8_t ahbBufferId

Suspended AHB request’s buffer Id.

uint16_t dataLeft

How many data left to transfer.

uint32_t address

Current address of suspended AHB request.

struct _xspi_config
#include <fsl_xspi.h>

XSPI configuration structure.

Public Members

xspi_byte_order_t byteOrder

Byte ordering endianness

bool enableDoze

Enable/disable doze mode support.

xspi_ahb_access_config_t *ptrAhbAccessConfig

Pointer to AHB access configuration, can be NULL is AHB access is not used.

xspi_ip_access_config_t *ptrIpAccessConfig

Pointer to IP access configuration, can be NULL is IP access is not used.

struct _xspi_cache64_config
#include <fsl_xspi.h>

The structure of cache64 configuration.

Region0 range from base address to region0TopAddr[28:10] + 0x3FF, region1 range from region0TopAddr[28:10] + 0x400 to region1TopAddr[28:10] + 0x3FF, region1TopAddr[28:10] + 0x400 to end address.

Public Members

uint32_t region0TopAddr

Top address of region0, bit0-bit9 ignored.

xspi_cache64_policy_t region0Policy

Policy of region0.

uint32_t region1TopAddr

Top address of region1, bit0-bit9 ignored.

xspi_cache64_policy_t region1Policy

Policy of region1.

xspi_cache64_policy_t region2Policy

Policy of region2.

struct bypassModePara

Public Members

uint16_t delayElementCoarseValue

Delay element coarse adjustment value, range from 0 to 15.

uint16_t delayElementFineValue

Delay element fine adjustment value, range from 0 to 7.

uint16_t offsetDelayElementCount

Specify the number of offset delay elements, range from 0 to 15.

uint16_t enableHighFreq

If set as true, high frequency used for delay chain operations, otherwise low frequency is used.

uint16_t bypassModeReserved

Reserved.

struct autoUpdateModoPara

Public Members

uint16_t referenceCounter

Specify count of interval for DLL phase detection, range from 0 to 15.

uint16_t resolution

Specify minimum resolution for the DLL phase detctor, range from 0 to 15.

uint16_t offsetDelayElementCount

Specify the number of offset delay elements, range from 0 to 15.

uint16_t tDiv16OffsetDelayElementCount

Specify the number of T/16 offset elements in the incoming DQS, range from 0 to 15.

uint16_t enableHighFreq

If set as true, high frequency used for delay chain operations, otherwise low frequency is used.

struct strandardExtendedSPISettings

Public Members

uint32_t pageSize

The size of page to program, the unit is byte.

struct hyperBusSettings

Public Members

xspi_hyper_bus_x16_mode_t x16Mode

Specify hyper bus X16 mode.

bool enableVariableLatency

If enabled, the count of latency is depends on hyper bus device.

bool forceBit10To1

Force bit 10 to logic one or not.

uint32_t pageSize

The size of page to program, the unit is byte.

union enaPri

Public Members

bool enablePriority

High Priority Enable, it can be written ‘1’ only when OTFAD is disabled, the AHB prefetch feature must be enabled if priority mechanism is enabled.

bool enableAllMaster

When set, buffer3 acts as an all-master buffer.buff[i] routed to buffer3

struct ahbErrorPayload

Public Members

uint32_t highPayload

High 32bit error payload.

uint32_t lowPayload

Low 32bit error payload.

XSPI eDMA Driver

enum _xspi_edma_ntransfer_size

eDMA transfer configuration

Values:

enumerator kXSPI_EDMAnSize1Bytes

Source/Destination data transfer size is 1 byte every time

enumerator kXSPI_EDMAnSize2Bytes

Source/Destination data transfer size is 2 bytes every time

enumerator kXSPI_EDMAnSize4Bytes

Source/Destination data transfer size is 4 bytes every time

enumerator kXSPI_EDMAnSize8Bytes

Source/Destination data transfer size is 8 bytes every time

enumerator kXSPI_EDMAnSize32Bytes

Source/Destination data transfer size is 32 bytes every time

typedef struct _xspi_edma_handle xspi_edma_handle_t
typedef void (*xspi_edma_callback_t)(XSPI_Type *base, xspi_edma_handle_t *handle, status_t status, void *userData)

XSPI eDMA transfer callback function for finish and error.

typedef enum _xspi_edma_ntransfer_size xspi_edma_transfer_nsize_t

eDMA transfer configuration

FSL_XSPI_EDMA_DRIVER_VERSION

XSPI EDMA driver version 2.0.2.

void XSPI_TransferCreateHandleEDMA(XSPI_Type *base, xspi_edma_handle_t *handle, xspi_edma_callback_t callback, void *userData, edma_handle_t *txDmaHandle, edma_handle_t *rxDmaHandle)

Initializes the XSPI handle for transfer which is used in transactional functions and set the callback.

Parameters:
  • base – XSPI peripheral base address

  • handle – Pointer to xspi_edma_handle_t structure

  • callback – XSPI callback, NULL means no callback.

  • userData – User callback function data.

  • txDmaHandle – User requested DMA handle for TX DMA transfer.

  • rxDmaHandle – User requested DMA handle for RX DMA transfer.

void XSPI_TransferUpdateSizeEDMA(XSPI_Type *base, xspi_edma_handle_t *handle, xspi_edma_transfer_nsize_t nsize)

Update XSPI EDMA transfer source data transfer size(SSIZE) and destination data transfer size(DSIZE).

See also

xspi_edma_transfer_nsize_t .

Parameters:
  • base – XSPI peripheral base address

  • handle – Pointer to xspi_edma_handle_t structure

  • nsize – XSPI DMA transfer data transfer size(SSIZE/DSIZE), by default the size is kFLEXPSI_EDMAnSize1Bytes(one byte).

status_t XSPI_TransferEDMA(XSPI_Type *base, xspi_edma_handle_t *handle, xspi_transfer_t *xfer)

Transfers XSPI data using an eDMA non-blocking method.

This function writes/receives data to/from the XSPI transmit/receive FIFO. This function is non-blocking.

Parameters:
  • base – XSPI peripheral base address.

  • handle – Pointer to xspi_edma_handle_t structure

  • xfer – XSPI transfer structure.

Return values:
  • kStatus_XSPI_Busy – XSPI is busy transfer.

  • kStatus_InvalidArgument – The watermark configuration is invalid, the watermark should be power of 2 to do successfully EDMA transfer.

  • kStatus_Success – XSPI successfully start edma transfer.

void XSPI_TransferAbortEDMA(XSPI_Type *base, xspi_edma_handle_t *handle)

Aborts the transfer data using eDMA.

This function aborts the transfer data using eDMA.

Parameters:
  • base – XSPI peripheral base address.

  • handle – Pointer to xspi_edma_handle_t structure

status_t XSPI_TransferGetTransferCountEDMA(XSPI_Type *base, xspi_edma_handle_t *handle, size_t *count)

Gets the transferred counts of transfer.

Parameters:
  • base – XSPI peripheral base address.

  • handle – Pointer to xspi_edma_handle_t structure.

  • count – Bytes transfer.

Return values:
  • kStatus_Success – Succeed get the transfer count.

  • kStatus_NoTransferInProgress – There is not a non-blocking transaction currently in progress.

edma_handle_t *txDmaHandle

eDMA handler for XSPI Tx.

edma_handle_t *rxDmaHandle

eDMA handler for XSPI Rx.

size_t transferSize

Bytes need to transfer.

xspi_edma_transfer_nsize_t nsize

eDMA SSIZE/DSIZE in each transfer.

uint32_t nbytes

eDMA minor byte transfer count initially configured.

uint8_t count

The transfer data count in a DMA request.

uint32_t state

Internal state for XSPI eDMA transfer.

xspi_edma_callback_t completionCallback

A callback function called after the eDMA transfer is finished.

void *userData

User callback parameter

struct _xspi_edma_handle
#include <fsl_xspi_edma.h>

XSPI DMA transfer handle, users should not touch the content of the handle.