Harry Liebel | f58ad36 | 2014-01-10 18:00:33 +0000 | [diff] [blame] | 1 | /* |
Masahiro Yamada | e3a2b31 | 2017-05-08 18:29:03 +0900 | [diff] [blame] | 2 | * Copyright (c) 2016-2017, ARM Limited and Contributors. All rights reserved. |
Harry Liebel | f58ad36 | 2014-01-10 18:00:33 +0000 | [diff] [blame] | 3 | * |
dp-arm | fa3cf0b | 2017-05-03 09:38:09 +0100 | [diff] [blame] | 4 | * SPDX-License-Identifier: BSD-3-Clause |
Harry Liebel | f58ad36 | 2014-01-10 18:00:33 +0000 | [diff] [blame] | 5 | */ |
6 | |||||
dp-arm | 4972ec5 | 2016-05-25 16:20:20 +0100 | [diff] [blame] | 7 | #ifndef __FIPTOOL_H__ |
8 | #define __FIPTOOL_H__ | ||||
Harry Liebel | f58ad36 | 2014-01-10 18:00:33 +0000 | [diff] [blame] | 9 | |
dp-arm | 4972ec5 | 2016-05-25 16:20:20 +0100 | [diff] [blame] | 10 | #include <stddef.h> |
Harry Liebel | f58ad36 | 2014-01-10 18:00:33 +0000 | [diff] [blame] | 11 | #include <stdint.h> |
Harry Liebel | f58ad36 | 2014-01-10 18:00:33 +0000 | [diff] [blame] | 12 | |
Isla Mitchell | 751f56b | 2017-07-14 10:46:32 +0100 | [diff] [blame] | 13 | #include <firmware_image_package.h> |
Masahiro Yamada | e3a2b31 | 2017-05-08 18:29:03 +0900 | [diff] [blame] | 14 | #include <uuid.h> |
Harry Liebel | f58ad36 | 2014-01-10 18:00:33 +0000 | [diff] [blame] | 15 | |
Evan Lloyd | 04dc344 | 2017-05-25 19:06:47 +0100 | [diff] [blame] | 16 | #include "fiptool_platform.h" |
17 | |||||
dp-arm | 4972ec5 | 2016-05-25 16:20:20 +0100 | [diff] [blame] | 18 | #define NELEM(x) (sizeof (x) / sizeof *(x)) |
Harry Liebel | f58ad36 | 2014-01-10 18:00:33 +0000 | [diff] [blame] | 19 | |
dp-arm | 4972ec5 | 2016-05-25 16:20:20 +0100 | [diff] [blame] | 20 | enum { |
dp-arm | 90d2f0e | 2016-11-14 15:54:32 +0000 | [diff] [blame] | 21 | DO_UNSPEC = 0, |
dp-arm | 4972ec5 | 2016-05-25 16:20:20 +0100 | [diff] [blame] | 22 | DO_PACK = 1, |
23 | DO_UNPACK = 2, | ||||
24 | DO_REMOVE = 3 | ||||
25 | }; | ||||
Harry Liebel | f58ad36 | 2014-01-10 18:00:33 +0000 | [diff] [blame] | 26 | |
dp-arm | 4972ec5 | 2016-05-25 16:20:20 +0100 | [diff] [blame] | 27 | enum { |
28 | LOG_DBG, | ||||
29 | LOG_WARN, | ||||
30 | LOG_ERR | ||||
31 | }; | ||||
32 | |||||
dp-arm | 90d2f0e | 2016-11-14 15:54:32 +0000 | [diff] [blame] | 33 | typedef struct image_desc { |
34 | uuid_t uuid; | ||||
35 | char *name; | ||||
36 | char *cmdline_name; | ||||
37 | int action; | ||||
38 | char *action_arg; | ||||
dp-arm | afa1efa | 2017-02-14 15:22:13 +0000 | [diff] [blame] | 39 | struct image *image; |
dp-arm | 90d2f0e | 2016-11-14 15:54:32 +0000 | [diff] [blame] | 40 | struct image_desc *next; |
41 | } image_desc_t; | ||||
42 | |||||
dp-arm | 4972ec5 | 2016-05-25 16:20:20 +0100 | [diff] [blame] | 43 | typedef struct image { |
Masahiro Yamada | 2fe0dad | 2017-01-27 03:56:58 +0900 | [diff] [blame] | 44 | struct fip_toc_entry toc_e; |
45 | void *buffer; | ||||
dp-arm | 4972ec5 | 2016-05-25 16:20:20 +0100 | [diff] [blame] | 46 | } image_t; |
47 | |||||
48 | typedef struct cmd { | ||||
dp-arm | 90d2f0e | 2016-11-14 15:54:32 +0000 | [diff] [blame] | 49 | char *name; |
50 | int (*handler)(int, char **); | ||||
51 | void (*usage)(void); | ||||
dp-arm | 4972ec5 | 2016-05-25 16:20:20 +0100 | [diff] [blame] | 52 | } cmd_t; |
Harry Liebel | f58ad36 | 2014-01-10 18:00:33 +0000 | [diff] [blame] | 53 | |
dp-arm | 4972ec5 | 2016-05-25 16:20:20 +0100 | [diff] [blame] | 54 | #endif /* __FIPTOOL_H__ */ |