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

📄 nvram.c

📁 操作系统vxworks平台下内存控制器设备的驱动程序,支持多种芯片,支持多种cpu
💻 C
字号:
/* nvRam.c - non-volatile RAM library *//* Copyright 1984-1996 Wind River Systems, Inc. */#include "copyright_wrs.h"/*modification history--------------------01f,18jun96,wlf  doc: cleanup.01e,24may96,wlf  doc: cleanup.01d,28jan93,caf  made boot line begin at offset 0 (SPR #1933).01c,02sep92,caf  changed nvRamLib.c to nvRam.c. changed NV_BOOT_LINE to		 NV_RAM_ADRS.  tweaked documentation.01b,29jun92,caf  changed bbRamLib.c to nvRamLib.c. tweaked documentation.01a,26jun92,caf  derived from sysNvRamSet() and sysNvRamGet() in PortKit.*//*DESCRIPTIONThis library contains routines to manipulate non-volatile RAM which isaccessed as normal RAM (e.g., battery backed RAM).  Read and write routinesare included.  All non-volatile RAM accesses are byte wide.The macro NV_RAM_ADRS must be defined to point to the first byte ofnon-volatile memory.  The macro NV_RAM_SIZE must be defined to provide parameterchecking for sysNvRamSet() and sysNvRamGet().*//******************************************************************************** sysNvRamGet - get the contents of non-volatile RAM** This routine copies the contents of non-volatile memory into a specified* string.  The string is terminated with an EOS.** RETURNS: OK, or ERROR if access is outside the non-volatile RAM range.** SEE ALSO: sysNvRamSet()*/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 */    )    {    offset += NV_BOOT_OFFSET;   /* boot line begins at <offset> = 0 */    if ((offset < 0) || (strLen < 0) || ((offset + strLen) > NV_RAM_SIZE))        return (ERROR);    bcopyBytes (NV_RAM_ADRS + offset, string, strLen);    string [strLen] = EOS;    return (OK);    }/********************************************************************************* sysNvRamSet - write to non-volatile RAM** This routine copies a specified string into non-volatile RAM.** RETURNS: OK, or ERROR if access is outside the non-volatile RAM range.** SEE ALSO: sysNvRamGet()*/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);    bcopyBytes (string, NV_RAM_ADRS + offset, strLen);    return (OK);    }

⌨️ 快捷键说明

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