📄 externflashdev.c
字号:
/*================================================================================
Module Name: Externflashapp.c
General Description: Read/Write event from/to flash
==================================================================================
Honeywell Confidential Proprietary
ACS - Security (Asia Pacific) R&D Software Operations
(c) Copyright Honeywell 2005, All Rights Reserved
Revision History:
Modification Tracking
Author Date Ver Number Description of Changes
---------------- ------------ ---------- -------------------------
Developer chenkang 06/06/2006 ver0.0.1 create
Portability: Indicate if this module is portable to other compilers or
platforms. If not, indicate specific reasons why is it not portable.
==================================================================================
INCLUDE FILES
================================================================================*/
#include "externflashdev.h"
#define GetAddr(addr) (volatile uint16 *)(FLASH_ADDR|(addr<<1))
#define GetStartAddr(addr) (volatile uint16 *)(FLASH_START_ADDR|(addr<<1))
/*********************************************************************************************************
** Function name: WordRead
** Descriptions: 读取指定地址(Flash内部的)上的半字(16位)数据。
** Input: Addr 编程地址(SST39VF1601内部地址)
** Output: 返回值即是读出的数据
** Created by: 黄绍斌
** Created Date: 2006-01-05
**-------------------------------------------------------------------------------------------------------
** Modified by:
** Modified Date:
**------------------------------------------------------------------------------------------------------
********************************************************************************************************/
uint16 WordRead(uint32 Addr)
{
volatile uint16 *ip;
ip = GetAddr(Addr);
return(*ip);
}
int read_config_data_from_exflash(FLASH_CONFIG_SECTOR_S * pstrInData)
{
uint16 ausbuf[CONFIG_SIZE/2];
uint32 uladdr;
int i;
uladdr = SECTOR_3M_START_SECTOR + CONFIG_SECTOR_ID * SECTOR_SIZE;
for(i = 0; i < (CONFIG_SIZE)/2; i++)
{
ausbuf[i] = WordRead(uladdr + i);
}
memcpy((uint8 *)pstrInData,(uint8 *)ausbuf,CONFIG_SIZE);
return (0);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -