Line No. | Rev | Author | Line |
---|---|---|---|
1 | 6 | kaklik | /*! \file spieeprom.h \brief Interface for standard SPI EEPROM memories. */ |
2 | //***************************************************************************** |
||
3 | // |
||
4 | // File Name : 'spieeprom.h' |
||
5 | // Title : Interface for standard SPI EEPROM memories |
||
6 | // Author : Pascal Stang - Copyright (C) 2004 |
||
7 | // Created : 2004.10.07 |
||
8 | // Revised : 2004.10.07 |
||
9 | // Version : 0.1 |
||
10 | // Target MCU : Atmel AVR series |
||
11 | // Editor Tabs : 4 |
||
12 | // |
||
13 | /// \ingroup driver_hw |
||
14 | /// \defgroup spieeprom Interface for standard SPI EEPROM memories (spieeprom.c) |
||
15 | /// \code #include "spieeprom.h" \endcode |
||
16 | /// \par Overview |
||
17 | /// This library provides functions for reading and writing standard |
||
18 | /// 25Cxxx/25LCxxx SPI EEPROM memories. Memory sizes up to 64Kbytes are |
||
19 | /// supported. Future revisions may include page-write support. |
||
20 | /// |
||
21 | /// \Note Library not fully tested! |
||
22 | // |
||
23 | // This code is distributed under the GNU Public License |
||
24 | // which can be found at http://www.gnu.org/licenses/gpl.txt |
||
25 | // |
||
26 | //***************************************************************************** |
||
27 | |||
28 | #ifndef SPIEEPROM_H |
||
29 | #define SPIEEPROM_H |
||
30 | |||
31 | #include "global.h" |
||
32 | |||
33 | // defines and constants |
||
34 | // commands |
||
35 | #define SPIEEPROM_CMD_READ 0x03 ///< Read byte(s) |
||
36 | #define SPIEEPROM_CMD_WRITE 0x02 ///< Write byte(s) |
||
37 | #define SPIEEPROM_CMD_WREN 0x06 ///< Write Enable |
||
38 | #define SPIEEPROM_CMD_WRDI 0x04 ///< Write Disable |
||
39 | #define SPIEEPROM_CMD_RDSR 0x05 ///< Read Status Register |
||
40 | #define SPIEEPROM_CMD_WRSR 0x01 ///< Write Status Register |
||
41 | |||
42 | // status register bit defines |
||
43 | #define SPIEEPROM_STATUS_WIP 0x01 ///< Write in progress |
||
44 | #define SPIEEPROM_STATUS_WEL 0x01 ///< Write enable |
||
45 | #define SPIEEPROM_STATUS_BP0 0x01 ///< Block Proection 0 |
||
46 | #define SPIEEPROM_STATUS_BP1 0x01 ///< Block Proection 1 |
||
47 | #define SPIEEPROM_STATUS_WPEN 0x01 ///< Write Protect Enable |
||
48 | |||
49 | // functions |
||
50 | |||
51 | //! Initialize SPI EEPROM interface |
||
52 | void spieepromInit(void); |
||
53 | |||
54 | //! In the SPI EEPROM read a byte from memory location [memAddr] |
||
55 | u08 spieepromReadByte(u32 memAddr); |
||
56 | |||
57 | //! In the SPI EEPROM write a byte [data] to the memory location [memAddr] |
||
58 | void spieepromWriteByte(u32 memAddr, u08 data); |
||
59 | |||
60 | void spieepromWriteEnable(void); |
||
61 | void spieepromWriteDisable(void); |
||
62 | u08 spieepromReadStatus(void); |
||
63 | |||
64 | #endif |
Powered by WebSVN v2.8.3