mX mbed BaseBoard USB HID

Dependencies:   mbed

Committer:
ashwin_athani
Date:
Wed Dec 08 06:30:25 2010 +0000
Revision:
0:093612081f64

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ashwin_athani 0:093612081f64 1 /* usbdc.h */
ashwin_athani 0:093612081f64 2 /* USB device controller */
ashwin_athani 0:093612081f64 3 /* Copyright (c) Phil Wright 2008 */
ashwin_athani 0:093612081f64 4
ashwin_athani 0:093612081f64 5 #ifndef USBDC_H
ashwin_athani 0:093612081f64 6 #define USBDC_H
ashwin_athani 0:093612081f64 7
ashwin_athani 0:093612081f64 8 /* Endpoints */
ashwin_athani 0:093612081f64 9 #define EP0OUT (0) /* Control */
ashwin_athani 0:093612081f64 10 #define EP0IN (1) /* Control */
ashwin_athani 0:093612081f64 11 #define EP1OUT (2) /* Interrupt */
ashwin_athani 0:093612081f64 12 #define EP1IN (3) /* Interrupt */
ashwin_athani 0:093612081f64 13 #define EP2OUT (4) /* Bulk */
ashwin_athani 0:093612081f64 14 #define EP2IN (5) /* Bulk */
ashwin_athani 0:093612081f64 15
ashwin_athani 0:093612081f64 16 #include "mbed.h"
ashwin_athani 0:093612081f64 17
ashwin_athani 0:093612081f64 18 class usbdc : public Base
ashwin_athani 0:093612081f64 19 {
ashwin_athani 0:093612081f64 20 public:
ashwin_athani 0:093612081f64 21 usbdc();
ashwin_athani 0:093612081f64 22 void connect(void);
ashwin_athani 0:093612081f64 23 void disconnect(void);
ashwin_athani 0:093612081f64 24 protected:
ashwin_athani 0:093612081f64 25 void setAddress(unsigned char address);
ashwin_athani 0:093612081f64 26 void realiseEndpoint(unsigned char endpoint, unsigned long maxPacket);
ashwin_athani 0:093612081f64 27 void enableEndpointEvent(unsigned char endpoint);
ashwin_athani 0:093612081f64 28 void disableEndpointEvent(unsigned char endpoint);
ashwin_athani 0:093612081f64 29 void stallEndpoint(unsigned char endpoint);
ashwin_athani 0:093612081f64 30 void unstallEndpoint(unsigned char endpoint);
ashwin_athani 0:093612081f64 31 bool getEndpointStallState(unsigned char endpoint);
ashwin_athani 0:093612081f64 32 void configureDevice(void);
ashwin_athani 0:093612081f64 33 void unconfigureDevice(void);
ashwin_athani 0:093612081f64 34 unsigned long endpointRead(unsigned char endpoint, unsigned char *buffer);
ashwin_athani 0:093612081f64 35 void endpointWrite(unsigned char endpoint, unsigned char *buffer, unsigned long size);
ashwin_athani 0:093612081f64 36 void enableEvents(void);
ashwin_athani 0:093612081f64 37 void disableEvents(void);
ashwin_athani 0:093612081f64 38 virtual void deviceEventReset(void);
ashwin_athani 0:093612081f64 39 virtual void deviceEventFrame(void);
ashwin_athani 0:093612081f64 40 virtual void endpointEventEP0Setup(void);
ashwin_athani 0:093612081f64 41 virtual void endpointEventEP0In(void);
ashwin_athani 0:093612081f64 42 virtual void endpointEventEP0Out(void);
ashwin_athani 0:093612081f64 43 virtual void endpointEventEP1In(void);
ashwin_athani 0:093612081f64 44 virtual void endpointEventEP1Out(void);
ashwin_athani 0:093612081f64 45 virtual void endpointEventEP2In(void);
ashwin_athani 0:093612081f64 46 virtual void endpointEventEP2Out(void);
ashwin_athani 0:093612081f64 47 private:
ashwin_athani 0:093612081f64 48 void SIECommand(unsigned long command);
ashwin_athani 0:093612081f64 49 void SIEWriteData(unsigned char data);
ashwin_athani 0:093612081f64 50 unsigned char SIEReadData(unsigned long command);
ashwin_athani 0:093612081f64 51 void setDeviceStatus(unsigned char status);
ashwin_athani 0:093612081f64 52 void setEndpointStatus(unsigned char endpoint, unsigned char status);
ashwin_athani 0:093612081f64 53 unsigned char getDeviceStatus(void);
ashwin_athani 0:093612081f64 54 unsigned char selectEndpoint(unsigned char endpoint);
ashwin_athani 0:093612081f64 55 unsigned char selectEndpointClearInterrupt(unsigned char endpoint);
ashwin_athani 0:093612081f64 56 unsigned char clearBuffer(void);
ashwin_athani 0:093612081f64 57 void validateBuffer(void);
ashwin_athani 0:093612081f64 58 void usbisr(void);
ashwin_athani 0:093612081f64 59 unsigned long endpointStallState;
ashwin_athani 0:093612081f64 60 static void _usbisr(void);
ashwin_athani 0:093612081f64 61 static usbdc *instance;
ashwin_athani 0:093612081f64 62 };
ashwin_athani 0:093612081f64 63
ashwin_athani 0:093612081f64 64
ashwin_athani 0:093612081f64 65 #endif