fiptool.h 933 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

Isla Mitchell's avatar
Isla Mitchell committed
10
11
#include <firmware_image_package.h>

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

15
#include <uuid.h>
16

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

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

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

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

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

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

#endif /* __FIPTOOL_H__ */