Skip to content

EDMC Example

Name

example_edmc - MemBroker opeartion example.

Description

KNEO Pi provides an application called example_edmc designed for MemBroker demostrations. This application demonstrates the creation and release of EDMC memory and cache related operations.

Before using the MemBroker, ensure that edmc.ko is loaded.

After installing the EDMC driver, continuous physical memory can be allocated by the MemBroker component. MemBroker uses contiguous memory allocator (CMA) mechanism in kernel. CMA is a memory allocator within the kernel which allows allocating large chunks of memory with contiguous physical memory addresses. When using MemBroker library in applications, users should follow the rules below.

  • All Kneron hardware engines need to use memory allocated by MemBroker library.
  • Keep cache in coherence when the memory buffers allocated by MemBroker library are accessed by both CPU and hardware engines.

MemBroker API Reference as below:

Function Name Description
MemBroker_GetMemory Allocate memory from EDMC.
MemBroker_FreeMemory Free memory to EDMC.
MemBroker_GetPhysAddr Translate a virtual address to a physical address.
MemBroker_CacheCopyBack Copy data from CPU cache to external DRAM.
MemBroker_CacheInvalidate Invalidate CPU cache tags.

Example

Use the following command to start the edmc process:

./example_edmc