Contiki 2.6

eeprom.h

Go to the documentation of this file.
00001 /**
00002  * \addtogroup dev
00003  * @{
00004  */
00005 
00006 /**
00007  * \defgroup eeprom EEPROM API
00008  *
00009  * The EEPROM API defines a common interface for EEPROM access on
00010  * Contiki platforms.
00011  *
00012  * A platform with EEPROM support must implement this API.
00013  *
00014  * @{
00015  */
00016 
00017 /**
00018  * \file
00019  * EEPROM functions.
00020  * \author Adam Dunkels <adam@sics.se>
00021  */
00022 
00023 /* Copyright (c) 2004 Swedish Institute of Computer Science.
00024  * All rights reserved.
00025  *
00026  * Redistribution and use in source and binary forms, with or without modification,
00027  * are permitted provided that the following conditions are met:
00028  *
00029  * 1. Redistributions of source code must retain the above copyright notice,
00030  *    this list of conditions and the following disclaimer.
00031  * 2. Redistributions in binary form must reproduce the above copyright notice,
00032  *    this list of conditions and the following disclaimer in the documentation
00033  *    and/or other materials provided with the distribution.
00034  * 3. The name of the author may not be used to endorse or promote products
00035  *    derived from this software without specific prior written permission.
00036  *
00037  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
00038  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
00039  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
00040  * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00041  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
00042  * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00043  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00044  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
00045  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
00046  * OF SUCH DAMAGE.
00047  *
00048  * $Id: eeprom.h,v 1.1 2006/06/17 22:41:16 adamdunkels Exp $
00049  *
00050  * Author: Adam Dunkels <adam@sics.se>
00051  *
00052  */
00053 
00054 
00055 #ifndef __EEPROM_H__
00056 #define __EEPROM_H__
00057 
00058 typedef unsigned short eeprom_addr_t;
00059 #define EEPROM_NULL 0
00060 
00061 /**
00062  * Write a buffer into EEPROM.
00063  *
00064  * This function writes a buffer of the specified size into EEPROM.
00065  *
00066  * \param addr The address in EEPROM to which the buffer should be written.
00067  *
00068  * \param buf A pointer to the buffer from which data is to be read.
00069  *
00070  * \param size The number of bytes to write into EEPROM.
00071  *
00072  *
00073  */
00074 void eeprom_write(eeprom_addr_t addr, unsigned char *buf, int size);
00075 
00076 /**
00077  * Read data from the EEPROM.
00078  *
00079  * This function reads a number of bytes from the specified address in
00080  * EEPROM and into a buffer in memory.
00081  *
00082  * \param addr The address in EEPROM from which the data should be read.
00083  *
00084  * \param buf A pointer to the buffer to which the data should be stored.
00085  *
00086  * \param size The number of bytes to read.
00087  *
00088  *
00089  */
00090 void eeprom_read(eeprom_addr_t addr, unsigned char *buf, int size);
00091 
00092 /**
00093  * Initialize the EEPROM module
00094  *
00095  * This function initializes the EEPROM module and is called from the
00096  * bootup code.
00097  *
00098  */
00099  
00100 void eeprom_init(void);
00101 
00102 #endif /* __EEPROM_H__ */
00103 
00104 /** @} */
00105 /** @} */