Книга: Microsoft Windows Embedded CE 6.0 Exam Preparation Kit

Driver Globals

Driver Globals

Among other things you can use the Eboot.bib file to reserve a memory section for the boot loader to pass information to the operating system during the startup process. This information might reflect the current state of initialized hardware, network communication capabilities if the boot loader supports Ethernet downloads, user and system flags for the operating system, such as to enable Kernel Independent Transport Layer (KITL), and so on. To enable this communication, the boot loader and operating system must share a common region of physical memory, which is referred to as driver globals (DRV_GLB). The above Eboot.bib listing includes a DRV_GLB mapping. The data that the boot loader passes to the operating system in the DRV_GLB region must adhere to a BOOT_ARGS structure that you can define according to your specific requirements.

The following procedure illustrates how to pass Ethernet and IP configuration information from the boot loader to the operating system through a DRV_GLB region. To do this, create a header file in the %_WINCEROOT%Platform<BSP Name>SrcInc folder, such as Drv_glob.h, with the following content:

#include <halether.h>
// Debug Ethernet parameters.
typedef struct _ETH_HARDWARE_SETTINGS {
 EDBG_ADAPTER Adapter; // The NIC to communicate with Platform Builder.
 UCHAR ucEdbgAdapterType; // Type of debug Ethernet adapter.
 UCHAR ucEdbgIRQ; // IRQ line to use for debug Ethernet adapter.
 DWORD dwEdbgBaseAddr; // Base I/O address for debug Ethernet adapter.
 DWORD dwEdbgDebugZone; // EDBG debug zones to be enabled.
 // Base for creating a device name.
 // This will be combined with the EDBG MAC address
 // to generate a unique device name to identify
 // the device to Platform Builder.
 char szPlatformStri ng[EDBG_MAX_DEV_NAMELEN];
 UCHAR ucCpuId; // Type of CPU.
} ETH_HARDWARE_SETTINGS, *PETH_HARDWARE_SETTINGS;
// BootArgs - Parameters passed from the boot loader to the OS.
#define BOOTARG_SIG 0x544F4F42 // "BOOT"
typedef struct BOOT_ARGS {
 DWORD dwSig;
 DWORD dwLen; // Total length of BootArgs struct.
 UCHAR ucLoaderFlags; // Flags set by boot loader.
 UCHAR ucEshellFlags; // Flags from Eshell.
 DWORD dwEdbgDebugZone; // Which debug messages are enabled?
 // The following addresses are only valid if LDRFL_JUMPIMG is set and
 // the corresponding bit in ucEshellFlags is set (configured by Eshell, bit
 // definitions in Ethdbg.h).
 EDBG_ADDR EshellHostAddr;   // IP/Ethernet addr and UDP port of host
                             // running Eshell.
 EDBG_ADDR DbgHostAddr;      // IP/Ethernet address and UDP port of host
                             // receiving debug messages.
 EDBG_ADDR CeshHostAddr;     // IP/Ethernet addr and UDP port of host
                             // running Ethernet text shell.
 EDBG_ADDR KdbgHostAddr;     // IP/Ethernet addr and UDP port of host
                             // running kernel debugger.
 ETH_HARDWARE_SETTINGS Edbg; // The debug Ethernet controller.
} BOOT_ARGS, *PBOOT_ARGS;
// Definitions for flags set by the boot loader.
#define LDRFL_USE_EDBG 0x0001 // Set to attempt to use debug Ethernet.
// The following two flags are only looked at if LDRFL_USE_EDBG is set.
#define LDRFL_ADDR_VALID 0x0002 // Set if EdbgAddr member is valid.
#define LDRFL_JUMPIMG    0x0004 // If set, do not communicate with Eshell
                                // to get configuration information,
                                // use ucEshellFlags member instead.
typedef struct _DRIVER_GLOBALS {
 //
 // TODO: Later, fill in this area with shared information between
 // drivers and the OS.
 //
 BOOT_ARGS bootargs;
} DRIVER_GLOBALS, *PDRIVER_GLOBALS;

Оглавление книги


Генерация: 1.113. Запросов К БД/Cache: 3 / 0
поделиться
Вверх Вниз