HPM SDK
HPMicro Software Development Kit
hpm_dmamux_drv.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2021-2022 HPMicro
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  *
6  */
7 
8 #ifndef HPM_DMAMUX_DRV_H
9 #define HPM_DMAMUX_DRV_H
10 #include "hpm_common.h"
11 #include "hpm_soc_feature.h"
12 #include "hpm_dmamux_regs.h"
13 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
26 
27 #if !defined(DMAMUX_SOC_WRITEONLY) || !DMAMUX_SOC_WRITEONLY
28 
35 static inline void dmamux_enable_channel(DMAMUX_Type *ptr, uint8_t ch_index)
36 {
37  ptr->MUXCFG[ch_index] |= DMAMUX_MUXCFG_ENABLE_MASK;
38 }
39 
46 static inline void dmamux_disable_channel(DMAMUX_Type *ptr, uint8_t ch_index)
47 {
48  ptr->MUXCFG[ch_index] &= ~DMAMUX_MUXCFG_ENABLE_MASK;
49 }
50 
51 #endif
52 
61 static inline void dmamux_config(DMAMUX_Type *ptr, uint8_t ch_index, uint8_t src, bool enable)
62 {
63  ptr->MUXCFG[ch_index] = DMAMUX_MUXCFG_SOURCE_SET(src)
64  | DMAMUX_MUXCFG_ENABLE_SET(enable);
65 }
66 
67 
68 #ifdef __cplusplus
69 }
70 #endif
75 #endif /* HPM_DMAMUX_DRV_H */
76 
#define DMAMUX_MUXCFG_ENABLE_SET(x)
Definition: hpm_dmamux_regs.h:29
#define DMAMUX_MUXCFG_SOURCE_SET(x)
Definition: hpm_dmamux_regs.h:40
#define DMAMUX_MUXCFG_ENABLE_MASK
Definition: hpm_dmamux_regs.h:27
static void dmamux_disable_channel(DMAMUX_Type *ptr, uint8_t ch_index)
Disable dmamux channel.
Definition: hpm_dmamux_drv.h:46
static void dmamux_enable_channel(DMAMUX_Type *ptr, uint8_t ch_index)
Enable dmamux channel.
Definition: hpm_dmamux_drv.h:35
static void dmamux_config(DMAMUX_Type *ptr, uint8_t ch_index, uint8_t src, bool enable)
Config DMAMUX.
Definition: hpm_dmamux_drv.h:61
Definition: hpm_dmamux_regs.h:12
__W uint32_t MUXCFG[32]
Definition: hpm_dmamux_regs.h:13