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

📄 k9fxx08.h

📁 zlg nand flash 写平衡 在LINUX XIA
💻 H
字号:
/****************************************Copyright (c)**************************************************
**                               Guangzou ZLG-MCU Development Co.,LTD.
**                                      graduate school
**                                 http://www.zlgmcu.com
**
**--------------File Info-------------------------------------------------------------------------------
** File name: 			k9fxx08.h
** Last modified Date:  2005-2-18
** Last Version: 		1.0
** Descriptions: 		k9f6408/2808/5608/1208 driver
**
**------------------------------------------------------------------------------------------------------
** Created by: 			Chenmingji
** Created date:   		2005-2-18
** Version:				1.0
** Descriptions: 		The original version
**
**------------------------------------------------------------------------------------------------------
** Modified by: 
** Modified date:
** Version:	
** Descriptions: 
**
********************************************************************************************************/
#ifndef __K9FXX08_H 
#define __K9FXX08_H

    #ifdef __cplusplus
    extern "C" {
    #endif

typedef struct _K9FXX08_HARDWARE
{
    volatile    uint8 *CLE;
    volatile    uint8 *ALE;
    volatile    uint8 *Data;
    uint8       *Buf;                              /* 扇区拷贝临时缓冲区 temporary buf for sector copy  */
    uint16      BytsPerSec;                        /* 每扇区字节数       bytes per sector               */
    uint16      BytsPerSecC;                       /* 每扩展扇区字节数   bytes per sector(subjoin data) */
    uint16      SecPerBlock;                       /* 每块扇区数         sectors per block              */
    uint16      BlockPerChip;                      /* 芯片块数           blocks per chip                */
    uint8       (* DataToK9fxx08)(uint8 Data);     /* 数据转换成硬件格式 data to chip format            */
    uint8       (* DataToMCU)(uint8 Data);         /* 数据转换成MCU格式  data to mcu format             */
}K9fXX08Hardware;


    #ifdef IN_K9FXX08

#define K9FXX_SET_ADDR_A        0x00                /* 设置读写指针指向A区 set read point A */
#define K9FXX_SET_ADDR_B        0x01                /* 设置读写指针指向B区 set read point B */
#define K9FXX_SET_ADDR_C        0x50                /* 设置读写指针指向C区 set read point C */

#define K9FXX_READ_ID           0x90                /* 读器件ID  read chip ID       */

#define K9FXX_RESET             0xff                /* 复位芯片  chip reset         */

#define K9FXX_BLOCK_PROGRAM_1   0x80                /* 块编程指令1 block program 1  */
#define K9FXX_BLOCK_PROGRAM_2   0x10                /* 块编程指令2 block program 2  */

#define K9FXX_BLOCK_ERASE_1     0x60                /* 块擦除指令1 block erase 1    */
#define K9FXX_BLOCK_ERASE_2     0xd0                /* 块擦除指令2 block erase 2    */

#define K9FXX_READ_STATUS       0x70                /* 读器件状态 read chip state   */

#define K9FXX_BUSY              (1 << 6)            /* 器件忙标志 chip busy         */

#define K9FXX_OK                (1 << 0)            /* 器件操作成功标志 chip ok     */

uint8  K9fxx08EmptyFunction(uint8 Data);
    #endif


    #ifndef IN_K9FXX08

extern uint8  K9fxx08EmptyFunction(uint8 Data);
/*********************************************************************************************************
** Function name: K9fxx08EmptyFunction
** Descriptions:  默认数据转换函数  defauld data conversion function
** Input:Data: 输入数据  Input Data
** Output: 转换后的数据  Output Data
********************************************************************************************************/

extern uint8 K9fxx08ReadStatus(const K9fXX08Hardware *Index);
/*********************************************************************************************************
** Function name: K9fxx08ReadStatus
** Descriptions: 读芯片状态  read chip state
** Input:Index: 芯片信息结构体 chip information struct
** Output: 状态  state
********************************************************************************************************/
 
extern uint8  K9fxx08SectorRead(const K9fXX08Hardware *Index, void *Buf, uint32 SecIndex);
/*********************************************************************************************************
** Function name: K9fxx08SectorRead
** Descriptions: 读芯片扇区  read chip sector
** Input:Index: 芯片信息结构体 chip information struct
**       Buf:数据缓冲区 data buf
**       SecIndex:扇区索引 sector index
** Output: TRUE: 成功  OK
**         FALSE: 未成功 Not OK
********************************************************************************************************/

extern uint8  K9fxx08SectCRead(const K9fXX08Hardware *Index, void *Buf, uint32 SecIndex);
/*********************************************************************************************************
** Function name: K9fxx08SectCRead
** Descriptions: 读芯片扇区附加数据  read chip sector subjoin data
** Input:Index: 芯片信息结构体 chip information struct
**       Buf:数据缓冲区 data buf
**       SecIndex:扇区索引 sector index
** Output: TRUE: 成功  OK
**         FALSE: 未成功 Not OK
********************************************************************************************************/

extern uint8  K9fxx08SectorProgram(const K9fXX08Hardware *Index, void *Buf, uint32 SecIndex);
/*********************************************************************************************************
** Function name: K9fxx08SectorProgram
** Descriptions: 编程芯片扇区  Program chip sector
** Input:Index: 芯片信息结构体 chip information struct
**       Buf:数据缓冲区 data buf
**       SecIndex:扇区索引 sector index
** Output: TRUE: 成功  OK
**         FALSE: 未成功 Not OK
********************************************************************************************************/

extern uint8  K9fxx08SectorCProgram(const K9fXX08Hardware *Index, void *Buf, uint32 SecIndex);
/*********************************************************************************************************
** Function name: K9fxx08SectorCProgram
** Descriptions: 编程芯片扇区附加数据  Program chip sector subjoin data
** Input:Index: 芯片信息结构体 chip information struct
**       Buf:数据缓冲区 data buf
**       SecIndex:扇区索引 sector index
** Output: TRUE: 成功  OK
**         FALSE: 未成功 Not OK
********************************************************************************************************/

extern uint8  K9fxx08BlockErase(const K9fXX08Hardware *Index, uint32 SecIndex);
/*********************************************************************************************************
** Function name: K9fxx08BlockErase
** Descriptions: 擦除芯片扇区所在的块  erase chip block (include sector)
** Input:Index: 芯片信息结构体 chip information struct
**       SecIndex:块中的某个扇区的索引 sector(in block) index
** Output: TRUE: 成功  OK
**         FALSE: 未成功 Not OK
********************************************************************************************************/

extern uint16 K9fxx08ReadID(const K9fXX08Hardware *Index);
/*********************************************************************************************************
** Function name: K9fxx08ReadID
** Descriptions: 读芯片ID  read chip ID
** Input:Index: 芯片信息结构体 chip information struct
** Output: 芯片ID  chip ID
********************************************************************************************************/

extern uint8  K9fxx08SecCopy(const K9fXX08Hardware *Index, uint32 SourSecIndex, uint32 DestSecIndex);
/*********************************************************************************************************
** Function name: K9fxx08SecCopy
** Descriptions: 芯片内扇区拷贝  copy chip sector
** Input:Index: 芯片信息结构体 chip information struct
**       SourSecIndex:源扇区索引 source sector index
**       DestSecIndex:目标扇区索引 destination sector index
** Output: TRUE: 成功  OK
**         FALSE: 未成功 Not OK
********************************************************************************************************/

extern uint8 K9fxx08BlockCheck(const K9fXX08Hardware *Index, uint32 BlockIndex);
/*********************************************************************************************************
** Function name: K9fxx08BlockCheck
** Descriptions: 芯片块初始有效检测  chip block OK at leave factory
** Input:Index: 芯片信息结构体 chip information struct
**       BlockIndex:块索引  block index
** Output: TRUE: 成功  OK
**         FALSE: 未成功 Not OK
********************************************************************************************************/

extern uint8  K9fxx08SectorCheck(const K9fXX08Hardware *Index, void *Buf, uint32 SecIndex);
/*********************************************************************************************************
** Function name: K9fxx08SectorRead
** Descriptions: 校验芯片扇区  Check chip sector
** Input:Index: 芯片信息结构体 chip information struct
**       Buf:数据缓冲区 data buf
**       SecIndex:扇区索引 sector index
** Output: TRUE: 成功  OK
**         FALSE: 未成功 Not OK
********************************************************************************************************/

extern uint8  K9fxx08SectCCheck(const K9fXX08Hardware *Index, void *Buf, uint32 SecIndex);
/*********************************************************************************************************
** Function name: K9fxx08SectCRead
** Descriptions: 校验芯片扇区附加数据  Check chip sector subjoin data
** Input:Index: 芯片信息结构体 chip information struct
**       Buf:数据缓冲区 data buf
**       SecIndex:扇区索引 sector index
** Output: TRUE: 成功  OK
**         FALSE: 未成功 Not OK
********************************************************************************************************/

    #endif

    #ifdef __cplusplus
    }
    #endif
 
#endif
/*********************************************************************************************************
**                            End Of File
********************************************************************************************************/

⌨️ 快捷键说明

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