⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 nvramtoflash.c

📁 au1500开发的应用程序
💻 C
字号:
/* nvRamToFlash.c - non-volatile RAM to FLASH memory routine mapping *//* Copyright 1994-1997 Wind River Systems, Inc. */#include "copyright_wrs.h"/*modification history--------------------01d,04feb97,wlf  doc: more cleanup.01c,14nov96,wlf  doc: cleanup.01b,31jan96,dzb  added NV_BOOT_OFFSET and NV_RAM_SIZE checking.  Added EOS.01a,08jan94,dzb  created.*//*DESCRIPTIONThis library contains non-volatile RAM manipulation routines for targetslacking non-volatile RAM, but that do have FLASH memory.  Read and writewrappers are provided for the FLASH memory routines sysFlashGet() andsysFlashSet().*//* includes */#include "drv/mem/memDev.h"#include "drv/mem/flashDev.h"/******************************************************************************** sysNvRamGet - get the contents of non-volatile RAM** This routine calls sysFlashGet() to copy the contents of flash memory* into a specified string.  The string is terminated with an EOS.** NOTE: This routine uses flash memory, since there is no NVRAM on the IBM * 403 EVB.** RETURNS: The return value of sysFlashGet().** SEE ALSO: sysNvRamSet(), sysFlashGet()*/STATUS sysNvRamGet    (    char *string,    /* where to copy non-volatile RAM    */    int strLen,      /* maximum number of bytes to copy   */    int offset       /* byte offset into non-volatile RAM */    )    {    STATUS retVal;    offset += NV_BOOT_OFFSET;   /* boot line begins at <offset> = 0 */    if ((offset < 0) || (strLen < 0) || ((offset + strLen) > NV_RAM_SIZE))        return (ERROR);    retVal = sysFlashGet (string, strLen, offset);    string [strLen] = EOS;    return (retVal);    }/********************************************************************************* sysNvRamSet - write to non-volatile RAM** This routine calls sysFlashSet() to copy a specified string into* flash memory.** NOTE: This routine uses flash memory, since there is no NVRAM on the IBM * 403 EVB.** RETURNS: The return value of sysFlashSet().** SEE ALSO: sysNvRamGet(), sysFlashSet()*/STATUS sysNvRamSet    (    char *string,     /* string to be copied into non-volatile RAM */    int strLen,       /* maximum number of bytes to copy           */    int offset        /* byte offset into non-volatile RAM         */    )    {    offset += NV_BOOT_OFFSET;   /* boot line begins at <offset> = 0 */    if ((offset < 0) || (strLen < 0) || ((offset + strLen) > NV_RAM_SIZE))        return (ERROR);    return (sysFlashSet (string, strLen, offset));    }

⌨️ 快捷键说明

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