SD card interface

Committer:
lharoon
Date:
Mon Oct 08 11:14:07 2012 +0000
Revision:
0:22612ae617a0
1st edition

Who changed what in which revision?

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