Re: Accessing peripherals from a managed application



And .NET CF 2.0 has serial port classes built into it...

Paul T.

"Bruce Eitman (eMVP)" <beitman.nospam@xxxxxxxxxxxxxxxxxxxxxx> wrote in
message news:u8XW2AUkGHA.1936@xxxxxxxxxxxxxxxxxxxxxxx
You don't, because you don't call those functions.

You call the Win32 APIs for serial ports. Look in help for the Serial
Communications Functions. You could probably find some code at
OpenNetCF.org like OpenNetCF.IO.Serial

--
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:1150418975.424374.64740@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
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: Accessing peripherals from a managed application
    ... Paul G. Tobey [eMVP] wrote: ... I did find that System.IO.Port has the functionalities of a serial port ... with the serial port and/or the driver used in PB to build the OS ...
    (microsoft.public.windowsce.app.development)
  • Re: Accessing peripherals from a managed application
    ... There's a driver for, ... I did find that System.IO.Port has the functionalities of a serial port ... Paul G. Tobey wrote: ... Call on the imported functions to access the hardware. ...
    (microsoft.public.windowsce.app.development)
  • Re: WRITE_PORT_BUFFER_ULONG
    ... WRITE_PORT_BUFFER_ULONG is normally used in a disk driver or ethernet ... This sounds like too high speed of an operation for a serial port. ... If the hardware you are using can support such high data-rates, ... |> smaillet at EmbeddedFusion dot com ...
    (microsoft.public.windowsce.embedded.vc)
  • Re: Windows and USB communication
    ... > Yes, I have a driver, but it is for Win 9x,NT :-( ... >> created that, when opened, actually sends the data via the USB port. ... >> Paul T. ... >>>similar to Serial Port programming in the MSDN. ...
    (microsoft.public.windowsce.app.development)
  • Re: Serial port failure
    ... message to a group of embedded boxes daisy chained via the serial port. ... Assuming the driver is locking up then it looks like a serial port ... My advice is to try a different serial port hardware. ...
    (comp.lang.python)