Contiki 2.5
eeprom.h
Go to the documentation of this file.
1 /**
2  * \addtogroup dev
3  * @{
4  */
5 
6 /**
7  * \defgroup eeprom EEPROM API
8  *
9  * The EEPROM API defines a common interface for EEPROM access on
10  * Contiki platforms.
11  *
12  * A platform with EEPROM support must implement this API.
13  *
14  * @{
15  */
16 
17 /**
18  * \file
19  * EEPROM functions.
20  * \author Adam Dunkels <adam@sics.se>
21  */
22 
23 /* Copyright (c) 2004 Swedish Institute of Computer Science.
24  * All rights reserved.
25  *
26  * Redistribution and use in source and binary forms, with or without modification,
27  * are permitted provided that the following conditions are met:
28  *
29  * 1. Redistributions of source code must retain the above copyright notice,
30  * this list of conditions and the following disclaimer.
31  * 2. Redistributions in binary form must reproduce the above copyright notice,
32  * this list of conditions and the following disclaimer in the documentation
33  * and/or other materials provided with the distribution.
34  * 3. The name of the author may not be used to endorse or promote products
35  * derived from this software without specific prior written permission.
36  *
37  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
38  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
39  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
40  * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
41  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
42  * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
43  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
44  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
45  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
46  * OF SUCH DAMAGE.
47  *
48  * $Id: eeprom.h,v 1.1 2006/06/17 22:41:16 adamdunkels Exp $
49  *
50  * Author: Adam Dunkels <adam@sics.se>
51  *
52  */
53 
54 
55 #ifndef __EEPROM_H__
56 #define __EEPROM_H__
57 
58 typedef unsigned short eeprom_addr_t;
59 #define EEPROM_NULL 0
60 
61 /**
62  * Write a buffer into EEPROM.
63  *
64  * This function writes a buffer of the specified size into EEPROM.
65  *
66  * \param addr The address in EEPROM to which the buffer should be written.
67  *
68  * \param buf A pointer to the buffer from which data is to be read.
69  *
70  * \param size The number of bytes to write into EEPROM.
71  *
72  *
73  */
74 void eeprom_write(eeprom_addr_t addr, unsigned char *buf, int size);
75 
76 /**
77  * Read data from the EEPROM.
78  *
79  * This function reads a number of bytes from the specified address in
80  * EEPROM and into a buffer in memory.
81  *
82  * \param addr The address in EEPROM from which the data should be read.
83  *
84  * \param buf A pointer to the buffer to which the data should be stored.
85  *
86  * \param size The number of bytes to read.
87  *
88  *
89  */
90 void eeprom_read(eeprom_addr_t addr, unsigned char *buf, int size);
91 
92 /**
93  * Initialize the EEPROM module
94  *
95  * This function initializes the EEPROM module and is called from the
96  * bootup code.
97  *
98  */
99 
100 void eeprom_init(void);
101 
102 #endif /* __EEPROM_H__ */
103 
104 /** @} */
105 /** @} */