delugeimgstablestore.nc

来自「tinyos最新版」· NC 代码 · 共 159 行

NC
159
字号
// $Id: DelugeImgStableStore.nc,v 1.9 2004/07/27 18:29:48 jwhui Exp $/*									tab:4 * * * "Copyright (c) 2000-2004 The Regents of the University  of California.   * All rights reserved. * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose, without fee, and without written agreement is * hereby granted, provided that the above copyright notice, the following * two paragraphs and the author appear in all copies of this software. *  * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *  * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS." * *//** * Generic interface for reading and writing deluge image data to and * from stable storage. * * @author Jonathan Hui <jwhui@cs.berkeley.edu> */interface DelugeImgStableStore {  /**   * Translates an image number to starting external flash page.   *   * @param imgNum  The image number to translate.   * @return        Starting page address in external flash.   */  command eeprompage_t imgNum2FlashPage(uint8_t imgNum);  /**   * Translates an external flash page address to image number.   *   * @param flashPage  The flash page address to translate.   * @return           Image number.   */  command uint8_t flashPage2ImgNum(eeprompage_t flashPage);  /**   * Reads image data from stable storage.   *   * @param imgNum  Image to read data from.   * @param offset  The offset in the image to begin read of data.   * @param dest    The buffer to put read image data.   * @param length  The number of bytes to read.   * @return        <code>SUCCESS</code> if the read request is successful;   *                <code>FAIL</code> otherwise.   */  command result_t getImgData(uint8_t imgNum, uint32_t offset, void* dest, uint32_t length);  /**   * Notify that the read of image data has completed.   *   * @param result  <code>SUCCESS</code> if the read completed successfuly;   *                <code>FAIL</code> otherwise.   * @return        <code>SUCCESS</code> if the read request completed   *                successfully;   *                <code>FAIL</code> otherwise.   */  event   result_t getImgDataDone(result_t result);  /**   * Initiate a check on crc.   *   * @param imgNum  Image to check crc.   * @param pgNum   Page to check crc.   * @param buf     Temporary working buf for checking crc.   * @return        <code>SUCCESS</code> if the crc check request is accepted;   *                <code>FAIL</code> otherwise.   */  command result_t checkCrc(uint8_t imgNum, pgnum_t pgNum, void* buf);  /**   * Notify that the crc check has completed.   *   * @param result  <code>SUCCESS</code> if the crc check passes;   *                <code>FAIL</otherwise>   */  event result_t checkCrcDone(result_t result);  /**   * Write image data to stable storage.   *   * @param imgNum  Image to write data to.   * @param offset  The offset in the image to begin write of data.   * @param source  The image data to write to stable storage.   * @param length  The number of bytes to read.   * @return        <code>SUCCESS</code> if the write request is successful;   *                <code>FAIL</code> otherwise.   */  command result_t writeImgData(uint8_t imgNum, uint32_t offset, void* source, uint32_t length);  /**   * Notify that the write of image data has completed.   *   * @param result  <code>SUCCESS</code> if the write requested completed    *                successfully;   *                <code>FAIL</code> otherwise.   * @return        <code>SUCCESS</code> if the event is handled successfully;   *                <code>FAIL</code> otherwise.   */  event   result_t writeImgDataDone(result_t result);  /**   * Request all data to be written out on external flash.   *   * @return  <code>SUCCESS</code> if the request is accepted;   *          <code>FAIL</code> otherwise.   */  command result_t syncImgData();  /**   * Notify the completion of a sync request.   *   * @param result  <code>SUCCESS</code> if the write requested completed    *                successfully;   *                <code>FAIL</code> otherwise.   * @return        <code>SUCCESS</code> if the event is handled successfully;   *                <code>FAIL</code> otherwise.   */  event   result_t syncImgDataDone(result_t result);  /**   * Request to get a page crc that was previously written out.   *   * @param imgNum  Image to request page crc from.   * @param pgNum   Page to request page crc from.   * @param buf     Buffer to place crc in.   * @return        <code>SUCCESS</code> if the request is accepted;   *                <code>FAIL</code> otherwise.   */  command result_t getPageCrc(uint8_t imgNum, pgnum_t pgNum, void* buf);  /**   * Write out a page crc.   *   * @param imgNum  Image to write page crc to.   * @param pgNum   Page to write page crc to.   * @param buf     Buffer where crc exists.   * @return        <code>SUCCESS</code> if the request is accepted;   *                <code>FAIL</code> otherwise.   */  command result_t writePageCrc(uint8_t imgNum, pgnum_t pgNum, void* buf);}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?