Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Devices /
Chapter 5 - ADB Manager


Summary of the ADB Manager

Pascal Summary

Data Types

TYPE ADBDataBlock = 
   PACKED RECORD
      devType:          SignedByte;    {device handler ID}
      origADBAddr:      SignedByte;    {default ADB address}
      dbServiceRtPtr:   Ptr;           {pointer to device handler}
      dbDataAreaAddr:   Ptr;           {pointer to data area}
   END;
   ADBDBlkPtr = ^ADBDataBlock;
TYPE ADBSetInfoBlock = 
   RECORD
      siServiceRtPtr:   Ptr;           {pointer to device handler}
      siDataAreaAddr:   Ptr;           {pointer to data area}
   END;
   ADBSInfoPtr = ^ADBSetInfoBlock;
TYPE ADBOpBlock =
   RECORD
      dataBuffPtr:      Ptr;           {address of data buffer}
      opServiceRtPtr:   Ptr;           {pointer to device handler}
      opDataAreaPtr:    Ptr;           {pointer to optional data area}
   END;
   ADBOpBPtr = ^ADBOpBlock;
   ADBAddress = SignedByte;

ADB Manager Routines

Initializing the ADB Manager

PROCEDURE ADBReInit;

Communicating Through the ADB

FUNCTION ADBOp     (data: Ptr; compRout: ProcPtr; buffer: Ptr; 
                    commandNum: Integer): OSErr;

Getting ADB Device Information

FUNCTION CountADBs:Integer;
FUNCTION GetIndADB  (VAR info: ADBDataBlock; 
                     devTableIndex: Integer): ADBAddress;
FUNCTION GetADBInfo (VAR info: ADBDataBlock; 
                     adbAddr: ADBAddress): OSErr;

Setting ADB Device Information

FUNCTION SetADBInfo (VAR info: ADBSetInfoBlock; 
                     adbAddr: ADBAddress): OSErr;

Application-Defined Routines

PROCEDURE MyDeviceHandler;
PROCEDURE MyCompletionRoutine;

C Summary

Data Types

typedef char ADBAddress;
struct ADBDataBlock {
   char        devType;                /*device type*/
   char        origADBAddr;            /*original ADB address*/
   Ptr         dbServiceRtPtr;         /*pointer to device handler*/
   Ptr         dbDataAreaAdd;          /*pointer to data area*/
};
typedef struct ADBDataBlock ADBDataBlock;
typedef ADBDataBlock *ADBDBlkPtr;
struct ADBSetInfoBlock {
   Ptr         siServiceRtPtr;         /*pointer to device handler*/
   Ptr         siDataAreaAddr;         /*pointer to data area*/
};
typedef struct ADBSetInfoBlock ADBSetInfoBlock;
typedef ADBSetInfoBlock *ADBSInfoPtr;
struct ADBOpBlock {
   Ptr         dataBuffPtr;            /*address of data buffer*/
   Ptr         opServiceRtPtr;         /*pointer to device handler*/
   Ptr         opDataAreaPtr;          /*pointer to optional data area*/
};
typedef struct ADBOpBlock ADBOpBlock;
typedef ADBOpBlock *ADBOpBPtr;

ADB Manager Functions

Initializing the ADB Manager

pascal void ADBReInit(void);

Communicating Through the ADB

pascal OSErr ADBOp  (Ptr data, ProcPtr compRout, Ptr buffer, 
                     short commandNum);

Getting ADB Device Information

pascal short CountADBs   (void);
pascal ADBAddress GetIndADB
                         (ADBDataBlock *info, short devTableIndex);
pascal OSErr GetADBInfo  (ADBDataBlock *info, ADBAddress adbAddr);

Setting ADB Device Information

pascal OSErr SetADBInfo  (ADBSetInfoBlock *info, ADBAddress adbAddr);

Application-Defined Functions

pascal void MyDeviceHandler     (void);
pascal void MyCompletionRoutine (void);

Assembly-Language Summary

Data Structures

ADB Data Block
0devTypebytedevice type
1origADBAddrbyteoriginal ADB address
2dbServiceRtPtrlongpointer to completion routine
6dbDataAreaAddrlongpointer to data area

ADB Information Block
0siServiceRtPtrlongpointer to completion routine
4siDataAreaAddrlongpointer to data area

ADB Operation Block
0dataBuffPtrlongaddress of data buffer
4opServiceRtPtrlongpointer to completion routine
8opDataAreaPtrlongpointer optional data area

Trap Macros

Trap Macro Names
Pascal nameTrap macro name
ADBReInit_ADBReInit
ADBOp_ADBOp
CountADBs_CountADBs
GetIndADB_GetIndADB
GetADBInfo_GetADBInfo
SetADBInfo_SetADBInfo

Global Variables
JADBProclongPointer to ADBReInit preprocessing/postprocessing routine.
KbdLastbyteADB address of the keyboard last used.
KbdTypebyteKeyboard type of the keyboard last used.

Result Codes
noErr0No error
errADBop-1Unsuccessful completion


Previous Book Contents Book Index Next

© Apple Computer, Inc.
3 JUL 1996