I'm writing a code in C++ for Xtensa virtual platform. I want to use the functionality of the simcall_callback, to return data from the internal FW code. My C++ is a little bit rusty.
typedef int(∗ simcall_callback)(xtsc_core &core, void ∗callback_arg, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6)
simcall_callback set_simcall_callback (simcall_callback callback, void ∗callback_arg, void ∗∗ previous_arg = NULL)
How should I invoke the set_simcall_callback correctly, and what should be the second and third arguments?
Documentation about the Xtensa callback functions can be found at the following link (Pg.282, 309)
If you need declare function you can do it like this:
simcall_callback simcall_callback_func;
Then you need define callback function body:
int simcall_callback_func (xtsc_core &core, void *callback_arg, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6)
{
// Do what you need
return 0;
}
then you can invoke set_simcall_callback where first parameter our declared function. All parameters are described on page 310 of instraction.
int main()
{
// If you need previouse function then hold returned value
simcall_callback prev_func = set_simcall_callback (simcall_callback_func, NULL);
return 0;
}