31 #ifndef __USB_DISK_H__ 32 #define __USB_DISK_H__ 1 42 #define USB_DEVICE_INTERRUPT_PRIORITY (4) 50 #define U32_LE(n) ((n)&0xff), (((n) >> 8) & 0xff), (((n) >> 16) & 0xff), (((n) >> 24) & 0xff) 54 #define U16_LE(n) ((n)&0xff), (((n) >> 8) & 0xff) 58 #define LENGTH_OF_EACH_LBA (512) 60 #define TOTAL_LOGICAL_ADDRESS_BLOCKS_NORMAL (48) 65 #define LOGICAL_UNIT_SUPPORTED (1) 67 #define USB_DEVICE_MSC_WRITE_BUFF_NUM 2 68 #define USB_DEVICE_MSC_WRITE_BUFF_SIZE 512 69 #define USB_DEVICE_MSC_READ_BUFF_SIZE 512 105 #define CLUSTER_FROM_SECTOR(s) (((s)-kFirstClusterSector) / kDiskClusterSize) 108 enum _root_dir_entry_numbers
110 kInfoFileDirEntry = 11,
111 kStatusFileDirEntry = 12,
112 kFirstUnusedDirEntry = 13
119 typedef struct SectorInfo
127 typedef enum _sb_transfer_status
133 } sb_transfer_status_t;
136 typedef enum _sb_loader_status
142 } sb_loader_status_t;
145 typedef enum _sector_buffer_status
151 } sector_buffer_status_t;
154 enum _usb_msd_constants
157 kNumberOfSectorBuffers = 2,
160 kInvalidBufferReadIndex = ~0
166 typedef struct _usb_msd_state
171 uint8_t isDiskLocked;
172 uint8_t read_write_error;
175 uint8_t sbLoaderStatus;
185 typedef struct _usb_msc_struct
187 usb_device_handle device_handle;
188 class_handle_t msc_handle;
191 uint8_t current_configuration;
192 uint8_t current_interface_alternate_setting[USB_MSC_INTERFACE_COUNT];
First sector available for data.
Definition: msc_disk.h:99
Number of sectors per cluster.
Definition: msc_disk.h:80
Sector number of the first cluster.
Definition: msc_disk.h:101
Sector information.
Definition: msc_disk.h:119
Number of sectors occupied by each FAT, rounded up.
Definition: msc_disk.h:82
uint8_t isProcessing
Set to true while the SB file is being processed.
Definition: msc_disk.h:176
const uint8_t * data
Data for the sector.
Definition: msc_disk.h:122
Mac OS X '.fseventsd' directory.
Definition: msc_disk.h:94
Size in bytes of each sector of the disk.
Definition: msc_disk.h:74
FAT2 (unused)
Definition: msc_disk.h:91
uint8_t isActive
Set to true when the first SB file is transferred.
Definition: msc_disk.h:173
uint32_t length
Number of bytes of data.
Definition: msc_disk.h:123
Windows 8.1 'System Volume Information' directory.
Definition: msc_disk.h:95
Root directory 2 (16 x 32-byte entries)
Definition: msc_disk.h:93
PBS.
Definition: msc_disk.h:78
uint8_t isReceivePending
Whether a sector write is being held off until a buffer is free.
Definition: msc_disk.h:177
Definition: msc_disk.h:185
Size in bytes of the total disk.
Definition: msc_disk.h:76
Root directory 1 (16 x 32-byte entries)
Definition: msc_disk.h:92
uint32_t infoFileLength
Size in bytes of the info.txt file.
Definition: msc_disk.h:178
Windows 8.1 'IndexerVolumeGuid' file.
Definition: msc_disk.h:96
State information for the USB MSD peripheral.
Definition: msc_disk.h:166
Partition Boot Sector.
Definition: msc_disk.h:89
uint32_t remainingFileLength
Total length in bytes of the SB file being transferred.
Definition: msc_disk.h:180
Number of SCSI LUNs.
Definition: msc_disk.h:77
uint32_t dataBytesAvailable
Number of bytes available in sectorBuffer.
Definition: msc_disk.h:181
Info .txt file.
Definition: msc_disk.h:97
uint32_t nextSector
The next expected sector write for the SB file transfer.
Definition: msc_disk.h:179
Total number of sectors in the disk.
Definition: msc_disk.h:75
uint32_t sector
Sector number.
Definition: msc_disk.h:121
Status .txt file.
Definition: msc_disk.h:98
uint8_t isTransferring
Whether an SB file transfer has been started.
Definition: msc_disk.h:174
FAT1.
Definition: msc_disk.h:90
sb_transfer_status_t transferStatus
Status to present in the status.txt file.
Definition: msc_disk.h:182
Two bytes per FAT16 entry.
Definition: msc_disk.h:79