BLE demo for mbed Ported RunningElectronics's SBDBT firmware for BLE. It can communicate with iOS
Dependencies: FatFileSystem mbed
Fork of BTstack by
msc.h
00001 #ifndef MSC_H 00002 #define MSC_H 00003 #include "UsbHostMgr.h" 00004 #include "UsbEndpoint.h" 00005 #include "UsbBaseClass.h" 00006 #include "FATFileSystem.h" 00007 00008 #define SCSI_CMD_REQUEST_SENSE 0x03 00009 #define SCSI_CMD_TEST_UNIT_READY 0x00 00010 #define SCSI_CMD_INQUIRY 0x12 00011 #define SCSI_CMD_READ_10 0x28 00012 #define SCSI_CMD_READ_CAPACITY 0x25 00013 #define SCSI_CMD_WRITE_10 0x2A 00014 00015 #pragma pack(push,1) 00016 typedef struct stcbw { 00017 uint32_t dCBWSignature; 00018 uint32_t dCBWTag; 00019 uint32_t dCBWDataTraansferLength; 00020 uint8_t bmCBWFlags; 00021 uint8_t bCBWLUN; 00022 uint8_t bCBWCBLength; 00023 uint8_t CBWCB[16]; 00024 } CBW; 00025 00026 typedef struct stcsw { 00027 uint32_t dCSWSignature; 00028 uint32_t dCSWTag; 00029 uint32_t dCSWDataResidue; 00030 uint8_t bCSWStatus; 00031 } CSW; 00032 #pragma pack(pop) 00033 00034 class msc : public FATFileSystem, public UsbBaseClass { 00035 public: 00036 msc(const char* name = NULL, int drive = 0); 00037 virtual int disk_initialize(); 00038 virtual int disk_write(const char *buffer, int block_number); 00039 virtual int disk_read(char *buffer, int block_number); 00040 virtual int disk_status(); 00041 virtual int disk_sync(); 00042 virtual int disk_sectors(); 00043 00044 int setup(int timeout = 9000); 00045 void _test(); 00046 private: 00047 int ParseConfiguration(); 00048 int BulkOnlyMassStorageReset(); 00049 int GetMaxLUN(); 00050 int ReadCapacity(); 00051 int GetSenseInfo(); 00052 int TestUnitReady(); 00053 int Inquire(); 00054 int MS_BulkRecv(uint32_t block_number, int num_blocks, uint8_t* user_buffer); 00055 int MS_BulkSend(uint32_t block_number, int num_blocks, uint8_t* user_buffer); 00056 int CommandTransport(const uint8_t* cdb, int size); 00057 int StatusTransport(); 00058 int _bulkRecv(uint8_t* buf, int size); 00059 int _bulkSend(uint8_t* buf, int size); 00060 const char* m_name; 00061 int m_drive; 00062 uint32_t m_numBlocks; 00063 int m_BlockSize; 00064 int m_lun; 00065 int m_MaxLUN; 00066 int m_interface; 00067 uint32_t m_tag; 00068 CBW m_CBW; 00069 CSW m_CSW; 00070 UsbDevice* m_pDev; 00071 UsbEndpoint* m_pEpBulkIn; 00072 UsbEndpoint* m_pEpBulkOut; 00073 }; 00074 00075 #endif // MSC_H
Generated on Thu Jul 14 2022 15:03:49 by 1.7.2