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_dmamux_regs.h"
12 
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24 
25 
26 #if !defined(DMAMUX_SOC_WRITEONLY) || !DMAMUX_SOC_WRITEONLY
27 
34 static inline void dmamux_enable_channel(DMAMUX_Type *ptr, uint8_t ch_index)
35 {
36  ptr->MUXCFG[ch_index] |= DMAMUX_MUXCFG_ENABLE_MASK;
37 }
38 
45 static inline void dmamux_disable_channel(DMAMUX_Type *ptr, uint8_t ch_index)
46 {
47  ptr->MUXCFG[ch_index] &= ~DMAMUX_MUXCFG_ENABLE_MASK;
48 }
49 
50 #endif
51 
60 static inline void dmamux_config(DMAMUX_Type *ptr, uint8_t ch_index, uint8_t src, bool enable)
61 {
62  ptr->MUXCFG[ch_index] = DMAMUX_MUXCFG_SOURCE_SET(src)
63  | DMAMUX_MUXCFG_ENABLE_SET(enable);
64 }
65 
66 
67 #ifdef __cplusplus
68 }
69 #endif
74 #endif /* HPM_DMAMUX_DRV_H */
75 
#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:45
static void dmamux_enable_channel(DMAMUX_Type *ptr, uint8_t ch_index)
Enable dmamux channel.
Definition: hpm_dmamux_drv.h:34
static void dmamux_config(DMAMUX_Type *ptr, uint8_t ch_index, uint8_t src, bool enable)
Config DMAMUX.
Definition: hpm_dmamux_drv.h:60
Definition: hpm_dmamux_regs.h:12
__W uint32_t MUXCFG[32]
Definition: hpm_dmamux_regs.h:13