Contiki 2.5
infomem.h
Go to the documentation of this file.
1 /*
2 Copyright 2006, Freie Universitaet Berlin. All rights reserved.
3 
4 These sources were developed at the Freie Universität Berlin, Computer
5 Systems and Telematics group.
6 
7 Redistribution and use in source and binary forms, with or without
8 modification, are permitted provided that the following conditions are
9 met:
10 
11 - Redistributions of source code must retain the above copyright
12 notice, this list of conditions and the following disclaimer.
13 
14 - Redistributions in binary form must reproduce the above copyright
15 notice, this list of conditions and the following disclaimer in the
16 documentation and/or other materials provided with the distribution.
17 
18 - Neither the name of Freie Universitaet Berlin (FUB) nor the names of its
19 contributors may be used to endorse or promote products derived from
20 this software without specific prior written permission.
21 
22 This software is provided by FUB and the contributors on an "as is"
23 basis, without any representations or warranties of any kind, express
24 or implied including, but not limited to, representations or
25 warranties of non-infringement, merchantability or fitness for a
26 particular purpose. In no event shall FUB or contributors be liable
27 for any direct, indirect, incidental, special, exemplary, or
28 consequential damages (including, but not limited to, procurement of
29 substitute goods or services; loss of use, data, or profits; or
30 business interruption) however caused and on any theory of liability,
31 whether in contract, strict liability, or tort (including negligence
32 or otherwise) arising in any way out of the use of this software, even
33 if advised of the possibility of such damage.
34 
35 This implementation was developed by the CST group at the FUB.
36 
37 For documentation and questions please use the web site
38 http://scatterweb.mi.fu-berlin.de and the mailinglist
39 scatterweb@lists.spline.inf.fu-berlin.de (subscription via the Website).
40 Berlin, 2006
41 */
42 
43 /**
44  * @file infomem.h
45  * @addtogroup storage
46  * @brief MSP430 Infomemory Storage
47  *
48  * @author Michael Baar <baar@inf.fu-berlin.de>
49  */
50 
51 #ifndef INFOMEM_H
52 #define INFOMEM_H
53 
54 #if !defined(INFOMEM_START) || !defined(INFOMEM_BLOCK_SIZE)
55  #error "infomem position (INFOMEM_START) and block size (INFOMEM_BLOCK_SIZE) need to be defined for the platform"
56 #endif
57 
58 /**
59  * @brief Read bytes from infomemory
60  * @param[out] buffer Pointer to buffer for read data
61  * @param[in] offset Offset in infomemory (0-254)
62  * @param[in] size Number of bytes to read
63  */
64 void infomem_read(void *buffer, unsigned int offset, unsigned char size);
65 
66 /**
67  * @brief Write bytes to infomemory
68  * @param[in] offset Offset in infomemory (0-254)
69  * @param[in] count Number of items following
70  * each item is a pair pointer, length
71  *
72  * Example: Infomem_write( 0, 2, &a,3, &b,1 );
73  *
74  * \note: The MSP430 has two consecutive blocks of infomemory.
75  * Each is 128 bytes large. The offset is the relative address
76  * starting at the beginning of the first block. You can write an
77  * arbitrary number of bytes at any offset, but this function
78  * cannot write across the two blocks of infomemory.
79  */
80 bool infomem_write(unsigned int offset, unsigned char count, ...);
81 
82 #endif // !INFOMEM_H