2 ******************************************************************************
4 * @author PhoenixPilot, http://github.com/PhoenixPilot, Copyright (C) 2012
5 * @addtogroup PIOS PIOS Core hardware abstraction layer
7 * @addtogroup PIOS_FLASH Flash Driver API Definition
9 * @brief Flash Driver API Definition
10 *****************************************************************************/
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 3 of the License, or
15 * (at your option) any later version.
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
19 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 * You should have received a copy of the GNU General Public License along
23 * with this program; if not, write to the Free Software Foundation, Inc.,
24 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
32 struct pios_flash_chunk
{
37 struct pios_flash_driver
{
38 int32_t (*start_transaction
)(uintptr_t flash_id
);
39 int32_t (*end_transaction
)(uintptr_t flash_id
);
40 int32_t (*erase_chip
)(uintptr_t flash_id
);
41 int32_t (*erase_sector
)(uintptr_t flash_id
, uint32_t addr
);
42 int32_t (*write_data
)(uintptr_t flash_id
, uint32_t addr
, uint8_t *data
, uint16_t len
);
43 int32_t (*write_chunks
)(uintptr_t flash_id
, uint32_t addr
, struct pios_flash_chunk chunks
[], uint32_t num_chunks
);
44 int32_t (*rewrite_data
)(uintptr_t flash_id
, uint32_t addr
, uint8_t *data
, uint16_t len
);
45 int32_t (*rewrite_chunks
)(uintptr_t flash_id
, uint32_t addr
, struct pios_flash_chunk chunks
[], uint32_t num_chunks
);
46 int32_t (*read_data
)(uintptr_t flash_id
, uint32_t addr
, uint8_t *data
, uint16_t len
);
49 #endif /* PIOS_FLASH_H */