00001 /** 00002 * \file 00003 * Functions for reading and writing MSP430 flash ROM. 00004 * \author Adam Dunkels <adam@sics.se> 00005 */ 00006 00007 /* Copyright (c) 2004 Swedish Institute of Computer Science. 00008 * All rights reserved. 00009 * 00010 * Redistribution and use in source and binary forms, with or without 00011 * modification, are permitted provided that the following conditions 00012 * are met: 00013 * 00014 * 1. Redistributions of source code must retain the above copyright notice, 00015 * this list of conditions and the following disclaimer. 00016 * 2. Redistributions in binary form must reproduce the above copyright notice, 00017 * this list of conditions and the following disclaimer in the documentation 00018 * and/or other materials provided with the distribution. 00019 * 3. The name of the author may not be used to endorse or promote products 00020 * derived from this software without specific prior written permission. 00021 * 00022 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS 00023 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 00024 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00025 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 00026 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00027 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 00028 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00029 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 00030 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 00031 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00032 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00033 * 00034 * $Id: flash.h,v 1.1 2006/06/17 22:41:21 adamdunkels Exp $ 00035 * 00036 * Author: Adam Dunkels <adam@sics.se> 00037 * 00038 */ 00039 00040 #ifndef __FLASH_H__ 00041 #define __FLASH_H__ 00042 00043 /** 00044 * Setup function to be called before any of the flash programming functions. 00045 * 00046 */ 00047 void flash_setup(void); 00048 00049 /** 00050 * Function that is to be called after flashing is done. 00051 */ 00052 void flash_done(void); 00053 00054 /** 00055 * Write a 16-bit word to flash ROM. 00056 * 00057 * This function writes a 16-bit word to flash ROM. The function 00058 * flash_setup() must have been called first. 00059 * 00060 * \param addr A pointer to the address in flash ROM which is to be 00061 * written. 00062 * 00063 * \param word The 16-bit word that is to be written. 00064 */ 00065 void flash_write(unsigned short *addr, unsigned short word); 00066 00067 /** 00068 * Clear a 16-bit word in flash ROM. 00069 * 00070 * This function clears a 16-bit word in flash ROM. The function 00071 * flash_setup() must have been called first. 00072 * 00073 * \param addr A pointer to the address in flash ROM which is to be 00074 * cleared. 00075 */ 00076 void flash_clear(unsigned short *addr); 00077 00078 #endif /* __FLASH_H__ */