PS2SDK
PS2 Homebrew Libraries
scsi.h
1 #define XFER_BLOCK_SIZE 65024 /* 65536-512. It seems like my Oxford 934 is capable of maximum transfers of less than 65536 bytes. \
2  NOTE: I reduced the maximum block size here by 512, since transfers are done in (smallest) groups of 512 bytes! \
3  */
4 
5 #define READ_TRANSACTION 0
6 #define WRITE_TRANSACTION 1
7 
8 /* Some macros */
9 #define CDB_PAGE_SIZE(v) ((v) << 16) /* Not in use. */
10 #define CDB_PAGE_TABLE_PRESENT(v) ((v) << 19) /* Not in use. */
11 #define CDB_MAX_PAYLOAD(v) ((v) << 20)
12 #define CDB_SPEED(v) ((v) << 24)
13 #define CDB_DIRECTION(v) ((v) << 27)
14 #define CDB_DATA_SIZE(v) ((v))
15 
16 typedef struct _inquiry_data
17 {
18  u8 peripheral_device_type; // 00h - Direct access (Floppy), 1Fh none (no FDD connected)
19  u8 removable_media; // 80h - removeable
20  u8 iso_ecma_ansi;
21  u8 repsonse_data_format;
22  u8 additional_length;
23  u8 res[3];
24  u8 vendor[8];
25  u8 product[16];
26  u8 revision[4];
27 } inquiry_data;
28 
29 typedef struct _sense_data
30 {
31  u8 error_code;
32  u8 res1;
33  u8 sense_key;
34  u8 information[4];
35  u8 add_sense_len;
36  u8 res3[4];
37  u8 add_sense_code;
38  u8 add_sense_qual;
39  u8 res4[4];
40 } sense_data;
41 
42 typedef struct _read_capacity_data
43 {
44  u32 last_lba; /* Big endian data. */
45  u32 block_length; /* Big endian data. */
47 
48 /* Function prototypes. */
49 extern int scsiReadSector(struct SBP2Device *dev, unsigned long int lba, void *buffer, int sectorCount);
50 extern int scsiWriteSector(struct SBP2Device *dev, unsigned long int lba, void *buffer, int sectorCount);
51 extern void releaseSBP2Device(struct SBP2Device *dev);
52 extern int ConfigureSBP2Device(struct SBP2Device *dev);
_inquiry_data
Definition: scsi.c:15
_read_capacity_data
Definition: scsi.c:41
_sense_data
Definition: scsi.c:28
SBP2Device
Definition: sbp2_disk.h:125