libdragon
Loading...
Searching...
No Matches
dma.h
Go to the documentation of this file.
1
8#ifndef __LIBDRAGON_DMA_H
9#define __LIBDRAGON_DMA_H
10
11#include <stdbool.h>
12#include <stdint.h>
13
35#ifdef __cplusplus
36extern "C" {
37#endif
38
39#define PI_DRAM_ADDR ((volatile uint32_t*)0xA4600000)
40#define PI_CART_ADDR ((volatile uint32_t*)0xA4600004)
41#define PI_RD_LEN ((volatile uint32_t*)0xA4600008)
42#define PI_WR_LEN ((volatile uint32_t*)0xA460000C)
43#define PI_STATUS ((volatile uint32_t*)0xA4600010)
44
63void dma_write_raw_async(const void *ram_address, unsigned long pi_address, unsigned long len);
64
83void dma_write(const void * ram_address, unsigned long pi_address, unsigned long len);
84
85
106void dma_read_raw_async(void *ram_address, unsigned long pi_address, unsigned long len);
107
135void dma_read_async(void *ram_pointer, unsigned long pi_address, unsigned long len);
136
155void dma_read(void * ram_address, unsigned long pi_address, unsigned long len);
156
157
161void dma_wait(void);
162
163
177uint32_t io_read(uint32_t pi_address);
178
196void io_write(uint32_t pi_address, uint32_t data);
197
224bool io_accessible(uint32_t pi_address);
225
226__attribute__((deprecated("use dma_wait instead")))
227volatile int dma_busy(void);
228
229
230#ifdef __cplusplus
231}
232#endif
233
/* dma */
235
236#endif
void dma_read_async(void *ram_pointer, unsigned long pi_address, unsigned long len)
Start reading data from a peripheral through PI DMA.
Definition dma.c:150
void dma_write(const void *ram_address, unsigned long pi_address, unsigned long len)
Write to a peripheral.
Definition dma.c:225
void dma_write_raw_async(const void *ram_address, unsigned long pi_address, unsigned long len)
Start writing data to a peripheral through PI DMA (low-level)
Definition dma.c:86
uint32_t io_read(uint32_t pi_address)
Read a 32 bit integer from a peripheral using the CPU.
Definition dma.c:232
void dma_read(void *ram_address, unsigned long pi_address, unsigned long len)
Read data from a peripheral through PI DMA, waiting for completion.
Definition dma.c:218
bool io_accessible(uint32_t pi_address)
Check whether the specified PI address can be accessed doing I/O from CPU.
Definition dma.c:36
void dma_wait(void)
Wait until an async DMA or I/O transfer is finished.
Definition dma.c:212
volatile int dma_busy(void)
Return whether the DMA controller is currently busy.
Definition dma.c:63
void io_write(uint32_t pi_address, uint32_t data)
Write a 32 bit integer to a peripheral using the CPU.
Definition dma.c:243
void dma_read_raw_async(void *ram_address, unsigned long pi_address, unsigned long len)
Start reading data from a peripheral through PI DMA (low-level)
Definition dma.c:68