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