comparison flash.h @ 21:bd8e2cf04034

- Add flash erase, write & read commands (needs more work). - Split the buffer into argv/argc to make sub commands simpler.
author Daniel O'Connor <darius@dons.net.au>
date Thu, 15 Nov 2012 23:40:51 +1030
parents 58d76cf522ff
children a9cc07caa801
comparison
equal deleted inserted replaced
20:35cf31794a42 21:bd8e2cf04034
1 void flashcmd(char **, int);
1 uint16_t flashreadid(void); 2 uint16_t flashreadid(void);
2 uint8_t flashreadstatus(void); 3 uint8_t flashreadstatus(void);
3 void flashwritestatus(uint8_t status); 4 void flashwritestatus(uint8_t status);
4 void flashwritectl(int enable); 5 void flashwritectl(int enable);
6 void flash4kerase(uint32_t addr);
7 uint8_t flashread(uint32_t addr);
8 void flashenablewrite(void);
9 void flashwrite(uint32_t addr, uint8_t data);
5 10
11 #define FL_BUSY (1<<0)
12 #define FL_WEL (1<<1)
6 #define FL_BP0 (1<<2) 13 #define FL_BP0 (1<<2)
7 #define FL_BP1 (1<<3) 14 #define FL_BP1 (1<<3)
8 #define FL_BP2 (1<<4) 15 #define FL_BP2 (1<<4)
9 #define FL_BP3 (1<<5) 16 #define FL_BP3 (1<<5)
17 #define FL_AAI (1<<6)
10 #define FL_BPL (1<<7) 18 #define FL_BPL (1<<7)
11 19
12 #define FL_READ 0x03 20 #define FL_READ 0x03
13 #define FL_HSREAD 0x0b 21 #define FL_HSREAD 0x0b
22 #define FL_4KERASE 0x20
14 #define FL_32KERASE 0x52 23 #define FL_32KERASE 0x52
15 #define FL_64KERASE 0xd8 24 #define FL_64KERASE 0xd8
16 #define FL_CHIPERASE 0x60 25 #define FL_CHIPERASE 0x60
17 #define FL_BYTEPROG 0x02 26 #define FL_BYTEPROG 0x02
18 #define FL_AAIWP 0xad 27 #define FL_AAIWP 0xad