Hello,
I'm looking to build an IOM driver as an XDC module to add extra configurability in the .cfg file. I am running into some issues with getting the driver functions table setup correctly. Below are some applicable code snippets:
Driver.xdc:
import ti.sysbios.io.DEV;
import ti.sysbios.io.GIO;
import ti.sysbios.knl.Queue;
module Driver
{
struct Channel_s
{
Bool InUse;
Int Mode;
Int ProtocolId;
Int TransportId;
//Queue_Struct* PendingPackets;
ti.sysbios.knl.Queue.Handle PendingPackets;
Ptr NextPacket;
Fxn CbFxn;
Ptr CbArgs;
};
struct ChannelArgs_s
{
Int ProtocolId;
Int TransportId;
};
config Int NumRxDescriptors = 8;
config Int NumTxDescriptors = 8;
config Int NumProtocols = 1;
config Int NumChannelsPerProtocol[];
config Int MaxRxBufferSize = 256;
config Int NumRxBuffers = 16;
config Int DmaChannel = 0;
config Int RxInterruptVector = 0;
config Int TxInterruptVector = 0;
config Int MiscInterruptVector = 0;
Int DriverInit();
Int DriverBind();
Int DriverUnBind();
Int DriverChannelCreate();
Int DriverChannelClose();
Int DriverChannelControl();
Int DriverSubmit();
Int DriverRxSwi();
Int DriverRxInterrupt();
Int DriverTxInterrupt();
Int DriverMiscInterrupt();
Int DriverDmaInterrupt();
config ti.sysbios.io.DEV.Fxns DriverFunctions = {mdBindDev : DriverBind,
mdUnBindDev : DriverUnBind,
mdControlChan : DriverChannelControl,
mdCreateChan : DriverChannelCreate,
mdDeleteChan : DriverChannelClose,
mdSubmitChan : DriverSubmit
};
instance:
internal:
// The module state will contain all Driver data
struct Module_State
{
Int DeviceID;
Int HWInitialized;
Int NumProtocols;
Int ProtocolIDs[];
Int NumOpenInputChannelsPerProtocol[];
Int NumOpenOutputChannelsPerProtocol[];
Channel_s Channels[];
}
// unsure if this is needed yet
struct Instance_State
{
}
}
test.cfg snippet:
var driverMod = xdc.useModule('prog.drivers.Driver');
//Add an entry to the device table
DEV.tableSize = 3;
//set up Driver
var dev0Params = new DEV.Params();
dev0Params.devid = 0;
dev0Params.instance.name = "TEST1";
dev0Params.initFxn = driverMod.DriverInit;
dev0Params.deviceParams = null;
Program.global.mDevEth0 = DEV.create("/TEST1", driverMod.DriverFunctions, dev0Params);
The error I get is:
js: "./test.cfg", line 102: XDC runtime error: prog.drivers.driver/DriverFunctions: incompatible assignment to mdBindDev : xdc.services.intern.xsr.Extern@a00185::&prog_drivers_driver_DriverBind__E
Is what I am attempting to do possible? Or am I stuck doing some of this in straight C? I'd prefer to use some of the pre-compile time features / configuration that XDC provides.
It should be possible since the old IDriver interface in IPC used to do this somehow.
Thanks!