NEORV32 Software Framework Documentation
The NEORV32 RISC-V Processor
Loading...
Searching...
No Matches
neorv32_dma.h
Go to the documentation of this file.
1// ================================================================================ //
2// The NEORV32 RISC-V Processor - https://github.com/stnolting/neorv32 //
3// Copyright (c) NEORV32 contributors. //
4// Copyright (c) 2020 - 2024 Stephan Nolting. All rights reserved. //
5// Licensed under the BSD-3-Clause license, see LICENSE for details. //
6// SPDX-License-Identifier: BSD-3-Clause //
7// ================================================================================ //
8
18#ifndef neorv32_dma_h
19#define neorv32_dma_h
20
21#include <stdint.h>
22
23
24/**********************************************************************/
29typedef volatile struct __attribute__((packed,aligned(4))) {
30 uint32_t CTRL;
31 uint32_t SRC_BASE;
32 uint32_t DST_BASE;
33 uint32_t TTYPE;
35
37#define NEORV32_DMA ((neorv32_dma_t*) (NEORV32_DMA_BASE))
38
54
69/**********************************************************************/
73#define DMA_CMD_B2B (0b00 << DMA_TTYPE_QSEL_LSB) // byte to byte
74#define DMA_CMD_B2UW (0b01 << DMA_TTYPE_QSEL_LSB) // byte to unsigned word
75#define DMA_CMD_B2SW (0b10 << DMA_TTYPE_QSEL_LSB) // byte to signed word
76#define DMA_CMD_W2W (0b11 << DMA_TTYPE_QSEL_LSB) // word to word
77
78#define DMA_CMD_SRC_CONST (0b0 << DMA_TTYPE_SRC_INC) // constant source address
79#define DMA_CMD_SRC_INC (0b1 << DMA_TTYPE_SRC_INC) // incrementing source address
80
81#define DMA_CMD_DST_CONST (0b0 << DMA_TTYPE_DST_INC) // constant destination address
82#define DMA_CMD_DST_INC (0b1 << DMA_TTYPE_DST_INC) // incrementing destination address
83
84#define DMA_CMD_ENDIAN (0b1 << DMA_TTYPE_ENDIAN) // convert endianness
88/**********************************************************************/
97
98
99/**********************************************************************/
103int neorv32_dma_available(void);
104void neorv32_dma_enable(void);
105void neorv32_dma_disable(void);
106void neorv32_dma_fence_enable(void);
108void neorv32_dma_transfer(uint32_t base_src, uint32_t base_dst, uint32_t num, uint32_t config);
109void neorv32_dma_transfer_auto(uint32_t base_src, uint32_t base_dst, uint32_t num, uint32_t config, int firq_sel, int firq_type);
110int neorv32_dma_status(void);
111int neorv32_dma_done(void);
115#endif // neorv32_dma_h
NEORV32_DMA_STATUS_enum
Definition neorv32_dma.h:91
@ DMA_STATUS_ERR_WR
Definition neorv32_dma.h:92
@ DMA_STATUS_IDLE
Definition neorv32_dma.h:94
@ DMA_STATUS_BUSY
Definition neorv32_dma.h:95
@ DMA_STATUS_ERR_RD
Definition neorv32_dma.h:93
int neorv32_dma_available(void)
Definition neorv32_dma.c:26
void neorv32_dma_fence_enable(void)
Definition neorv32_dma.c:59
void neorv32_dma_transfer(uint32_t base_src, uint32_t base_dst, uint32_t num, uint32_t config)
Definition neorv32_dma.c:82
NEORV32_DMA_TTYPE_enum
Definition neorv32_dma.h:56
@ DMA_TTYPE_ENDIAN
Definition neorv32_dma.h:64
@ DMA_TTYPE_QSEL_MSB
Definition neorv32_dma.h:61
@ DMA_TTYPE_SRC_INC
Definition neorv32_dma.h:62
@ DMA_TTYPE_NUM_MSB
Definition neorv32_dma.h:58
@ DMA_TTYPE_NUM_LSB
Definition neorv32_dma.h:57
@ DMA_TTYPE_DST_INC
Definition neorv32_dma.h:63
@ DMA_TTYPE_QSEL_LSB
Definition neorv32_dma.h:60
NEORV32_DMA_CTRL_enum
Definition neorv32_dma.h:40
@ DMA_CTRL_DONE
Definition neorv32_dma.h:48
@ DMA_CTRL_FIRQ_SEL_MSB
Definition neorv32_dma.h:52
@ DMA_CTRL_ERROR_RD
Definition neorv32_dma.h:45
@ DMA_CTRL_AUTO
Definition neorv32_dma.h:42
@ DMA_CTRL_EN
Definition neorv32_dma.h:41
@ DMA_CTRL_BUSY
Definition neorv32_dma.h:47
@ DMA_CTRL_FIRQ_SEL_LSB
Definition neorv32_dma.h:51
@ DMA_CTRL_FENCE
Definition neorv32_dma.h:43
@ DMA_CTRL_FIRQ_TYPE
Definition neorv32_dma.h:50
@ DMA_CTRL_ERROR_WR
Definition neorv32_dma.h:46
void neorv32_dma_disable(void)
Definition neorv32_dma.c:49
void neorv32_dma_transfer_auto(uint32_t base_src, uint32_t base_dst, uint32_t num, uint32_t config, int firq_sel, int firq_type)
Definition neorv32_dma.c:101
void neorv32_dma_fence_disable(void)
Definition neorv32_dma.c:68
int neorv32_dma_status(void)
Definition neorv32_dma.c:121
void neorv32_dma_enable(void)
Definition neorv32_dma.c:40
int neorv32_dma_done(void)
Definition neorv32_dma.c:146
Definition neorv32_dma.h:29
uint32_t SRC_BASE
Definition neorv32_dma.h:31
uint32_t TTYPE
Definition neorv32_dma.h:33
uint32_t CTRL
Definition neorv32_dma.h:30
uint32_t DST_BASE
Definition neorv32_dma.h:32