Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
USBBusInterface.h
00001 /* USBBusInterface.h */ 00002 /* USB Bus Interface */ 00003 /* Copyright (c) 2011 ARM Limited. All rights reserved. */ 00004 00005 #ifndef USBBUSINTERFACE_H 00006 #define USBBUSINTERFACE_H 00007 00008 #include "mbed.h" 00009 #include "USBEndpoints.h" 00010 00011 class USBHAL { 00012 public: 00013 /* Configuration */ 00014 USBHAL(); 00015 ~USBHAL(); 00016 void connect(void); 00017 void disconnect(void); 00018 void configureDevice(void); 00019 void unconfigureDevice(void); 00020 void setAddress(uint8_t address); 00021 void remoteWakeup(void); 00022 00023 /* Endpoint 0 */ 00024 void EP0setup(uint8_t *buffer); 00025 void EP0read(void); 00026 uint32_t EP0getReadResult(uint8_t *buffer); 00027 void EP0write(uint8_t *buffer, uint32_t size); 00028 void EP0getWriteResult(void); 00029 void EP0stall(void); 00030 00031 /* Other endpoints */ 00032 EP_STATUS endpointRead(uint8_t endpoint, uint32_t maximumSize); 00033 EP_STATUS endpointReadResult(uint8_t endpoint, uint8_t *data, uint32_t *bytesRead); 00034 EP_STATUS endpointWrite(uint8_t endpoint, uint8_t *data, uint32_t size); 00035 EP_STATUS endpointWriteResult(uint8_t endpoint); 00036 void stallEndpoint(uint8_t endpoint); 00037 void unstallEndpoint(uint8_t endpoint); 00038 bool realiseEndpoint(uint8_t endpoint, uint32_t maxPacket, uint32_t options); 00039 bool getEndpointStallState(unsigned char endpoint); 00040 uint32_t endpointReadcore(uint8_t endpoint, uint8_t *buffer); 00041 00042 protected: 00043 virtual void busReset(void){}; 00044 virtual void EP0setupCallback(void){}; 00045 virtual void EP0out(void){}; 00046 virtual void EP0in(void){}; 00047 virtual void connectStateChanged(unsigned int connected){}; 00048 virtual void suspendStateChanged(unsigned int suspended){}; 00049 virtual void SOF(int frameNumber){}; 00050 virtual bool EP1_OUT_callback(){return false;}; 00051 virtual bool EP1_IN_callback(){return false;}; 00052 virtual bool EP2_OUT_callback(){return false;}; 00053 virtual bool EP2_IN_callback(){return false;}; 00054 virtual bool EP3_OUT_callback(){return false;}; 00055 virtual bool EP3_IN_callback(){return false;}; 00056 00057 private: 00058 void usbisr(void); 00059 static void _usbisr(void); 00060 static USBHAL * instance; 00061 }; 00062 #endif 00063 00064
Generated on Wed Jul 13 2022 10:21:28 by
1.7.2