Revision c227f099 hw/eeprom93xx.c
b/hw/eeprom93xx.c | ||
---|---|---|
71 | 71 |
}; |
72 | 72 |
#endif |
73 | 73 |
|
74 |
struct eeprom {
|
|
74 |
struct _eeprom_t {
|
|
75 | 75 |
uint8_t tick; |
76 | 76 |
uint8_t address; |
77 | 77 |
uint8_t command; |
... | ... | |
93 | 93 |
{ |
94 | 94 |
/* Save EEPROM data. */ |
95 | 95 |
unsigned address; |
96 |
a_eeprom *eeprom = (a_eeprom *)opaque;
|
|
96 |
eeprom_t *eeprom = (eeprom_t *)opaque;
|
|
97 | 97 |
|
98 | 98 |
qemu_put_byte(f, eeprom->tick); |
99 | 99 |
qemu_put_byte(f, eeprom->address); |
... | ... | |
116 | 116 |
{ |
117 | 117 |
/* Load EEPROM data from saved data if version and EEPROM size |
118 | 118 |
of data and current EEPROM are identical. */ |
119 |
a_eeprom *eeprom = (a_eeprom *)opaque;
|
|
119 |
eeprom_t *eeprom = (eeprom_t *)opaque;
|
|
120 | 120 |
int result = -EINVAL; |
121 | 121 |
if (version_id >= OLD_EEPROM_VERSION) { |
122 | 122 |
unsigned address; |
... | ... | |
150 | 150 |
return result; |
151 | 151 |
} |
152 | 152 |
|
153 |
void eeprom93xx_write(a_eeprom *eeprom, int eecs, int eesk, int eedi)
|
|
153 |
void eeprom93xx_write(eeprom_t *eeprom, int eecs, int eesk, int eedi)
|
|
154 | 154 |
{ |
155 | 155 |
uint8_t tick = eeprom->tick; |
156 | 156 |
uint8_t eedo = eeprom->eedo; |
... | ... | |
275 | 275 |
eeprom->command = command; |
276 | 276 |
} |
277 | 277 |
|
278 |
uint16_t eeprom93xx_read(a_eeprom *eeprom)
|
|
278 |
uint16_t eeprom93xx_read(eeprom_t *eeprom)
|
|
279 | 279 |
{ |
280 | 280 |
/* Return status of pin DO (0 or 1). */ |
281 | 281 |
logout("CS=%u DO=%u\n", eeprom->eecs, eeprom->eedo); |
... | ... | |
292 | 292 |
} |
293 | 293 |
#endif |
294 | 294 |
|
295 |
a_eeprom *eeprom93xx_new(uint16_t nwords)
|
|
295 |
eeprom_t *eeprom93xx_new(uint16_t nwords)
|
|
296 | 296 |
{ |
297 | 297 |
/* Add a new EEPROM (with 16, 64 or 256 words). */ |
298 |
a_eeprom *eeprom;
|
|
298 |
eeprom_t *eeprom;
|
|
299 | 299 |
uint8_t addrbits; |
300 | 300 |
|
301 | 301 |
switch (nwords) { |
... | ... | |
313 | 313 |
addrbits = 6; |
314 | 314 |
} |
315 | 315 |
|
316 |
eeprom = (a_eeprom *)qemu_mallocz(sizeof(*eeprom) + nwords * 2);
|
|
316 |
eeprom = (eeprom_t *)qemu_mallocz(sizeof(*eeprom) + nwords * 2);
|
|
317 | 317 |
eeprom->size = nwords; |
318 | 318 |
eeprom->addrbits = addrbits; |
319 | 319 |
/* Output DO is tristate, read results in 1. */ |
... | ... | |
324 | 324 |
return eeprom; |
325 | 325 |
} |
326 | 326 |
|
327 |
void eeprom93xx_free(a_eeprom *eeprom)
|
|
327 |
void eeprom93xx_free(eeprom_t *eeprom)
|
|
328 | 328 |
{ |
329 | 329 |
/* Destroy EEPROM. */ |
330 | 330 |
logout("eeprom = 0x%p\n", eeprom); |
... | ... | |
332 | 332 |
qemu_free(eeprom); |
333 | 333 |
} |
334 | 334 |
|
335 |
uint16_t *eeprom93xx_data(a_eeprom *eeprom)
|
|
335 |
uint16_t *eeprom93xx_data(eeprom_t *eeprom)
|
|
336 | 336 |
{ |
337 | 337 |
/* Get EEPROM data array. */ |
338 | 338 |
return &eeprom->contents[0]; |
Also available in: Unified diff