1 /*************************************************************

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/******************************************************************************/
/***
データフラッシュの制御
***/
/******************************************************************************/
#ifndef INCLUDED_DATAFLASH_H
#define INCLUDED_DATAFLASH_H
#include
"typedefine.h"
//#pragma bit_order right
/* データフラッシュ制御のエラーコード
****************************************/
#define
#define
#define
#define
#define
#define
#define
#define
#define
#define
正常
その他異常
処理異常
書き込み異常
データサイズ異常(8の倍数でない)
アドレス境界異常(8バイト境界でない)
アドレス異常(無効なアドレス)
ブロック異常
ブランクではない
FCU異常
DF_NOERROR
DF_ERR_OTHER
DF_ERR_PROC
DF_ERR_WRITE
DF_ERR_SIZE
DF_ERR_BORDR
DF_ERR_ADDR
DF_ERR_BLOCK
DF_ERR_BLANK
DF_ERR_FCU
(0)
(1)
(2)
(3)
(4)
(5)
(6)
(7)
(8)
(9)
/*
/*
/*
/*
/*
/*
/*
/*
/*
/*
/* データフラッシュのブロック番号
#define
#define
#define
#define
#define
#define
#define
#define
#define
#define
#define
#define
#define
#define
#define
#define
DFLASH_B00
DFLASH_B01
DFLASH_B02
DFLASH_B03
DFLASH_B04
DFLASH_B05
DFLASH_B06
DFLASH_B07
DFLASH_B08
DFLASH_B09
DFLASH_B10
DFLASH_B11
DFLASH_B12
DFLASH_B13
DFLASH_B14
DFLASH_B15
( 0)
( 1)
( 2)
( 3)
( 4)
( 5)
( 6)
( 7)
( 8)
( 9)
(10)
(11)
(12)
(13)
(14)
(15)
********************************************/
/*
:Start Addr-End Addr :Size */
/* 0:0x00100000-0x001007FF:2KB */
/* 1:0x00100800-0x00100FFF:2KB */
/* 2:0x00101000-0x001017FF:2KB */
/* 3:0x00101800-0x00101FFF:2KB */
/* 4:0x00102000-0x001027FF:2KB */
/* 5:0x00102800-0x00102FFF:2KB */
/* 6:0x00103000-0x001037FF:2KB */
/* 7:0x00103800-0x00103FFF:2KB */
/* 8:0x00104000-0x001047FF:2KB */
/* 9:0x00104800-0x00104FFF:2KB */
/* 10:0x00105000-0x001057FF:2KB */
/* 11:0x00105800-0x00105FFF:2KB */
/* 12:0x00106000-0x001067FF:2KB */
/* 13:0x00106800-0x00106FFF:2KB */
/* 14:0x00107000-0x001077FF:2KB */
/* 15:0x00107800-0x00107FFF:2KB */
/* ブランクチェックのサイズ指定コード
#define BLANK_CHECK_8BYTE
#define BLANK_CHECK_BLOCK
(0)
(1)
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
****************************************/
/* 8バイトブラックチェック */
/* ブロック全体をブランクチェック */
/* 関数プロトタイプ ***********************************************************/
void
BYTE
BYTE
BYTE
void
void
BYTE
Set_DFlash_EnableBlock(WORD wReadEnable, WORD wWriteEnable);
Check_DFlash_Blank(DWORD dwFlAddr, BYTE bySize);
Erase_DFlash_Block(BYTE byBlock);
Write_DFlash_Data(DWORD dwFlAddr, BYTE* pbyData, WORD wBytes);
Erase_DFlash_Allblock(void);
Init_DataFlash(void);
Read_DFlash_Data(DWORD dwFlAddr, BYTE* pbyBuff, WORD wBytes);
#endif
/* INCLUDED_DATAFLASH_H */