textual
[RRG-proxmark3.git] / client / src / flash.h
blob23dd280797a480b299566bbfd0906f7ce4bd6f70
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 //-----------------------------------------------------------------------------
9 #ifndef __FLASH_H__
10 #define __FLASH_H__
12 #include "common.h"
14 #define FLASH_MAX_FILES 4
15 #define ONE_KB 1024
17 typedef struct {
18 void *data;
19 uint32_t start;
20 uint32_t length;
21 } flash_seg_t;
23 typedef struct {
24 const char *filename;
25 int can_write_bl;
26 int num_segs;
27 flash_seg_t *segments;
28 } flash_file_t;
30 int flash_load(flash_file_t *ctx, const char *name, int can_write_bl, int flash_size);
31 int flash_start_flashing(int enable_bl_writes, char *serial_port_name, uint32_t *max_allowed);
32 int flash_write(flash_file_t *ctx);
33 void flash_free(flash_file_t *ctx);
34 int flash_stop_flashing(void);
35 #endif