Opencv 3.1 project on GR-PEACH board
Fork of gr-peach-opencv-project by
USBHost_custom/USBHost3GModule/WANDongleInitializer.h@170:54ff26da7eb6, 2017-07-04 (annotated)
- Committer:
- thedo
- Date:
- Tue Jul 04 06:23:13 2017 +0000
- Revision:
- 170:54ff26da7eb6
- Parent:
- 166:3a9487d57a5c
project opencv 3.1 on GR PEACH board, no use SD card.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
thedo | 166:3a9487d57a5c | 1 | /* Copyright (c) 2010-2012 mbed.org, MIT License |
thedo | 166:3a9487d57a5c | 2 | * |
thedo | 166:3a9487d57a5c | 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software |
thedo | 166:3a9487d57a5c | 4 | * and associated documentation files (the "Software"), to deal in the Software without |
thedo | 166:3a9487d57a5c | 5 | * restriction, including without limitation the rights to use, copy, modify, merge, publish, |
thedo | 166:3a9487d57a5c | 6 | * distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the |
thedo | 166:3a9487d57a5c | 7 | * Software is furnished to do so, subject to the following conditions: |
thedo | 166:3a9487d57a5c | 8 | * |
thedo | 166:3a9487d57a5c | 9 | * The above copyright notice and this permission notice shall be included in all copies or |
thedo | 166:3a9487d57a5c | 10 | * substantial portions of the Software. |
thedo | 166:3a9487d57a5c | 11 | * |
thedo | 166:3a9487d57a5c | 12 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING |
thedo | 166:3a9487d57a5c | 13 | * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
thedo | 166:3a9487d57a5c | 14 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
thedo | 166:3a9487d57a5c | 15 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
thedo | 166:3a9487d57a5c | 16 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
thedo | 166:3a9487d57a5c | 17 | */ |
thedo | 166:3a9487d57a5c | 18 | |
thedo | 166:3a9487d57a5c | 19 | #ifndef WANDONGLEINITIALIZER_H |
thedo | 166:3a9487d57a5c | 20 | #define WANDONGLEINITIALIZER_H |
thedo | 166:3a9487d57a5c | 21 | |
thedo | 166:3a9487d57a5c | 22 | #include "USBHostConf.h" |
thedo | 166:3a9487d57a5c | 23 | |
thedo | 166:3a9487d57a5c | 24 | #ifdef USBHOST_3GMODULE |
thedo | 166:3a9487d57a5c | 25 | |
thedo | 166:3a9487d57a5c | 26 | #include <stdint.h> |
thedo | 166:3a9487d57a5c | 27 | |
thedo | 166:3a9487d57a5c | 28 | #include "USBHost.h" |
thedo | 166:3a9487d57a5c | 29 | #include "IUSBEnumerator.h" |
thedo | 166:3a9487d57a5c | 30 | |
thedo | 166:3a9487d57a5c | 31 | // [TODO] move these declarations to a proper place |
thedo | 166:3a9487d57a5c | 32 | #define WANDONGLE_MAX_SERIAL_PORTS 2 |
thedo | 166:3a9487d57a5c | 33 | #define WANDONGLE_MAX_INITIALIZERS 6 |
thedo | 166:3a9487d57a5c | 34 | |
thedo | 166:3a9487d57a5c | 35 | #define WAN_DONGLE_TYPE_UNKNOWN (-1) |
thedo | 166:3a9487d57a5c | 36 | |
thedo | 166:3a9487d57a5c | 37 | class WANDongleInitializer : public IUSBEnumerator |
thedo | 166:3a9487d57a5c | 38 | { |
thedo | 166:3a9487d57a5c | 39 | protected: |
thedo | 166:3a9487d57a5c | 40 | WANDongleInitializer(USBHost* pHost) { m_pHost = pHost; } |
thedo | 166:3a9487d57a5c | 41 | USBHost* m_pHost; |
thedo | 166:3a9487d57a5c | 42 | uint8_t m_serialIntfMap[WANDONGLE_MAX_SERIAL_PORTS]; |
thedo | 166:3a9487d57a5c | 43 | |
thedo | 166:3a9487d57a5c | 44 | public: |
thedo | 166:3a9487d57a5c | 45 | virtual ~WANDongleInitializer() {} |
thedo | 166:3a9487d57a5c | 46 | virtual uint16_t getMSDVid() = 0; |
thedo | 166:3a9487d57a5c | 47 | virtual uint16_t getMSDPid() = 0; |
thedo | 166:3a9487d57a5c | 48 | |
thedo | 166:3a9487d57a5c | 49 | virtual uint16_t getSerialVid() = 0; |
thedo | 166:3a9487d57a5c | 50 | virtual uint16_t getSerialPid() = 0; |
thedo | 166:3a9487d57a5c | 51 | |
thedo | 166:3a9487d57a5c | 52 | virtual bool switchMode(USBDeviceConnected* pDev) = 0; |
thedo | 166:3a9487d57a5c | 53 | |
thedo | 166:3a9487d57a5c | 54 | virtual USBEndpoint* getEp(USBDeviceConnected* pDev, int serialPortNumber, bool tx) { |
thedo | 166:3a9487d57a5c | 55 | return pDev->getEndpoint(m_serialIntfMap[serialPortNumber], BULK_ENDPOINT, tx ? OUT : IN, 0); |
thedo | 166:3a9487d57a5c | 56 | } |
thedo | 166:3a9487d57a5c | 57 | |
thedo | 166:3a9487d57a5c | 58 | virtual int getSerialPortCount() = 0; |
thedo | 166:3a9487d57a5c | 59 | |
thedo | 166:3a9487d57a5c | 60 | virtual void setVidPid(uint16_t vid, uint16_t pid) = 0; |
thedo | 166:3a9487d57a5c | 61 | |
thedo | 166:3a9487d57a5c | 62 | virtual bool parseInterface(uint8_t intf_nb, uint8_t intf_class, uint8_t intf_subclass, uint8_t intf_protocol) = 0; //Must return true if the interface should be parsed |
thedo | 166:3a9487d57a5c | 63 | |
thedo | 166:3a9487d57a5c | 64 | virtual bool useEndpoint(uint8_t intf_nb, ENDPOINT_TYPE type, ENDPOINT_DIRECTION dir) = 0; //Must return true if the endpoint will be used |
thedo | 166:3a9487d57a5c | 65 | |
thedo | 166:3a9487d57a5c | 66 | virtual int getType() = 0; |
thedo | 166:3a9487d57a5c | 67 | |
thedo | 166:3a9487d57a5c | 68 | virtual uint8_t getSerialIntf(int index) { return m_serialIntfMap[index]; } |
thedo | 166:3a9487d57a5c | 69 | }; |
thedo | 166:3a9487d57a5c | 70 | |
thedo | 166:3a9487d57a5c | 71 | #endif /* USBHOST_3GMODULE */ |
thedo | 166:3a9487d57a5c | 72 | |
thedo | 166:3a9487d57a5c | 73 | #endif |