logo

.
Saturday 21st of October 2017    

Binding PDF Print E-mail
Saturday, 07 February 2009 12:00

The C Kernel Binding

 

Standard C type definitions (stddefs.h) used:

  • bool boolean data type, e.g. bit or unsigned char

  • int8u unsigned, 8 bits

  • int8s signed, 8 bits

  • int16u unsigned, 16 bits

  • int16s signed, 16 bits

  • int32u unsigned, 32 bits

  • int32s signed, 32 bits

  • float32 floating point, single precision, 32 bits

  • float64 floating point, double precision, 64 bits

  •  

  • pointer void *, general pointer type

  • string int8s*, general string type

  • handlerptr void *handlerptr (void), general handlerptr type

  •  

  • taskptr void (*taskptr) (void)

  • stacktype specify stack type, such as int8u or int16u

 

Definitions for protection of critical regions inside kernel calls:

  • START_CRITICAL Definition for starting protected critical section

  • END_CRITICAL Definition for ending protected critical section

  • _disable () Macro for 'standard' C disable function if needed

  • _enable () Macro for 'standard' C enable function if needed

Note: The _disable () and _enable macro's may not be needed when the C compiler supports these functions for standard. In that case the macro's do not have to be specified.

 

 

Definitions for inside C Kernel types:

  • ck_int8u Inside C Kernel type for int8u type

  • ck_int16u Inside C Kernel type for int16u type

  • ck_bool Inside C Kernel type for bool type

  • ck_int32u Inside C Kernel type for int32u type

Note: The inside C Kernel types can be used to override the standard types used. In some bindings for example it can be very efficient to use a compiler specific bit type instead of a standard boolean type, or to designate the int8u type to specific 'faster' data areas when supported by the compiler.

 

 

Function prototypes to implement in the binding:

 

/****************************************************************************/
void KernelTickInit (void);
/****************************************************************************/
/*
* Initializes the necessary tick hardware for the kernel and starts the
* tick hardware timer used. This function is called from CK_Init.
*/

/****************************************************************************/
void KernelTickSetHandler (handlerptr tickHandlerPtr);
/****************************************************************************/
/*
* Sets the tick handler for the C Kernel. This function is called from
* CK_Init.
*/

/****************************************************************************/
void SetupStack (int8u tid, handlerptr taskFunction,
stacktype *stackBasePtr, int16u stacksize);
/****************************************************************************/
/*
* Initializes the stack for a task. The function is pushed as the return
* address, after that all initial values for the registers are pushed in
* order to get the correct register values when the task is started.
*/

/****************************************************************************/
void ContextSwitch (void);
/****************************************************************************/
/*
* Performs a normal context switch for a task. The context of a task is saved
* just as if an interrupt has occurred.
*/

/****************************************************************************/
void ISRcontextSwitch (void);
/****************************************************************************/
/*
* Performs an interrupt context switch for a task. The context of a task
* is already saved by the interrupt so the normal saving of a context
* can be skipped.
*/

Top

 
bottom

top

Statistics

Members : 411
Content : 10
Web Links : 2
Content View Hits : 160849

Who's Online

We have 25 guests online

bottom

(c) The C Kernel pages, powered by Joomla!. Validated XHTML and CSS.