i_sched Kernel Service

Purpose

Schedules off-level processing.

Syntax

#include <sys/types.h>
#include <sys/errno.h>
#include <sys/intr.h>

void i_sched ( handler)
struct intr *handler;

Parameter

Item Description
handler Specifies the address of the pinned interrupt handler structure.

Description

The i_sched service allows device drivers to schedule some of their work to be processed at a less-favored interrupt priority. This capability allows interrupt handlers to run as quickly as possible, avoiding interrupt-processing delays and overrun conditions. See the i_init kernel service for a brief description of interrupt handlers.

Processing can be scheduled off-level in the following situations:

Attention: The caller cannot alter any fields in the intr structure from the time the i_sched service is called until the kernel calls the off-level routine. The structure must also stay pinned. Otherwise, the system may crash.

The interrupt handler structure pointed to by the handler parameter describes an off-level interrupt handler. The caller of the i_sched service must set up all fields in the intr structure. The INIT_OFFLn macros in the /usr/include/sys/intr.h file can be used to initialize the handler parameter. The n value represents the priority class that the off-level handler should run at. Currently, classes from 0 to 3 are defined.

Use of the i_sched service has two additional restrictions:

First, the i_sched service will not re-register an intr structure that is already registered for off-level handling. Since i_sched has no return value, the service will simply return normally without registering the specified structure if it was already registered but not yet executed. The kernel removes the intr structure from the registration list immediately prior to calling the off-level handler specified in the structure. It is therefore possible for the off-level handler to use the structure again to register another off-level request.

Care must be taken when scheduling off-level requests from a second-level interrupt handler (SLIH). If the off-level request is already registered but has not yet executed, a second registration will be ignored. If the off-level handler is currently executing, or has already run, a new request will be registered. Users of this service should be aware of these timing considerations and program accordingly.

Second, the kernel uses the flags field in the specified intr structure to determine if this structure is already registered. This field should be initialized once before the first call to the i_sched service and should remain unmodified for future calls to the i_sched service.

Note: Off-level interrupt handler path length should not exceed 5,000 instructions. If it does exceed this number, real-time support is adversely affected.

Execution Environment

The i_sched kernel service can be called from either the process or interrupt environment.

Return Values

The i_sched service has no return values.