////////////////////////////////////////////////////////////////////////////
//
// 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 queue.h 
 *
 * This contains the function decerations for queue manegement routines.
 ***************************************************************************/
#ifndef _QUEUE_H
#define _QUEUE_H

#include <os_config.h>

/**
 * @name Queue Types 
 * Various Queue's used in the System.
 * @{
 */
#define RUN_Q 	1	/**< Used to store Processes in PROC_RUN state */
#define READY_Q 2 	/**< Used to store Processes in PROC_READY state */
#define SEMA_Q	3	/**< Used for storing processes waiting for 
			     Semaphore resource */
#define MSG_Q 	4	/**< Used for storing Messages in Message Q */
/*@}*/

typedef struct _queue *queuep ;

/**
 * Queue handling structure.
 */
struct _queue {
	unsigned short item_size ;	/**< Size of Queue item */
	unsigned char max_items ;	/**< Max. number of items in Q */
	unsigned char item_count ;	/**< Items in the Queue */
	unsigned char qfront ;		/**< Queue front pointer 	*/
	unsigned char qend ;		/**< Queue end pointer 	*/
	void *items ;			/**< Queue of item's 	*/
} ;	


/*
 * Function prototypes defined in sys/queue.c
 */
void alloc_q( queuep queue, unsigned char max_items, 
		unsigned char qtype, unsigned short size, unsigned char qno ) ;
void qinit( queuep queue ) ;
void enq( queuep queue, const void *item, unsigned short key ) ;
void deq( queuep queue, void *item, unsigned short key ) ;
signed char delq( queuep queue, unsigned char item ) ;

#endif
