xref: /rk3399_ARM-atf/tools/fiptool/fiptool.h (revision 2a4b4b71ba8a14148708719077d80889faa6f47b)
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 <firmware_image_package.h>
11 
12 #include <stddef.h>
13 #include <stdint.h>
14 
15 #include <uuid.h>
16 
17 #define NELEM(x) (sizeof (x) / sizeof *(x))
18 
19 enum {
20 	DO_UNSPEC = 0,
21 	DO_PACK   = 1,
22 	DO_UNPACK = 2,
23 	DO_REMOVE = 3
24 };
25 
26 enum {
27 	LOG_DBG,
28 	LOG_WARN,
29 	LOG_ERR
30 };
31 
32 typedef struct image_desc {
33 	uuid_t             uuid;
34 	char              *name;
35 	char              *cmdline_name;
36 	int                action;
37 	char              *action_arg;
38 	struct image      *image;
39 	struct image_desc *next;
40 } image_desc_t;
41 
42 typedef struct image {
43 	struct fip_toc_entry toc_e;
44 	void                *buffer;
45 } image_t;
46 
47 typedef struct cmd {
48 	char              *name;
49 	int              (*handler)(int, char **);
50 	void             (*usage)(void);
51 } cmd_t;
52 
53 #endif /* __FIPTOOL_H__ */
54