Files
qdl/program.h
Bjorn Andersson dff2ed7a72 qdl: Add "read" and "write" commands
There are a number of scenarios where one just want to write a binary
file directly to some specific location on the target, such as writing a
full disk image to LUN 0. Similarily (although not as frequent) one just
want to dump a few sectors of data for inspection.

So far the recommended way to do this has been to craft a program.xml
or a read.xml file and feed to QDL, but this is annoying.

Add support for writing/reading binary data straight to/from the device
by the means of just specifying the "write" or "read" commands on the
QDL commandline, e.g.:

  qdl prog_firehose.elf write 0 debian.img

Signed-off-by: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
2025-09-09 16:18:12 -05:00

43 lines
1.1 KiB
C

/* SPDX-License-Identifier: BSD-3-Clause */
#ifndef __PROGRAM_H__
#define __PROGRAM_H__
#include <sys/types.h>
#include <stdbool.h>
#include <stdint.h>
#include "qdl.h"
struct program {
unsigned int pages_per_block;
unsigned int sector_size;
unsigned int file_offset;
const char *filename;
const char *label;
unsigned int num_sectors;
unsigned int partition;
bool sparse;
const char *start_sector;
unsigned int last_sector;
bool is_nand;
bool is_erase;
unsigned int sparse_chunk_type;
uint32_t sparse_fill_value;
off_t sparse_offset;
struct program *next;
};
int program_load(const char *program_file, bool is_nand);
int program_execute(struct qdl_device *qdl, int (*apply)(struct qdl_device *qdl, struct program *program, int fd),
const char *incdir, bool allow_missing);
int erase_execute(struct qdl_device *qdl, int (*apply)(struct qdl_device *qdl, struct program *program));
int program_find_bootable_partition(bool *multiple_found);
int program_is_sec_partition_flashed(void);
int program_cmd_add(const char *address, const char *filename);
void free_programs(void);
#endif