forked from DediProgSW/SF100Linux
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSerialFlash.h
More file actions
93 lines (61 loc) · 3.06 KB
/
SerialFlash.h
File metadata and controls
93 lines (61 loc) · 3.06 KB
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#pragma once
#ifndef SERIALFLASHS
#define SERIALFLASHS
#define SerialFlash_FALSE -1
#define SerialFlash_TRUE 1
//#define size_t unsigned int
enum //list of all chip-specific instruction, for ST serial flash
{
WREN = 0x06, // Write Enable
WRDI = 0x04, // Write Disable
RDIDJ = 0x9F, //RDIDJ // Read Jedec ID , except 80
RDSR = 0x05, // Read Status Register
WRSR = 0x01, // Write Status Register
READ = 0x03, // Byte Read
FREAD = 0x0B, // Fast Read
PP = 0x02, // Page Program
SE = 0xD8, // Sector Erase
CHIP_ERASE = 0xC7, //CHIP_ERASE // Bulk (or Chip) Erase
DP = 0xB9, // Deep Power Down
RDP = 0xAB, //RES // Release Deep Power Down
RES = 0xAB, //RES // RDP and read signature
RDSCUR = 0x2B,
GBULK = 0x98,
EN4B = 0xB7,
EXIT4B = 0xE9,
};
int SerialFlash_doWRSR(unsigned char cSR,int Index);
int SerialFlash_doRDSR(unsigned char *cSR,int Index);
void SerialFlash_waitForWEL(int Index);
bool SerialFlash_waitForWIP(int Index);
int SerialFlash_doWREN(int Index);
int SerialFlash_doWRDI(int Index);
int SerialFlash_protectBlock(int bProtect,int Index);
int SerialFlash_EnableQuadIO(int bEnable,int boRW,int Index);
int SerialFlash_Enable4ByteAddrMode(int bEnable,int Index);
int SerialFlash_rangeBlankCheck(struct CAddressRange *Range,int Index);
int SerialFlash_rangeProgram(struct CAddressRange *AddrRange, unsigned char *vData,int Index);
int SerialFlash_rangeRead(struct CAddressRange *AddrRange, unsigned char *vData,int Index);
int SerialFlash_DoPolling(int Index);
int SerialFlash_is_good();
#if 0
int SerialFlash_batchErase(size_t *vAddrs,int Index);
#endif
int SerialFlash_rangeErase(unsigned char cmd, size_t sectionSize, struct CAddressRange *AddrRange,int Index);
int SerialFlash_chipErase(int Index);
int SerialFlash_bulkPipeProgram(struct CAddressRange *AddrRange, unsigned char *vData, unsigned char modeWrite, unsigned char WriteCom, int Index);
int SerialFlash_bulkPipeRead(struct CAddressRange *AddrRange, unsigned char *vData, unsigned char modeRead,unsigned char ReadCom,int Index);
void SerialFlash_SetCancelOperationFlag();
void SerialFlash_ClearCancelOperationFlag();
int SerialFlash_readSR(unsigned char *cSR,int Index);
int SerialFlash_writeSR(unsigned char cSR,int Index);
int SerialFlash_is_protectbits_set(int Index);
bool SST25xFxxA_protectBlock(int bProtect,int Index);
bool SST25xFxx_protectBlock(int bProtect,int Index);
bool AT25FSxxx_protectBlock(int bProtect,int Index);
bool CEN25QHxx_LargeEnable4ByteAddrMode(bool Enable4Byte,int Index);
bool CN25Qxxx_LargeRDFSR(unsigned char *cSR, int Index);
bool CN25Qxxx_LargeEnable4ByteAddrMode(bool Enable4Byte,int Index);
size_t GetChipSize(void);
size_t GetPageSize(void);
#endif //SERIALFLASHS