The boot args and driver Globals in WinCE eboot

Source: Internet
Author: User
Tags config reserved

An important buffer contained in Eboot is called Driver Globals, which is used to share data between device drivers and WinCE OS. The startup parameter structure that is used in eboot is called the Boot Args, which is used to share some parameter information between the Eboot and the WinCE OS. Generally speaking, the boot args will be assigned or updated when the eboot is running, the most commonly used is the information about the network equipment, such as IP address, MAC address, interrupt and so on.

The Driver globals contains the boot Args, which means that Driver globals is a memory buffer, which also contains the memory buffer of the boot Args. The point here is that driver globals is an optional feature, nothing more than a piece of memory, in the Eboot and WinCE OS data sharing. If you want to use, you will use, do not want to use, you can not. When we were using driver globals, In general, the Eboot.bib and config.bib files define a reserved area of memory in which the starting address and size of the area of memory defined in these two files must be the same, I believe this can be understood, as for the type is definitely reserved. As a result, the shared memory is reserved when Eboot and wince run. Of course, we also need to define the starting address and size of the memory in the BSP through the macro definition, so that the memory can be accessed in the BSP. Example:

First of all, Eboot.bib and Config.bib should have the following definition:

MEMORY
;  Name   Start   Size   Type
;  ------- -------- -------- ----
ARGS   80020800 00000800 RESERVED

The above description indicates that the starting address of the driver Globals shared memory is 0x80020800, and the size is 0x800.

Then you also define the starting address and size in the BSP as follows:

#define IMAGE_SHARE_ARGS_UA_START    0xA0020000
#define IMAGE_SHARE_ARGS_CA_START    0x80020800
#define IMAGE_SHARE_ARGS_SIZE      0x00000800

In this way, Eboot can access shared memory through the address defined by the macro above. This shared area is described by the driver globals structure, which is defined as follows:

typedef struct _DRIVER_GLOBALS
{
//
// 之后,可以定义用于驱动程序和WinCE OS之间的共享信息
//

BOOT_ARGS    bootargs;
} DRIVER_GLOBALS, *PDRIVER_GLOBALS;

You can see that it contains the BOOT_ARGS structure that describes the boot args, and of course users can add data types to the structure that are used to drive and wince the OS.

The following describes the Boot_args structure of the boot args, defined as follows:

#define BOOTARG_SIG 0x544F4F42 // "BOOT"

typedef struct BOOT_ARGS
{
DWORD  dwSig;
DWORD  dwLen;        // BOOT_ARGS的结构长度
UCHAR  ucLoaderFlags;    // Boot loader设定的标志
UCHAR  ucEshellFlags;    // EShell标志
DWORD  dwEdbgDebugZone;   // 调试域Debug Zone的定义

EDBG_ADDR EshellHostAddr;   // Host端的IP地址和EShell的UDP端口号
EDBG_ADDR DbgHostAddr;    // IP地址和接收Debug信息的UDP端口号
EDBG_ADDR CeshHostAddr;    // IP地址和以太网cesh的UDP端口号
EDBG_ADDR KdbgHostAddr;    // IP地址和Kenel Debugger的UDP端口号

ETH_HARDWARE_SETTINGS  Edbg; // 调试以太网卡的硬件设置信息
} BOOT_ARGS, *PBOOT_ARGS;

The setting flags for the boot loader are defined as follows:

#define  LDRFL_USE_EDBG   0x0001 // 设置尝试使用调试以太网
//如果设置了LDRFL_USE_EDBG,下面两个标志才会被看到
#define  LDRFL_ADDR_VALID 0x0002 // 当EdbgAddr有效时设置
#define  LDRFL_JUMPIMG   0x0004 // 不使用与Eshell通信

The eth_hardware_settings structure in the BOOT_ARGS structure above is defined as follows:

typedef struct _ETH_HARDWARE_SETTINGS
{
EDBG_ADAPTER  Adapter;       // 与Platform Builder通信的网卡
UCHAR      ucEdbgAdapterType;  // 调试以太网卡的类型
UCHAR      ucEdbgIRQ;      // 调试以太网卡的IRQ
DWORD      dwEdbgBaseAddr;   // 调试以太网卡的基地址
DWORD      dwEdbgDebugZone;   // 调试以太网卡的调试域

char szPlatformString[EDBG_MAX_DEV_NAMELEN];  //一个唯一的目标板设备名

UCHAR      ucCpuId;       // 处理器类型
} ETH_HARDWARE_SETTINGS, *PETH_HARDWARE_SETTINGS;

As you can see, this shared memory between Eboot and wince is described using the driver globals data structure, and the memory is reserved in Eboot.bib and config.bib in advance. Finally achieve the goal of sharing data with each other.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.