📄 flash_drv.h
字号:
//----------------------------------------------------------------------------
// Filename : Flash_drv.h
//----------------------------------------------------------------------------
//
// Copyright (c) 2008,东莞太平计算机科技有限公司
// All rights reserved.
// www.pacific-gold.com.cn
//
// 历史版本:
//
// 版本: V1.0
// 作者: 罗先能
// 日期: 2007-12-21
// 描述: 建立第一版本
//
//
// 描述:
// 1. 设备st39vf1601的驱动程序
//
//
//----------------------------------------------------------------------------
#ifndef __FLASH_DRV_H__
#define __FLASH_DRV_H__
//============================================================================
//----------------------------------------------------------------------------
// Includes
//----------------------------------------------------------------------------
#include "71x_lib.h"
//----------------------------------------------------------------------------
// Global Constant Definitions
//----------------------------------------------------------------------------
#define IGNORE ~0 // ignore the parameter
#define SKIP ~0 // ignore the parameter
typedef enum
{
CHIP_ERASE, // 1. chip erase
BLOCK_ERASE, // 2. block erase
SECTOR_ERASE, // 3. sector erase
WORD_PROGRAM, // 4. word program
GET_SPACE, // 5. get the size of space
GET_USED_SPACE, // 6. get the size of used space
GET_RELEASE_SPACE, // 7. get the size of release space
GET_ID // 8. get the chip's ID
} FLASH_CTRL_DEF;
//----------------------------------------------------------------------------
// Global Varable Declare
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
// Global Function Declare
//----------------------------------------------------------------------------
/**************************************************************
* Function: flash_init(...)
* Description:
* initialize the device of extern flash
* Input: no
*
* Return: TRUE : ok
* FALSE: error
*
**************************************************************/
extern bool flash_init( void );
/**************************************************************
* Function: flash_open(...)
* Description: open the device of extern flash
*
* Input: no
*
* Return: TRUE : ok
* FALSE: error
**************************************************************/
extern bool flash_open( void );
/**************************************************************
* Function: flash_close(...);
* Description:
* not use
* Input:
*
* Return:
*
**************************************************************/
extern bool flash_close( void );
/**************************************************************
* Function: flash_read(...)
* Description: read datas from flash
*
* Input: offset [--> ]: start address of extern flash
* size [<-->]:
* [ -->]: the size of want to get.
* [<-- ]: return the size of have getted data.
* buffer [<-- ]: the buffer of return data
*
* Return: TRUE : ok
* FALSE: error
**************************************************************/
extern bool flash_read( u32 addr, u32 size, void* buffer);
/**************************************************************
* Function: flash_write(...)
* Description: write datas to the device of flash
*
* Input: offset [--> ]: start address
* size [--> ]: the number of data bytes
* buffer [--> ]: the datas
* Return: TRUE : ok
* FALSE: error
**************************************************************/
extern bool flash_write(u32 addr, u32 size, void* buffer);
/**************************************************************
* Function: flash_ctrl(...)
* Description: controll the flash
*
* Input: cmd [--> ]: control command
* arg [--> ]: parameter of command
* buffer[--> ]:
* Parameter: cmd, arg, buffer
* -------------------------------------
* CHIP_ERASE, - , -
* BLOCK_ERASE, address, -
* SECTOR_ERASE, address, -
* WORD_PROGRAM, address, buffer[0]
* GET_SPACE,
* GET_USED_SPACE,
* GET_RELEASE_SPACE,
* GET_ID,
*
* Return: TRUE: ok
* FALSE: error
**************************************************************/
extern bool flash_ctrl(FLASH_CTRL_DEF cmd, u32 arg, void* buffer);
//============================================================================
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -