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.

RTOS/TMS320F28377D: TI-RTOS Swi

Part Number: TMS320F28377D

Tool/software: TI-RTOS

Our application has a statically-created SWI.  Is there any way to dynamically change a SWI argument, so that I can pass a value to the Swi just before calling Swi_post()?

Currently, when I attempt to change arg0, I get a compiler error (" ... pointer to incomplete class type ..." when I try somthing like this:

swi_oncePerCycle ->arg0 = var1;    // COMPILER ERROR here

Swi_post(swi_oncePerCycle );

It appears to not have the stuct info about the SWI object, and the compiler can't find it.

Here is the SWI setup in the configuration file:

var swi1Params = new Swi.Params();
swi1Params.instance.name = "oncePerCycle";
swi1Params.priority = 12;
Program.global.swi_oncePerCycle = Swi.create("&swiFunction", swi1Params);

Thanks for any suggestions.

Chuck S.

  • Hi,

    You can use Swi_setAttrs. Please refer to API reference to see the restrictions. You can use Swi_getAttrs also to get the values of the fields you don't want to change.

    Todd

  • Todd,

    Thanks for that info. How does the Swi function then access those arguments? Does the function look like this:

    swiFunc(UArg arg0, UArg arg1) , where arg0 = Swi_Params.arg0 and arg1 = Swi_Params.arg1?

    Chuck
  • Please refer to the API reference for more details.

  • I'm still a little foggy about how the params (Swi_Params) are used.  The API shows how to assign params, but not what their use is.  When the swi runs, and invokes swiFxn, are the swi params accessible by swiFxn?  If not what are the params for?

    Thanks,

    Chuck

  • The params are supplied on the Swi.create in the .cfg (or in the Swi_create & Swi_construct for runtime creation). So you can supply an empty param to Swi_getAttrs to get the original settings. Then change the params you want (e.g. arg0) and then call Swi_setAttrs with that params structure. Just make sure the constraints are met for Swi_setAttrs (shown above).

    Todd
  • I think that I've now got a pretty good grasp on the swi attributes, but here's the concept that I'm not sure of: If i have a function (swiFnxn) that gets invoked by the SWI, are the params that I set up with Swi_setAttrs passed as arguments to swiFnxn?

    This is what the API shows:

    typedef Void (*Swi_FuncPtr) (UArg, UArg);

    Are the two UArg parameters that are passed to the function equal to the two params that I set up with Swi_setAttrs? If not, I need to know how the UArgs are passed in.

    Thanks,
    Chuck
  • The arg0 and arg1 fields in the Swi_Params structure are the ones that are passed into the Swi function when it is invoked.