Книга: 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

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


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