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