module ti.sdo.io.DriverTypes

DriverTypes module

This module defines several types required by modules implementing the IDriver interface. [ more ... ]
C synopsis target-domain sourced in ti/sdo/io/DriverTypes.xdc
#include <ti/sdo/io/DriverTypes.h>
Functions common to all target modules
Defines
#define
#define
#define
#define
Typedefs
typedef opaque
typedef Void 
typedef enum
typedef struct
typedef opaque
Constants
extern const DriverTypes_ControlCmd 
extern const DriverTypes_ControlCmd 
extern const DriverTypes_ControlCmd 
extern const Error_Id 
extern const Error_Id 
extern const Error_Id 
extern const Error_Id 
extern const Error_Id 
extern const Error_Id 
extern const Error_Id 
extern const Log_Event 
extern const Log_Event 
extern const DriverTypes_PacketCmd 
extern const DriverTypes_PacketCmd 
 
DETAILS
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
readonly config ControlCmd MYCMD;
readonly config PacketCmd MYPKTCMD;
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

C synopsis target-domain
#define DriverTypes_COMPLETED (UInt)0x0
 
 
const DriverTypes_ERROR

error status IDriver.submit

C synopsis target-domain
#define DriverTypes_ERROR (UInt)0x2
 
 
const DriverTypes_NOERROR

used in Packet when io completes without an error

C synopsis target-domain
#define DriverTypes_NOERROR (UInt)0
 
 
const DriverTypes_PENDING

async callback IDriver.submit

C synopsis target-domain
#define DriverTypes_PENDING (UInt)0x1
 
 
enum DriverTypes_IOMode
C synopsis target-domain
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

C synopsis target-domain
typedef opaque DriverTypes_ControlCmd;
 
 
typedef DriverTypes_DoneFxn

Typedef for driver's callback function

C synopsis target-domain
typedef Void (*DriverTypes_DoneFxn)(UArg,DriverTypes_Packet*);
 
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

C synopsis target-domain
typedef opaque DriverTypes_PacketCmd;
 
 
struct DriverTypes_Packet

IO packet

C synopsis target-domain
typedef struct DriverTypes_Packet {
    List_Elem link;
    // queue link
    Ptr addr;
    // buffer address
    SizeT origSize;
    // size requested
    SizeT size;
    // processed size
    UArg arg;
    // arg to be used by end app
    DriverTypes_PacketCmd cmd;
    // command for mini-driver
    Error_Id error;
    // 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

C synopsis target-domain
extern const DriverTypes_ControlCmd DriverTypes_CHAN_ABORT;
 
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

C synopsis target-domain
extern const DriverTypes_ControlCmd DriverTypes_CHAN_RESET;
 
 
config DriverTypes_DEVICE_RESET  // module-wide

Reset device

C synopsis target-domain
extern const DriverTypes_ControlCmd DriverTypes_DEVICE_RESET;
 
 
config DriverTypes_READ  // module-wide

READ IO operation

C synopsis target-domain
extern const DriverTypes_PacketCmd DriverTypes_READ;
 
 
config DriverTypes_WRITE  // module-wide

WRITE IO operation

C synopsis target-domain
extern const DriverTypes_PacketCmd DriverTypes_WRITE;
 
 
config DriverTypes_EABORTED  // module-wide

Error within aborted packet

C synopsis target-domain
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
C synopsis target-domain
extern const Error_Id DriverTypes_EBADARGS;
 
 
config DriverTypes_EBADIO  // module-wide
C synopsis target-domain
extern const Error_Id DriverTypes_EBADIO;
 
 
config DriverTypes_EBADMODE  // module-wide
C synopsis target-domain
extern const Error_Id DriverTypes_EBADMODE;
 
 
config DriverTypes_EINUSE  // module-wide
C synopsis target-domain
extern const Error_Id DriverTypes_EINUSE;
 
 
config DriverTypes_EINVALIDDEV  // module-wide
C synopsis target-domain
extern const Error_Id DriverTypes_EINVALIDDEV;
 
 
config DriverTypes_ENOTIMPL  // module-wide
C synopsis target-domain
extern const Error_Id DriverTypes_ENOTIMPL;
 
 
config DriverTypes_LM_ioComplete  // module-wide

Logged when io is completed

C synopsis target-domain
extern const Log_Event DriverTypes_LM_ioComplete;
 
 
config DriverTypes_LM_startIO  // module-wide

Logged just prior to submitting IO packet to driver

C synopsis target-domain
extern const Log_Event DriverTypes_LM_startIO;
 
Module-Wide Built-Ins

C synopsis target-domain
Types_ModuleId DriverTypes_Module_id();
// Get this module's unique id
 
Bool DriverTypes_Module_startupDone();
// Test if this module has completed startup
 
IHeap_Handle DriverTypes_Module_heap();
// 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
 
XDCscript usage meta-domain sourced in ti/sdo/io/DriverTypes.xdc
var DriverTypes = xdc.useModule('ti.sdo.io.DriverTypes');
module-wide constants & types
 
    values of type DriverTypes.IOMode// 
 
    var obj = new DriverTypes.Packet// IO packet;
        obj.link// queue link = List.Elem  ...
        obj.addr// buffer address = Ptr  ...
        obj.origSize// size requested = SizeT  ...
        obj.size// processed size = SizeT  ...
        obj.arg// arg to be used by end app = UArg  ...
        obj.error// error id = Error.Desc  ...
        obj.misc// reserved = UArg  ...
        obj.status// reserved for legacy IOM support = Int  ...
        obj.drvArg// reserved for use by driver = UArg  ...
module-wide config parameters
 
        msg: "Aborted Packet"
    };
        msg: "Bad args"
    };
        msg: "Generic Failure"
    };
        msg: "Illegal Mode"
    };
        msg: "Channel in use"
    };
        msg: "Invalid devNum"
    };
        msg: "Not implemented"
    };
        mask: Diags.USER1 | Diags.USER2,
        msg: "LM_ioComplete: buf: 0x%x, size: 0x%x, arg: 0x%x"
    };
        mask: Diags.USER1 | Diags.USER2,
        msg: "LM_startIO: buf: 0x%x, size: 0x%x, arg: 0x%x"
    };
 
 
 
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;
 
    obj.link = List.Elem  ...
    // 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
    obj.cmd = DriverTypes.PacketCmdDesc  ...
    // command for mini-driver
    obj.error = Error.Desc  ...
    // 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
const DriverTypes.CHAN_ABORT = DriverTypes.ControlCmdDesc computed value;
 
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
const DriverTypes.CHAN_RESET = DriverTypes.ControlCmdDesc computed value;
 
C SYNOPSIS
 
config DriverTypes.DEVICE_RESET  // module-wide

Reset device

XDCscript usage meta-domain
const DriverTypes.DEVICE_RESET = DriverTypes.ControlCmdDesc computed value;
 
C SYNOPSIS
 
config DriverTypes.READ  // module-wide

READ IO operation

XDCscript usage meta-domain
const DriverTypes.READ = DriverTypes.PacketCmdDesc computed value;
 
C SYNOPSIS
 
config DriverTypes.WRITE  // module-wide

WRITE IO operation

XDCscript usage meta-domain
const DriverTypes.WRITE = DriverTypes.PacketCmdDesc computed value;
 
C SYNOPSIS
 
config DriverTypes.EABORTED  // module-wide

Error within aborted packet

XDCscript usage meta-domain
DriverTypes.EABORTED = Error.Desc {
    msg: "Aborted Packet"
};
 
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
DriverTypes.EBADARGS = Error.Desc {
    msg: "Bad args"
};
 
C SYNOPSIS
 
config DriverTypes.EBADIO  // module-wide
XDCscript usage meta-domain
DriverTypes.EBADIO = Error.Desc {
    msg: "Generic Failure"
};
 
C SYNOPSIS
 
config DriverTypes.EBADMODE  // module-wide
XDCscript usage meta-domain
DriverTypes.EBADMODE = Error.Desc {
    msg: "Illegal Mode"
};
 
C SYNOPSIS
 
config DriverTypes.EINUSE  // module-wide
XDCscript usage meta-domain
DriverTypes.EINUSE = Error.Desc {
    msg: "Channel in use"
};
 
C SYNOPSIS
 
config DriverTypes.EINVALIDDEV  // module-wide
XDCscript usage meta-domain
DriverTypes.EINVALIDDEV = Error.Desc {
    msg: "Invalid devNum"
};
 
C SYNOPSIS
 
config DriverTypes.ENOTIMPL  // module-wide
XDCscript usage meta-domain
DriverTypes.ENOTIMPL = Error.Desc {
    msg: "Not implemented"
};
 
C SYNOPSIS
 
config DriverTypes.LM_ioComplete  // module-wide

Logged when io is completed

XDCscript usage meta-domain
DriverTypes.LM_ioComplete = Log.EventDesc {
    mask: Diags.USER1 | Diags.USER2,
    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
DriverTypes.LM_startIO = Log.EventDesc {
    mask: Diags.USER1 | Diags.USER2,
    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
DriverTypes.common$ = Types.Common$ undefined;
 
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.
generated on Sat, 11 Feb 2012 00:37:46 GMT