Forums

Error creating software interrupt

Started by adit...@gmail.com July 17, 2008
Hi all,

I'm trying to create a software interrupt "swi" to call the function "filter()" using DSP/BIOS APIs:

This is the part of the code that gives an error:

***********************************************************

void filter(void);

SWI_Attrs SWI_ATTRS={(SWI_Fxn)filter,0,0,1,0};

SWI_Handle swi= SWI_create(&SWI_ATTRS);

***********************************************************

The last line gives me the following error: "function call is not allowed in a constant expression".

Can someone please tell me what's wrong with my code?

Thanks a lot,
Aditya.
Aditya,

>From the looks of he snippet you sent me, these declarations are
outside a function block.

i.e. like this
----------------------------------
int a; <-- Your declarations are here

void main()
{

}

int foo()
{

}
----------------------------------

If that's the case, you cannot execute code there. You declare the
filter function prototype there, and that's fine. You declare
SWI_ATTRS there, and fill it with the address of filter, and then
0,0,1,0). You're still not executing code, all of that is done at
compile time. You then declare the swi, and you're still ok to that
point. But you cannot call SWI_create() here. Anything outside a
function block must be able to be completed at compile/link time.
SWI_create needs to be called at run time. Leave the following

SWI_Handle swi;

and then move put this inside a function block somewhere (main?)

swi= SWI_create(&SWI_ATTRS);

Regards,
Dan

--- In c..., adityak1985@... wrote:
>
> Hi all,
>
> I'm trying to create a software interrupt "swi" to call the function
"filter()" using DSP/BIOS APIs:
>
> This is the part of the code that gives an error:
>
> ***********************************************************
>
> void filter(void);
>
> SWI_Attrs SWI_ATTRS={(SWI_Fxn)filter,0,0,1,0};
>
> SWI_Handle swi= SWI_create(&SWI_ATTRS);
>
> ***********************************************************
>
> The last line gives me the following error: "function call is not
allowed in a constant expression".
>
> Can someone please tell me what's wrong with my code?
>
> Thanks a lot,
> Aditya.
>