Committer:
chris
Date:
Fri Oct 21 23:02:16 2011 +0000
Revision:
1:4d08e0ebf5dd
Parent:
0:e98d1c2b16c6

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
chris 0:e98d1c2b16c6 1 /* USBDevice.h */
chris 0:e98d1c2b16c6 2 /* Generic USB device */
chris 0:e98d1c2b16c6 3 /* Copyright (c) 2011 ARM Limited. All rights reserved. */
chris 0:e98d1c2b16c6 4
chris 0:e98d1c2b16c6 5 #ifndef _USB_DEVICE_
chris 0:e98d1c2b16c6 6 #define _USB_DEVICE_
chris 0:e98d1c2b16c6 7
chris 0:e98d1c2b16c6 8 #include "mbed.h" //for NULL
chris 0:e98d1c2b16c6 9 #include "USBDevice_Types.h"
chris 0:e98d1c2b16c6 10
chris 0:e98d1c2b16c6 11 bool USBDevice_init(void);
chris 0:e98d1c2b16c6 12 void USBDevice_uninit(void);
chris 0:e98d1c2b16c6 13 bool USBDevice_isConfigured(void);
chris 0:e98d1c2b16c6 14 void USBDevice_connect(void);
chris 0:e98d1c2b16c6 15 void USBDevice_disconnect(void);
chris 0:e98d1c2b16c6 16 CONTROL_TRANSFER *USBDevice_getTransferPtr(void);
chris 0:e98d1c2b16c6 17 bool USBDevice_addEndpoint(uint8_t endpoint, uint32_t maxPacket);
chris 0:e98d1c2b16c6 18 bool USBDevice_addRateFeedbackEndpoint(uint8_t endpoint, uint32_t maxPacket);
chris 0:e98d1c2b16c6 19
chris 0:e98d1c2b16c6 20
chris 0:e98d1c2b16c6 21 /* Endpoint events that must be implemented by device layer: */
chris 0:e98d1c2b16c6 22 void USBDevice_EP0setup(void);
chris 0:e98d1c2b16c6 23 void USBDevice_EP0out(void);
chris 0:e98d1c2b16c6 24 void USBDevice_EP0in(void);
chris 0:e98d1c2b16c6 25
chris 0:e98d1c2b16c6 26 /* Endpoint events that are optionally implemented by device layer: */
chris 0:e98d1c2b16c6 27 void USBDevice_busReset(void);
chris 0:e98d1c2b16c6 28 void USBDevice_SOF(uint16_t frameNumber);
chris 0:e98d1c2b16c6 29 void USBDevice_connectStateChanged(unsigned int state);
chris 0:e98d1c2b16c6 30 void USBDevice_suspendStateChanged(unsigned int state);
chris 0:e98d1c2b16c6 31
chris 0:e98d1c2b16c6 32 uint8_t * USBDevice_findDescriptor(uint8_t descriptorType);
chris 0:e98d1c2b16c6 33
chris 0:e98d1c2b16c6 34 class USBDevice
chris 0:e98d1c2b16c6 35 {
chris 0:e98d1c2b16c6 36 public:
chris 0:e98d1c2b16c6 37 USBDevice();
chris 0:e98d1c2b16c6 38 virtual void USBCallback_busReset(void){};
chris 0:e98d1c2b16c6 39 virtual bool USBCallback_request(){return false;};
chris 0:e98d1c2b16c6 40 virtual void USBCallback_requestCompleted(){};
chris 0:e98d1c2b16c6 41 virtual bool USBCallback_setConfiguration(uint8_t configuration){return false;};
chris 0:e98d1c2b16c6 42
chris 0:e98d1c2b16c6 43 virtual uint8_t * DeviceDesc();
chris 0:e98d1c2b16c6 44 virtual uint8_t * ConfigurationDesc();
chris 0:e98d1c2b16c6 45 virtual uint8_t * StringLangidDesc();
chris 0:e98d1c2b16c6 46 virtual uint8_t * StringImanufacturerDesc();
chris 0:e98d1c2b16c6 47 virtual uint8_t * StringIproductDesc();
chris 0:e98d1c2b16c6 48 virtual uint8_t * StringIserialDesc();
chris 0:e98d1c2b16c6 49 virtual uint8_t * StringIConfigurationDesc();
chris 0:e98d1c2b16c6 50 virtual uint8_t * StringIinterfaceDesc();
chris 0:e98d1c2b16c6 51 virtual uint16_t ReportDescLength(){return 0;};
chris 0:e98d1c2b16c6 52 };
chris 0:e98d1c2b16c6 53
chris 0:e98d1c2b16c6 54
chris 0:e98d1c2b16c6 55 void setInstanceDevice(USBDevice * _inst);
chris 0:e98d1c2b16c6 56
chris 0:e98d1c2b16c6 57
chris 0:e98d1c2b16c6 58 #endif