00001 #ifndef _MWEEPROM_H_ 00002 #define _MWEEPROM_H_ 00003 00004 /* 00005 * Copyright (C) 2004 by Jan Dubiec. All rights reserved. 00006 * 00007 * Redistribution and use in source and binary forms, with or without 00008 * modification, are permitted provided that the following conditions 00009 * are met: 00010 * 00011 * 1. Redistributions of source code must retain the above copyright 00012 * notice, this list of conditions and the following disclaimer. 00013 * 2. Redistributions in binary form must reproduce the above copyright 00014 * notice, this list of conditions and the following disclaimer in the 00015 * documentation and/or other materials provided with the distribution. 00016 * 3. Neither the name of the copyright holders nor the names of 00017 * contributors may be used to endorse or promote products derived 00018 * from this software without specific prior written permission. 00019 * 00020 * THIS SOFTWARE IS PROVIDED BY JAN DUBIEC AND CONTRIBUTORS 00021 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00022 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 00023 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JAN DUBIEC 00024 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00025 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00026 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 00027 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 00028 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00029 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00030 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00031 */ 00032 00033 /* 00034 * $Log$ 00035 * Revision 1.2 2004/03/19 07:46:35 jdubiec 00036 * Make this file independent on sys/types.h due to compilation problems. 00037 * 00038 * Revision 1.1 2004/03/16 16:48:28 haraldkipp 00039 * Added Jan Dubiec's H8/300 port. 00040 * 00041 */ 00042 00043 /* 00044 * Microwire EEPROM routines compatible with avr-gcc API which Nut/OS uses. 00045 * Based on Yousuke FURUSAWA's code: 00046 * http://www.open.esys.tsukuba.ac.jp/~yousuke/software/h8/microwire/index.jp.html 00047 * 00048 * Jan Dubiec <jdx@slackware.pl> 00049 * 00050 */ 00051 00052 #include <stddef.h> 00053 00054 #ifdef __cplusplus 00055 extern "C" { 00056 #endif 00057 00058 extern unsigned char eeprom_read_byte(const unsigned char *addr); 00059 extern unsigned short eeprom_read_word(const unsigned short *addr); 00060 extern void eeprom_read_block(void *buf, const void *addr, size_t n); 00061 extern void eeprom_write_byte(unsigned char *addr, unsigned char val); 00062 extern void eeprom_write_word(unsigned short *addr, unsigned short val); 00063 extern void eeprom_write_block(const void *buf, void *addr, size_t n); 00064 extern void eeprom_fill_all(const unsigned char c); 00065 extern void eeprom_erase(unsigned char *addr); 00066 extern void eeprom_erase_all(void); 00067 00068 #ifdef __cplusplus 00069 } 00070 #endif 00071 #endif /* #ifndef _MWEEPROM_H_ */