2 #define __USBSTORAGE_H 1
6 #endif /* __cplusplus */
10 #define USBSTORAGE_OK 0
11 #define USBSTORAGE_ENOINTERFACE -10000
12 #define USBSTORAGE_ESENSE -10001
13 #define USBSTORAGE_ECAPACITY -10002
14 #define USBSTORAGE_ESHORTWRITE -10003
15 #define USBSTORAGE_ESHORTREAD -10004
16 #define USBSTORAGE_ESIGNATURE -10005
17 #define USBSTORAGE_ETAG -10006
18 #define USBSTORAGE_ESTATUS -10007
19 #define USBSTORAGE_EDATARESIDUE -10008
22 typedef struct _usbendpointdesc
32 typedef struct _usbinterfacedesc
40 u8 bInterfaceSubClass
;
41 u8 bInterfaceProtocol
;
43 struct _usbendpointdesc
*endpoints
;
46 typedef struct _usbconfdesc
52 u8 bConfigurationValue
;
56 struct _usbinterfacedesc
*interfaces
;
57 } usb_configurationdesc
;
59 typedef struct _usbdevdesc
74 u8 bNumConfigurations
;
75 struct _usbconfdesc
*configurations
;
101 s32
USB_GetDescriptors(s32 fd
, _usb_devdesc
*udd
);
102 void USB_FreeDescriptors(_usb_devdesc
*udd
);
104 s32
USBStorage_Initialize();
105 s32
USBStorage_Deinitialize();
107 s32
USBStorage_Open(usbstorage_handle
*dev
, const char *bus
, u16 vid
, u16 pid
);
108 s32
USBStorage_Close(usbstorage_handle
*dev
);
109 s32
USBStorage_Reset(usbstorage_handle
*dev
);
111 s32
USBStorage_ReadCapacity(usbstorage_handle
*dev
, u32
*sector_size
, u32
*n_sectors
);
113 s32
USBStorage_Read(usbstorage_handle
*dev
, u32 sector
, u8
*buffer
, u16 n_sectors
);
114 s32
USBStorage_Write(usbstorage_handle
*dev
, u32 sector
, const u8
*buffer
, u16 n_sectors
);
118 #endif /* __cplusplus */