Class TkdCustomCard
Unit
kdclxcore
Declaration
type TkdCustomCard = class(TComponent)
Description
Class TkdCustomCard models hardware device. Whereas descendants of TkdResource
class model different hardware resources separately (such as: memory and port ranges, registers, interrupts and other), TkdCustomCard models hardware device (or card) on the whole. This class includes members for making up the device abstraction (henceforth, model) by attaching and detaching essential resources mentioned above, loading and unloading the GDD, registering and unregistering the device model (the prototype of user-mode device driver) in the system. An original and very powerful feature is that this component and its CardItems
property are equipped with a specific editor - tool whose name is CardBuilder. Right at design time CardBuilder, like a wizard, helps you to produce the definition of device model and the diagnostics of corresponding hardware. TkdCustomCard is the ultimate class for hardware devices, it does not support inheritance. Although TkdCustomCard class has dozens of methods and properties, relevant members are documented only. Refer to the outside documentation about how to use CardBuilder.Methods
Overview
Description
TkdCustomCard redefines Create so that, for hardware device, Create also: 1. checks that the hardware device component is being placed onto a TDataModule instance; 2. checks that the hardware device component is the only one per application; 3. registers all classes modelling hardware resources.
TkdCustomCard redefines Destroy so that, for hardware device, Destroy also 1. unregisters the device model if the corresponding hardware is currently serviced, 2. frees all hardware resources maintained.
AddResource method attaches the new resource to the resources list of the hardware device. The method returns -1 on fail, otherwise a positive number is returned.
CallUserCodeFromKernel method calls a user application routine, specified by pointer, and performs the whole execution in the kernel space. In the body of the routine use build-in assembler code only. Usage of any variables (either local or global) is not currently supported. Consider usage of EAX processor register to return a value from the kernel space, if need be. See demos as well as ExecNativeKernelRoutine
method description.
Clear method detaches and frees all resources maintained in the resources list of the hardware device.
DeleteResource method detaches the resource specified by handle from the resources list of the hardware device and deletes it.
ExecNativeKernelRoutine method calls a native kernel routine, specified by name. See demos as well as CallUserCodeFromKernel
method description.
GetCountByClass method returns the number of resources of the specified class name. This method is principally called by CardBuilder to categorize all resources maintained.
ItemIndexByHandle method returns the categorized index of the resource specified by handle and class name. This method is principally called by CardBuilder to categorize all resources maintained.
LoadModule method is a part of the write method for ModuleLoaded
property. It executes a Linux shell script that installs the GDD. Installing the GDD is a compound process that consists of: loading the corresponding kernel module (kdmodule.o/kdmodule.ko), linking it to the kernel and creating requisite device files. The method returns True if the GDD has been successfully loaded and is ready to function, otherwise False is returned.
RegisterCard method registers the hardware device (all resources) in the system and establishes the instant working session with the GDD. The method internally calls RegisterResource
method for each resource maintained in the resources list of the hardware device according to each priority and returns True if all calls are successfully completed. Otherwise False is returned. As soon as the hardware device is registered, your Kylix user-mode device driver team up with the GDD are put into action to serve the particular physical device.
RemoveItem method is internally called by DeleteResource
method to remove the specified resource from the resources list of the hardware device.
Sleep method delays execution for a specific duration of time. The method can be used to access slow response hardware and for other goals. The result is True if the method has worked out, otherwise False is returned.
UnloadModule method is a part of the write method for ModuleLoaded
property. It executes a Linux shell script that uninstalls the GDD. Uninstalling the GDD is a compound process that consists of: unloading the corresponding kernel module (kdmodule), unlinking it from the kernel and deleting requisite device files.
UnregisterCard method unregisters the hardware device (all resources) in the system and closes the current working session with the GDD. The method internally calls UnregisterResource
method for each resource maintained in the resources list of the hardware device according to each priority. As soon as the hardware device is unregistered, your Kylix user-mode device driver team up with the GDD are disenabled to serve the particular physical device.
Properties
Overview
Description
CardItems property hosts the whole set of resources of the hardware device It implements the resources list. The property as well as the TkdCustomCard component itself is equipped with a specific editor called CardBuilder, that helps you to produce the definition of a device model and the diagnostics of corresponding hardware at design time.
CardRegistered property is an accessor for determining whether the hardware device is currently registered in the system or not. The result is True if the hardware device is registered.
TO BE DOCUMENTED.
Count property is an accessor for obtaining the number of resources maintained in the resources list of the hardware device.
Description property hosts remarks you specify for the hardware device. This property may be useful for keeping any design-time information that is actual for all the life-time of a Kylix project.
DevicePath property specifies the directory (Linux system /dev directory) where requisite device files are located. The device files are needed to function with the GDD from the side of a user application. Do not affect this property.
FailedResource property is an accessor for obtaining the resource failed during unsuccessful registration of the hardware device.
ModuleLoaded property installs and uninstalls the GDD. If the hardware device is currently registered, the GDD can not be uninstalled. The property is initially set to False. If the GDD has not been installed for some reason, the property is still False. Refer to LoadModule
and UnloadModule
methods for additional information. This property is actual for root only.
ScriptPath property specifies the directory where the GDD module (kdmodule.o/kdmodule.ko file) is located.
SleepMicrosecs property specifies sleep time in microseconds for Sleep
method.
SleepOptions property specifies necessary rule for Sleep
method to function. If soNON_BUSY_SLEEP value is specified, Sleep
method delays execution with no consuming CPU resources. This value is not relevant for under 17000 microseconds specified at SleepMicrosecs
property. Non-busy sleep is less accurate than busy sleep and is not specified by default.