USBMSD SD card Hello World for Mbed platforms
Dependencies: mbed USBMSD_SD USBDevice
USBDevice/USBDevice/USBBusInterface.h@2:27a7e7f8d399, 2011-11-11 (annotated)
- Committer:
- samux
- Date:
- Fri Nov 11 15:22:53 2011 +0000
- Revision:
- 2:27a7e7f8d399
we have 2MB with the sdcard!!
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
samux |
2:27a7e7f8d399 | 1 | /* USBBusInterface.h */ |
samux |
2:27a7e7f8d399 | 2 | /* USB Bus Interface */ |
samux |
2:27a7e7f8d399 | 3 | /* Copyright (c) 2011 ARM Limited. All rights reserved. */ |
samux |
2:27a7e7f8d399 | 4 | |
samux |
2:27a7e7f8d399 | 5 | #ifndef USBBUSINTERFACE_H |
samux |
2:27a7e7f8d399 | 6 | #define USBBUSINTERFACE_H |
samux |
2:27a7e7f8d399 | 7 | |
samux |
2:27a7e7f8d399 | 8 | #include "mbed.h" |
samux |
2:27a7e7f8d399 | 9 | #include "USBEndpoints.h" |
samux |
2:27a7e7f8d399 | 10 | |
samux |
2:27a7e7f8d399 | 11 | class USBHAL { |
samux |
2:27a7e7f8d399 | 12 | public: |
samux |
2:27a7e7f8d399 | 13 | /* Configuration */ |
samux |
2:27a7e7f8d399 | 14 | USBHAL(); |
samux |
2:27a7e7f8d399 | 15 | ~USBHAL(); |
samux |
2:27a7e7f8d399 | 16 | void connect(void); |
samux |
2:27a7e7f8d399 | 17 | void disconnect(void); |
samux |
2:27a7e7f8d399 | 18 | void configureDevice(void); |
samux |
2:27a7e7f8d399 | 19 | void unconfigureDevice(void); |
samux |
2:27a7e7f8d399 | 20 | void setAddress(uint8_t address); |
samux |
2:27a7e7f8d399 | 21 | void remoteWakeup(void); |
samux |
2:27a7e7f8d399 | 22 | |
samux |
2:27a7e7f8d399 | 23 | /* Endpoint 0 */ |
samux |
2:27a7e7f8d399 | 24 | void EP0setup(uint8_t *buffer); |
samux |
2:27a7e7f8d399 | 25 | void EP0read(void); |
samux |
2:27a7e7f8d399 | 26 | uint32_t EP0getReadResult(uint8_t *buffer); |
samux |
2:27a7e7f8d399 | 27 | void EP0write(uint8_t *buffer, uint32_t size); |
samux |
2:27a7e7f8d399 | 28 | void EP0getWriteResult(void); |
samux |
2:27a7e7f8d399 | 29 | void EP0stall(void); |
samux |
2:27a7e7f8d399 | 30 | |
samux |
2:27a7e7f8d399 | 31 | /* Other endpoints */ |
samux |
2:27a7e7f8d399 | 32 | EP_STATUS endpointRead(uint8_t endpoint, uint32_t maximumSize); |
samux |
2:27a7e7f8d399 | 33 | EP_STATUS endpointReadResult(uint8_t endpoint, uint8_t *data, uint32_t *bytesRead); |
samux |
2:27a7e7f8d399 | 34 | EP_STATUS endpointWrite(uint8_t endpoint, uint8_t *data, uint32_t size); |
samux |
2:27a7e7f8d399 | 35 | EP_STATUS endpointWriteResult(uint8_t endpoint); |
samux |
2:27a7e7f8d399 | 36 | void stallEndpoint(uint8_t endpoint); |
samux |
2:27a7e7f8d399 | 37 | void unstallEndpoint(uint8_t endpoint); |
samux |
2:27a7e7f8d399 | 38 | bool realiseEndpoint(uint8_t endpoint, uint32_t maxPacket, uint32_t options); |
samux |
2:27a7e7f8d399 | 39 | bool getEndpointStallState(unsigned char endpoint); |
samux |
2:27a7e7f8d399 | 40 | |
samux |
2:27a7e7f8d399 | 41 | protected: |
samux |
2:27a7e7f8d399 | 42 | virtual void busReset(void){}; |
samux |
2:27a7e7f8d399 | 43 | virtual void EP0setupCallback(void){}; |
samux |
2:27a7e7f8d399 | 44 | virtual void EP0out(void){}; |
samux |
2:27a7e7f8d399 | 45 | virtual void EP0in(void){}; |
samux |
2:27a7e7f8d399 | 46 | virtual void connectStateChanged(unsigned int connected){}; |
samux |
2:27a7e7f8d399 | 47 | virtual void suspendStateChanged(unsigned int suspended){}; |
samux |
2:27a7e7f8d399 | 48 | virtual void SOF(int frameNumber){}; |
samux |
2:27a7e7f8d399 | 49 | virtual bool EP1_OUT_callback(){return false;}; |
samux |
2:27a7e7f8d399 | 50 | virtual bool EP1_IN_callback(){return false;}; |
samux |
2:27a7e7f8d399 | 51 | virtual bool EP2_OUT_callback(){return false;}; |
samux |
2:27a7e7f8d399 | 52 | virtual bool EP2_IN_callback(){return false;}; |
samux |
2:27a7e7f8d399 | 53 | virtual bool EP3_OUT_callback(){return false;}; |
samux |
2:27a7e7f8d399 | 54 | virtual bool EP3_IN_callback(){return false;}; |
samux |
2:27a7e7f8d399 | 55 | |
samux |
2:27a7e7f8d399 | 56 | private: |
samux |
2:27a7e7f8d399 | 57 | void usbisr(void); |
samux |
2:27a7e7f8d399 | 58 | static void _usbisr(void); |
samux |
2:27a7e7f8d399 | 59 | static USBHAL * instance; |
samux |
2:27a7e7f8d399 | 60 | }; |
samux |
2:27a7e7f8d399 | 61 | #endif |
samux |
2:27a7e7f8d399 | 62 | |
samux |
2:27a7e7f8d399 | 63 |