summaryrefslogtreecommitdiff
path: root/arm9/lib/include/CARD_rom.h
blob: b96c527ba9cd3260d8085ecb3ce04ccc4e217366 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#ifndef NITRO_CARD_ROM_H_
#define NITRO_CARD_ROM_H_

#include "nitro/types.h"
#include "MI_exMemory.h"
#include "MI_dma.h"

typedef struct
{
    u32 offset;
    u32 length;
}
CARDRomRegion;

static inline const CARDRomRegion * CARD_GetRomRegionOVT(MIProcessor target)
{
    return (target == MI_PROCESSOR_ARM9)
    ? (const CARDRomRegion *)((const u8 *)HW_ROM_HEADER_BUF + 0x50)
    : (const CARDRomRegion *)((const u8 *)HW_ROM_HEADER_BUF + 0x58);
}

void CARDi_ReadRom(u32 dma, const void * src, void * dst, u32 len, MIDmaCallback done_cb, void * arg, BOOL is_async);

static inline void CARD_ReadRomAsync(u32 dma, const void * src, void * dst, u32 len, MIDmaCallback callback, void * arg)
{
    CARDi_ReadRom(dma, src, dst, len, callback, arg, TRUE);
}

static inline const CARDRomRegion * CARD_GetRomRegionFNT() {
    return (const CARDRomRegion *)((const u8 *)HW_ROM_HEADER_BUF + 0x40);
}

static inline const CARDRomRegion * CARD_GetRomRegionFAT() {
    return (const CARDRomRegion *)((const u8 *)HW_ROM_HEADER_BUF + 0x48);
}

#endif //NITRO_CARD_ROM_H_