summaryrefslogtreecommitdiffstats
path: root/flash.h
blob: 44f5155497a52695a9e505e5ac64a636c049cebe (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
/* SPDX-License-Identifier: Apache-2.0 */
/* Copyright (C) 2018 IBM Corp. */

#ifndef FLASH_H
#define FLASH_H

#include <stdint.h>

#define FLASH_DIRTY	0x00
#define FLASH_ERASED	0x01

/* Estimate as to how long (milliseconds) it takes to access a MB from flash */
#define FLASH_ACCESS_MS_PER_MB		8000

struct mbox_context;

int flash_dev_init(struct mbox_context *context);
void flash_dev_free(struct mbox_context *context);
int64_t flash_copy(struct mbox_context *context, uint32_t offset, void *mem,
		   uint32_t size);
int flash_set_bytemap(struct mbox_context *context, uint32_t offset,
		      uint32_t count, uint8_t val);
int flash_erase(struct mbox_context *context, uint32_t offset, uint32_t count);
int flash_write(struct mbox_context *context, uint32_t offset, void *buf,
		uint32_t count);

#endif /* FLASH_H */
OpenPOWER on IntegriCloud