Alchemy
Loading...
Searching...
No Matches

ramcode.h

Go to the documentation of this file.
1#ifndef GUARD_RAMCODE_H
2#define GUARD_RAMCODE_H
3
4/// @file
5/// Copying ARM routines to RAM to run them there.
6
7#include "dma.h"
8#include "io_reg.h"
9#include "mem.h"
10#include "types.h"
11
12// Copies an ARM routine to RAM for execution. bytes is its linker-defined size.
13
14/// Allocates a heap copy; release it with MemFree when finished.
15#define RamCode_Load(to, code, bytes) \
16 do { \
17 u32 size_; \
18 \
19 size_ = (u32)(bytes); \
20 \
21 (to) = MemAlloc(size_); \
22 Dma_Set((const void *)(code), (to), 0x84000000 | (size_ >> 2), REG_DMA3); \
23 } while (0)
24
25/// Allocates a work-slot copy; release it with Runtime_ReleaseHeapBlock.
26#define RamCode_LoadSlot(slot, code, bytes) \
27 do { \
28 u32 size_; \
29 \
30 size_ = (u32)(bytes); \
31 \
32 Dma_Set((const void *)(code), Runtime_AllocateHeapBlock((slot), size_), \
33 0x84000000 | (size_ >> 2), REG_DMA3); \
34 } while (0)
35
36#endif
DMA channel registers, and the DMA and CPU fills.
The hardware's I/O registers and their bits, as pret names them.
The heaps: allocating and freeing blocks.
The integer types, TRUE, UNUSED and the fixed-address macros.