no-OS
All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
no_os_dma.h
Go to the documentation of this file.
1/***************************************************************************/
34#ifndef _NO_OS_DMA_H_
35#define _NO_OS_DMA_H_
36
37#include <stdio.h>
38#include <stdlib.h>
39#include <stdint.h>
40
41#include "no_os_list.h"
42#include "no_os_irq.h"
43#include "no_os_mutex.h"
44
54
64
66
73 uint8_t *src;
75 uint8_t *dst;
77 uint32_t length;
80
83 struct no_os_dma_xfer_desc *,
84 void *);
91 uint32_t irq_priority;
92
98
100 void *extra;
101};
102
131
138 uint32_t id;
140 uint32_t num_ch;
153 void *extra;
155 uint32_t ref;
157 void *mutex;
158
164 void (*sg_handler)(void *);
165};
166
173 uint32_t id;
175 uint32_t num_ch;
179 void *extra;
180
185 void (*sg_handler)(void *);
190 void *ctx;
191};
192
194int no_os_dma_init(struct no_os_dma_desc **,
195 struct no_os_dma_init_param *);
196
198int no_os_dma_remove(struct no_os_dma_desc *);
199
202 struct no_os_dma_xfer_desc *,
203 uint32_t,
204 struct no_os_dma_ch *);
205
208
211
213int no_os_dma_xfer_start(struct no_os_dma_desc *, struct no_os_dma_ch *);
214
219int no_os_dma_xfer_abort(struct no_os_dma_desc *, struct no_os_dma_ch *);
220
225bool no_os_dma_is_completed(struct no_os_dma_desc *, struct no_os_dma_ch *);
226
228bool no_os_dma_in_progress(struct no_os_dma_desc *, struct no_os_dma_ch *);
229
232
235
243 int (*dma_init)(struct no_os_dma_desc **, struct no_os_dma_init_param *);
245 int (*dma_remove)(struct no_os_dma_desc *desc);
247 int (*dma_acquire_ch)(struct no_os_dma_desc *, uint32_t *);
248 int (*dma_release_ch)(struct no_os_dma_desc *, uint32_t);
251 struct no_os_dma_xfer_desc *);
253 int (*dma_xfer_start)(struct no_os_dma_desc *, struct no_os_dma_ch *);
255 int (*dma_xfer_abort)(struct no_os_dma_desc *, struct no_os_dma_ch *);
263};
264
265#endif
bool
Definition common.h:42
int no_os_dma_chan_unlock(struct no_os_dma_ch *)
Unlock a DMA channel, marking it available for acquisition.
Definition no_os_dma.c:336
bool no_os_dma_in_progress(struct no_os_dma_desc *, struct no_os_dma_ch *)
Whether or not there is a transfer in progress on a specific channel.
Definition no_os_dma.c:434
int no_os_dma_xfer_start(struct no_os_dma_desc *, struct no_os_dma_ch *)
Acquire a channel and configure the list of transfers.
Definition no_os_dma.c:356
int no_os_dma_xfer_abort(struct no_os_dma_desc *, struct no_os_dma_ch *)
Abort the ongoing and any other future transfers scheduled for a channel.
Definition no_os_dma.c:384
int no_os_dma_init(struct no_os_dma_desc **, struct no_os_dma_init_param *)
Initialize the DMA controller.
Definition no_os_dma.c:90
no_os_dma_xfer_type
Supported transfer directions.
Definition no_os_dma.h:49
@ MEM_TO_MEM
Definition no_os_dma.h:50
@ MEM_TO_DEV
Definition no_os_dma.h:51
@ DEV_TO_MEM
Definition no_os_dma.h:52
int no_os_dma_release_channel(struct no_os_dma_desc *, struct no_os_dma_ch *)
Free DMA channel.
Definition no_os_dma.c:216
int no_os_dma_chan_lock(struct no_os_dma_ch *)
Lock a DMA channel, so it won't be acquired even if it's free.
Definition no_os_dma.c:317
int no_os_dma_config_xfer(struct no_os_dma_desc *, struct no_os_dma_xfer_desc *, uint32_t, struct no_os_dma_ch *)
Acquire a channel and configure the list of transfers.
Definition no_os_dma.c:242
bool no_os_dma_is_completed(struct no_os_dma_desc *, struct no_os_dma_ch *)
Get the state of a DMA channel (free or not).
Definition no_os_dma.c:417
int no_os_dma_remove(struct no_os_dma_desc *)
Remove resources allocated for the DMA controller.
Definition no_os_dma.c:143
int no_os_dma_acquire_channel(struct no_os_dma_desc *, struct no_os_dma_ch **)
Get a free DMA channel.
Definition no_os_dma.c:184
Header file of IRQ interface.
no_os_irq_peripheral
Definition no_os_irq.h:77
List library header.
Structure describing a callback to be registered.
Definition no_os_irq.h:136
Describes the state of a DMA channel.
Definition no_os_dma.h:107
uint32_t irq_num
Definition no_os_dma.h:115
struct no_os_list_desc * sg_list
Definition no_os_dma.h:113
uint32_t id
Definition no_os_dma.h:109
void * mutex
Definition no_os_dma.h:123
struct no_os_callback_desc cb_desc
Definition no_os_dma.h:117
bool free
Definition no_os_dma.h:111
void * extra
Definition no_os_dma.h:120
struct no_os_dma_default_handler_data irq_ctx
Definition no_os_dma.h:119
bool sync_lock
Definition no_os_dma.h:129
IRQ parameter for the default inter transfer handler.
Definition no_os_dma.h:59
struct no_os_dma_ch * channel
Definition no_os_dma.h:61
void * extra
Definition no_os_dma.h:62
struct no_os_dma_desc * desc
Definition no_os_dma.h:60
Describes the state of the DMA controller.
Definition no_os_dma.h:136
struct no_os_irq_ctrl_desc * irq_ctrl
Definition no_os_dma.h:151
uint32_t ref
Definition no_os_dma.h:155
void(* sg_handler)(void *)
Definition no_os_dma.h:164
struct no_os_dma_ch * channels
Definition no_os_dma.h:142
void * extra
Definition no_os_dma.h:153
struct no_os_dma_platform_ops * platform_ops
Definition no_os_dma.h:144
uint32_t num_ch
Definition no_os_dma.h:140
void * mutex
Definition no_os_dma.h:157
uint32_t id
Definition no_os_dma.h:138
Initialization parameter for the DMA controller.
Definition no_os_dma.h:171
void * ctx
Definition no_os_dma.h:190
void(* sg_handler)(void *)
Definition no_os_dma.h:185
struct no_os_dma_platform_ops * platform_ops
Definition no_os_dma.h:177
uint32_t num_ch
Definition no_os_dma.h:175
uint32_t id
Definition no_os_dma.h:173
void * extra
Definition no_os_dma.h:179
Definition no_os_dma.h:241
int(* dma_config_xfer)(struct no_os_dma_ch *, struct no_os_dma_xfer_desc *)
Definition no_os_dma.h:250
int(* dma_remove)(struct no_os_dma_desc *desc)
Definition no_os_dma.h:245
int(* dma_xfer_abort)(struct no_os_dma_desc *, struct no_os_dma_ch *)
Definition no_os_dma.h:255
int(* dma_init)(struct no_os_dma_desc **, struct no_os_dma_init_param *)
Definition no_os_dma.h:243
int(* dma_release_ch)(struct no_os_dma_desc *, uint32_t)
Definition no_os_dma.h:248
bool(* dma_ch_is_completed)(struct no_os_dma_desc *, struct no_os_dma_ch *)
Definition no_os_dma.h:257
bool(* dma_ch_in_progress)(struct no_os_dma_desc *, struct no_os_dma_ch *)
Definition no_os_dma.h:262
int(* dma_xfer_start)(struct no_os_dma_desc *, struct no_os_dma_ch *)
Definition no_os_dma.h:253
int(* dma_acquire_ch)(struct no_os_dma_desc *, uint32_t *)
Definition no_os_dma.h:247
It's used to setup a generic DMA transfer.
Definition no_os_dma.h:71
uint8_t * src
Definition no_os_dma.h:73
enum no_os_irq_peripheral periph
Definition no_os_dma.h:97
enum no_os_dma_xfer_type xfer_type
Definition no_os_dma.h:79
void(* xfer_complete_cb)(struct no_os_dma_xfer_desc *, struct no_os_dma_xfer_desc *, void *)
Definition no_os_dma.h:82
void * xfer_complete_ctx
Definition no_os_dma.h:89
void * extra
Definition no_os_dma.h:100
uint32_t irq_priority
Definition no_os_dma.h:91
uint8_t * dst
Definition no_os_dma.h:75
uint32_t length
Definition no_os_dma.h:77
Definition no_os_irq.h:117
Structure storing the list and function wrapper for usual list types.
Definition no_os_list.h:218