CardServices.h
上传用户:xjjlds
上传日期:2015-12-05
资源大小:22823k
文件大小:43k
源码类别:

多媒体编程

开发平台:

Visual C++

  1. /*
  2.      File:       CardServices.h
  3.  
  4.      Contains:   The client interface to Card and Socket Services.
  5.  
  6.      Version:    Technology: System 7.5
  7.                  Release:    QuickTime 6.0.2
  8.  
  9.      Copyright:  (c) 1994-2001 by Apple Computer, Inc. All rights reserved.
  10.  
  11.      Bugs?:      For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __CARDSERVICES__
  18. #define __CARDSERVICES__
  19. #ifndef __MACTYPES__
  20. #include "MacTypes.h"
  21. #endif
  22. #ifndef __PCCARDTUPLES__
  23. #include "PCCardTuples.h"
  24. #endif
  25. #ifndef __MIXEDMODE__
  26. #include "MixedMode.h"
  27. #endif
  28. #if PRAGMA_ONCE
  29. #pragma once
  30. #endif
  31. #ifdef __cplusplus
  32. extern "C" {
  33. #endif
  34. #if PRAGMA_IMPORT
  35. #pragma import on
  36. #endif
  37. #if PRAGMA_STRUCT_ALIGN
  38.     #pragma options align=mac68k
  39. #elif PRAGMA_STRUCT_PACKPUSH
  40.     #pragma pack(push, 2)
  41. #elif PRAGMA_STRUCT_PACK
  42.     #pragma pack(2)
  43. #endif
  44. /*  miscellaneous*/
  45. enum {
  46.     CS_MAX_SOCKETS              = 32                            /* a long is used as a socket bitmap*/
  47. };
  48. /* Will move to <Traps.h>*/
  49. enum {
  50.     _PCCardDispatch             = 0xAAF0                        /* Card Services entry trap*/
  51. };
  52. /* Will move to <Errors.h>*/
  53. /*  result codes*/
  54. enum {
  55.     kCSBadAdapterErr            = -9050,                        /* invalid adapter number*/
  56.     kCSBadAttributeErr          = -9051,                        /* specified attributes field value is invalid*/
  57.     kCSBadBaseErr               = -9052,                        /* specified base system memory address is invalid*/
  58.     kCSBadEDCErr                = -9053,                        /* specified EDC generator specified is invalid*/
  59.     kCSBadIRQErr                = -9054,                        /* specified IRQ level is invalid*/
  60.     kCSBadOffsetErr             = -9055,                        /* specified PC card memory array offset is invalid*/
  61.     kCSBadPageErr               = -9056,                        /* specified page is invalid*/
  62.     kCSBadSizeErr               = -9057,                        /* specified size is invalid*/
  63.     kCSBadSocketErr             = -9058,                        /* specified logical or physical socket number is invalid*/
  64.     kCSBadTypeErr               = -9059,                        /* specified window or interface type is invalid*/
  65.     kCSBadVccErr                = -9060,                        /* specified Vcc power level index is invalid*/
  66.     kCSBadVppErr                = -9061,                        /* specified Vpp1 or Vpp2 power level index is invalid*/
  67.     kCSBadWindowErr             = -9062,                        /* specified window is invalid*/
  68.     kCSBadArgLengthErr          = -9063,                        /* ArgLength argument is invalid*/
  69.     kCSBadArgsErr               = -9064,                        /* values in argument packet are invalid*/
  70.     kCSBadHandleErr             = -9065,                        /* clientHandle is invalid*/
  71.     kCSBadCISErr                = -9066,                        /* CIS on card is invalid*/
  72.     kCSBadSpeedErr              = -9067,                        /* specified speed is unavailable*/
  73.     kCSReadFailureErr           = -9068,                        /* unable to complete read request*/
  74.     kCSWriteFailureErr          = -9069,                        /* unable to complete write request*/
  75.     kCSGeneralFailureErr        = -9070,                        /* an undefined error has occurred*/
  76.     kCSNoCardErr                = -9071,                        /* no PC card in the socket*/
  77.     kCSUnsupportedFunctionErr   = -9072,                        /* function is not supported by this implementation*/
  78.     kCSUnsupportedModeErr       = -9073,                        /* mode is not supported*/
  79.     kCSBusyErr                  = -9074,                        /* unable to process request at this time - try later*/
  80.     kCSWriteProtectedErr        = -9075,                        /* media is write-protected*/
  81.     kCSConfigurationLockedErr   = -9076,                        /* a configuration has already been locked*/
  82.     kCSInUseErr                 = -9077,                        /* requested resource is being used by a client*/
  83.     kCSNoMoreItemsErr           = -9078,                        /* there are no more of the requested item*/
  84.     kCSOutOfResourceErr         = -9079                         /* Card Services has exhausted the resource*/
  85. };
  86. /*  messages sent to client's event handler*/
  87. enum {
  88.     kCSNullMessage              = 0x00,                         /* no messages pending (not sent to clients)*/
  89.     kCSCardInsertionMessage     = 0x01,                         /* card has been inserted into the socket*/
  90.     kCSCardRemovalMessage       = 0x02,                         /* card has been removed from the socket*/
  91.     kCSCardLockMessage          = 0x03,                         /* card is locked into the socket with a mechanical latch*/
  92.     kCSCardUnlockMessage        = 0x04,                         /* card is no longer locked into the socket*/
  93.     kCSCardReadyMessage         = 0x05,                         /* card is ready to be accessed*/
  94.     kCSCardResetMessage         = 0x06,                         /* physical reset has completed*/
  95.     kCSInsertionRequestMessage  = 0x07,                         /* request to insert a card using insertion motor*/
  96.     kCSInsertionCompleteMessage = 0x08,                         /* insertion motor has finished inserting a card*/
  97.     kCSEjectionRequestMessage   = 0x09,                         /* user or other client is requesting a card ejection*/
  98.     kCSEjectionFailedMessage    = 0x0A,                         /* eject failure due to electrical/mechanical problems*/
  99.     kCSPMResumeMessage          = 0x0B,                         /* power management resume (TBD)*/
  100.     kCSPMSuspendMessage         = 0x0C,                         /* power management suspend (TBD)*/
  101.     kCSResetPhysicalMessage     = 0x0D,                         /* physical reset is about to occur on this card*/
  102.     kCSResetRequestMessage      = 0x0E,                         /* physical reset has been requested by a client*/
  103.     kCSResetCompleteMessage     = 0x0F,                         /* ResetCard() background reset has completed*/
  104.     kCSBatteryDeadMessage       = 0x10,                         /* battery is no longer useable, data will be lost*/
  105.     kCSBatteryLowMessage        = 0x11,                         /* battery is weak and should be replaced*/
  106.     kCSWriteProtectMessage      = 0x12,                         /* card is now write protected*/
  107.     kCSWriteEnabledMessage      = 0x13,                         /* card is now write enabled*/
  108.     kCSClientInfoMessage        = 0x14,                         /* client is to return client information*/
  109.     kCSSSUpdatedMessage         = 0x15,                         /* AddSocketServices/ReplaceSocket services has changed SS support*/
  110.     kCSFunctionInterruptMessage = 0x16,                         /* card function interrupt*/
  111.     kCSAccessErrorMessage       = 0x17,                         /* client bus errored on access to socket*/
  112.     kCSCardUnconfiguredMessage  = 0x18,                         /* a CARD_READY was delivered to all clients and no client */
  113.                                                                 /*    requested a configuration for the socket*/
  114.     kCSStatusChangedMessage     = 0x19                          /* status change for cards in I/O mode*/
  115. };
  116. /*
  117.     The following is a mapping of the PCMCIA name space to the Macintosh name space.
  118.     These two enum lists will be removed and given to developers as a separate file.
  119. */
  120. enum {
  121.     SUCCESS                     = noErr,
  122.     BAD_ADAPTER                 = kCSBadAdapterErr,
  123.     BAD_ATTRIBUTE               = kCSBadAttributeErr,
  124.     BAD_BASE                    = kCSBadBaseErr,
  125.     BAD_EDC                     = kCSBadEDCErr,
  126.     BAD_IRQ                     = kCSBadIRQErr,
  127.     BAD_OFFSET                  = kCSBadOffsetErr,
  128.     BAD_PAGE                    = kCSBadPageErr,
  129.     BAD_SIZE                    = kCSBadSizeErr,
  130.     BAD_SOCKET                  = kCSBadSocketErr,
  131.     BAD_TYPE                    = kCSBadTypeErr,
  132.     BAD_VCC                     = kCSBadVccErr,
  133.     BAD_VPP                     = kCSBadVppErr,
  134.     BAD_WINDOW                  = kCSBadWindowErr,
  135.     BAD_ARG_LENGTH              = kCSBadArgLengthErr,
  136.     BAD_ARGS                    = kCSBadArgsErr,
  137.     BAD_HANDLE                  = kCSBadHandleErr,
  138.     BAD_CIS                     = kCSBadCISErr,
  139.     BAD_SPEED                   = kCSBadSpeedErr,
  140.     READ_FAILURE                = kCSReadFailureErr,
  141.     WRITE_FAILURE               = kCSWriteFailureErr,
  142.     GENERAL_FAILURE             = kCSGeneralFailureErr,
  143.     NO_CARD                     = kCSNoCardErr,
  144.     UNSUPPORTED_FUNCTION        = kCSUnsupportedFunctionErr,
  145.     UNSUPPORTED_MODE            = kCSUnsupportedModeErr,
  146.     BUSY                        = kCSBusyErr,
  147.     WRITE_PROTECTED             = kCSWriteProtectedErr,
  148.     CONFIGURATION_LOCKED        = kCSConfigurationLockedErr,
  149.     IN_USE                      = kCSInUseErr,
  150.     NO_MORE_ITEMS               = kCSNoMoreItemsErr,
  151.     OUT_OF_RESOURCE             = kCSOutOfResourceErr
  152. };
  153. /*  messages sent to client's event handler*/
  154. enum {
  155.     NULL_MESSAGE                = kCSNullMessage,
  156.     CARD_INSERTION              = kCSCardInsertionMessage,
  157.     CARD_REMOVAL                = kCSCardRemovalMessage,
  158.     CARD_LOCK                   = kCSCardLockMessage,
  159.     CARD_UNLOCK                 = kCSCardUnlockMessage,
  160.     CARD_READY                  = kCSCardReadyMessage,
  161.     CARD_RESET                  = kCSCardResetMessage,
  162.     INSERTION_REQUEST           = kCSInsertionRequestMessage,
  163.     INSERTION_COMPLETE          = kCSInsertionCompleteMessage,
  164.     EJECTION_REQUEST            = kCSEjectionRequestMessage,
  165.     EJECTION_FAILED             = kCSEjectionFailedMessage,
  166.     PM_RESUME                   = kCSPMResumeMessage,
  167.     PM_SUSPEND                  = kCSPMSuspendMessage,
  168.     RESET_PHYSICAL              = kCSResetPhysicalMessage,
  169.     RESET_REQUEST               = kCSResetRequestMessage,
  170.     RESET_COMPLETE              = kCSResetCompleteMessage,
  171.     BATTERY_DEAD                = kCSBatteryDeadMessage,
  172.     BATTERY_LOW                 = kCSBatteryLowMessage,
  173.     WRITE_PROTECT               = kCSWriteProtectMessage,
  174.     WRITE_ENABLED               = kCSWriteEnabledMessage,
  175.     CLIENT_INFO                 = kCSClientInfoMessage,
  176.     SS_UPDATED                  = kCSSSUpdatedMessage,
  177.     FUNCTION_INTERRUPT          = kCSFunctionInterruptMessage,
  178.     ACCESS_ERROR                = kCSAccessErrorMessage,
  179.     CARD_UNCONFIGURED           = kCSCardUnconfiguredMessage,
  180.     STATUS_CHANGED              = kCSStatusChangedMessage
  181. };
  182. /*----------------      CSAccessConfigurationRegister   ----------------*/
  183. struct AccessConfigurationRegisterPB {
  184.     UInt16                          socket;                     /*  -> global socket number*/
  185.     UInt8                           action;                     /*  -> read/write*/
  186.     UInt8                           offset;                     /*  -> offset from config register base*/
  187.     UInt8                           value;                      /* <-> value to read/write*/
  188.     UInt8                           padding[1];                 /* */
  189. };
  190. typedef struct AccessConfigurationRegisterPB AccessConfigurationRegisterPB;
  191. /*  'action' field values*/
  192. enum {
  193.     kCSReadConfigRegister       = 0x00,
  194.     kCSWriteConfigRegister      = 0x01
  195. };
  196. /*----------------      CSGetCardServicesInfo           ----------------*/
  197. struct GetCardServicesInfoPB {
  198.     UInt8                           signature[2];               /* <-  two ascii chars 'CS'*/
  199.     UInt16                          count;                      /* <-  total number of sockets installed*/
  200.     UInt16                          revision;                   /* <-  BCD*/
  201.     UInt16                          csLevel;                    /* <-  BCD*/
  202.     UInt16                          reserved;                   /*  -> zero*/
  203.     UInt16                          vStrLen;                    /* <-> in: client's buffer size, out: vendor string length*/
  204.     UInt8 *                         vendorString;               /* <-> in: pointer to buffer to hold CS vendor string (zero-terminated)*/
  205.                                                                 /*    out: CS vendor string copied to buffer*/
  206. };
  207. typedef struct GetCardServicesInfoPB    GetCardServicesInfoPB;
  208. /*----------------      CSGetClientInfo                 ----------------*/
  209. /* upper byte of attributes is kCSClientInfoSubfunction*/
  210. struct ClientInfoParam {
  211.     UInt32                          clientHandle;               /*  -> clientHandle returned by RegisterClient*/
  212.     UInt16                          attributes;                 /* <-> subfunction + bitmapped client attributes*/
  213.     UInt16                          revision;                   /* <-  BCD value of client's revision*/
  214.     UInt16                          csLevel;                    /* <-  BCD value of CS release*/
  215.     UInt16                          revDate;                    /* <-  revision date: y[15-9], m[8-5], d[4-0]*/
  216.     SInt16                          nameLen;                    /* <-> in: max length of client name string, out: actual length*/
  217.     SInt16                          vStringLen;                 /* <-> in: max length of vendor string, out: actual length*/
  218.     UInt8 *                         nameString;                 /* <-  pointer to client name string (zero-terminated)*/
  219.     UInt8 *                         vendorString;               /* <-  pointer to vendor string (zero-terminated)*/
  220. };
  221. typedef struct ClientInfoParam          ClientInfoParam;
  222. /*
  223.    upper byte of attributes is kCSCardNameSubfunction,
  224.                                kCSCardTypeSubfunction,
  225.                                kCSHelpStringSubfunction
  226. */
  227. struct AlternateTextStringParam {
  228.     UInt32                          clientHandle;               /*  -> clientHandle returned by RegisterClient*/
  229.     UInt16                          attributes;                 /* <-> subfunction + bitmapped client attributes*/
  230.     UInt16                          socket;                     /*  -> logical socket number*/
  231.     UInt16                          reserved;                   /*  -> zero*/
  232.     SInt16                          length;                     /* <-> in: max length of string, out: actual length*/
  233.     UInt8 *                         text;                       /* <-  pointer to string (zero-terminated)*/
  234. };
  235. typedef struct AlternateTextStringParam AlternateTextStringParam;
  236. /* upper byte of attributes is kCSCardIconSubfunction*/
  237. struct AlternateCardIconParam {
  238.     UInt32                          clientHandle;               /*  -> clientHandle returned by RegisterClient*/
  239.     UInt16                          attributes;                 /* <-> subfunction + bitmapped client attributes*/
  240.     UInt16                          socket;                     /*  -> logical socket number*/
  241.     Handle                          iconSuite;                  /* <-  handle to icon suite containing all icons*/
  242. };
  243. typedef struct AlternateCardIconParam   AlternateCardIconParam;
  244. /* upper byte of attributes is kCSActionProcSubfunction*/
  245. struct CustomActionProcParam {
  246.     UInt32                          clientHandle;               /*  -> clientHandle returned by RegisterClient*/
  247.     UInt16                          attributes;                 /* <-> subfunction + bitmapped client attributes*/
  248.     UInt16                          socket;                     /*  -> logical socket number*/
  249. };
  250. typedef struct CustomActionProcParam    CustomActionProcParam;
  251. struct GetClientInfoPB {
  252.     union {
  253.         ClientInfoParam                 clientInfo;
  254.         AlternateTextStringParam        alternateTextString;
  255.         AlternateCardIconParam          alternateIcon;
  256.         CustomActionProcParam           customActionProc;
  257.     }                                 u;
  258. };
  259. typedef struct GetClientInfoPB          GetClientInfoPB;
  260. /*  'attributes' field values*/
  261. enum {
  262.     kCSMemoryClient             = 0x0001,
  263.     kCSIOClient                 = 0x0004,
  264.     kCSClientTypeMask           = 0x0007,
  265.     kCSShareableCardInsertEvents = 0x0008,
  266.     kCSExclusiveCardInsertEvents = 0x0010,
  267.     kCSInfoSubfunctionMask      = 0xFF00,
  268.     kCSClientInfoSubfunction    = 0x0000,
  269.     kCSCardNameSubfunction      = 0x8000,
  270.     kCSCardTypeSubfunction      = 0x8100,
  271.     kCSHelpStringSubfunction    = 0x8200,
  272.     kCSCardIconSubfunction      = 0x8300,
  273.     kCSActionProcSubfunction    = 0x8400
  274. };
  275. /*
  276.   ----------------      CSGetConfigurationInfo          ----------------
  277.   ----------------      CSModifyConfiguration           ----------------
  278.   ----------------      CSRequestConfiguration          ----------------
  279. */
  280. struct GetModRequestConfigInfoPB {
  281.     UInt32                          clientHandle;               /*  -> clientHandle returned by RegisterClient*/
  282.     UInt16                          socket;                     /*  -> logical socket number*/
  283.     UInt16                          attributes;                 /* <-> bitmap of configuration attributes*/
  284.     UInt8                           vcc;                        /* <-> Vcc setting*/
  285.     UInt8                           vpp1;                       /* <-> Vpp1 setting*/
  286.     UInt8                           vpp2;                       /* <-> Vpp2 setting*/
  287.     UInt8                           intType;                    /* <-> interface type (memory or memory+I/O)*/
  288.     UInt32                          configBase;                 /* <-> card base address of configuration registers*/
  289.     UInt8                           status;                     /* <-> card status register setting, if present*/
  290.     UInt8                           pin;                        /* <-> card pin register setting, if present*/
  291.     UInt8                           copy;                       /* <-> card socket/copy register setting, if present*/
  292.     UInt8                           configIndex;                /* <-> card option register setting, if present*/
  293.     UInt8                           present;                    /* <-> bitmap of which configuration registers are present*/
  294.     UInt8                           firstDevType;               /* <-  from DeviceID tuple*/
  295.     UInt8                           funcCode;                   /* <-  from FuncID tuple*/
  296.     UInt8                           sysInitMask;                /* <-  from FuncID tuple*/
  297.     UInt16                          manufCode;                  /* <-  from ManufacturerID tuple*/
  298.     UInt16                          manufInfo;                  /* <-  from ManufacturerID tuple*/
  299.     UInt8                           cardValues;                 /* <-  valid card register values*/
  300.     UInt8                           padding[1];                 /* */
  301. };
  302. typedef struct GetModRequestConfigInfoPB GetModRequestConfigInfoPB;
  303. /*  'attributes' field values*/
  304. enum {
  305.     kCSExclusivelyUsed          = 0x0001,
  306.     kCSEnableIREQs              = 0x0002,
  307.     kCSVccChangeValid           = 0x0004,
  308.     kCSVpp1ChangeValid          = 0x0008,
  309.     kCSVpp2ChangeValid          = 0x0010,
  310.     kCSValidClient              = 0x0020,
  311.     kCSSleepPower               = 0x0040,                       /* request that power be applied to socket during Sleep*/
  312.     kCSLockSocket               = 0x0080,
  313.     kCSTurnOnInUse              = 0x0100
  314. };
  315. /*  'intType' field values*/
  316. enum {
  317.     kCSMemoryInterface          = 0x01,
  318.     kCSMemory_And_IO_Interface  = 0x02
  319. };
  320. /*  'present' field values*/
  321. enum {
  322.     kCSOptionRegisterPresent    = 0x01,
  323.     kCSStatusRegisterPresent    = 0x02,
  324.     kCSPinReplacementRegisterPresent = 0x04,
  325.     kCSCopyRegisterPresent      = 0x08
  326. };
  327. /*  'cardValues' field values*/
  328. enum {
  329.     kCSOptionValueValid         = 0x01,
  330.     kCSStatusValueValid         = 0x02,
  331.     kCSPinReplacementValueValid = 0x04,
  332.     kCSCopyValueValid           = 0x08
  333. };
  334. /*
  335.   ----------------      CSGetClientEventMask            ----------------
  336.   ----------------      CSSetClientEventMask            ----------------
  337. */
  338. struct GetSetClientEventMaskPB {
  339.     UInt32                          clientHandle;               /*  -> clientHandle returned by RegisterClient*/
  340.     UInt16                          attributes;                 /* <-> bitmap of attributes*/
  341.     UInt16                          eventMask;                  /* <-> bitmap of events to be passed to client for this socket*/
  342.     UInt16                          socket;                     /*  -> logical socket number*/
  343. };
  344. typedef struct GetSetClientEventMaskPB  GetSetClientEventMaskPB;
  345. /*  'attributes' field values*/
  346. enum {
  347.     kCSEventMaskThisSocketOnly  = 0x0001
  348. };
  349. /*  'eventMask' field values*/
  350. enum {
  351.     kCSWriteProtectEvent        = 0x0001,
  352.     kCSCardLockChangeEvent      = 0x0002,
  353.     kCSEjectRequestEvent        = 0x0004,
  354.     kCSInsertRequestEvent       = 0x0008,
  355.     kCSBatteryDeadEvent         = 0x0010,
  356.     kCSBatteryLowEvent          = 0x0020,
  357.     kCSReadyChangeEvent         = 0x0040,
  358.     kCSCardDetectChangeEvent    = 0x0080,
  359.     kCSPMChangeEvent            = 0x0100,
  360.     kCSResetEvent               = 0x0200,
  361.     kCSSSUpdateEvent            = 0x0400,
  362.     kCSFunctionInterrupt        = 0x0800,
  363.     kCSAllEvents                = 0xFFFF
  364. };
  365. /*
  366.   ----------------      CSGetFirstClient                ----------------
  367.   ----------------      CSGetNextClient                 ----------------
  368. */
  369. struct GetClientPB {
  370.     UInt32                          clientHandle;               /* <-  clientHandle for this client*/
  371.     UInt16                          socket;                     /*  -> logical socket number*/
  372.     UInt16                          attributes;                 /*  -> bitmap of attributes*/
  373. };
  374. typedef struct GetClientPB              GetClientPB;
  375. /*  'attributes' field values*/
  376. enum {
  377.     kCSClientsForAllSockets     = 0x0000,
  378.     kCSClientsThisSocketOnly    = 0x0001
  379. };
  380. /*
  381.   ----------------      CSGetFirstTuple                 ----------------
  382.   ----------------      CSGetNextTuple                  ----------------
  383.   ----------------      CSGetTupleData                  ----------------
  384. */
  385. struct GetTuplePB {
  386.     UInt16                          socket;                     /*  -> logical socket number*/
  387.     UInt16                          attributes;                 /*  -> bitmap of attributes*/
  388.     UInt8                           desiredTuple;               /*  -> desired tuple code value, or $FF for all*/
  389.     UInt8                           tupleOffset;                /*  -> offset into tuple from link byte*/
  390.     UInt16                          flags;                      /* <-> internal use*/
  391.     UInt32                          linkOffset;                 /* <-> internal use*/
  392.     UInt32                          cisOffset;                  /* <-> internal use*/
  393.     union {
  394.         struct {
  395.             UInt8                           tupleCode;          /* <-  tuple code found*/
  396.             UInt8                           tupleLink;          /* <-  link value for tuple found*/
  397.         }                                 TuplePB;
  398.         struct {
  399.             UInt16                          tupleDataMax;       /*  -> maximum size of tuple data area*/
  400.             UInt16                          tupleDataLen;       /* <-  number of bytes in tuple body*/
  401.             TupleBody                       tupleData;          /* <-  tuple data*/
  402.         }                                 TupleDataPB;
  403.     }                                 u;
  404. };
  405. typedef struct GetTuplePB               GetTuplePB;
  406. /*  'attributes' field values*/
  407. enum {
  408.     kCSReturnLinkTuples         = 0x0001
  409. };
  410. /*
  411.   ----------------      CSRequestSocketMask             ----------------
  412.   ----------------      CSReleaseSocketMask             ----------------
  413. */
  414. struct ReqRelSocketMaskPB {
  415.     UInt32                          clientHandle;               /*  -> clientHandle returned by RegisterClient*/
  416.     UInt16                          socket;                     /*  -> logical socket*/
  417.     UInt16                          eventMask;                  /*  -> bitmap of events to be passed to client for this socket*/
  418. };
  419. typedef struct ReqRelSocketMaskPB       ReqRelSocketMaskPB;
  420. /*  'eventMask' field values (see above for Get/SetClientEventMask*/
  421. /*----------------      CSGetStatus                     ----------------*/
  422. struct GetStatusPB {
  423.     UInt16                          socket;                     /*  -> logical socket number*/
  424.     UInt16                          cardState;                  /* <-  current state of installed card*/
  425.     UInt16                          socketState;                /* <-  current state of the socket*/
  426. };
  427. typedef struct GetStatusPB              GetStatusPB;
  428. /*  'cardState' field values*/
  429. enum {
  430.     kCSWriteProtected           = 0x0001,
  431.     kCSCardLocked               = 0x0002,
  432.     kCSEjectRequest             = 0x0004,
  433.     kCSInsertRequest            = 0x0008,
  434.     kCSBatteryDead              = 0x0010,
  435.     kCSBatteryLow               = 0x0020,
  436.     kCSReady                    = 0x0040,
  437.     kCSCardDetected             = 0x0080
  438. };
  439. /*  'socketState' field values*/
  440. enum {
  441.     kCSWriteProtectChanged      = 0x0001,
  442.     kCSCardLockChanged          = 0x0002,
  443.     kCSEjectRequestPending      = 0x0004,
  444.     kCSInsertRequestPending     = 0x0008,
  445.     kCSBatteryDeadChanged       = 0x0010,
  446.     kCSBatteryLowChanged        = 0x0020,
  447.     kCSReadyChanged             = 0x0040,
  448.     kCSCardDetectChanged        = 0x0080
  449. };
  450. /*
  451.   ----------------      CSModifyWindow                  ----------------
  452.   ----------------      CSReleaseWindow                 ----------------
  453.   ----------------      CSRequestWindow                 ----------------
  454. */
  455. struct ReqModRelWindowPB {
  456.     UInt32                          clientHandle;               /*  -> clientHandle returned by RegisterClient*/
  457.     UInt32                          windowHandle;               /* <-> window descriptor*/
  458.     UInt16                          socket;                     /*  -> logical socket number*/
  459.     UInt16                          attributes;                 /*  -> window attributes (bitmap)*/
  460.     UInt32                          base;                       /* <-> system base address*/
  461.     UInt32                          size;                       /* <-> memory window size*/
  462.     UInt8                           accessSpeed;                /*  -> window access speed (bitmap)*/
  463.                                                                 /*       (not applicable for I/O mode)*/
  464.     UInt8                           padding[1];                 /* */
  465. };
  466. typedef struct ReqModRelWindowPB        ReqModRelWindowPB;
  467. /*  'attributes' field values*/
  468. enum {
  469.     kCSMemoryWindow             = 0x0001,
  470.     kCSIOWindow                 = 0x0002,
  471.     kCSAttributeWindow          = 0x0004,                       /* not normally used by Card Services clients*/
  472.     kCSWindowTypeMask           = 0x0007,
  473.     kCSEnableWindow             = 0x0008,
  474.     kCSAccessSpeedValid         = 0x0010,
  475.     kCSLittleEndian             = 0x0020,                       /* configure socket for little endianess*/
  476.     kCS16BitDataPath            = 0x0040,
  477.     kCSWindowPaged              = 0x0080,                       /* */
  478.     kCSWindowShared             = 0x0100,
  479.     kCSWindowFirstShared        = 0x0200,                       /* */
  480.     kCSWindowProgrammable       = 0x0400                        /* */
  481. };
  482. /*  'accessSpeed' field values*/
  483. enum {
  484.     kCSDeviceSpeedCodeMask      = 0x07,
  485.     kCSSpeedExponentMask        = 0x07,
  486.     kCSSpeedMantissaMask        = 0x78,
  487.     kCSUseWait                  = 0x80,
  488.     kCSAccessSpeed250nsec       = 0x01,
  489.     kCSAccessSpeed200nsec       = 0x02,
  490.     kCSAccessSpeed150nsec       = 0x03,
  491.     kCSAccessSpeed100nsec       = 0x04,
  492.     kCSExtAccSpeedMant1pt0      = 0x01,
  493.     kCSExtAccSpeedMant1pt2      = 0x02,
  494.     kCSExtAccSpeedMant1pt3      = 0x03,
  495.     kCSExtAccSpeedMant1pt5      = 0x04,
  496.     kCSExtAccSpeedMant2pt0      = 0x05,
  497.     kCSExtAccSpeedMant2pt5      = 0x06,
  498.     kCSExtAccSpeedMant3pt0      = 0x07,
  499.     kCSExtAccSpeedMant3pt5      = 0x08,
  500.     kCSExtAccSpeedMant4pt0      = 0x09,
  501.     kCSExtAccSpeedMant4pt5      = 0x0A,
  502.     kCSExtAccSpeedMant5pt0      = 0x0B,
  503.     kCSExtAccSpeedMant5pt5      = 0x0C,
  504.     kCSExtAccSpeedMant6pt0      = 0x0D,
  505.     kCSExtAccSpeedMant7pt0      = 0x0E,
  506.     kCSExtAccSpeedMant8pt0      = 0x0F,
  507.     kCSExtAccSpeedExp1ns        = 0x00,
  508.     kCSExtAccSpeedExp10ns       = 0x01,
  509.     kCSExtAccSpeedExp100ns      = 0x02,
  510.     kCSExtAccSpeedExp1us        = 0x03,
  511.     kCSExtAccSpeedExp10us       = 0x04,
  512.     kCSExtAccSpeedExp100us      = 0x05,
  513.     kCSExtAccSpeedExp1ms        = 0x06,
  514.     kCSExtAccSpeedExp10ms       = 0x07
  515. };
  516. /*
  517.   ----------------      CSRegisterClient                ----------------
  518.   ----------------      CSDeregisterClient              ----------------
  519. */
  520. struct ClientCallbackPB {
  521.     UInt16                          message;                    /*  -> which event this is*/
  522.     UInt16                          socket;                     /*  -> logical socket number*/
  523.     UInt16                          info;                       /*  -> function-specific*/
  524.     UInt16                          misc;                       /*  -> function-specific*/
  525.     Ptr                             reserved;                   /*  -> pointer to MTD request block*/
  526.     Ptr                             buffer;                     /*  -> function-specific*/
  527.     Ptr                             clientData;                 /*  -> pointer to client's data (from RegisterClient)*/
  528. };
  529. typedef struct ClientCallbackPB         ClientCallbackPB;
  530. typedef ClientCallbackPB *              ClientCallbackPBPtr;
  531. typedef CALLBACK_API( UInt16 , PCCardCSClientProcPtr )(ClientCallbackPBPtr ccPBPtr);
  532. typedef STACK_UPP_TYPE(PCCardCSClientProcPtr)                   PCCardCSClientUPP;
  533. #if OPAQUE_UPP_TYPES
  534. #if CALL_NOT_IN_CARBON
  535.     EXTERN_API(PCCardCSClientUPP)
  536.     NewPCCardCSClientUPP           (PCCardCSClientProcPtr   userRoutine);
  537.     EXTERN_API(void)
  538.     DisposePCCardCSClientUPP       (PCCardCSClientUPP       userUPP);
  539.     EXTERN_API(UInt16)
  540.     InvokePCCardCSClientUPP        (ClientCallbackPBPtr     ccPBPtr,
  541.                                     PCCardCSClientUPP       userUPP);
  542. #endif  /* CALL_NOT_IN_CARBON */
  543. #else
  544.     enum { uppPCCardCSClientProcInfo = 0x000000E0 };                /* pascal 2_bytes Func(4_bytes) */
  545.     #define NewPCCardCSClientUPP(userRoutine)                       (PCCardCSClientUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppPCCardCSClientProcInfo, GetCurrentArchitecture())
  546.     #define DisposePCCardCSClientUPP(userUPP)                       DisposeRoutineDescriptor(userUPP)
  547.     #define InvokePCCardCSClientUPP(ccPBPtr, userUPP)               (UInt16)CALL_ONE_PARAMETER_UPP((userUPP), uppPCCardCSClientProcInfo, (ccPBPtr))
  548. #endif
  549. /* support for pre-Carbon UPP routines: NewXXXProc and CallXXXProc */
  550. #define NewPCCardCSClientProc(userRoutine)                      NewPCCardCSClientUPP(userRoutine)
  551. #define CallPCCardCSClientProc(userRoutine, ccPBPtr)            InvokePCCardCSClientUPP(ccPBPtr, userRoutine)
  552. struct RegisterClientPB {
  553.     UInt32                          clientHandle;               /* <-  client descriptor*/
  554.     PCCardCSClientUPP               clientEntry;                /*  -> universal procPtr to client's event handler*/
  555.     UInt16                          attributes;                 /*  -> bitmap of client attributes*/
  556.     UInt16                          eventMask;                  /*  -> bitmap of events to notify client*/
  557.     Ptr                             clientData;                 /*  -> pointer to client's data*/
  558.     UInt16                          version;                    /*  -> Card Services version this client expects*/
  559. };
  560. typedef struct RegisterClientPB         RegisterClientPB;
  561. /*  'attributes' field values (see GetClientInfo)*/
  562. /*
  563.     kCSMemoryClient                 = 0x0001,
  564.     kCSIOClient                     = 0x0004,
  565.     kCSShareableCardInsertEvents    = 0x0008,
  566.     kCSExclusiveCardInsertEvents    = 0x0010
  567. */
  568. /*----------------      CSReleaseConfiguration          ----------------*/
  569. struct ReleaseConfigurationPB {
  570.     UInt32                          clientHandle;               /*  -> clientHandle returned by RegisterClient*/
  571.     UInt16                          socket;                     /*  -> */
  572. };
  573. typedef struct ReleaseConfigurationPB   ReleaseConfigurationPB;
  574. /*----------------      CSResetCard                     ----------------*/
  575. struct ResetCardPB {
  576.     UInt32                          clientHandle;               /*  -> clientHandle returned by RegisterClient*/
  577.     UInt16                          socket;                     /*  -> */
  578.     UInt16                          attributes;                 /*  -> xxx*/
  579. };
  580. typedef struct ResetCardPB              ResetCardPB;
  581. /*----------------      CSValidateCIS                   ----------------*/
  582. struct ValidateCISPB {
  583.     UInt16                          socket;                     /*  -> */
  584.     UInt16                          chains;                     /*  -> whether link/null tuples should be included*/
  585. };
  586. typedef struct ValidateCISPB            ValidateCISPB;
  587. /*
  588.   ----------------      CSRequestIO                     ----------------
  589.   ----------------      CSReleaseIO                     ----------------
  590. */
  591. struct ReqRelIOPB {
  592.     UInt32                          clientHandle;               /*  -> clientHandle returned by RegisterClient*/
  593.     UInt16                          socket;                     /*  -> socket number*/
  594.     UInt16                          reserved;
  595.     UInt16                          basePort1;                  /*    -> base I/O port for range*/
  596.     UInt8                           numPorts1;                  /*    -> number of ports (e.g., bytes).*/
  597.     UInt8                           attributes1;                /*    -> attributes*/
  598.     UInt16                          basePort2;                  /*    -> base I/O port for range*/
  599.     UInt8                           numPorts2;                  /*    -> number of ports*/
  600.     UInt8                           attributes2;                /*    -> attributes*/
  601.     UInt8                           ioAddrLines;                /*    -> number of I/O lines decoded by card*/
  602.     UInt8                           reserved1;
  603. };
  604. typedef struct ReqRelIOPB               ReqRelIOPB;
  605. /*----------------      CSVendorSpecific                ----------------*/
  606. struct VendorSpecificPB {
  607.     UInt32                          clientHandle;               /*  -> clientHandle returned by RegisterClient*/
  608.     UInt16                          vsCode;
  609.     UInt16                          socket;
  610.     UInt32                          dataLen;                    /*  -> length of buffer pointed to by vsDataPtr*/
  611.     UInt8 *                         vsDataPtr;                  /*  -> Card Services version this client expects*/
  612. };
  613. typedef struct VendorSpecificPB         VendorSpecificPB;
  614. /*  'vsCode' field values*/
  615. enum {
  616.     vsAppleReserved             = 0x0000,
  617.     vsEjectCard                 = 0x0001,
  618.     vsGetCardInfo               = 0x0002,
  619.     vsEnableSocketEvents        = 0x0003,
  620.     vsGetCardLocationIcon       = 0x0004,
  621.     vsGetCardLocationText       = 0x0005,
  622.     vsGetAdapterInfo            = 0x0006
  623. };
  624. /*
  625.   ///////////////////////////////////////////////////////////////////////////////////////
  626.     GetAdapterInfo parameter block (vendor-specific call #6)
  627. */
  628. struct GetAdapterInfoPB {
  629.     UInt32                          attributes;                 /* <-  capabilties of socket's adapter*/
  630.     UInt16                          revision;                   /* <-  id of adapter*/
  631.     UInt16                          reserved;                   /* */
  632.     UInt16                          numVoltEntries;             /* <-  number of valid voltage values*/
  633.     UInt8 *                         voltages;                   /* <-> array of BCD voltage values*/
  634. };
  635. typedef struct GetAdapterInfoPB         GetAdapterInfoPB;
  636. /*  'attributes' field values*/
  637. enum {
  638.     kCSLevelModeInterrupts      = 0x00000001,
  639.     kCSPulseModeInterrupts      = 0x00000002,
  640.     kCSProgrammableWindowAddr   = 0x00000004,
  641.     kCSProgrammableWindowSize   = 0x00000008,
  642.     kCSSocketSleepPower         = 0x00000010,
  643.     kCSSoftwareEject            = 0x00000020,
  644.     kCSLockableSocket           = 0x00000040,
  645.     kCSInUseIndicator           = 0x00000080
  646. };
  647. /*
  648.   ///////////////////////////////////////////////////////////////////////////////////////
  649.     GetCardInfo parameter block (vendor-specific call #2)
  650. */
  651. struct GetCardInfoPB {
  652.     UInt8                           cardType;                   /* <-  type of card in this socket (defined at top of file)*/
  653.     UInt8                           subType;                    /* <-  more detailed card type (defined at top of file)*/
  654.     UInt16                          reserved;                   /* <-> reserved (should be set to zero)*/
  655.     UInt16                          cardNameLen;                /*  -> maximum length of card name to be returned*/
  656.     UInt16                          vendorNameLen;              /*  -> maximum length of vendor name to be returned*/
  657.     UInt8 *                         cardName;                   /*  -> pointer to card name string (read from CIS), or nil*/
  658.     UInt8 *                         vendorName;                 /*  -> pointer to vendor name string (read from CIS), or nil*/
  659. };
  660. typedef struct GetCardInfoPB            GetCardInfoPB;
  661. /*  GetCardInfo card types*/
  662. enum {
  663.     kCSUnknownCardType          = 0,
  664.     kCSMultiFunctionCardType    = 1,
  665.     kCSMemoryCardType           = 2,
  666.     kCSSerialPortCardType       = 3,
  667.     kCSSerialOnlyType           = 0,
  668.     kCSDataModemType            = 1,
  669.     kCSFaxModemType             = 2,
  670.     kCSFaxAndDataModemMask      = (kCSDataModemType | kCSFaxModemType),
  671.     kCSVoiceEncodingType        = 4,
  672.     kCSParallelPortCardType     = 4,
  673.     kCSFixedDiskCardType        = 5,
  674.     kCSUnknownFixedDiskType     = 0,
  675.     kCSATAInterface             = 1,
  676.     kCSRotatingDevice           = (0 << 7),
  677.     kCSSiliconDevice            = (1 << 7),
  678.     kCSVideoAdaptorCardType     = 6,
  679.     kCSNetworkAdaptorCardType   = 7,
  680.     kCSAIMSCardType             = 8,
  681.     kCSNumCardTypes             = 9
  682. };
  683. #ifndef __PCCARDENABLERPLUGIN__
  684. /*
  685.     NOTE: These prototypes conflict with PCCardEnablerPlugin.*
  686.           You cannot use both PCCardEnablerPlugin.h and CardServices.h
  687.           
  688. */
  689. #if CALL_NOT_IN_CARBON
  690. EXTERN_API( OSErr )
  691. CSVendorSpecific                (VendorSpecificPB *     pb)                                 TWOWORDINLINE(0x7000, 0xAAF0);
  692. EXTERN_API( OSErr )
  693. CSRegisterClient                (RegisterClientPB *     pb)                                 TWOWORDINLINE(0x7001, 0xAAF0);
  694. EXTERN_API( OSErr )
  695. CSDeregisterClient              (RegisterClientPB *     pb)                                 TWOWORDINLINE(0x7002, 0xAAF0);
  696. EXTERN_API( OSErr )
  697. CSGetFirstTuple                 (GetTuplePB *           pb)                                 TWOWORDINLINE(0x7003, 0xAAF0);
  698. EXTERN_API( OSErr )
  699. CSGetNextTuple                  (GetTuplePB *           pb)                                 TWOWORDINLINE(0x7004, 0xAAF0);
  700. EXTERN_API( OSErr )
  701. CSGetTupleData                  (GetTuplePB *           pb)                                 TWOWORDINLINE(0x7005, 0xAAF0);
  702. EXTERN_API( OSErr )
  703. CSGetConfigurationInfo          (GetModRequestConfigInfoPB * pb)                            TWOWORDINLINE(0x7006, 0xAAF0);
  704. EXTERN_API( OSErr )
  705. CSGetCardServicesInfo           (GetCardServicesInfoPB * pb)                                TWOWORDINLINE(0x7007, 0xAAF0);
  706. EXTERN_API( OSErr )
  707. CSGetStatus                     (GetStatusPB *          pb)                                 TWOWORDINLINE(0x7008, 0xAAF0);
  708. EXTERN_API( OSErr )
  709. CSValidateCIS                   (ValidateCISPB *        pb)                                 TWOWORDINLINE(0x7009, 0xAAF0);
  710. EXTERN_API( OSErr )
  711. CSGetFirstClient                (GetClientPB *          pb)                                 TWOWORDINLINE(0x700F, 0xAAF0);
  712. EXTERN_API( OSErr )
  713. CSGetNextClient                 (GetClientPB *          pb)                                 TWOWORDINLINE(0x7010, 0xAAF0);
  714. EXTERN_API( OSErr )
  715. CSGetClientInfo                 (GetClientInfoPB *      pb)                                 TWOWORDINLINE(0x7011, 0xAAF0);
  716. EXTERN_API( OSErr )
  717. CSResetCard                     (ResetCardPB *          pb)                                 TWOWORDINLINE(0x7012, 0xAAF0);
  718. EXTERN_API( OSErr )
  719. CSRequestWindow                 (ReqModRelWindowPB *    pb)                                 TWOWORDINLINE(0x7013, 0xAAF0);
  720. EXTERN_API( OSErr )
  721. CSModifyWindow                  (ReqModRelWindowPB *    pb)                                 TWOWORDINLINE(0x7014, 0xAAF0);
  722. EXTERN_API( OSErr )
  723. CSReleaseWindow                 (ReqModRelWindowPB *    pb)                                 TWOWORDINLINE(0x7015, 0xAAF0);
  724. EXTERN_API( OSErr )
  725. CSRequestConfiguration          (GetModRequestConfigInfoPB * pb)                            TWOWORDINLINE(0x701B, 0xAAF0);
  726. EXTERN_API( OSErr )
  727. CSModifyConfiguration           (GetModRequestConfigInfoPB * pb)                            TWOWORDINLINE(0x701C, 0xAAF0);
  728. EXTERN_API( OSErr )
  729. CSAccessConfigurationRegister   (AccessConfigurationRegisterPB * pb)                        TWOWORDINLINE(0x701D, 0xAAF0);
  730. EXTERN_API( OSErr )
  731. CSReleaseConfiguration          (ReleaseConfigurationPB * pb)                               TWOWORDINLINE(0x701E, 0xAAF0);
  732. EXTERN_API( OSErr )
  733. CSGetClientEventMask            (GetSetClientEventMaskPB * pb)                              TWOWORDINLINE(0x701F, 0xAAF0);
  734. EXTERN_API( OSErr )
  735. CSSetClientEventMask            (GetSetClientEventMaskPB * pb)                              TWOWORDINLINE(0x7020, 0xAAF0);
  736. EXTERN_API( OSErr )
  737. CSRequestSocketMask             (ReqRelSocketMaskPB *   pb)                                 TWOWORDINLINE(0x7021, 0xAAF0);
  738. EXTERN_API( OSErr )
  739. CSReleaseSocketMask             (ReqRelSocketMaskPB *   pb)                                 TWOWORDINLINE(0x7022, 0xAAF0);
  740. /*
  741.     Additional calls which are required for all I/O clients when running on
  742.     systems which do not reserve dedicated I/O-spaces for each PC Card.
  743. */
  744. EXTERN_API( OSErr )
  745. CSRequestIO                     (ReqRelIOPB *           pb)                                 TWOWORDINLINE(0x7025, 0xAAF0);
  746. EXTERN_API( OSErr )
  747. CSReleaseIO                     (ReqRelIOPB *           pb)                                 TWOWORDINLINE(0x7026, 0xAAF0);
  748. #endif  /* CALL_NOT_IN_CARBON */
  749. #endif  /* !defined(__PCCARDENABLERPLUGIN__) */
  750. #if PRAGMA_STRUCT_ALIGN
  751.     #pragma options align=reset
  752. #elif PRAGMA_STRUCT_PACKPUSH
  753.     #pragma pack(pop)
  754. #elif PRAGMA_STRUCT_PACK
  755.     #pragma pack()
  756. #endif
  757. #ifdef PRAGMA_IMPORT_OFF
  758. #pragma import off
  759. #elif PRAGMA_IMPORT
  760. #pragma import reset
  761. #endif
  762. #ifdef __cplusplus
  763. }
  764. #endif
  765. #endif /* __CARDSERVICES__ */