1 /*
2  * Copyright (c) 2016-2017, ARM Limited and Contributors. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #ifndef FIPTOOL_H
8 #define FIPTOOL_H
9 
10 #include <stddef.h>
11 #include <stdint.h>
12 
13 #include <firmware_image_package.h>
14 #include <uuid.h>
15 
16 #include "fiptool_platform.h"
17 
18 #define NELEM(x) (sizeof (x) / sizeof *(x))
19 
20 enum {
21 	DO_UNSPEC = 0,
22 	DO_PACK   = 1,
23 	DO_UNPACK = 2,
24 	DO_REMOVE = 3
25 };
26 
27 enum {
28 	LOG_DBG,
29 	LOG_WARN,
30 	LOG_ERR
31 };
32 
33 typedef struct image_desc {
34 	uuid_t             uuid;
35 	char              *name;
36 	char              *cmdline_name;
37 	int                action;
38 	char              *action_arg;
39 	struct image      *image;
40 	struct image_desc *next;
41 } image_desc_t;
42 
43 typedef struct image {
44 	struct fip_toc_entry toc_e;
45 	void                *buffer;
46 } image_t;
47 
48 typedef struct cmd {
49 	char              *name;
50 	int              (*handler)(int, char **);
51 	void             (*usage)(int);
52 } cmd_t;
53 
54 #endif /* FIPTOOL_H */
55