2010-02-21 08:47:22 +08:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// This code is licensed to you under the terms of the GNU GPL, version 2 or,
|
|
|
|
// at your option, any later version. See the LICENSE.txt file for the text of
|
|
|
|
// the license.
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// Flashing utility functions
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2010-01-05 20:32:44 +08:00
|
|
|
#ifndef __FLASH_H__
|
|
|
|
#define __FLASH_H__
|
|
|
|
|
2019-08-08 22:57:33 +08:00
|
|
|
#include "common.h"
|
2010-02-20 08:36:48 +08:00
|
|
|
|
2019-09-09 07:07:46 +08:00
|
|
|
#define FLASH_MAX_FILES 4
|
|
|
|
#define ONE_KB 1024
|
|
|
|
|
2010-02-26 22:03:43 +08:00
|
|
|
typedef struct {
|
2019-03-10 06:35:06 +08:00
|
|
|
void *data;
|
|
|
|
uint32_t start;
|
|
|
|
uint32_t length;
|
2010-02-26 22:03:43 +08:00
|
|
|
} flash_seg_t;
|
2010-01-04 13:11:08 +08:00
|
|
|
|
2010-02-26 22:03:43 +08:00
|
|
|
typedef struct {
|
2019-03-10 06:35:06 +08:00
|
|
|
const char *filename;
|
|
|
|
int can_write_bl;
|
|
|
|
int num_segs;
|
|
|
|
flash_seg_t *segments;
|
2010-02-26 22:03:43 +08:00
|
|
|
} flash_file_t;
|
2010-01-04 13:11:08 +08:00
|
|
|
|
2019-07-19 03:18:52 +08:00
|
|
|
int flash_load(flash_file_t *ctx, const char *name, int can_write_bl, int flash_size);
|
2019-07-20 04:59:51 +08:00
|
|
|
int flash_start_flashing(int enable_bl_writes, char *serial_port_name, uint32_t *max_allowed);
|
2010-02-26 22:03:43 +08:00
|
|
|
int flash_write(flash_file_t *ctx);
|
|
|
|
void flash_free(flash_file_t *ctx);
|
|
|
|
int flash_stop_flashing(void);
|
2010-01-05 20:32:44 +08:00
|
|
|
#endif
|
|
|
|
|