/* Mode:c; Tab-Width:4; */
/*                                                                       */
/*                                                                       */
/*                      RESTRICTED RIGHTS LEGEND                         */
/*                                                                       */
/* Use, duplication, or disclosure by the Government is subject to       */
/* restrictions as set forth in subdivision (c)(1)(ii) of the Rights in  */
/* Technical Data and Computer Software clause at 252.227-7013.          */
/*                                                                       */
/*                    TEXAS INSTRUMENTS INCORPORATED.                    */
/*                            P.O. BOX 149149                            */
/*                         AUSTIN, TEXAS 78714-9149                      */
/*                              MS 2151                                  */
/*                                                                       */
/*  Copyright (C) 1987,1988,1989,1990 Texas Instruments Incorporated.    */
/*  All rights reserved.                                                 */
/*                                                                       */
/*
	Devices.h - Device Manager

	C Interface to the Macintosh Libraries
	Copyright Apple Computer,Inc. 1985,1986,1987
	All rights reserved.
*/

/* Record of changes */
/*  08/28/89 clm   -  Removed redundant definition of CntrlParam struct.    It has already been defined in   */
/*                    CIncludes:Files.h.  Inlcude that file here as CntrlParam is needed by  PBControl       */  
/*                    struct definition.                                                                     */

#ifndef __DEVICES__
#define __DEVICES__
#ifndef __OSUTILS__
#include <OSUtils.h>
#endif
#ifndef _FILES_
#include <Files.h>
#endif

#define fsAtMark 0
#define fsCurPerm 0
#define fsRdPerm 1
#define fsWrPerm 2
#define fsRdWrPerm 3
#define fsRdWrShPerm 4

#define newSelMsg 12
#define fillListMsg 13
#define getSelMsg 14
#define selectMsg 15
#define deselectMsg 16
#define terminateMsg 17
#define buttonMsg 19
#define chooserID 1

	/* cdev message types */
#define initDev		0		/* Time for cdev to initialize itself */
#define hitDev			1		/* Hit on one of my items */
#define closeDev		2		/* Close yourself */
#define nulDev			3		/* Null event */
#define updateDev		4		/* Update event */
#define activDev		5		/* Activate event */
#define deactivDev	6		/* Deactivate event */
#define keyEvtDev		7		/* Key down/auto key */
#define macDev			8		/* Decide whether or not to show up */

	/* cdev error codes */
#define cdevGenErr	-1		/* General error; gray cdev w/o alert */
#define cdevMemErr	0		/* Memory shortfall; alert user please */
#define cdevResErr	1		/* Couldn't get a needed resource; alert */
#define cdevUnset		3		/* cdevValue is initialized to this */

/* 08/28/89 clm - this definition is already done in 
    CIncludes:Files.h; removing this version.  */
/*
typedef struct CntrlParam {
	struct QElem *qLink;
	short qType;
	short ioTrap;
	Ptr ioCmdAddr;
	ProcPtr ioCompletion;
	OSErr ioResult;
	char *ioNamePtr;
	short ioVRefNum;
	short ioCRefNum;
	short csCode;
	short csParam[11];
} CntrlParam;
*/

typedef struct DCtlEntry {
	Ptr dCtlDriver;
	short dCtlFlags;
	QHdr dCtlQHdr;
	long dCtlPosition;
	Handle dCtlStorage;
	short dCtlRefNum;
	long dCtlCurTicks;
	struct GrafPort *dCtlWindow;
	short dCtlDelay;
	short dCtlEMask;
	short dCtlMenu;
} DCtlEntry,*DCtlPtr,**DCtlHandle;

typedef struct AuxDCE {
	Ptr dCtlDriver;
	short dCtlFlags;
	QHdr dCtlQHdr;
	long dCtlPosition;
	Handle dCtlStorage;
	short dCtlRefNum;
	long dCtlCurTicks;
	struct GrafPort *dCtlWindow;
	short dCtlDelay;
	short dCtlEMask;
	short dCtlMenu;
	char dCtlSlot;
	char dCtlSlotId;
	long dCtlDevBase;
	Ptr dCtlOwner;
	char dCtlExtDev;
	char fillByte;
} AuxDCE,*AuxDCEPtr,**AuxDCEHandle;

pascal DCtlHandle GetDCtlEntry(refNum)
	short refNum;
	extern;
	
pascal Boolean SetChooserAlert(f)
	Boolean f;
	extern;
	
pascal OSErr OpenDriver(name, refNum)
	char *name;
	short *refNum;
	extern;
	
pascal OSErr OPENDRIVER(name, drvrRefNum)
	Str255 *name;
	short *drvrRefNum;
	extern;
	
pascal OSErr CloseDriver(refNum)
	short refNum;
	extern;
	
pascal OSErr FSRead(refNum,count,buffPtr)
	short refNum;
	long 	*count;
	Ptr 	buffPtr;
	extern;
	
pascal OSErr FSWrite(refNum,count,buffPtr)
	short refNum;
	long 	*count;
	Ptr 	buffPtr;
	extern;

pascal OSErr Control(refNum, csCode, csParamPtr)
	short refNum;
	short csCode;
	Ptr csParamPtr;
	extern;

pascal OSErr Status(refNum, csCode, csParamPtr)
	short refNum;
	short csCode;
	Ptr csParamPtr;
	extern;	

pascal OSErr KillIO(refNum)
	short refNum;
	extern;

pascal OSErr PBOpen(paramBlock, async)
	struct ParamBlockRec *paramBlock;
	Boolean async;
	extern;

pascal OSErr PBClose(paramBlock, async)
	struct ParamBlockRec *paramBlock;
	Boolean async;
	extern;
	
pascal OSErr PBControl(paramBlock, async)
	CntrlParam *paramBlock;
	Boolean async;
	extern;
	
	
#endif
