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