RTEMS
6.1-rc2
Loading...
Searching...
No Matches
bsps
powerpc
include
bsp
vpd.h
1
#ifndef PPC_MOTLOAD_VPD_H
2
#define PPC_MOTLOAD_VPD_H
3
4
/* MotLoad VPD format */
5
6
/* Till Straumann, 2005; see copyright notice at the end of this file */
7
8
#ifdef __cplusplus
9
extern
"C"
{
10
#endif
11
12
/*
13
VPD = "MOTOROLA" , { field }
14
15
field = type_byte, length_byte, { data }
16
*/
17
18
/* Known fields so far */
19
typedef
enum
{
20
ProductIdent = 0x01,
/* String */
21
AssemblyNumber = 0x02,
/* String */
22
SerialNumber = 0x03,
/* String */
23
CpuClockHz = 0x05,
/* binary (5bytes), 0x01 byte appended to unsigned int */
24
BusClockHz = 0x06,
/* binary (5bytes), 0x01 byte appended to unsigned int */
25
EthernetAddr = 0x08,
/* binary (7bytes), 0x00 byte appended, 2nd has 0x01 appended */
26
CpuType = 0x09,
/* String */
27
EEpromCrc = 0x0a,
/* binary (4bytes) */
28
FlashConfig = 0x0b,
/* binary */
29
L2CacheConfig = 0x0e,
/* binary */
30
VPDRevision = 0x0f,
/* binary (4bytes) */
31
L3CacheConfig = 0x19,
/* binary */
32
End = 0xff
33
} VpdKey;
34
35
typedef
struct
{
36
VpdKey key;
/* key for the data item to be read into 'buf' */
37
char
instance;
/* instance # (starting with 0) - some keys are present more than one time */
38
void
*buf;
/* pointer to area where the data item is to be stored */
39
int
buflen;
/* available space in the buffer */
40
char
found;
/* set by BSP_vpdRetrieveFields() to the original length as found in the PROM */
41
}
VpdBufRec
, *
VpdBuf
;
42
43
44
#define VPD_END { key:End, }
45
46
47
/* Scan the VPD EEPROM for a number of fields
48
*
49
* Pass an array of VpdBufRec items. The routine
50
* fills the 'buf'fers for all keys that are found
51
* and sets the 'found' field to the original length
52
* of the data (i.e., as found in the PROM) so that
53
* the routine could be called again with a larger
54
* buffer.
55
*
56
* NOTE: - the array must be terminated by a VPD_END record!
57
* - no CRC check is performed.
58
* - INTERRUPT MANAGEMENT MUST BE FUNCTIONAL
59
*
60
* RETURNS: 0 on success, -1 if any read errors were
61
* encountered or if the "MOTOROLA" header
62
* was not found.
63
*/
64
int
65
BSP_vpdRetrieveFields(
VpdBuf
data);
66
67
/* Example:
68
* Read 2nd ethernet address:
69
*
70
* char enet_addr_2[6];
71
*
72
* VpdBufRec enetVpd [] = {
73
* { key: EthernetAddr, instance: 1, buf: enet_addr_2, buflen: 2},
74
* VPD_END
75
* };
76
*
77
* if ( BSP_vpdRetrieveFields(enetVpd) ) {
78
* error("ethernet address couldn't be read\n");
79
* } else if ( enetVpd[0].found < 6 ) {
80
* error("2nd ethernet address not found in VPD\n");
81
* } else {
82
* use_it(enet_addr_2);
83
* }
84
*/
85
86
87
/* Simple wrapper if only one field is needed
88
*
89
* RETURNS: original length if key is found, -1 on error or if key is not found
90
*/
91
int
92
BSP_vpdRetrieveKey(VpdKey k,
void
*buf,
int
buflen,
int
instance);
93
94
#ifdef __cplusplus
95
}
96
#endif
97
98
/*
99
* Authorship
100
* ----------
101
* This software ('beatnik' RTEMS BSP for MVME6100 and MVME5500) was
102
* created by Till Straumann <strauman@slac.stanford.edu>, 2005-2007,
103
* Stanford Linear Accelerator Center, Stanford University.
104
*
105
* Acknowledgement of sponsorship
106
* ------------------------------
107
* The 'beatnik' BSP was produced by
108
* the Stanford Linear Accelerator Center, Stanford University,
109
* under Contract DE-AC03-76SFO0515 with the Department of Energy.
110
*
111
* Government disclaimer of liability
112
* ----------------------------------
113
* Neither the United States nor the United States Department of Energy,
114
* nor any of their employees, makes any warranty, express or implied, or
115
* assumes any legal liability or responsibility for the accuracy,
116
* completeness, or usefulness of any data, apparatus, product, or process
117
* disclosed, or represents that its use would not infringe privately owned
118
* rights.
119
*
120
* Stanford disclaimer of liability
121
* --------------------------------
122
* Stanford University makes no representations or warranties, express or
123
* implied, nor assumes any liability for the use of this software.
124
*
125
* Stanford disclaimer of copyright
126
* --------------------------------
127
* Stanford University, owner of the copyright, hereby disclaims its
128
* copyright and all other rights in this software. Hence, anyone may
129
* freely use it for any purpose without restriction.
130
*
131
* Maintenance of notices
132
* ----------------------
133
* In the interest of clarity regarding the origin and status of this
134
* SLAC software, this and all the preceding Stanford University notices
135
* are to remain affixed to any copy or derivative of this software made
136
* or distributed by the recipient and are to be affixed to any copy of
137
* software made or distributed by the recipient that contains a copy or
138
* derivative of this software.
139
*
140
* ------------------ SLAC Software Notices, Set 4 OTT.002a, 2004 FEB 03
141
*/
142
143
#endif
VpdBufRec
Definition:
vpd.h:35
Generated by
1.9.6