RetroArch
card_io.h
Go to the documentation of this file.
1 #ifndef __CARD_IO_H__
2 #define __CARD_IO_H__
3 
4 #include <gctypes.h>
5 
6 #define MAX_MI_NUM 1
7 #define MAX_DI_NUM 5
8 
9 #define PAGE_SIZE256 256
10 #define PAGE_SIZE512 512
11 
12 /* CID Register */
13 #define MANUFACTURER_ID(drv_no) ((u8)(g_CID[drv_no][0]))
14 
15 /* CSD Register */
16 #define READ_BL_LEN(drv_no) ((u8)(g_CSD[drv_no][5]&0x0f))
17 #define WRITE_BL_LEN(drv_no) ((u8)((g_CSD[drv_no][12]&0x03)<<2)|((g_CSD[drv_no][13]>>6)&0x03))
18 #define C_SIZE(drv_no) ((u16)(((g_CSD[drv_no][6]&0x03)<<10)|(g_CSD[drv_no][7]<<2)|((g_CSD[drv_no][8]>>6)&0x03)))
19 #define C_SIZE_MULT(drv_no) ((u8)((g_CSD[drv_no][9]&0x03)<<1)|((g_CSD[drv_no][10]>>7)&0x01))
20 
21 #ifdef __cplusplus
22  extern "C" {
23 #endif /* __cplusplus */
24 
25 extern u8 g_CSD[MAX_DRIVE][16];
26 extern u8 g_CID[MAX_DRIVE][16];
27 extern u8 g_mCode[MAX_MI_NUM];
29 
30 
32 s32 sdgecko_initIO(s32 drv_no);
33 s32 sdgecko_preIO(s32 drv_no);
34 s32 sdgecko_readCID(s32 drv_no);
35 s32 sdgecko_readCSD(s32 drv_no);
36 s32 sdgecko_readStatus(s32 drv_no);
37 s32 sdgecko_readSectors(s32 drv_no,u32 sector_no,u32 num_sectors,void *buf);
38 s32 sdgecko_writeSector(s32 drv_no,u32 sector_no,const void *buf,u32 len);
39 s32 sdgecko_writeSectors(s32 drv_no,u32 sector_no,u32 num_sectors,const void *buf);
40 
41 s32 sdgecko_doUnmount(s32 drv_no);
42 
43 void sdgecko_insertedCB(s32 drv_no);
44 void sdgecko_ejectedCB(s32 drv_no);
45 
46 
47 #ifdef __cplusplus
48  }
49 #endif /* __cplusplus */
50 
51 #endif
s32 sdgecko_writeSectors(s32 drv_no, u32 sector_no, u32 num_sectors, const void *buf)
Definition: sdgecko_io.c:1247
s32 sdgecko_readSectors(s32 drv_no, u32 sector_no, u32 num_sectors, void *buf)
Definition: sdgecko_io.c:1211
int32_t s32
32bit signed integer
Definition: gctypes.h:24
void sdgecko_initIODefault()
Definition: sdgecko_io.c:1095
Data type definitions.
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:8418
s32 sdgecko_readStatus(s32 drv_no)
Definition: sdgecko_io.c:1199
GLenum GLsizei len
Definition: glext.h:7389
u8 g_CSD[MAX_DRIVE][16]
Definition: sdgecko_io.c:50
s32 sdgecko_readCSD(s32 drv_no)
Definition: sdgecko_io.c:1188
void sdgecko_ejectedCB(s32 drv_no)
Definition: sdgecko_io.c:1329
s32 sdgecko_initIO(s32 drv_no)
Definition: sdgecko_io.c:1111
s32 sdgecko_readCID(s32 drv_no)
Definition: sdgecko_io.c:1177
#define MAX_DRIVE
Definition: card_cmn.h:37
uint16_t u16
16bit unsigned integer
Definition: gctypes.h:18
void sdgecko_insertedCB(s32 drv_no)
Definition: sdgecko_io.c:1323
#define MAX_DI_NUM
Definition: card_io.h:7
s32 sdgecko_writeSector(s32 drv_no, u32 sector_no, const void *buf, u32 len)
u8 g_CID[MAX_DRIVE][16]
Definition: sdgecko_io.c:49
s32 sdgecko_doUnmount(s32 drv_no)
Definition: sdgecko_io.c:1296
u16 g_dCode[MAX_MI_NUM][MAX_DI_NUM]
Definition: sdgecko_io.c:55
s32 sdgecko_preIO(s32 drv_no)
Definition: sdgecko_io.c:1164
u8 g_mCode[MAX_MI_NUM]
Definition: sdgecko_io.c:53
uint8_t u8
8bit unsigned integer
Definition: gctypes.h:17
uint32_t u32
32bit unsigned integer
Definition: gctypes.h:19
#define MAX_MI_NUM
Definition: card_io.h:6