**
**	$RCSfile: errorlog.i,v $
**	$Filename: ErrorLog.i $
**	$Revision: 1.2 $
**	$Date: 2002/01/05 18:14:39 $
**
**	ErrorLog assembler include file (version 1.2 beta) 
**
**	(C) Copyright 1993-2001 by Etienne Vogt
**

	IFND EXEC_PORTS_I
	INCLUDE "exec/ports.i"
	ENDC	! EXEC_PORTS_I
	IFND EXEC_SEMAPHORES_I
	INCLUDE "exec/semaphores.i"
	ENDC	! EXEC_SEMAPHORES_I
	IFND SANA2_SANA2DEVICE_I
	INCLUDE "devices/sana2.i"
	ENDC	! SANA2_SANA2DEVICE_I
	IFND DOS_DOS_I
	INCLUDE "dos/dos.i"
	ENDC	! DOS_DOS_I


 STRUCTURE	HellGate,SS_SIZE	; Semaphore for arbitration
	UWORD	hg_LogCount		; Number of logged devices
	STRUCT	hg_MsgPort,MP_SIZE	; Message Port for IORequests
	UWORD	hg_AbortCount		; Number of abort Requests
	STRUCT	hg_DoomList,LH_SIZE	; List of logged devices
	UWORD	hg_ErrorCount		; Total number of errors
	ULONG	hg_OpCount		; Total number of IOs
	APTR	hg_PatchBeginIO		; Pointer to patched BeginIO code
	APTR	hg_PatchAbortIO		; Pointer to patched AbortIO code
	APTR	hg_DummyCopyBuff	; Pointer to dummy CopyBuff routine
 	APTR	hg_Pool			; Memory pool for dynamic structures
 LABEL		hg_SizeOf

 STRUCTURE 	EvilNode,MLN_SIZE	; Link into list
	APTR	en_OrigIOReq		; Pointer to Original IORequest
	APTR	en_DoomNode		; Pointer to Device DoomNode
 LABEL		en_EffectIOReq		; Effective IORequest goes here

en_SizeOf	EQU	en_EffectIOReq

DNAME_SIZE	EQU	8		; Size of DoomNode name
DVNAME_SIZE	EQU	24		; Size of exec device name
TNAME_SIZE	EQU	32		; Size of calling task name

 STRUCTURE	DoomNode,LN_SIZE	; Standard Node
	UWORD	dn_Flags		; DoomNode Flags
	ULONG	dn_UnitNum		; Unit number
	STRUCT	dn_DoomName,DNAME_SIZE	; Log Name for device/unit
	STRUCT	dn_DeviceName,DVNAME_SIZE ; exec device name (not pointer !)
	UBYTE	dn_DevSubType		; Device subtype (mainly for SCSI devices)
	UBYTE	dn_DevType		; Type of device logged (NSD ID)
	UWORD	dn_IOSize		; Size of device's IORequests
	APTR	dn_OrigBeginIO		; Pointer to original BeginIO code
	APTR	dn_OrigAbortIO		; Pointer to original AbortIO code
	ULONG	dn_OpCount		; Device Operation count so far
	UWORD	dn_ErrorCount		; Device Error count so far
	UWORD	dn_ActiveCount		; Number of active Requests
	STRUCT	dn_Evils,MLH_SIZE	; Linked List of active Requests
	STRUCT	dn_IOReq,IOS2_SIZE	; Largest known IORequest yet
	STRUCT	dn_IOPort,MP_SIZE	; IORequest reply port
 LABEL	dn_SizeOf

NT_DOOMNODE	EQU	NT_USER

* Device Types

NSDEVTYPE_UNKNOWN	EQU	0	; No suitable category, anything
NSDEVTYPE_GAMEPORT	EQU	1	; like gameport.device
NSDEVTYPE_TIMER		EQU	2	; like timer.device
NSDEVTYPE_KEYBOARD	EQU	3	; like keyboard.device
NSDEVTYPE_INPUT		EQU	4	; like input.device
NSDEVTYPE_TRACKDISK	EQU	5	; like trackdisk.device
NSDEVTYPE_CONSOLE	EQU	6	; like console.device
NSDEVTYPE_SANA2		EQU	7	; A >=SANA2R2 networking device
NSDEVTYPE_AUDIO		EQU	8	; like audio.device
NSDEVTYPE_CLIPBOARD	EQU	9	; like clipboard.device
NSDEVTYPE_PRINTER	EQU	10	; like printer.device
NSDEVTYPE_SERIAL	EQU	11	; like serial.device
NSDEVTYPE_PARALLEL	EQU	12	; like parallel.device

* DoomNode Flags

 BITDEF	DN,ENABLED,0			; IoRequests catching is enabled
 BITDEF DN,LOGERRORS,1			; Log Errors for this device


 STRUCTURE ErrorMessage,MN_SIZE
	UWORD	erm_Entry		; Error entry number
	UBYTE	erm_DevType		; Error entry type
	UBYTE	erm_Version		; ErrorLog version
	STRUCT	erm_Date,ds_SIZEOF	; Date of error
	STRUCT	erm_DoomName,DNAME_SIZE ; Device LogName
	STRUCT	erm_DeviceName,DVNAME_SIZE ; Exec device name
	STRUCT	erm_TaskName,TNAME_SIZE ; Calling Task Name (if available)
	ULONG	erm_UnitNum		; Device unit number
	ULONG	erm_OpCount		; Device operation count
	UWORD	erm_ErrorCount		; Device error count
	UWORD	erm_IOSize		; Device IORequest size
 LABEL	erm_IOReq			; Device IORequest follows...


* Alert Codes

AN_ErrorLog	EQU	$70000000
AN_elBadMessage	EQU	$70000001	; Unexpected message at HellGate
AN_elLoggerFail EQU	$700B0002	; Couldn't start logger process
AN_elNoHellGate EQU	$70000003	; Couldn't find HellGate semaphore
AN_elBadEvilLst	EQU	$70000004	; Evil List is corrupt
AN_elNoDoomNode	EQU	$70000005	; Couldn't find DoomNode
AO_ErrorLog	EQU	$00008070
