Dependents: UMTSStickNetIfExample PMK_UMTSStickNetIfExample
LPC1768/drv/usb/UsbHostMgr.h@2:e16df9d8bca7, 2010-07-09 (annotated)
- Committer:
- donatien
- Date:
- Fri Jul 09 15:06:54 2010 +0000
- Revision:
- 2:e16df9d8bca7
- Parent:
- 0:45cd39946923
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
donatien | 0:45cd39946923 | 1 | /* |
donatien | 0:45cd39946923 | 2 | Copyright (c) 2010 Donatien Garnier (donatiengar [at] gmail [dot] com) |
donatien | 0:45cd39946923 | 3 | |
donatien | 0:45cd39946923 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy |
donatien | 0:45cd39946923 | 5 | of this software and associated documentation files (the "Software"), to deal |
donatien | 0:45cd39946923 | 6 | in the Software without restriction, including without limitation the rights |
donatien | 0:45cd39946923 | 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
donatien | 0:45cd39946923 | 8 | copies of the Software, and to permit persons to whom the Software is |
donatien | 0:45cd39946923 | 9 | furnished to do so, subject to the following conditions: |
donatien | 0:45cd39946923 | 10 | |
donatien | 0:45cd39946923 | 11 | The above copyright notice and this permission notice shall be included in |
donatien | 0:45cd39946923 | 12 | all copies or substantial portions of the Software. |
donatien | 0:45cd39946923 | 13 | |
donatien | 0:45cd39946923 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
donatien | 0:45cd39946923 | 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
donatien | 0:45cd39946923 | 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
donatien | 0:45cd39946923 | 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
donatien | 0:45cd39946923 | 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
donatien | 0:45cd39946923 | 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
donatien | 0:45cd39946923 | 20 | THE SOFTWARE. |
donatien | 0:45cd39946923 | 21 | */ |
donatien | 0:45cd39946923 | 22 | |
donatien | 0:45cd39946923 | 23 | //Assigns addresses to connected devices... |
donatien | 0:45cd39946923 | 24 | |
donatien | 0:45cd39946923 | 25 | #ifndef USB_HOSTMGR_H |
donatien | 0:45cd39946923 | 26 | #define USB_HOSTMGR_H |
donatien | 0:45cd39946923 | 27 | |
donatien | 0:45cd39946923 | 28 | #include "mbed.h" |
donatien | 0:45cd39946923 | 29 | #include "UsbInc.h" |
donatien | 0:45cd39946923 | 30 | #include "UsbDevice.h" |
donatien | 0:45cd39946923 | 31 | |
donatien | 2:e16df9d8bca7 | 32 | #define USB_HOSTMGR_MAX_DEVS 2 //2 devices max for now... will be more when hubs are supported |
donatien | 0:45cd39946923 | 33 | |
donatien | 0:45cd39946923 | 34 | class UsbDevice; |
donatien | 0:45cd39946923 | 35 | |
donatien | 0:45cd39946923 | 36 | class UsbHostMgr //[0-1] inst |
donatien | 0:45cd39946923 | 37 | { |
donatien | 0:45cd39946923 | 38 | public: |
donatien | 0:45cd39946923 | 39 | UsbHostMgr(); |
donatien | 0:45cd39946923 | 40 | ~UsbHostMgr(); |
donatien | 0:45cd39946923 | 41 | |
donatien | 0:45cd39946923 | 42 | UsbErr init(); //Initialize host |
donatien | 0:45cd39946923 | 43 | |
donatien | 0:45cd39946923 | 44 | void poll(); //Enumerate connected devices, etc |
donatien | 0:45cd39946923 | 45 | |
donatien | 0:45cd39946923 | 46 | int devicesCount(); |
donatien | 0:45cd39946923 | 47 | |
donatien | 0:45cd39946923 | 48 | UsbDevice* getDevice(int item); |
donatien | 0:45cd39946923 | 49 | void releaseDevice(UsbDevice* pDev); |
donatien | 0:45cd39946923 | 50 | |
donatien | 0:45cd39946923 | 51 | |
donatien | 0:45cd39946923 | 52 | void UsbIrqhandler(); |
donatien | 0:45cd39946923 | 53 | |
donatien | 0:45cd39946923 | 54 | protected: |
donatien | 0:45cd39946923 | 55 | void onUsbDeviceConnected(int hub, int port); |
donatien | 0:45cd39946923 | 56 | void onUsbDeviceDisconnected(int hub, int port); |
donatien | 0:45cd39946923 | 57 | |
donatien | 0:45cd39946923 | 58 | friend class UsbDevice; |
donatien | 0:45cd39946923 | 59 | void resetPort(int hub, int port); |
donatien | 0:45cd39946923 | 60 | |
donatien | 0:45cd39946923 | 61 | private: |
donatien | 0:45cd39946923 | 62 | /* __align(8)*/ volatile HCCA* m_pHcca; |
donatien | 0:45cd39946923 | 63 | |
donatien | 0:45cd39946923 | 64 | UsbDevice* m_lpDevices[USB_HOSTMGR_MAX_DEVS]; |
donatien | 0:45cd39946923 | 65 | }; |
donatien | 0:45cd39946923 | 66 | |
donatien | 0:45cd39946923 | 67 | #endif |