home *** CD-ROM | disk | FTP | other *** search
- ;*********************************************************************
- ;* *
- ;*********************************************************************
-
- ;*************
- ;* Constants *
- ;*************
- ABSEXECBASE EQU 4 ; Absolute Location of the Pointer to Exec.Library Base
-
- MD_NUMUNITS EQU 4 ; Maximum Number of Units for This Device
- TASKSTKSIZE EQU $900 ; Size of Stack Provided for Each Unit Task
-
- ; Set INFO_LEVEL to Zero to Disable Debugging Output
- ; Set INFO_LEVEL to 300 or so for Maximum Detail Output
- INFO_LEVEL EQU 0 ; Specifies the Amount of Debugging Info Desired.
- ; If > 0 You Must Link with DEBUG.LIB!
- ; (You will need to run a terminal program to
- ; initially set the baud rate).
-
- ;****************************************
- ;* Device Command Function-Code Equates *
- ;* (In Addition to the Standard Codes) *
- ;* (See Include:Exec/IO.I for Info) *
- ;****************************************
- DEVINIT ; Establish the Standard Basic Codes
- ;Option DEVCMD CMD_USERDEF ; Additional 'Extended' Device Commands as Defined
- DEVCMD CMDRANGE_END ; Placemarker - First Illegal Command Code
-
- ;********************
- ;* External Symbols *
- ;********************
- XLIB Debug ; Enter the Runtime Wack Debugger
- XLIB InitStruct ; Initialize a Data Structure
- XLIB OpenLibrary ; Open an Exec-Style Shared Library
- XLIB MakeLibrary ; Create a Library-Style Node
- XLIB CloseLibrary ; Close an Exec-Style Shared Library
- XLIB Alert ; Display a Popup Alert Box to the User
- XLIB AllocMem ; Allocate Some Memory
- XLIB FreeMem ; Release Some Memory
- XLIB Remove ; Remove a Node from a Linked List
- XLIB AddPort ; Add a Message Port to the Public List
- XLIB AddTask ; Create a New Task
- XLIB RemTask ; Destroy an Existing Task
- XLIB SetTaskPri ; Set the Scheduling Priority of a Task
- XLIB PutMsg ; Send a Message to a Message Port
- XLIB WaitPort ; Wait for a Message to Arrive at a Message Port
- XLIB GetMsg ; Retrieve the Next Message at a Message Port
- XLIB ReplyMsg ; Reply to a Message Received at a Message Port
- XLIB AllocSignal ; Allocate One of My Signal Bits
- XLIB Signal ; Generate a Signal to a Task
- XLIB Wait ; Wait for Certain Signals to Me
- XLIB CopyMemQuick ; Copy Memory Contents Quickly from A to B
- XLIB InitSemaphore ; Initialize a Signal Semaphore Structure
- XLIB ObtainSemaphore ; Obtain Exclusive Access to the Controlled Item
- XLIB ReleaseSemaphore ; Release Exclusive Access to the Controlled Item
-
- INT_ABLES ; Macro to Define XREF for Enable/Disable (exec/ables.i)
-
- ;***************************************
- ;* Device-Command Classification Masks *
- ;***************************************
- ;* This equate is used to tell which device commands should be
- ;* handled immediately (on the caller's thread). This method
- ;* of encoding limits the number of possible commands to 32.
- ;*
- ;* Commands which are trivially short and 100% reentrant should
- ;* be performed immediately by the device, to eliminate the
- ;* task switching overhead.
- IMMEDIATES EQU %00000000000000000000000111000011
- ; --------========--------========
- ; FEDCBA9876543210FEDCBA9876543210
- ;* This equate is used to tell which device commands should
- ;* never be handled immediately. This method of encoding
- ;* limits the number of possible commands to 32.
- ;*
- NEVERIMMED EQU %00000000000000000000100000001100
- ; --------========--------========
- ; FEDCBA9876543210FEDCBA9876543210
-
- ;*********************************************************************
- ;* Layout Template of Device and Unit Structures *
- ;*********************************************************************
-
- ; Device Node Structure <=====================================================
- STRUCTURE MyDev,LIB_SIZE ; Standard Shared-Library-Style Structure |
- ; The rest of the items (except md_SegList) in this structure are |
- ; optional. The device's seglist must be returned to Exec upon |
- ; upon close to properly unload the device's code. |
- UBYTE md_Flags ; Device-Specific Flags |
- UBYTE md_Pad1 ; (Pad to Longword Boundary) |
- ULONG md_SysLib ; Ptr to Base of Exec Shared Library |
- ULONG md_SegList ; Ptr to Device's Own LoadSegment List |
- STRUCT md_SemLock,SS_SIZE ; Semaphore Controlling Sharing of the |
- ; Device Global Data Area |
- STRUCT md_Units,MD_NUMUNITS*4 ; Array of Ptrs to Unit Descriptors (0-3) |
- ; |
- ; Other Device-Specific Data Global Across All Units |
- ; |
- LABEL MyDev_Sizeof ; End of Device Node Structure <=====================
-
- ; Unit Descriptor Structure <=================================================
- STRUCTURE MyDevUnit,UNIT_SIZE ; Standard MsgPort, RefCount, etc. |
- UBYTE mdu_UnitNum ; Unit Number (0-255) |
- UBYTE mdu_Pad2 ; (Pad to Longword Boundary) |
- APTR mdu_Device ; Ptr to Our Device Node |
- STRUCT mdu_Stack,TASKSTKSIZE ; Memory Block for Use as Our Stack |
- STRUCT mdu_Tcb,TC_SIZE ; Memory Block for Use as Our TaskCtrlBlk |
- LABEL MyDevUnit_Sizeof ; End of Unit Descriptor Structure <======
-
- ; Unit Descriptor Flags (UNIT_FLAGS)
- ;Std BITDEF UNIT,ACTIVE,0 ; Device is Active
- ;Std BITDEF UNIT,INTASK,1 ; Running in Device's Unit Task (vs User's Task)
- BITDEF MDU,STOPPED,2 ; Unit's Operation is Suspended (Stopped)
-
- ;*********************************************************************
- ;* *
- ;*********************************************************************
-
-