JBBoardに接続したモーター2つをRCBControllerでコントロールするテストです。

Dependencies:   FatFileSystem TB6612FNG2 mbed

Fork of JBB_BTLE_Test by Jksoft Blue mbed Board Developer

Committer:
jksoft
Date:
Mon May 12 14:24:35 2014 +0000
Revision:
7:3ed1e36587d4
Parent:
0:1ed23ab1345f
First edition

Who changed what in which revision?

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