joe carter
/
nitrocarproject
h_and_c_files/usbhost_ms.h@0:960b355eaa84, 2010-08-20 (annotated)
- Committer:
- joe
- Date:
- Fri Aug 20 11:18:40 2010 +0000
- Revision:
- 0:960b355eaa84
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
joe | 0:960b355eaa84 | 1 | /* |
joe | 0:960b355eaa84 | 2 | ************************************************************************************************************** |
joe | 0:960b355eaa84 | 3 | * NXP USB Host Stack |
joe | 0:960b355eaa84 | 4 | * |
joe | 0:960b355eaa84 | 5 | * (c) Copyright 2008, NXP SemiConductors |
joe | 0:960b355eaa84 | 6 | * (c) Copyright 2008, OnChip Technologies LLC |
joe | 0:960b355eaa84 | 7 | * All Rights Reserved |
joe | 0:960b355eaa84 | 8 | * |
joe | 0:960b355eaa84 | 9 | * www.nxp.com |
joe | 0:960b355eaa84 | 10 | * www.onchiptech.com |
joe | 0:960b355eaa84 | 11 | * |
joe | 0:960b355eaa84 | 12 | * File : usbhost_ms.h |
joe | 0:960b355eaa84 | 13 | * Programmer(s) : Ravikanth.P |
joe | 0:960b355eaa84 | 14 | * Version : |
joe | 0:960b355eaa84 | 15 | * |
joe | 0:960b355eaa84 | 16 | ************************************************************************************************************** |
joe | 0:960b355eaa84 | 17 | */ |
joe | 0:960b355eaa84 | 18 | |
joe | 0:960b355eaa84 | 19 | #ifndef USBHOST_MS_H |
joe | 0:960b355eaa84 | 20 | #define USBHOST_MS_H |
joe | 0:960b355eaa84 | 21 | |
joe | 0:960b355eaa84 | 22 | /* |
joe | 0:960b355eaa84 | 23 | ************************************************************************************************************** |
joe | 0:960b355eaa84 | 24 | * INCLUDE HEADER FILES |
joe | 0:960b355eaa84 | 25 | ************************************************************************************************************** |
joe | 0:960b355eaa84 | 26 | */ |
joe | 0:960b355eaa84 | 27 | |
joe | 0:960b355eaa84 | 28 | #include "usbhost_inc.h" |
joe | 0:960b355eaa84 | 29 | |
joe | 0:960b355eaa84 | 30 | /* |
joe | 0:960b355eaa84 | 31 | ************************************************************************************************************** |
joe | 0:960b355eaa84 | 32 | * MASS STORAGE SPECIFIC DEFINITIONS |
joe | 0:960b355eaa84 | 33 | ************************************************************************************************************** |
joe | 0:960b355eaa84 | 34 | */ |
joe | 0:960b355eaa84 | 35 | |
joe | 0:960b355eaa84 | 36 | #define MS_GET_MAX_LUN_REQ 0xFE |
joe | 0:960b355eaa84 | 37 | #define MASS_STORAGE_CLASS 0x08 |
joe | 0:960b355eaa84 | 38 | #define MASS_STORAGE_SUBCLASS_SCSI 0x06 |
joe | 0:960b355eaa84 | 39 | #define MASS_STORAGE_PROTOCOL_BO 0x50 |
joe | 0:960b355eaa84 | 40 | |
joe | 0:960b355eaa84 | 41 | #define INQUIRY_LENGTH 36 |
joe | 0:960b355eaa84 | 42 | /* |
joe | 0:960b355eaa84 | 43 | ************************************************************************************************************** |
joe | 0:960b355eaa84 | 44 | * SCSI SPECIFIC DEFINITIONS |
joe | 0:960b355eaa84 | 45 | ************************************************************************************************************** |
joe | 0:960b355eaa84 | 46 | */ |
joe | 0:960b355eaa84 | 47 | |
joe | 0:960b355eaa84 | 48 | #define CBW_SIGNATURE 0x43425355 |
joe | 0:960b355eaa84 | 49 | #define CSW_SIGNATURE 0x53425355 |
joe | 0:960b355eaa84 | 50 | #define CBW_SIZE 31 |
joe | 0:960b355eaa84 | 51 | #define CSW_SIZE 13 |
joe | 0:960b355eaa84 | 52 | #define CSW_CMD_PASSED 0x00 |
joe | 0:960b355eaa84 | 53 | #define SCSI_CMD_REQUEST_SENSE 0x03 |
joe | 0:960b355eaa84 | 54 | #define SCSI_CMD_TEST_UNIT_READY 0x00 |
joe | 0:960b355eaa84 | 55 | #define SCSI_CMD_INQUIRY 0x12 |
joe | 0:960b355eaa84 | 56 | #define SCSI_CMD_READ_10 0x28 |
joe | 0:960b355eaa84 | 57 | #define SCSI_CMD_READ_CAPACITY 0x25 |
joe | 0:960b355eaa84 | 58 | #define SCSI_CMD_WRITE_10 0x2A |
joe | 0:960b355eaa84 | 59 | |
joe | 0:960b355eaa84 | 60 | /* |
joe | 0:960b355eaa84 | 61 | ************************************************************************************************************** |
joe | 0:960b355eaa84 | 62 | * TYPE DEFINITIONS |
joe | 0:960b355eaa84 | 63 | ************************************************************************************************************** |
joe | 0:960b355eaa84 | 64 | */ |
joe | 0:960b355eaa84 | 65 | |
joe | 0:960b355eaa84 | 66 | typedef enum ms_data_dir { |
joe | 0:960b355eaa84 | 67 | |
joe | 0:960b355eaa84 | 68 | MS_DATA_DIR_IN = 0x80, |
joe | 0:960b355eaa84 | 69 | MS_DATA_DIR_OUT = 0x00, |
joe | 0:960b355eaa84 | 70 | MS_DATA_DIR_NONE = 0x01 |
joe | 0:960b355eaa84 | 71 | |
joe | 0:960b355eaa84 | 72 | } MS_DATA_DIR; |
joe | 0:960b355eaa84 | 73 | |
joe | 0:960b355eaa84 | 74 | /* |
joe | 0:960b355eaa84 | 75 | ************************************************************************************************************** |
joe | 0:960b355eaa84 | 76 | * FUNCTION PROTOTYPES |
joe | 0:960b355eaa84 | 77 | ************************************************************************************************************** |
joe | 0:960b355eaa84 | 78 | */ |
joe | 0:960b355eaa84 | 79 | |
joe | 0:960b355eaa84 | 80 | USB_INT32S MS_BulkRecv ( USB_INT32U block_number, |
joe | 0:960b355eaa84 | 81 | USB_INT16U num_blocks, |
joe | 0:960b355eaa84 | 82 | volatile USB_INT08U *user_buffer); |
joe | 0:960b355eaa84 | 83 | |
joe | 0:960b355eaa84 | 84 | USB_INT32S MS_BulkSend ( USB_INT32U block_number, |
joe | 0:960b355eaa84 | 85 | USB_INT16U num_blocks, |
joe | 0:960b355eaa84 | 86 | volatile USB_INT08U *user_buffer); |
joe | 0:960b355eaa84 | 87 | USB_INT32S MS_ParseConfiguration(void); |
joe | 0:960b355eaa84 | 88 | USB_INT32S MS_TestUnitReady (void); |
joe | 0:960b355eaa84 | 89 | USB_INT32S MS_ReadCapacity (USB_INT32U *numBlks, USB_INT32U *blkSize); |
joe | 0:960b355eaa84 | 90 | USB_INT32S MS_GetMaxLUN (void); |
joe | 0:960b355eaa84 | 91 | USB_INT32S MS_GetSenseInfo (void); |
joe | 0:960b355eaa84 | 92 | USB_INT32S MS_Init (USB_INT32U *blkSize, USB_INT32U *numBlks, USB_INT08U *inquiryResult); |
joe | 0:960b355eaa84 | 93 | USB_INT32S MS_Inquire (USB_INT08U *response); |
joe | 0:960b355eaa84 | 94 | |
joe | 0:960b355eaa84 | 95 | void Fill_MSCommand ( USB_INT32U block_number, |
joe | 0:960b355eaa84 | 96 | USB_INT32U block_size, |
joe | 0:960b355eaa84 | 97 | USB_INT16U num_blocks, |
joe | 0:960b355eaa84 | 98 | MS_DATA_DIR direction, |
joe | 0:960b355eaa84 | 99 | USB_INT08U scsi_cmd, |
joe | 0:960b355eaa84 | 100 | USB_INT08U scsi_cmd_len); |
joe | 0:960b355eaa84 | 101 | #endif |