USBMSD SD card Hello World for Mbed platforms

Dependencies:   mbed USBMSD_SD USBDevice

Committer:
samux
Date:
Tue Dec 06 12:07:12 2011 +0000
Revision:
14:757226626acb
protection enabled when usb cable plugged. filesystem has no access when plugged

Who changed what in which revision?

UserRevisionLine numberNew contents of line
samux 14:757226626acb 1 /* USBBusInterface.h */
samux 14:757226626acb 2 /* USB Bus Interface */
samux 14:757226626acb 3 /* Copyright (c) 2011 ARM Limited. All rights reserved. */
samux 14:757226626acb 4
samux 14:757226626acb 5 #ifndef USBBUSINTERFACE_H
samux 14:757226626acb 6 #define USBBUSINTERFACE_H
samux 14:757226626acb 7
samux 14:757226626acb 8 #include "mbed.h"
samux 14:757226626acb 9 #include "USBEndpoints.h"
samux 14:757226626acb 10
samux 14:757226626acb 11 class USBHAL {
samux 14:757226626acb 12 public:
samux 14:757226626acb 13 /* Configuration */
samux 14:757226626acb 14 USBHAL();
samux 14:757226626acb 15 ~USBHAL();
samux 14:757226626acb 16 void connect(void);
samux 14:757226626acb 17 void disconnect(void);
samux 14:757226626acb 18 void configureDevice(void);
samux 14:757226626acb 19 void unconfigureDevice(void);
samux 14:757226626acb 20 void setAddress(uint8_t address);
samux 14:757226626acb 21 void remoteWakeup(void);
samux 14:757226626acb 22
samux 14:757226626acb 23 /* Endpoint 0 */
samux 14:757226626acb 24 void EP0setup(uint8_t *buffer);
samux 14:757226626acb 25 void EP0read(void);
samux 14:757226626acb 26 uint32_t EP0getReadResult(uint8_t *buffer);
samux 14:757226626acb 27 void EP0write(uint8_t *buffer, uint32_t size);
samux 14:757226626acb 28 void EP0getWriteResult(void);
samux 14:757226626acb 29 void EP0stall(void);
samux 14:757226626acb 30
samux 14:757226626acb 31 /* Other endpoints */
samux 14:757226626acb 32 EP_STATUS endpointRead(uint8_t endpoint, uint32_t maximumSize);
samux 14:757226626acb 33 EP_STATUS endpointReadResult(uint8_t endpoint, uint8_t *data, uint32_t *bytesRead);
samux 14:757226626acb 34 EP_STATUS endpointWrite(uint8_t endpoint, uint8_t *data, uint32_t size);
samux 14:757226626acb 35 EP_STATUS endpointWriteResult(uint8_t endpoint);
samux 14:757226626acb 36 void stallEndpoint(uint8_t endpoint);
samux 14:757226626acb 37 void unstallEndpoint(uint8_t endpoint);
samux 14:757226626acb 38 bool realiseEndpoint(uint8_t endpoint, uint32_t maxPacket, uint32_t options);
samux 14:757226626acb 39 bool getEndpointStallState(unsigned char endpoint);
samux 14:757226626acb 40 uint32_t endpointReadcore(uint8_t endpoint, uint8_t *buffer);
samux 14:757226626acb 41
samux 14:757226626acb 42 protected:
samux 14:757226626acb 43 virtual void busReset(void){};
samux 14:757226626acb 44 virtual void EP0setupCallback(void){};
samux 14:757226626acb 45 virtual void EP0out(void){};
samux 14:757226626acb 46 virtual void EP0in(void){};
samux 14:757226626acb 47 virtual void connectStateChanged(unsigned int connected){};
samux 14:757226626acb 48 virtual void suspendStateChanged(unsigned int suspended){};
samux 14:757226626acb 49 virtual void SOF(int frameNumber){};
samux 14:757226626acb 50 virtual bool EP1_OUT_callback(){return false;};
samux 14:757226626acb 51 virtual bool EP1_IN_callback(){return false;};
samux 14:757226626acb 52 virtual bool EP2_OUT_callback(){return false;};
samux 14:757226626acb 53 virtual bool EP2_IN_callback(){return false;};
samux 14:757226626acb 54 virtual bool EP3_OUT_callback(){return false;};
samux 14:757226626acb 55 virtual bool EP3_IN_callback(){return false;};
samux 14:757226626acb 56
samux 14:757226626acb 57 private:
samux 14:757226626acb 58 void usbisr(void);
samux 14:757226626acb 59 static void _usbisr(void);
samux 14:757226626acb 60 static USBHAL * instance;
samux 14:757226626acb 61 };
samux 14:757226626acb 62 #endif
samux 14:757226626acb 63
samux 14:757226626acb 64