mirror of
https://github.com/vivier/EMILE.git
synced 2024-12-22 10:29:31 +00:00
Add scsi_READ
This commit is contained in:
parent
079def3b0b
commit
4feec025f2
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
|
#include <scsi/scsi.h>
|
||||||
#include "bank.h"
|
#include "bank.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
#include "glue.h"
|
#include "glue.h"
|
||||||
@ -63,7 +64,7 @@ int scsi_INQUIRY(int target, char *buffer, size_t count)
|
|||||||
char cdb[6];
|
char cdb[6];
|
||||||
TIB_t tib[2];
|
TIB_t tib[2];
|
||||||
|
|
||||||
cdb[0] = 0x12;
|
cdb[0] = INQUIRY;
|
||||||
cdb[1] = 0;
|
cdb[1] = 0;
|
||||||
cdb[2] = 0;
|
cdb[2] = 0;
|
||||||
cdb[3] = 0;
|
cdb[3] = 0;
|
||||||
@ -80,12 +81,56 @@ int scsi_INQUIRY(int target, char *buffer, size_t count)
|
|||||||
return scsi_command(target, cdb, 6, tib);
|
return scsi_command(target, cdb, 6, tib);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
/******************************************************************************
|
||||||
char cdb[6] = {
|
+=====-========-========-========-========-========-========-========-========+
|
||||||
0x08, /* READ */
|
| Bit| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
|
||||||
(offset >> 16) & 0x1F,
|
|Byte | | | | | | | | |
|
||||||
(offset >> 8) & 0xFF,
|
|=====+=======================================================================|
|
||||||
offset & 0xFF,
|
| 0 | Operation code (28h) |
|
||||||
(size + 511) / 512, /* FIXME: blocksize and max is 255 */
|
|-----+-----------------------------------------------------------------------|
|
||||||
0 };
|
| 1 | Logical unit number | DPO | FUA | Reserved | RelAdr |
|
||||||
#endif
|
|-----+-----------------------------------------------------------------------|
|
||||||
|
| 2 | (MSB) |
|
||||||
|
|-----+--- ---|
|
||||||
|
| 3 | |
|
||||||
|
|-----+--- Logical block address ---|
|
||||||
|
| 4 | |
|
||||||
|
|-----+--- ---|
|
||||||
|
| 5 | (LSB) |
|
||||||
|
|-----+-----------------------------------------------------------------------|
|
||||||
|
| 6 | Reserved |
|
||||||
|
|-----+-----------------------------------------------------------------------|
|
||||||
|
| 7 | (MSB) |
|
||||||
|
|-----+--- Transfer length |
|
||||||
|
| 8 | (LSB) |
|
||||||
|
|-----+-----------------------------------------------------------------------|
|
||||||
|
| 9 | Control |
|
||||||
|
+=============================================================================+
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
int scsi_READ(int target, unsigned long offset, unsigned short nb_blocks,
|
||||||
|
char *buffer, int buffer_size)
|
||||||
|
{
|
||||||
|
char cdb[10];
|
||||||
|
TIB_t tib[2];
|
||||||
|
|
||||||
|
cdb[0] = READ_10;
|
||||||
|
cdb[1] = 0;
|
||||||
|
cdb[2] = (offset >> 24) & 0xFF;
|
||||||
|
cdb[3] = (offset >> 16) & 0xFF;
|
||||||
|
cdb[4] = (offset >> 8) & 0xFF;
|
||||||
|
cdb[5] = offset & 0xFF;
|
||||||
|
cdb[6] = 0;
|
||||||
|
cdb[7] = (nb_blocks >> 8) & 0xFF;
|
||||||
|
cdb[8] = nb_blocks & 0xFF;
|
||||||
|
cdb[9] = 0;
|
||||||
|
|
||||||
|
tib[0].opcode = op_no_inc;
|
||||||
|
tib[0].param1 = (int)buffer;
|
||||||
|
tib[0].param2 = buffer_size;
|
||||||
|
tib[1].opcode = op_stop;
|
||||||
|
tib[1].param1 = 0;
|
||||||
|
tib[1].param2 = 0;
|
||||||
|
|
||||||
|
return scsi_command(target, cdb, 10, tib);
|
||||||
|
}
|
||||||
|
@ -5,3 +5,5 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
extern int scsi_INQUIRY(int target, char* buffer, size_t count);
|
extern int scsi_INQUIRY(int target, char* buffer, size_t count);
|
||||||
|
extern int scsi_READ(int target, unsigned long offset, unsigned short nb_blocks,
|
||||||
|
char *buffer, int buffer_size);
|
||||||
|
Loading…
Reference in New Issue
Block a user