Arrow / Mbed OS DAPLink Reset
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers fsl_dmamux.h Source File

fsl_dmamux.h

00001 /*
00002  * Copyright (c) 2015, Freescale Semiconductor, Inc.
00003  * Copyright 2016-2017 NXP
00004  * All rights reserved.
00005  * 
00006  * SPDX-License-Identifier: BSD-3-Clause
00007  */
00008 
00009 #ifndef _FSL_DMAMUX_H_
00010 #define _FSL_DMAMUX_H_
00011 
00012 #include "fsl_common.h"
00013 
00014 /*!
00015  * @addtogroup dmamux
00016  * @{
00017  */
00018 
00019 
00020 /*******************************************************************************
00021  * Definitions
00022  ******************************************************************************/
00023 
00024 /*! @name Driver version */
00025 /*@{*/
00026 /*! @brief DMAMUX driver version 2.0.2. */
00027 #define FSL_DMAMUX_DRIVER_VERSION (MAKE_VERSION(2, 0, 2))
00028 /*@}*/
00029 
00030 /*******************************************************************************
00031  * API
00032  ******************************************************************************/
00033 
00034 #if defined(__cplusplus)
00035 extern "C" {
00036 #endif /* __cplusplus */
00037 
00038 /*!
00039  * @name DMAMUX Initialization and de-initialization
00040  * @{
00041  */
00042 
00043 /*!
00044  * @brief Initializes the DMAMUX peripheral.
00045  *
00046  * This function ungates the DMAMUX clock.
00047  *
00048  * @param base DMAMUX peripheral base address.
00049  *
00050  */
00051 void DMAMUX_Init(DMAMUX_Type *base);
00052 
00053 /*!
00054  * @brief Deinitializes the DMAMUX peripheral.
00055  *
00056  * This function gates the DMAMUX clock.
00057  *
00058  * @param base DMAMUX peripheral base address.
00059  */
00060 void DMAMUX_Deinit(DMAMUX_Type *base);
00061 
00062 /* @} */
00063 /*!
00064  * @name DMAMUX Channel Operation
00065  * @{
00066  */
00067 
00068 /*!
00069  * @brief Enables the DMAMUX channel.
00070  *
00071  * This function enables the DMAMUX channel.
00072  *
00073  * @param base DMAMUX peripheral base address.
00074  * @param channel DMAMUX channel number.
00075  */
00076 static inline void DMAMUX_EnableChannel(DMAMUX_Type *base, uint32_t channel)
00077 {
00078     assert(channel < FSL_FEATURE_DMAMUX_MODULE_CHANNEL);
00079 
00080     base->CHCFG[channel] |= DMAMUX_CHCFG_ENBL_MASK;
00081 }
00082 
00083 /*!
00084  * @brief Disables the DMAMUX channel.
00085  *
00086  * This function disables the DMAMUX channel.
00087  *
00088  * @note The user must disable the DMAMUX channel before configuring it.
00089  * @param base DMAMUX peripheral base address.
00090  * @param channel DMAMUX channel number.
00091  */
00092 static inline void DMAMUX_DisableChannel(DMAMUX_Type *base, uint32_t channel)
00093 {
00094     assert(channel < FSL_FEATURE_DMAMUX_MODULE_CHANNEL);
00095 
00096     base->CHCFG[channel] &= ~DMAMUX_CHCFG_ENBL_MASK;
00097 }
00098 
00099 /*!
00100  * @brief Configures the DMAMUX channel source.
00101  *
00102  * @param base DMAMUX peripheral base address.
00103  * @param channel DMAMUX channel number.
00104  * @param source Channel source, which is used to trigger the DMA transfer.
00105  */
00106 static inline void DMAMUX_SetSource(DMAMUX_Type *base, uint32_t channel, uint32_t source)
00107 {
00108     assert(channel < FSL_FEATURE_DMAMUX_MODULE_CHANNEL);
00109 
00110     base->CHCFG[channel] = ((base->CHCFG[channel] & ~DMAMUX_CHCFG_SOURCE_MASK) | DMAMUX_CHCFG_SOURCE(source));
00111 }
00112 
00113 #if defined(FSL_FEATURE_DMAMUX_HAS_TRIG) && FSL_FEATURE_DMAMUX_HAS_TRIG > 0U
00114 /*!
00115  * @brief Enables the DMAMUX period trigger.
00116  *
00117  * This function enables the DMAMUX period trigger feature.
00118  *
00119  * @param base DMAMUX peripheral base address.
00120  * @param channel DMAMUX channel number.
00121  */
00122 static inline void DMAMUX_EnablePeriodTrigger(DMAMUX_Type *base, uint32_t channel)
00123 {
00124     assert(channel < FSL_FEATURE_DMAMUX_MODULE_CHANNEL);
00125 
00126     base->CHCFG[channel] |= DMAMUX_CHCFG_TRIG_MASK;
00127 }
00128 
00129 /*!
00130  * @brief Disables the DMAMUX period trigger.
00131  *
00132  * This function disables the DMAMUX period trigger.
00133  *
00134  * @param base DMAMUX peripheral base address.
00135  * @param channel DMAMUX channel number.
00136  */
00137 static inline void DMAMUX_DisablePeriodTrigger(DMAMUX_Type *base, uint32_t channel)
00138 {
00139     assert(channel < FSL_FEATURE_DMAMUX_MODULE_CHANNEL);
00140 
00141     base->CHCFG[channel] &= ~DMAMUX_CHCFG_TRIG_MASK;
00142 }
00143 #endif /* FSL_FEATURE_DMAMUX_HAS_TRIG */
00144 
00145 #if (defined(FSL_FEATURE_DMAMUX_HAS_A_ON) && FSL_FEATURE_DMAMUX_HAS_A_ON)
00146 /*!
00147  * @brief Enables the DMA channel to be always ON.
00148  *
00149  * This function enables the DMAMUX channel always ON feature.
00150  *
00151  * @param base DMAMUX peripheral base address.
00152  * @param channel DMAMUX channel number.
00153  * @param enable Switcher of the always ON feature. "true" means enabled, "false" means disabled.
00154  */
00155 static inline void DMAMUX_EnableAlwaysOn(DMAMUX_Type *base, uint32_t channel, bool enable)
00156 {
00157     assert(channel < FSL_FEATURE_DMAMUX_MODULE_CHANNEL);
00158 
00159     if (enable)
00160     {
00161         base->CHCFG[channel] |= DMAMUX_CHCFG_A_ON_MASK;
00162     }
00163     else
00164     {
00165         base->CHCFG[channel] &= ~DMAMUX_CHCFG_A_ON_MASK;
00166     }
00167 }
00168 #endif /* FSL_FEATURE_DMAMUX_HAS_A_ON */
00169 
00170 /* @} */
00171 
00172 #if defined(__cplusplus)
00173 }
00174 #endif /* __cplusplus */
00175 
00176 /* @} */
00177 
00178 #endif /* _FSL_DMAMUX_H_ */