PxHndCall Interface
PxHndCall Interface is an interface for running a function (handler) with supervisor privileges.
The PXROS-HR Kernel already contains a _PxHndcall
macro to execute user-defined functions in supervisor mode. However, the implementation makes use of the nested function feature in GCC and is thus only available in C modules, but not in C++. Therefore, the PxHndcall Interface provided by this utility serves as a replacement for the original interface and is applicable in C and C++ code.
This utility defines a C/C++ interface for _PxHndcall
.
The handler runs in Kernel mode (interrupt priority level 1). As a result, handler cannot be interrupted by any Task — scheduling is disabled during handler execution. The handler runs in the calling task’s context and uses the task’s stack.
The calling task must:
-
define the handler with possibly variable number of arguments
-
call this handler using a
_PxHndcall()
macro -
have the task access right to execute handlers, i.e. PXACCESS_HANDLERS access right
PxHndcall
can be called only from Task level (not from handlers!).