ths | 663e8e5 | 2007-04-02 12:35:34 +0000 | [diff] [blame] | 1 | /* |
| 2 | * QEMU EEPROM 93xx emulation |
| 3 | * |
| 4 | * Copyright (c) 2006-2007 Stefan Weil |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; either version 2 of the License, or |
| 9 | * (at your option) any later version. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License |
Blue Swirl | 8167ee8 | 2009-07-16 20:47:01 +0000 | [diff] [blame] | 17 | * along with this program; if not, see <http://www.gnu.org/licenses/>. |
ths | 663e8e5 | 2007-04-02 12:35:34 +0000 | [diff] [blame] | 18 | */ |
| 19 | |
| 20 | #ifndef EEPROM93XX_H |
| 21 | #define EEPROM93XX_H |
| 22 | |
malc | 99a0949 | 2009-10-01 22:20:47 +0400 | [diff] [blame^] | 23 | typedef struct eeprom a_eeprom; |
ths | 663e8e5 | 2007-04-02 12:35:34 +0000 | [diff] [blame] | 24 | |
| 25 | /* Create a new EEPROM with (nwords * 2) bytes. */ |
malc | 99a0949 | 2009-10-01 22:20:47 +0400 | [diff] [blame^] | 26 | a_eeprom *eeprom93xx_new(uint16_t nwords); |
ths | 663e8e5 | 2007-04-02 12:35:34 +0000 | [diff] [blame] | 27 | |
| 28 | /* Destroy an existing EEPROM. */ |
malc | 99a0949 | 2009-10-01 22:20:47 +0400 | [diff] [blame^] | 29 | void eeprom93xx_free(a_eeprom *eeprom); |
ths | 663e8e5 | 2007-04-02 12:35:34 +0000 | [diff] [blame] | 30 | |
| 31 | /* Read from the EEPROM. */ |
malc | 99a0949 | 2009-10-01 22:20:47 +0400 | [diff] [blame^] | 32 | uint16_t eeprom93xx_read(a_eeprom *eeprom); |
ths | 663e8e5 | 2007-04-02 12:35:34 +0000 | [diff] [blame] | 33 | |
| 34 | /* Write to the EEPROM. */ |
malc | 99a0949 | 2009-10-01 22:20:47 +0400 | [diff] [blame^] | 35 | void eeprom93xx_write(a_eeprom *eeprom, int eecs, int eesk, int eedi); |
ths | 663e8e5 | 2007-04-02 12:35:34 +0000 | [diff] [blame] | 36 | |
| 37 | /* Get EEPROM data array. */ |
malc | 99a0949 | 2009-10-01 22:20:47 +0400 | [diff] [blame^] | 38 | uint16_t *eeprom93xx_data(a_eeprom *eeprom); |
ths | 663e8e5 | 2007-04-02 12:35:34 +0000 | [diff] [blame] | 39 | |
| 40 | #endif /* EEPROM93XX_H */ |