Drivers

There are 46 entries for the tag Drivers
Windows CE: Using a Driver to Read/Write Hardware Registers
Download GPIO Example driver and appplication source code A recent discussion thread in the Windows Embedded Compact Platform Development forum made it clear to me that for new Windows CE Software Engineers doing something as simple as accessing a hardware register can be very difficult. In the old days, Windows CE 5.0 and before, it was very easy; write an application that allocates a virtual address and then read or write a register. The problem with that is that allowing applications to access ......

Posted On Sunday, August 1, 2010 4:21 PM | Comments (14)

Windows CE Chat Transcript (March 30, 2010)
For those of you who missed the chat today, here is the raw transcript. By raw, I mean that I copied and pasted the discussion without any edits. This is divided into two parts, the top part is the answers from the Microsoft Experts and the bottom part is the questions from the audience. Answers from Microsoft: Karel Danihelka [MS] (Expert)[2010-3-30 12:2]: Hi everyone, my name is Karel Danihelka and I am developer in partner response team. Sing Wee [MS] (Expert)[2010-3-30 12:2]: Hi, I'm Sing Wee, ......

Posted On Tuesday, March 30, 2010 8:33 PM | Comments (0)

Windows CE: Using IOCTL_DISK_GET_STORAGEID
A customer approached me recently to ask if I had any code that demonstrated how to use STORAGE_IDENTIFICATION, which is the data structure used to get the Storage ID from a disk. I didn’t have anything, which of course sends me off writing code and blogging about it. Simple enough, right? Go read the documentation for STORAGE_IDENTIFICATION which lead me to IOCTL_DISK_GET_STORAGEID. Except that the documentation for IOCTL_DISK_GET_STORAGEID seems to have a problem. The most obvious problem is that ......

Posted On Sunday, March 21, 2010 10:50 PM | Comments (3)

Platform Builder: The K Flag and Your Driver
One of our engineers was adding a third party driver to system today and had trouble getting it to work. When he installed from the CAB file that was provided, it worked correctly. When he built it into the OS, it wouldn’t work correctly (unfortunately I didn’t discuss it in enough detail to tell you what it was doing.) Just before the end of the day he called out to me and said he left the K flag out. For those of us who read the Platform Builder newsgroup regularly, we know that this is a common ......

Posted On Thursday, February 4, 2010 1:47 PM | Comments (3)

Windows CE Chat Transcript (November 24, 2009)
For those of you who missed the chat today, here is the raw transcript. By raw, I mean that I copied and pasted the discussion without any edits. This is divided into two parts, the top part is the answers from the Microsoft Experts and the bottom part is the questions from the audience. Answers from Microsoft: msft_davbo (Moderator): Our chat today covers the topic of Windows Embedded CE! 1. This chat will last for one hour. During this hour, our Experts will respond to as many questions as they ......

Posted On Tuesday, November 24, 2009 1:40 PM | Comments (0)

Windows CE
What is Windows CE? Microsoft says that Windows CE is “Componentized, real-time operating system for a wide range of small footprint devices” on their WEB site. That is a very precise description, but what does it really mean? Windows CE is designed for embedded systems. An embedded system is typically a device that doesn’t necessarily look like a computer, but provides some special functionality. Examples of embedded computers are GPS systems, voting machines, Automated Teller Machines, Point Of ......

Posted On Wednesday, October 14, 2009 12:47 PM | Comments (3)

Windows CE: Watchdog Timers
Watchdog timers have been coming up in discussions lately, so I thought it might be good to start a discussion about the use and misuse of watchdog timers in a preemptive multitasking operating system, like Windows CE. I am going to share my thoughts, but look forward to you, my reader, sharing your thoughts on the subject. I am going to focus this discussion on hardware watchdogs, totally ignoring the software watchdog that is included in Windows CE and discussed by Luca Calligaris in an article ......

Posted On Tuesday, September 29, 2009 8:03 PM | Comments (2)

Windows CE: Suspend, What Really Happens?
What happens when a Windows CE device suspends? What does suspend mean? Let’s look at these, but not in the technical sense of examining all of the details and twists and turns, but in terms that an application developer and maybe a user may want to know. Suspend, also known as putting the device to sleep or on some devices turning it off, is a way to put a device in a state that it consumes very little electricity. This is important for battery operated devices, like PDAs and cell phones. The system ......

Posted On Monday, September 21, 2009 8:07 PM | Comments (11)

Windows CE: Modifying XXX_Open() for the Power Manager
Previously I wrote about adding power management support to a stream interface driver in Windows CE: Stream Interface Driver Power Management. What I didn’t discuss was that the Power Manager needs to open the driver so that it can call DeviceIoControl() to access the IOCTLs. Of course that isn’t a problem if the driver is written to support multiple opens, but many drivers neither need or support multiple opens. These drivers usually have a flag or counter to restrict the number of open handles. ......

Posted On Tuesday, September 15, 2009 9:36 PM | Comments (0)

Windows CE Chat Transcript (August 25, 2009)
For those of you who missed the chat today, here is the raw transcript. By raw, I mean that I copied and pasted the discussion without any edits. This is divided into two parts, the top part is the answers from the Microsoft Experts and the bottom part is the discuss (questions) from the audience. Answers from Microsoft: RajeevDu[MS] (Expert): Hi, This is Rajeev Dubey, Bluetooth Program Manager. Sue Loh [MS] (Moderator)[12:02]: Hi, I’m Sue Loh, a developer in the Windows Devices Core team at Microsoft. ......

Posted On Tuesday, August 25, 2009 12:09 PM | Comments (0)

Windows CE: CeSetPowerOnEvent()
CeSetPowerOnEvent() is an interesting and powerful function when used with Windows CE 4.1 and 4.2, but after that its behavior changes. CeSetPowerOnEvent() was created to allow drivers to set events in their XXX_PowerUp() and XXX_PowerDown() functions. The power functions must not call functions that block or could cause a context switch, which included SetEvent(), so CeSetPowerOnEvent() was created to queue up the events temporarily to be signaled later. Behavior of CeSetPowerOnEvent() in Windows ......

Posted On Sunday, August 9, 2009 9:12 PM | Comments (0)

Windows CE: Synchronization Objects – Events
Events are one of the synchronization objects provided by the Windows CE kernel. Events are used to allow one thread to signal one or more threads that something happened. Examples: · Events are used by the kernel and drivers to handle system interrupts. When an interrupt occurs the kernel signals the driver by setting an event that the driver waits for. · Events are sometimes used to signal driver or services that registry settings have been changed by an application or Control Panel Applet. The ......

Posted On Tuesday, July 28, 2009 9:16 PM | Comments (10)

Platform Builder: Looking for an Engineer
Eurotech is looking for a Senior Software Engineer to port and maintain Windows CE on our single board computers. This position is in our Columbia, MD office near Baltimore and Washington DC. If you are looking for a change, or know a good engineer, take a look at our Eurotech Careers page. We are not looking for application developers. We are looking for engineers with experience writing device drivers and bootloaders. We would prefer engineers with Platform Builder experience. But that is not a ......

Posted On Monday, June 15, 2009 11:09 PM | Comments (0)

Platform Builder: Creating a New Project Design Template for Windows CE 6.0
The Design Template can be downloaded from: Download the Design Template The new Windows Embedded CE 6.0 New Design Wizard is configurable by adding new templates to a catalog file (PBCXML). You may already know that you can add new BSPs to the catalog and these will then be listed in the wizard. You can also add new design templates for selecting the starting OS components. Having a custom design template can be useful to standardize the systems that you develop. At Eurotech, we have a set of Commercial ......

Posted On Saturday, April 11, 2009 11:47 PM | Comments (0)

Platform Builder: Adding a Binary Component to the Catalog
In Platform Builder 6.0: Creating a Catalog File I discuss creating a catalog file for a BSP. Someone asked me about adding a binary component to the catalog, so let’s look into that. To start with, let’s assume that the binary is a DLL that is in the BSP Files folder, and that the BIB and REG file settings are in Platform.bib and Platform.reg. The BIB and REG file settings look like this: Platform.bib IF BSP_MYBINARYDRIVER MyBinaryDriver.dll $(_FLATRELEASEDIR)\MyBinary... NK K ENDIF Platform.reg ......

Posted On Monday, April 6, 2009 9:13 PM | Comments (5)

Windows CE: What is a Bootloader?
A bootloader is a small program that handles the reset vector and starts up a system. Bootloaders are not all equal, so writing about them is difficult to do without discussing the optional things that a bootloader might do. The only reasons to have a bootloader is to provide a mechanism for updating the software on a device or to retrieve the OS from some storage medium and move it to RAM to run which are the “loader” parts of the bootloader. Anything else that a bootloader might do are optional. ......

Posted On Monday, March 30, 2009 8:50 PM | Comments (4)

Windows CE: How to Break a System with Two Lines of Code
I was recently working on a driver that would fail to work about 50% of the time when the system booted. The driver used to work, and it hadn’t been changed. I started reviewing the change log for the entire BSP, not too many changes to existing files and a few new drivers were added. None of the changes looked like they could affect the problem, or at least not when I was reviewing the code quickly. After some work, I decided to probe the reset line to the chip that the driver controlled. To my ......

Posted On Tuesday, March 24, 2009 12:50 PM | Comments (0)

Windows CE: Accessing a Stream Interface Driver from an Application
This week I was asked how to access a stream interface driver from an application. The request came from someone who was trying to call the XXX_Open, XXX_Write… functions directly from his application. By directly, I mean using LoadLibrary() and GetProcAddress(). Let’s start with stating that calling the functions directly is not the way to call the functions in a driver. In fact, a Windows CE 6.0 kernel driver cannot be accessed at all by applications directly. Let us think about that for a moment ......

Posted On Saturday, March 21, 2009 9:53 PM | Comments (3)

Windows CE: Monitor Power State Changes
I started writing this as a how to monitor for system resume. But then I thought that a more general function that monitors for power state changes would be more useful. Many applications have reasons to monitor for Suspend and Resume transitions. There isn’t a good general way to monitor for Suspend, but applications can be notified when the system resumes. I do think that it would be good for applications to be notified on suspend so that they can save data just in case of power loss during suspend. ......

Posted On Saturday, February 14, 2009 11:33 PM | Comments (6)

Windows CE: More on Starting an Application when the Device Boots
I have written several posts about starting an application when a Windows CE device boots. These posts have been fairly popular, but there are still some questions. The how to posts include: · Windows CE: Starting an Application when the System Boots which covers information needed by both application developers and Platform Builder users. · Windows CE: Programmatically Setting Up an Application to Auto Start which covers writing an application that sets itself up to run when the system boots. · ......

Posted On Saturday, February 7, 2009 11:49 PM | Comments (0)

Windows CE: Interrupt Service Thread Example
In Windows CE: Interrupt Service Thread I discussed the steps required by an Interrupt Service Thread (IST.) Refer to that post for an explanation of the following code. static DWORD WINAPI DSInterruptThread(LPVOID p) { DWORD RetVal = 0; HANDLE hEvent; DWORD SysintrValue; DWORD IRQ = MYDRIVER_IRQ; // Create an Event hEvent = CreateEvent(NULL, FALSE, FALSE, NULL); // Register with the Kernel KernelIoControl(IOCTL_HAL_R... &IRQ, sizeof(DWORD), &SysintrValue, sizeof(DWORD), NULL) ......

Posted On Friday, January 16, 2009 10:43 PM | Comments (9)

Windows CE: Interrupt Service Thread
An Interrupt Service Thread (IST) is the way that drivers in Windows CE service an interrupt. Typically, a driver will contain a thread function that handles the interrupt, and does nothing else. A typical IST will do the following: 1. Create an Event 2. Register with the kernel 3. Set the thread priority 4. Wait for the event to be signaled 5. Service the hardware 6. Tell the kernel that the interrupt has been serviced 7. Repeat steps 3, 4 and 5 There are certainly variations in how ISTs are written ......

Posted On Thursday, January 15, 2009 8:37 PM | Comments (12)

Windows CE 6.0: Example UIProxy User Mode DLL
The UIProxy source code can be downloaded from: Download UIProxy Source Code In Windows CE 6.0: Using UIProxy I discussed how to use CeCallUserProc() and the UIProxy. I showed some simple code for displaying a very simple MessageBox(). For this post, I thought that it would be interesting to flesh that out a little more and create a user mode DLL that wraps MessageBox() and allows the driver to do everything with MessageBox() that it might do if it was calling it directly. Almost everything, except ......

Posted On Saturday, January 10, 2009 8:15 PM | Comments (0)

Windows CE 6.0: Using UIProxy
Starting with Windows CE 6.0 kernel mode drivers cannot call User Interface (UI) functions. To overcome this Windows CE 6.0 provides the UIProxy and a new function, CeCallUserProc(). Kernel mode drivers can call CeCallUserProc() to request that a user mode dll be loaded and a function in the dll be called. When writing the driver, also write the user mode dll and provide functions that will present a UI for the driver. Luca Calligaris was nice enough to provide an example function in response to ......

Posted On Saturday, January 10, 2009 6:02 PM | Comments (0)

Platform Builder: Compiler Optimization and Volatile
Many of you already know about the use of the C/C++ keyword volatile, but I was having a discussion with a colleague this afternoon and the topic came up. The colleague is a bright up and coming engineer who finds himself writing software, but really wanting to design hardware. He was telling me about a test that he wrote to estimate the CPU speed of a board. Simple little application, get the current milliseconds using GetTickCount(), then run a busy loop. When the loop completes call GetTickCount() ......

Posted On Tuesday, December 30, 2008 10:40 PM | Comments (0)

Windows CE: Stream Interface Driver Registry Settings
If you have looked at my other posts on stream interface drivers, you have seen that the registry settings that I use for Driver Shell are: [HKEY_LOCAL_MACHINE\Drivers... "Dll"="DriverShell.dll" "Order"=dword:4 "Prefix"="XXX" "DeviceArrayIndex"=dword:1 "IClass"="{A32942B7-920C-48... I thought that I would discuss these a little more, and includes some other settings. Let’s start with the key HKEY_LOCAL_MACHINE\Drivers\... The key HKEY_LOCAL_MACHINE\Drivers\... ......

Posted On Monday, December 8, 2008 9:33 PM | Comments (11)

Windows CE: Enhanced BusEnum
Yuqun Cao, SDE, Windows CE JDP of Microsoft, released a whitepaper on enhancing BusEnum a few months ago. I finally had a chance to read it yesterday and was impressed by the additions that he made to BusEnum. The changes allow for drivers to be loaded asynchronously. This change can be used to speed up the perceived time to boot a Windows CE system to the desktop or a kiosk application. The BusEnum that comes with Platform Builder loads drivers one at a time. It loads the drivers using ActivateDeviceEx() ......

Posted On Wednesday, November 12, 2008 9:32 PM | Comments (10)

Windows CE: Closing Invalid Handles
I pulled some old source code off the shelf recently, dusted it off and started modifying it. Okay, that was my first mistake… I really should have tested it first but that actually would not have helped this time. When the system booted up, it successfully loaded drivers and then when it came to loading Explorer.exe all heck broke loose. Sometime the desktop would appear and other times it would not. When the desktop would appear, GWES would data abort. The system was a mess, and needed to be fixed. ......

Posted On Thursday, October 23, 2008 12:59 PM | Comments (0)

Platform Builder: Understanding the Serial Debug Port
Recently, there have been a few questions in the newsgroups about the serial debug port. The questions were along the lines of: · Which COM port do I use for debug output? · How do I change the COM port that is used for debug output? These are actually quite common questions, so I thought I would address these. Every CPU and/or UART is different so I won’t give you a how to lesson, but I will provide you with enough information to look inside your BSP to figure it out for yourself. First, let’s address ......

Posted On Monday, September 8, 2008 9:32 PM | Comments (2)

Windows CE: Data Synchronization using Interlocked Functions
Windows CE provides several ways to synchronize threads and access to data by multiple threads. These include the synchronization objects that are typical for a multithreaded operating system: mutex, semaphores, events and critical sections. These synchronization objects may be overkill for protecting access to a single variable. The Interlocked functions can be used to control access to a single 32 bit variable. The interlocked functions are: Function Name Action InterlockedCompareExchange Compares ......

Posted On Wednesday, September 3, 2008 8:42 PM | Comments (0)

Books on My Shelf: Windows Embedded CE 6.0 Fundamentals
Windows Embedded CE 6.0 Fundamentals by Stanislav Pavlov and Pavel Belevsky is one of the first books about developing a Windows CE device using Platform Builder available in several years. As the name states, this book contains the fundamentals of developing using Platform Builder. It does not venture into too many details though, so this is a book for beginners, not beginning programmers, but beginners with Platform Builder. This book is fairly short at 230 pages, as technical books go, so reading ......

Posted On Tuesday, August 26, 2008 11:10 PM | Comments (0)

Platform Builder: Cloning an MDD Lib
I have written about cloning code from the Public tree to a platform in the past, but someone recently asked about cloning an MDD lib build directory. More specifically the question was about cloning ufnmdd.lib in Windows CE 5.0, which is actually created by linking three separate libs together. In this article, I will walk through the process by cloning one of those libs. Ufnmdd.lib is created by linking ufnmddbase.lib, ceosutil.lib and defbuslib.lib. I suspect that most people don’t really need ......

Posted On Thursday, August 21, 2008 12:10 AM | Comments (2)

Windows CE: Device Driver Summary
Posts About Stream Interface Drivers Windows CE: A Stream Interface Driver Shell This post contains all of the code necessary to create a driver which will actually be loaded by the device manager. It gives a simple starting point for developing a Stream Interface driver. Windows CE: Stream Interface Driver, DllEntry() A short post about what the DllEntry() function does in a device driver. Windows CE: Stream Interface Driver, XXX_Init() A discussion of what can and should be done by the driver XXX_Init() ......

Posted On Wednesday, August 13, 2008 10:02 PM

Windows CE: Stream Interface Driver Power Management
The DriverShell source code can be downloaded from: Download DriverShell Source Code Windows CE runs on many battery powered devices and therefore needs to be able to minimize the power consumption to maximize battery life. To do this Windows CE has a power manager that can be used to notify device drivers when the system power state changes. Drivers can then respond to the notification by powering down the hardware that they manage. Basic Power Management The most basic power handling that a driver ......

Posted On Wednesday, August 13, 2008 9:05 PM | Comments (9)

Platform Builder: My Stream Interface Driver Does Not Load
You just created a new Stream Interface driver, but it isn’t being loaded. I hear this a lot and thought it would be good to look into the possible causes. Hopefully, if you are here you have already reviewed Windows CE: A Stream Interface Driver Shell which provides a very basic driver an all of code and other files to demonstrate a driver that actually loads. The first things to check: 1. Is the driver in you OS image? Check to see that it is in %_FLATRELEASEDIR%\ce.bib. 2. Do all of the functions ......

Posted On Friday, August 8, 2008 1:07 PM | Comments (8)

Windows CE: Stream Interface Driver, XXX_Init()
In the DriverShell Example that I posted (Windows CE: A Stream Interface Driver Shell), I included an XXX_Init() function that didn’t do very much. This post will discuss the things that you can do with XXX_Init(). For reference, this is the function as I originally posted it. DWORD XXX_Init(LPCTSTR RegistryPath, DWORD dwBusContect) { HKEY hKey; RETAILMSG( 1, (TEXT("XXX_Init\n"))); hKey = OpenDeviceKey(RegistryPath); if ( !hKey ) { RETAILMSG(1, (TEXT("Failed to open devkeypath,\r\n"))); } else { ......

Posted On Thursday, August 7, 2008 9:56 PM | Comments (6)

Windows CE: Why is reading from the driver so slow?
I was working with a customer today and discovered that their application was calling into one of my drivers repeatedly to read 4 bytes at a time, each time reading the next 4 bytes of data. The driver reads a minimum of 4 bytes, or they probably would have read less, but the driver is capable of reading large quantities of data on each call from the application. This really isn’t all that uncommon though and it actually will read the data correctly. The problem is that each call to the driver has ......

Posted On Tuesday, August 5, 2008 8:41 PM | Comments (6)

Windows CE: Loading a Driver with ActivateDeviceEx
In my post about a basic driver shell, I assumed that the driver was built into the system including the registry settings to cause the device manager to load the driver when the system booted. Sometimes there is a reason to load a driver when an application starts. For that there are several functions that can be used including; RegisterDevice, ActivateDevice and ActivateDeviceEx. RegisterDevice is maintained for backward compatibility, but for future compatibility you probably should start using ......

Posted On Monday, July 14, 2008 9:16 PM | Comments (28)

Windows CE 6.0: VMProcessPageFault Error: Page Fault during Resume
When we first ported our BSP to Windows CE 6.0 we started to see this VMProcessPageFault Error: Page Fault message in our debug output during resume from sleep. The system seemed to be working okay, but this message seemed ominous so as we continued to work on the port we kept an eye on the problem and investigated the possible cause of the message. Others had reported this message and they discovered the cause was that they had a driver that was calling a system API in XXX_PowerUp. Microsoft has ......

Posted On Wednesday, July 9, 2008 10:27 PM | Comments (3)

Windows CE: Stream Interface Driver, DllEntry()
Previously, I introduce a Stream Interface Driver that was just a shell of a driver or a driver that didn’t do anything useful. I thought that it would be good to flesh it out a little and add some code to demonstrate some driver features that are fairly common. To get started, let’s flesh out the first function that gets called when the driver loads; DllEntry(). DllEntry() is typically fairly basic, but does some important things. First, I will fill in the function, and then I will discuss what ......

Posted On Monday, July 7, 2008 10:00 PM | Comments (15)

Platform Builder 6.0: Creating a Catalog File
Five years ago, I wrote an article about creating a Catalog file for Windows CE 4.0. How time flies, and how the tools get better as we go. That article turned out to be 10 pages when printed; this one should be much shorter because the tools have become much better. What is the Catalog and why would we want to change it? The Catalog is a collection of components that can be added to your project. These components include OS features, like Internet Explorer, and Board Support Packages (BSP). If you ......

Posted On Friday, June 20, 2008 4:38 PM | Comments (12)

Windows CE: Listing Running Drivers
I recently posted a sample stream interface driver (Windows CE: A Stream Interface Driver Shell) and claimed that I included enough to cause the driver to be loaded by the device manager. The following code is how I know that it loaded. This code enumerates the running drivers using FindFirstDevice() and FindNextDevice() which are included in the device manager functions. There are several options for enumerating the drivers, this example uses DeviceSearchByLegacyName. I include this function in ......

Posted On Tuesday, June 10, 2008 1:03 AM | Comments (2)

Windows CE: A Stream Interface Driver Shell
Note: In Windows CE: Stream Interface Driver Power Management I have included a download of the source code for this driver. I thought that it might be useful to have a shell of a stream interface driver that I could use to start developing a driver from. I can’t believe that I never created this before, but here it is. I called this driver “DriverShell” because that is all that it is, a shell of a driver. This is a very basic starting point for creating a new driver. I have tested that this driver ......

Posted On Monday, June 9, 2008 5:58 PM | Comments (30)

Platform Builder: Getting from BSP Source Code Change to Test Quickly
Anyone who has used Platform Builder knows that running Sysgen can take 15 minutes, or even more to build the OS. That kind of delay between changing code and testing can be crippling to your development, and can cost your company hundreds or even thousands of dollars a day in lost productivity. There must be a better way. In fact, there are several options available. The following will discuss several of these options. FAST: Build and Makeimg from the Command Line The option that I use most, primarily ......

Posted On Friday, June 6, 2008 9:14 AM | Comments (4)

Platform Builder: Glossary of Terms
Platform Builder Help will do a more complete job of documenting much of these terms. This is meant to be a quick start glossary of terms, and will fill in some blanks that Help doesn't cover. Platform Builder - The software development tool used for developing a Windows CE system. This tool is typically used by OEMS who create devices like PDAs, Automated Teller Machines (ATM), medical devices and much more. Board Support Package (BSP) - A BSP is a set of files used to support the chips on a board. ......

Posted On Saturday, May 24, 2008 1:12 AM | Comments (0)

Profile of Bruce Eitman

Bruce is Director of the Windows CE Technology Group at EuroTech Inc where he not only manages the Software Engineers, but keeps busy doing engineering. Bruce works out the Akron, OH office and travels frequently to the home office in Columbia, MD.

Posted On Tuesday, May 13, 2008 12:55 AM