home *** CD-ROM | disk | FTP | other *** search
/ Amiga MA Magazine 1998 #6 / amigamamagazinepolishissue1998.iso / disks / ratunku / rdbmount / hardblocks.h < prev    next >
C/C++ Source or Header  |  1998-10-05  |  6KB  |  155 lines

  1. /* $Revision Header *** Header built automatically - do not edit! ***********
  2.  *
  3.  *    (C) Copyright 1992 by Torsten Jürgeleit
  4.  *
  5.  *    Name .....: hardblocks.h
  6.  *    Created ..: Wednesday 19-Feb-92 09:25:36
  7.  *    Revision .: 2
  8.  *
  9.  *    Date        Author                 Comment
  10.  *    =========   ====================   ====================
  11.  *    10-Apr-92   Torsten Jürgeleit      Add structure for standard
  12.  *                                         hardblock header
  13.  *    17-Mar-92   Torsten Jürgeleit      New error codes HBERR_NO_DEVICE
  14.  *                                         and HBERR_NO_HOST_ID
  15.  *    19-Feb-92   Torsten Jürgeleit      Created this file!
  16.  *
  17.  ****************************************************************************
  18.  *
  19.  *    Defines, structures, prototypes and pragmas for hardblocks functions
  20.  *
  21.  * $Revision Header ********************************************************/
  22.  
  23. #ifndef LIBRARIES_HARDBLOCKS_H
  24. #define LIBRARIES_HARDBLOCKS_H
  25.  
  26.     /* Includes */
  27.  
  28. #ifndef    EXEC_TYPES_H
  29. #include <exec/types.h>
  30. #endif    /* EXEC_TYPES_H */
  31.  
  32. #ifndef    DEVICES_HARDBLOCKS_H
  33. #include <devices/hardblocks.h>
  34. #endif    /* DEVICES_HARDBLOCKS_H */
  35.  
  36. #ifndef    DEVICES_SCSIDISK_H
  37. #include <devices/scsidisk.h>
  38. #endif    /* DEVICES_SCSIDISK_H */
  39.  
  40. #ifndef    LIBRARIES_DOSEXTENS_H
  41. #include <libraries/dosextens.h>
  42. #endif    /* LIBRARIES_DOSEXTENS_H */
  43.  
  44.     /* Defines for hardblocks */
  45.  
  46. #define HardBlocksName        "hardblocks.library"
  47. #define HardBlocksVersion    1L
  48.  
  49. #define HB_NULL            0xffffffff
  50.  
  51.     /* Standard hardblock header structure (common to most hardblocks) */
  52.  
  53. struct HardBlockHeader {
  54.     ULONG    hbh_ID;            /* 4 character identifier */
  55.     ULONG    hbh_SummedLongs;    /* size of block in longwords */
  56.     ULONG    hbh_ChkSum;        /* block checksum (longword sum to zero) */
  57.     ULONG    hbh_HostID;        /* SCSI Target ID of host */
  58.     ULONG    hbh_Next;        /* block number of next block */
  59. };
  60.     /* Custom hardblock structure used for BadBlock and LoadSeg lists */
  61.  
  62. struct DataBlock {
  63.     ULONG    db_ID;            /* 4 character identifier */
  64.     ULONG    db_BlockLongs;        /* size of block in longwords */
  65.     ULONG    db_ChkSum;        /* block checksum (longword sum to zero) */
  66.     ULONG    db_HostID;        /* SCSI Target ID of host */
  67.     ULONG    db_Data[1];        /* first longword of data */
  68. };
  69.     /* Error codes */
  70.  
  71. #define HBERR_INVALID_PARAMETERS    1
  72. #define HBERR_OUT_OF_MEM        2
  73. #define HBERR_NO_DEVICE            3    /* selected device don't exist */
  74. #define HBERR_NO_BOARD            4    /* selected board from unit num don't exist */
  75. #define HBERR_NO_HOST_ID        5    /* can't find target id of controller for rdb_HostID */
  76. #define HBERR_DEVICE_OPEN_FAILED    6    /* selected device unit don't exist or isn't ready */
  77. #define HBERR_DEVICE_READ_FAILED    7
  78. #define HBERR_DEVICE_WRITE_FAILED    8
  79. #define HBERR_NO_HD_SCSI_CMD        9
  80. #define HBERR_SELF_UNIT            10    /* cannot issue SCSI command to self */
  81. #define HBERR_DMA            11    /* DMA error */
  82. #define HBERR_PHASE            12    /* illegal or unexpected SCSI phase */
  83. #define HBERR_PARITY            13    /* SCSI parity error */
  84. #define HBERR_SELECT_TIMEOUT        14    /* Select timed out */
  85. #define HBERR_BAD_STATUS        15    /* status and/or sense error */
  86. #define HBERR_INQUIRY_FAILED        16
  87. #define HBERR_MODE_SENSE_FAILED        17
  88. #define HBERR_SCSI_CMD_FAILED        18
  89. #define HBERR_UNIT_NOT_READY        19
  90. #define HBERR_NO_DIRECT_ACCESS        20
  91. #define HBERR_INVALID_BLOCK_SIZE    21    /* wrong rdb_BlockBytes */
  92. #define HBERR_INVALID_HARDBLOCKS_AREA    22    /* incorrect rdb_RDBBlocksLo/Hi */
  93. #define HBERR_HARDBLOCKS_AREA_TOO_SMALL    23    /* reserved area (rdb_RDBBlocksLo/Hi) too small for hardblocks */
  94. #define HBERR_INVALID_BLOCK_NUM        24    /* block num greater than num of last logical block of device unit */
  95. #define HBERR_INVALID_BLOCK_PTR        25    /* odd aligned ptr to block in memory */
  96. #define HBERR_UNKNOWN_ID        26    /* block with unsupported id */
  97. #define HBERR_INVALID_ID        27
  98. #define HBERR_INVALID_SUMMED_LONGS    28
  99. #define HBERR_INVALID_CHECKSUM        29
  100. #define HBERR_NO_RIGIDDISK        30
  101. #define HBERR_INVALID_RIGIDDISK        31
  102. #define HBERR_INVALID_BADBLOCK        32
  103. #define HBERR_INVALID_PARTITION        33
  104. #define HBERR_INVALID_FILESYSHEADER    34
  105. #define HBERR_MISSING_FILESYSTEM    35
  106. #define HBERR_INVALID_FILESYSTEM    36
  107. #define HBERR_INVALID_DRIVEINIT        37
  108. #define HBERR_INVALID_LOADSEG        38
  109. #define HBERR_BREAK_ABORT        39    /* function was terminated by <ctrl c> */
  110. #define HBERR_FILE_OPEN_FAILED        40
  111. #define HBERR_FILE_SEEK_FAILED        41
  112. #define HBERR_FILE_READ_FAILED        42
  113. #define HBERR_FILE_WRITE_FAILED        43
  114.  
  115.     /* Prototypes */
  116.  
  117. USHORT LoadHardBlocks(struct RigidDiskBlock  *rdb, BYTE *device, ULONG unit);
  118. USHORT SaveHardBlocks(struct RigidDiskBlock  *rdb, BYTE *device, ULONG unit);
  119. USHORT RestoreHardBlocks(struct RigidDiskBlock  *rdb, BYTE *file);
  120. USHORT BackupHardBlocks(struct RigidDiskBlock  *rdb, BYTE *file);
  121. USHORT PrintHardBlocks(struct RigidDiskBlock  *rdb, BPTR fh);
  122. USHORT FreeHardBlocks(struct RigidDiskBlock  *rdb);
  123. USHORT RemoveHardBlocks(BYTE *device, ULONG unit);
  124. USHORT InitRigidDiskBlock(struct RigidDiskBlock  *rdb, BYTE *device,
  125.                                 ULONG unit);
  126. USHORT LastHardBlockNum(struct RigidDiskBlock  *rdb);
  127.  
  128.     /* Pragmas for Manx and Lattice */
  129.  
  130. #ifndef    __NO_PRAGMAS
  131. #ifdef    AZTEC_C
  132. #pragma amicall(HardBlocksBase, 0x1e, LoadHardBlocks(a0,a1,d0))
  133. #pragma amicall(HardBlocksBase, 0x24, SaveHardBlocks(a0,a1,d0))
  134. #pragma amicall(HardBlocksBase, 0x2a, RestoreHardBlocks(a0,a1))
  135. #pragma amicall(HardBlocksBase, 0x30, BackupHardBlocks(a0,a1))
  136. #pragma amicall(HardBlocksBase, 0x36, PrintHardBlocks(a0,a1))
  137. #pragma amicall(HardBlocksBase, 0x3c, FreeHardBlocks(a0))
  138. #pragma amicall(HardBlocksBase, 0x42, RemoveHardBlocks(a0,d0))
  139. #pragma amicall(HardBlocksBase, 0x48, InitRigidDiskBlock(a0,a1,d0))
  140. #pragma amicall(HardBlocksBase, 0x4e, LastHardBlockNum(a0))
  141. #else    /* AZTEC_C */
  142. #pragma libcall HardBlocksBase LoadHardBlocks 1e 9803
  143. #pragma libcall HardBlocksBase SaveHardBlocks 24 9803
  144. #pragma libcall HardBlocksBase RestoreHardBlocks 2a 9802
  145. #pragma libcall HardBlocksBase BackupHardBlocks 30 9802
  146. #pragma libcall HardBlocksBase PrintHardBlocks 36 9802
  147. #pragma libcall HardBlocksBase FreeHardBlocks 3c 801
  148. #pragma libcall HardBlocksBase RemoveHardBlocks 42 802
  149. #pragma libcall HardBlocksBase InitRigidDiskBlock 48 9803
  150. #pragma libcall HardBlocksBase LastHardBlockNum 4e 801
  151. #endif    /* AZTEC_C */
  152. #endif    /* __NO_PRAGMAS */
  153.  
  154. #endif    /* LIBRARIES_HARDBLOCKS_H */
  155.