annotate spiflash.h @ 80:1a4573062b37

Reshuffle in preparation for being able to have a common API for SPI flash and (emulated) EEPROM.
author Daniel O'Connor <darius@dons.net.au>
date Sun, 07 Jul 2013 22:49:02 +0930
parents flash.h@aaf0603d7f88
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
80
1a4573062b37 Reshuffle in preparation for being able to have a common API for SPI flash and (emulated) EEPROM.
Daniel O'Connor <darius@dons.net.au>
parents: 70
diff changeset
1 void spiflashcmd(int argc, char **argv);
1a4573062b37 Reshuffle in preparation for being able to have a common API for SPI flash and (emulated) EEPROM.
Daniel O'Connor <darius@dons.net.au>
parents: 70
diff changeset
2 uint16_t spiflashreadid(void);
1a4573062b37 Reshuffle in preparation for being able to have a common API for SPI flash and (emulated) EEPROM.
Daniel O'Connor <darius@dons.net.au>
parents: 70
diff changeset
3 uint8_t spiflashreadstatus(void);
1a4573062b37 Reshuffle in preparation for being able to have a common API for SPI flash and (emulated) EEPROM.
Daniel O'Connor <darius@dons.net.au>
parents: 70
diff changeset
4 void spiflashwritestatus(uint8_t status);
1a4573062b37 Reshuffle in preparation for being able to have a common API for SPI flash and (emulated) EEPROM.
Daniel O'Connor <darius@dons.net.au>
parents: 70
diff changeset
5 void spiflashwritectl(int enable);
1a4573062b37 Reshuffle in preparation for being able to have a common API for SPI flash and (emulated) EEPROM.
Daniel O'Connor <darius@dons.net.au>
parents: 70
diff changeset
6 void spiflash4kerase(uint32_t addr);
1a4573062b37 Reshuffle in preparation for being able to have a common API for SPI flash and (emulated) EEPROM.
Daniel O'Connor <darius@dons.net.au>
parents: 70
diff changeset
7 uint8_t spiflashread(uint32_t addr);
1a4573062b37 Reshuffle in preparation for being able to have a common API for SPI flash and (emulated) EEPROM.
Daniel O'Connor <darius@dons.net.au>
parents: 70
diff changeset
8 void spiflashenablewrite(void);
1a4573062b37 Reshuffle in preparation for being able to have a common API for SPI flash and (emulated) EEPROM.
Daniel O'Connor <darius@dons.net.au>
parents: 70
diff changeset
9 void spiflashwrite(uint32_t addr, uint8_t data);
1a4573062b37 Reshuffle in preparation for being able to have a common API for SPI flash and (emulated) EEPROM.
Daniel O'Connor <darius@dons.net.au>
parents: 70
diff changeset
10 void spiflashwait(void);
1a4573062b37 Reshuffle in preparation for being able to have a common API for SPI flash and (emulated) EEPROM.
Daniel O'Connor <darius@dons.net.au>
parents: 70
diff changeset
11 int spiflashreadblock(uint32_t addr, uint32_t len, void *_data);
1a4573062b37 Reshuffle in preparation for being able to have a common API for SPI flash and (emulated) EEPROM.
Daniel O'Connor <darius@dons.net.au>
parents: 70
diff changeset
12 int spiflashwriteblock(uint32_t addr, uint32_t len, void *_data);
1a4573062b37 Reshuffle in preparation for being able to have a common API for SPI flash and (emulated) EEPROM.
Daniel O'Connor <darius@dons.net.au>
parents: 70
diff changeset
13 uint32_t spiflashcrcblock(uint32_t addr, uint32_t len);
1a4573062b37 Reshuffle in preparation for being able to have a common API for SPI flash and (emulated) EEPROM.
Daniel O'Connor <darius@dons.net.au>
parents: 70
diff changeset
14 void spiflashprintstatus(uint8_t status, FILE *out);
25
a9cc07caa801 Add stream read/write commands.
Daniel O'Connor <darius@dons.net.au>
parents: 21
diff changeset
15
a9cc07caa801 Add stream read/write commands.
Daniel O'Connor <darius@dons.net.au>
parents: 21
diff changeset
16 /* Streaming read/write */
80
1a4573062b37 Reshuffle in preparation for being able to have a common API for SPI flash and (emulated) EEPROM.
Daniel O'Connor <darius@dons.net.au>
parents: 70
diff changeset
17 void spiflashstartread(uint32_t addr);
1a4573062b37 Reshuffle in preparation for being able to have a common API for SPI flash and (emulated) EEPROM.
Daniel O'Connor <darius@dons.net.au>
parents: 70
diff changeset
18 uint8_t spiflashreadbyte(void);
1a4573062b37 Reshuffle in preparation for being able to have a common API for SPI flash and (emulated) EEPROM.
Daniel O'Connor <darius@dons.net.au>
parents: 70
diff changeset
19 void spiflashstartwrite(uint32_t addr, uint16_t data);
1a4573062b37 Reshuffle in preparation for being able to have a common API for SPI flash and (emulated) EEPROM.
Daniel O'Connor <darius@dons.net.au>
parents: 70
diff changeset
20 void spiflashwriteword(uint16_t data);
1a4573062b37 Reshuffle in preparation for being able to have a common API for SPI flash and (emulated) EEPROM.
Daniel O'Connor <darius@dons.net.au>
parents: 70
diff changeset
21 void spiflashstopread(void);
1a4573062b37 Reshuffle in preparation for being able to have a common API for SPI flash and (emulated) EEPROM.
Daniel O'Connor <darius@dons.net.au>
parents: 70
diff changeset
22 void spiflashstopwrite(void);
8
58d76cf522ff Split out code into separate files.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
23
21
bd8e2cf04034 - Add flash erase, write & read commands (needs more work).
Daniel O'Connor <darius@dons.net.au>
parents: 8
diff changeset
24 #define FL_BUSY (1<<0)
bd8e2cf04034 - Add flash erase, write & read commands (needs more work).
Daniel O'Connor <darius@dons.net.au>
parents: 8
diff changeset
25 #define FL_WEL (1<<1)
8
58d76cf522ff Split out code into separate files.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
26 #define FL_BP0 (1<<2)
58d76cf522ff Split out code into separate files.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
27 #define FL_BP1 (1<<3)
58d76cf522ff Split out code into separate files.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
28 #define FL_BP2 (1<<4)
58d76cf522ff Split out code into separate files.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
29 #define FL_BP3 (1<<5)
21
bd8e2cf04034 - Add flash erase, write & read commands (needs more work).
Daniel O'Connor <darius@dons.net.au>
parents: 8
diff changeset
30 #define FL_AAI (1<<6)
8
58d76cf522ff Split out code into separate files.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
31 #define FL_BPL (1<<7)
58d76cf522ff Split out code into separate files.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
32
58d76cf522ff Split out code into separate files.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
33 #define FL_READ 0x03
58d76cf522ff Split out code into separate files.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
34 #define FL_HSREAD 0x0b
21
bd8e2cf04034 - Add flash erase, write & read commands (needs more work).
Daniel O'Connor <darius@dons.net.au>
parents: 8
diff changeset
35 #define FL_4KERASE 0x20
8
58d76cf522ff Split out code into separate files.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
36 #define FL_32KERASE 0x52
58d76cf522ff Split out code into separate files.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
37 #define FL_64KERASE 0xd8
58d76cf522ff Split out code into separate files.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
38 #define FL_CHIPERASE 0x60
58d76cf522ff Split out code into separate files.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
39 #define FL_BYTEPROG 0x02
58d76cf522ff Split out code into separate files.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
40 #define FL_AAIWP 0xad
58d76cf522ff Split out code into separate files.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
41 #define FL_RDSR 0x05
58d76cf522ff Split out code into separate files.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
42 #define FL_EWSR 0x50
58d76cf522ff Split out code into separate files.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
43 #define FL_WRSR 0x01
58d76cf522ff Split out code into separate files.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
44 #define FL_WREN 0x06
58d76cf522ff Split out code into separate files.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
45 #define FL_WRDI 0x04
58d76cf522ff Split out code into separate files.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
46 #define FL_RDID 0x90
58d76cf522ff Split out code into separate files.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
47 #define FL_JEDECID 0x9f
58d76cf522ff Split out code into separate files.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
48 #define FL_EBSY 0x70
58d76cf522ff Split out code into separate files.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
49 #define FL_DBSY 0x80
58d76cf522ff Split out code into separate files.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
50