2016-07-08 11:26:26 -07:00
|
|
|
#ifndef __PROGRAM_H__
|
|
|
|
|
#define __PROGRAM_H__
|
|
|
|
|
|
|
|
|
|
#include <stdbool.h>
|
2018-11-09 17:33:51 -08:00
|
|
|
#include "qdl.h"
|
2016-07-08 11:26:26 -07:00
|
|
|
|
|
|
|
|
struct program {
|
2021-04-15 14:22:15 -05:00
|
|
|
unsigned pages_per_block;
|
2016-07-08 11:26:26 -07:00
|
|
|
unsigned sector_size;
|
|
|
|
|
unsigned file_offset;
|
|
|
|
|
const char *filename;
|
|
|
|
|
const char *label;
|
|
|
|
|
unsigned num_sectors;
|
|
|
|
|
unsigned partition;
|
2021-04-15 14:20:41 -05:00
|
|
|
unsigned start_sector;
|
2021-04-15 14:22:15 -05:00
|
|
|
unsigned last_sector;
|
|
|
|
|
|
|
|
|
|
bool is_nand;
|
|
|
|
|
bool is_erase;
|
2016-07-08 11:26:26 -07:00
|
|
|
|
|
|
|
|
struct program *next;
|
|
|
|
|
};
|
|
|
|
|
|
2021-04-15 14:22:15 -05:00
|
|
|
int program_load(const char *program_file, bool is_nand);
|
2018-11-09 17:33:51 -08:00
|
|
|
int program_execute(struct qdl_device *qdl, int (*apply)(struct qdl_device *qdl, struct program *program, int fd),
|
2018-03-26 16:55:11 +02:00
|
|
|
const char *incdir);
|
2021-04-15 14:22:15 -05:00
|
|
|
int erase_execute(struct qdl_device *qdl, int (*apply)(struct qdl_device *qdl, struct program *program));
|
2017-11-06 23:21:15 -08:00
|
|
|
int program_find_bootable_partition(void);
|
2016-07-08 11:26:26 -07:00
|
|
|
|
|
|
|
|
#endif
|