This module defines several types required by modules implementing the
IDriver interface.
This modules defines two Encoded types PacketCmd and ControlCmd.
The @Encoded keyword is used here to allow us to have different
representations for PacketCmd and ControlCmd in the meta
domain and in the target domain. Here these datatypes are Bits32 in
the target domain. In the meta domain they are represented as
structures whose contents decide the value in the target domain.
The purpose is to assign unique values to all PacketCmds in the
application. Similarly all config parameters of type ControlCmds
get assigned unique values at configuration time.
The encoding scheme used is (moduleId << 16) | unique number.
Modules that implement IDriver can define their own ControlCmds and
PacketCmds as follows
This module also defines the IO packet used to send buffers to a driver.
Common cmds and errors useful to all IDriver modules are also defined here.
const DriverTypes_COMPLETED |
|
completed status IDriver.submit
#define DriverTypes_COMPLETED (UInt)0x0
const DriverTypes_ERROR |
|
error status IDriver.submit
#define DriverTypes_ERROR (UInt)0x2
const DriverTypes_NOERROR |
|
used in Packet when io completes without an error
#define DriverTypes_NOERROR (UInt)0
const DriverTypes_PENDING |
|
async callback IDriver.submit
#define DriverTypes_PENDING (UInt)0x1
enum DriverTypes_IOMode |
|
typedef enum DriverTypes_IOMode {
DriverTypes_INPUT,
// open channel for input
DriverTypes_OUTPUT,
// open channel for output
DriverTypes_INOUT
// simultaneous input/output
} DriverTypes_IOMode;
typedef DriverTypes_ControlCmd |
|
Control command type
typedef opaque DriverTypes_ControlCmd;
typedef DriverTypes_DoneFxn |
|
Typedef for driver's callback function
DETAILS
The driver will call a function of this type whenever an I/O
operation completes after an async submit() call.
The UArg is the callback function arg specified during
IDriver.open.
The Packet* points to packet used during
IDriver.submit call.
typedef DriverTypes_PacketCmd |
|
Packet command type
typedef opaque DriverTypes_PacketCmd;
struct DriverTypes_Packet |
|
IO packet
typedef struct DriverTypes_Packet {
// queue link
Ptr addr;
// buffer address
SizeT origSize;
// size requested
SizeT size;
// processed size
UArg arg;
// arg to be used by end app
// command for mini-driver
// error id
UArg misc;
// reserved
Int status;
// reserved for legacy IOM support
UArg drvArg;
// reserved for use by driver
} DriverTypes_Packet;
FIELDS
link
field can be used by driver to queue up IO packets.
addr
field points to buffer of data.
The driver preserves this field.
origSize
is the size of data buffer.
The driver preserves this field.
size
is actual size of data written or read.
Driver updates this field.
arg
is used by end application. The driver preserves
this field.
cmd
is the Packet command. Driver preserves this field.
error
is filled in by the mini-driver and contains status
of IO.
misc
is used by Stream. The driver preserves
this field.
status
is reserved for use by iom adapters.
drvArg
is reserved for use by drivers. Only drivers can use
this field.
DETAILS
Packets are the basis for all I/O operations. Packets are sent
to the driver using
IDriver.submit function.
config DriverTypes_CHAN_ABORT // module-wide |
|
Abort channel
DETAILS
This is a control command that all drivers must attempt
to support. This control command will abort ALL the packets
queued up in the driver and return the packets by calling the
DoneFxn for each packet. Aborted packets are marked
with
E_Aborted. This control command arg is an (UInt *).
The driver returns number of packets aborted in the cmdArg.
config DriverTypes_CHAN_RESET // module-wide |
|
Reset channel
config DriverTypes_DEVICE_RESET // module-wide |
|
Reset device
config DriverTypes_READ // module-wide |
|
READ IO operation
config DriverTypes_WRITE // module-wide |
|
WRITE IO operation
config DriverTypes_EABORTED // module-wide |
|
Error within aborted packet
extern const Error_Id DriverTypes_EABORTED;
DETAILS
This is a special error that all drivers will return in the IO packet
in case
ABORT control cmd is received.
config DriverTypes_EBADARGS // module-wide |
|
extern const Error_Id DriverTypes_EBADARGS;
config DriverTypes_EBADIO // module-wide |
|
extern const Error_Id DriverTypes_EBADIO;
config DriverTypes_EBADMODE // module-wide |
|
extern const Error_Id DriverTypes_EBADMODE;
config DriverTypes_EINUSE // module-wide |
|
extern const Error_Id DriverTypes_EINUSE;
config DriverTypes_EINVALIDDEV // module-wide |
|
extern const Error_Id DriverTypes_EINVALIDDEV;
config DriverTypes_ENOTIMPL // module-wide |
|
extern const Error_Id DriverTypes_ENOTIMPL;
config DriverTypes_LM_ioComplete // module-wide |
|
Logged when io is completed
extern const Log_Event DriverTypes_LM_ioComplete;
config DriverTypes_LM_startIO // module-wide |
|
Logged just prior to submitting IO packet to driver
extern const Log_Event DriverTypes_LM_startIO;
Module-Wide Built-Ins |
|
// Get this module's unique id
Bool DriverTypes_Module_startupDone();
// Test if this module has completed startup
// The heap from which this module allocates memory
Bool DriverTypes_Module_hasMask();
// Test whether this module has a diagnostics mask
Bits16 DriverTypes_Module_getMask();
// Returns the diagnostics mask for this module
Void DriverTypes_Module_setMask(Bits16 mask);
// Set the diagnostics mask for this module
const DriverTypes.COMPLETED |
|
completed status IDriver.submit
XDCscript usage |
meta-domain |
const DriverTypes.COMPLETED = 0x0;
C SYNOPSIS
const DriverTypes.ERROR |
|
error status IDriver.submit
XDCscript usage |
meta-domain |
const DriverTypes.ERROR = 0x2;
C SYNOPSIS
const DriverTypes.NOERROR |
|
used in Packet when io completes without an error
XDCscript usage |
meta-domain |
const DriverTypes.NOERROR = 0;
C SYNOPSIS
const DriverTypes.PENDING |
|
async callback IDriver.submit
XDCscript usage |
meta-domain |
const DriverTypes.PENDING = 0x1;
C SYNOPSIS
enum DriverTypes.IOMode |
|
XDCscript usage |
meta-domain |
values of type DriverTypes.IOMode
const DriverTypes.INPUT;
// open channel for input
const DriverTypes.OUTPUT;
// open channel for output
const DriverTypes.INOUT;
// simultaneous input/output
C SYNOPSIS
struct DriverTypes.Packet |
|
IO packet
XDCscript usage |
meta-domain |
var obj = new DriverTypes.Packet;
// queue link
obj.addr = Ptr ...
// buffer address
obj.origSize = SizeT ...
// size requested
obj.size = SizeT ...
// processed size
obj.arg = UArg ...
// arg to be used by end app
// command for mini-driver
// error id
obj.misc = UArg ...
// reserved
obj.status = Int ...
// reserved for legacy IOM support
obj.drvArg = UArg ...
// reserved for use by driver
FIELDS
link
field can be used by driver to queue up IO packets.
addr
field points to buffer of data.
The driver preserves this field.
origSize
is the size of data buffer.
The driver preserves this field.
size
is actual size of data written or read.
Driver updates this field.
arg
is used by end application. The driver preserves
this field.
cmd
is the Packet command. Driver preserves this field.
error
is filled in by the mini-driver and contains status
of IO.
misc
is used by Stream. The driver preserves
this field.
status
is reserved for use by iom adapters.
drvArg
is reserved for use by drivers. Only drivers can use
this field.
DETAILS
Packets are the basis for all I/O operations. Packets are sent
to the driver using
IDriver.submit function.
C SYNOPSIS
config DriverTypes.CHAN_ABORT // module-wide |
|
Abort channel
XDCscript usage |
meta-domain |
DETAILS
This is a control command that all drivers must attempt
to support. This control command will abort ALL the packets
queued up in the driver and return the packets by calling the
DoneFxn for each packet. Aborted packets are marked
with
E_Aborted. This control command arg is an (UInt *).
The driver returns number of packets aborted in the cmdArg.
C SYNOPSIS
config DriverTypes.CHAN_RESET // module-wide |
|
Reset channel
XDCscript usage |
meta-domain |
C SYNOPSIS
config DriverTypes.DEVICE_RESET // module-wide |
|
Reset device
XDCscript usage |
meta-domain |
C SYNOPSIS
config DriverTypes.READ // module-wide |
|
READ IO operation
XDCscript usage |
meta-domain |
C SYNOPSIS
config DriverTypes.WRITE // module-wide |
|
WRITE IO operation
XDCscript usage |
meta-domain |
C SYNOPSIS
config DriverTypes.EABORTED // module-wide |
|
Error within aborted packet
XDCscript usage |
meta-domain |
DETAILS
This is a special error that all drivers will return in the IO packet
in case
ABORT control cmd is received.
C SYNOPSIS
config DriverTypes.EBADARGS // module-wide |
|
XDCscript usage |
meta-domain |
C SYNOPSIS
config DriverTypes.EBADIO // module-wide |
|
XDCscript usage |
meta-domain |
msg: "Generic Failure"
};
C SYNOPSIS
config DriverTypes.EBADMODE // module-wide |
|
XDCscript usage |
meta-domain |
C SYNOPSIS
config DriverTypes.EINUSE // module-wide |
|
XDCscript usage |
meta-domain |
C SYNOPSIS
config DriverTypes.EINVALIDDEV // module-wide |
|
XDCscript usage |
meta-domain |
C SYNOPSIS
config DriverTypes.ENOTIMPL // module-wide |
|
XDCscript usage |
meta-domain |
msg: "Not implemented"
};
C SYNOPSIS
config DriverTypes.LM_ioComplete // module-wide |
|
Logged when io is completed
XDCscript usage |
meta-domain |
msg: "LM_ioComplete: buf: 0x%x, size: 0x%x, arg: 0x%x"
};
C SYNOPSIS
config DriverTypes.LM_startIO // module-wide |
|
Logged just prior to submitting IO packet to driver
XDCscript usage |
meta-domain |
msg: "LM_startIO: buf: 0x%x, size: 0x%x, arg: 0x%x"
};
C SYNOPSIS
metaonly config DriverTypes.common$ // module-wide |
|
Common module configuration parameters
XDCscript usage |
meta-domain |
DETAILS
All modules have this configuration parameter. Its name
contains the '$' character to ensure it does not conflict with
configuration parameters declared by the module. This allows
new configuration parameters to be added in the future without
any chance of breaking existing modules.