a553f267 |
1 | //----------------------------------------------------------------------------- |
2 | // This code is licensed to you under the terms of the GNU GPL, version 2 or, |
3 | // at your option, any later version. See the LICENSE.txt file for the text of |
4 | // the license. |
5 | //----------------------------------------------------------------------------- |
6 | // Flashing utility functions |
7 | //----------------------------------------------------------------------------- |
8 | |
b961ef03 |
9 | #ifndef __FLASH_H__ |
10 | #define __FLASH_H__ |
11 | |
91c38cf7 |
12 | #include <stdint.h> |
8fe1a992 |
13 | #include "elf.h" |
91c38cf7 |
14 | |
8fe1a992 |
15 | typedef struct { |
16 | void *data; |
17 | uint32_t start; |
18 | uint32_t length; |
19 | } flash_seg_t; |
6e4d4ee6 |
20 | |
8fe1a992 |
21 | typedef struct { |
22 | const char *filename; |
23 | int can_write_bl; |
24 | int num_segs; |
25 | flash_seg_t *segments; |
26 | } flash_file_t; |
6e4d4ee6 |
27 | |
8fe1a992 |
28 | int flash_load(flash_file_t *ctx, const char *name, int can_write_bl); |
e12b82d3 |
29 | int flash_start_flashing(int enable_bl_writes,char *serial_port_name); |
8fe1a992 |
30 | int flash_write(flash_file_t *ctx); |
31 | void flash_free(flash_file_t *ctx); |
32 | int flash_stop_flashing(void); |
b961ef03 |
33 | |
34 | #endif |
35 | |