Muti-bin的一些相关函数和设置

来源:互联网 发布:中国瓷器品牌知乎 编辑:程序博客网 时间:2024/05/01 11:56

This function saves the number of .bin files to be downloaded and their addresses and sizes.
这个函数保存要下载的.bin文件的数目和他们的地址以及大小。
句式:
void OEMMultiBINNotify(
  const PMultiBINInfo pInfo
);
参数:
pInfo
[in] Contains information about the downloaded .bin files.
返回值:
NONE
备注:
The number of .bin files to be downloaded and their addresses and sizes are necessary to successfully cache all the OS images in RAM, if they are destined for flash memory.
如果.bin文件要下载的数目和他们的地址、大小的目的地址是flash memory,他们是很有必要成功地缓存到RAM里面的操作系统镜像文件。
g_pOEMMultiBINNotify is a function pointer. You can assign the address of a custom BIN notify routine that the BLCOMMON code then calls at the appropriate time through this function pointer. The following code example shows how you can perform this routine.
g_pOEMMultiBINNotify是一个函数指针。你可以分配一个定制的BIN通知例程的地址,这个例程的BLCOMMON代码接着在合适的时间通过这个函数指针调用。下面的代码例子显示了你是如何执行这个例程的。

BOOL OEMMultiBINNotify(const PMultiBINInfo pInfo);
g_pOEMMultiBINNotify = OEMMultiBINNotify;
要求:
Header blcommon.h
Library blcommon.lib
Windows Embedded CE Windows CE .NET 4.2 and later

==========================================================-------------==========
Adding Support for Multiple-BIN Image Notification

Platform Builder and the BLCOMMON library support downloading multiple .bin files during the same download session. This is useful when developing a multi-BIN run-time image.
Platform Builder and the BLCOMMON library 支持多bin文件的下载在统一下载阶段。当你在开发多bin运行时镜像文件这是很有用的。

The BLCOMMON library can notify third-party code about each .bin file to be downloaded, and the .bin file's address and length, through a function pointer.
The BLCOMMON library可以识别第三方代码关于每个要下载的.bin文件,.bin文件的地址和长度,通过一个函数指针来进行下载。

This information is useful when deciding how to temporarily cache a multi-BIN run-time image in RAM before writing it to flash memory. For more information, see OEMMultiBINNotify.
这个信息是有用的,当决定如何去临时的缓存一个在RAM中的多bin运行时镜像文件,并把它写入进flash memory。对于更多的消息,可以查阅OEMMultiBINNotify.

The following code example shows an implementation of OEMMultiBINNotify.
下面的代码例子显示了OEMMultiBINNotify的实现。
void OEMMultiBINNotify(const PMultiBINInfo pInfo)
{
    BYTE nCount;

    if (!pInfo || !pInfo->dwNumRegions)
    {
        EdbgOutputDebugString("WARNING: OEMMultiBINNotify: Invalid BIN region descriptor(s)./r/n");
        return;
    }

    g_dwMinImageStart = pInfo->Region[0].dwRegionStart;

    EdbgOutputDebugString("/r/nDownload BIN file information:/r/n");
    EdbgOutputDebugString("-----------------------------------------------------/r/n");
    for (nCount = 0 ; nCount < pInfo->dwNumRegions ; nCount++)
    {
        EdbgOutputDebugString("[%d]: Base Address=0x%x  Length=0x%x/r/n" , nCount, pInfo->Region[nCount].dwRegionStart, pInfo->Region[nCount].dwRegionLength);
        if (pInfo->Region[nCount].dwRegionStart < g_dwMinImageStart)
        {
            g_dwMinImageStart = pInfo->Region[nCount].dwRegionStart;
            if (g_dwMinImageStart == 0)
            {
                EdbgOutputDebugString("WARNING: OEMMultiBINNotify: Bad start address for region (%d)./r/n", nCount);
                return;
            }
        }
    }

    memcpy((LPBYTE)&g_BINRegionInfo, (LPBYTE)pInfo, sizeof(MultiBINInfo));
}

When using BLCOMMON during boot loader initialization, for example, OEMDebugInit, the multi-BIN notification function pointer should be assigned to the OEM's notification routine.

For example, to have BLCOMMON call OEMMultiBINNotify to validate the image signature, you should do the following in OEMDebugInit.
在boot loader初始化的时候使用BLCOMMON,例如,OEMDebugInit,the multi-BIN 通知函数指针应该分配给OEM的通知例程。
例如,让BLCOMMON 调用 OEMMultiBINNotify使镜像签名有效,你可以在OEMDebugInit中进行如下设置:
g_pOEMMultiBINNotify = OEMMultiBINNotify;

-----------------------------------------------------------------------------------------------------------------

This function verifies that the address provided is in valid memory.
这个函数校验有效内存中提供的地址。
句式:
BOOL OEMVerifyMemory(
  DWORD dwStartAddr,
  DWORD dwLength
);
参数:
dwStartAddr
[in] Address to be verified.

dwLength
[in] Length of the address, in bytes.
返回值:
TRUE indicates success. FALSE indicates failure.
备注:
g_pOEMVerifyMemory is a function pointer. An OEM can assign the address of a custom verify memory routine that the BLCOMMON code then calls at the appropriate time through this function pointer. The following code example shows how you can perform this routine.
g_pOEMVerifyMemory是一个函数指针。OEM可以分配给一个定制的校验内存例程分配例程,是在适当的时间通过这个函数指针调用 BLCOMMON代码实现的。下面的代码的例子显示了你可以执行这个例程。

BOOL OEMVerifyMemory(DWORD dwStartAddr, DWORD dwLength);
g_pOEMVerifyMemory = OEMVerifyMemory;
要求:
Header blcommon.h
Library blcommon.lib
Windows Embedded CE Windows CE .NET 4.2 and later

-----------------------------------------------------------------------------------------------------------

Mount settings can be located anywhere along a multi-level hierarchy of registry keys starting at HKEY_LOCAL_MACHINE/System/StorageManager/Profiles. The scope of the mount setting narrows at each level in the same manner as variable scope in a C++ program. At any particular level, Storage Manager combines the applicable settings to generate the proper mount settings for a specific instance of a mounted file. Settings at a lower level in the hierarchy override values that might have been set at a higher level.
Mount可以和多级别的注册键值一起被定位在HKEY_LOCAL_MACHINE/System/StorageManager/Profiles的任何地方。mount的范围可以在C++程序中的每一级别以同样的方式作为可视的范围进行狭窄的设置。再任何特定的级别,Storage Manager结合适当的设置可以对一个挂载区域的特定的实例进行适当的mount设置。在其更低一级别的设置可能比更高一级的设置的优先级要高。

    * Mount settings under the base profile key(在基本的文件键值)
      Settings at [HKLM/System/StorageManager/Profiles] pertain to all file systems on all profile-based storage devices; that is, any file system with a block device. Note that this excludes AutoLoad file systems.
      在[HKLM/System/StorageManager/Profiles] 分区下的设置,对于在所有基于文件存储设备上的所有文件系统,任何文件系统都有块设备。注意这个排除了 AutoLoad文件系统。

    * Mount settings under a specific profile key(指定的文件键值)
      Settings at [HKLM/System/StorageManager/Profiles/<MyProfileName>], pertain to all mounted instances of all file systems on storage devices reporting the profile <MyProfileName>.
      在[HKLM/System/StorageManager/Profiles/<MyProfileName>]下进行设置,对于在存储设备上的所有文件系统的挂载实例的分区,记录着<MyProfileName>文件。

    * Mount settings under a file system sub-key of a profile specific key(一个给定文件系统键值下的一个文件系统的子键)
      Settings under a file system sub-key, [HKLM/System/StorageManager/Profiles/< MyProfileName>/<MyFileSystemName >], pertain to only mounted instances of < MyFileSystemName > on storage devices reporting the profile <MyProfileName>.
      在一个文件系统子键下进行设置,[HKLM/System/StorageManager/Profiles/< MyProfileName>/<MyFileSystemName >],只
在存储设备上挂载的< MyFileSystemName >实例记录profile <MyProfileName>的分区。
    * Mount settings under a partition sub-key of a profile specific key(一个给定文件系统的键值下的一个分区子键)
      Settings at [HKLM/System/StorageManager/Profiles/<MyProfileName>/<MyPartitionName>], pertain to only the partition named <MyPartitionName> when mounted on devices reporting the profile <MyProfileName>.
     在[HKLM/System/StorageManager/Profiles/<MyProfileName>/<MyPartitionName>]进行设置,分区只存在 <MyPartitionName>的分区。当挂载在设备记录着文件<MyProfileName>。

For versions of Windows Embedded CE earlier than Windows CE 5.0, you can place mount settings in the MountFlags value. MountFlags value use bitwise OR combinations to specify how the partition should be mounted. Values for MountFlags and its replacements can be set at the Profiles level, and also within an individual profile.
对于Windows CE 5.0之前的版本,你可以进行mount设置在MountFlags value值里。MountFlags value使用逐位或者组合在一起去明确分区是如何被装载的。MountFlags的值和它的替代值可以在Profiles级别进行设置,也可以在每个Profiles下面进行设置。

For Windows CE 5.0 and later, the MountFlags registry flag has been deprecated. Replacement values are simpler: each replacement value can be dword:1, indicating that the setting is turned on, or dword:0, indicating that the setting is turned off.
对于Windows CE 5.0和之后的版本,MountFlags 注册表 的flag已经不推荐使用了。用更简单的值去替代:每个替代值可以被设置成dword:1,指出设置被打开,或者dword:0,指出设置设置被关闭

The following table provides summary descriptions of flags for setting mount values.
下表提供了关于mount值简要的描述和属性


Flag                 Description

"MountFlags"        Indicates how the partition is mounted.
                    This value has been deprecated for Windows CE 5.0 and later. It is                     recommended that you use the replacement registry keys listed below to                     indicate partition mount values.
指出分区是如何挂载的
这个值在Windows CE 5.0 and later已经不推荐使用了。它被推荐使用下面列出的标志分区挂载值的注册表键值来代替。

"MountHidden"       Specifies a hidden file system. Set to 1 to enable.

                    Replaces "MountFlags"=dword:1
明确一个隐藏的文件系统,设置1使能。代替了一签版本使用的"MountFlags"=dword:1

"MountAsBootable"   Specifies that the file system may contain the system registry. The                          first mounted partition on the store gets the hive. Set to 1 to enable.

                    Replaces "MountFlags"=dword:2
明确了文件系统可能包含的系统注册表。存储设备上的第一个挂载的分区是基于蜂窝的,设置1去使能。代替了以往的:"MountFlags"=dword:2
"MountAsRoot"       Specifies to mount as the root of the file system. Set to 1 to enable.

                    Replaces "MountFlags"=dword:4
明确了作为文件系统的根。设置1使能。替代以前版本的"MountFlags"=dword:4
"MountAsROM"        Specifies to mount as an external ROM file system. Set to 1 to enable.

                    Replaces "MountFlags"=dword:10
明确了挂载作为一个扩展ROM文件系统,设置1去使能,替代以前版本的"MountFlags"=dword:10
"MountSystem"       Treats all files and subdirectories as system files. Set to 1 to enable.

                    Replaces "MountFlags"=dword:20
把所有的文件和子路径看成系统文件。设置1使能,替代老版本的"MountFlags"=dword:20
"MountPermanent"    Indicates this volume can never be dismounted. Set to 1 to enable.

                    Replaces "MountFlags"=dword:40
指出了这个分区时永远不能被挂载的,设置1使能。替代以前版本的"MountFlags"=dword:40
"MountAsNetwork"    Indicates this volume receives all UNC paths. Set to 1 to enable.

                    Replaces "MountFlags"=dword:80
指出了这个分区接收所有的UNC路径,设置1使能。替代以前版本的"MountFlags"=dword:80


The following table shows examples of typical replacements for deprecated MountFlags values:
下表显示了典型的替代不赞成使用的MountFlags的值:
Deprecated value:      Replacement values             Description

"MountFlags"=dword:6     "MountAsBootable"=dword:1"MountAsRoot"=dword:1
    

Mounts the partition at the root as a bootable partition.
挂载一个分区在根目录作为一个引导分区表

"MountFlags"=dword:11    "MountHidden"=dword:1"MountAsROM"=dword:1
    

Mounts the partition as ROM, and makes the partition not visible to users.
挂载一个分区作为ROM,并使分区对于用户是不可见的。