/* File: PCCardCalls.h Contains:This file contains the data structures and equates needed to call the PC Card driver on the Macintosh side. Copyright: 1994 by Apple Computer, Inc., all rights reserved. */ #ifndef __PCCARDCALLS__ #define __PCCARDCALLS__ /*---------------------------------------------------------------------------- ; Other Header Files ;--------------------------------------------------------------------------*/ #ifndef __TYPES__ #include #endif #ifndef __OSUTILS__ #include #endif #ifndef __EVENTS__ #include #endif /*---------------------------------------------------------------------------- ; Misc. Equates ;--------------------------------------------------------------------------*/ #define RSDriverName "\p.RoyalScam"// The name of the driver /*---------------------------------------------------------------------------- ; Error Codes Returned from Control/Status Calls ;--------------------------------------------------------------------------*/ enum{ rsFirstErr = 0x7000, // first error code rsAlreadyBooted = 0x7001, // PC is already booted, can't complete operation rsLastErr = 0x7001 // last error code }; /*---------------------------------------------------------------------------- ; Notifications Codes Sent to Notification Proc ;--------------------------------------------------------------------------*/ enum{ rsPrintSpoolErr = 0x7F00, // Having trouble opening/writting the print spool file rsPrintSpoolFileReady = 0x7F01, // at least 1 spool file is ready to be printed rsCOM1SpoolErr = 0x7F01, // Having trouble opening/writting the serial spool file rsCOM2SpoolErr = 0x7F02 // Having trouble opening/writting the serial spool file }; /*---------------------------------------------------------------------------- ; Control/Status ParamBlock Record ;--------------------------------------------------------------------------*/ typedef struct { // PC Card driver Control/Status ParamBlock Record QElemPtr qLink; // queue link in header short qType; // type byte for safety check short ioTrap; // FS: the Trap Ptr ioCmdAddr; // FS: address to dispatch to ProcPtr ioCompletion; // completion routine addr (0 for synch calls) OSErr ioResult; // result code StringPtr ioNamePtr; // ptr to Vol:FileName string short ioVRefNum; // volume refnum (DrvNum for Eject and MountVol) short ioCRefNum; // refNum for I/O operation short csCode; // The operation code void * csPtr; // pointer to proceedure or data long csData; // data long csData2; // data } RSParamBlockRec, *RSParamBlockRecPtr; /*---------------------------------------------------------------------------- ; PC Control ;--------------------------------------------------------------------------*/ // Control Codes enum{ rsBootPC = 701, // Boots the PC rsResetPC = 702, // Resets the PC rsWriteCMOS = 703, // Writes the CMOS RAM values rsReadCMOS = 704, // Reads current CMOS RAM values rsEnableVideo = 705, // Enables the VGA output rsDisableVideo = 706, // Disables the VGA output rsSetMemoryConfig = 707, // Sets the shared memory config rsHaltPC = 708, // Stops the PC rsResumePC = 709 // Allows PC to continue }; // Status Codes enum{ rsPCStatus = 701, // Returns driver state information rsLastError = 702 // Returns the last non-zero error }; // PC Status Masks enum{ rsBooted = 1, // Mask for boot state rsVGAEnabled = 2, // Mask for VGA output state rsKeyboardEnabled = 4, // Mask for keyboard state rsMouseEnabled = 8, // Mask for mouse tracking state rsDiskMountEnabled = 16, // Mask for Disk Mounting state rsSharedEnabled = 32, // Mask for Shared Memory Enabled rsDMAEnabled = 64, // Mask for DMA Enabled rsCableInstalled = 128, // Mask for video Cable Installed rsModemUsedByCom1 = 256, // Mask for modem use by com1 rsPrinterUsedByCom1 = 512, // Mask for printer use by com1 rsModemUsedByCom2 = 1024, // Mask for modem use by com2 rsPrinterUsedByCom2 = 2048, // Mask for printer use by com2 rsSoundEnabled = 4096, // Mask for Sound Enabled rsBIOSModified = 8192 // Mask for Bios modified by Driver }; /*---------------------------------------------------------------------------- ; Keyboard ;--------------------------------------------------------------------------*/ // Control Codes enum{ rsActivateKB = 102, // Tells the driver keyboard is now active rsDeactivateKB = 103, // Tells the driver keyboard is no longer active rsSetDeactivateKey = 104, // Sets the key that causes the deactivate routine to be called rsSetKeyMap1 = 105, // Sets the scan code map #1 rsSetKeyMap2 = 106, // Sets the scan code map #2 rsSetKeyMap3 = 107, // Sets the scan code map #3 rsSetKeyMap = 108 // Sets the Mac to PC map }; // Data Structures typedef char RSKeyMap[128]; // KeyMap data structure typedef char *RSKeyMapPtr; typedef struct { // Scan Code Map data structure char length; // Length of the scan code (# of bytes) char code[6]; // Scan code } RSScanCodeMap[128], *RSScanCodeMapPtr, **RSScanCodeMapHdl; /*---------------------------------------------------------------------------- ; Mouse ;--------------------------------------------------------------------------*/ // Control Codes enum{ rsSetMouseButtonKey = 200, // Sets which key to use as the second mouse button rsBeginMouseTracking = 201, // Tells the driver to track the mouse movement rsEndMouseTracking = 202 // Releases control of the mouse }; /*---------------------------------------------------------------------------- ; Serial IO ;--------------------------------------------------------------------------*/ // Com port Indexs enum{ rsCom1 = 0, // Index for Com1 rsCom2 = 1 // Index for Com2 }; // Device Types enum{ rsNULLComPort = 0, // Com port is connected to NULL (bit bucket) rsModemComPort = 1, // Com port is connected to Modem port rsPrinterComPort = 2, // Com port is connected to Printer port rsSpoolComPort = 3, // Com port data dumped into a file rsComToolBoxComPort = 4, // Com port is connected to Com Tool Box port rsIgnorePort = -1 // Do not change this port }; // Control Codes enum{ rsSetComPortConfig = 300 // Sets the connection and flow control for a port }; // Parameter Block data structures typedef struct{ short type; // The port type (rsModemComPort, rsPrinterComPort, etc..) short vRefNum; // Volume reference number for serial spool file long dirID; // Directory ID for the file long fileNamePtr; // Pointer to the file name } RSComConfig[2], *RSComConfigPtr; /*---------------------------------------------------------------------------- ; Parallel IO ;--------------------------------------------------------------------------*/ // Control Calls enum{ rsSetParallelConfig = 400,// Sets the configuration for the parallel port rsEndPrintJob = 401 // forces an end to the current print job }; // Parameter Block Data Structures typedef struct{ short eojTimeOut; // Signal End of job after n seconds of no data short vRefNum; // Volume RefNum of the Mac Volume the dir is on long spoolDirID; // RefNum for spool directory } RSParallelConfig, *RSParallelConfigPtr; /*---------------------------------------------------------------------------- ; Fixed Drive IO ;--------------------------------------------------------------------------*/ // Fixed Drive Types enum{ rsNullDrive = 0, // No drive available rsFloppyDrive = 1, // Drive is a super drive rsFileDrive = 2, // Drive is a FS file rsPartitionDrive = 3, // Drive is a partition defined elsewhere rsIgnoreDrive = -1 // Don't change this drive }; // Fixed Drive Array Index Numbers enum{ rsDriveA = 0, // Floppy Drive A: rsDriveB = 1, // Floppy Drive B: rsDriveC = 2, // Hard Drive C: rsDriveD = 3 // Hard Drive D: }; // Control Codes enum{ rsSetDriveConfig = 500, // Initialize the Drive Configuration rsMountDisks = 501, // Mount any disk that is inserted rsDontMountDisks = 502 // Do not mount any disk that is inserted }; // Fixed Disk Data Structures typedef struct{ short type; // what type of device this drive is short vRefNum; // Volume refNum or SCSI ID long dirID; // Directory ID or starting sector number for SCSI long fileNamePtr; // Ptr to file name or # of sectors if SCSI } RSFixedDriveConfig[4], *RSFixedDriveConfigPtr; /*---------------------------------------------------------------------------- ; Network Disk IO ;--------------------------------------------------------------------------*/ // Control Codes enum{ rsSetNetDriveConfig = 600 // Set Net Drive config }; // Status Codes enum{ rsGetNetDriveConfig = 650 // Get Drive Letter Info }; // Data Structure typedef struct{ char status; // 0 = unusable, - = inuse, + = can be used char changed; // Used by driver! short vRefNum; // which mac volume (0 = no net drive) long dirID; // the Directory ID } RSNetDriveConfig[26], *RSNetDriveConfigPtr; /*---------------------------------------------------------------------------- ; Messaging ;--------------------------------------------------------------------------*/ // Message control codes enum{ rsSendMessage = 800, // Send a message rsInstallMsgHandler = 801, // Install a message handler rsRemoveMsgHandler = 802, // Remove message handler rsRegisterMessage = 803 // Register message type }; // Message Results (in msgResult field of MsgPBlk) enum { msgNoError = 0, // No error, completed msgOverrun = -1, // More data was available msgUnderrun = -2, // Less data was available msgTimeout = -3 // Timeout error }; typedef struct MsgPBlk { struct MsgPBlk* msgQLink; // Pointer to next queue element short msgQType; // Queue Flags short msgCmd; // The message type or command long msgParam1; // Message parameter 1 long msgParam2; // Message parameter 2 void* msgBuffer; // Ptr to the message data buffer long msgReqCount; // Requested data length long msgActCount; // Actual data length ProcPtr msgCompletion; // Ptr to completion routine or NULL short msgResult; // The result of message operation short msgFlags; // Message flags (swap and shared) long msgUserData; // For use by caller (a5, etc…) } MsgPBlk, *MsgPBlkPtr; typedef struct MsgRecElem { struct MsgRecElem* recQLink; // Next queue element short recQType; // queue flags short recFlags; // Not used...Yet...Set to zero ProcPtr recProc; // Ptr to the receive proceedure short recCmdBase; // first command received by this proc short recCmdCount; // # of commands allocated for this proc long recUserData; // For caller's use (could be A5...) } MsgRecElem, *MsgRecElemPtr; /*---------------------------------------------------------------------------- ; Sound ;--------------------------------------------------------------------------*/ enum{ rsEnableSound = 1000, // Enable sound emulation rsDisableSound = 1001 // Disable sound emulation }; /*---------------------------------------------------------------------------- ; Notification Proc ;--------------------------------------------------------------------------*/ // Control Codes enum{ rsSetNotificationProc = 900 // Sets the address of the Notification proceedure }; /*---------------------------------------------------------------------------- ; Event Notification ;--------------------------------------------------------------------------*/ // Control Codes enum{ rsEventInstall = 1100, // Install and event handler rsEventRemove = 1101, // Remove an event handler rsEventNotify = 1102 // Notify event chain of an event }; // Status Codes enum{ rsEventSample = 1100 // Sample data on an event }; /*---------------------------------------------------------------------------- ; NotifyUPP definition ;--------------------------------------------------------------------------*/ /* pcCardNotificationProcs cannot be written in or called from a high-level language without the help of mixed mode or assembly glue because they use the following parameter-passing convention: typedef pascal void (*PCCardNotifyProcPtr)(short event, long a1Param); In: event D0.W a1Param A1.L Out: none */ enum { uppPCCardNotifyProcInfo= kRegisterBased |REGISTER_ROUTINE_PARAMETER(1,kRegisterD0,kTwoByteCode) |REGISTER_ROUTINE_PARAMETER(2,kRegisterA1,kFourByteCode) }; #if USESROUTINEDESCRIPTORS typedef pascal void (*PCCardNotifyProcPtr)(short event, long a1Param); typedef UniversalProcPtr PCCardNotifyUPP; #define CallPCCardNotifyProc(userRoutine, event, a1Param) \ CallUniversalProc((UniversalProcPtr)(userRoutine), uppPCCardNotifyProcInfo, (event, a1Param)) #define NewPCCardNotifyProc(userRoutine) \ (PCCardNotifyUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), \ uppPCCardNotifyProcInfo, GetCurrentISA()) #else typedef ProcPtr PCCardNotifyUPP; #define NewPCCardNotifyProc(userRoutine) \ (PCCardNotifyUPP)((userRoutine)) #endif /*---------------------------------------------------------------------------- ; function prototypes ;--------------------------------------------------------------------------*/ OSErr OpenPCCardDriver(short *refNum); OSErr CallrsBootPCSync(short refNum); OSErr CallrsResetPCSync(short refNum); OSErr CallrsPCStatusSync(short refNum, long *status); OSErr CallrsEnableVideoSync(short refNum); OSErr CallrsDisableVideoSync(short refNum); OSErr CallrsMountDisksSync(short refNum); OSErr CallrsDontMountDisksSync(short refNum); OSErr CallrsActivateKBSync(short refNum); OSErr CallrsDeactivateKBSync(short refNum); OSErr CallrsBeginMouseTrackingSync(short refNum); OSErr CallrsEndMouseTrackingSync(short refNum); OSErr CallrsEndPrintJobSync(short refNum); OSErr CallrsSetNotifcationProcSync(short refNum, PCCardNotifyUPP *pcCardNotifyUPPPtr, long *a1ParamPtr); OSErr CallrsSetMemoryConfigSync(short refNum, long logBaseAddr, long physBaseAddr, long memlen); #endif// __PCCARDCALLS__