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

Overview

The MCUXpresso SDK provides Peripheral driver for the Inter-Peripheral Crossbar Switch (XBAR) block of MCUXpresso SDK devices.

The XBAR peripheral driver configures the XBAR (Inter-Peripheral Crossbar Switch) and handles initialization and configuration of the XBAR module.

XBAR driver has two parts:

Function groups

XBAR Initialization

To initialize the XBAR driver, a state structure has to be passed into the initialization function. This block of memory keeps pointers to user's callback functions and parameters to these functions. The XBAR module is initialized by calling the XBAR_Init() function.

Call diagram

  1. Call the "XBAR_Init()" function to initialize the XBAR module.
  2. Optionally, call the "XBAR_SetSignalsConnection()" function to Set connection between the selected XBAR_IN[*] input and the XBAR_OUT[*] output signal. It connects the XBAR input to the selected XBAR output. A configuration structure of the "xbar_input_signal_t" type and "xbar_output_signal_t" type is required.
  3. Call the "XBAR_SetOutputSignalConfig" function to set the active edge features, such interrupts or DMA requests. A configuration structure of the "xbar_control_config_t" type is required to point to structure that keeps configuration of control register.
  4. Finally, the XBAR works properly.

Typical use case

Data Structures

struct  xbar_control_config_t
 Defines the configuration structure of the XBAR control register. More...
 

Macros

#define FSL_XBAR_DRIVER_VERSION   (MAKE_VERSION(2, 0, 2))
 Version 2.0.2. More...
 
#define XBAR_SELx(base, output)
 Macros for entire XBAR_SELx register. More...
 
#define XBAR_WR_SELx_SELx(base, input, output)
 Set the XBAR_SELx_SELx field to a new value. More...
 

Enumerations

enum  xbar_active_edge_t {
  kXBAR_EdgeNone = 0U,
  kXBAR_EdgeRising = 1U,
  kXBAR_EdgeFalling = 2U,
  kXBAR_EdgeRisingAndFalling = 3U
}
 XBAR active edge for detection. More...
 
enum  xbar_request_t {
  kXBAR_RequestDisable = 0U,
  kXBAR_RequestDMAEnable = 1U,
  kXBAR_RequestInterruptEnalbe = 2U
}
 Defines the XBAR DMA and interrupt configurations. More...
 
enum  xbar_status_flag_t {
  kXBAR_EdgeDetectionOut0,
  kXBAR_EdgeDetectionOut1,
  kXBAR_EdgeDetectionOut2,
  kXBAR_EdgeDetectionOut3
}
 XBAR status flags. More...
 

XBAR functional Operation

void XBAR_Init (XBAR_Type *base)
 Initializes the XBAR modules. More...
 
void XBAR_Deinit (XBAR_Type *base)
 Shutdown the XBAR modules. More...
 
void XBAR_SetSignalsConnection (XBAR_Type *base, xbar_input_signal_t input, xbar_output_signal_t output)
 Set connection between the selected XBAR_IN[*] input and the XBAR_OUT[*] output signal. More...
 
void XBAR_ClearStatusFlags (XBAR_Type *base, uint32_t mask)
 Clears the the edge detection status flags of relative mask. More...
 
uint32_t XBAR_GetStatusFlags (XBAR_Type *base)
 Gets the active edge detection status. More...
 
void XBAR_SetOutputSignalConfig (XBAR_Type *base, xbar_output_signal_t output, const xbar_control_config_t *controlConfig)
 Configures the XBAR control register. More...
 

Data Structure Documentation

struct xbar_control_config_t

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

Data Fields

xbar_active_edge_t activeEdge
 Active edge to be detected. More...
 
xbar_request_t requestType
 Selects DMA/Interrupt request. More...
 

Field Documentation

xbar_active_edge_t xbar_control_config_t::activeEdge
xbar_request_t xbar_control_config_t::requestType

Macro Definition Documentation

#define FSL_XBAR_DRIVER_VERSION   (MAKE_VERSION(2, 0, 2))
#define XBAR_SELx (   base,
  output 
)
Value:
(*(volatile uint16_t *)((uintptr_t) & \
(base->SEL0) + ((output) / 2U) * 2U))
#define XBAR_WR_SELx_SELx (   base,
  input,
  output 
)
Value:
(XBAR_SELx((base), (output)) = \
((XBAR_SELx((base), (output)) & ~(0xFFU << (XBAR_SEL0_SEL1_SHIFT * ((output) % 2U)))) | \
((input) << (XBAR_SEL0_SEL1_SHIFT * ((output) % 2U)))))
#define XBAR_SELx(base, output)
Macros for entire XBAR_SELx register.
Definition: fsl_xbar.h:47

Enumeration Type Documentation

Enumerator
kXBAR_EdgeNone 

Edge detection status bit never asserts.

kXBAR_EdgeRising 

Edge detection status bit asserts on rising edges.

kXBAR_EdgeFalling 

Edge detection status bit asserts on falling edges.

kXBAR_EdgeRisingAndFalling 

Edge detection status bit asserts on rising and falling edges.

Enumerator
kXBAR_RequestDisable 

Interrupt and DMA are disabled.

kXBAR_RequestDMAEnable 

DMA enabled, interrupt disabled.

kXBAR_RequestInterruptEnalbe 

Interrupt enabled, DMA disabled.

This provides constants for the XBAR status flags for use in the XBAR functions.

Enumerator
kXBAR_EdgeDetectionOut0 

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

kXBAR_EdgeDetectionOut1 

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

kXBAR_EdgeDetectionOut2 

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

kXBAR_EdgeDetectionOut3 

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

Function Documentation

void XBAR_Init ( XBAR_Type *  base)

This function un-gates the XBAR clock.

Parameters
baseXBAR peripheral address.
void XBAR_Deinit ( XBAR_Type *  base)

This function disables XBAR clock.

Parameters
baseXBAR peripheral address.
void XBAR_SetSignalsConnection ( XBAR_Type *  base,
xbar_input_signal_t  input,
xbar_output_signal_t  output 
)

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

Example:

XBAR_SetSignalsConnection(XBAR, kXBAR_InputTMR_CH0_Output, kXBAR_OutputXB_DMA_INT2);
Parameters
baseXBAR peripheral address
inputXBAR input signal.
outputXBAR output signal.
void XBAR_ClearStatusFlags ( XBAR_Type *  base,
uint32_t  mask 
)
Parameters
baseXBAR peripheral address
maskthe status flags to clear.
uint32_t XBAR_GetStatusFlags ( XBAR_Type *  base)

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

Example:

uint32_t status;
status = XBAR_GetStatusFlags(XBAR);
Parameters
baseXBAR peripheral address.
Returns
the mask of these status flag bits.
void XBAR_SetOutputSignalConfig ( XBAR_Type *  base,
xbar_output_signal_t  output,
const xbar_control_config_t controlConfig 
)

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

Example:

XBAR_SetOutputSignalConfig(XBAR, kXBAR_OutputXB_DMA_INT0, &userConfig);
Parameters
baseXBAR peripheral address
outputXBAR output number.
controlConfigPointer to structure that keeps configuration of control register.