eeprom.h
Go to the documentation of this file.
1 //*****************************************************************************
2 //
3 // eeprom.h - Prototypes for the EEPROM driver.
4 //
5 // Copyright (c) 2010-2017 Texas Instruments Incorporated. All rights reserved.
6 // Software License Agreement
7 //
8 // Redistribution and use in source and binary forms, with or without
9 // modification, are permitted provided that the following conditions
10 // are met:
11 //
12 // Redistributions of source code must retain the above copyright
13 // notice, this list of conditions and the following disclaimer.
14 //
15 // Redistributions in binary form must reproduce the above copyright
16 // notice, this list of conditions and the following disclaimer in the
17 // documentation and/or other materials provided with the
18 // distribution.
19 //
20 // Neither the name of Texas Instruments Incorporated nor the names of
21 // its contributors may be used to endorse or promote products derived
22 // from this software without specific prior written permission.
23 //
24 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
27 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
28 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
29 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
30 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
31 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
32 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
33 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
34 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 //
36 //*****************************************************************************
37 
38 #ifndef __DRIVERLIB_EEPROM_H__
39 #define __DRIVERLIB_EEPROM_H__
40 
41 #include <stdint.h>
42 #include <stdbool.h>
43 
44 //*****************************************************************************
45 //
46 // If building with a C++ compiler, make all of the definitions in this header
47 // have a C binding.
48 //
49 //*****************************************************************************
50 #ifdef __cplusplus
51 extern "C"
52 {
53 #endif
54 
55 //*****************************************************************************
56 //
59 //
60 //*****************************************************************************
61 
62 //*****************************************************************************
63 //
64 // Values returned by EEPROMInit.
65 //
66 //*****************************************************************************
67 
68 //
72 //
73 #define EEPROM_INIT_OK 0
74 
75 //
83 //
84 #define EEPROM_INIT_ERROR 2
85 
86 //*****************************************************************************
87 //
88 // Error indicators returned by various EEPROM API calls. These will be ORed
89 // together into the final return code.
90 //
91 //*****************************************************************************
92 
93 //
96 //
97 #define EEPROM_RC_WRBUSY 0x00000020
98 
99 //
105 //
106 #define EEPROM_RC_NOPERM 0x00000010
107 
108 //
113 //
114 #define EEPROM_RC_WKCOPY 0x00000008
115 
116 //
120 //
121 #define EEPROM_RC_WKERASE 0x00000004
122 
123 //
127 //
128 #define EEPROM_RC_WORKING 0x00000001
129 
130 //*****************************************************************************
131 //
132 // Values that can be passed to EEPROMBlockProtectSet() in the ui32Protect
133 // parameter, and returned by EEPROMBlockProtectGet().
134 //
135 //*****************************************************************************
136 
137 //
142 //
143 #define EEPROM_PROT_SUPERVISOR_ONLY 0x00000008
144 
145 //
151 //
152 #define EEPROM_PROT_RW_LRO_URW 0x00000000
153 
154 //
158 //
159 #define EEPROM_PROT_NA_LNA_URW 0x00000001
160 
161 //
167 //
168 #define EEPROM_PROT_RO_LNA_URO 0x00000002
169 
170 //*****************************************************************************
171 //
175 //
176 //*****************************************************************************
177 #define EEPROM_INT_PROGRAM 0x00000004
178 
179 //*****************************************************************************
180 //
194 //
195 //*****************************************************************************
196 #define EEPROMBlockFromAddr(ui32Addr) ((ui32Addr) >> 6)
197 
198 //*****************************************************************************
199 //
210 //
211 //*****************************************************************************
212 #define EEPROMAddrFromBlock(ui32Block) ((ui32Block) << 6)
213 
214 //*****************************************************************************
215 //
216 // Close the Doxygen group.
218 //
219 //*****************************************************************************
220 
221 //*****************************************************************************
222 //
223 // Prototypes for the APIs.
224 //
225 //*****************************************************************************
226 extern uint32_t EEPROMInit(void);
227 extern uint32_t EEPROMSizeGet(void);
228 extern uint32_t EEPROMBlockCountGet(void);
229 extern void EEPROMRead(uint32_t *pui32Data, uint32_t ui32Address,
230  uint32_t ui32Count);
231 extern uint32_t EEPROMProgram(uint32_t *pui32Data,
232  uint32_t ui32Address,
233  uint32_t ui32Count);
234 extern uint32_t EEPROMProgramNonBlocking(uint32_t ui32Data,
235  uint32_t ui32Address);
236 extern uint32_t EEPROMStatusGet(void);
237 extern uint32_t EEPROMMassErase(void);
238 extern uint32_t EEPROMBlockProtectGet(uint32_t ui32Block);
239 extern uint32_t EEPROMBlockProtectSet(uint32_t ui32Block,
240  uint32_t ui32Protect);
241 extern uint32_t EEPROMBlockPasswordSet(uint32_t ui32Block,
242  uint32_t *pui32Password,
243  uint32_t ui32Count);
244 extern uint32_t EEPROMBlockLock(uint32_t ui32Block);
245 extern uint32_t EEPROMBlockUnlock(uint32_t ui32Block,
246  uint32_t *pui32Password,
247  uint32_t ui32Count);
248 extern void EEPROMBlockHide(uint32_t ui32Block);
249 extern void EEPROMIntEnable(uint32_t ui32IntFlags);
250 extern void EEPROMIntDisable(uint32_t ui32IntFlags);
251 extern uint32_t EEPROMIntStatus(bool bMasked);
252 extern void EEPROMIntClear(uint32_t ui32IntFlags);
253 
254 //*****************************************************************************
255 //
256 // Mark the end of the C bindings section for C++ compilers.
257 //
258 //*****************************************************************************
259 #ifdef __cplusplus
260 }
261 #endif
262 
263 #endif // __DRIVERLIB_EEPROM_H__
uint32_t EEPROMStatusGet(void)
Definition: eeprom.c:1044
uint32_t EEPROMBlockUnlock(uint32_t ui32Block, uint32_t *pui32Password, uint32_t ui32Count)
Definition: eeprom.c:807
void EEPROMRead(uint32_t *pui32Data, uint32_t ui32Address, uint32_t ui32Count)
Definition: eeprom.c:257
uint32_t EEPROMBlockCountGet(void)
Definition: eeprom.c:220
uint32_t EEPROMProgram(uint32_t *pui32Data, uint32_t ui32Address, uint32_t ui32Count)
Definition: eeprom.c:331
uint32_t EEPROMBlockLock(uint32_t ui32Block)
Definition: eeprom.c:754
uint32_t EEPROMIntStatus(bool bMasked)
Definition: eeprom.c:970
uint32_t EEPROMProgramNonBlocking(uint32_t ui32Data, uint32_t ui32Address)
Definition: eeprom.c:457
uint32_t EEPROMBlockPasswordSet(uint32_t ui32Block, uint32_t *pui32Password, uint32_t ui32Count)
Definition: eeprom.c:678
void EEPROMBlockHide(uint32_t ui32Block)
Definition: eeprom.c:867
void EEPROMIntClear(uint32_t ui32IntFlags)
Definition: eeprom.c:1019
uint32_t EEPROMBlockProtectSet(uint32_t ui32Block, uint32_t ui32Protect)
Definition: eeprom.c:613
uint32_t EEPROMSizeGet(void)
Definition: eeprom.c:198
void EEPROMIntDisable(uint32_t ui32IntFlags)
Definition: eeprom.c:935
uint32_t EEPROMBlockProtectGet(uint32_t ui32Block)
Definition: eeprom.c:550
void EEPROMIntEnable(uint32_t ui32IntFlags)
Definition: eeprom.c:899
uint32_t EEPROMInit(void)
Definition: eeprom.c:126
uint32_t EEPROMMassErase(void)
Definition: eeprom.c:502
Copyright 2018, Texas Instruments Incorporated