Re: Call standard C functions in device driver



Well, you're wrong about what's in the kernel and what's in user space in
CE5, but that's not relevant.

When you're implementing your device driver, you usually have to implement
the various functions like Init, Open, Read, Write, IoCtl, Close, Deinit,
and the power-handling stuff (or specific functions for other sorts of
drivers like an NDIS driver). If you look in the documentation for those
call implementations, XXX_Init(), XXX_PowerUp(), etc., you'll see what
restrictions apply (look at XXX_PowerUp() for an example). If you're doing
something else, like implementing an interrupt service routine for your
driver, you need to look up that in the help and see what the restrictions
are. The same for an interrupt service thread. There's no global
you-can-never-call-these-functions-from-your-driver list because there can't
be a list like that.

Paul T.

"Marco Wang" <marco.wxy@xxxxxxxxx> wrote in message
news:fc1daf39-17cd-4a68-ae9f-db3b18be2e35@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
On Nov 4, 10:29 pm, "Bruce Eitman [eMVP]"
<bruce.eitman.nos...@xxxxxxxxxxxxxxxxxxx> wrote:
And of course, you can always try it to find out for yourself.

--
Bruce Eitman (eMVP)
Senior Engineer
Bruce.Eitman AT EuroTech DOT com
My BLOGhttp://geekswithblogs.net/bruceeitman

Thanks for your guys' responses, but my question is not really
answered.

The biggest difference between Linux and Windows CE is that Linux is
monolithic kernel, in contrast, Windows CE is micro-kernel based. In
Linux, all device drivers, either built within kernel or as a module
driver, are all linked with kernel executable. There is no concept of
DLL here, either. Only symbols (functions, global variables) exported
from kernel can be referred by a device driver.

No idea about Windows CE 6.0, but for CE 5.0, only nk.exe is running
in "real" kernel mode, devices.exe, gwes.exe, filesys.exe are actually
running in user space. In addition, Windows CE 5.0 uses a flat virtual
memory model, which is also different with Linux.

My understanding in general is that a Windows CE device driver can
call most of standard C functions (I mean POSIX C functions which are
available on Win32 platform) and Win32 APIs as long as it is in user
space context at most of time, plus it is "compiled" and "linked" as
DLL already. Certainly there are special functions for device drivers
only, for instance physical memory access, virtual memory access, etc.

However, I don't find any document from MSDN which emphasizes what API
a device driver should NOT call in specific circumstance.

Thanks,
Marco Wang


EuroTech Inc.www.EuroTech.com

"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT

com> wrote in messagenews:elOJt2cPJHA.2312@xxxxxxxxxxxxxxxxxxxxxxx
Version of Windows CE?

Generally, some standard Win32 functions can be called in some
situations
from drivers, yes. There are also situations where you should not be
calling some or all Win32 functions. Those are documented in the help.
If you have a specific question, you're a lot more-likely to get a
clear,
simple answer...

Please read:

http://guruce.com/blogpost/howtoaskquestionsonnewsgroups

Paul T.

"Marco Wang" <marco....@xxxxxxxxx> wrote in message
news:2323df68-f2e8-4d9e-b7d5-037befbeaf0b@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hello,

I get confused with a fundamental concept regarding Windows CE device
driver. In Linux, we can't call standard C functions because Linux
kernel has no concept of C runtime library. Then how about Windows CE,
is it allowed to call C functions in a kernel mode Windows CE device
driver?

Thanks,
Marco Wang


.



Relevant Pages

  • Re: 2.6.30-rc4 kernel
    ... I think there may be a problem with the 2.6.30 kernel that is ... # Generic Driver Options ... # PCI IDE chipsets support ... # Other IDE chipsets support ...
    (Linux-Kernel)
  • 2.6.30-rc4 kernel
    ... kernel panic - not syncing: ... # Generic Driver Options ... # PCI IDE chipsets support ... # Other IDE chipsets support ...
    (Linux-Kernel)
  • [PATCH 18-rc2] Fix typos in /Documentation : N-P
    ... Again, if you're not gonna do synchronization with disk drives (dang, ... -the kernel. ... There are two options specific to PSX driver portion. ... The driver uses the settings from the EEPROM set in the SCSI BIOS ...
    (Linux-Kernel)
  • Re: Video editing in Linux?
    ... but the majority of windows based games were using the Directx ... >>that linux used to use for audio. ... the philosophy behind much of the linux kernel is to avoid putting large ... ALSA has a driver component and a library ...
    (alt.linux)
  • two scary syslog kernel messages
    ... Sep 20 03:46:06 marvin kernel: kernel BUG at mm/rmap.c:482! ... ACPI: Local APIC address 0xfee00000 ... Allocating PCI resources starting at 80000000 ... ** driver failed to call pci_enable_device. ...
    (Debian-User)