Usb read

Dependencies:   FATFileSystem

Fork of F401RE-USBHost by Norimasa Okamoto

Revision:
16:981c3104f6c0
Parent:
11:61843badd06e
Child:
18:61554f238584
diff -r d14c06cc5c07 -r 981c3104f6c0 USBHost/USBHALHost_F401RE.h
--- a/USBHost/USBHALHost_F401RE.h	Fri Jun 13 01:52:44 2014 +0000
+++ b/USBHost/USBHALHost_F401RE.h	Mon Jun 23 20:30:04 2014 +0900
@@ -12,6 +12,29 @@
     uint16_t wLength;
 };
 
+class HC {
+    static const uint8_t DIR_IN  = 1;
+    static const uint8_t DIR_OUT = 0;
+
+public:
+    HC();
+    HC(int ch);
+    ~HC();
+    HAL_StatusTypeDef Init(uint8_t epnum, uint8_t dev_address, uint8_t speed, uint8_t ep_type, uint16_t mps);
+    HAL_StatusTypeDef SubmitRequest(uint8_t* pbuff, uint16_t length, bool setup = false);
+    HCD_URBStateTypeDef GetURBState();
+    HCD_HCStateTypeDef GetState();
+    uint32_t GetXferCount();
+    void SetToggle(uint8_t toggle);
+
+    static uint8_t slot;
+
+private:
+    int _ch;
+    uint8_t _ep_addr;
+    uint8_t _ep_type;
+};
+
 class USBHALHost {
 public:
     uint8_t LastStatus;
@@ -25,12 +48,14 @@
     void setEndpoint(){}
     void token_transfer_init(){}
     int token_setup(USBEndpoint* ep, SETUP_PACKET* setup, uint16_t wLength = 0);
+    int token_iso_in(USBEndpoint* ep, uint8_t* data, int size);
+    void token_ready(){}
+    int multi_token_in(USBEndpoint* ep, uint8_t* data = NULL, size_t total = 0, bool block = true);
+    int multi_token_out(USBEndpoint* ep, const uint8_t* data = NULL, size_t total = 0, bool block = true);
+
+private:
     int token_in(USBEndpoint* ep, uint8_t* data = NULL, int size = 0, int retryLimit = 10);
     int token_out(USBEndpoint* ep, const uint8_t* data = NULL, int size = 0, int retryLimit = 10);
-    int token_iso_in(USBEndpoint* ep, uint8_t* data, int size);
-    void token_ready(){}
-
-private:
     int token_ctl_in(USBEndpoint* ep, uint8_t* data, int size, int retryLimit);
     int token_int_in(USBEndpoint* ep, uint8_t* data, int size);
     int token_blk_in(USBEndpoint* ep, uint8_t* data, int size, int retryLimit);