RTEMS 6.1-rc2
Loading...
Searching...
No Matches
fsl_dmamux.h
1/*
2 * Copyright (c) 2015, Freescale Semiconductor, Inc.
3 * Copyright 2016-2017 NXP
4 * All rights reserved.
5 *
6 * SPDX-License-Identifier: BSD-3-Clause
7 */
8
9#ifndef _FSL_DMAMUX_H_
10#define _FSL_DMAMUX_H_
11
12#include "fsl_common.h"
13
19/*******************************************************************************
20 * Definitions
21 ******************************************************************************/
22
26#define FSL_DMAMUX_DRIVER_VERSION (MAKE_VERSION(2, 0, 5))
29/*******************************************************************************
30 * API
31 ******************************************************************************/
32
33#if defined(__cplusplus)
34extern "C" {
35#endif /* __cplusplus */
36
50void DMAMUX_Init(DMAMUX_Type *base);
51
59void DMAMUX_Deinit(DMAMUX_Type *base);
60
61/* @} */
75static inline void DMAMUX_EnableChannel(DMAMUX_Type *base, uint32_t channel)
76{
77 assert(channel < (uint32_t)FSL_FEATURE_DMAMUX_MODULE_CHANNEL);
78
79 base->CHCFG[channel] |= DMAMUX_CHCFG_ENBL_MASK;
80}
81
91static inline void DMAMUX_DisableChannel(DMAMUX_Type *base, uint32_t channel)
92{
93 assert(channel < (uint32_t)FSL_FEATURE_DMAMUX_MODULE_CHANNEL);
94
95#if defined FSL_FEATURE_DMAMUX_CHCFG_REGISTER_WIDTH && (FSL_FEATURE_DMAMUX_CHCFG_REGISTER_WIDTH == 32U)
96 base->CHCFG[channel] &= ~DMAMUX_CHCFG_ENBL_MASK;
97#else
98 base->CHCFG[channel] &= ~(uint8_t)DMAMUX_CHCFG_ENBL_MASK;
99#endif
100}
101
109static inline void DMAMUX_SetSource(DMAMUX_Type *base, uint32_t channel, uint32_t source)
110{
111 assert(channel < (uint32_t)FSL_FEATURE_DMAMUX_MODULE_CHANNEL);
112
113#if defined FSL_FEATURE_DMAMUX_CHCFG_REGISTER_WIDTH && (FSL_FEATURE_DMAMUX_CHCFG_REGISTER_WIDTH == 32U)
114 base->CHCFG[channel] = ((base->CHCFG[channel] & ~DMAMUX_CHCFG_SOURCE_MASK) | DMAMUX_CHCFG_SOURCE(source));
115#else
116 base->CHCFG[channel] = (uint8_t)((base->CHCFG[channel] & ~DMAMUX_CHCFG_SOURCE_MASK) | DMAMUX_CHCFG_SOURCE(source));
117#endif
118}
119
120#if defined(FSL_FEATURE_DMAMUX_HAS_TRIG) && FSL_FEATURE_DMAMUX_HAS_TRIG > 0U
129static inline void DMAMUX_EnablePeriodTrigger(DMAMUX_Type *base, uint32_t channel)
130{
131 assert(channel < (uint32_t)FSL_FEATURE_DMAMUX_MODULE_CHANNEL);
132
133 base->CHCFG[channel] |= DMAMUX_CHCFG_TRIG_MASK;
134}
135
144static inline void DMAMUX_DisablePeriodTrigger(DMAMUX_Type *base, uint32_t channel)
145{
146 assert(channel < (uint32_t)FSL_FEATURE_DMAMUX_MODULE_CHANNEL);
147
148#if defined FSL_FEATURE_DMAMUX_CHCFG_REGISTER_WIDTH && (FSL_FEATURE_DMAMUX_CHCFG_REGISTER_WIDTH == 32U)
149 base->CHCFG[channel] &= ~DMAMUX_CHCFG_TRIG_MASK;
150#else
151 base->CHCFG[channel] &= ~(uint8_t)DMAMUX_CHCFG_TRIG_MASK;
152#endif
153}
154#endif /* FSL_FEATURE_DMAMUX_HAS_TRIG */
155
156#if (defined(FSL_FEATURE_DMAMUX_HAS_A_ON) && FSL_FEATURE_DMAMUX_HAS_A_ON)
166static inline void DMAMUX_EnableAlwaysOn(DMAMUX_Type *base, uint32_t channel, bool enable)
167{
168 assert(channel < (uint32_t)FSL_FEATURE_DMAMUX_MODULE_CHANNEL);
169
170 if (enable)
171 {
172 base->CHCFG[channel] |= DMAMUX_CHCFG_A_ON_MASK;
173 }
174 else
175 {
176 base->CHCFG[channel] &= ~DMAMUX_CHCFG_A_ON_MASK;
177 }
178}
179#endif /* FSL_FEATURE_DMAMUX_HAS_A_ON */
180
181/* @} */
182
183#if defined(__cplusplus)
184}
185#endif /* __cplusplus */
186
187/* @} */
188
189#endif /* _FSL_DMAMUX_H_ */
#define DMAMUX_CHCFG_SOURCE(x)
Definition: MIMXRT1052.h:17884
void DMAMUX_Init(DMAMUX_Type *base)
Initializes the DMAMUX peripheral.
Definition: fsl_dmamux.c:72
void DMAMUX_Deinit(DMAMUX_Type *base)
Deinitializes the DMAMUX peripheral.
Definition: fsl_dmamux.c:86
Definition: MIMXRT1052.h:17864