# modules/msd/LPC17xx/msc_scsi.c File Reference

`#include <mios32.h>`
`#include <usbapi.h>`
`#include <string.h>`
`#include <msd.h>`
`#include "usbdebug.h"`
`#include "blockdev.h"`
`#include "msc_scsi.h"`

## Data Structures
struct | TCDB6
## Defines
#define | BLOCKSIZE 512
#define | SCSI_CMD_TEST_UNIT_READY 0x00
#define | SCSI_CMD_REQUEST_SENSE 0x03
#define | SCSI_CMD_FORMAT_UNIT 0x04
#define | SCSI_CMD_READ_6 0x08
#define | SCSI_CMD_INQUIRY 0x12
#define | SCSI_CMD_START_STOP_UNIT 0x1b
#define | SCSI_CMD_SEND_DIAGNOSTIC 0x1D
#define | SCSI_CMD_READ_CAPACITY_10 0x25
#define | SCSI_CMD_READ_10 0x28
#define | SCSI_CMD_REPORT_LUNS 0xA0
#define | SCSI_CMD_WRITE_6 0x0A
#define | SCSI_CMD_WRITE_10 0x2A
#define | SCSI_CMD_VERIFY_10 0x2F
#define | WRITE_ERROR 0x030C00
#define | READ_ERROR 0x031100
#define | INVALID_CMD_OPCODE 0x052000
#define | INVALID_FIELD_IN_CDB 0x052400
## Functions
void | SCSIReset (void)
u8 * | SCSIHandleCmd (u8 *pbCDB, u8 iCDBLen, int *piRspLen, BOOL *pfDevIn)
u8 * | SCSIHandleData (u8 *pbCDB, u8 iCDBLen, u8 *pbData, u32 dwOffset)

## Detailed Description

This is the SCSI layer of the USB mass storage application example. This layer depends directly on the blockdev layer.

Windows peculiarities: Size of REQUEST SENSE CDB is 12 bytes instead of expected 6 Windows requires VERIFY(10) command to do a format. This command is not mandatory in the SBC/SBC-2 specification.

## Define Documentation

#define BLOCKSIZE 512

#define INVALID_CMD_OPCODE 0x052000

#define INVALID_FIELD_IN_CDB 0x052400

#define READ_ERROR 0x031100

#define SCSI_CMD_FORMAT_UNIT 0x04

#define SCSI_CMD_INQUIRY 0x12

#define SCSI_CMD_READ_10 0x28

#define SCSI_CMD_READ_6 0x08

#define SCSI_CMD_READ_CAPACITY_10 0x25

#define SCSI_CMD_REPORT_LUNS 0xA0

#define SCSI_CMD_REQUEST_SENSE 0x03

#define SCSI_CMD_SEND_DIAGNOSTIC 0x1D

#define SCSI_CMD_START_STOP_UNIT 0x1b

#define SCSI_CMD_TEST_UNIT_READY 0x00

#define SCSI_CMD_VERIFY_10 0x2F

#define SCSI_CMD_WRITE_10 0x2A

#define SCSI_CMD_WRITE_6 0x0A

#define WRITE_ERROR 0x030C00

## Function Documentation

u8* SCSIHandleCmd | ( | u8 * | pbCDB,
|  | u8 | iCDBLen,
|  | int * | piRspLen,
|  | BOOL * | pfDevIn |
| ) |  |  |

Here is the call graph for this function:

u8* SCSIHandleData | ( | u8 * | pbCDB,
|  | u8 | iCDBLen,
|  | u8 * | pbData,
|  | u32 | dwOffset |
| ) |  |  |

Here is the call graph for this function:

void SCSIReset | ( | void |  | ) |