Mac OS 9
DeskBus.h
Go to the documentation of this file.
1 
19 #ifndef __DESKBUS__
20 #define __DESKBUS__
21 
22 #ifndef __MACTYPES__
23 #include <MacTypes.h>
24 #endif
25 
26 #ifndef __MIXEDMODE__
27 #include <MixedMode.h>
28 #endif
29 
30 #if PRAGMA_ONCE
31 #pragma once
32 #endif
33 
34 #ifdef __cplusplus
35 extern "C"
36 {
37 #endif
38 
39 #if PRAGMA_IMPORT
40 #pragma import on
41 #endif
42 
43 #if PRAGMA_STRUCT_ALIGN
44 #pragma options align = mac68k
45 #elif PRAGMA_STRUCT_PACKPUSH
46 #pragma pack(push, 2)
47 #elif PRAGMA_STRUCT_PACK
48 #pragma pack(2)
49 #endif
50 
51 #if TARGET_OS_MAC
52  typedef SInt8 ADBAddress;
53 #if CALL_NOT_IN_CARBON
54  typedef CALLBACK_API_REGISTER68K(void, ADBCompletionProcPtr,
55  (Ptr buffer, Ptr refCon, long command));
56  typedef CALLBACK_API_REGISTER68K(void, ADBDeviceDriverProcPtr,
57  (SInt8 devAddress, SInt8 devType));
62  typedef REGISTER_UPP_TYPE(ADBServiceRoutineProcPtr) TempADBServiceRoutineUPP;
63  typedef CALLBACK_API_REGISTER68K(void, ADBServiceRoutineProcPtr,
64  (Ptr buffer,
65  TempADBServiceRoutineUPP completionProc,
66  Ptr refCon, long command));
67  typedef CALLBACK_API_REGISTER68K(void, ADBInitProcPtr, (SInt8 callOrder));
68  typedef REGISTER_UPP_TYPE(ADBCompletionProcPtr) ADBCompletionUPP;
69  typedef REGISTER_UPP_TYPE(ADBDeviceDriverProcPtr) ADBDeviceDriverUPP;
70  typedef REGISTER_UPP_TYPE(ADBServiceRoutineProcPtr) ADBServiceRoutineUPP;
71  typedef REGISTER_UPP_TYPE(ADBInitProcPtr) ADBInitUPP;
72  struct ADBDataBlock
73  {
74  SInt8 devType; /* original handler ID */
75  SInt8 origADBAddr; /* original ADB Address */
76  ADBServiceRoutineUPP dbServiceRtPtr; /* service routine pointer */
77  Ptr dbDataAreaAddr; /* this field is passed as the refCon parameter to the
78  service routine */
79  };
80  typedef struct ADBDataBlock ADBDataBlock;
81  typedef ADBDataBlock *ADBDBlkPtr;
82  struct ADBSetInfoBlock
83  {
84  ADBServiceRoutineUPP siService; /* service routine pointer */
85  Ptr siDataAreaAddr; /* this field is passed as the refCon parameter to the
86  service routine */
87  };
88  typedef struct ADBSetInfoBlock ADBSetInfoBlock;
89  typedef ADBSetInfoBlock *ADBSInfoPtr;
90  // ADBOpBlock is only used when calling ADBOp from 68k assembly code
91  struct ADBOpBlock
92  {
93  Ptr dataBuffPtr; /* buffer: pointer to variable length data buffer */
94  ADBServiceRoutineUPP
95  opServiceRtPtr; /* completionProc: completion routine pointer */
96  Ptr opDataAreaPtr; /* refCon: this field is passed as the refCon parameter to
97  the completion routine */
98  };
99  typedef struct ADBOpBlock ADBOpBlock;
100  typedef ADBOpBlock *ADBOpBPtr;
101 #endif /* CALL_NOT_IN_CARBON */
102 #if CALL_NOT_IN_CARBON
111  void
112  ADBReInit(void);
113 
135 #endif /* CALL_NOT_IN_CARBON */
136 
137 #if CALL_NOT_IN_CARBON
138 
182  OSErr
183  ADBOp(Ptr refCon, ADBCompletionUPP compRout, Ptr buffer, short commandNum);
184 
185 #endif /* CALL_NOT_IN_CARBON */
186 
187 #if CALL_NOT_IN_CARBON
188 
203 #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
204 #pragma parameter __D0 CountADBs
205 #endif
206  short
207  CountADBs(void);
208 
231 #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
232 #pragma parameter __D0 GetIndADB(__A0, __D0)
233 #endif
234  ADBAddress
235  GetIndADB(ADBDataBlock *info, short devTableIndex);
236 
273 #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
274 #pragma parameter __D0 GetADBInfo(__A0, __D0)
275 #endif
276  OSErr
277  GetADBInfo(ADBDataBlock *info, ADBAddress adbAddr);
278 
305 #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
306 #pragma parameter __D0 SetADBInfo(__A0, __D0)
307 #endif
308  OSErr
309  SetADBInfo(const ADBSetInfoBlock *info, ADBAddress adbAddr);
310 
311 #endif /* CALL_NOT_IN_CARBON */
312 
313 #if CALL_NOT_IN_CARBON
322  ADBCompletionUPP
323  NewADBCompletionUPP(ADBCompletionProcPtr userRoutine);
324 #if !OPAQUE_UPP_TYPES
325  enum
326  {
327  uppADBCompletionProcInfo = 0x007B9802
328  }; /* register no_return_value Func(4_bytes:A0, 4_bytes:A2, 4_bytes:D0) */
329 #ifdef __cplusplus
330  inline ADBCompletionUPP NewADBCompletionUPP(ADBCompletionProcPtr userRoutine)
331  {
332  return (ADBCompletionUPP)NewRoutineDescriptor((ProcPtr)(userRoutine),
333  uppADBCompletionProcInfo,
334  GetCurrentArchitecture());
335  }
336 #else
337 #define NewADBCompletionUPP(userRoutine) \
338  (ADBCompletionUPP) \
339  NewRoutineDescriptor((ProcPtr)(userRoutine), uppADBCompletionProcInfo, \
340  GetCurrentArchitecture())
341 #endif
342 #endif
343 
352  ADBDeviceDriverUPP
353  NewADBDeviceDriverUPP(ADBDeviceDriverProcPtr userRoutine);
354 #if !OPAQUE_UPP_TYPES
355  enum
356  {
357  uppADBDeviceDriverProcInfo = 0x00050802
358  }; /* register no_return_value Func(1_byte:D0, 1_byte:D1) */
359 #ifdef __cplusplus
360  inline ADBDeviceDriverUPP
361  NewADBDeviceDriverUPP(ADBDeviceDriverProcPtr userRoutine)
362  {
363  return (ADBDeviceDriverUPP)NewRoutineDescriptor((ProcPtr)(userRoutine),
364  uppADBDeviceDriverProcInfo,
365  GetCurrentArchitecture());
366  }
367 #else
368 #define NewADBDeviceDriverUPP(userRoutine) \
369  (ADBDeviceDriverUPP) \
370  NewRoutineDescriptor((ProcPtr)(userRoutine), uppADBDeviceDriverProcInfo, \
371  GetCurrentArchitecture())
372 #endif
373 #endif
374 
383  ADBServiceRoutineUPP
384  NewADBServiceRoutineUPP(ADBServiceRoutineProcPtr userRoutine);
385 #if !OPAQUE_UPP_TYPES
386  enum
387  {
388  uppADBServiceRoutineProcInfo = 0x0F779802
389  }; /* register no_return_value Func(4_bytes:A0, 4_bytes:A1, 4_bytes:A2,
390  4_bytes:D0) */
391 #ifdef __cplusplus
392  inline ADBServiceRoutineUPP
393  NewADBServiceRoutineUPP(ADBServiceRoutineProcPtr userRoutine)
394  {
395  return (ADBServiceRoutineUPP)NewRoutineDescriptor(
396  (ProcPtr)(userRoutine), uppADBServiceRoutineProcInfo,
397  GetCurrentArchitecture());
398  }
399 #else
400 #define NewADBServiceRoutineUPP(userRoutine) \
401  (ADBServiceRoutineUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), \
402  uppADBServiceRoutineProcInfo, \
403  GetCurrentArchitecture())
404 #endif
405 #endif
406 
415  ADBInitUPP
416  NewADBInitUPP(ADBInitProcPtr userRoutine);
417 #if !OPAQUE_UPP_TYPES
418  enum
419  {
420  uppADBInitProcInfo = 0x00000802
421  }; /* register no_return_value Func(1_byte:D0) */
422 #ifdef __cplusplus
423  inline ADBInitUPP NewADBInitUPP(ADBInitProcPtr userRoutine)
424  {
425  return (ADBInitUPP)NewRoutineDescriptor(
426  (ProcPtr)(userRoutine), uppADBInitProcInfo, GetCurrentArchitecture());
427  }
428 #else
429 #define NewADBInitUPP(userRoutine) \
430  (ADBInitUPP) NewRoutineDescriptor( \
431  (ProcPtr)(userRoutine), uppADBInitProcInfo, GetCurrentArchitecture())
432 #endif
433 #endif
434 
443  void
444  DisposeADBCompletionUPP(ADBCompletionUPP userUPP);
445 #if !OPAQUE_UPP_TYPES
446 #ifdef __cplusplus
447  inline void DisposeADBCompletionUPP(ADBCompletionUPP userUPP)
448  {
449  DisposeRoutineDescriptor((UniversalProcPtr)userUPP);
450  }
451 #else
452 #define DisposeADBCompletionUPP(userUPP) DisposeRoutineDescriptor(userUPP)
453 #endif
454 #endif
455 
464  void
465  DisposeADBDeviceDriverUPP(ADBDeviceDriverUPP userUPP);
466 #if !OPAQUE_UPP_TYPES
467 #ifdef __cplusplus
468  inline void DisposeADBDeviceDriverUPP(ADBDeviceDriverUPP userUPP)
469  {
470  DisposeRoutineDescriptor((UniversalProcPtr)userUPP);
471  }
472 #else
473 #define DisposeADBDeviceDriverUPP(userUPP) DisposeRoutineDescriptor(userUPP)
474 #endif
475 #endif
476 
485  void
486  DisposeADBServiceRoutineUPP(ADBServiceRoutineUPP userUPP);
487 #if !OPAQUE_UPP_TYPES
488 #ifdef __cplusplus
489  inline void DisposeADBServiceRoutineUPP(ADBServiceRoutineUPP userUPP)
490  {
491  DisposeRoutineDescriptor((UniversalProcPtr)userUPP);
492  }
493 #else
494 #define DisposeADBServiceRoutineUPP(userUPP) DisposeRoutineDescriptor(userUPP)
495 #endif
496 #endif
497 
506  void
507  DisposeADBInitUPP(ADBInitUPP userUPP);
508 #if !OPAQUE_UPP_TYPES
509 #ifdef __cplusplus
510  inline void DisposeADBInitUPP(ADBInitUPP userUPP)
511  {
512  DisposeRoutineDescriptor((UniversalProcPtr)userUPP);
513  }
514 #else
515 #define DisposeADBInitUPP(userUPP) DisposeRoutineDescriptor(userUPP)
516 #endif
517 #endif
518 
527  void
528  InvokeADBCompletionUPP(Ptr buffer, Ptr refCon, long command,
529  ADBCompletionUPP userUPP);
530 #if !OPAQUE_UPP_TYPES && \
531  (!TARGET_OS_MAC || !TARGET_CPU_68K || TARGET_RT_MAC_CFM)
532 #ifdef __cplusplus
533  inline void InvokeADBCompletionUPP(Ptr buffer, Ptr refCon, long command,
534  ADBCompletionUPP userUPP)
535  {
536  CALL_THREE_PARAMETER_UPP(userUPP, uppADBCompletionProcInfo, buffer, refCon,
537  command);
538  }
539 #else
540 #define InvokeADBCompletionUPP(buffer, refCon, command, userUPP) \
541  CALL_THREE_PARAMETER_UPP((userUPP), uppADBCompletionProcInfo, (buffer), \
542  (refCon), (command))
543 #endif
544 #endif
545 
554 #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
555 #pragma parameter InvokeADBDeviceDriverUPP(__D0, __D1, __A0)
556 #endif
557  void
558  InvokeADBDeviceDriverUPP(SInt8 devAddress, SInt8 devType,
559  ADBDeviceDriverUPP userUPP);
560 #if !OPAQUE_UPP_TYPES && \
561  (!TARGET_OS_MAC || !TARGET_CPU_68K || TARGET_RT_MAC_CFM)
562 #ifdef __cplusplus
563  inline void InvokeADBDeviceDriverUPP(SInt8 devAddress, SInt8 devType,
564  ADBDeviceDriverUPP userUPP)
565  {
566  CALL_TWO_PARAMETER_UPP(userUPP, uppADBDeviceDriverProcInfo, devAddress,
567  devType);
568  }
569 #else
570 #define InvokeADBDeviceDriverUPP(devAddress, devType, userUPP) \
571  CALL_TWO_PARAMETER_UPP((userUPP), uppADBDeviceDriverProcInfo, (devAddress), \
572  (devType))
573 #endif
574 #endif
575 
584  void
585  InvokeADBServiceRoutineUPP(Ptr buffer, TempADBServiceRoutineUPP completionProc,
586  Ptr refCon, long command,
587  ADBServiceRoutineUPP userUPP);
588 #if !OPAQUE_UPP_TYPES && \
589  (!TARGET_OS_MAC || !TARGET_CPU_68K || TARGET_RT_MAC_CFM)
590 #ifdef __cplusplus
591  inline void InvokeADBServiceRoutineUPP(Ptr buffer,
592  TempADBServiceRoutineUPP completionProc,
593  Ptr refCon, long command,
594  ADBServiceRoutineUPP userUPP)
595  {
596  CALL_FOUR_PARAMETER_UPP(userUPP, uppADBServiceRoutineProcInfo, buffer,
597  completionProc, refCon, command);
598  }
599 #else
600 #define InvokeADBServiceRoutineUPP(buffer, completionProc, refCon, command, \
601  userUPP) \
602  CALL_FOUR_PARAMETER_UPP((userUPP), uppADBServiceRoutineProcInfo, (buffer), \
603  (completionProc), (refCon), (command))
604 #endif
605 #endif
606 
615 #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
616 #pragma parameter InvokeADBInitUPP(__D0, __A0)
617 #endif
618  void
619  InvokeADBInitUPP(SInt8 callOrder, ADBInitUPP userUPP);
620 #if !OPAQUE_UPP_TYPES && \
621  (!TARGET_OS_MAC || !TARGET_CPU_68K || TARGET_RT_MAC_CFM)
622 #ifdef __cplusplus
623  inline void InvokeADBInitUPP(SInt8 callOrder, ADBInitUPP userUPP)
624  {
625  CALL_ONE_PARAMETER_UPP(userUPP, uppADBInitProcInfo, callOrder);
626  }
627 #else
628 #define InvokeADBInitUPP(callOrder, userUPP) \
629  CALL_ONE_PARAMETER_UPP((userUPP), uppADBInitProcInfo, (callOrder))
630 #endif
631 #endif
632 
633 #endif /* CALL_NOT_IN_CARBON */
634 
635 #if CALL_NOT_IN_CARBON || OLDROUTINENAMES
636 /* support for pre-Carbon UPP routines: New...Proc and Call...Proc */
637 #define NewADBCompletionProc(userRoutine) NewADBCompletionUPP(userRoutine)
638 #define NewADBDeviceDriverProc(userRoutine) NewADBDeviceDriverUPP(userRoutine)
639 #define NewADBServiceRoutineProc(userRoutine) \
640  NewADBServiceRoutineUPP(userRoutine)
641 #define NewADBInitProc(userRoutine) NewADBInitUPP(userRoutine)
642 #define CallADBCompletionProc(userRoutine, buffer, refCon, command) \
643  InvokeADBCompletionUPP(buffer, refCon, command, userRoutine)
644 #define CallADBDeviceDriverProc(userRoutine, devAddress, devType) \
645  InvokeADBDeviceDriverUPP(devAddress, devType, userRoutine)
646 #define CallADBServiceRoutineProc(userRoutine, buffer, completionProc, refCon, \
647  command) \
648  InvokeADBServiceRoutineUPP(buffer, completionProc, refCon, command, \
649  userRoutine)
650 #define CallADBInitProc(userRoutine, callOrder) \
651  InvokeADBInitUPP(callOrder, userRoutine)
652 #endif /* CALL_NOT_IN_CARBON */
653 
654 #endif /* TARGET_OS_MAC */
655 
656 #if PRAGMA_STRUCT_ALIGN
657 #pragma options align = reset
658 #elif PRAGMA_STRUCT_PACKPUSH
659 #pragma pack(pop)
660 #elif PRAGMA_STRUCT_PACK
661 #pragma pack()
662 #endif
663 
664 #ifdef PRAGMA_IMPORT_OFF
665 #pragma import off
666 #elif PRAGMA_IMPORT
667 #pragma import reset
668 #endif
669 
670 #ifdef __cplusplus
671 }
672 #endif
673 
674 #endif /* __DESKBUS__ */
675 * /
676 #pragma pack()
677 #endif
678 
679 #ifdef PRAGMA_IMPORT_OFF
680 #pragma import off
681 #elif PRAGMA_IMPORT
682 #pragma import reset
683 #endif
684 
685 #ifdef __cplusplus
686 }
687 #endif
688 
689 #endif /* __DESKBUS__ */
690 * /*/*/ * /
Basic Macintosh data types.
Mixed Mode Manager Interfaces.
void DisposeRoutineDescriptor(UniversalProcPtr theUPP)
UniversalProcPtr NewRoutineDescriptor(ProcPtr theProc, ProcInfoType theProcInfo, ISAType theISA)
typedef CALLBACK_API_REGISTER68K(void, SIInterruptProcPtr,(SPBPtr inParamPtr, Ptr dataBuffer, short peakAmplitude, long sampleSize))
typedef REGISTER_UPP_TYPE(HighHookProcPtr) HighHookUPP