I've got a function that calls a number of APIs and I want it to be usable from I-State as well as normal-state, by checking what state it has been called from and invoking the appropriate I-class or normal API.
However I can't find an API that gives me the current kernel state! I've looked in the documentation, searched this forum, nada.
Sure it's there and just me being stupid, so could anyone point me to it please?
Thanks.
Kernel state?
Moderators: RoccoMarco, lbednarz, tfAteba
- Giovanni
- Site Admin
- Posts: 14895
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
Re: Kernel state?
There isn't one, usually you know in what context runs your code.
The kernel 3.0 has support for "universal" functions, you may switch to that one.
Giovanni
The kernel 3.0 has support for "universal" functions, you may switch to that one.
Giovanni
Re: Kernel state?
Giovanni wrote:There isn't one, usually you know in what context runs your code.
The kernel 3.0 has support for "universal" functions, you may switch to that one.
Giovanni
Yeah I've ended up adding another parameter to the function I want to 'share' and it invokes the appropriate I-class or normal API accordingly. All working now.
As an aside, as an enhancement suggestion, is it worth considering a new class of API that can be called from either context and figures things out itself? Would make things a lot easier than the current API situation? It could be done with a naming convention to sit alongside the current API to make migration easy?
- Giovanni
- Site Admin
- Posts: 14895
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
Re: Kernel state?
Hi,
3.0 has a convention for universal APIs, the "X" suffix. Any I-Class function can be turned in X-Class by putting it in between: chSysGetStatusAndLockX() and chSysRestoreStatusX().
Giovanni
3.0 has a convention for universal APIs, the "X" suffix. Any I-Class function can be turned in X-Class by putting it in between: chSysGetStatusAndLockX() and chSysRestoreStatusX().
Giovanni