Share via


Active and Passive KITL

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 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 like the debugger.

You must determine which mode the device should enter on boot. KITL provides a flag called KTS_PASSIVE_MODE that determines which mode is used. You must pass this flag, if used, to the OAL before KitlInit is called. On the CEPC platform, this is done by passing the data through the boot loader in the BootArgs section. 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

Last updated on Wednesday, April 13, 2005

© 2005 Microsoft Corporation. All rights reserved.