This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

SYS/BIOS IPC IOMAdapter

Hello all,

I am using XDC v3.23.2.47 with SYS/BIOS 6.33.5.46. IPC is version 1.24.3.32 and I also have PSP 3.0.1.00. All using CCSv5.1.

I am trying to get the IPC IOMAdapter to work with an old iom driver written for DSP/BIOS 5. Here is a snippet of the relevant code in the .cfg file (variable names have been changed):

var IomParams = new IomAdapter.Params();
IomParams.instance.name = "myIOM";
IomParams.iomFxns = "&IomFunctions";
IomParams.initFxn = "&IomInit";
IomParams.deviceId = 0;
IomParams.deviceParams = null;
Program.global.myIOM = IomAdapter.create(IomParams);
DriverTable.addMeta("/myIOM", Program.global.myIOM);

And then the function definitions:

void IomInit(void)
{
   //do initialization of EDMA/McBSP
}

const IOM_Fxns IomFunctions=
{
   Bind,
   Unbind,
   Control,
   Create,
   Delete,
   Submit
//   IOM_TmdBindDev       mdBindDev;
//   IOM_TmdUnBindDev     mdUnBindDev;
//   IOM_TmdControlChan   mdControlChan;
//   IOM_TmdCreateChan    mdCreateChan;
//   IOM_TmdDeleteChan    mdDeleteChan;
//   IOM_TmdSubmitChan    mdSubmitChan;
};

From what I understand, the IOMAdapter module should translate my driver to the IDriver interface for me (the commented out section of IomFunctions). Of course I have the IomFunctions defined as well.

So here's the issue. Before I load my program into the debugger/emulator I put a breakpoint in my IomInit function. I also have a breakpoint on BIOS_start();. I hit my IomInit function first when I load the program and this makes sense as it should execute until main. If I hit run, I hit my IomInit breakpoint again. I can continue doing this endlessly (hitting run and going back to my IomInit function). If I remove this breakpoint, the program runs into the weeds without ever hitting main.

Now I can remove this line:

//IomParams .iomFxns = "&IomFunctions";

And I run the program and hit my IomInit function as normal. But continuing execution runs into main and runs my program normally. There must be an error with how I create the IomFunctions.

Thanks in advance for any ideas!

  • Try this syntax for the assignment of the iomFxns:

        IomParams.iomFxns = $externPtr("IomFunctions");

    Alan

  • Thanks Alan, worked like a charm.

  • Great!

    I'll file an internal bug to update the CDOCs for the IomAdapter module to explicitly show how to configure the .iomFxns.

    Alan

  • Marshall --

    We added back support for IOM drivers and the GIO APIs in BIOS 6.33 to allow easier use of IOM drivers in SYS/BIOS.   This might simplify things for you if you are still having problems.   See Chapter 9 of the latest User's Guide.  You will have to update your driver to replace HWI and QUE calls with their SYS/BIOS equivalent APIs Hwi and Queue.   I think that the PSP 3.x drivers and examples are using GIO and IOM directly.

    Regards,
    -Karl-

  • Alan/Karl -

    I've been using the IPC and SYS/BIOS user's guides as if they were bibles. While they have helped in my understanding of the low level theory on how driver writing and task buffer streaming works, I am always missing something fundamental when trying to write a simple example.

    I haven't gotten much further from this last problem in this thread and I don't think this warrants a whole new thread (and we can use the same information in the original post). I am trying to setup the device for my IOM driver. For some reason the IOM create() function is always called before the bind() function. I know in DSP/BIOS this cannot be the case because bind() is what takes in the devParams to setup the device (*devp) that create() will use. Is this intended behavior, or am I doing something wrong?

    Right now create() is being called first with a NULL *devp (device global data structure) because bind() has not set it up yet. This is obviously no good for setting up the channel/stream.

    IOM_create() is called on Stream_create() and I think IOM_bind() is called after "device initialization" which I assumed to be IomAdapter.create(); In my config file I have made sure that the device is created and added to the driver table before the stream is created. I probably could move stream creation to dynamic because bind() is called before main(), but I am trying to avoid dynamic creation altogether if possible (and this is kludge-y).

    Here's my stream definition:

    var stream0Params = new Stream.Params();
    stream0Params.instance.name = "stream0";
    Program.global.stream0 = Stream.create("/myIOM", Stream.OUTPUT, stream0Params);

    Any ideas?

  • I've been working around the above problem (driver create before bind) by noting the address of my global device parameter and changing the value passed into create() at runtime in the debugger and this has been working as I expect it. So I have been able to continue on, but obviously I do need to find a solution to the problem above.