2014-01-10 18:00:33 +00:00
|
|
|
/*
|
2016-05-25 16:20:20 +01:00
|
|
|
* Copyright (c) 2016, ARM Limited and Contributors. All rights reserved.
|
2014-01-10 18:00:33 +00:00
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions are met:
|
|
|
|
*
|
|
|
|
* Redistributions of source code must retain the above copyright notice, this
|
|
|
|
* list of conditions and the following disclaimer.
|
|
|
|
*
|
|
|
|
* Redistributions in binary form must reproduce the above copyright notice,
|
|
|
|
* this list of conditions and the following disclaimer in the documentation
|
|
|
|
* and/or other materials provided with the distribution.
|
|
|
|
*
|
|
|
|
* Neither the name of ARM nor the names of its contributors may be used
|
|
|
|
* to endorse or promote products derived from this software without specific
|
|
|
|
* prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
|
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
|
|
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
* POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
2016-05-25 16:20:20 +01:00
|
|
|
#ifndef __FIPTOOL_H__
|
|
|
|
#define __FIPTOOL_H__
|
2014-01-10 18:00:33 +00:00
|
|
|
|
2016-05-25 16:20:20 +01:00
|
|
|
#include <stddef.h>
|
2014-01-10 18:00:33 +00:00
|
|
|
#include <stdint.h>
|
|
|
|
|
2017-01-26 18:56:58 +00:00
|
|
|
#include "firmware_image_package.h"
|
2016-05-25 16:20:20 +01:00
|
|
|
#include "uuid.h"
|
2014-01-10 18:00:33 +00:00
|
|
|
|
2016-05-25 16:20:20 +01:00
|
|
|
#define NELEM(x) (sizeof (x) / sizeof *(x))
|
2014-01-10 18:00:33 +00:00
|
|
|
|
2016-05-25 16:20:20 +01:00
|
|
|
enum {
|
2016-11-14 15:54:32 +00:00
|
|
|
DO_UNSPEC = 0,
|
2016-05-25 16:20:20 +01:00
|
|
|
DO_PACK = 1,
|
|
|
|
DO_UNPACK = 2,
|
|
|
|
DO_REMOVE = 3
|
|
|
|
};
|
2014-01-10 18:00:33 +00:00
|
|
|
|
2016-05-25 16:20:20 +01:00
|
|
|
enum {
|
|
|
|
LOG_DBG,
|
|
|
|
LOG_WARN,
|
|
|
|
LOG_ERR
|
|
|
|
};
|
2014-01-10 18:00:33 +00:00
|
|
|
|
2016-11-14 15:54:32 +00:00
|
|
|
typedef struct image_desc {
|
|
|
|
uuid_t uuid;
|
|
|
|
char *name;
|
|
|
|
char *cmdline_name;
|
|
|
|
int action;
|
|
|
|
char *action_arg;
|
2017-02-14 15:22:13 +00:00
|
|
|
struct image *image;
|
2016-11-14 15:54:32 +00:00
|
|
|
struct image_desc *next;
|
|
|
|
} image_desc_t;
|
|
|
|
|
2016-05-25 16:20:20 +01:00
|
|
|
typedef struct image {
|
2017-01-26 18:56:58 +00:00
|
|
|
struct fip_toc_entry toc_e;
|
|
|
|
void *buffer;
|
2016-05-25 16:20:20 +01:00
|
|
|
} image_t;
|
|
|
|
|
|
|
|
typedef struct cmd {
|
2016-11-14 15:54:32 +00:00
|
|
|
char *name;
|
|
|
|
int (*handler)(int, char **);
|
|
|
|
void (*usage)(void);
|
2016-05-25 16:20:20 +01:00
|
|
|
} cmd_t;
|
|
|
|
|
|
|
|
#endif /* __FIPTOOL_H__ */
|