no-OS
maxim_dma.h
Go to the documentation of this file.
1 /***************************************************************************/
39 #ifndef MAXIM_DMA_H_
40 #define MAXIM_DMA_H_
41 
42 #include <stdint.h>
43 #include "no_os_dma.h"
44 #include "dma.h"
45 
46 #if TARGET_NUM == 32650
47 #include "max32650.h"
48 #elif TARGET_NUM == 32655
49 #include "max32655.h"
50 #elif TARGET_NUM == 32660
51 #include "max32660.h"
52 #elif TARGET_NUM == 32665
53 #include "max32665.h"
54 #elif TARGET_NUM == 32690
55 #include "max32690.h"
56 #elif TARGET_NUM == 78000
57 #include "max78000.h"
58 #endif
59 
60 #define MAX_DMA ((struct max_dma_regs *)(MXC_DMA))
61 #define MAX_DMA_IRQ_EN_ALL_CH NO_OS_GENMASK(15, 0)
62 #define MAX_DMA_ENABLED NO_OS_BIT(0)
63 #define MAX_DMA_ENABLE NO_OS_BIT(0)
64 #define MAX_DMA_IRQ_CTZ_EN NO_OS_BIT(31)
65 #define MAX_DMA_REQSEL_MASK NO_OS_GENMASK(9, 4)
66 #define MAX_DMA_DST_INC NO_OS_BIT(22)
67 #define MAX_DMA_SRC_INC NO_OS_BIT(18)
68 
70  volatile uint32_t cfg;
71  volatile uint32_t st;
72  volatile uint32_t src;
73  volatile uint32_t dst;
74  volatile uint32_t cnt;
75  volatile uint32_t src_rld;
76  volatile uint32_t dst_rld;
77  volatile uint32_t cnt_rld;
78 };
79 
80 struct max_dma_regs {
81  volatile uint32_t cn;
82  volatile const uint32_t intr;
83  const uint32_t rsv_0x8_0xff[62];
84  volatile struct max_dma_ch_regs ch[MXC_DMA_CHANNELS];
85 };
86 
88 
97 static inline uint32_t max_dma_get_irq(uint32_t id, uint32_t ch)
98 {
99 #if TARGET_NUM == 32665
100  if (!id)
101  return MXC_DMA0_CH_GET_IRQ(ch);
102 
103  return MXC_DMA1_CH_GET_IRQ(ch);
104 #else
105  return MXC_DMA_CH_GET_IRQ(ch);
106 #endif
107 }
108 
109 #endif
MAX_DMA_DST_INC
#define MAX_DMA_DST_INC
Definition: maxim_dma.h:66
max_dma_ch_regs::dst_rld
volatile uint32_t dst_rld
Definition: maxim_dma.h:76
MAX_DMA_SRC_INC
#define MAX_DMA_SRC_INC
Definition: maxim_dma.h:67
no_os_alloc.h
max_dma_regs::rsv_0x8_0xff
const uint32_t rsv_0x8_0xff[62]
Definition: maxim_dma.h:83
max_dma_ch_regs::src_rld
volatile uint32_t src_rld
Definition: maxim_dma.h:75
no_os_dma_init_param
Initialization parameter for the DMA controller.
Definition: no_os_dma.h:177
no_os_dma_ch::id
uint32_t id
Definition: no_os_dma.h:115
no_os_irq.h
Header file of IRQ interface.
no_os_dma_desc::id
uint32_t id
Definition: no_os_dma.h:144
max_dma_ch_regs
Definition: maxim_dma.h:69
max_dma_ch_regs::cfg
volatile uint32_t cfg
Definition: maxim_dma.h:70
no_os_dma_ch::irq_num
uint32_t irq_num
Definition: no_os_dma.h:121
DEV_TO_MEM
@ DEV_TO_MEM
Definition: no_os_dma.h:58
no_os_dma_desc::extra
void * extra
Definition: no_os_dma.h:159
max_dma_regs
Definition: maxim_dma.h:80
max_dma_regs::cn
volatile uint32_t cn
Definition: maxim_dma.h:81
MAX_DMA_ENABLED
#define MAX_DMA_ENABLED
Definition: maxim_dma.h:62
max_dma_ch_regs::src
volatile uint32_t src
Definition: maxim_dma.h:72
no_os_calloc
void * no_os_calloc(size_t nitems, size_t size)
Allocate memory and return a pointer to it, set memory to 0.
Definition: chibios_alloc.c:60
MAX_DMA_IRQ_CTZ_EN
#define MAX_DMA_IRQ_CTZ_EN
Definition: maxim_dma.h:64
no_os_dma_init_param::num_ch
uint32_t num_ch
Definition: no_os_dma.h:181
no_os_dma_init_param::id
uint32_t id
Definition: no_os_dma.h:179
max_dma_ops
struct no_os_dma_platform_ops max_dma_ops
Maxim platform specific callbacks for the DMA API.
Definition: maxim_dma.c:279
no_os_field_prep
uint32_t no_os_field_prep(uint32_t mask, uint32_t val)
no_os_error.h
Error codes definition.
max_dma_regs::intr
const volatile uint32_t intr
Definition: maxim_dma.h:82
no_os_dma_ch
Describes the state of a DMA channel.
Definition: no_os_dma.h:113
no_os_dma_platform_ops
Definition: no_os_dma.h:247
no_os_dma_xfer_desc::dst
uint8_t * dst
Definition: no_os_dma.h:81
MEM_TO_MEM
@ MEM_TO_MEM
Definition: no_os_dma.h:56
max_irq_ops
const struct no_os_irq_platform_ops max_irq_ops
maxim specific IRQ platform ops structure
Definition: maxim_irq.c:662
no_os_irq_init_param::irq_ctrl_id
uint32_t irq_ctrl_id
Definition: no_os_irq.h:115
no_os_irq_ctrl_init
int32_t no_os_irq_ctrl_init(struct no_os_irq_ctrl_desc **desc, const struct no_os_irq_init_param *param)
Initialize the IRQ interrupts.
Definition: no_os_irq.c:51
no_os_dma_xfer_desc
It's used to setup a generic DMA transfer.
Definition: no_os_dma.h:77
max_dma_ops
struct no_os_dma_platform_ops max_dma_ops
Maxim platform specific callbacks for the DMA API.
Definition: maxim_dma.c:279
no_os_dma_desc::irq_ctrl
struct no_os_irq_ctrl_desc * irq_ctrl
Definition: no_os_dma.h:157
MAX_DMA_GCR_RST_POS
#define MAX_DMA_GCR_RST_POS
Definition: maxim_dma.c:49
no_os_dma_desc::num_ch
uint32_t num_ch
Definition: no_os_dma.h:146
no_os_dma_platform_ops::dma_init
int(* dma_init)(struct no_os_dma_desc **, struct no_os_dma_init_param *)
Definition: no_os_dma.h:249
no_os_dma_ch::free
bool free
Definition: no_os_dma.h:117
no_os_dma_xfer_desc::xfer_type
enum no_os_dma_xfer_type xfer_type
Definition: no_os_dma.h:85
MAX_DMA_ENABLE
#define MAX_DMA_ENABLE
Definition: maxim_dma.h:63
no_os_free
void no_os_free(void *ptr)
Deallocate memory previously allocated by a call to no_os_calloc or no_os_malloc.
Definition: chibios_alloc.c:75
NULL
#define NULL
Definition: wrapper.h:64
max_dma_ch_regs::cnt
volatile uint32_t cnt
Definition: maxim_dma.h:74
MAX_DMA_IRQ_EN_ALL_CH
#define MAX_DMA_IRQ_EN_ALL_CH
Definition: maxim_dma.h:61
max_dma_ch_regs::st
volatile uint32_t st
Definition: maxim_dma.h:71
max_dma_ch_regs::dst
volatile uint32_t dst
Definition: maxim_dma.h:73
no_os_dma_xfer_desc::src
uint8_t * src
Definition: no_os_dma.h:79
no_os_irq_init_param
Structure holding the initial parameters for Interrupt Request.
Definition: no_os_irq.h:113
no_os_irq_ctrl_remove
int32_t no_os_irq_ctrl_remove(struct no_os_irq_ctrl_desc *desc)
Free the resources allocated by no_os_irq_ctrl_init().
Definition: no_os_irq.c:77
no_os_dma_ch::extra
void * extra
Definition: no_os_dma.h:126
max_dma_regs::ch
volatile struct max_dma_ch_regs ch[MXC_DMA_CHANNELS]
Definition: maxim_dma.h:84
max_dma_ch_regs::cnt_rld
volatile uint32_t cnt_rld
Definition: maxim_dma.h:77
MEM_TO_DEV
@ MEM_TO_DEV
Definition: no_os_dma.h:57
no_os_dma_desc::channels
struct no_os_dma_ch * channels
Definition: no_os_dma.h:148
no_os_util.h
Header file of utility functions.
MAX_DMA_REQSEL_MASK
#define MAX_DMA_REQSEL_MASK
Definition: maxim_dma.h:65
MAX_DMA
#define MAX_DMA
Definition: maxim_dma.h:60
no_os_dma_ch::sync_lock
bool sync_lock
Definition: no_os_dma.h:135
maxim_dma.h
Maxim platform specific header DMA API.
no_os_dma_xfer_desc::length
uint32_t length
Definition: no_os_dma.h:83
no_os_dma.h
Platform independent function definitions and data types for the DMA API.
no_os_dma_desc
Describes the state of the DMA controller.
Definition: no_os_dma.h:142