summaryrefslogtreecommitdiff
path: root/util/ec_flash.h
blob: f4aea3b7a3dfa8933fbc38c0fc9a3ab2a86ddfa1 (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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/* Copyright 2013 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.
 */

#ifndef __UTIL_EC_FLASH_H
#define __UTIL_EC_FLASH_H

/**
 * Read EC flash memory
 *
 * @param buf		Destination buffer
 * @param offset	Offset in EC flash to read
 * @param size		Number of bytes to read
 *
 * @return 0 if success, negative if error.
 */
int ec_flash_read(uint8_t *buf, int offset, int size);

/**
 * Verify EC flash memory
 *
 * @param buf		Source buffer to verify against EC flash
 * @param offset	Offset in EC flash to check
 * @param size		Number of bytes to check
 *
 * @return 0 if success, negative if error.
 */
int ec_flash_verify(const uint8_t *buf, int offset, int size);

/**
 * Write EC flash memory
 *
 * @param buf		Source buffer
 * @param offset	Offset in EC flash to write
 * @param size		Number of bytes to write
 *
 * @return 0 if success, negative if error.
 */
int ec_flash_write(const uint8_t *buf, int offset, int size);

/**
 * Erase EC flash memory
 *
 * @param offset	Offset in EC flash to erase
 * @param size		Number of bytes to erase
 *
 * @return 0 if success, negative if error.
 */
int ec_flash_erase(int offset, int size);

/**
 * Erase EC flash memory asynchronously
 *
 * @param offset	Offset in EC flash to erase
 * @param size		Number of bytes to erase
 *
 * @return 0 if success, negative if error.
 */
int ec_flash_erase_async(int offset, int size);

#endif