다음을 통해 공유


Active and Passive KITL (Windows CE 5.0)

Send Feedback

The kernel independent transport layer (KITL) contains the following two modes of operation:

  • Active: The device boots the OAL, calls KitlInit(TRUE) to initialize KITL, and initializes all default KITL clients like the kernel debugger. The KITL service then calls OEMKitlInit and registers all default clients that are used by the system.
  • Passive: KITL is not automatically started when the device boots. In this mode, KITL initializes itself and the default KITL clients. Call KitlInit(FALSE) to initialize in passive mode. OEMKitlInit is then called when a client registers with the KITL servers.

You must determine which mode the device should enter on boot. Platform Builder provides a flag called KTS_PASSIVE_MODE that determines which mode is used. You can set KTS_PASSIVE_MODE in Platform Builder by enabling active or passive KITL. For more information, see Enabling Active or Passive KITL.

You must pass the KTS_PASSIVE_MODE flag, if used, to the OAL before KitlInit is called. On the CEPC hardware platform, passing the data through the boot loader in the BootArgs section does this. To view an example, see %_WINCEROOT%\Platform\Cepc\Kernel\Hal\Halkitl.c.

Active KITL is best suited for the development processes so that the debugger can maintain a constant connection. Passive KITL is better suited to a real-world scenario where the debugger is not constantly needed. The benefit of the passive mode is that it allows you to create a device that does not have to be tethered to the desktop tools. The device can even be mobile and if it enters a state where the desktop tools are needed, it initiates a KITL connection between the device and desktop.

The following code example shows how this is done.

BOOL OEMKitlInit (PKITLTRANSPORT pKitl)
{
    BOOL fRet = TRUE;
    BOOT_ARGS *pBootArgs = (BOOT_ARGS *) ((ULONG)(*(PBYTE *)BOOT_ARG_PTR_LOCATION) | 0x80000000);

    KITLOutputDebugString ("+OEMKitlInit\n");

    // start the requested transport
    switch(pBootArgs->KitlTransport & ~KTS_PASSIVE_MODE)
    {
        case KTS_SERIAL:
            fRet = InitSerial(pKitl);
            break;

        case KTS_ETHER:
        case KTS_DEFAULT:
        default:
            fRet = InitEther(pKitl);
            break;
    }

    if(!fRet)
        KITLOutputDebugString ("Unable to initialize KITL Transports!\n");

    KITLOutputDebugString ("-OEMKitlInit\n");
    return fRet;
}

void InitDebugEther (void)
{
    BOOT_ARGS *pBootArgs = (BOOT_ARGS *) ((ULONG)(*(PBYTE *)BOOT_ARG_PTR_LOCATION) | 0x80000000);

    if ((pBootArgs->KitlTransport & ~KTS_PASSIVE_MODE) == KTS_NONE)
        return;

    // Initialize KITL transport
    if (KitlInit(!(pBootArgs->KitlTransport & KTS_PASSIVE_MODE))) {
        KITLOutputDebugString ("KITL Initialized\n");
        // no longer need to start kernel services
        // since KITL config message told us what to start and
        // kitl will start it accordingly
    } else {
        KITLOutputDebugString ("KITL Initialization Failed, No debugging support available\n");
    }
}

See Also

Kernel Independent Transport Layer | Debugging and Testing

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.