Parent directory

eeprom_custom.c-template

1856 bytes
 1/* Copyright 2019 Nick Brassel (tzarc)
 2 *
 3 * This program is free software: you can redistribute it and/or modify
 4 * it under the terms of the GNU General Public License as published by
 5 * the Free Software Foundation, either version 2 of the License, or
 6 * (at your option) any later version.
 7 *
 8 * This program is distributed in the hope that it will be useful,
 9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#include <stdint.h>
18#include <string.h>
19
20#include "eeprom_driver.h"
21
22void eeprom_driver_init(void) {
23    /* Any initialisation code */
24 }
25
26void eeprom_driver_format(bool erase) {
27    /* If erase=false, then only do the absolute minimum initialisation necessary
28       to make sure that the eeprom driver is usable. It doesn't need to guarantee
29       that the content of the eeprom is reset to any particular value. For many
30       eeprom drivers this may be a no-op.
31
32       If erase=true, then in addition to making sure the eeprom driver is in a
33       usable state, also make sure that it is erased.
34     */
35}
36
37void eeprom_driver_erase(void) {
38    /* Wipe out the EEPROM, setting values to zero */
39}
40
41void eeprom_read_block(void *buf, const void *addr, size_t len) {
42    /*
43        Read a block of data:
44            buf: target buffer
45            addr: 0-based offset within the EEPROM
46            len: length to read
47     */
48}
49
50void eeprom_write_block(const void *buf, void *addr, size_t len) {
51    /*
52        Write a block of data:
53            buf: target buffer
54            addr: 0-based offset within the EEPROM
55            len: length to write
56     */
57}