Main Page   Modules   Data Structures   File List   Data Fields   Globals   Related Pages   Examples  

eeprom.h

00001 /* Copyright (c) 2002, Marek Michalkiewicz
00002    All rights reserved.
00003 
00004    Redistribution and use in source and binary forms, with or without
00005    modification, are permitted provided that the following conditions are met:
00006 
00007    * Redistributions of source code must retain the above copyright
00008      notice, this list of conditions and the following disclaimer.
00009    * Redistributions in binary form must reproduce the above copyright
00010      notice, this list of conditions and the following disclaimer in
00011      the documentation and/or other materials provided with the
00012      distribution.
00013 
00014   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00015   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00016   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00017   ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
00018   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00019   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
00020   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00021   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00022   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00023   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00024   POSSIBILITY OF SUCH DAMAGE. */
00025 
00026 /*
00027    eeprom.h
00028 
00029    Contributors:
00030      Created by Marek Michalkiewicz <marekm@linux.org.pl>
00031  */
00032 
00033 #ifndef _EEPROM_H_
00034 #define _EEPROM_H_ 1
00035 
00036 #define __need_size_t
00037 #include <stddef.h>
00038 
00039 #include <avr/io.h>
00040 
00063 #define eeprom_is_ready() bit_is_clear(EECR, EEWE)
00064 
00065 #ifdef __cplusplus
00066 extern "C" {
00067 #endif
00068 
00071 extern unsigned char eeprom_rb(unsigned int addr);
00072 
00075 extern unsigned int eeprom_rw(unsigned int addr);
00076 
00079 extern void eeprom_wb(unsigned int addr, unsigned char val);
00080 
00084 extern void eeprom_read_block(void *buf, unsigned int addr, size_t n);
00085 
00086 #ifdef __cplusplus
00087 }
00088 #endif
00089 
00095 
00099 #define _EEPUT(addr, val) eeprom_wb(addr, val)
00100 
00104 #define _EEGET(var, addr) (var) = eeprom_rb(addr)
00105 
00108 #endif /* _EEPROM_H_ */

Generated on Thu Jan 30 22:30:44 2003 for EduNet by doxygen1.2.18