![]() |
|
|||
File indexing completed on 2025-05-11 08:23:02
0001 /* 0002 * Copyright (c) 2015, Freescale Semiconductor, Inc. 0003 * Copyright 2016-2019, 2022 NXP 0004 * All rights reserved. 0005 * 0006 * SPDX-License-Identifier: BSD-3-Clause 0007 */ 0008 0009 #ifndef _FSL_XBARA_H_ 0010 #define _FSL_XBARA_H_ 0011 0012 #include "fsl_common.h" 0013 0014 /*! 0015 * @addtogroup xbara 0016 * @{ 0017 */ 0018 0019 /******************************************************************************* 0020 * Definitions 0021 ******************************************************************************/ 0022 0023 #define FSL_XBARA_DRIVER_VERSION (MAKE_VERSION(2, 0, 5)) 0024 0025 /* Macros for entire XBARA_SELx register. */ 0026 #define XBARA_SELx(base, output) (((volatile uint16_t *)(&((base)->SEL0)))[(uint32_t)(output) / 2UL]) 0027 0028 /* Set the XBARA_SELx_SELx field to a new value. */ 0029 #define XBARA_WR_SELx_SELx(base, input, output) XBARA_SetSignalsConnection((base), (input), (output)) 0030 0031 /* For driver backward compatibility. */ 0032 #define kXBARA_RequestInterruptEnalbe kXBARA_RequestInterruptEnable 0033 0034 /*! 0035 * @brief XBARA active edge for detection 0036 */ 0037 typedef enum _xbara_active_edge 0038 { 0039 kXBARA_EdgeNone = 0U, /*!< Edge detection status bit never asserts. */ 0040 kXBARA_EdgeRising = 1U, /*!< Edge detection status bit asserts on rising edges. */ 0041 kXBARA_EdgeFalling = 2U, /*!< Edge detection status bit asserts on falling edges. */ 0042 kXBARA_EdgeRisingAndFalling = 3U /*!< Edge detection status bit asserts on rising and falling edges. */ 0043 } xbara_active_edge_t; 0044 0045 /*! 0046 * @brief Defines the XBARA DMA and interrupt configurations. 0047 */ 0048 typedef enum _xbar_request 0049 { 0050 kXBARA_RequestDisable = 0U, /*!< Interrupt and DMA are disabled. */ 0051 kXBARA_RequestDMAEnable = 1U, /*!< DMA enabled, interrupt disabled. */ 0052 kXBARA_RequestInterruptEnable = 2U /*!< Interrupt enabled, DMA disabled. */ 0053 } xbara_request_t; 0054 0055 /*! 0056 * @brief XBARA status flags. 0057 * 0058 * This provides constants for the XBARA status flags for use in the XBARA functions. 0059 */ 0060 typedef enum _xbara_status_flag_t 0061 { 0062 kXBARA_EdgeDetectionOut0 = 0063 (XBARA_CTRL0_STS0_MASK), /*!< XBAR_OUT0 active edge interrupt flag, sets when active edge detected. */ 0064 kXBARA_EdgeDetectionOut1 = 0065 (XBARA_CTRL0_STS1_MASK), /*!< XBAR_OUT1 active edge interrupt flag, sets when active edge detected. */ 0066 kXBARA_EdgeDetectionOut2 = 0067 (XBARA_CTRL1_STS2_MASK << 16U), /*!< XBAR_OUT2 active edge interrupt flag, sets when active edge detected. */ 0068 kXBARA_EdgeDetectionOut3 = 0069 (XBARA_CTRL1_STS3_MASK << 16U), /*!< XBAR_OUT3 active edge interrupt flag, sets when active edge detected. */ 0070 } xbara_status_flag_t; 0071 0072 /*! 0073 * @brief Defines the configuration structure of the XBARA control register. 0074 * 0075 * This structure keeps the configuration of XBARA control register for one output. 0076 * Control registers are available only for a few outputs. Not every XBARA module has 0077 * control registers. 0078 */ 0079 typedef struct XBARAControlConfig 0080 { 0081 xbara_active_edge_t activeEdge; /*!< Active edge to be detected. */ 0082 xbara_request_t requestType; /*!< Selects DMA/Interrupt request. */ 0083 } xbara_control_config_t; 0084 0085 /******************************************************************************* 0086 * API 0087 ******************************************************************************/ 0088 0089 #if defined(__cplusplus) 0090 extern "C" { 0091 #endif /* __cplusplus */ 0092 0093 /*! 0094 * @name XBARA functional Operation. 0095 * @{ 0096 */ 0097 0098 /*! 0099 * @brief Initializes the XBARA module. 0100 * 0101 * This function un-gates the XBARA clock. 0102 * 0103 * @param base XBARA peripheral address. 0104 */ 0105 void XBARA_Init(XBARA_Type *base); 0106 0107 /*! 0108 * @brief Shuts down the XBARA module. 0109 * 0110 * This function disables XBARA clock. 0111 * 0112 * @param base XBARA peripheral address. 0113 */ 0114 void XBARA_Deinit(XBARA_Type *base); 0115 0116 /*! 0117 * @brief Sets a connection between the selected XBARA_IN[*] input and the XBARA_OUT[*] output signal. 0118 * 0119 * This function connects the XBARA input to the selected XBARA output. 0120 * If more than one XBARA module is available, only the inputs and outputs from the same module 0121 * can be connected. 0122 * 0123 * Example: 0124 @code 0125 XBARA_SetSignalsConnection(XBARA, kXBARA_InputPIT_TRG0, kXBARA_OutputDMAMUX18); 0126 @endcode 0127 * 0128 * @param base XBARA peripheral address. 0129 * @param input XBARA input signal. 0130 * @param output XBARA output signal. 0131 */ 0132 void XBARA_SetSignalsConnection(XBARA_Type *base, xbar_input_signal_t input, xbar_output_signal_t output); 0133 0134 /*! 0135 * @brief Gets the active edge detection status. 0136 * 0137 * This function gets the active edge detect status of all XBARA_OUTs. If the 0138 * active edge occurs, the return value is asserted. When the interrupt or the DMA 0139 * functionality is enabled for the XBARA_OUTx, this field is 1 when the interrupt 0140 * or DMA request is asserted and 0 when the interrupt or DMA request has been 0141 * cleared. 0142 * 0143 * @param base XBARA peripheral address. 0144 * @return the mask of these status flag bits. 0145 */ 0146 uint32_t XBARA_GetStatusFlags(XBARA_Type *base); 0147 0148 /*! 0149 * @brief Clears the edge detection status flags of relative mask. 0150 * 0151 * @param base XBARA peripheral address. 0152 * @param mask the status flags to clear. 0153 */ 0154 void XBARA_ClearStatusFlags(XBARA_Type *base, uint32_t mask); 0155 0156 /*! 0157 * @brief Configures the XBARA control register. 0158 * 0159 * This function configures an XBARA control register. The active edge detection 0160 * and the DMA/IRQ function on the corresponding XBARA output can be set. 0161 * 0162 * Example: 0163 @code 0164 xbara_control_config_t userConfig; 0165 userConfig.activeEdge = kXBARA_EdgeRising; 0166 userConfig.requestType = kXBARA_RequestInterruptEnalbe; 0167 XBARA_SetOutputSignalConfig(XBARA, kXBARA_OutputDMAMUX18, &userConfig); 0168 @endcode 0169 * 0170 * @param base XBARA peripheral address. 0171 * @param output XBARA output number. 0172 * @param controlConfig Pointer to structure that keeps configuration of control register. 0173 */ 0174 void XBARA_SetOutputSignalConfig(XBARA_Type *base, 0175 xbar_output_signal_t output, 0176 const xbara_control_config_t *controlConfig); 0177 0178 #if defined(__cplusplus) 0179 } 0180 #endif /* __cplusplus */ 0181 0182 /*! @}*/ 0183 0184 /*!* @} */ 0185 0186 #endif /* _FSL_XBARA_H_ */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |