Книга: Microsoft Windows Embedded CE 6.0 Exam Preparation Kit
Allocating Physical Memory
Allocating Physical Memory
It's possible to allocate a portion of memory so you can use it in a driver or the kernel. There are two ways to do this:
? Dynamically, by calling the AllocPhysMem function AllocPhysMem allocates contiguous physical memory in one or more pages that you can map to virtual memory in the user space by calling MmMapIoSpace or OALPAtoVA, depending on whether the code is running in user mode or kernel mode. Because physical memory is allocated in units of memory pages, it is not possible to allocate less than a page of physical memory. The size of the memory page depends on the hardware platform. A typical page size is 64 KB.
? Statically, by creating a RESERVED section in the Config.bib file You can statically reserve physical memory by using the MEMORY section of a run-time image's BIB file, such as Config.bib in the BSP folder. Figure 6-9 illustrates this approach. The names of the memory regions are for informational purposes and are only used to identify the different memory areas defined on the system. The important pieces of information are the address definitions and the RESERVED keyword. According to these settings, Windows Embedded CE excludes the reserved regions from system memory so that they can be used for DMA by peripherals and data transfers. There is no risk of access conflicts because the system does not use reserved memory areas.
Figure 6-9 Definition of reserved memory regions in a Config.bib file
- EVENT MEMORY SIZE
- 12.2.1 Port-Mapped vs. Memory-Mapped I
- Displaying Free and Used Memory with free
- Passwords and Physical Security
- Physical Structure of the File System on the Disk
- 2.3.1. Flash Memory
- 2.3.5. Memory Space
- 2.3.7. Process Virtual Memory
- 9.3. MEMORY MANAGEMENT IN CHORUS
- Physical Address Extension (PAE)
- 1.3.10 EEPROM Data Memory
- 2.1.1 Program Memory Organization