2025-06-24 06:49:51 +02:00
|
|
|
/* SPDX-License-Identifier: BSD-3-Clause */
|
2016-07-08 11:26:26 -07:00
|
|
|
#ifndef __PROGRAM_H__
|
|
|
|
|
#define __PROGRAM_H__
|
|
|
|
|
|
2025-08-26 15:41:40 -05:00
|
|
|
#include <sys/types.h>
|
2016-07-08 11:26:26 -07:00
|
|
|
#include <stdbool.h>
|
2025-08-26 15:41:40 -05:00
|
|
|
#include <stdint.h>
|
2025-08-28 11:26:11 -05:00
|
|
|
#include "list.h"
|
2016-07-08 11:26:26 -07:00
|
|
|
|
|
|
|
|
struct program {
|
2025-06-18 09:39:54 +02:00
|
|
|
unsigned int pages_per_block;
|
|
|
|
|
unsigned int sector_size;
|
|
|
|
|
unsigned int file_offset;
|
2016-07-08 11:26:26 -07:00
|
|
|
const char *filename;
|
|
|
|
|
const char *label;
|
2025-06-18 09:39:54 +02:00
|
|
|
unsigned int num_sectors;
|
2025-09-07 21:18:14 -05:00
|
|
|
int partition;
|
2025-03-27 15:41:03 +01:00
|
|
|
bool sparse;
|
2021-04-29 10:25:55 -05:00
|
|
|
const char *start_sector;
|
2025-06-18 09:39:54 +02:00
|
|
|
unsigned int last_sector;
|
2021-04-15 14:22:15 -05:00
|
|
|
|
|
|
|
|
bool is_nand;
|
|
|
|
|
bool is_erase;
|
2016-07-08 11:26:26 -07:00
|
|
|
|
2025-03-27 15:41:04 +01:00
|
|
|
unsigned int sparse_chunk_type;
|
2025-08-26 15:41:40 -05:00
|
|
|
uint32_t sparse_fill_value;
|
|
|
|
|
off_t sparse_offset;
|
2025-03-27 15:41:04 +01:00
|
|
|
|
2025-09-07 21:18:14 -05:00
|
|
|
const char *gpt_partition;
|
|
|
|
|
|
2025-08-28 11:26:11 -05:00
|
|
|
struct list_head node;
|
2016-07-08 11:26:26 -07:00
|
|
|
};
|
|
|
|
|
|
2025-08-28 11:26:11 -05:00
|
|
|
struct qdl_device;
|
|
|
|
|
|
2025-08-28 13:49:24 -05:00
|
|
|
int program_load(const char *program_file, bool is_nand, bool allow_missing, const char *incdir);
|
|
|
|
|
int program_execute(struct qdl_device *qdl, int (*apply)(struct qdl_device *qdl, struct program *program, int fd));
|
2021-04-15 14:22:15 -05:00
|
|
|
int erase_execute(struct qdl_device *qdl, int (*apply)(struct qdl_device *qdl, struct program *program));
|
2024-12-17 09:53:36 -06:00
|
|
|
int program_find_bootable_partition(bool *multiple_found);
|
2025-04-22 16:01:21 +02:00
|
|
|
int program_is_sec_partition_flashed(void);
|
2025-09-07 20:56:44 -05:00
|
|
|
int program_cmd_add(const char *address, const char *filename);
|
2025-09-07 21:18:14 -05:00
|
|
|
int program_resolve_gpt_deferrals(struct qdl_device *qdl);
|
2025-04-22 16:01:21 +02:00
|
|
|
|
2024-12-13 13:05:57 -06:00
|
|
|
void free_programs(void);
|
2016-07-08 11:26:26 -07:00
|
|
|
|
|
|
|
|
#endif
|