mn_flash.c

来自「hammerOS(了解的人就知道了)的一个板块Manage的源代码」· C语言 代码 · 共 76 行

C
76
字号

/***********************************************************

                          mn_flash.c  -  description
                             -------------------
description      : read and write flash functions 
begin          : Wed April 25 2001
copyright       : (C) 2001 Beijing Harbour Networks Ltd.
email          : chenb@harbournetworks.com


*************************************************************/

#ifdef _cplusplus
extern"C"{
#endif

#include "mn_flash.h"




int mn_conf_read_flash_to_mem(char *memfile, int *memfile_length)
{
  int len = 0;

#ifdef _MN_HAVE_FLASH_
  char read_tag[1];
  int tag_len;

  read_tag[0] = 0;
  tag_len = 1;
  mn_flash_busy_signal = 1;
  xflash_file_read(_MN_FLASH_LOAD_TAG_,read_tag ,&tag_len);
  if (read_tag[0] == 'u')   
    {
      if (xflash_file_exist(_MN_FLASH_CONF_TAG_) == OK)
        {
          len = xflash_file_read(_MN_FLASH_CONF_TAG_ , memfile ,memfile_length);
        }
    }  
  else
    {
      read_tag[0] = 'u';
      xflash_file_write(_MN_FLASH_LOAD_TAG_,read_tag,&tag_len);
    }
  mn_flash_busy_signal = 0;
#endif

  
  return len;

}


int mn_conf_write_mem_to_flash(char *memfile, int *memfile_length)
{
  int ret = 0;

  
#ifdef _MN_HAVE_FLASH_
  mn_flash_busy_signal = 1;
  ret = xflash_file_write(_MN_FLASH_CONF_TAG_, memfile,memfile_length);
  mn_flash_busy_signal = 0;
#endif 


  return ret;

}

#ifdef _cplusplus
}
#endif

⌨️ 快捷键说明

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