Windows NT 4.0 source code leak
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

218 lines
4.0 KiB

4 years ago
  1. /*++
  2. Copyright (c) 1993 Digital Equipment Corporation
  3. Module Name:
  4. jxprom.h
  5. Abstract:
  6. This module defines structures and datatypes for use in reading
  7. and writing ROMs/PROMs/Flash ROMs.
  8. This file, and rom.c, makes no attempt at universal ROM-support.
  9. Author:
  10. John DeRosa 4-May-1993
  11. Revision History:
  12. Jeff McLeman 13-May-1993
  13. Adapted for use in Hal
  14. --*/
  15. //
  16. // All ROM manipulations (reading, writing, etc.) are done through
  17. // an array. The array contains one entry per ROM type, and the values
  18. // in each entry dictate how to talk to the ROM.
  19. //
  20. // Supported ROMs are assumed to have the following characteristics:
  21. //
  22. // The ROM space in the machine is made up of all the same parts.
  23. // I.e., the space is homogeneous.
  24. //
  25. // Each chip has a byte path for data in and data out.
  26. //
  27. // Each chip has a way to identify itself.
  28. //
  29. // Each chip has a way to be reset.
  30. //
  31. // Each chip has a finite erase, write, set read-mode, and identify
  32. // sequence.
  33. //
  34. // The chip block size is less than or equal to 64KB.
  35. //
  36. //
  37. // Define the maximum length of certain commands.
  38. //
  39. #define MAXIMUM_ROM_ID_COMMAND_LENGTH 3
  40. #define MAXIMUM_ROM_ID_RESPONSE_LENGTH 2
  41. #define MAXIMUM_ROM_READ_COMMAND_LENGTH 3
  42. #define MAXIMUM_ROM_RESET_COMMAND_LENGTH 3
  43. //
  44. //
  45. //
  46. #define SIXTY_FOUR_KB 0x10000
  47. //
  48. // Define supported Rom types
  49. //
  50. typedef enum _ROM_TYPE {
  51. I28F008SA,
  52. Am29F010,
  53. InvalidROM
  54. } ROM_TYPE, *PROM_TYPE;
  55. //
  56. // Define function time for erase and byte-write entries.
  57. //
  58. typedef ARC_STATUS (*PROMSECTORERASE) (IN PUCHAR EraseAddress);
  59. typedef ARC_STATUS (*PROMBYTEWRITE) (IN PUCHAR WriteAddress,
  60. IN UCHAR WriteData);
  61. //
  62. // Define structure to store ROM address and byte pairs.
  63. //
  64. typedef struct _ABSOLUTE_ROM_COMMAND {
  65. PUCHAR Address;
  66. UCHAR Value;
  67. } ABSOLUTE_ROM_COMMAND, *PABSOLUTE_ROM_COMMAND;
  68. typedef struct _OFFSET_ROM_COMMAND {
  69. ULONG Offset;
  70. UCHAR Value;
  71. } OFFSET_ROM_COMMAND, *POFFSET_ROM_COMMAND;
  72. //
  73. // Define the entries in the ROM values table. These are organized for
  74. // memory efficiency.
  75. //
  76. typedef struct _ROM_VALUES {
  77. //
  78. // Microseconds to stall after most ROM commands.
  79. //
  80. UCHAR StallAmount;
  81. //
  82. // Length of the Identification command sequence.
  83. //
  84. UCHAR IdCommandLength;
  85. //
  86. // Length of the Identification response.
  87. //
  88. UCHAR IdResponseLength;
  89. //
  90. // Length of the Reset command.
  91. //
  92. UCHAR ResetCommandLength;
  93. //
  94. // Length of the Set read-mode command.
  95. //
  96. UCHAR ReadCommandLength;
  97. //
  98. // The ROM supported by this entry.
  99. //
  100. ROM_TYPE ROMType;
  101. //
  102. // Number of bytes per chip.
  103. //
  104. ULONG BytesPerChip;
  105. //
  106. // Number of bytes per block.
  107. //
  108. ULONG BytesPerBlock;
  109. //
  110. // Identification command sequence.
  111. //
  112. // Each step in the sequence is two bytes: address to be written,
  113. // and data to be written.
  114. //
  115. ABSOLUTE_ROM_COMMAND IdCommand[MAXIMUM_ROM_ID_COMMAND_LENGTH];
  116. //
  117. // Identification response sequence.
  118. //
  119. // Each step in the seqeuence is two bytes: address to be read, and
  120. // the byte that should be returned.
  121. //
  122. ABSOLUTE_ROM_COMMAND IdResponse[MAXIMUM_ROM_ID_RESPONSE_LENGTH];
  123. //
  124. // Reset command sequence.
  125. //
  126. // Each step in the sequence is two bytes: address to be written,
  127. // and data to be written.
  128. //
  129. OFFSET_ROM_COMMAND ResetCommand[MAXIMUM_ROM_RESET_COMMAND_LENGTH];
  130. //
  131. // Set read-mode command sequence.
  132. //
  133. // Each step in the sequence is two bytes: address to be written,
  134. // and data to be written.
  135. //
  136. OFFSET_ROM_COMMAND ReadCommand[MAXIMUM_ROM_READ_COMMAND_LENGTH];
  137. //
  138. // The function to be called to do a block erase.
  139. //
  140. PROMSECTORERASE SectorErase;
  141. //
  142. // The function to be called to do a byte write.
  143. //
  144. PROMBYTEWRITE ByteWrite;
  145. } ROM_VALUES, *PROM_VALUES;
  146. //
  147. // Define function protoypes
  148. //
  149. VOID
  150. HalpROMResetStatus(
  151. IN PUCHAR Address
  152. );
  153. VOID
  154. HalpROMSetReadMode(
  155. IN PUCHAR Address
  156. );