Simple USBHost library for STM32F746NG Discovery board. Only either the Fastspeed or the Highspeed port can be used( not both together)

Dependents:   DISCO-F746NG_USB_Host

Fork of KL46Z-USBHost by Norimasa Okamoto

Committer:
va009039
Date:
Fri Jan 31 13:45:07 2014 +0000
Revision:
8:6463cd1964c0
Parent:
5:10bfc10afcc8
Child:
9:7f9f64cf5ded
USB hub support.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
va009039 8:6463cd1964c0 1 /* mbed USBHost Library
va009039 8:6463cd1964c0 2 * Copyright (c) 2006-2013 ARM Limited
va009039 8:6463cd1964c0 3 *
va009039 8:6463cd1964c0 4 * Licensed under the Apache License, Version 2.0 (the "License");
va009039 8:6463cd1964c0 5 * you may not use this file except in compliance with the License.
va009039 8:6463cd1964c0 6 * You may obtain a copy of the License at
va009039 8:6463cd1964c0 7 *
va009039 8:6463cd1964c0 8 * http://www.apache.org/licenses/LICENSE-2.0
va009039 8:6463cd1964c0 9 *
va009039 8:6463cd1964c0 10 * Unless required by applicable law or agreed to in writing, software
va009039 8:6463cd1964c0 11 * distributed under the License is distributed on an "AS IS" BASIS,
va009039 8:6463cd1964c0 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
va009039 8:6463cd1964c0 13 * See the License for the specific language governing permissions and
va009039 8:6463cd1964c0 14 * limitations under the License.
va009039 8:6463cd1964c0 15 */
va009039 8:6463cd1964c0 16
va009039 5:10bfc10afcc8 17 #pragma once
va009039 5:10bfc10afcc8 18 #include "USBHostTypes.h"
va009039 8:6463cd1964c0 19 #include "USBDeviceConnected.h"
va009039 8:6463cd1964c0 20 class USBDeviceConnected;
va009039 5:10bfc10afcc8 21
va009039 5:10bfc10afcc8 22 class USBEndpoint {
va009039 5:10bfc10afcc8 23 public:
va009039 8:6463cd1964c0 24 USBEndpoint() : data01_toggle(DATA0),address(0),MaxPacketSize(8) {
va009039 8:6463cd1964c0 25 dev = NULL;
va009039 8:6463cd1964c0 26 }
va009039 8:6463cd1964c0 27 void setDevice(USBDeviceConnected* _dev) { dev = _dev; }
va009039 5:10bfc10afcc8 28 void setState(uint8_t st){}; // dummy
va009039 8:6463cd1964c0 29 void setLengthTransferred(int len) { transferred = len; };
va009039 5:10bfc10afcc8 30 void setSize(int size) { MaxPacketSize = size; }
va009039 8:6463cd1964c0 31 void setType(ENDPOINT_TYPE _type) { type = _type; };
va009039 5:10bfc10afcc8 32 void setAddress(uint8_t addr) { address = addr; }
va009039 5:10bfc10afcc8 33 void setData01(uint8_t data01) { data01_toggle = data01; }
va009039 8:6463cd1964c0 34
va009039 8:6463cd1964c0 35 USBDeviceConnected* getDevice() { return dev; }
va009039 8:6463cd1964c0 36 ENDPOINT_TYPE getType() { return type; };
va009039 8:6463cd1964c0 37 int getLengthTransferred() { return transferred; }
va009039 5:10bfc10afcc8 38 uint8_t getAddress(){ return address; };
va009039 5:10bfc10afcc8 39 int getSize() { return MaxPacketSize; }
va009039 8:6463cd1964c0 40 ENDPOINT_DIRECTION getDir() { return (address & 0x80) ? IN : OUT; }
va009039 5:10bfc10afcc8 41 uint8_t getData01() { return data01_toggle; }
va009039 5:10bfc10afcc8 42 void toggleData01() {
va009039 5:10bfc10afcc8 43 data01_toggle = (data01_toggle == DATA0) ? DATA1 : DATA0;
va009039 5:10bfc10afcc8 44 }
va009039 5:10bfc10afcc8 45
va009039 5:10bfc10afcc8 46 private:
va009039 8:6463cd1964c0 47 ENDPOINT_TYPE type;
va009039 8:6463cd1964c0 48 ENDPOINT_DIRECTION dir;
va009039 8:6463cd1964c0 49 USBDeviceConnected* dev;
va009039 5:10bfc10afcc8 50 uint8_t data01_toggle; // DATA0,DATA1
va009039 5:10bfc10afcc8 51 uint8_t address;
va009039 8:6463cd1964c0 52 int transferred;
va009039 5:10bfc10afcc8 53 int MaxPacketSize;
va009039 5:10bfc10afcc8 54 };