📄 flash.h
字号:
/****************************************Copyright (c)****************************************************
** ZhangZhou KENENG electronics Co.,LTD.
**
**
**
**--------------File Info---------------------------------------------------------------------------------
** File name: flash.h
** Last modified Date: 2009-03-12
** Last Version: 1.0
** Descriptions: 提供操作片外NOR FLASH的接口,当前主要用到初始化函数
同时提供其他操作,以备将来BOOTLOADER功能扩展需要。
** (从bootloader中移植到uc/os-II环境,考虑到nor flash的时序问题,
** 添加了关键操作的开关中断处理,确保flash操作的正确,
** 同时,还考虑了代码的兼容性问题)
**
**--------------------------------------------------------------------------------------------------------
** Created by: heshusheng
** Created date: 2009-03-12
** Version: 1.0
** Descriptions: The original version
**
**--------------------------------------------------------------------------------------------------------
** Modified by:
** Modified date:
** Version:
** Descriptions:
**
*********************************************************************************************************/
#ifndef _FLASH_H_
#define _FLASH_H_
typedef struct
{
uint32 base_addr;//flash的起始地址
uint32 size;//flash的长度
uint32 sector_size;//扇区的长度
uint32 block_size;//块的长度
}flash_info_type;
/*********************************************************************************************************
* 名 称:flash_init()
* 功 能:提供接口供给外部调用,NORFLASH 初始化函数
* 入口参数:无
* 出口参数:无
**********************************************************************************************************/
void flash_init( void );
/*********************************************************************************************************
* 名 称:flash_erase_sector
* 功 能:擦除指定的扇区 4Kbyte
* 入口参数:Addr 编程地址
* no 扇区数目
* 出口参数:返回TRUE表示操作成功,返回FALSE表示操作失败
**********************************************************************************************************/
int flash_erase_sector(long addr, int no);
/*********************************************************************************************************
* 名 称:flash_erase_sector
* 功 能:擦除指定的块64Kbyte
* 入口参数:Addr 编程地址
* no 块数目
* 出口参数:返回TRUE表示操作成功,返回FALSE表示操作失败
**********************************************************************************************************/
int flash_erase_block(long addr, int no);
/*********************************************************************************************************
* 名 称:flash_write()
* 功 能:提供接口供给外部调用,按字节进行编程。
* 入口参数:src 写入的数据缓存
* addr : 写入的地址,使用0x81******开头的地址
* cnt :写入的数据长度
* 出口参数:返回TRUE表示操作成功,返回FALSE表示操作失败
**********************************************************************************************************/
int flash_write(char *src,long addr,long cnt);
#endif /*_FLASH_H_*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -