summaryrefslogtreecommitdiff
path: root/include/eeprom.h
blob: 70290e17d4695def56c22c89b8ab86a32e4fd5f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/* Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

/* EEPROM module for Chrome EC */

#ifndef __CROS_EC_EEPROM_H
#define __CROS_EC_EEPROM_H

#include "common.h"

/* Initializes the module. */
int eeprom_init(void);

/* Returns the number of EEPROM blocks on the system. */
int eeprom_get_block_count(void);

/* Returns the EEPROM block size in bytes. */
int eeprom_get_block_size(void);

/* Reads <size> bytes of data from <offset> in <block> of EEPROM.  Offset
 * and size must be a multiple of 32 bits. */
int eeprom_read(int block, int offset, int size, char *data);

/* Writes <size> bytes of data to <offset> in <block> of EEPROM.  Offset
 * and size must be a multiple of 32 bits. */
int eeprom_write(int block, int offset, int size, const char *data);

/* Hides an EEPROM block until the next reset. */
int eeprom_hide(int block);

/* TODO: write protect */

#endif  /* __CROS_EC_EEPROM_H */