module ti.sdo.io.DriverTypes

DriverTypes module

This module defines several types required by modules implementing the IDriver interface. [ more ... ]
XDCspec summary sourced in ti/sdo/io/DriverTypes.xdc
module DriverTypes {  ...
// inherits xdc.runtime.IModule
C synopsis target-domain
#include <ti/sdo/io/DriverTypes.h>
module-wide constants & types
 
    typedef enum DriverTypes_IOMode//  {
    } DriverTypes_IOMode;
 
 
    typedef struct DriverTypes_Packet// IO 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;
        Error_Id error// error id;
        UArg misc// reserved;
        UArg drvArg// reserved for use by driver;
    } DriverTypes_Packet;
module-wide config parameters
 
    extern const Error_Id DriverTypes_EBADARGS// ;
    extern const Error_Id DriverTypes_EBADIO// ;
    extern const Error_Id DriverTypes_EBADMODE// ;
    extern const Error_Id DriverTypes_EINUSE// ;
    extern const Error_Id DriverTypes_EINVALIDDEV// ;
    extern const Error_Id DriverTypes_ENOTIMPL// ;
module-wide built-ins
 
XDCscript usage meta-domain
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"
    };
 
 
XDCspec declarations sourced in ti/sdo/io/DriverTypes.xdc
package ti.sdo.io;
 
module DriverTypes {
module-wide constants & types
    const UInt ERROR// error status IDriver.submit = 0x2;
    const UInt PENDING// async callback IDriver.submit = 0x1;
 
    enum IOMode//  {
    };
 
 
    struct Packet// IO 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;
        Error.Id error// error id;
        UArg misc// reserved;
        UArg drvArg// reserved for use by driver;
    };
module-wide config parameters
 
        msg: "Aborted Packet"
    };
    config Error.Id EBADARGS//  = {
        msg: "Bad args"
    };
    config Error.Id EBADIO//  = {
        msg: "Generic Failure"
    };
    config Error.Id EBADMODE//  = {
        msg: "Illegal Mode"
    };
    config Error.Id EINUSE//  = {
        msg: "Channel in use"
    };
    config Error.Id EINVALIDDEV//  = {
        msg: "Invalid devNum"
    };
    config Error.Id ENOTIMPL//  = {
        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"
    };
 
}
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

XDCscript usage meta-domain
const DriverTypes.COMPLETED = 0x0;
C synopsis target-domain
#define DriverTypes_COMPLETED (UInt)0x0
 
 
const DriverTypes.ERROR

error status IDriver.submit

XDCscript usage meta-domain
const DriverTypes.ERROR = 0x2;
C synopsis target-domain
#define DriverTypes_ERROR (UInt)0x2
 
 
const DriverTypes.NOERROR

used in Packet when io completes without an error

XDCscript usage meta-domain
const DriverTypes.NOERROR = 0;
C synopsis target-domain
#define DriverTypes_NOERROR (UInt)0
 
 
const DriverTypes.PENDING

async callback IDriver.submit

XDCscript usage meta-domain
const DriverTypes.PENDING = 0x1;
C synopsis target-domain
#define DriverTypes_PENDING (UInt)0x1
 
 
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 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

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
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

XDCscript usage meta-domain
const DriverTypes.CHAN_ABORT = DriverTypes.ControlCmdDesc computed value;
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

XDCscript usage meta-domain
const DriverTypes.CHAN_RESET = DriverTypes.ControlCmdDesc computed value;
C synopsis target-domain
extern const DriverTypes_ControlCmd DriverTypes_CHAN_RESET;
 
 
config DriverTypes.DEVICE_RESET  // module-wide

Reset device

XDCscript usage meta-domain
const DriverTypes.DEVICE_RESET = DriverTypes.ControlCmdDesc computed value;
C synopsis target-domain
extern const DriverTypes_ControlCmd DriverTypes_DEVICE_RESET;
 
 
config DriverTypes.READ  // module-wide

READ IO operation

XDCscript usage meta-domain
const DriverTypes.READ = DriverTypes.PacketCmdDesc computed value;
C synopsis target-domain
extern const DriverTypes_PacketCmd DriverTypes_READ;
 
 
config DriverTypes.WRITE  // module-wide

WRITE IO operation

XDCscript usage meta-domain
const DriverTypes.WRITE = DriverTypes.PacketCmdDesc computed value;
C synopsis target-domain
extern const DriverTypes_PacketCmd DriverTypes_WRITE;
 
 
config DriverTypes.EABORTED  // module-wide

Error within aborted packet

XDCscript usage meta-domain
DriverTypes.EABORTED = Error.Desc {
    msg: "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
XDCscript usage meta-domain
DriverTypes.EBADARGS = Error.Desc {
    msg: "Bad args"
};
C synopsis target-domain
extern const Error_Id DriverTypes_EBADARGS;
 
 
config DriverTypes.EBADIO  // module-wide
XDCscript usage meta-domain
DriverTypes.EBADIO = Error.Desc {
    msg: "Generic Failure"
};
C synopsis target-domain
extern const Error_Id DriverTypes_EBADIO;
 
 
config DriverTypes.EBADMODE  // module-wide
XDCscript usage meta-domain
DriverTypes.EBADMODE = Error.Desc {
    msg: "Illegal Mode"
};
C synopsis target-domain
extern const Error_Id DriverTypes_EBADMODE;
 
 
config DriverTypes.EINUSE  // module-wide
XDCscript usage meta-domain
DriverTypes.EINUSE = Error.Desc {
    msg: "Channel in use"
};
C synopsis target-domain
extern const Error_Id DriverTypes_EINUSE;
 
 
config DriverTypes.EINVALIDDEV  // module-wide
XDCscript usage meta-domain
DriverTypes.EINVALIDDEV = Error.Desc {
    msg: "Invalid devNum"
};
C synopsis target-domain
extern const Error_Id DriverTypes_EINVALIDDEV;
 
 
config DriverTypes.ENOTIMPL  // module-wide
XDCscript usage meta-domain
DriverTypes.ENOTIMPL = Error.Desc {
    msg: "Not implemented"
};
C synopsis target-domain
extern const Error_Id DriverTypes_ENOTIMPL;
 
 
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 target-domain
extern const Log_Event DriverTypes_LM_ioComplete;
 
 
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 target-domain
extern const Log_Event DriverTypes_LM_startIO;
 
 
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.
 
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
generated on Fri, 09 Apr 2010 01:41:18 GMT