NetServices Stack source

Dependents:   HelloWorld ServoInterfaceBoardExample1 4180_Lab4

Committer:
donatien
Date:
Thu Aug 05 15:01:33 2010 +0000
Revision:
11:da4498f591ee
Parent:
5:dd63a1e02b1b

        

Who changed what in which revision?

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