The Pedigree Project
0.1
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
src
modules
system
usb
UsbPnP.h
1
/*
2
* Copyright (c) 2008-2014, Pedigree Developers
3
*
4
* Please see the CONTRIB file in the root of the source tree for a full
5
* list of contributors.
6
*
7
* Permission to use, copy, modify, and distribute this software for any
8
* purpose with or without fee is hereby granted, provided that the above
9
* copyright notice and this permission notice appear in all copies.
10
*
11
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18
*/
19
20
#ifndef USBPNP_H
21
#define USBPNP_H
22
23
#include "pedigree/kernel/compiler.h"
24
#include "pedigree/kernel/processor/types.h"
25
#include "pedigree/kernel/utilities/List.h"
26
#include "pedigree/kernel/utilities/new"
27
28
class
Device
;
29
class
UsbDevice
;
30
31
enum
UsbPnPConstants
32
{
33
VendorIdNone = 0xFFFF,
34
ProductIdNone = 0xFFFF,
35
ClassNone = 0xFF,
36
SubclassNone = 0xFF,
37
ProtocolNone = 0xFF,
38
};
39
40
class
EXPORTED_PUBLIC
UsbPnP
41
{
42
private
:
44
typedef
UsbDevice
*(*callback_t)(
UsbDevice
*);
45
46
public
:
47
UsbPnP
();
48
virtual
~
UsbPnP
();
49
51
static
UsbPnP
&
instance
()
52
{
53
return
m_Instance;
54
}
55
57
void
registerCallback(
58
uint16_t nVendorId, uint16_t nProductId, callback_t callback);
59
61
void
registerCallback(
62
uint8_t nClass, uint8_t nSubclass, uint8_t nProtocol,
63
callback_t callback);
64
66
bool
probeDevice(
Device
*pDeviceBase);
67
68
private
:
71
Device
*doProbe(
Device
*pDeviceBase);
72
74
static
UsbPnP
m_Instance
;
75
77
void
reprobeDevices(
Device
*pParent);
78
81
struct
CallbackItem
82
{
84
callback_t
callback
;
85
87
uint16_t
nVendorId
;
88
uint16_t nProductId;
89
91
uint8_t
nClass
;
92
uint8_t nSubclass;
93
uint8_t nProtocol;
94
};
95
97
List<CallbackItem *>
m_Callbacks
;
98
};
99
100
#endif
EXPORTED_PUBLIC
#define EXPORTED_PUBLIC
Definition:
system/include/pedigree/kernel/compiler.h:78
UsbDevice
Definition:
UsbDevice.h:37
UsbPnP::CallbackItem::callback
callback_t callback
The callback function.
Definition:
UsbPnP.h:84
UsbPnP::CallbackItem
Definition:
UsbPnP.h:81
UsbPnP::CallbackItem::nVendorId
uint16_t nVendorId
Vendor and product IDs.
Definition:
UsbPnP.h:87
Device
Definition:
Device.h:43
List
Definition:
List.h:64
UsbPnP
Definition:
UsbPnP.h:40
UsbPnP::CallbackItem::nClass
uint8_t nClass
Class, subclass and protocol numbers.
Definition:
UsbPnP.h:91
UsbPnP::instance
static UsbPnP & instance()
Singleton design.
Definition:
UsbPnP.h:51
UsbPnP::m_Callbacks
List< CallbackItem * > m_Callbacks
Callback list.
Definition:
UsbPnP.h:97
UsbPnP::m_Instance
static UsbPnP m_Instance
Static instance.
Definition:
UsbPnP.h:74
Generated on Fri Jan 24 2020 06:49:08 for The Pedigree Project by
1.8.11