ezfo-disc_io/source/tonccpy.h
ApacheThunder 21bf488362 Initial port to libnds compatible DLDI
* DMA code limited to GBA compile flag as it will not operate safely in
DS mode due to arm9 cache system.
* tonccpy used in place of dmaCopy for NDS mode.
* Altered detection routine in startup function. Should be more reliable
(for DS mode at least. Maybe it worked better for GBA homebrew but I
found this to be unreliable for DS mode stuff)
* setRomPage value for Kernel mode alrted to be 0x8002 as rerferenced in
the EZFlash Kernel source code. 0x8000....not sure what the difference
is with that one. Maybe 0x8000 is actually bootloader mode?
* Disabling of SD and setting back to PSRam mode will no only occur if
DLDI is compiled for GBA as the constant mode switching is not
nessecery.
2024-06-23 14:32:29 -05:00

44 lines
1.1 KiB
C

//# Stuff you may not have yet.
#ifndef TONCCPY_H
#define TONCCPY_H
#ifdef __cplusplus
extern "C" {
#endif
#include <nds/ndstypes.h>
typedef unsigned int uint;
#define BIT_MASK(len) ( (1<<(len))-1 )
static inline u32 quad8(u16 x) { x |= x<<8; return x | x<<16; }
//# Declarations and inlines.
void tonccpy(void *dst, const void *src, uint size);
void __toncset(void *dst, u32 fill, uint size);
static inline void toncset(void *dst, u8 src, uint size);
static inline void toncset16(void *dst, u16 src, uint size);
static inline void toncset32(void *dst, u32 src, uint size);
//! VRAM-safe memset, byte version. Size in bytes.
static inline void toncset(void *dst, u8 src, uint size)
{ __toncset(dst, quad8(src), size); }
//! VRAM-safe memset, halfword version. Size in hwords.
static inline void toncset16(void *dst, u16 src, uint size)
{ __toncset(dst, src|src<<16, size*2); }
//! VRAM-safe memset, word version. Size in words.
static inline void toncset32(void *dst, u32 src, uint size)
{ __toncset(dst, src, size*4); }
#ifdef __cplusplus
}
#endif
#endif