libdragon
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
11#ifdef __cplusplus
12extern "C" {
13#endif
14
15#define PI_DRAM_ADDR ((volatile uint32_t*)0xA4600000)
16#define PI_CART_ADDR ((volatile uint32_t*)0xA4600004)
17#define PI_RD_LEN ((volatile uint32_t*)0xA4600008)
18#define PI_WR_LEN ((volatile uint32_t*)0xA460000C)
19#define PI_STATUS ((volatile uint32_t*)0xA4600010)
20
21void dma_write_raw_async(const void *ram_address, unsigned long pi_address, unsigned long len);
22void dma_write(const void * ram_address, unsigned long pi_address, unsigned long len);
23
24void dma_read_raw_async(void *ram_address, unsigned long pi_address, unsigned long len);
25void dma_read_async(void *ram_address, unsigned long pi_address, unsigned long len);
26void dma_read(void * ram_address, unsigned long pi_address, unsigned long len);
27
28void dma_wait(void);
29
30/* 32 bit IO read from PI device */
31uint32_t io_read(uint32_t pi_address);
32
33/* 32 bit IO write to PI device */
34void io_write(uint32_t pi_address, uint32_t data);
35
36bool io_accessible(uint32_t pi_address);
37
38__attribute__((deprecated("use dma_wait instead")))
39volatile int dma_busy(void);
40
41
42#ifdef __cplusplus
43}
44#endif
45
46#endif
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:281
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:168
uint32_t io_read(uint32_t pi_address)
Read a 32 bit integer from a peripheral using the CPU.
Definition: dma.c:435
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:390
bool io_accessible(uint32_t pi_address)
Check whether the specified PI address can be accessed doing I/O from CPU.
Definition: dma.c:80
void dma_write(const void *ram_address, unsigned long pi_address, unsigned long len)
Write to a peripheral.
Definition: dma.c:415
void dma_wait(void)
Wait until an async DMA or I/O transfer is finished.
Definition: dma.c:366
volatile int dma_busy(void)
Return whether the DMA controller is currently busy.
Definition: dma.c:107
void io_write(uint32_t pi_address, uint32_t data)
Write a 32 bit integer to a peripheral using the CPU.
Definition: dma.c:463
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:132