fiptool.h 932 Bytes
Newer Older
1
/*
2
 * Copyright (c) 2016-2017, ARM Limited and Contributors. All rights reserved.
3
 *
dp-arm's avatar
dp-arm committed
4
 * SPDX-License-Identifier: BSD-3-Clause
5
6
 */

dp-arm's avatar
dp-arm committed
7
8
#ifndef __FIPTOOL_H__
#define __FIPTOOL_H__
9

dp-arm's avatar
dp-arm committed
10
#include <stddef.h>
11
12
#include <stdint.h>

13
14
#include <firmware_image_package.h>
#include <uuid.h>
15

dp-arm's avatar
dp-arm committed
16
#define NELEM(x) (sizeof (x) / sizeof *(x))
17

dp-arm's avatar
dp-arm committed
18
enum {
19
	DO_UNSPEC = 0,
dp-arm's avatar
dp-arm committed
20
21
22
23
	DO_PACK   = 1,
	DO_UNPACK = 2,
	DO_REMOVE = 3
};
24

dp-arm's avatar
dp-arm committed
25
26
27
28
29
enum {
	LOG_DBG,
	LOG_WARN,
	LOG_ERR
};
30

31
32
33
34
35
36
typedef struct image_desc {
	uuid_t             uuid;
	char              *name;
	char              *cmdline_name;
	int                action;
	char              *action_arg;
37
	struct image      *image;
38
39
40
	struct image_desc *next;
} image_desc_t;

dp-arm's avatar
dp-arm committed
41
typedef struct image {
42
43
	struct fip_toc_entry toc_e;
	void                *buffer;
dp-arm's avatar
dp-arm committed
44
45
46
} image_t;

typedef struct cmd {
47
48
49
	char              *name;
	int              (*handler)(int, char **);
	void             (*usage)(void);
dp-arm's avatar
dp-arm committed
50
51
52
} cmd_t;

#endif /* __FIPTOOL_H__ */