Chris Cant - Writing Windows WDM Device Drivers
Здесь есть возможность читать онлайн «Chris Cant - Writing Windows WDM Device Drivers» весь текст электронной книги совершенно бесплатно (целиком полную версию без сокращений). В некоторых случаях можно слушать аудио, скачать через торрент в формате fb2 и присутствует краткое содержание. Город: Lawrence, Kansas 66046, ISBN: , Издательство: R & D Books, Жанр: Программирование, на английском языке. Описание произведения, (предисловие) а так же отзывы посетителей доступны на портале библиотеки ЛибКат.
- Название:Writing Windows WDM Device Drivers
- Автор:
- Издательство:R & D Books
- Жанр:
- Год:неизвестен
- Город:Lawrence, Kansas 66046
- ISBN:0-87930-565-7
- Рейтинг книги:5 / 5. Голосов: 1
-
Избранное:Добавить в избранное
- Отзывы:
-
Ваша оценка:
- 100
- 1
- 2
- 3
- 4
- 5
Writing Windows WDM Device Drivers: краткое содержание, описание и аннотация
Предлагаем к чтению аннотацию, описание, краткое содержание или предисловие (зависит от того, что написал сам автор книги «Writing Windows WDM Device Drivers»). Если вы не нашли необходимую информацию о книге — напишите в комментариях, мы постараемся отыскать её.
Writing Windows WDM Device Drivers — читать онлайн бесплатно полную книгу (весь текст) целиком
Ниже представлен текст книги, разбитый по страницам. Система сохранения места последней прочитанной страницы, позволяет с удобством читать онлайн бесплатно книгу «Writing Windows WDM Device Drivers», без необходимости каждый раз заново искать на чём Вы остановились. Поставьте закладку, и сможете в любой момент перейти на страницу, на которой закончили чтение.
Интервал:
Закладка:
The host can then read the rest of the device's descriptors. Eventually, the host selects one of the device configurations. This fully enables the device so that all the endpoints can be used.
The USB system will only let a device configuration be selected if there is enough bandwidth available.
Window inspects the configuration, interface, and endpoint descriptors and loads the appropriate drivers. In the unlikely case of a device with more than one configuration, Windows itself prompts the user to choose between them.
Root Hub
The PC host contains a root hub that it finds on its internal buses when the host is switched on. A USB host controller is usually found by the PCI enumerator. The host controller's PCI configuration space is accessed and set with appropriate values. The controller's registers are permanently mapped into memory. A USB host controller can usually take bus mastership to do its data transfers.
The PC talks directly to the root hub electronics embedded in the host controller. The root hub then reports any devices or further hubs that are attached. Any further hubs are enumerated in the same way until all the USB devices have been found.
If Windows finds two root hubs for example, it treats them as two separate USB buses.
Hub Functionality
A hub is a standard USB device of class HubClass, which must implement functions defined in the USB Specification. It has the necessary USB descriptors to describe its functionality.
A hub primarily consists of a signal repeater and controller. The repeater passes the USB signals in the correct direction. The controller understands the protocol and instructs the repeater. The hub controller is itself controlled by the host through two endpoints.
A hub is configured and interrogated through its standard Endpoint 0. This default pipe implements most of the standard control transactions and then goes on to implement various hub class specific control transactions (ClearHubFeature , ClearPortFeature, GetBusState, GetHubDescriptor, GetHubStatus, GetPortStatus, SetHubDescriptor, SetHubFeature , and SetPortFeature ).
A hub also has a Status Change interrupt endpoint, used to inform the host of changes to each of its downstream ports. A port change bit is set if any of the following states change: device connected, port enabled, suspended, over-current indicated, reset, and powered. The host asks for the Status Change interrupt data every 255ms. The hub simply returns NAK if nothing has changed (e.g., if no devices have been added or removed).
The USB system uses standard control transactions to set up all devices. Further class and vendor specific requests can be defined.
A control transaction starts with a SETUP packet that includes eight data bytes in a customizable format, as shown in Table 20.2. Table 20.3 shows the bit definitions of the first byte, bmRequestType. The next byte is the request code.
Table 20.2 Control transfers
Field | Size | Description |
---|---|---|
bmRequestType |
1 | byte Request characteristics, see Table 20.3 |
bRequest |
1 | Request code, see Table 20.4 |
wValue |
2 | word parameter |
wIndex |
2 | index parameter |
wLength |
2 | Number of bytes to transfer |
Table 20.3 bmRequestType bit definitions
Bit 7 | Transfer direction | 0 = Host to device |
1 = Device to host | ||
Bits 6..5 | Type | 0 = Standard |
1 = Class | ||
2 = Vendor | ||
3 = Reserved | ||
Bits 4..0 | Recipient | 0 = Device |
1 = Interface | ||
2 = Endpoint | ||
3 = Other | ||
4..31 reserved |
The basic USB spec only defines the Standard type control transfers listed in Table 20.4. The table indicates the possible destinations, such as Device (D), Interface (I), or Endpoint (E).
Table 20.4 Standard USB SETUP transfer requests
Request code | Recipient | Description |
---|---|---|
CLEAR_FEATURE |
DIE | Clears stall or remote wake-up and clears power states |
GET_CONFIGURATION |
D | Get current configuration number (or 0 if not configured) |
GET_DESCRIPTOR |
D | Get descriptor: Device, String or Configuration, Interface, and Endpoint. |
GET_INTERFACE |
I | Get alternate setting for interface |
GET_STATUS |
DIE | Get status, e.g., whether device is self-powered andwhether remote wake-up is signalled, or whether end-point is stalled. |
SET_ADDRESS |
D | Set the device's address |
SET_CONFIGURATION |
D | Set the configuration number |
SET_DESCRIPTOR |
D | Set or add a descriptor |
SET_FEATURE |
DIE | Sets stall or remote wake-up and sets power states |
SET_INTERFACE |
I | Select an alternate interface setting |
SYNCH_FRAME |
E | Used in isochronous transfers to indicate the start of a frame pattern. |
For example, the SET_ADDRESS request is sent to assign a USB address to a device. The device returns ACK when complete. A GET_DESCRIPTOR request asks for one of the descriptors. The descriptor is returned in one or more DATA packets.
Each device class usually has various control transfer requests defined. See the appropriate specification for details.
Table 20.5 shows the basic types of descriptor that a device should return, along with a summary of the information in each descriptor. Figure 20.1 gives a view of the relationship between the various descriptors. String descriptors are optional. Further class specific or vendor specific descriptors can be returned. Table 20.6 lists the standard descriptor type constants.
Configuration and endpoint descriptors must not include a descriptor for Endpoint 0.
An interface may have alternate settings that redefine the number or characteristics of the associated endpoints.
For isochronous requests, the endpoint maximum packet size reserves bus time.
Table 20.5 USB descriptor types and fields
Descriptor | Fields |
---|---|
Device |
Vendor ID, Product ID, and Device release number. Device class, sub class, and protocol. Number of configurations |
Configuration |
Number of interfaces. Attributes: bus-powered, self-powered, supports remote wake-up. Maximum power required |
Interface |
Interface number, class, subclass, and protocol. Number of endpoints. |
Endpoint |
Endpoint number, direction, transfer type, maximum packet size, and interrupt polling interval. |
String |
String index 0: Language ID supported by device. Others: Unicode string and length |
Table 20.6 Standard descriptor type constants
USB_DEVICE_DESCRIPTOR_TYPE |
0x01 | |
USB_CONFIGURATION_DESCRIPTOR_TYPE |
0x02 | |
USB_STRING_DESCRIPTOR_TYPE |
0x03 | |
USB_INTERFACE_DESCRIPTOR_TYPE |
0x04 | |
USB_ENDPOINT_DESCRIPTOR_TYPE |
0x05 | |
USB_POWER_DESCRIPTOR_TYPE |
0x06 | W98 only |
USB_CONFIG_POWER_DESCRIPTOR_TYPE |
0x07 | W2000 only |
USB_INTERFACE_POWER_DESCRIPTOR_TYPE |
0x08 | W2000 only |
Windows uses values in the Device or Interface descriptors to choose which driver to load. Windows initially forms Hardware IDs using the Device descriptor vendor and product fields ( idVendor, idProduct, and bcdDevice). If no installation INF file can be found with a model that matches the Hardware IDs, Windows forms Compatible IDs out of the Interface descriptor class fields (bInterfaceClass, bInterfaceSubClass, and bInterfaceProtocol). Windows then searches for an installation file that handles one of these Compatible IDs. If nothing can be found, it prompts the user for a new driver. The chosen installation file specifies the driver to load.
Читать дальшеИнтервал:
Закладка:
Похожие книги на «Writing Windows WDM Device Drivers»
Представляем Вашему вниманию похожие книги на «Writing Windows WDM Device Drivers» списком для выбора. Мы отобрали схожую по названию и смыслу литературу в надежде предоставить читателям больше вариантов отыскать новые, интересные, ещё непрочитанные произведения.
Обсуждение, отзывы о книге «Writing Windows WDM Device Drivers» и просто собственные мнения читателей. Оставьте ваши комментарии, напишите, что Вы думаете о произведении, его смысле или главных героях. Укажите что конкретно понравилось, а что нет, и почему Вы так считаете.