Units
Class Hierarchy
Classes, Interfaces and Objects
Types
Enumerations
Variables
Constants
Functions and Procedures
Identifiers

Class TkdHWRange

Unit

kdranges

Declaration

type TkdHWRange = class(TkdRange)

Description

Resource class TkdHWRange is the ancestor for all components modelling address ranges composed of either ports or memory areas belonging to a particular hardware device. Those areas are locations where different resources of the hardware device are mapped. This class introduces Transfer method that initiates data reading and writing operations on hardware and it introduces properties which specify rules for the transfer. By making up multifarious combination over values of the properties, required transfer operations can be easily composed. The class also introduces a number of virtual methods intended to be overridden by its port-oriented and memory-oriented descendants, including those checking the self-consistency and the inter-consistency of all instances of this class, and those maintaining instances of the dependent class TkdHWRangeRegister.

Hierarchy

TkdRange > TkdResource

Methods

Overview

Protectedprocedure CheckOverlappedRanges (IsRangeShared: Boolean; ARangeFrom, ARangeTo: LongWord);
Protectedprocedure CheckRangeFrom (Value: String); override;
Protectedprocedure CheckRangeTo (Value: String); override;
Protectedprocedure CheckRegistersValidities (RngFrom, RngTo: LongWord);
Publicprocedure CheckRegisterValidity (RngFrom, RngTo: LongWord; ARegister: TkdResource); virtual;
Protectedprocedure CheckTransferAutoInc (TransferAutoIncValue: Boolean); virtual;
Protectedprocedure CheckTransferPropsIntegrity (ARangeFrom, ARangeTo: LongWord; AnTransferAutoInc: Boolean; ATransferCount: LongWord; ATransferSize: TkdHWRangeTransferSize; ATransferOffset: LongWord); virtual;
Protectedfunction GetRegisterPriority: Byte; override;
Publicclass function GetTransferSize (Value: TkdHWRangeTransferSize): Byte;
Protectedprocedure PrepareTransferStruct (ABuffer: Pointer; ABufferSize: LongWord); virtual;
Protectedfunction Transfer (ABuffer: Pointer; BufferSize: LongWord): LongWord;

Description

Protectedprocedure CheckOverlappedRanges (IsRangeShared: Boolean; ARangeFrom, ARangeTo: LongWord);

CheckOverlappedRanges method checks if there is another address range that seems overlapped and, if so, raises the corresponding exception conflict_ranges to prohibit from the inter-consistency contradiction of the two address ranges. Two ranges are considered overlapped if these ranges are both non-shared and have a common bar of addresses. See also CheckRangeFrom and CheckRangeTo methods and RangeShared property for reference.

Protectedprocedure CheckRangeFrom (Value: String); override;

CheckRangeFrom method is overridden to add additional verifications in the form of consequent calls to CheckOverlappedRanges, CheckTransferPropsIntegrity, and CheckRegistersValidities methods.

Protectedprocedure CheckRangeTo (Value: String); override;

CheckRangeTo method is overridden to add additional verifications in the form of consequent calls to CheckOverlappedRanges, CheckTransferPropsIntegrity, and CheckRegistersValidities methods.

Protectedprocedure CheckRegistersValidities (RngFrom, RngTo: LongWord);

CheckRegistersValidities method cyclically calls CheckRegisterValidity method for each of hardware registers located on the address range.

Publicprocedure CheckRegisterValidity (RngFrom, RngTo: LongWord; ARegister: TkdResource); virtual;

CheckRegisterValidity method checks if the hardware register given is located inside the address range whose bounds are given as well. If the register is illegal the corresponding exception register_out_of_range has to be raised.

Protectedprocedure CheckTransferAutoInc (TransferAutoIncValue: Boolean); virtual;

CheckTransferAutoInc method is introduced void to be overridden if the auto-incrementation of addresses is not allowed for transfer operation. If this is the case a descendant must raise a corresponding exception.

Protectedprocedure CheckTransferPropsIntegrity (ARangeFrom, ARangeTo: LongWord; AnTransferAutoInc: Boolean; ATransferCount: LongWord; ATransferSize: TkdHWRangeTransferSize; ATransferOffset: LongWord); virtual;

CheckTransferPropsIntegrity method checks if all the properties responsible for transfer operations and given as agruments are set semantically consistent with the remaining ones. If it is not the case the corresponding exception (either invalid_transfer_size or invalid_transfer_count) is raised.

Protectedfunction GetRegisterPriority: Byte; override;

GetRegisterPriority method is overridden to result independent_registration_priority constant so that to allow any resource of this class to be registered first of all.

Publicclass function GetTransferSize (Value: TkdHWRangeTransferSize): Byte;

GetTransferSize class method determines the integer size of a transfer operation (each transmitted operand) whose size is known as the value of TkdHWRangeTransferSize enumeration type.

Protectedprocedure PrepareTransferStruct (ABuffer: Pointer; ABufferSize: LongWord); virtual;

PrepareTransferStruct method is introduced to provide for transfer operations the set of properties common to all descendants. Final resource class TkdPortRange overrides this method.

Protectedfunction Transfer (ABuffer: Pointer; BufferSize: LongWord): LongWord;

Transfer method accomplishes data transfer operations on the address range as provided by corresponding properties. The buffer to transfer to/from and the size of the buffer are given as arguments.

Properties

Overview

Protectedproperty RangeShared: Boolean;
Protectedproperty TransferAutoInc: Boolean;
Protectedproperty TransferCount: LongWord;
Protectedproperty TransferDir: TkdHWRangeTransferDir;
Protectedproperty TransferOffset: LongWord;
Protectedproperty TransferSize: TkdHWRangeTransferSize;

Description

Protectedproperty RangeShared: Boolean;

RangeShared property specifies if the address range can be shared between other kernel processes in the system or must be registered exclusively with the GDD.

Protectedproperty TransferAutoInc: Boolean;

TransferAutoInc property specifies if the auto-incrementation of addresses must be put in place during transfer. If False, then all data is transferred to/from the same address of the address range.

Protectedproperty TransferCount: LongWord;

TransferCount property specifies the number of data items to transfer to/from the address range.

Protectedproperty TransferDir: TkdHWRangeTransferDir;

TransferDir property specifies the direction for transfer. If tdRead, then data is read from, otherwise data is written to the address range.

Protectedproperty TransferOffset: LongWord;

TransferOffset property specifies the offset within the address range to begin transfer from.

Protectedproperty TransferSize: TkdHWRangeTransferSize;

TransferSize property specifies the size of data item to transfer to/from the address range.