/*-=-=-=-=-=-=-=-=-=-=-=- RCCL/RCI Notice of Copyright -=-=-=-=-=-=-=-=-=-=-*
 *									    *
 *	Copyright (C) 1987, 1991 by John E. Lloyd.			    *
 *									    *
 *	Information on copyright permissions, as well as a complete	    *
 *	disclaimer of warranty, is given in the file COPYRIGHT.		    *
 *									    *
 *-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/

#ifndef _RCIMACROS_H_
#define _RCIMACROS_H_

#include "../h/rciTask.h"

#define TASKNUM(td)	((td)->taskID)
#define TASKMASK(td)	((td)->taskCode)
#define TASKCPU(td)	((td)->cpu)
#define TASKCPUMASK(td)	(unsigned long)(1<<((td)->cpu))
#define TASKTCB(td)	((td)->tcb)
#define TASKDEV(td)	((IO_DEVICE*)((td)->dev))

#define TASKNUMROBOTS(td) (td->numRobots)
#define TASKROBOT(td,n)	(((n)<0||(n)>= MAX_TASKROBOTS) ? NULL : (td)->rbts[n])

#define ROBOT_DEV(rbt)	((IO_DEVICE*)((rbt)->dev))
#define ROBOT_WAKEUP(rbt)	((*rbt->wakeup)(rbt->wakeupArg))
#define ROBOT_READY(rbt)	((*rbt->ready)(rbt->readyArg))
#endif
