rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
fsl_dmamux.h
Go to the documentation of this file.
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
14/*!
15 * @addtogroup dmamux
16 * @{
17 */
18
19
20/*******************************************************************************
21 * Definitions
22 ******************************************************************************/
23
24/*! @name Driver version */
25/*@{*/
26/*! @brief DMAMUX driver version 2.0.2. */
27#define FSL_DMAMUX_DRIVER_VERSION (MAKE_VERSION(2, 0, 2))
28/*@}*/
29
30/*******************************************************************************
31 * API
32 ******************************************************************************/
33
34#if defined(__cplusplus)
35extern "C" {
36#endif /* __cplusplus */
37
38/*!
39 * @name DMAMUX Initialization and de-initialization
40 * @{
41 */
42
43/*!
44 * @brief Initializes the DMAMUX peripheral.
45 *
46 * This function ungates the DMAMUX clock.
47 *
48 * @param base DMAMUX peripheral base address.
49 *
50 */
51void DMAMUX_Init(DMAMUX_Type *base);
52
53/*!
54 * @brief Deinitializes the DMAMUX peripheral.
55 *
56 * This function gates the DMAMUX clock.
57 *
58 * @param base DMAMUX peripheral base address.
59 */
60void DMAMUX_Deinit(DMAMUX_Type *base);
61
62/* @} */
63/*!
64 * @name DMAMUX Channel Operation
65 * @{
66 */
67
68/*!
69 * @brief Enables the DMAMUX channel.
70 *
71 * This function enables the DMAMUX channel.
72 *
73 * @param base DMAMUX peripheral base address.
74 * @param channel DMAMUX channel number.
75 */
76static inline void DMAMUX_EnableChannel(DMAMUX_Type *base, uint32_t channel)
77{
78 assert(channel < FSL_FEATURE_DMAMUX_MODULE_CHANNEL);
79
80 base->CHCFG[channel] |= DMAMUX_CHCFG_ENBL_MASK;
81}
82
83/*!
84 * @brief Disables the DMAMUX channel.
85 *
86 * This function disables the DMAMUX channel.
87 *
88 * @note The user must disable the DMAMUX channel before configuring it.
89 * @param base DMAMUX peripheral base address.
90 * @param channel DMAMUX channel number.
91 */
92static inline void DMAMUX_DisableChannel(DMAMUX_Type *base, uint32_t channel)
93{
94 assert(channel < FSL_FEATURE_DMAMUX_MODULE_CHANNEL);
95
96 base->CHCFG[channel] &= ~DMAMUX_CHCFG_ENBL_MASK;
97}
98
99/*!
100 * @brief Configures the DMAMUX channel source.
101 *
102 * @param base DMAMUX peripheral base address.
103 * @param channel DMAMUX channel number.
104 * @param source Channel source, which is used to trigger the DMA transfer.
105 */
106static inline void DMAMUX_SetSource(DMAMUX_Type *base, uint32_t channel, uint32_t source)
107{
108 assert(channel < FSL_FEATURE_DMAMUX_MODULE_CHANNEL);
109
110 base->CHCFG[channel] = ((base->CHCFG[channel] & ~DMAMUX_CHCFG_SOURCE_MASK) | DMAMUX_CHCFG_SOURCE(source));
111}
112
113#if defined(FSL_FEATURE_DMAMUX_HAS_TRIG) && FSL_FEATURE_DMAMUX_HAS_TRIG > 0U
114/*!
115 * @brief Enables the DMAMUX period trigger.
116 *
117 * This function enables the DMAMUX period trigger feature.
118 *
119 * @param base DMAMUX peripheral base address.
120 * @param channel DMAMUX channel number.
121 */
122static inline void DMAMUX_EnablePeriodTrigger(DMAMUX_Type *base, uint32_t channel)
123{
124 assert(channel < FSL_FEATURE_DMAMUX_MODULE_CHANNEL);
125
126 base->CHCFG[channel] |= DMAMUX_CHCFG_TRIG_MASK;
127}
128
129/*!
130 * @brief Disables the DMAMUX period trigger.
131 *
132 * This function disables the DMAMUX period trigger.
133 *
134 * @param base DMAMUX peripheral base address.
135 * @param channel DMAMUX channel number.
136 */
137static inline void DMAMUX_DisablePeriodTrigger(DMAMUX_Type *base, uint32_t channel)
138{
139 assert(channel < FSL_FEATURE_DMAMUX_MODULE_CHANNEL);
140
141 base->CHCFG[channel] &= ~DMAMUX_CHCFG_TRIG_MASK;
142}
143#endif /* FSL_FEATURE_DMAMUX_HAS_TRIG */
144
145#if (defined(FSL_FEATURE_DMAMUX_HAS_A_ON) && FSL_FEATURE_DMAMUX_HAS_A_ON)
146/*!
147 * @brief Enables the DMA channel to be always ON.
148 *
149 * This function enables the DMAMUX channel always ON feature.
150 *
151 * @param base DMAMUX peripheral base address.
152 * @param channel DMAMUX channel number.
153 * @param enable Switcher of the always ON feature. "true" means enabled, "false" means disabled.
154 */
155static inline void DMAMUX_EnableAlwaysOn(DMAMUX_Type *base, uint32_t channel, bool enable)
156{
157 assert(channel < FSL_FEATURE_DMAMUX_MODULE_CHANNEL);
158
159 if (enable)
160 {
161 base->CHCFG[channel] |= DMAMUX_CHCFG_A_ON_MASK;
162 }
163 else
164 {
165 base->CHCFG[channel] &= ~DMAMUX_CHCFG_A_ON_MASK;
166 }
167}
168#endif /* FSL_FEATURE_DMAMUX_HAS_A_ON */
169
170/* @} */
171
172#if defined(__cplusplus)
173}
174#endif /* __cplusplus */
175
176/* @} */
177
178#endif /* _FSL_DMAMUX_H_ */
uint16_t channel
Definition adc_inputs.h:104
static void DMAMUX_DisableChannel(DMAMUX_Type *base, uint32_t channel)
Disables the DMAMUX channel.
Definition fsl_dmamux.h:92
static void DMAMUX_EnableAlwaysOn(DMAMUX_Type *base, uint32_t channel, bool enable)
Enables the DMA channel to be always ON.
Definition fsl_dmamux.h:155
static void DMAMUX_DisablePeriodTrigger(DMAMUX_Type *base, uint32_t channel)
Disables the DMAMUX period trigger.
Definition fsl_dmamux.h:137
void DMAMUX_Init(DMAMUX_Type *base)
Initializes the DMAMUX peripheral.
Definition fsl_dmamux.c:73
static void DMAMUX_SetSource(DMAMUX_Type *base, uint32_t channel, uint32_t source)
Configures the DMAMUX channel source.
Definition fsl_dmamux.h:106
static void DMAMUX_EnablePeriodTrigger(DMAMUX_Type *base, uint32_t channel)
Enables the DMAMUX period trigger.
Definition fsl_dmamux.h:122
void DMAMUX_Deinit(DMAMUX_Type *base)
Deinitializes the DMAMUX peripheral.
Definition fsl_dmamux.c:87
static void DMAMUX_EnableChannel(DMAMUX_Type *base, uint32_t channel)
Enables the DMAMUX channel.
Definition fsl_dmamux.h:76
static void enable(const char *param)
Definition settings.cpp:441