PN532 updates
[hackover2013-badge-firmware.git] / drivers / eeprom / at25040 / at25040.h
1 /**************************************************************************/
2 /*!
3 @file at25040.h
4 @author K. Townsend (microBuilder.eu)
5 @date 22 March 2010
6 @version 0.10
7
8
9 @section LICENSE
10
11 Software License Agreement (BSD License)
12
13 Copyright (c) 2010, microBuilder SARL
14 All rights reserved.
15
16 Redistribution and use in source and binary forms, with or without
17 modification, are permitted provided that the following conditions are met:
18 1. Redistributions of source code must retain the above copyright
19 notice, this list of conditions and the following disclaimer.
20 2. Redistributions in binary form must reproduce the above copyright
21 notice, this list of conditions and the following disclaimer in the
22 documentation and/or other materials provided with the distribution.
23 3. Neither the name of the copyright holders nor the
24 names of its contributors may be used to endorse or promote products
25 derived from this software without specific prior written permission.
26
27 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
28 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
29 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
30 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
31 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
32 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
33 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
34 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
35 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 */
38 /**************************************************************************/
39
40 #ifndef _AT25040_H_
41 #define _AT25040_H_
42
43 #include "projectconfig.h"
44
45 #define AT25_RDSR_RDY 0x01
46 #define AT25_RDSR_WEN 0x02
47 #define AT25_A8 0x08 // For addresses > 0xFF (AT25040 only) A8 must be added to R/W commands
48 #define AT25_MAXADDRESS 0x0200 // AT25040 = 0X0200, AT25020 = 0x100, AT25010 = 0x80
49
50 /**************************************************************************/
51 /*!
52 AT25040 Commands
53 */
54 /**************************************************************************/
55 typedef enum
56 {
57 AT25_WREN = 0x06,
58 AT25_WRDI = 0x04,
59 AT25_RDSR = 0x05,
60 AT25_WRSR = 0x01,
61 AT25_READ = 0x03,
62 AT25_WRITE = 0x02
63 } at25_Commands_e;
64
65 /**************************************************************************/
66 /*!
67 Error messages
68 */
69 /**************************************************************************/
70 typedef enum
71 {
72 AT25_ERROR_OK = 0, // Everything executed normally
73 AT25_ERROR_TIMEOUT_WE, // Timed out waiting for write enable status
74 AT25_ERROR_TIMEOUT_WFINISH, // Timed out waiting for write to finish
75 AT25_ERROR_ADDRERR, // Address out of range
76 AT25_ERROR_BUFFEROVERFLOW, // Max 6 bytes can be read/written in one operation
77 AT2_ERROR_LAST
78 }
79 at25Error_e;
80
81 void at25Init (void);
82 at25Error_e at25Read (uint16_t address, uint8_t *buffer, uint32_t bufferLength);
83 at25Error_e at25Write (uint16_t address, uint8_t *buffer, uint32_t bufferLength);
84
85 #endif
This page took 0.050474 seconds and 5 git commands to generate.