Nico Huber | 34e783a | 2023-02-11 00:30:27 +0100 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the flashprog project. |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or modify |
| 5 | * it under the terms of the GNU General Public License as published by |
| 6 | * the Free Software Foundation; either version 2 of the License, or |
| 7 | * (at your option) any later version. |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | */ |
| 14 | |
| 15 | #ifndef FLASHPROG_CLI_H |
| 16 | #define FLASHPROG_CLI_H |
| 17 | |
| 18 | enum { |
| 19 | OPTION_CHIP = 'c', |
| 20 | OPTION_PROGRAMMER = 'p', |
Nico Huber | d91822a | 2023-02-11 00:43:54 +0100 | [diff] [blame^] | 21 | OPTION_LAYOUT = 'l', |
Nico Huber | e7899a9 | 2023-02-11 00:39:47 +0100 | [diff] [blame] | 22 | |
| 23 | /* Options below have only long option names, i.e. no single char: */ |
| 24 | OPTION_IFD = 0x0100, |
| 25 | OPTION_FMAP, |
| 26 | OPTION_FMAP_FILE, |
| 27 | OPTION_FLASH_CONTENTS, |
| 28 | OPTION_FLASH_NAME, |
| 29 | OPTION_FLASH_SIZE, |
| 30 | OPTION_PROGRESS, |
Nico Huber | 34e783a | 2023-02-11 00:30:27 +0100 | [diff] [blame] | 31 | }; |
| 32 | |
| 33 | struct flash_args { |
| 34 | char *chip; |
| 35 | char *prog_name; |
| 36 | char *prog_args; |
| 37 | }; |
| 38 | |
Nico Huber | d91822a | 2023-02-11 00:43:54 +0100 | [diff] [blame^] | 39 | struct layout_args { |
| 40 | bool ifd; |
| 41 | bool fmap; |
| 42 | char *fmapfile; |
| 43 | char *layoutfile; |
| 44 | }; |
| 45 | |
| 46 | int cli_check_filename(const char *filename, const char *type); |
| 47 | |
Nico Huber | 34e783a | 2023-02-11 00:30:27 +0100 | [diff] [blame] | 48 | int cli_parse_flash_args(struct flash_args *, int opt, const char *optarg); |
Nico Huber | d91822a | 2023-02-11 00:43:54 +0100 | [diff] [blame^] | 49 | int cli_parse_layout_args(struct layout_args *, int opt, const char *optarg); |
Nico Huber | 34e783a | 2023-02-11 00:30:27 +0100 | [diff] [blame] | 50 | |
| 51 | #endif |