////////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2002 Xilinx, Inc.  All rights reserved.
//
// Xilinx, Inc.
// XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS" AS A 
// COURTESY TO YOU.  BY PROVIDING THIS DESIGN, CODE, OR INFORMATION AS
// ONE POSSIBLE   IMPLEMENTATION OF THIS FEATURE, APPLICATION OR 
// STANDARD, XILINX IS MAKING NO REPRESENTATION THAT THIS IMPLEMENTATION
// IS FREE FROM ANY CLAIMS OF INFRINGEMENT, AND YOU ARE RESPONSIBLE 
// FOR OBTAINING ANY RIGHTS YOU MAY REQUIRE FOR YOUR IMPLEMENTATION.  
// XILINX EXPRESSLY DISCLAIMS ANY WARRANTY WHATSOEVER WITH RESPECT TO 
// THE ADEQUACY OF THE IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO 
// ANY WARRANTIES OR REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE 
// FROM CLAIMS OF INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY 
// AND FITNESS FOR A PARTICULAR PURPOSE.
// 
// Date   : 2002, November.
// Author : Raj Nagarajan (rajn@xilinx.com)
// Company: Xilinx
// Group  : Emerging Software Technologies
//
// $Id :$
//
//////////////////////////////////////////////////////////////////////////////

/***************************************************************************/
/**
 * @file msg.h 
 *
 * Thic contains the function decleration for Message Queue routine.
 ***************************************************************************/
#ifndef _MSG_H
#define _MSG_H

#include <os_config.h>
#include <config_param.h>
#include <config_cparam.h>
#include <sys/queue.h>
#include <sys/sema.h>
#include <sys/ipc.h>

/**
 * Each Message queue is associated with this structure.
 */
struct msgid_ds {
	signed char msgid ;		/**< Message Queue ID */
	unsigned char key ;		/**< Key used to identify the MsgQ */
	unsigned char msgsize ;		/**< The size of the Message */
	unsigned char maxmsg ;		/**< Message Queue Max. length */
	struct _semaphore *full ;	/**< Semaphore used by the producer */
	struct _semaphore *empty ;	/**< Semaphore used by the consumer */
	struct _queue msg_q ;		/**< Queue of Messages */
} ;

/*
 * Message Q functions defined in sys/msg.c
 */
int sys_msgget( unsigned int key, unsigned int msgsize, unsigned int maxmsg, unsigned int flag );
int sys_msgctl( unsigned int msgid, unsigned int cmd, struct msgid_ds *buf ) ;
int sys_msgsend( unsigned int msgid, const void *msg, unsigned int nbytes, unsigned int flag ) ;
int sys_msgrecv( unsigned int msgid, void *msg, unsigned int nbytes, unsigned int type, unsigned int flag ) ;

#endif
