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