MCUXpresso SDK API Reference Manual  Rev. 0
NXP Semiconductors
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
XBAR: Inter-Peripheral Crossbar Switch Driver

Read Guidance

This document consists of sections titled with Driver Overview, Data Structures, Enumerations, Functions, etc., each with an overview list and detailed documentation. It is recommended to read the Driver Overview first for it includes a comprehensive description of the peripheral, driver and driver changes. Other sections give detailed information for APIs, enums, macros, etc., for your further reference.

Driver Overview

 The Driver Change Log
 The current XBAR driver version is 2.0.0.
 
 XBAR Peripheral and Driver Overview
 Content including 1) features; 2) driver design logic and use method; 3) typical use case.
 

Data Structures

struct  xbara_control_config_t
 Defines the configuration structure of the XBARA control register. More...
 

Macros

#define XBARA_SELx(base, output)   (((volatile uint16_t *)(&((base)->SEL0)))[(uint8_t)(output) >> 0x01U])
 Macro function to extract the XBAR select register address for a given xbar output signal.
 
#define XBARA_CTRLx(base, output)   (((volatile uint16_t *)(&((base)->CTRL0)))[(uint8_t)(output) >> 0x01U])
 Macro function to extract the XBAR Ctrl register address for a given xbar output signal.
 
#define XBARA_SELx_SELn_SHIFT(output)   ((output & 0x01U) ? 8U : 0U)
 Macro function to get SELn field shift in XBARA_SELx register for a given output signal.
 
#define XBARA_SELx_SELn_MASK(output)   ((output & 0x01U) ? 0x3F00U : 0x3FU)
 Macro function to get SELn field mask in XBARA_SELx register for a given output signal.
 
#define XBARA_SELx_SELn(output, input_signal)   (((uint16_t)(((uint16_t)(input_signal)) << XBARA_SELx_SELn_SHIFT(output))) & XBARA_SELx_SELn_MASK(output))
 Macro function to create SELn field value in XBARA_SELx register for given output signal and input signal value input_signal, see _xbara_input_signal.
 
#define XBARA_CTRLx_DIENn_MASK(output)   ((output & 0x01U) ? 0x300U : 0x03U)
 Macro function to get DIENn field mask in XBARA_CTRLx register for a given output signal.
 
#define XBARA_CTRLx_DIENn_SHIFT(output)   ((output & 0x01U) ? 8U : 0U)
 Macro function to get DIENn field shift in XBARA_CTRLx register for a given output signal.
 
#define XBARA_CTRLx_DIENn(output, x)   (((uint16_t)(((uint16_t)(x)) << XBARA_CTRLx_DIENn_SHIFT(output))) & XBARA_CTRLx_DIENn_MASK(output))
 Macro function to create DIENn field value in XBARA_CTRLx register for given output signal and DMA/Interrupt mode x, see _xbara_request.
 
#define XBARA_CTRLx_EDGEn_MASK(output)   ((output & 0x01U) ? 0xC00U : 0x0CU)
 Macro function to get EDGEn field mask in XBARA_CTRLx register for a given output signal.
 
#define XBARA_CTRLx_EDGEn_SHIFT(output)   ((output & 0x01U) ? 10U : 2U)
 Macro function to get EDGEn field shift in XBARA_CTRLx register for a given output signal.
 
#define XBARA_CTRLx_EDGEn(output, x)   (((uint16_t)(((uint16_t)(x)) << XBARA_CTRLx_EDGEn_SHIFT(output))) & XBARA_CTRLx_EDGEn_MASK(output))
 Macro function to create EDGEn field value in XBARA_CTRLx register for given output signal and edge mode x, see _xbara_active_edge.
 
#define XBARA_CTRLx_STS_MASK   (0x1010U)
 Macro value for the Status bits in CTRL register.
 

Enumerations

enum  xbara_active_edge_t {
  kXBARA_EdgeNone = 0U,
  kXBARA_EdgeRising = 1U,
  kXBARA_EdgeFalling = 2U,
  kXBARA_EdgeRisingAndFalling = 3U
}
 XBARA active edge for detection. More...
 
enum  xbara_request_t {
  kXBARA_RequestDisable = 0U,
  kXBARA_RequestDMAEnable = 1U,
  kXBARA_RequestInterruptEnable = 2U
}
 XBARA DMA and interrupt configurations. More...
 
enum  xbara_status_flag_t {
  kXBARA_EdgeDetectionOut0Flag,
  kXBARA_EdgeDetectionOut1Flag,
  kXBARA_EdgeDetectionOut2Flag,
  kXBARA_EdgeDetectionOut3Flag
}
 XBARA status flags. More...
 

Driver version

#define FSL_XBARA_DRIVER_VERSION   (MAKE_VERSION(2, 0, 0))
 

Initialization and Deinitialization Interfaces

void XBARA_Init (XBARA_Type *base)
 Initializes the XBARA module. More...
 
void XBARA_Deinit (XBARA_Type *base)
 Shuts down the XBARA module. More...
 

XBARA output signal configuration Interfaces

static void XBARA_SetSignalsConnection (XBARA_Type *base, xbar_input_signal_t eInput, xbar_output_signal_t eOutput)
 Sets a connection between the selected XBARA_IN[*] input and the XBARA_OUT[*] output signal. More...
 
static void XBARA_SetActiveEdgeDetectMode (XBARA_Type *base, xbar_output_signal_t eOutput, xbara_active_edge_t eActiveEdgeMode)
 Sets active edge detection mode for the XBARA_OUT[*] output signal. More...
 
static void XBARA_SetInterruptDMARequestMode (XBARA_Type *base, xbar_output_signal_t eOutput, xbara_request_t eRequest)
 Sets DMA, Interrupt or disabled request generation mode for the XBARA_OUT[*] output signal. More...
 
void XBARA_SetOutputSignalConfig (XBARA_Type *base, xbar_output_signal_t eOutput, const xbara_control_config_t *psControlConfig)
 Configures the XBARA output signal edge detection and interrupt/dma featues. More...
 

Status Get/Clear Interfaces

uint16_t XBARA_GetStatusFlags (XBARA_Type *base)
 Gets the active edge detection status for all XBAR output signal supporting this feature. More...
 
static void XBARA_ClearStatusFlags (XBARA_Type *base, uint16_t u16Flags)
 Clear the edge detection status flags of relative mask. More...
 

Data Structure Documentation

struct xbara_control_config_t

This structure keeps the configuration of XBARA control register for one output. Control registers are available only for a few outputs. Not every XBARA module has control registers.

Data Fields

xbara_active_edge_t eActiveEdge
 Active edge to be detected. More...
 
xbara_request_t eRequestType
 Selects DMA/Interrupt request. More...
 

Field Documentation

xbara_active_edge_t xbara_control_config_t::eActiveEdge
xbara_request_t xbara_control_config_t::eRequestType

Enumeration Type Documentation

Enumerator
kXBARA_EdgeNone 

Edge detection status bit never asserts.

kXBARA_EdgeRising 

Edge detection status bit asserts on rising edges.

kXBARA_EdgeFalling 

Edge detection status bit asserts on falling edges.

kXBARA_EdgeRisingAndFalling 

Edge detection status bit asserts on rising and falling edges.

Note it only apply for a subset of XBARA output signal.

Enumerator
kXBARA_RequestDisable 

Interrupt and DMA are disabled.

kXBARA_RequestDMAEnable 

DMA enabled, interrupt disabled.

kXBARA_RequestInterruptEnable 

Interrupt enabled, DMA disabled.

This provides constants for the XBARA status flags for use in the XBARA functions. The enumerator value is designed to make sure Flags in same register can be created with register value to write/read register.

Enumerator
kXBARA_EdgeDetectionOut0Flag 

XBAR_OUT0 active edge interrupt flag, sets when active edge detected.

kXBARA_EdgeDetectionOut1Flag 

XBAR_OUT1 active edge interrupt flag, sets when active edge detected.

kXBARA_EdgeDetectionOut2Flag 

XBAR_OUT2 active edge interrupt flag, sets when active edge detected.

kXBARA_EdgeDetectionOut3Flag 

XBAR_OUT3 active edge interrupt flag, sets when active edge detected.

Function Documentation

void XBARA_Init ( XBARA_Type *  base)

This function un-gates the XBARA clock.

Parameters
baseXBARA peripheral address.
void XBARA_Deinit ( XBARA_Type *  base)

This function disables XBARA clock.

Parameters
baseXBARA peripheral address.
static void XBARA_SetSignalsConnection ( XBARA_Type *  base,
xbar_input_signal_t  eInput,
xbar_output_signal_t  eOutput 
)
inlinestatic

This function connects the XBARA input to the selected XBARA output. If more than one XBARA module is available, only the inputs and outputs from the same module can be connected.

Example:

XBARA_SetSignalsConnection(XBARA, kXBARA_InputPIT_TRG0, kXBARA_OutputDMAMUX18);
Parameters
baseXBARA peripheral address.
eInputXBARA input signal.
eOutputXBARA output signal.
static void XBARA_SetActiveEdgeDetectMode ( XBARA_Type *  base,
xbar_output_signal_t  eOutput,
xbara_active_edge_t  eActiveEdgeMode 
)
inlinestatic
Parameters
baseXBARA peripheral address.
eOutputXBARA output signal.
eActiveEdgeModeActive edge mode.
static void XBARA_SetInterruptDMARequestMode ( XBARA_Type *  base,
xbar_output_signal_t  eOutput,
xbara_request_t  eRequest 
)
inlinestatic
Parameters
baseXBARA peripheral address.
eOutputXBARA output signal.
eRequestRequest type.
void XBARA_SetOutputSignalConfig ( XBARA_Type *  base,
xbar_output_signal_t  eOutput,
const xbara_control_config_t psControlConfig 
)

This function configures an XBARA control register. The active edge detection and the DMA/IRQ function on the corresponding XBARA output can be set.

Note
Only a subset of the XBARA output signal can be called with this API. On debug mode code will check whether the output signal eOutput satisfy the requirement.

Example:

userConfig.activeEdge = kXBARA_EdgeRising;
userConfig.requestType = kXBARA_RequestInterruptEnable;
XBARA_SetOutputSignalConfig(XBARA, kXBARA_OutputDMAMUX18, &userConfig);
Parameters
baseXBARA peripheral address.
eOutputXBARA output number.
psControlConfigPointer to structure that keeps configuration of control register.
uint16_t XBARA_GetStatusFlags ( XBARA_Type *  base)

This function gets the active edge detect status of all XBARA_OUTs. If the active edge occurs, the return value is asserted. When the interrupt or the DMA functionality is enabled for the XBARA_OUTx, this field is 1 when the interrupt or DMA request is asserted and 0 when the interrupt or DMA request has been cleared.

Parameters
baseXBARA peripheral address.
Returns
ORed value from all status flag from _xbara_status_flag.
static void XBARA_ClearStatusFlags ( XBARA_Type *  base,
uint16_t  u16Flags 
)
inlinestatic
Parameters
baseXBARA peripheral address.
u16Flagsstatus flags composed from ORed _xbara_status_flag indicating flags to be cleared.