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

多媒体编程

开发平台:

Visual C++

  1. /*
  2.      File:       PCCardTuples.h
  3.  
  4.      Contains:   List of PCMCIA tuple types and definitions of tuple contents.
  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 __PCCARDTUPLES__
  18. #define __PCCARDTUPLES__
  19. #ifndef __MACTYPES__
  20. #include "MacTypes.h"
  21. #endif
  22. #if PRAGMA_ONCE
  23. #pragma once
  24. #endif
  25. #ifdef __cplusplus
  26. extern "C" {
  27. #endif
  28. #if PRAGMA_IMPORT
  29. #pragma import on
  30. #endif
  31. #if PRAGMA_STRUCT_ALIGN
  32.     #pragma options align=mac68k
  33. #elif PRAGMA_STRUCT_PACKPUSH
  34.     #pragma pack(push, 2)
  35. #elif PRAGMA_STRUCT_PACK
  36.     #pragma pack(2)
  37. #endif
  38. enum {
  39.     MAX_TUPLE_SIZE              = 256
  40. };
  41. /*------------------------------------------------------------------------
  42.     Defines for Tuple codes
  43. ------------------------------------------------------------------------*/
  44. enum {
  45.     CISTPL_NULL                 = 0x00,
  46.     CISTPL_DEVICE               = 0x01,
  47.     CISTPL_LONGLINK_CB          = 0x02,
  48.     CISTPL_INDIRECT             = 0x03,
  49.     CISTPL_CONFIG_CB            = 0x04,
  50.     CISTPL_CFTABLE_ENTRY_CB     = 0x05,
  51.     CISTPL_LONGLINK_MFC         = 0x06,
  52.     CISTPL_BAR                  = 0x07,
  53.     CISTPL_CHECKSUM             = 0x10,
  54.     CISTPL_LONGLINK_A           = 0x11,
  55.     CISTPL_LONGLINK_C           = 0x12,
  56.     CISTPL_LINKTARGET           = 0x13,
  57.     CISTPL_NO_LINK              = 0x14,
  58.     CISTPL_VERS_1               = 0x15,
  59.     CISTPL_ALTSTR               = 0x16,
  60.     CISTPL_DEVICE_A             = 0x17,
  61.     CISTPL_JEDEC_C              = 0x18,
  62.     CISTPL_JEDEC_A              = 0x19,
  63.     CISTPL_CONFIG               = 0x1A,
  64.     CISTPL_CFTABLE_ENTRY        = 0x1B,
  65.     CISTPL_DEVICE_OC            = 0x1C,
  66.     CISTPL_DEVICE_OA            = 0x1D,
  67.     CISTPL_DEVICE_GEO           = 0x1E,
  68.     CISTPL_DEVICE_GEO_A         = 0x1F,
  69.     CISTPL_MANFID               = 0x20,
  70.     CISTPL_FUNCID               = 0x21,
  71.     CISTPL_FUNCE                = 0x22,
  72.     CISTPL_SWIL                 = 0x23,
  73.     CISTPL_VERS_2               = 0x40,
  74.     CISTPL_FORMAT               = 0x41,
  75.     CISTPL_GEOMETRY             = 0x42,
  76.     CISTPL_BYTEORDER            = 0x43,
  77.     CISTPL_DATE                 = 0x44,
  78.     CISTPL_BATTERY              = 0x45,
  79.     CISTPL_ORG                  = 0x46,
  80.     CISTPL_VENDOR               = 0xFE,
  81.     CISTPL_END                  = 0xFF
  82. };
  83. /*------------------------------------------------------------------------
  84.     Tuple Data Block Definitions
  85. ------------------------------------------------------------------------*/
  86. /*------------    Device Information Tuple (01H, 17H)    -----------                            */
  87. struct DeviceIDTuple {
  88.     Byte                            TPLDEV_TYPE_WPS_SPEED;      /* Device Type Code: 7-4, WPS: 3,  Device Speed: 2-0*/
  89.     Byte                            deviceData[253];
  90. };
  91. typedef struct DeviceIDTuple            DeviceIDTuple;
  92. enum {
  93.     TPLDEV_TYPE_MASK            = 0xF0,                         /* device type mask for TPLDEV_TYPE_WPS_SPEED*/
  94.     TPLDEV_TYPE_EXTENDED        = 0xE0,                         /* device type value for extended type*/
  95.     TPLDEV_WPS_MASK             = 0x08,                         /* write-protect switch mask for TPLDEV_TYPE_WPS_SPEED*/
  96.     TPLDEV_SPEED_MASK           = 0x07,                         /* device speed mask for TPLDEV_TYPE_WPS_SPEED*/
  97.     TPLDEV_DSPEED_NULL          = 0x00,                         /* speed for null device type*/
  98.     TPLDEV_DSPEED_250NS         = 0x01,                         /* 250ns card access time*/
  99.     TPLDEV_DSPEED_200NS         = 0x02,                         /* 200ns card access time*/
  100.     TPLDEV_DSPEED_150NS         = 0x03,                         /* 150ns card access time*/
  101.     TPLDEV_DSPEED_100NS         = 0x04,                         /* 100ns card access time*/
  102.     TPLDEV_EXTENDED_SPEED       = 0x07,                         /* device speed value for extended speed*/
  103.     TPLDEV_SPEED_EXPONENT       = 0x07,                         /* extended byte exponent mask*/
  104.     TPLDEV_SPEED_MANTISSA       = 0x78,                         /* extended byte mantissa mask*/
  105.     TPLDEV_SPEED_EXTENDED_MASK  = 0x80                          /* bit set if more extended speed data follows*/
  106. };
  107. /*  device ID types*/
  108. enum {
  109.     DTYPE_NULL                  = 0,
  110.     DTYPE_ROM                   = 1,
  111.     DTYPE_OTPROM                = 2,
  112.     DTYPE_EPROM                 = 3,
  113.     DTYPE_EEPROM                = 4,
  114.     DTYPE_FLASH                 = 5,
  115.     DTYPE_SRAM                  = 6,
  116.     DTYPE_DRAM                  = 7,
  117.     DTYPE_FUNCSPEC              = 0x0D,
  118.     DTYPE_EXTEND                = 0x0E
  119. };
  120. /*---------------    Checksum Control Tuple (10H)    ---------------                            */
  121. struct ChecksumControlTuple {
  122.     short                           TPLCKS_ADDR;                /* offset to region to be checksummed, LSB first*/
  123.     short                           TPLCKS_LEN;                 /* length of region to be checksummed, LSB first*/
  124.     char                            TPLCKS_CS;                  /* checksum of the region*/
  125.     Byte                            reserved;                   /* padding*/
  126. };
  127. typedef struct ChecksumControlTuple     ChecksumControlTuple;
  128. /*----------------    Long Link Multi-Function Tuple (06H)    ------                    */
  129. struct LongLinkMFCTuple {
  130.     UInt8                           TPLMFC_NUM;                 /* Number of sets of config registers for individual functions*/
  131.     UInt8                           TPLMFC_TAS1;                /* CIS target address space for first function (00 = Attr, 01 = Common)*/
  132.     UInt32                          TPLMFC_ADDR1;               /* Target address of first CIS, unsigned long, lsb first*/
  133.     UInt8                           TPLMFC_TAS2;                /* CIS target address space for second function (00 = Attr, 01 = Common)*/
  134.     UInt8                           TPLMFC_ADDR2[4];            /* [MISALIGNED!] Target address of second CIS, unsigned long, lsb first*/
  135.                                                                 /* the following fields are of undetermined length and should be calculated at runtime*/
  136.                                                                 /* */
  137.                                                                 /* UInt8   TPLMFC_TASn;*/
  138.                                                                 /* UInt32     TPLMFC_ADDRn;*/
  139. };
  140. typedef struct LongLinkMFCTuple         LongLinkMFCTuple;
  141. /*----------------    Long Link Tuple (11H, 12H)    ----------------                            */
  142. struct LongLinkTuple {
  143.     UInt32                          TPLL_ADDR;                  /* target address, LSB first*/
  144. };
  145. typedef struct LongLinkTuple            LongLinkTuple;
  146. /*-----------------    Link Target Tuple (13H)    ------------------                            */
  147. struct LinkTargetTuple {
  148.     Byte                            TPLL_TAG[3];                /* tag: should be 'C', 'I', 'S'*/
  149. };
  150. typedef struct LinkTargetTuple          LinkTargetTuple;
  151. /*----------------    Level 1 Version Tuple (15H)    ---------------                            */
  152. struct Level1VersionTuple {
  153.     Byte                            TPLLV1_MAJOR;               /* major version number (0x04)*/
  154.     Byte                            TPLLV1_MINOR;               /* minor version number (0x01 for release 2.0 and 2.01)*/
  155.     Byte                            TPLLV1_INFO[1];             /* product information string, zero-terminated*/
  156. };
  157. typedef struct Level1VersionTuple       Level1VersionTuple;
  158. /*-------------    JEDEC Identifier Tuple (18H, 19H)    ------------                            */
  159. struct JEDECDeviceInfo {
  160.     Byte                            manufacturerID;
  161.     Byte                            manufacturerInfo;
  162. };
  163. typedef struct JEDECDeviceInfo          JEDECDeviceInfo;
  164. struct JEDECIdentifierTuple {
  165.     JEDECDeviceInfo                 device[1];
  166. };
  167. typedef struct JEDECIdentifierTuple     JEDECIdentifierTuple;
  168. /*---------    Configuration Tuple (1AH)    ----------                          */
  169. struct ConfigTuple {
  170.     Byte                            TPCC_SZ;                    /* size of fields byte*/
  171.     Byte                            TPCC_LAST;                  /* index number of last config entry*/
  172.     Byte                            TPCC_RADR;                  /* config reg's base addr in reg. space*/
  173.     Byte                            reserved;                   /* padding*/
  174.                                                                 /* the following fields are of undetermined length and should be calculated at runtime*/
  175.                                                                 /*UInt32       TPCC_RMSK;*/
  176.                                                                 /*UInt32       TPCC_RSVD;*/
  177.                                                                 /*UInt32       TPCC_SBTPL;*/
  178. };
  179. typedef struct ConfigTuple              ConfigTuple;
  180. /*  TPCC_RADR field definitions*/
  181. enum {
  182.     TPCC_RASZ                   = 0x03,                         /* bits 1-0*/
  183.     TPCC_RMSZ                   = 0x3C,                         /* bits 5-2*/
  184.     TPCC_RFSZ                   = 0xC0                          /* bits 7-6*/
  185. };
  186. /*---------    Device Geometry Tuple (1EH, 1FH)    ----------*/
  187. struct DeviceGeometry {
  188.     UInt8                           DGTPL_BUS;                  /* system bus width = 2^(n-1), n>0*/
  189.     UInt8                           DGTPL_EBS;                  /* erase block size = 2^(n-1), n>0*/
  190.     UInt8                           DGTPL_RBS;                  /* read block size = 2^(n-1), n>0*/
  191.     UInt8                           DGTPL_WBS;                  /* write block size = 2^(n-1), n>0*/
  192.     UInt8                           DGTPL_PART;                 /* partitioning size = 2^(n-1), n>0*/
  193.     UInt8                           DGTPL_HWIL;                 /* hardware interleave = 2^(n-1), n>0*/
  194. };
  195. typedef struct DeviceGeometry           DeviceGeometry;
  196. struct DeviceGeometryTuple {
  197.     DeviceGeometry                  device[42];
  198. };
  199. typedef struct DeviceGeometryTuple      DeviceGeometryTuple;
  200. /*---------    Manufacturer Identification Tuple (20H)    ----------                            */
  201. struct ManufIDTuple {
  202.     short                           TPLMID_MANF;                /* PCMCIA PC Card manufacturer code*/
  203.     short                           TPLMID_CARD;                /* manufacturer information (part number and/or revision)*/
  204. };
  205. typedef struct ManufIDTuple             ManufIDTuple;
  206. /*-----------    Function Identification Tuple (21H)    ------------                            */
  207. struct FunctionIDTuple {
  208.     Byte                            TPLFID_FUNCTION;            /* PC card function code*/
  209.     Byte                            TPLFID_SYSINIT;             /* system initialization bit mask*/
  210. };
  211. typedef struct FunctionIDTuple          FunctionIDTuple;
  212. /*  function codes*/
  213. enum {
  214.     TPLFID_MultiFunction        = 0,
  215.     TPLFID_Memory               = 1,
  216.     TPLFID_SerialPort           = 2,
  217.     TPLFID_ParallelPort         = 3,
  218.     TPLFID_FixedDisk            = 4,
  219.     TPLFID_VideoAdapter         = 5,
  220.     TPLFID_NetworkLANAdapter    = 6,
  221.     TPLFID_AIMS                 = 7,
  222.     TPLFID_SCSI                 = 8,
  223.     TPLFID_Security             = 9
  224. };
  225. /*------------    Software Interleave Tuple (23H)    ---------------                            */
  226. struct SoftwareInterleaveTuple {
  227.     char                            TPLSWIL_INTRLV;             /* software interleave*/
  228. };
  229. typedef struct SoftwareInterleaveTuple  SoftwareInterleaveTuple;
  230. /*-------    Level 2 Version and Information Tuple (40H)    --------                            */
  231. struct Level2VersionTuple {
  232.     Byte                            TPLLV2_VERS;                /* structure version (0x00)*/
  233.     Byte                            TPLLV2_COMPLY;              /* level of compliance with the standard (0x00)*/
  234.     UInt16                          TPLLV2_DINDEX;              /* byte address of first data byte in card, LSB first*/
  235.     Byte                            TPLLV2_RSV6;                /* reserved, must be zero*/
  236.     Byte                            TPLLV2_RSV7;                /* reserved, must be zero*/
  237.     Byte                            TPLLV2_VSPEC8;              /* vendor specific byte*/
  238.     Byte                            TPLLV2_VSPEC9;              /* vendor specific byte*/
  239.     char                            TPLLV2_NHDR;                /* number of copies of CIS present on this device*/
  240.     char                            TPLLV2_OEM[1];              /* vendor of software that formatted card, zero-terminated*/
  241.     char                            TPLLV2_INFO[1];             /* informational message about the card, zero-terminated*/
  242.     Byte                            reserved;                   /* padding*/
  243. };
  244. typedef struct Level2VersionTuple       Level2VersionTuple;
  245. /*--------------------    Format Tuple (41H)    --------------------                            */
  246. /* additional information for disk type:*/
  247. struct FormatDiskTuple {
  248.     UInt16                          TPLFMT_BKSZ;                /*    block size, or zero if unblocked format*/
  249.     UInt32                          TPLFMT_NBLOCKS;             /*    number of data blocks in this partition*/
  250.     UInt32                          TPLFMT_EDCLOC;              /*    location of error detection code, or zero if interleaved*/
  251. };
  252. typedef struct FormatDiskTuple          FormatDiskTuple;
  253. /* additional information for disk type:*/
  254. struct FormatMemTuple {
  255.     Byte                            TPLFMT_FLAGS;               /*    various flags*/
  256.     Byte                            TPLFMT_RESERVED;            /*    reserved, set to zero*/
  257.     UInt32                          TPLFMT_ADDRESS;             /*    physical location at which this memory partion must be mapped*/
  258.     UInt32                          TPLFMT_EDCLOC;              /*    location of error detection code, or zero if interleaved*/
  259. };
  260. typedef struct FormatMemTuple           FormatMemTuple;
  261. struct FormatTuple {
  262.     char                            TPLFMT_TYPE;                /* format type code*/
  263.     char                            TPLFMT_EDC;                 /* error detection method and length of error detection code*/
  264.     long                            TPLFMT_OFFSET;              /* offset to first data byte in this partition*/
  265.     long                            TPLFMT_NBYTES;              /* number of data bytes in this partition*/
  266.     union {
  267.         FormatDiskTuple                 TPLFMT_DISK;
  268.         FormatMemTuple                  TPLFMT_MEM;
  269.     }                                 u;
  270. };
  271. typedef struct FormatTuple              FormatTuple;
  272. /*  format types*/
  273. enum {
  274.     TPLFMTTYPE_DISK             = 0,
  275.     TPLFMTTYPE_MEM              = 1,
  276.     TPLFMTTYPE_VS               = 0x80
  277. };
  278. /*  error detection types*/
  279. enum {
  280.     TPLFMTEDC_NONE              = 0,
  281.     TPLFMTEDC_CKSUM             = 1,
  282.     TPLFMTEDC_CRC               = 2,
  283.     TPLFMTEDC_PCC               = 3,
  284.     TPLFMTEDC_VS                = 8
  285. };
  286. /*  bits in TPLFMT_FLAGS*/
  287. enum {
  288.     TPLFMTFLAGS_ADDR            = 0,
  289.     TPLFMTFLAGS_AUTO            = 1
  290. };
  291. /*------------------    Geometry Tuple (42H)    --------------------                            */
  292. struct GeometryTuple {
  293.     char                            TPLGEO_SPT;                 /* number of sectors per track*/
  294.     char                            TPLGEO_TPC;                 /* number of tracks per cylinder*/
  295.     short                           TPLGEO_NCYL;                /* number of cylinders, total*/
  296. };
  297. typedef struct GeometryTuple            GeometryTuple;
  298. /*-----------------    Byte-Order Tuple (43H)    -------------------                            */
  299. struct ByteOrderTuple {
  300.     char                            TPLBYTE_ORDER;              /* byte order code*/
  301.     char                            TPLBYTE_MAP;                /* byte mapping code*/
  302. };
  303. typedef struct ByteOrderTuple           ByteOrderTuple;
  304. /*  byte order codes*/
  305. enum {
  306.     TYPBYTEORD_LOW              = 0,
  307.     TYPBYTEORD_HIGH             = 1,
  308.     TYPBYTEORD_VS               = 0x80
  309. };
  310. /*  byte mapping codes*/
  311. enum {
  312.     TYPBYTEMAP_LOW              = 0,
  313.     TYPBYTEMAP_HIGH             = 1,
  314.     TYPBYTEMAP_VS               = 0x80
  315. };
  316. /*----------    Card Initialization Date Tuple (44H)    ------------                            */
  317. struct CardInitDateTuple {
  318.     UInt16                          TPLDATE_TIME;               /* hours, minutes, seconds*/
  319.     UInt16                          TPLDATE_DAY;                /* year, month, day*/
  320. };
  321. typedef struct CardInitDateTuple        CardInitDateTuple;
  322. /*----------    Battery-Replacement Date Tuple (45H)    ------------                            */
  323. struct BatteryReplaceDateTuple {
  324.     UInt16                          TPLBATT_RDAY;               /* last replacement date (year, month, day)*/
  325.     UInt16                          TPLBATT_XDAY;               /* battery expiration date (year, month, day)*/
  326. };
  327. typedef struct BatteryReplaceDateTuple  BatteryReplaceDateTuple;
  328. /*----------------------    General Tuple    -----------------------                            */
  329. union TupleBody {
  330.     DeviceIDTuple                   deviceID;
  331.     ChecksumControlTuple            checksum;
  332.     LongLinkTuple                   link;
  333.     LinkTargetTuple                 target;
  334.     Level1VersionTuple              level1;
  335.     JEDECIdentifierTuple            jedecID;
  336.     ConfigTuple                     config;
  337.     DeviceGeometryTuple             devGeo;
  338.     ManufIDTuple                    manufID;
  339.     FunctionIDTuple                 funcID;
  340.     SoftwareInterleaveTuple         swil;
  341.     Level2VersionTuple              level2;
  342.     FormatTuple                     format;
  343.     GeometryTuple                   geometry;
  344.     ByteOrderTuple                  order;
  345.     CardInitDateTuple               initDate;
  346.     BatteryReplaceDateTuple         battDate;
  347.     Byte                            tupleData[254];
  348. };
  349. typedef union TupleBody                 TupleBody;
  350. struct Tuple {
  351.     Byte                            TPL_CODE;
  352.     Byte                            TPL_LINK;
  353.     TupleBody                       TPL_BODY;
  354. };
  355. typedef struct Tuple                    Tuple;
  356. #if PRAGMA_STRUCT_ALIGN
  357.     #pragma options align=reset
  358. #elif PRAGMA_STRUCT_PACKPUSH
  359.     #pragma pack(pop)
  360. #elif PRAGMA_STRUCT_PACK
  361.     #pragma pack()
  362. #endif
  363. #ifdef PRAGMA_IMPORT_OFF
  364. #pragma import off
  365. #elif PRAGMA_IMPORT
  366. #pragma import reset
  367. #endif
  368. #ifdef __cplusplus
  369. }
  370. #endif
  371. #endif /* __PCCARDTUPLES__ */