/*
 *	Queue definition
 *	Copyright (C) 1998 Jim Moores
 *	Modifications (C) 2002-2005 Fred Barnes
 *
 *	This program is free software; you can redistribute it and/or modify
 *	it under the terms of the GNU General Public License as published by
 *	the Free Software Foundation; either version 2 of the License, or
 *	(at your option) any later version.
 *
 *	This program is distributed in the hope that it will be useful,
 *	but WITHOUT ANY WARRANTY; without even the implied warranty of
 *	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *	GNU General Public License for more details.
 *
 *	You should have received a copy of the GNU General Public License
 *	along with this program; if not, write to the Free Software
 *	Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

#ifndef QUEUE_DEFS_H
#define QUEUE_DEFS_H

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include <sched_consts.h>
#include <arch/sched_types.h>

#ifdef PROCESS_PRIORITY
/* FIXME: keeping these separate for now -- gcc issues ? */
#if 0 && defined(CAN_DO_SCHEDSTRUCT)
#define Fptr_q svars.fptrq
#define Bptr_q svars.bptrq
#define PPriority svars.ppriority
#define PState svars.pstate
#else
extern word *Fptr_q[MAX_PRIORITY_LEVELS];
extern word *Bptr_q[MAX_PRIORITY_LEVELS];
extern word PPriority;
extern word PState;

#if defined(PROCESS_GROUPS)
#define MaskedPPriority (PPriority & PRIORITY_MASK)
#define MaskedPGroup (PPriority & PGROUP_MASK)
#define PriMasked(X) ((X) & PRIORITY_MASK)

#define PGroupOf(X) ((pgrpinfo_t *)(((X) & PGROUP_MASK) ? ((X) & PGROUP_MASK) : (int)&default_pgroup))
#define SetPGroup(X,G) (X) = (((X) & ~PGROUP_MASK) | ((word)(G) & PGROUP_MASK))

#else	/* !defined(PROCESS_GROUPS) */
#define MaskedPPriority PPriority
#define MaskedPGroup 0
#define PriMasked(X) (X)

#endif	/* !defined(PROCESS_GROUPS) */

#endif
#endif

#if defined(CAN_DO_SCHEDSTRUCT)
extern sched_vars_type svars;
#else
extern word *Fptr;
extern word *Bptr;
#endif


#endif /* queue_defs.h */
