Implementing the OEMInit Function (Windows Embedded CE 6.0)


The OEMInit function is responsible for initializing the board-level hardware.

During OEMInit, you must:

  • Initialize all hardware peripherals needed to support the hardware platform.
  • Initiate the debug KITL transport.
  • Set kernel variables that are required by the kernel to enable or alter functionality.

For more information about KITL initialization, see Adding KITL Initialization Code.

The OEMInit** function contains much of the functionality present in the OEMPlatformInit function in the boot loader. For more information, see Implementing the OEMPlatformInit Function.**

The following list shows the suggested initialization tasks for the OEMInit function.

To implement the OEMInit function

  1. Initialize interrupt mapping tables. These are two private OAL tables that map between physical interrupts — interrupt requests (IRQs) — and logical interrupts — SYSINTR values. The following code example shows how to initialize the interrupt mapping tables:

    for (i = 0; i <= IRQ_MAXIMUM; i++) {
        IRQToSysIntr[i] = SYSINTR_UNDEFINED;
    for (i = 0; i < SYSINTR_MAXIMUM; i++) {
        SysIntrToIRQ[i] = IRQ_UNDEFINED;


    The interrupt mapping tables, for example, IRQToSysIntr and SysIntrToIRQ, are private to the OAL. OEMs can give these interrupt mapping tables any name. OEMs can use the interrupt mapping tables to implement the functions OEMTranslateIrq and OEMTranslateSysIntr.

  2. Create any initial static mappings required by the OAL. For example, SYSINTR_OS_TICK might map to hardware IRQ_OS_TICK, as shown in the following code example:


    For more information about Windows Embedded CE interrupts, see Interrupts and Defining an Interrupt Identifier.

  3. Configure the system timer, real-time clock (RTC), or any other timekeeping device by implementing the InitClock function and calling it from OEMInit. For more information, see System Tick Timer Initialization.

  4. Configure any CPU-level and board-level interrupt controllers.

  5. Provide LED debug support. While optional, it is helpful when debugging the kernel.

  6. If necessary for your CPU type, call the HookInterrupt function to register one or more interrupt service routines (ISRs).

    The HookInterrupt function associates an ISR with an interrupt request line (IRQ) value. OEMInit must register the ISR for the system tick. This is the base functionality required by the kernel to schedule threads. For more information, see System Tick Timer Implementation.


    HookInterrupt is not required or possible for ARM-based hardware platforms. There are only two interrupts and they are handled by OEMInterruptHandler and OEMInterruptHandlerFIQ.

    The following code example shows how you can register the interval-timer ISR, TimerISR, for hardware interrupt 5.

    void OEMInit(void)
      HookInterrupt(5, TimerISR); // Hook timer interrupt
  7. Mask all unconfigured interrupt sources at the CPU-level and board-level. This prevents interrupts from accidentally being delivered during the kernel initialization.

  8. Leave the 1-millisecond (ms) system tick unmasked, so that timekeeping and thread scheduling function properly.

The following list shows optional functionality that you can implement in the OEMInit function:

  • Logging functions
  • Registry functions
  • Secure loader functions
  • Save and restore coprocessor registers
  • High performance counters
  • System halt
  • Event tracking
  • Detection of idle time
  • User notification alarm
  • Multiple execute-in-place (XIP) regions
  • Default thread quantum
  • Enable debug IO control
  • Erasing the object store
  • Supporting CPU utilization functionality
  • Object store cold boot
  • ARM FPU support
  • Zeroing memory

See Also


How to Develop an OEM Adaptation Layer