summaryrefslogtreecommitdiffstats
path: root/private/ntos/fw/alpha/rom.h
blob: 3b79dea8b4c668dbeddd7626868fa1aabf909f9e (plain) (blame)
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
/*++

Copyright (c) 1993 Digital Equipment Corporation

Module Name:

    rom.h

Abstract:

    This module defines structures and datatypes for use in reading
    and writing ROMs/PROMs/Flash ROMs.

    Neither this file or rom.c makes an attempt at universal ROM support.

Author:

    John DeRosa		4-May-1993

Revision History:

--*/

//
// All ROM manipulations (reading, writing, etc.) are done through
// an array.  The array contains one entry per ROM type, and the values
// in each entry dictate how to talk to the ROM.
//
// Supported ROMs are assumed to have the following characteristics:
//
//	The ROM space in the machine is made up of all the same parts.
//	I.e., the space is homogeneous.
//
//	Each chip has a byte path for data in and data out.
//
//	Each chip has a way to identify itself.
//
//	Each chip has a way to be reset.
//
//	Each chip has a finite erase, write, set read-mode, and identify
//	sequence.
//
//	The chip block size is less than or equal to 64KB.
//

//
// Define the maximum length of certain commands.
//

#define MAXIMUM_ROM_ID_COMMAND_LENGTH		3
#define MAXIMUM_ROM_ID_RESPONSE_LENGTH		2
#define MAXIMUM_ROM_READ_COMMAND_LENGTH		3
#define MAXIMUM_ROM_RESET_COMMAND_LENGTH	3


//
// Define function time for erase and byte-write entries.
//

typedef ARC_STATUS (*PROMSECTORERASE) (IN PUCHAR EraseAddress);

typedef ARC_STATUS (*PROMBYTEWRITE) (IN PUCHAR WriteAddress,
				     IN UCHAR WriteData);

//
// Define structure to store ROM address and byte pairs.
//

typedef struct _ABSOLUTE_ROM_COMMAND {
    PUCHAR Address;
    UCHAR Value;
} ABSOLUTE_ROM_COMMAND, *PABSOLUTE_ROM_COMMAND;

typedef struct _OFFSET_ROM_COMMAND {
    ULONG Offset;
    UCHAR Value;
} OFFSET_ROM_COMMAND, *POFFSET_ROM_COMMAND;

//
// Define the entries in the ROM values table.  These are organized for
// memory efficiency.
//

typedef struct _ROM_VALUES {

    //
    // Microseconds to stall after most ROM commands.
    //

    UCHAR StallAmount;

    //
    // Length of the Identification command sequence.
    //

    UCHAR IdCommandLength;

    //
    // Length of the Identification response.
    //

    UCHAR IdResponseLength;

    //
    // Length of the Reset command.
    //

    UCHAR ResetCommandLength;

    //
    // Length of the Set read-mode command.
    //

    UCHAR ReadCommandLength;

    //
    // The ROM supported by this entry.
    //

    ROM_TYPE ROMType;

    //
    // Number of bytes per chip.
    //

    ULONG BytesPerChip;

    //
    // Number of bytes per block.
    //

    ULONG BytesPerBlock;

    //
    // Identification command sequence.
    //
    // Each step in the sequence is two bytes: address to be written,
    // and data to be written.
    //

    ABSOLUTE_ROM_COMMAND IdCommand[MAXIMUM_ROM_ID_COMMAND_LENGTH];

    //
    // Identification response sequence.
    //
    // Each step in the seqeuence is two bytes: address to be read, and
    // the byte that should be returned.
    //

    ABSOLUTE_ROM_COMMAND IdResponse[MAXIMUM_ROM_ID_RESPONSE_LENGTH];

    //
    // Reset command sequence.
    //
    // Each step in the sequence is two bytes: address to be written,
    // and data to be written.
    //

    OFFSET_ROM_COMMAND ResetCommand[MAXIMUM_ROM_RESET_COMMAND_LENGTH];

    //
    // Set read-mode command sequence.
    //
    // Each step in the sequence is two bytes: address to be written,
    // and data to be written.
    //

    OFFSET_ROM_COMMAND ReadCommand[MAXIMUM_ROM_READ_COMMAND_LENGTH];

    //
    // The function to be called to do a block erase.
    //

    PROMSECTORERASE SectorErase;

    //
    // The function to be called to do a byte write.
    //

    PROMBYTEWRITE ByteWrite;

} ROM_VALUES, *PROM_VALUES;