1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-07-02 06:23:18 +02:00

Move the CLI related functions main() and cli_usage() to cli_classic.c

And rename them accordingly. For now, main() just calls cli_classic(),
but alternative frontends can be switched in main().
Annotate remaining help texts with CLI dependency inside flashrom.c with
a FIXME comment.

Now people can go and create different frontends and be happy. Please
note that any other frontend will have to sort of duplicate the probing
code in cli_classic.c. Refactoring that part of the code is possible,
but not easy because we still want to print instructive help messages
for users.

Corresponding to flashrom svn r833.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Sean Nelson <audiohacked@gmail.com>
This commit is contained in:
Carl-Daniel Hailfinger
2010-01-07 03:24:05 +00:00
parent e48654cf70
commit a84835a7ea
4 changed files with 401 additions and 353 deletions

10
flash.h
View File

@ -482,21 +482,31 @@ extern char *programmer_param;
extern unsigned long flashbase;
extern int verbose;
extern const char *flashrom_version;
extern char *chip_to_probe;
#define printf_debug(x...) { if (verbose) printf(x); }
void map_flash_registers(struct flashchip *flash);
int read_memmapped(struct flashchip *flash, uint8_t *buf, int start, int len);
int erase_flash(struct flashchip *flash);
struct flashchip *probe_flash(struct flashchip *first_flash, int force);
int read_flash(struct flashchip *flash, char *filename);
void check_chip_supported(struct flashchip *flash);
int check_max_decode(enum chipbustype buses, uint32_t size);
int min(int a, int b);
int max(int a, int b);
char *extract_param(char **haystack, char *needle, char *delim);
int check_erased_range(struct flashchip *flash, int start, int len);
int verify_range(struct flashchip *flash, uint8_t *cmpbuf, int start, int len, char *message);
char *strcat_realloc(char *dest, const char *src);
void print_version(void);
int selfcheck(void);
int doit(struct flashchip *flash, int force, char *filename, int read_it, int write_it, int erase_it, int verify_it);
#define OK 0
#define NT 1 /* Not tested */
/* cli_classic.c */
int cli_classic(int argc, char *argv[]);
/* layout.c */
int show_id(uint8_t *bios, int size, int force);
int read_romlayout(char *name);