dRonin  adbada4
dRonin firmware
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
pios_flash_priv.h
Go to the documentation of this file.
1 
11 /*
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.
16  *
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
20  * for more details.
21  *
22  * You should have received a copy of the GNU General Public License along
23  * with this program; if not, see <http://www.gnu.org/licenses/>
24  */
25 
26 #ifndef PIOS_FLASH_PRIV_H_
27 #define PIOS_FLASH_PRIV_H_
28 
29 #include <stdint.h>
30 #include "pios_flash.h"
31 
36  int32_t (*start_transaction)(uintptr_t chip_id);
37  int32_t (*end_transaction)(uintptr_t chip_id);
38 
39  int32_t (*erase_sector)(uintptr_t chip_id, uint32_t chip_sector, uint32_t chip_offset);
40  int32_t (*write_data)(uintptr_t chip_id, uint32_t chip_offset, const uint8_t *data, uint16_t len);
41  int32_t (*read_data)(uintptr_t chip_id, uint32_t chip_offset, uint8_t *data, uint16_t len);
42  void *(*get_pointer)(uintptr_t chip_id, uint32_t chip_offset);
43 };
44 
49  uint16_t base_sector;
50  uint16_t last_sector;
51  uint32_t sector_size;
52 };
53 
67  const struct pios_flash_driver *driver;
68  uintptr_t *chip_id;
69  uint32_t page_size;
71  uint32_t num_blocks;
72 };
73 
84  const struct pios_flash_chip *chip_desc;
85  uint16_t first_sector;
86  uint16_t last_sector;
87  uint32_t chip_offset;
88  uint32_t size;
89 };
90 
91 #define FLASH_SECTOR_1KB ( 1 * 1024)
92 #define FLASH_SECTOR_2KB ( 2 * 1024)
93 #define FLASH_SECTOR_4KB ( 4 * 1024)
94 #define FLASH_SECTOR_8KB ( 8 * 1024)
95 #define FLASH_SECTOR_16KB ( 16 * 1024)
96 #define FLASH_SECTOR_32KB ( 32 * 1024)
97 #define FLASH_SECTOR_64KB ( 64 * 1024)
98 #define FLASH_SECTOR_128KB (128 * 1024)
99 
100 extern void PIOS_FLASH_register_partition_table(const struct pios_flash_partition partition_table[], uint8_t num_partitions);
101 
103  struct pios_flash_partition *partition_table,
104  uint8_t partition_table_len,
105  const struct pios_flash_chip *descriptor,
106  struct pios_flash_sector_range *sectors,
107  uint32_t num_bytes);
108 
109 #endif /* PIOS_FLASH_PRIV_H_ */
int32_t(* read_data)(uintptr_t chip_id, uint32_t chip_offset, uint8_t *data, uint16_t len)
const struct pios_flash_sector_range * sector_blocks
int32_t(* erase_sector)(uintptr_t chip_id, uint32_t chip_sector, uint32_t chip_offset)
uintptr_t * chip_id
const struct pios_flash_chip * chip_desc
uint8_t data[XFER_BYTES_PER_PACKET]
Definition: bl_messages.h:129
int32_t(* end_transaction)(uintptr_t chip_id)
void PIOS_FLASH_fixup_partitions_for_capacity(struct pios_flash_partition *partition_table, uint8_t partition_table_len, const struct pios_flash_chip *descriptor, struct pios_flash_sector_range *sectors, uint32_t num_bytes)
int32_t(* write_data)(uintptr_t chip_id, uint32_t chip_offset, const uint8_t *data, uint16_t len)
void PIOS_FLASH_register_partition_table(const struct pios_flash_partition partition_table[], uint8_t num_partitions)
pios_flash_partition_labels
Definition: pios_flash.h:31
const struct pios_flash_driver * driver
enum pios_flash_partition_labels label
int32_t(* start_transaction)(uintptr_t chip_id)