Blackfin
Kernel api abstracts the primitive operating system services and facilitates easy migration of applications to different operating system environments.The basic services include synchronization services, interrupt services, and timer based callback services.kernel-api provides a standard and uniform interface irrespective of the underlying operating environment. This abstraction enables the applications to be portable across different operating system platforms and environments.
Each semaphore object is allocated a unique identifier by the underlying kernel implementation and this identifier is passed by any application on each function that operates on the object. The unique identifier is a ker_sem_id_t type whose C declaration is as shown below
typedef unsigned int ker_sem_id_t
Applications use the kernel api ker_get_semaphore
function to obtain a
semaphore object and the
ker_rel_semaphore
function to release the object and hand the ownership of the object back
to the operating
system when it is no longer required by the component.
Once an object has been obtained, the component calls the
ker_pend_semaphore to acquire the
synchronization object and the kernel is expected to block the execution
entity if the object is
not available. Once the object has been acquired it is made available by
calling the
ker_post_semaphore function.
Multiple
ker_pend_semaphore may be active on a synchronization object when the
ker_post_semaphore function is invoked and
in such a scenario
the kernel is expected to release only one execution entity on each
invocation of
ker_post_semaphore function for the object.
read
request on a socket, can not be
satisfied
then the TCP/IP module will perform a
ker_pend_semaphore on
the associated synchronization object.
Once data is available on the socket then the associated synchronization
object is signaled through
a call on the ker_post_semaphore function
which will unblock the
waiting execution entity.
Name | Type | Description |
---|---|---|
ker_sem_id_t | typdef | ker_sem_id_t is the type for the identifier of a Semaphore synchronization object.The kernel api returns an id when a new object is allocated by a call on the ker_get_semaphore function and is used on the other function calls to identify which synchronization object is being operated on. |
ker_priority_level_e | enum | The Priority level enumeration defines the priority levels that are accepted by the ker_disable_interrupts and ker_enable_interrupts functions. These enumerations are valid only for the Blackfin Family of processors running on VDK. |
Name | Description |
---|---|
ker_get_semaphore | ker_get_semaphore is used obtain the identifier for a new semaphore object. |
ker_rel_semaphore | ker_rel_semaphore releases a semaphore object and returns ownership of the object to the underlying operating system. |
ker_pend_semaphore | ker_pend_semaphore enables the caller to acquire a semaphore object. |
ker_post_semaphore | ker_post_semaphore releases (or signals) the specified synchronization object. |
ker_disable_interrupts | ker_disable_interrupts disables interrupts up to the priority level specified. |
ker_enable_interrupts | ker_enable_interrupts re-enables interrupts after a call on ker_disable_interrupts. |
ker_sleep | Blocks the execution entity for the specified number of milliseconds. |
ker_set_lasterror | ker_set_lasterror sets the supplied last error value to the executing thread or process specific error of the OS. |
ker_get_lasterror | ker_get_lasterror returns the last error value for the current executing thread.ker_set_lasterror sets the error value and typically stores in the executing threads context. |
ker_get_systime | ker_get_systime returns the current system time in milliseconds since the system boot. |
ker_get_auxdata | Auxiliary data thats passed by the environment to the kernel. This value can be used by the kernel api interface developers to pass in any extra data during the initialization. ker_get_auxdata returns the pointer to the data. |
ker_set_auxdata | Auxiliary data can be used to pass in any auxiliary information to the underlying OS. For example in VDK environement generic VDK thread template that is used to create lwip threads is passed to kernel interface during initialziation. |