Nicolas Besson - Microsoft Windows Embedded CE 6.0 Exam Preparation Kit
Здесь есть возможность читать онлайн «Nicolas Besson - Microsoft Windows Embedded CE 6.0 Exam Preparation Kit» весь текст электронной книги совершенно бесплатно (целиком полную версию без сокращений). В некоторых случаях можно слушать аудио, скачать через торрент в формате fb2 и присутствует краткое содержание. Город: Redmond, Год выпуска: 2008, Издательство: Microsoft, Жанр: Руководства, ОС и Сети, Программы, на английском языке. Описание произведения, (предисловие) а так же отзывы посетителей доступны на портале библиотеки ЛибКат.
- Название:Microsoft Windows Embedded CE 6.0 Exam Preparation Kit
- Автор:
- Издательство:Microsoft
- Жанр:
- Год:2008
- Город:Redmond
- ISBN:нет данных
- Рейтинг книги:5 / 5. Голосов: 1
-
Избранное:Добавить в избранное
- Отзывы:
-
Ваша оценка:
- 100
- 1
- 2
- 3
- 4
- 5
Microsoft Windows Embedded CE 6.0 Exam Preparation Kit: краткое содержание, описание и аннотация
Предлагаем к чтению аннотацию, описание, краткое содержание или предисловие (зависит от того, что написал сам автор книги «Microsoft Windows Embedded CE 6.0 Exam Preparation Kit»). Если вы не нашли необходимую информацию о книге — напишите в комментариях, мы постараемся отыскать её.
Microsoft Windows Embedded CE 6.0 Exam Preparation Kit — читать онлайн бесплатно полную книгу (весь текст) целиком
Ниже представлен текст книги, разбитый по страницам. Система сохранения места последней прочитанной страницы, позволяет с удобством читать онлайн бесплатно книгу «Microsoft Windows Embedded CE 6.0 Exam Preparation Kit», без необходимости каждый раз заново искать на чём Вы остановились. Поставьте закладку, и сможете в любой момент перейти на страницу, на которой закончили чтение.
Интервал:
Закладка:
Because Device Manager can load a single driver multiple times to satisfy the requests from different processes and threads, stream drivers must implement context management. Windows Embedded CE knows two context levels for device drivers, device context and open context, which the operating system passes in each appropriate function call to the driver so that the driver can associate internal resources and allocated memory regions with each caller.<\/p>
The stream interface consists of 12 functions: XXX_Init, XXX_Open, XXX_Read, XXX_Write, XXX_Seek, XXX_IOControl, XXX_PowerUp, XXX_PowerDown, XXX_PreClose, XXX_Close, XXX_PreDeinit, and XXX_Deinit. Not all functions are mandatory (such as XXX_PreClose and XXX_PreDeinit), yet any functions that the stream device driver implements must be exposed from the driver DLL to Device Manager. To export these functions, you must define them in the .def file of the DLL subproject. You should also adjust the DLL subproject's Sources file to ensure that the driver DLL can make platform-dependent function calls.<\/p>
Lesson 3: Configuring and Loading a Driver<\/p> <\/div>
In general, you have two options to load a stream driver under Windows Embedded CE 6.0. You can instruct Device Manager to load the driver automatically during the boot sequence by configuring driver settings in the HKEY_LOCAL_MACHINE\Drivers\BuiltIn registry key, or you can load the driver dynamically through a direct call to ActivateDeviceEx. Either way, Device Manager can load the device driver with the same registry flags and settings. The key difference is that you receive a handle to the driver when using ActivateDeviceEx, which you can use later in a call to DeactivateDevice. Especially during the development stage, it might be advantageous to load a driver dynamically through ActivateDeviceEx so that you can unload the driver, install an updated version, and then reload the driver without having to restart the operating system. You can also use DeactivateDevice to unload drivers loaded automatically based on entries under the BuiltIn registry key, but you cannot reload them without calling ActivateDeviceEx directly.<\/p>
After this lesson, you will be able to:<\/strong> <\/p>
■ Identify the mandatory registry settings for a device driver.<\/p>
■ Access the registry settings from within a driver.<\/p>
■ Load a driver at startup or on demand in an application.<\/p>
■ Load a driver in user space or kernel space.<\/p>
Estimated lesson time: 25 minutes.<\/strong> <\/p> <\/cite>
Device Driver Load Procedure<\/p> <\/div>
Whether you load a device driver statically or dynamically, the ActivateDeviceEx function is always involved. A dedicated driver named the Bus Enumerator (BusEnum) calls ActivateDeviceEx for every driver registered under HKEY_LOCAL_MACHINE\Drivers\BuiltIn just as you can call ActivateDeviceEx directly, passing in an alternate registry path for the driver settings in the lpszDevKey parameter.<\/p>
Device Manager uses the following procedure to load device drivers at boot time:<\/p>
1. Device Manager reads the HKEY_LOCAL_MACHINE\Drivers\RootKey entry to determine the location of the device driver entries in the registry. The default value of the RootKey entry is Drivers\BuiltIn.<\/p>
2. Device Manager reads the Dll registry value at the location specified in the RootKey location (HKEY_LOCAL_MACHINE\Drivers\BuiltIn) to determine the enumerator DLL to load. By default, this is the bus enumerator (BusEnum.dll). The bus enumerator is a stream driver that exports the Init and Deinit functions.<\/p>
3. The bus enumerator runs at startup to scan the RootKey registry location for subkeys that refer to additional buses and devices. It can be run again later with a different RootKey to load more drivers. The bus enumerator examines the Order value in each subkey to determine the load order.<\/p>
4. Starting with the lowest Order values, the bus enumerator iterates through the subkeys and calls ActivateDeviceEx passing in the current driver's registry path (that is, HKEY_LOCAL_MACHINE\Drivers\BuiltIn\< DriverName<\/em> >).<\/p>
5. ActivateDeviceEx loads the driver DLL registered in the DLL value located in the driver's subkey, and then creates a subkey for the driver under the HKEY_LOCAL_MACHINE\Drivers\Active registry key to keep track of all currently loaded drivers.<\/p>
Figure 6-4 shows a typical registration under the HKEY_LOCAL_MACHINE\Drivers\BuiltIn registry key for an audio device driver.<\/p>
Registry Settings to Load Device Drivers<\/p> <\/div>
If you use ActivateDeviceEx to load your driver dynamically, you are not required to place the driver's registry settings in a subkey under HKEY_LOCAL_MACHINE\Drivers\BuiltIn. You can use an arbitrary path, such as HKEY_LOCAL_MACHINE\SampleDriver. However, the registry values for the driver are the same in both cases. Table 6-3 lists general registry entries that you can specify for a device driver in the driver's registry subkey (see Figure 6-4 for sample values).<\/p>
Table 6-3 General registry entries for device drivers<\/strong> <\/p>
Registry Entry<\/th> | Type<\/th> | Description<\/th> <\/tr> |
---|---|---|
Prefix<\/td> | REG_SZ<\/td> | A string value that contains the driver's three-letter name. This is the value that replaces XXX in the stream interface functions. Applications also use this prefix to open a context of the driver through CreateFile.<\/td> <\/tr> |
Dll<\/td> | REG_SZ<\/td> | This is the name of the DLL that Device Manager loads to load the driver. Note that this is the only mandatory registry entry for a driver.<\/td> <\/tr> |
Index<\/td> | REG_DWORD<\/td> | This is the number appended to the driver prefix to create the driver's file name. For example, if this value is 1, applications can access this driver through a call to CreateFile(L"XXX1:"…) or CreateFile(L"\$device\XXX1"…). Note that this value is optional. If you do not define it, Device Manager assigns the next available index value to the driver.<\/td> <\/tr> |
Order<\/td> | REG_DWORD<\/td> | This is the order in which Device Manger loads the driver. If this value is not specified, the driver will be loaded last, at the same time as other drivers with no order specified. Drivers with the same Order value start concurrently. You should only configure this value to enforce a sequential load order. For example, a Global Positioning System (GPS) driver might require a Universal Asynchronous Receiver/Transmitter (UART) driver to get access to the GPS data through a serial port. In this case, it is important to assign the UART driver a lower Order value than the GPS driver so that the UART driver starts first. This will enable the GPS driver to access the UART driver during its initialization.<\/td> <\/tr> |
IClass<\/td> | REG_MULTI_SZ<\/td> | This value can specify predefined device interface globally unique identifiers (GUIDs). To advertise an interface to Device Manager, such as to support the Plug and Play notification system and power management capabilities, add the corresponding interface GUIDs to the IClass value or call AdvertiseInterface in the driver.<\/td> <\/tr> |
Flags<\/td> | REG_DWORD<\/td> | This value can contain the following flags:<\/td> <\/tr> |
■ DEVFLAGS_UNLOAD (0x0000 0001)<\/strong>The driver unloads after a call to XXX_Init.<\/td> <\/tr> | ||
■ DEVFLAGS_NOLOAD (0x0000 0004)<\/strong>The driver cannot be loaded.<\/td> <\/tr> | ||
■ DEVFLAGS_NAKEDENTRIES (0x0000 0008)<\/strong>The entry points of the driver are Init, Open, IOControl, and so forth, without any prefixes.<\/td> <\/tr> | ||
■ DEVFLAGS_BOOTPHASE_1 (0x0000 1000)<\/strong>The driver is loaded during system phase 1 for systems with multiple boot phases. This prevents the driver from being loaded more than one time during the boot process.<\/td> <\/tr> | ||
■ DEVFLAGS_IRQ_EXCLUSIVE (0x0000 0100)<\/strong>The bus driver loads this driver only when it has exclusive access to the interrupt request (IRQ) specified by the IRQ value.<\/td> <\/tr> | ||
■ DEVFLAGS_LOAD_AS_USERPROC (0x0000 0010)<\/strong>Loads the driver in user mode.<\/td> <\/tr> | ||
UserProcGroup<\/td> | REG_DWORD<\/td> | Associates a driver marked with the DEVFLAGS_LOAD_AS_USERPROC (0x0000 0010) flag to load in user mode with a user-mode driver host process group. User-mode drivers that belong to the same group are loaded by Device Manager in the same host process instance. If this registry entry does not exist, Device Manager loads the user-mode driver into a new host process instance.<\/td> <\/tr> <\/table>
NOTE<\/div>
Flags<\/div>
For details about the Flags registry value, see the section "ActivateDeviceEx" in the Windows Embedded CE 6.0 Documentation, available on the Microsoft MSDN Web site at http://msdn2.microsoft.com/en-us/library/aa929596.aspx<\/em> .<\/p> <\/cite> |
Интервал:
Закладка:
Похожие книги на «Microsoft Windows Embedded CE 6.0 Exam Preparation Kit»
Представляем Вашему вниманию похожие книги на «Microsoft Windows Embedded CE 6.0 Exam Preparation Kit» списком для выбора. Мы отобрали схожую по названию и смыслу литературу в надежде предоставить читателям больше вариантов отыскать новые, интересные, ещё непрочитанные произведения.
Обсуждение, отзывы о книге «Microsoft Windows Embedded CE 6.0 Exam Preparation Kit» и просто собственные мнения читателей. Оставьте ваши комментарии, напишите, что Вы думаете о произведении, его смысле или главных героях. Укажите что конкретно понравилось, а что нет, и почему Вы так считаете.