?? k9fxx08.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
#define K9F28_CLE ((volatile uint8 *)0x83100000)
#define K9F28_ALE ((volatile uint8 *)0x83080000)
#define K9F28_DATA ((volatile uint8 *)0x83000000)
#define K9FXX_WAIT()
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 + -