RetroArch
usbstorage.h
Go to the documentation of this file.
1 #ifndef __USBSTORAGE_H__
2 #define __USBSTORAGE_H__
3 
4 #if defined(HW_RVL)
5 
6 #include <gctypes.h>
7 #include <ogc/mutex.h>
8 #include <ogc/disc_io.h>
9 #include <ogc/system.h>
10 
11 #ifdef __cplusplus
12  extern "C" {
13 #endif /* __cplusplus */
14 
15 #define USBSTORAGE_OK 0
16 #define USBSTORAGE_ENOINTERFACE -10000
17 #define USBSTORAGE_ESENSE -10001
18 #define USBSTORAGE_ESHORTWRITE -10002
19 #define USBSTORAGE_ESHORTREAD -10003
20 #define USBSTORAGE_ESIGNATURE -10004
21 #define USBSTORAGE_ETAG -10005
22 #define USBSTORAGE_ESTATUS -10006
23 #define USBSTORAGE_EDATARESIDUE -10007
24 #define USBSTORAGE_ETIMEDOUT -10008
25 #define USBSTORAGE_EINIT -10009
26 #define USBSTORAGE_PROCESSING -10010
27 
28 typedef struct
29 {
30  u8 configuration;
31  u32 interface;
32  u32 altInterface;
33  u8 bInterfaceSubClass;
34 
35  u8 ep_in;
36  u8 ep_out;
37 
38  u8 max_lun;
39  u32 *sector_size;
40 
41  s32 usb_fd;
42 
43  mutex_t lock;
44  syswd_t alarm;
45  s32 retval;
46 
47  u32 tag;
48  u8 suspended;
49 
50  u8 *buffer;
51 } usbstorage_handle;
52 
53 #define B_RAW_DEVICE_DATA_IN 0x01
54 #define B_RAW_DEVICE_COMMAND 0
55 
56 typedef struct {
57  uint8_t command[16];
58  uint8_t command_length;
59  uint8_t flags;
60  uint8_t scsi_status;
61  void* data;
62  size_t data_length;
63 } raw_device_command;
64 
65 s32 USBStorage_Initialize();
66 
67 s32 USBStorage_Open(usbstorage_handle *dev, s32 device_id, u16 vid, u16 pid);
68 s32 USBStorage_Close(usbstorage_handle *dev);
69 s32 USBStorage_Reset(usbstorage_handle *dev);
70 
71 s32 USBStorage_GetMaxLUN(usbstorage_handle *dev);
72 s32 USBStorage_MountLUN(usbstorage_handle *dev, u8 lun);
73 s32 USBStorage_Suspend(usbstorage_handle *dev);
74 s32 USBStorage_IsDVD();
75 s32 USBStorage_ioctl(int request, ...);
76 
77 s32 USBStorage_ReadCapacity(usbstorage_handle *dev, u8 lun, u32 *sector_size, u32 *n_sectors);
78 s32 USBStorage_Read(usbstorage_handle *dev, u8 lun, u32 sector, u16 n_sectors, u8 *buffer);
79 s32 USBStorage_Write(usbstorage_handle *dev, u8 lun, u32 sector, u16 n_sectors, const u8 *buffer);
80 s32 USBStorage_StartStop(usbstorage_handle *dev, u8 lun, u8 lo_ej, u8 start, u8 imm);
81 
82 #define DEVICE_TYPE_WII_USB (('W'<<24)|('U'<<16)|('S'<<8)|'B')
83 
84 extern DISC_INTERFACE __io_usbstorage;
85 
86 #ifdef __cplusplus
87  }
88 #endif /* __cplusplus */
89 
90 #endif /* HW_RVL */
91 
92 #endif /* __USBSTORAGE_H__ */
int32_t s32
32bit signed integer
Definition: gctypes.h:24
int mutex_t
typedef for the mutex handle
Definition: lock.c:6
static const unsigned char tag[MAX_TESTS *3][16]
Definition: gcm.c:696
GLuint buffer
Definition: glext.h:6555
Data type definitions.
GLuint start
Definition: glext.h:6292
u32 syswd_t
handle typedef for the alarm context
Definition: system.h:138
GLsizei GLsizei GLenum GLenum const GLvoid * data
Definition: glext.h:6303
uint16_t u16
16bit unsigned integer
Definition: gctypes.h:18
OS functions and initialization.
Definition: iosuhax_disc_interface.h:52
Definition: video4linux2.c:51
GLbitfield flags
Definition: glext.h:7828
uint8_t u8
8bit unsigned integer
Definition: gctypes.h:17
uint32_t u32
32bit unsigned integer
Definition: gctypes.h:19
unsigned char uint8_t
Definition: stdint.h:124
Definition: command.c:129