eeprom.h
1 /*
2  * EEZ PSU Firmware
3  * Copyright (C) 2015-present, Envox d.o.o.
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9 
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14 
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 #pragma once
20 
243 namespace eez {
244 namespace psu {
245 namespace eeprom {
246 
247 static const uint16_t EEPROM_TEST_ADDRESS = 0;
248 static const uint16_t EEPROM_TEST_BUFFER_SIZE = 64;
249 
250 // opcodes
251 static const uint8_t WREN = 6;
252 static const uint8_t WRDI = 4;
253 static const uint8_t RDSR = 5;
254 static const uint8_t WRSR = 1;
255 static const uint8_t READ = 3;
256 static const uint8_t WRITE = 2;
257 
258 static const uint16_t EEPROM_ONTIME_START_ADDRESS = 64;
259 static const uint16_t EEPROM_ONTIME_SIZE = 64;
260 
261 static const uint16_t EEPROM_START_ADDRESS = 1024;
262 
263 static const uint16_t EEPROM_EVENT_QUEUE_START_ADDRESS = 16384;
264 
265 void init();
266 bool test();
267 
268 extern TestResult g_testResult;
269 
270 void read(uint8_t *buffer, uint16_t buffer_size, uint16_t address);
271 bool write(const uint8_t *buffer, uint16_t buffer_size, uint16_t address);
272 
273 }
274 }
275 } // namespace eez::psu::eeprom
Namespace for the everything from the EEZ.
Definition: actions.cpp:41