IOCTL Library
Other versions of this page are also available for the following:
8/27/2008
The IOCTL library provides common OAL implementations for IOCTL codes that are hardware platform-independent . It also provides a central method for configuring IOCTL processing, which removes a source of duplicated code across all hardware platforms and substantially reduces maintenance and test efforts. This also relieves OEMs from having to implement the common functionality.
The IOCTL library allows OEMs to easily replace OAL functions with custom hardware platform functions through a function callout table defined in the configuration directory. A standard hardware platform file, Ioctl.c, includes this configuration table. The function callout table provides a single point of control for all IOCTL processing.
The IOCTL table contains the IOCTL code and a function pointer to handle the IOCTL. The function pointer might be a public OAL function or a hardware platform function. A placeholder function is provided if the IOCTL is unsupported. The placeholder function generates an error message for unimplemented IOCTLs. The IOCTL code and an associated function pointer with the same argument prototype as OEMIoControl defines the IOCTL handler.
There are OAL and hardware platform specific data items relevant to IOCTL processing. The hardware platform code must be able to set OAL IOCTL variables. This is accomplished through global variables in the hardware platform file Ioctl.c. In the Ioctl.c file, the global variables are defined and initialized from configuration parameters defined in the configuration file Ioctl_cfg.h. This approach is required to maintain the separation between the OAL and hardware platform code.
The OAL IOCTL library implements the OEMIoControl function. The implementation searches the IOCTL table for the corresponding code that when found executes the function. Because this is a simple table lookup, IOCTL codes closer to the top of the table require less search time. For better performance, position IOCTL codes with a higher execution rate at the top of the table.
For more information, see %_WINCEROOT%\Platform\Common\Src\Inc\Oal_ioctl.h.