Overview
A-2
A.1 Overview
The control API is the collection of functions supplied in the stack library. The
entire API is exposed, although the vast majority of functions and objects will
only be used internally to the stack.
A.1.1 Interrupts and Preemption
It should be noted that no part of the stack is interrupt driven. Neither can any
stack function be called at interrupt time. All interrupt processing is performed
in the HAL or OS, and is thus externally-defined code. This allows the system
programmer to develop a HAL/OS architecture that is best suited for a given
operating environment, without affecting the operation of the stack.
The stack may or may not be pre-empted, depending on the operating environ-
ment in use. A non-preemptive architecture is possible since the stack code
does not uses polling loops nor make any blocking type calls, but preemption
is also supported.
A.1.2 Proper Use of the llEnter() and llExit() Functions
The internal stack functions are not designed to be reentrant. This allows the
stack to operate freely without the concept of a “critical section”, which is imple-
mentation dependent. Thus access to stack functions must be strictly con-
trolled. The form of this control is dependant on the system environment, and
is embodied as two low level OS functions; llEnter() and llExit(). These func-
tions are called before and after a section of code where any stack functions
are called. For example:
llEnter();
StackFunction1();
StackFunction2();
llExit();
These functions can be thought of as “entering” and “exiting” kernel mode.
To make normal user functions appear to be re-entrant, some user functions
(like the sockets API) make internal calls to llEnter() and llExit() when calling
into the stack. If an application needs to call both user functions and internal
stack functions, care must be taken so that standard user functions are not be
called between an llEnter() / llExit() pair (this would cause an error if they in turn
called llEnter()). Since applications generally don’t mix kernel type operations
with network sockets programming, this should not be an issue, but it is some-
thing to keep in mind.