libdragon
Loading...
Searching...
No Matches
cart.h
1#ifndef __CART_H__
2#define __CART_H__
3
4#include <stdint.h>
5
6/* Cartrige types */
7#define CART_NULL -1
8#define CART_CI 0 /* 64Drive */
9#define CART_EDX 1 /* EverDrive-64 X-series */
10#define CART_ED 2 /* EverDrive-64 V1, V2, V2.5, V3 and ED64+ */
11#define CART_SC 3 /* SummerCart64 */
12#define CART_MAX 4
13
14#ifdef __cplusplus
15extern "C" {
16#endif
17
18/* Size of cartridge SDRAM */
19extern uint32_t cart_size;
20
21/* Cartridge type */
22extern int cart_type;
23
24/* Detect cartridge and initialize it */
25extern int cart_init(void);
26/* Close the cartridge interface */
27extern int cart_exit(void);
28
29/* Swap high and low bytes per 16-bit word when reading into SDRAM */
30extern char cart_card_byteswap;
31
32/* Initialize card */
33extern int cart_card_init(void);
34/* Read sectors from card to system RDRAM */
35extern int cart_card_rd_dram(void *dram, uint32_t lba, uint32_t count);
36/* Read sectors from card to cartridge SDRAM */
37extern int cart_card_rd_cart(uint32_t cart, uint32_t lba, uint32_t count);
38/* Write sectors from system RDRAM to card */
39extern int cart_card_wr_dram(const void *dram, uint32_t lba, uint32_t count);
40/* Write sectors from cartridge SDRAM to card */
41extern int cart_card_wr_cart(uint32_t cart, uint32_t lba, uint32_t count);
42
43/* 64Drive functions */
44extern int ci_init(void);
45extern int ci_exit(void);
46extern int ci_card_init(void);
47extern int ci_card_byteswap(int flag);
48extern int ci_card_rd_dram(void *dram, uint32_t lba, uint32_t count);
49extern int ci_card_rd_cart(uint32_t cart, uint32_t lba, uint32_t count);
50extern int ci_card_wr_dram(const void *dram, uint32_t lba, uint32_t count);
51extern int ci_card_wr_cart(uint32_t cart, uint32_t lba, uint32_t count);
52
53/* EverDrive-64 X-series functions */
54extern int edx_init(void);
55extern int edx_exit(void);
56extern int edx_card_init(void);
57extern int edx_card_byteswap(int flag);
58extern int edx_card_rd_dram(void *dram, uint32_t lba, uint32_t count);
59extern int edx_card_rd_cart(uint32_t cart, uint32_t lba, uint32_t count);
60extern int edx_card_wr_dram(const void *dram, uint32_t lba, uint32_t count);
61extern int edx_card_wr_cart(uint32_t cart, uint32_t lba, uint32_t count);
62
63/* EverDrive-64 functions */
64extern int ed_init(void);
65extern int ed_exit(void);
66extern int ed_card_init(void);
67extern int ed_card_byteswap(int flag);
68extern int ed_card_rd_dram(void *dram, uint32_t lba, uint32_t count);
69extern int ed_card_rd_cart(uint32_t cart, uint32_t lba, uint32_t count);
70extern int ed_card_wr_dram(const void *dram, uint32_t lba, uint32_t count);
71extern int ed_card_wr_cart(uint32_t cart, uint32_t lba, uint32_t count);
72
73/* SummerCart64 functions */
74extern int sc_init(void);
75extern int sc_exit(void);
76extern int sc_card_init(void);
77extern int sc_card_byteswap(int flag);
78extern int sc_card_rd_dram(void *dram, uint32_t lba, uint32_t count);
79extern int sc_card_rd_cart(uint32_t cart, uint32_t lba, uint32_t count);
80extern int sc_card_wr_dram(const void *dram, uint32_t lba, uint32_t count);
81extern int sc_card_wr_cart(uint32_t cart, uint32_t lba, uint32_t count);
82
83#ifdef __cplusplus
84}
85#endif
86
87#endif /* __CART_H__ */