/* ******************* ******************************* C HEADER FILE ******************************* ** ******************* ** ** ** ** project : The C Kernel ** ** filename : CKMSG.H ** ** version : 2 ** ** last revised : August 22, 2004 ** ** ** ***************************************************************************** ** ** ** Copyright (c) 1998-2004, P.K. van der Vlugt ** ** All rights reserved. ** ** ** ***************************************************************************** Message 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 _CKMSG_INCLUDED #define _CKMSG_INCLUDED /****************************************************************************/ /** **/ /** MODULES USED **/ /** **/ /****************************************************************************/ #include "ckconfig.h" /****************************************************************************/ /** **/ /** DEFINITIONS AND MACROS **/ /** **/ /****************************************************************************/ /****************************************************************************/ /** **/ /** TYPEDEFS AND STRUCTURES **/ /** **/ /****************************************************************************/ typedef struct { int32u msg; int8u next; } MsgType; /****************************************************************************/ /** **/ /** EXPORTED VARIABLES **/ /** **/ /****************************************************************************/ #ifndef _CKMSG_C_SRC #if NR_OF_MBOXS > 0 && NR_OF_MSGS > 0 extern MsgType Msg[NR_OF_MSGS]; #endif #endif /****************************************************************************/ /** **/ /** EXPORTED FUNCTIONS **/ /** **/ /****************************************************************************/ /****************************************************************************/ void MsgInit (void); /****************************************************************************/ /* * Initializes all resources in this module. This function must be called * before any other functions of this module are used. */ /****************************************************************************/ int8u MsgAlloc (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_MSGS will be returned to indicate the * error situation. Other errors also return NR_OF_MSGS. */ /****************************************************************************/ void MsgFree (int8u id); /****************************************************************************/ /* * This function releases the specified resource id when it is a valid id. * The resource is set back to the initial state. */ /****************************************************************************/ void SetMsg (int8u id, int32u msg); /****************************************************************************/ /* * Sets the message specified by id with the value from msg. */ /****************************************************************************/ int32u GetMsg (int8u id); /****************************************************************************/ /* * Returns the contents of the message specified by id. */ #endif /****************************************************************************/ /** **/ /** EOF **/ /** **/ /****************************************************************************/