USB Host Driver with Socket Modem support. Works with revision 323 of mbed-src but broken with any later version.

Dependencies:   FATFileSystem

Fork of F401RE-USBHost by Norimasa Okamoto

Committer:
va009039
Date:
Tue Jul 01 18:33:31 2014 +0900
Revision:
18:61554f238584
Parent:
16:981c3104f6c0
add lpc4088/lpc1768

Who changed what in which revision?

UserRevisionLine numberNew contents of line
va009039 11:61843badd06e 1 #pragma once
va009039 11:61843badd06e 2 #include "mbed.h"
va009039 11:61843badd06e 3 #include "USBHostTypes.h"
va009039 11:61843badd06e 4 #include "USBEndpoint.h"
va009039 11:61843badd06e 5
va009039 16:981c3104f6c0 6 class HC {
va009039 16:981c3104f6c0 7 static const uint8_t DIR_IN = 1;
va009039 16:981c3104f6c0 8 static const uint8_t DIR_OUT = 0;
va009039 16:981c3104f6c0 9
va009039 16:981c3104f6c0 10 public:
va009039 16:981c3104f6c0 11 HC();
va009039 16:981c3104f6c0 12 HC(int ch);
va009039 16:981c3104f6c0 13 ~HC();
va009039 16:981c3104f6c0 14 HAL_StatusTypeDef Init(uint8_t epnum, uint8_t dev_address, uint8_t speed, uint8_t ep_type, uint16_t mps);
va009039 16:981c3104f6c0 15 HAL_StatusTypeDef SubmitRequest(uint8_t* pbuff, uint16_t length, bool setup = false);
va009039 16:981c3104f6c0 16 HCD_URBStateTypeDef GetURBState();
va009039 16:981c3104f6c0 17 HCD_HCStateTypeDef GetState();
va009039 16:981c3104f6c0 18 uint32_t GetXferCount();
va009039 16:981c3104f6c0 19 void SetToggle(uint8_t toggle);
va009039 16:981c3104f6c0 20
va009039 16:981c3104f6c0 21 static uint8_t slot;
va009039 16:981c3104f6c0 22
va009039 16:981c3104f6c0 23 private:
va009039 16:981c3104f6c0 24 int _ch;
va009039 16:981c3104f6c0 25 uint8_t _ep_addr;
va009039 16:981c3104f6c0 26 uint8_t _ep_type;
va009039 16:981c3104f6c0 27 };
va009039 16:981c3104f6c0 28
va009039 11:61843badd06e 29 class USBHALHost {
va009039 11:61843badd06e 30 public:
va009039 11:61843badd06e 31 uint8_t LastStatus;
va009039 11:61843badd06e 32 uint8_t prev_LastStatus;
va009039 11:61843badd06e 33
va009039 11:61843badd06e 34 protected:
va009039 11:61843badd06e 35 USBHALHost();
va009039 11:61843badd06e 36 void init();
va009039 11:61843badd06e 37 virtual bool addDevice(USBDeviceConnected* parent, int port, bool lowSpeed) = 0;
va009039 11:61843badd06e 38 int token_setup(USBEndpoint* ep, SETUP_PACKET* setup, uint16_t wLength = 0);
va009039 16:981c3104f6c0 39 int token_iso_in(USBEndpoint* ep, uint8_t* data, int size);
va009039 16:981c3104f6c0 40 int multi_token_in(USBEndpoint* ep, uint8_t* data = NULL, size_t total = 0, bool block = true);
va009039 18:61554f238584 41 int multi_token_out(USBEndpoint* ep, const uint8_t* data = NULL, size_t total = 0);
va009039 18:61554f238584 42 void multi_token_inNB(USBEndpoint* ep, uint8_t* data, int size);
va009039 18:61554f238584 43 USB_TYPE multi_token_inNB_result(USBEndpoint* ep);
va009039 18:61554f238584 44 void setToggle(USBEndpoint* ep, uint8_t toggle);
va009039 16:981c3104f6c0 45
va009039 16:981c3104f6c0 46 private:
va009039 11:61843badd06e 47 int token_in(USBEndpoint* ep, uint8_t* data = NULL, int size = 0, int retryLimit = 10);
va009039 11:61843badd06e 48 int token_out(USBEndpoint* ep, const uint8_t* data = NULL, int size = 0, int retryLimit = 10);
va009039 11:61843badd06e 49 int token_ctl_in(USBEndpoint* ep, uint8_t* data, int size, int retryLimit);
va009039 11:61843badd06e 50 int token_int_in(USBEndpoint* ep, uint8_t* data, int size);
va009039 11:61843badd06e 51 int token_blk_in(USBEndpoint* ep, uint8_t* data, int size, int retryLimit);
va009039 11:61843badd06e 52 int token_ctl_out(USBEndpoint* ep, const uint8_t* data, int size, int retryLimit);
va009039 11:61843badd06e 53 int token_int_out(USBEndpoint* ep, const uint8_t* data, int size);
va009039 11:61843badd06e 54 int token_blk_out(USBEndpoint* ep, const uint8_t* data, int size, int retryLimit);
va009039 11:61843badd06e 55 bool wait_attach();
va009039 11:61843badd06e 56 static USBHALHost * instHost;
va009039 11:61843badd06e 57 };
va009039 11:61843badd06e 58