libdragon
Loading...
Searching...
No Matches
dma.h
Go to the documentation of this file.
1
6#ifndef __LIBDRAGON_DMA_H
7#define __LIBDRAGON_DMA_H
8
9#include <stdbool.h>
10#include <stdint.h>
11
33#ifdef __cplusplus
34extern "C" {
35#endif
36
37#define PI_DRAM_ADDR ((volatile uint32_t*)0xA4600000)
38#define PI_CART_ADDR ((volatile uint32_t*)0xA4600004)
39#define PI_RD_LEN ((volatile uint32_t*)0xA4600008)
40#define PI_WR_LEN ((volatile uint32_t*)0xA460000C)
41#define PI_STATUS ((volatile uint32_t*)0xA4600010)
42
61void dma_write_raw_async(const void *ram_address, unsigned long pi_address, unsigned long len);
62
81void dma_write(const void * ram_address, unsigned long pi_address, unsigned long len);
82
83
104void dma_read_raw_async(void *ram_address, unsigned long pi_address, unsigned long len);
105
133void dma_read_async(void *ram_address, unsigned long pi_address, unsigned long len);
134
153void dma_read(void * ram_address, unsigned long pi_address, unsigned long len);
154
155
159void dma_wait(void);
160
161
175uint32_t io_read(uint32_t pi_address);
176
194void io_write(uint32_t pi_address, uint32_t data);
195
222bool io_accessible(uint32_t pi_address);
223
224__attribute__((deprecated("use dma_wait instead")))
225volatile int dma_busy(void);
226
227
228#ifdef __cplusplus
229}
230#endif
231
/* dma */
233
234#endif
void dma_write(const void *ram_address, unsigned long pi_address, unsigned long len)
Write to a peripheral.
Definition dma.c:223
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:84
uint32_t io_read(uint32_t pi_address)
Read a 32 bit integer from a peripheral using the CPU.
Definition dma.c:230
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:216
bool io_accessible(uint32_t pi_address)
Check whether the specified PI address can be accessed doing I/O from CPU.
Definition dma.c:34
void dma_read_async(void *ram_address, unsigned long pi_address, unsigned long len)
Start reading data from a peripheral through PI DMA.
Definition dma.c:148
void dma_wait(void)
Wait until an async DMA or I/O transfer is finished.
Definition dma.c:210
volatile int dma_busy(void)
Return whether the DMA controller is currently busy.
Definition dma.c:61
void io_write(uint32_t pi_address, uint32_t data)
Write a 32 bit integer to a peripheral using the CPU.
Definition dma.c:241
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:66