![](/media/cache/profiles/31857b449c407203749ae32dd0e7d64a.50x50_q85.jpg)
EA BaseBoard, playing wav, PC see\'s SD-card through USB port.
USBDevice/USBDevice/USBBusInterface.h@0:fef366d2ed20, 2011-11-22 (annotated)
- Committer:
- Lerche
- Date:
- Tue Nov 22 05:45:58 2011 +0000
- Revision:
- 0:fef366d2ed20
Thanks to those who provided EA_WavPlayer and USB_MSC
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Lerche | 0:fef366d2ed20 | 1 | /* USBBusInterface.h */ |
Lerche | 0:fef366d2ed20 | 2 | /* USB Bus Interface */ |
Lerche | 0:fef366d2ed20 | 3 | /* Copyright (c) 2011 ARM Limited. All rights reserved. */ |
Lerche | 0:fef366d2ed20 | 4 | |
Lerche | 0:fef366d2ed20 | 5 | #ifndef USBBUSINTERFACE_H |
Lerche | 0:fef366d2ed20 | 6 | #define USBBUSINTERFACE_H |
Lerche | 0:fef366d2ed20 | 7 | |
Lerche | 0:fef366d2ed20 | 8 | #include "mbed.h" |
Lerche | 0:fef366d2ed20 | 9 | #include "USBEndpoints.h" |
Lerche | 0:fef366d2ed20 | 10 | |
Lerche | 0:fef366d2ed20 | 11 | class USBHAL { |
Lerche | 0:fef366d2ed20 | 12 | public: |
Lerche | 0:fef366d2ed20 | 13 | /* Configuration */ |
Lerche | 0:fef366d2ed20 | 14 | USBHAL(); |
Lerche | 0:fef366d2ed20 | 15 | ~USBHAL(); |
Lerche | 0:fef366d2ed20 | 16 | void connect(void); |
Lerche | 0:fef366d2ed20 | 17 | void disconnect(void); |
Lerche | 0:fef366d2ed20 | 18 | void configureDevice(void); |
Lerche | 0:fef366d2ed20 | 19 | void unconfigureDevice(void); |
Lerche | 0:fef366d2ed20 | 20 | void setAddress(uint8_t address); |
Lerche | 0:fef366d2ed20 | 21 | void remoteWakeup(void); |
Lerche | 0:fef366d2ed20 | 22 | |
Lerche | 0:fef366d2ed20 | 23 | /* Endpoint 0 */ |
Lerche | 0:fef366d2ed20 | 24 | void EP0setup(uint8_t *buffer); |
Lerche | 0:fef366d2ed20 | 25 | void EP0read(void); |
Lerche | 0:fef366d2ed20 | 26 | uint32_t EP0getReadResult(uint8_t *buffer); |
Lerche | 0:fef366d2ed20 | 27 | void EP0write(uint8_t *buffer, uint32_t size); |
Lerche | 0:fef366d2ed20 | 28 | void EP0getWriteResult(void); |
Lerche | 0:fef366d2ed20 | 29 | void EP0stall(void); |
Lerche | 0:fef366d2ed20 | 30 | |
Lerche | 0:fef366d2ed20 | 31 | /* Other endpoints */ |
Lerche | 0:fef366d2ed20 | 32 | EP_STATUS endpointRead(uint8_t endpoint, uint32_t maximumSize); |
Lerche | 0:fef366d2ed20 | 33 | EP_STATUS endpointReadResult(uint8_t endpoint, uint8_t *data, uint32_t *bytesRead); |
Lerche | 0:fef366d2ed20 | 34 | EP_STATUS endpointWrite(uint8_t endpoint, uint8_t *data, uint32_t size); |
Lerche | 0:fef366d2ed20 | 35 | EP_STATUS endpointWriteResult(uint8_t endpoint); |
Lerche | 0:fef366d2ed20 | 36 | void stallEndpoint(uint8_t endpoint); |
Lerche | 0:fef366d2ed20 | 37 | void unstallEndpoint(uint8_t endpoint); |
Lerche | 0:fef366d2ed20 | 38 | bool realiseEndpoint(uint8_t endpoint, uint32_t maxPacket, uint32_t options); |
Lerche | 0:fef366d2ed20 | 39 | bool getEndpointStallState(unsigned char endpoint); |
Lerche | 0:fef366d2ed20 | 40 | |
Lerche | 0:fef366d2ed20 | 41 | void NakIntEnable(int frameNumber); |
Lerche | 0:fef366d2ed20 | 42 | |
Lerche | 0:fef366d2ed20 | 43 | protected: |
Lerche | 0:fef366d2ed20 | 44 | virtual void busReset(void){}; |
Lerche | 0:fef366d2ed20 | 45 | virtual void EP0setupCallback(void){}; |
Lerche | 0:fef366d2ed20 | 46 | virtual void EP0out(void){}; |
Lerche | 0:fef366d2ed20 | 47 | virtual void EP0in(void){}; |
Lerche | 0:fef366d2ed20 | 48 | virtual void connectStateChanged(unsigned int connected){}; |
Lerche | 0:fef366d2ed20 | 49 | virtual void suspendStateChanged(unsigned int suspended){}; |
Lerche | 0:fef366d2ed20 | 50 | void SOF(int frameNumber){}; |
Lerche | 0:fef366d2ed20 | 51 | virtual bool EPBULK_OUT_callback(){return false;}; |
Lerche | 0:fef366d2ed20 | 52 | virtual bool EPBULK_IN_callback(){return false;}; |
Lerche | 0:fef366d2ed20 | 53 | |
Lerche | 0:fef366d2ed20 | 54 | private: |
Lerche | 0:fef366d2ed20 | 55 | void usbisr(void); |
Lerche | 0:fef366d2ed20 | 56 | static void _usbisr(void); |
Lerche | 0:fef366d2ed20 | 57 | static USBHAL * instance; |
Lerche | 0:fef366d2ed20 | 58 | }; |
Lerche | 0:fef366d2ed20 | 59 | #endif |
Lerche | 0:fef366d2ed20 | 60 | |
Lerche | 0:fef366d2ed20 | 61 |