How to communicate through EIM in C#?

I have a C program of iMX6 processor which communicates with EIM bus. Is there any way to write and read on EIM bus by using C#?
For example, I have done GPIO program in C#. Available library on toradex board was TdxAllLibraries.dll. Using these .dll, i Was able to configure/perform operations on GPIO.
In communication through EIM bus, suppose i have to write a command 0XAA on a register and receive an acknowledgement from FPGA through EIM bus written in another register. How can i write a program based on communication through EIM bus in C#. I am successful in writing the communication through EIM bus in C program. But since my other modules are coded using C#, I wanted a way where I could either use this C program in C# or communicate through EIM bus by writing code in C#.
Thank you for the help.

Dear @rupal.gudadhe@bitmapper.com

The .NET CF framework does not allow to directly access memory locations, which is required to access EIM.

The solution therefore is to

  1. create a DLL from your native C code, and
  2. On the C# side, use the DllImport() statement to make your DLL functions available to C#.

Regards, Andy

Thank you sir… Can you give sample code ? It will be very helpful for me.

Dear @rupal.gudadhe@bitmapper.com

I don’t have a complete example readily available.
For the EIM Bus there’s a simple example on the developer page:

For the import into C#, there are plenty of examples available. Just google for “P/Invoke”

Regards, Andy

I downloaded you basic C code. After downloading your C code and modified the same C code in other program. It is giving me an error of header file Example: ‘mapmem.h’ ,‘clk_imx6.h’, ‘gpio_imx6.h’.
I got this header file from your sample code but when I tried to include them in my project it is giving me a fatal error of “can not open include file mapmem.h’ : No such file or directory”
Please let me know how can I add the header file? and Is any other file required to run program?

Dear @rupal.gudadhe@bitmapper.com

Please download the complete Toradex Ce libraries, and modify the Mapmem demo application without moving it. This way all the paths are setup correctly, and you won’t get such an error.

Regards, Andy