Re: Accessing peripherals from a managed application



Paul,

Thanks for your input. I used dumpbin utility to find out the headers
of the dll files. I did not find anything in the coredll.dll that
resembled functions for uart. However, I did find functions possible
related to the serial port on com16550.dll (output at the end of this
post) that was in my project release directory. Now, I can do a
P/Invoke on this functions, but how do I find what parameters each one
of these functions has? I tried the P/Invoke Wizard from Paul Yao's
site, but it kept crashing my system.



Regards,

Mario



Dump of file com16550.dll

File Type: DLL

Section contains the following exports for SERIAL.dll

00000000 characteristics
44903EE6 time date stamp Wed Jun 14 09:52:54 2006
0.00 version
1 ordinal base
12 number of functions
12 number of names

ordinal hint RVA name

1 0 00001A44 COM_Close = COM_Close
2 1 00001C0C COM_Deinit = COM_Deinit
3 2 000022E0 COM_IOControl = COM_IOControl
4 3 000030E8 COM_Init = COM_Init
5 4 00003380 COM_Open = COM_Open
6 5 000020F0 COM_PowerDown = COM_PowerDown
7 6 000020B0 COM_PowerUp = COM_PowerUp
8 7 0000198C COM_PreClose = COM_PreClose
9 8 00001BA4 COM_PreDeinit = COM_PreDeinit
10 9 00001D30 COM_Read = COM_Read
11 A 000020A8 COM_Seek = COM_Seek
12 B 00003618 COM_Write = COM_Write

Summary

1000 .data
1000 .pdata
1000 .reloc
7000 .text


Paul G. Tobey [eMVP] wrote:
How would a C/C++ program talk to the driver? You'll do exactly the same
thing from managed code. Maybe you open the driver with CreateFile(), and
read and write to it with ReadFile() and WriteFile(). If that's the case,
you'd P/Invoke to those API calls from managed code, yes. You don't somehow
import everything in coredll.dll. You declare the functions that you want
to call, indicating that they are in coredll.dll (*if* they are in
coredll.dll and not some other DLL), and then call them.

Paul T.

"Mario" <alphatommy@xxxxxxxxxxx> wrote in message
news:1150392387.307256.105420@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Bruce,

Thanks for the post. I do have the drivers for the hardware since they
came with the devevelopment board. What I have not figure out is how
to access to the driver from a managed application. From what I have
gathered, this is the sequence for developing a managed application
with VS2005 and PB (WinCE 5.0)

1. Create an OS image wtih PB.
2. Somehow figure out the headers contained in coredll.dll
3. use dllimport to import coredll.dll in the managed application in
VS2005.
4. Call on the imported functions to access the hardware.

Am I far off? The first experiment that I want to do is just to send
some data through the SPI or UART from a managed app. Again, thanks
for any additional input.

Best Regards,

Mario




Bruce Eitman (eMVP) wrote:
Mario:

Since nobody else replied, I will. I am not a Managed App developer, but
I
can tell you how this is typically done.

Typically, the hardware is accessed via a driver written in C/C++, then a
managed app accesses the driver to access the hardware. It is
intentionally
difficult, or impossible, to access hardware from managed code.

--
Bruce Eitman (eMVP)
Senior Engineer
beitman AT applieddata DOT net

Applied Data Systems
www.applieddata.net
An ISO 9001:2000 Registered Company
Microsoft WEP Gold-level Member

"Mario" <alphatommy@xxxxxxxxxxx> wrote in message
news:1149526298.777516.168540@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi,

I would appreciate it if someone could point me to a link, docs, or
tutorials regarding peripheral access from a managed application.
Things that I am interested in includes simple initialization and usage
of the SPI interface or GPIOs. I am using XScale with Win CE 5.0 and
developing the managed application with VS2005(C#). Thanks in advance.


Best Regards,

Mario



.



Relevant Pages

  • Re: ASM noob - couple of questions
    ... If someone wrote a DLL, which would run like a service of something, we ... would such a service give access to program windows ... writing a driver can give you direct access to many hardware features, ... service would expose your code to the actual hardware and thus YOU ...
    (alt.lang.asm)
  • Re: IISR from VS2005, with no BSP source
    ... hardware on an Arcom Viper processor. ... There are several IRQ ... driver without modifying the image itself. ... The driver DLL has no .lib links, and no DLLs shown in the Depends ...
    (microsoft.public.windowsce.platbuilder)
  • [opensuse] openSUSE 10.3 not detecting SATA HD
    ... the sata_sis driver. ... I've tried turning off ACPI in bios and acpi=off which ... openSUSE 10.2 and all my hardware is working fine. ... info.product = 'USB Raw Device Access' ...
    (SuSE)
  • Re: 2008 SBS no longer boots
    ... driver issue initially, the fact that it seems to happen randomly now ... weird with a hardware problem that consistently doesn't get through boot ... other customer, even a 2 week old one, the problem immediately returned. ... There was a time when a server was fired up with a specialized OS and had a battery of tests run against each component to purposefully stress it. ...
    (microsoft.public.windows.server.sbs)
  • Re: Linux, X, ld, gcc, linking, shared libraries and stuff
    ... >> because, originally, video cards / system RAM could NOT afford to have ... > GL actually "copies" everything, but it's done by the graphics card, so ... > anyway if it's not hardware accelerated. ... installed the proper driver, then it zooms around the screen... ...
    (alt.lang.asm)

Loading