I want to setup DSP BIOS SWI and define 1 or 2 arguments to be passed to the SWI. How do I define the arguments in my code? Should they be declared as globals? It is not very clear in the DSP BIOS User's Guide.
Thanks.
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.
Use the SWI_setattrs () API to change the attributes of an existing SWI object.
The SWI_attrs are defined as follows:
SWI_Attrs {
SWI_Fxn fxn;
Arg arg0;
Arg arg1;
Int priority;
Uns mailbox;
In your code you could change arg0 and arg1 so that next time when the SWI is posted, the function specified in the attribute will use these arguments. For example:
swiattrs = SWI_ATTRS;
swiattrs.priority = 1;
swiattrs.fxn = (SWI_Fxn)mySwiFunction;
swiattrs.mailbox = 1;
swiattrs.arg0 = 1;
swiattrs.arg1 = 2;
SWI_setattrs(swi, &swiattrs);
void mySwiFunction (Arg i, Arg j)
{
// Do something
}
The mySwiFunction will be called with the above arguments the next time the SWI is posted.
Arnie, David,
I want to double check with you that this technique works with statically defined SWI, as well as, dynamically created SWI. Is this correct?
Thanks.
Yes, this will work with both statically and dynamically defined SWI objects.