Contiki 2.6

infomem.h

Go to the documentation of this file.
00001 /*
00002 Copyright 2006, Freie Universitaet Berlin. All rights reserved.
00003 
00004 These sources were developed at the Freie Universität Berlin, Computer
00005 Systems and Telematics group.
00006 
00007 Redistribution and use in source and binary forms, with or without
00008 modification, are permitted provided that the following conditions are
00009 met:
00010 
00011 - Redistributions of source code must retain the above copyright
00012 notice, this list of conditions and the following disclaimer.
00013 
00014 - Redistributions in binary form must reproduce the above copyright
00015 notice, this list of conditions and the following disclaimer in the
00016 documentation and/or other materials provided with the distribution.
00017  
00018 - Neither the name of Freie Universitaet Berlin (FUB) nor the names of its
00019 contributors may be used to endorse or promote products derived from
00020 this software without specific prior written permission.
00021 
00022 This software is provided by FUB and the contributors on an "as is"
00023 basis, without any representations or warranties of any kind, express
00024 or implied including, but not limited to, representations or
00025 warranties of non-infringement, merchantability or fitness for a
00026 particular purpose. In no event shall FUB or contributors be liable
00027 for any direct, indirect, incidental, special, exemplary, or
00028 consequential damages (including, but not limited to, procurement of
00029 substitute goods or services; loss of use, data, or profits; or
00030 business interruption) however caused and on any theory of liability,
00031 whether in contract, strict liability, or tort (including negligence
00032 or otherwise) arising in any way out of the use of this software, even
00033 if advised of the possibility of such damage.
00034 
00035 This implementation was developed by the CST group at the FUB.
00036 
00037 For documentation and questions please use the web site
00038 http://scatterweb.mi.fu-berlin.de and the mailinglist
00039 scatterweb@lists.spline.inf.fu-berlin.de (subscription via the Website).
00040 Berlin, 2006
00041 */
00042 
00043 /**
00044  * @file                infomem.h
00045  * @addtogroup          storage
00046  * @brief               MSP430 Infomemory Storage
00047  * 
00048  * @author              Michael Baar    <baar@inf.fu-berlin.de>
00049  */
00050 
00051 #ifndef INFOMEM_H
00052 #define INFOMEM_H
00053 
00054 #if !defined(INFOMEM_START) || !defined(INFOMEM_BLOCK_SIZE)
00055   #error "infomem position (INFOMEM_START) and block size (INFOMEM_BLOCK_SIZE) need to be defined for the platform"
00056 #endif
00057 
00058 /**
00059  * @brief       Read bytes from infomemory
00060  * @param[out]          buffer          Pointer to buffer for read data
00061  * @param[in]           offset          Offset in infomemory (0-254)
00062  * @param[in]           size            Number of bytes to read
00063  */
00064 void infomem_read(void *buffer, unsigned int offset, unsigned char size);
00065 
00066 /**
00067  * @brief       Write bytes to infomemory
00068  * @param[in]           offset          Offset in infomemory (0-254)
00069  * @param[in]           count           Number of items following
00070  *                                      each item is a pair pointer, length
00071  *
00072  * Example: Infomem_write( 0, 2, &a,3, &b,1 );
00073  *
00074  * \note: The MSP430 has two consecutive blocks of infomemory.
00075  *        Each is 128 bytes large. The offset is the relative address 
00076  *        starting at the beginning of the first block. You can write an 
00077  *        arbitrary number of bytes at any offset, but this function 
00078  *        cannot write across the two blocks of infomemory.
00079  */
00080 bool infomem_write(unsigned int offset, unsigned char count, ...);
00081 
00082 #endif // !INFOMEM_H