/* ******************* ******************************* C HEADER FILE ******************************* ** ******************* ** ** ** ** project : The C Kernel ** ** filename : CKREGION.H ** ** version : 2 ** ** last revised : August 22, 2004 ** ** ** ***************************************************************************** ** ** ** Copyright (c) 1998-2004, P.K. van der Vlugt ** ** All rights reserved. ** ** ** ***************************************************************************** Region Resource module. VERSION HISTORY: ---------------- Version : 1 Date : June 01, 2003 Revised by : P.K. van der Vlugt Description : Original version Version : 2 Date : August 22, 2004 Revised by : P.K. van der Vlugt Description : * Changed module name to comply to new kernel module naming convention. */ #ifndef _CKREGION_INCLUDED #define _CKREGION_INCLUDED /****************************************************************************/ /** **/ /** MODULES USED **/ /** **/ /****************************************************************************/ #include "ckconfig.h" /****************************************************************************/ /** **/ /** DEFINITIONS AND MACROS **/ /** **/ /****************************************************************************/ /****************************************************************************/ /** **/ /** TYPEDEFS AND STRUCTURES **/ /** **/ /****************************************************************************/ typedef struct { bool req; bool lock; int8u tid; int8u qid; } RegionType; /****************************************************************************/ /** **/ /** EXPORTED VARIABLES **/ /** **/ /****************************************************************************/ #ifndef _CKREGION_C_SRC #if NR_OF_REGIONS > 0 extern RegionType Region[NR_OF_REGIONS]; #endif #endif /****************************************************************************/ /** **/ /** EXPORTED FUNCTIONS **/ /** **/ /****************************************************************************/ /****************************************************************************/ void RegionInit (void); /****************************************************************************/ /* * Initializes all resources in this module. This function must be called * before any other functions of this module are used. */ /****************************************************************************/ int8u RegionAlloc (void); /****************************************************************************/ /* * This function requests one of the available resources. If a resource * is available, the resource id will be returned. If there are no more * resources avaliable, NR_OF_REGIONS will be returned to indicate the * error situation. Other errors also return NR_OF_REGIONS. */ /****************************************************************************/ void RegionFree (int8u id); /****************************************************************************/ /* * This function releases the specified resource id when it is a valid id. * The resource is set back to the initial state. The associated resource * (task queue) is also released. */ #endif /****************************************************************************/ /** **/ /** EOF **/ /** **/ /****************************************************************************/