BaseJpegDeocde exampe program
Dependencies: BaseJpegDecode Terminal BaseUsbHost mbed mbed-rtos
Fork of BaseJpegDecode by
msc/msc.h@6:95be1cd2bc14, 2012-12-05 (annotated)
- Committer:
- va009039
- Date:
- Wed Dec 05 12:41:25 2012 +0000
- Revision:
- 6:95be1cd2bc14
- Parent:
- 4:7d88de31c55a
update FATFileASystem and BaseJpegDecode
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
va009039 | 6:95be1cd2bc14 | 1 | #ifndef MSC_H |
va009039 | 6:95be1cd2bc14 | 2 | #define MSC_H |
va009039 | 6:95be1cd2bc14 | 3 | #include "UsbHostMgr.h" |
va009039 | 6:95be1cd2bc14 | 4 | #include "UsbEndpoint.h" |
va009039 | 6:95be1cd2bc14 | 5 | #include "UsbBaseClass.h" |
va009039 | 6:95be1cd2bc14 | 6 | #include "FATFileSystem.h" |
va009039 | 6:95be1cd2bc14 | 7 | |
va009039 | 6:95be1cd2bc14 | 8 | #define SCSI_CMD_REQUEST_SENSE 0x03 |
va009039 | 6:95be1cd2bc14 | 9 | #define SCSI_CMD_TEST_UNIT_READY 0x00 |
va009039 | 6:95be1cd2bc14 | 10 | #define SCSI_CMD_INQUIRY 0x12 |
va009039 | 6:95be1cd2bc14 | 11 | #define SCSI_CMD_READ_10 0x28 |
va009039 | 6:95be1cd2bc14 | 12 | #define SCSI_CMD_READ_CAPACITY 0x25 |
va009039 | 6:95be1cd2bc14 | 13 | #define SCSI_CMD_WRITE_10 0x2A |
va009039 | 6:95be1cd2bc14 | 14 | |
va009039 | 6:95be1cd2bc14 | 15 | #pragma pack(push,1) |
va009039 | 6:95be1cd2bc14 | 16 | typedef struct stcbw { |
va009039 | 6:95be1cd2bc14 | 17 | uint32_t dCBWSignature; |
va009039 | 6:95be1cd2bc14 | 18 | uint32_t dCBWTag; |
va009039 | 6:95be1cd2bc14 | 19 | uint32_t dCBWDataTraansferLength; |
va009039 | 6:95be1cd2bc14 | 20 | uint8_t bmCBWFlags; |
va009039 | 6:95be1cd2bc14 | 21 | uint8_t bCBWLUN; |
va009039 | 6:95be1cd2bc14 | 22 | uint8_t bCBWCBLength; |
va009039 | 6:95be1cd2bc14 | 23 | uint8_t CBWCB[16]; |
va009039 | 6:95be1cd2bc14 | 24 | } CBW; |
va009039 | 6:95be1cd2bc14 | 25 | |
va009039 | 6:95be1cd2bc14 | 26 | typedef struct stcsw { |
va009039 | 6:95be1cd2bc14 | 27 | uint32_t dCSWSignature; |
va009039 | 6:95be1cd2bc14 | 28 | uint32_t dCSWTag; |
va009039 | 6:95be1cd2bc14 | 29 | uint32_t dCSWDataResidue; |
va009039 | 6:95be1cd2bc14 | 30 | uint8_t bCSWStatus; |
va009039 | 6:95be1cd2bc14 | 31 | } CSW; |
va009039 | 6:95be1cd2bc14 | 32 | #pragma pack(pop) |
va009039 | 6:95be1cd2bc14 | 33 | |
va009039 | 6:95be1cd2bc14 | 34 | class msc : public FATFileSystem, public UsbBaseClass { |
va009039 | 6:95be1cd2bc14 | 35 | public: |
va009039 | 6:95be1cd2bc14 | 36 | msc(const char* name = NULL, int drive = 0); |
va009039 | 6:95be1cd2bc14 | 37 | virtual int disk_initialize(); |
va009039 | 6:95be1cd2bc14 | 38 | virtual int disk_write(const uint8_t *buffer, uint64_t block_number); |
va009039 | 6:95be1cd2bc14 | 39 | virtual int disk_read(uint8_t *buffer, uint64_t block_number); |
va009039 | 6:95be1cd2bc14 | 40 | virtual int disk_status(); |
va009039 | 6:95be1cd2bc14 | 41 | virtual int disk_sync(); |
va009039 | 6:95be1cd2bc14 | 42 | virtual uint64_t disk_sectors(); |
va009039 | 6:95be1cd2bc14 | 43 | |
va009039 | 6:95be1cd2bc14 | 44 | int setup(int timeout = 9000); |
va009039 | 6:95be1cd2bc14 | 45 | void _test(); |
va009039 | 6:95be1cd2bc14 | 46 | private: |
va009039 | 6:95be1cd2bc14 | 47 | int ParseConfiguration(); |
va009039 | 6:95be1cd2bc14 | 48 | int BulkOnlyMassStorageReset(); |
va009039 | 6:95be1cd2bc14 | 49 | int GetMaxLUN(); |
va009039 | 6:95be1cd2bc14 | 50 | int ReadCapacity(); |
va009039 | 6:95be1cd2bc14 | 51 | int GetSenseInfo(); |
va009039 | 6:95be1cd2bc14 | 52 | int TestUnitReady(); |
va009039 | 6:95be1cd2bc14 | 53 | int Inquire(); |
va009039 | 6:95be1cd2bc14 | 54 | int MS_BulkRecv(uint32_t block_number, int num_blocks, uint8_t* user_buffer); |
va009039 | 6:95be1cd2bc14 | 55 | int MS_BulkSend(uint32_t block_number, int num_blocks, uint8_t* user_buffer); |
va009039 | 6:95be1cd2bc14 | 56 | int CommandTransport(const uint8_t* cdb, int size); |
va009039 | 6:95be1cd2bc14 | 57 | int StatusTransport(); |
va009039 | 6:95be1cd2bc14 | 58 | int _bulkRecv(uint8_t* buf, int size); |
va009039 | 6:95be1cd2bc14 | 59 | int _bulkSend(uint8_t* buf, int size); |
va009039 | 6:95be1cd2bc14 | 60 | const char* m_name; |
va009039 | 6:95be1cd2bc14 | 61 | int m_drive; |
va009039 | 6:95be1cd2bc14 | 62 | uint32_t m_numBlocks; |
va009039 | 6:95be1cd2bc14 | 63 | int m_BlockSize; |
va009039 | 6:95be1cd2bc14 | 64 | int m_lun; |
va009039 | 6:95be1cd2bc14 | 65 | int m_MaxLUN; |
va009039 | 6:95be1cd2bc14 | 66 | int m_interface; |
va009039 | 6:95be1cd2bc14 | 67 | uint32_t m_tag; |
va009039 | 6:95be1cd2bc14 | 68 | CBW m_CBW; |
va009039 | 6:95be1cd2bc14 | 69 | CSW m_CSW; |
va009039 | 6:95be1cd2bc14 | 70 | UsbDevice* m_pDev; |
va009039 | 6:95be1cd2bc14 | 71 | UsbEndpoint* m_pEpBulkIn; |
va009039 | 6:95be1cd2bc14 | 72 | UsbEndpoint* m_pEpBulkOut; |
va009039 | 6:95be1cd2bc14 | 73 | }; |
va009039 | 6:95be1cd2bc14 | 74 | |
va009039 | 6:95be1cd2bc14 | 75 | #endif // MSC_H |