VSF Documented
vsf_template_dma.h
Go to the documentation of this file.
1/*****************************************************************************
2 * Copyright(C)2009-2022 by VSF Team *
3 * *
4 * Licensed under the Apache License, Version 2.0 (the "License"); *
5 * you may not use this file except in compliance with the License. *
6 * You may obtain a copy of the License at *
7 * *
8 * http://www.apache.org/licenses/LICENSE-2.0 *
9 * *
10 * Unless required by applicable law or agreed to in writing, software *
11 * distributed under the License is distributed on an "AS IS" BASIS, *
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
13 * See the License for the specific language governing permissions and *
14 * limitations under the License. *
15 * *
16 ****************************************************************************/
17
18#ifndef __VSF_TEMPLATE_DMA_H__
19#define __VSF_TEMPLATE_DMA_H__
20
21/*============================ INCLUDES ======================================*/
22
24#include "hal/arch/vsf_arch.h"
25
26#ifdef __cplusplus
27extern "C" {
28#endif
29
30/*============================ MACROS ========================================*/
31
39#ifndef VSF_DMA_CFG_MULTI_CLASS
40# define VSF_DMA_CFG_MULTI_CLASS ENABLED
41#endif
42
52#ifndef VSF_DMA_CFG_PREFIX
53# if VSF_DMA_CFG_MULTI_CLASS == ENABLED
54# define VSF_DMA_CFG_PREFIX vsf
55# elif defined(VSF_HW_DMA_COUNT) && (VSF_HW_DMA_COUNT != 0)
56# define VSF_DMA_CFG_PREFIX vsf_hw
57# else
58# define VSF_DMA_CFG_PREFIX vsf
59# endif
60#endif
61
71#ifndef VSF_DMA_CFG_FUNCTION_RENAME
72# define VSF_DMA_CFG_FUNCTION_RENAME ENABLED
73#endif
74
82#ifndef VSF_DMA_CFG_REIMPLEMENT_TYPE_CHANNEL_MODE
83# define VSF_DMA_CFG_REIMPLEMENT_TYPE_CHANNEL_MODE DISABLED
84#endif
85
93#ifndef VSF_DMA_CFG_REIMPLEMENT_TYPE_IRQ_MASK
94# define VSF_DMA_CFG_REIMPLEMENT_TYPE_IRQ_MASK DISABLED
95#endif
96
104#ifndef VSF_DMA_CFG_REIMPLEMENT_TYPE_ADDR
105# define VSF_DMA_CFG_REIMPLEMENT_TYPE_ADDR DISABLED
106#endif
107
115#ifndef VSF_DMA_CFG_REIMPLEMENT_TYPE_CHANNEL_HINT
116# define VSF_DMA_CFG_REIMPLEMENT_TYPE_CHANNEL_HINT DISABLED
117#endif
118
130#ifndef VSF_DMA_CFG_REIMPLEMENT_TYPE_CHANNEL_CFG
131# define VSF_DMA_CFG_REIMPLEMENT_TYPE_CHANNEL_CFG DISABLED
132#endif
133
141#ifndef VSF_DMA_CFG_REIMPLEMENT_TYPE_CHANNEL_SG_CFG
142# define VSF_DMA_CFG_REIMPLEMENT_TYPE_CHANNEL_SG_CFG \
143 DISABLED
144#endif
145
169#ifndef __VSF_DMA_CFG_SUPPORT_STANDARD_OPTIONAL
170# define __VSF_DMA_CFG_SUPPORT_STANDARD_OPTIONAL DISABLED
171#endif
172
182#ifndef VSF_DMA_CFG_REIMPLEMENT_TYPE_CFG
183# define VSF_DMA_CFG_REIMPLEMENT_TYPE_CFG DISABLED
184#endif
185
192#ifndef VSF_DMA_CFG_REIMPLEMENT_TYPE_CHANNEL_STATUS
193# define VSF_DMA_CFG_REIMPLEMENT_TYPE_CHANNEL_STATUS DISABLED
194#endif
195
205#ifndef VSF_DMA_CFG_REIMPLEMENT_TYPE_CTRL
206# define VSF_DMA_CFG_REIMPLEMENT_TYPE_CTRL DISABLED
207#endif
208
218#ifndef VSF_DMA_CFG_REIMPLEMENT_TYPE_CAPABILITY
219# define VSF_DMA_CFG_REIMPLEMENT_TYPE_CAPABILITY DISABLED
220#endif
221
229#ifndef VSF_DMA_CFG_INHERIT_HAL_CAPABILITY
230# define VSF_DMA_CFG_INHERIT_HAL_CAPABILITY ENABLED
231#endif
232
268#ifndef VSF_DMA_CHANNEL_SG_ARRAY
269# define VSF_DMA_CHANNEL_SG_ARRAY(__NAME, __COUNT, ...) \
270 vsf_dma_channel_sg_desc_t __NAME[__COUNT] = { \
271 __VA_ARGS__ \
272 };
273#endif
274
289#ifndef VSF_DMA_CHANNEL_SG_ITEM
290# define VSF_DMA_CHANNEL_SG_ITEM(__MODE, __SRC_ADDR, __DST_ADDR, __CNT, ...) \
291 { \
292 .mode = __MODE, \
293 .src_address = __SRC_ADDR, \
294 .dst_address = __DST_ADDR, \
295 .count = __CNT, \
296 __VA_ARGS__ \
297 }
298#endif
299
300/*============================ MACROFIED FUNCTIONS ===========================*/
301
311#define VSF_DMA_APIS(__prefix_name) \
312 __VSF_HAL_TEMPLATE_API(__prefix_name, vsf_err_t, dma, init, VSF_MCONNECT(__prefix_name, _t) *dma_ptr, vsf_dma_cfg_t *cfg_ptr) \
313 __VSF_HAL_TEMPLATE_API(__prefix_name, void, dma, fini, VSF_MCONNECT(__prefix_name, _t) *dma_ptr) \
314 __VSF_HAL_TEMPLATE_API(__prefix_name, vsf_err_t, dma, get_configuration, VSF_MCONNECT(__prefix_name, _t) *dma_ptr, vsf_dma_cfg_t *cfg_ptr) \
315 __VSF_HAL_TEMPLATE_API(__prefix_name, vsf_dma_capability_t, dma, capability, VSF_MCONNECT(__prefix_name, _t) *dma_ptr) \
316 __VSF_HAL_TEMPLATE_API(__prefix_name, vsf_err_t, dma, channel_acquire, VSF_MCONNECT(__prefix_name, _t) *dma_ptr, vsf_dma_channel_hint_t *channel_hint_ptr) \
317 __VSF_HAL_TEMPLATE_API(__prefix_name, void, dma, channel_release, VSF_MCONNECT(__prefix_name, _t) *dma_ptr, uint8_t channel) \
318 __VSF_HAL_TEMPLATE_API(__prefix_name, vsf_err_t, dma, channel_config, VSF_MCONNECT(__prefix_name, _t) *dma_ptr, uint8_t channel, vsf_dma_channel_cfg_t *cfg_ptr) \
319 __VSF_HAL_TEMPLATE_API(__prefix_name, vsf_err_t, dma, channel_get_configuration, VSF_MCONNECT(__prefix_name, _t) *dma_ptr, uint8_t channel, vsf_dma_channel_cfg_t *cfg_ptr) \
320 __VSF_HAL_TEMPLATE_API(__prefix_name, vsf_err_t, dma, channel_start, VSF_MCONNECT(__prefix_name, _t) *dma_ptr, uint8_t channel, vsf_dma_addr_t src_address, vsf_dma_addr_t dst_address, uint32_t count) \
321 __VSF_HAL_TEMPLATE_API(__prefix_name, vsf_err_t, dma, channel_cancel, VSF_MCONNECT(__prefix_name, _t) *dma_ptr, uint8_t channel) \
322 __VSF_HAL_TEMPLATE_API(__prefix_name, vsf_err_t, dma, channel_sg_config_desc, VSF_MCONNECT(__prefix_name, _t) *dma_ptr, uint8_t channel, vsf_dma_isr_t isr, vsf_dma_channel_sg_desc_t *scatter_gather_cfg, uint32_t sg_count) \
323 __VSF_HAL_TEMPLATE_API(__prefix_name, vsf_err_t, dma, channel_sg_start, VSF_MCONNECT(__prefix_name, _t) *dma_ptr, uint8_t channel) \
324 __VSF_HAL_TEMPLATE_API(__prefix_name, uint32_t, dma, channel_get_transferred_count, VSF_MCONNECT(__prefix_name, _t) *dma_ptr, uint8_t channel) \
325 __VSF_HAL_TEMPLATE_API(__prefix_name, vsf_dma_channel_status_t, dma, channel_status, VSF_MCONNECT(__prefix_name, _t) *dma_ptr, uint8_t channel) \
326 __VSF_HAL_TEMPLATE_API(__prefix_name, vsf_err_t, dma, ctrl, VSF_MCONNECT(__prefix_name, _t) *dma_ptr, vsf_dma_ctrl_t ctrl, void* param)
327
328/*============================ TYPES =========================================*/
329
339#if VSF_DMA_CFG_REIMPLEMENT_TYPE_ADDR == DISABLED
341#endif
342
343#if VSF_DMA_CFG_REIMPLEMENT_TYPE_CHANNEL_MODE == DISABLED
349
353
357
364
371
380
389
390 //prio
391 VSF_DMA_PRIORITY_LOW = (0x00 << 22),
393 VSF_DMA_PRIORITY_HIGH = (0x02 << 22),
395
397#endif
398
399enum {
405
410
415
423
431
441
451
457
467
468};
469
470#if VSF_DMA_CFG_REIMPLEMENT_TYPE_IRQ_MASK == DISABLED
471typedef enum vsf_dma_irq_mask_t {
472 VSF_DMA_IRQ_MASK_CPL = (0x1ul << 0),
476#endif
477
478enum {
483};
484
485
486#if VSF_DMA_CFG_REIMPLEMENT_TYPE_CFG == DISABLED
499typedef struct vsf_dma_cfg_t {
502#endif
503
504#if VSF_DMA_CFG_REIMPLEMENT_TYPE_CHANNEL_HINT == DISABLED
516typedef struct vsf_dma_channel_hint_t {
562#endif
563
564#if VSF_DMA_CFG_REIMPLEMENT_TYPE_CHANNEL_CFG == DISABLED
565typedef struct vsf_dma_t vsf_dma_t;
566
567typedef void vsf_dma_isr_handler_t(void *target_ptr, vsf_dma_t *dma_ptr, int8_t channel, vsf_dma_irq_mask_t irq_mask);
568
569typedef struct vsf_dma_isr_t {
571 void *target_ptr;
573
575
586typedef struct vsf_dma_channel_cfg_t {
648#endif
649
650/*============================ INITIALIZATION MACROS =========================*/
651
652// Helper macro for optional argument with default value
653#ifndef __VSF_DMA_GET_ARG_OR_DEFAULT
654# define __VSF_DMA_GET_ARG_OR_DEFAULT(__DEFAULT, __ARG, ...) (__ARG)
655#endif
656
704#ifndef VSF_DMA_CHANNEL_HINT_INIT
705# define VSF_DMA_CHANNEL_HINT_INIT(__CHANNEL, __REQUEST_LINE, ...) \
706 { \
707 .channel = (__CHANNEL), \
708 .request_line = (__REQUEST_LINE), \
709 .prio = __VSF_DMA_GET_ARG_OR_DEFAULT(,##__VA_ARGS__, vsf_arch_prio_invalid, vsf_arch_prio_invalid), \
710 }
711#endif
712
738#ifndef VSF_DMA_CHANNEL_CFG_INIT
739# define VSF_DMA_CHANNEL_CFG_INIT(__MODE, __ISR, __IRQ_MASK, __SRC_REQ_IDX, __DST_REQ_IDX, ...) \
740 { \
741 .mode = (__MODE), \
742 .isr = (__ISR), \
743 .irq_mask = (__IRQ_MASK), \
744 .prio = __VSF_DMA_GET_ARG_OR_DEFAULT(,##__VA_ARGS__, vsf_arch_prio_invalid, vsf_arch_prio_invalid), \
745 .src_request_idx = (__SRC_REQ_IDX), \
746 .dst_request_idx = (__DST_REQ_IDX), \
747 }
748#endif
749
750#if VSF_DMA_CFG_REIMPLEMENT_TYPE_CHANNEL_SG_CFG == DISABLED
764typedef struct vsf_dma_channel_sg_desc_t {
776#endif
777
778#if VSF_DMA_CFG_REIMPLEMENT_TYPE_CHANNEL_STATUS == DISABLED
779typedef struct vsf_dma_channel_status_t {
780 union {
782 struct {
783 uint32_t is_busy : 1;
784 };
785 };
787#endif
788
789#if VSF_DMA_CFG_REIMPLEMENT_TYPE_CTRL == DISABLED
818typedef enum vsf_dma_ctrl_t {
838#endif
839
840#if VSF_DMA_CFG_REIMPLEMENT_TYPE_CAPABILITY == DISABLED
852typedef struct vsf_dma_capability_t {
853#if VSF_DMA_CFG_INHERIT_HAL_CAPABILITY == ENABLED
855#endif
856
858
860
870
888
891
894#endif
895
896typedef struct vsf_dma_op_t {
898#undef __VSF_HAL_TEMPLATE_API
899#define __VSF_HAL_TEMPLATE_API VSF_HAL_TEMPLATE_API_FP
901
902 VSF_DMA_APIS(vsf_dma)
904
905#if VSF_DMA_CFG_MULTI_CLASS == ENABLED
906struct vsf_dma_t {
908};
909#endif
910
911/*============================ PROTOTYPES ====================================*/
912
932extern vsf_err_t vsf_dma_init(vsf_dma_t *dma_ptr, vsf_dma_cfg_t *cfg_ptr);
933
945extern void vsf_dma_fini(vsf_dma_t *dma_ptr);
946
961
974
992extern vsf_err_t vsf_dma_channel_acquire(vsf_dma_t *dma_ptr, vsf_dma_channel_hint_t *channel_hint_ptr);
993
994#if __VSF_DMA_CFG_SUPPORT_STANDARD_OPTIONAL
1014extern vsf_dma_t *vsf_dma_channel_acquire_from_all(vsf_dma_channel_hint_t *channel_hint_ptr);
1015#endif
1016
1030extern void vsf_dma_channel_release(vsf_dma_t *dma_ptr, uint8_t channel);
1031
1088extern vsf_err_t vsf_dma_channel_config(vsf_dma_t *dma_ptr, uint8_t channel, vsf_dma_channel_cfg_t *cfg_ptr);
1089
1106
1143extern vsf_err_t vsf_dma_channel_start(vsf_dma_t *dma_ptr, uint8_t channel, vsf_dma_addr_t src_address, vsf_dma_addr_t dst_address, uint32_t count);
1144
1158extern vsf_err_t vsf_dma_channel_cancel(vsf_dma_t *dma_ptr, uint8_t channel);
1159
1205 vsf_dma_channel_sg_desc_t *sg_desc_ptr, uint32_t sg_count);
1206
1241extern vsf_err_t vsf_dma_channel_sg_start(vsf_dma_t *dma_ptr, uint8_t channel);
1242
1286
1301
1324extern vsf_err_t vsf_dma_ctrl(vsf_dma_t *dma_ptr, vsf_dma_ctrl_t ctrl, void * param);
1325
1327// \~english
1328// @brief Acquire a DMA channel from all available DMA instances
1329// @param[in,out] channel_hint_ptr: a pointer to DMA channel hint. User should provide appropriate hint information based on actual requirements. If the actually allocated channel or other configuration differs from user's expectation, the function may modify channel_hint_ptr to notify the user of the actual allocation. The allocated channel number will be stored in channel_hint_ptr->channel.
1330// @return vsf_dma_t *: pointer to the DMA instance that successfully allocated the channel, or NULL if allocation failed
1331// @note Prerequisites: All DMA instances must be homogeneous (isomorphic). Peripherals can acquire channels from any DMA instance, and channels acquired from any DMA instance can be assigned to any peripheral. This function iterates through all available DMA instances and attempts to acquire a channel from each one. It returns the first DMA instance that successfully allocates a channel.
1332// @note The VSF_PREFIX prefix of this can be replaced with the actual prefix, e.g. vsf_hw
1333//
1334// \~chinese
1335// @brief 从所有可用的 DMA 实例中获取一个 DMA 通道
1336// @param[in,out] channel_hint_ptr: 指向 DMA 通道提示的指针。用户应根据实际情况提供合适的提示信息。如果实际分配的通道或其他配置与用户预期不一致,函数可能会修改 channel_hint_ptr 来通知用户实际分配的结果。分配的通道号将存储在 channel_hint_ptr->channel 中。
1337// @return vsf_dma_t *: 成功分配通道的 DMA 实例指针,如果分配失败则返回 NULL
1338// @note 前提条件:所有 DMA 实例必须是同构的(功能相同)。外设可以从任意一个 DMA 实例申请通道,并且从任意一个 DMA 实例获取的通道都可以分配给任意一个外设使用。此函数遍历所有可用的 DMA 实例,并尝试从每个实例中获取通道。它返回第一个成功分配通道的 DMA 实例。
1339// @note VSF_PREFIX 前缀可以替换成实际的前缀,例如 vsf_hw
1340// */
1341//extern vsf_dma_t * VSF_PREFIX_dma_channel_acquire_from_all(vsf_dma_channel_hint_t *channel_hint_ptr);
1342//
1343
1344/*============================ MACROFIED FUNCTIONS ===========================*/
1345
1347#if VSF_DMA_CFG_FUNCTION_RENAME == ENABLED
1348# define __vsf_dma_t VSF_MCONNECT(VSF_DMA_CFG_PREFIX, _dma_t)
1349# define vsf_dma_init(__DMA, ...) VSF_MCONNECT(VSF_DMA_CFG_PREFIX, _dma_init)((__vsf_dma_t *)(__DMA), ##__VA_ARGS__)
1350# define vsf_dma_fini(__DMA) VSF_MCONNECT(VSF_DMA_CFG_PREFIX, _dma_fini)((__vsf_dma_t *)(__DMA))
1351# define vsf_dma_get_configuration(__DMA, ...) VSF_MCONNECT(VSF_DMA_CFG_PREFIX, _dma_get_configuration)((__vsf_dma_t *)(__DMA), ##__VA_ARGS__)
1352# define vsf_dma_capability(__DMA) VSF_MCONNECT(VSF_DMA_CFG_PREFIX, _dma_capability)((__vsf_dma_t *)(__DMA))
1353# define vsf_dma_channel_acquire(__DMA, ...) VSF_MCONNECT(VSF_DMA_CFG_PREFIX, _dma_channel_acquire)((__vsf_dma_t *)(__DMA), ##__VA_ARGS__)
1354# define vsf_dma_channel_release(__DMA, ...) VSF_MCONNECT(VSF_DMA_CFG_PREFIX, _dma_channel_release)((__vsf_dma_t *)(__DMA), ##__VA_ARGS__)
1355# define vsf_dma_channel_config(__DMA, ...) VSF_MCONNECT(VSF_DMA_CFG_PREFIX, _dma_channel_config)((__vsf_dma_t *)(__DMA), ##__VA_ARGS__)
1356# define vsf_dma_channel_get_configuration(__DMA, ...) VSF_MCONNECT(VSF_DMA_CFG_PREFIX, _dma_channel_get_configuration)((__vsf_dma_t *)(__DMA), ##__VA_ARGS__)
1357# define vsf_dma_channel_start(__DMA, ...) VSF_MCONNECT(VSF_DMA_CFG_PREFIX, _dma_channel_start)((__vsf_dma_t *)(__DMA), ##__VA_ARGS__)
1358# define vsf_dma_channel_sg_config_desc(__DMA, ...) VSF_MCONNECT(VSF_DMA_CFG_PREFIX, _dma_channel_sg_config_desc)((__vsf_dma_t *)(__DMA), ##__VA_ARGS__)
1359# define vsf_dma_channel_sg_start(__DMA, ...) VSF_MCONNECT(VSF_DMA_CFG_PREFIX, _dma_channel_sg_start)((__vsf_dma_t *)(__DMA), ##__VA_ARGS__)
1360# define vsf_dma_channel_cancel(__DMA, ...) VSF_MCONNECT(VSF_DMA_CFG_PREFIX, _dma_channel_cancel)((__vsf_dma_t *)(__DMA), ##__VA_ARGS__)
1361# define vsf_dma_channel_get_transferred_count(__DMA, ...) VSF_MCONNECT(VSF_DMA_CFG_PREFIX, _dma_channel_get_transferred_count)((__vsf_dma_t *)(__DMA), ##__VA_ARGS__)
1362# define vsf_dma_channel_status(__DMA, ...) VSF_MCONNECT(VSF_DMA_CFG_PREFIX, _dma_channel_status)((__vsf_dma_t *)(__DMA), ##__VA_ARGS__)
1363# define vsf_dma_ctrl(__DMA, ...) VSF_MCONNECT(VSF_DMA_CFG_PREFIX, _dma_ctrl)((__vsf_dma_t *)(__DMA), ##__VA_ARGS__)
1364#endif
1366
1367#ifdef __cplusplus
1368}
1369#endif
1370
1371#endif /*__VSF_TEMPLATE_DMA_H__*/
vsf_err_t
Definition __type.h:42
vsf_dma_channel_mode_t
Definition dma.h:86
vsf_dma_irq_mask_t
Definition dma.h:186
uintptr_t vsf_dma_addr_t
Definition dma.h:82
vsf_arch_prio_t
Definition cortex_a_generic.h:88
const i_spi_t vsf_spi_irq_mask_t irq_mask
Definition spi_interface.h:38
uint32_t uintptr_t
Definition stdint.h:38
unsigned uint32_t
Definition stdint.h:9
unsigned char uint8_t
Definition stdint.h:5
signed char int8_t
Definition stdint.h:4
DMA capability structure that can be reimplemented in specific HAL drivers.
Definition dma.h:255
uint8_t addr_alignment
Address alignment requirement in bytes (1 means no alignment required)
Definition dma.h:264
vsf_dma_channel_mode_t supported_modes
Definition dma.h:262
uint8_t channel_count
Number of DMA channels.
Definition dma.h:260
uint8_t support_scatter_gather
Support scatter-gather transfer.
Definition dma.h:265
uint8_t irq_count
Definition dma.h:261
uint32_t max_transfer_count
Maximum number of data items per transfer (0 means no limit)
Definition dma.h:263
inherit(vsf_peripheral_capability_t) vsf_dma_irq_mask_t irq_mask
Supported interrupt mask bits.
Configuration structure for DMA.
Definition dma.h:249
vsf_arch_prio_t prio
Default interrupt priority for DMA channels.
Definition dma.h:250
dma configuration
Definition dma.h:211
uint8_t dst_request_idx
Definition dma.h:217
vsf_dma_channel_mode_t mode
Definition dma.h:212
vsf_dma_irq_mask_t irq_mask
Definition dma.h:214
uint8_t src_request_idx
Definition dma.h:216
vsf_dma_isr_t isr
Definition dma.h:213
vsf_arch_prio_t prio
Definition dma.h:215
DMA channel hint structure for channel allocation.
Definition dma.h:197
int8_t channel
Definition dma.h:198
uint8_t request_line
Definition dma.h:199
vsf_arch_prio_t prio
Definition dma.h:200
DMA scatter-gather descriptor structure.
Definition dma.h:239
uint32_t count
Definition dma.h:243
vsf_dma_addr_t src_address
Source address.
Definition dma.h:241
vsf_dma_addr_t next
Definition dma.h:244
vsf_dma_channel_mode_t mode
DMA channel mode.
Definition dma.h:240
vsf_dma_addr_t dst_address
Destination address.
Definition dma.h:242
Definition dma.h:228
Definition dma.h:207
vsf_dma_isr_handler_t * handler_fn
Definition dma.h:208
void * target_ptr
Definition dma.h:209
Definition vsf_template_dma.h:896
Definition vsf_template_dma.h:906
const vsf_dma_op_t * op
Definition vsf_template_dma.h:907
Definition vsf_template_hal_driver.h:204
Definition vsf_template_hal_driver.h:197
vsf_adc_isr_t isr
Definition adc.h:113
vsf_dma_channel_mode_t
Definition dma.h:129
void vsf_dma_isr_handler_t(void *target_ptr, vsf_dma_t *dma_ptr, int8_t channel, vsf_dma_irq_mask_t irq_mask)
Definition dma.h:202
vsf_dma_irq_mask_t
Definition dma.h:183
vsf_dma_ctrl_t
Predefined VSF DMA control commands that can be reimplemented in specific HAL drivers.
Definition vsf_template_dma.h:818
@ __VSF_DMA_CTRL_DUMMY
Dummy value for compilation, required when no actual control commands are defined.
Definition vsf_template_dma.h:836
vsf_dma_channel_mode_t
Definition vsf_template_dma.h:344
@ VSF_DMA_PRIORITY_MEDIUM
Definition vsf_template_dma.h:392
@ VSF_DMA_DST_WIDTH_BYTES_32
Definition vsf_template_dma.h:370
@ VSF_DMA_SRC_BURST_LENGTH_64
Definition vsf_template_dma.h:378
@ VSF_DMA_DST_BURST_LENGTH_64
Definition vsf_template_dma.h:387
@ VSF_DMA_SRC_WIDTH_BYTES_8
Definition vsf_template_dma.h:361
@ VSF_DMA_SRC_WIDTH_BYTES_2
Definition vsf_template_dma.h:359
@ VSF_DMA_DST_WIDTH_BYTES_16
Definition vsf_template_dma.h:369
@ VSF_DMA_SRC_BURST_LENGTH_16
Definition vsf_template_dma.h:376
@ VSF_DMA_DST_BURST_LENGTH_128
Definition vsf_template_dma.h:388
@ VSF_DMA_DST_WIDTH_BYTE_1
Definition vsf_template_dma.h:365
@ VSF_DMA_PRIORITY_HIGH
Definition vsf_template_dma.h:393
@ VSF_DMA_SRC_WIDTH_BYTES_16
Definition vsf_template_dma.h:362
@ VSF_DMA_DST_ADDR_NO_CHANGE
Definition vsf_template_dma.h:356
@ VSF_DMA_DST_BURST_LENGTH_4
Definition vsf_template_dma.h:383
@ VSF_DMA_DST_BURST_LENGTH_1
Definition vsf_template_dma.h:381
@ VSF_DMA_SRC_ADDR_INCREMENT
Definition vsf_template_dma.h:350
@ VSF_DMA_MEMORY_TO_PERIPHERAL
Definition vsf_template_dma.h:346
@ VSF_DMA_DST_BURST_LENGTH_32
Definition vsf_template_dma.h:386
@ VSF_DMA_SRC_BURST_LENGTH_4
Definition vsf_template_dma.h:374
@ VSF_DMA_SRC_BURST_LENGTH_128
Definition vsf_template_dma.h:379
@ VSF_DMA_SRC_WIDTH_BYTE_1
Definition vsf_template_dma.h:358
@ VSF_DMA_MEMORY_TO_MEMORY
Definition vsf_template_dma.h:345
@ VSF_DMA_PRIORITY_LOW
Definition vsf_template_dma.h:391
@ VSF_DMA_SRC_WIDTH_BYTES_4
Definition vsf_template_dma.h:360
@ VSF_DMA_DST_WIDTH_BYTES_8
Definition vsf_template_dma.h:368
@ VSF_DMA_SRC_BURST_LENGTH_1
Definition vsf_template_dma.h:372
@ VSF_DMA_DST_WIDTH_BYTES_2
Definition vsf_template_dma.h:366
@ VSF_DMA_DST_WIDTH_BYTES_4
Definition vsf_template_dma.h:367
@ VSF_DMA_SRC_BURST_LENGTH_2
Definition vsf_template_dma.h:373
@ VSF_DMA_SRC_ADDR_DECREMENT
Definition vsf_template_dma.h:351
@ VSF_DMA_DST_BURST_LENGTH_8
Definition vsf_template_dma.h:384
@ VSF_DMA_SRC_ADDR_NO_CHANGE
Definition vsf_template_dma.h:352
@ VSF_DMA_DST_BURST_LENGTH_16
Definition vsf_template_dma.h:385
@ VSF_DMA_SRC_BURST_LENGTH_8
Definition vsf_template_dma.h:375
@ VSF_DMA_DST_BURST_LENGTH_2
Definition vsf_template_dma.h:382
@ VSF_DMA_SRC_WIDTH_BYTES_32
Definition vsf_template_dma.h:363
@ VSF_DMA_PRIORITY_VERY_HIGH
Definition vsf_template_dma.h:394
@ VSF_DMA_SRC_BURST_LENGTH_32
Definition vsf_template_dma.h:377
@ VSF_DMA_DST_ADDR_DECREMENT
Definition vsf_template_dma.h:355
@ VSF_DMA_PERIPHERAL_TO_PERIPHERAL
Definition vsf_template_dma.h:348
@ VSF_DMA_PERIPHERAL_TO_MEMORY
Definition vsf_template_dma.h:347
@ VSF_DMA_DST_ADDR_INCREMENT
Definition vsf_template_dma.h:354
struct vsf_dma_isr_t vsf_dma_isr_t
@ VSF_DMA_PRIORITY_MASK
Definition vsf_template_dma.h:453
@ VSF_DMA_DST_WIDTH_MASK
Definition vsf_template_dma.h:425
@ VSF_DMA_SRC_WIDTH_MASK
Definition vsf_template_dma.h:417
@ VSF_DMA_MODE_ALL_BITS_MASK
Definition vsf_template_dma.h:459
@ VSF_DMA_DST_ADDR_MASK
Definition vsf_template_dma.h:412
@ VSF_DMA_SRC_BURST_MASK
Definition vsf_template_dma.h:433
@ VSF_DMA_DST_ADDR_COUNT
Definition vsf_template_dma.h:411
@ VSF_DMA_DIRECTION_COUNT
Definition vsf_template_dma.h:400
@ VSF_DMA_PRIORITY_COUNT
Definition vsf_template_dma.h:452
@ VSF_DMA_DST_BURST_COUNT
Definition vsf_template_dma.h:442
@ VSF_DMA_SRC_BURST_COUNT
Definition vsf_template_dma.h:432
@ VSF_DMA_SRC_ADDR_COUNT
Definition vsf_template_dma.h:406
@ VSF_DMA_SRC_ADDR_MASK
Definition vsf_template_dma.h:407
@ VSF_DMA_DST_WIDTH_COUNT
Definition vsf_template_dma.h:424
@ VSF_DMA_DIRECTION_MASK
Definition vsf_template_dma.h:401
@ VSF_DMA_SRC_WIDTH_COUNT
Definition vsf_template_dma.h:416
@ VSF_DMA_MODE_MASK_COUNT
Definition vsf_template_dma.h:458
@ VSF_DMA_DST_BURST_MASK
Definition vsf_template_dma.h:443
vsf_err_t vsf_dma_channel_start(vsf_dma_t *dma_ptr, uint8_t channel, vsf_dma_addr_t src_address, vsf_dma_addr_t dst_address, uint32_t count)
Start a DMA channel transfer.
Definition dma_common.c:115
vsf_err_t vsf_dma_channel_sg_start(vsf_dma_t *dma_ptr, uint8_t channel)
Start a DMA scatter-gather transfer.
Definition dma_common.c:138
void vsf_dma_isr_handler_t(void *target_ptr, vsf_dma_t *dma_ptr, int8_t channel, vsf_dma_irq_mask_t irq_mask)
Definition vsf_template_dma.h:567
@ VSF_DMA_IRQ_COUNT
Definition vsf_template_dma.h:479
@ VSF_DMA_IRQ_ALL_BITS_MASK
Definition vsf_template_dma.h:480
struct vsf_dma_capability_t vsf_dma_capability_t
DMA capability structure that can be reimplemented in specific HAL drivers.
struct vsf_dma_channel_status_t vsf_dma_channel_status_t
vsf_err_t vsf_dma_channel_acquire(vsf_dma_t *dma_ptr, vsf_dma_channel_hint_t *channel_hint_ptr)
DMA acquire a new channel.
Definition dma_common.c:75
vsf_err_t vsf_dma_get_configuration(vsf_dma_t *dma_ptr, vsf_dma_cfg_t *cfg_ptr)
Get the current configuration of DMA instance.
Definition dma_common.c:56
vsf_err_t vsf_dma_channel_get_configuration(vsf_dma_t *dma_ptr, uint8_t channel, vsf_dma_channel_cfg_t *cfg_ptr)
Get the current configuration of a DMA channel.
Definition dma_common.c:104
void vsf_dma_channel_release(vsf_dma_t *dma_ptr, uint8_t channel)
Release a DMA channel.
Definition dma_common.c:85
struct vsf_dma_channel_sg_desc_t vsf_dma_channel_sg_desc_t
DMA scatter-gather descriptor structure.
vsf_err_t vsf_dma_init(vsf_dma_t *dma_ptr, vsf_dma_cfg_t *cfg_ptr)
Initialize a DMA instance.
Definition dma_common.c:38
vsf_err_t vsf_dma_channel_sg_config_desc(vsf_dma_t *dma_ptr, uint8_t channel, vsf_dma_isr_t isr, vsf_dma_channel_sg_desc_t *sg_desc_ptr, uint32_t sg_count)
Configure a DMA channel for scatter-gather transfer.
Definition dma_common.c:127
vsf_err_t vsf_dma_channel_cancel(vsf_dma_t *dma_ptr, uint8_t channel)
Cancel the transmission of a specific DMA channel.
Definition dma_common.c:147
void vsf_dma_fini(vsf_dma_t *dma_ptr)
Finalize a DMA instance.
Definition dma_common.c:47
vsf_err_t vsf_dma_channel_config(vsf_dma_t *dma_ptr, uint8_t channel, vsf_dma_channel_cfg_t *cfg_ptr)
Configure a DMA channel.
Definition dma_common.c:94
vsf_dma_irq_mask_t
Definition vsf_template_dma.h:471
@ VSF_DMA_IRQ_MASK_HALF_CPL
Definition vsf_template_dma.h:473
@ VSF_DMA_IRQ_MASK_CPL
Definition vsf_template_dma.h:472
@ VSF_DMA_IRQ_MASK_ERROR
Definition vsf_template_dma.h:474
uintptr_t vsf_dma_addr_t
DMA address type, used for source address, destination address and scatter-gather descriptor address.
Definition vsf_template_dma.h:340
vsf_dma_channel_status_t vsf_dma_channel_status(vsf_dma_t *dma_ptr, uint8_t channel)
Get status of a DMA channel.
Definition dma_common.c:165
struct vsf_dma_channel_cfg_t vsf_dma_channel_cfg_t
dma configuration
vsf_dma_capability_t vsf_dma_capability(vsf_dma_t *dma_ptr)
Get the capabilities of DMA instance.
Definition dma_common.c:66
struct vsf_dma_channel_hint_t vsf_dma_channel_hint_t
DMA channel hint structure for channel allocation.
uint32_t vsf_dma_channel_get_transferred_count(vsf_dma_t *dma_ptr, uint8_t channel)
Get the count of data items transferred for a specific DMA channel.
Definition dma_common.c:156
struct vsf_dma_cfg_t vsf_dma_cfg_t
Configuration structure for DMA.
vsf_err_t vsf_dma_ctrl(vsf_dma_t *dma_ptr, vsf_dma_ctrl_t ctrl, void *param)
Execute a control command on a DMA instance.
Definition dma_common.c:174
#define VSF_DMA_APIS(__prefix_name)
DMA API template, used to generate DMA type, specific prefix function declarations,...
Definition vsf_template_dma.h:311
Generated from commit: vsfteam/vsf@b2e9e8a