/* * EEPROM Write/Read Library for H8 * Written by fenir 2001.9.30 * Last Updated : 2001.9.30 * * ROM読み書きする前にrom_init()を呼び出すこと * */ #ifndef __EEPROM24C512_H__ #define __EEPROM24C512_H__ #ifdef __cplusplus extern "C" { #endif typedef struct i2c_rom_t{ int size; unsigned char ch; volatile unsigned char *ddr_port; volatile unsigned char *sda_port; unsigned char sda_port_mask; volatile unsigned char *scl_port; unsigned char scl_port_mask; } i2c_rom_t; void rom_init(); char rom_read_byte(i2c_rom_t *, unsigned char); unsigned char rom_write_byte(i2c_rom_t *, char); int rom_readpage(i2c_rom_t *, unsigned int, char *, unsigned char); int rom_writepage(i2c_rom_t *, unsigned int, char *, unsigned int); // ROMの設定 #define EEPROM_PAGE_SIZE 64 #define ROM_AMOUNT 16 i2c_rom_t i2c_rom[ROM_AMOUNT]; #ifdef __cplusplus } #endif #endif /* __EEPROM24C512_H__ */