Documentation on MapMem library

I read the documentation for MapMem library supplied together with Toradex CE Libraries 2.1 and I have problems in understanding some of the functions.

  • Map_VirtualCopy: Compatible version of VirtualCopy()

Where is the description ov VirtualCopy()? What is it expected to do?

[in] fdwProtect Specifies the protection desired. Where I can find the definition for fdwProtect?

  • Map_VirtualSetAttributes: I don’t understand what is its job
  • Map_LockPages: Locks into memory the specified region of the virtual address space

Could you clarify a little bit more?

  • Map_VirtualCopy: Could you clarify the meaning of fdwProtect parameter?

My suggestion is to improve the documentation for the whole library.

Could someone from Toradex clarify a little bit more, please?

Dear @vix

The functions you describe are hooks into the Kernel which should be only used for very specific purposes, usually to avoid the requirement of building your own image with Platform Builder.

There’s more information about the functions you mention along with their parameters in Microsoft’s Platform Builder documentation. We intentionally provided limited documentation, as it is very important to understand the impact of executing Kernel functions before you consider using them.

Regards, Andy

Hi @andy.tx
based on your explanation I wonder if my approach has sense.

I try to describe it a little bit, so that yoy can give my your opinion.
I need to share data between core M4 and A5 of VF61: for small buffers I use rpmsg library.
When I need to share larger buffers (keeping in mind performance) I thought to a dedicated memory region.
Following this topic I can reserve an area of the DDR.
From the M4 core I can easily write data into this area.

What do you think about this approach?

From the A5 core I think I need MapMem library to get the virtual address of the region.
I think that Map_Init, Map_Deinit, Map_MapMemory and Map_UnMapMemory are the only functions I need (and so I can forget about the other ones).

Do you agree?
Or do you see some dangers in this scenario?

Hi @vix

There is a bootloader setting if you type

set mem.reservedram you can reserve some MB of RAM at the end of DDR. You can freely write this memory from M4 and you can use Map_MapMemory to map this memory to your application on WinCE

Here you can find some documentation about this functions →

https://docs.microsoft.com/en-us/previous-versions/windows/embedded/aa450977(v%3Dmsdn.10)

https://docs.microsoft.com/en-us/previous-versions/windows/embedded/aa450982(v=msdn.10)

https://docs.microsoft.com/en-us/previous-versions/windows/embedded/ms886744(v%3Dmsdn.10)

Hi @vix
I fully agree. These 4 functions are the ones which are commonly used to access physical RAM or peripheral registers. Your approach is perfectly fine.
Regards, Andy