Deleted Added
full compact
dtc.h (204431) dtc.h (204433)
1#ifndef _DTC_H
2#define _DTC_H
3
4/*
5 * (C) Copyright David Gibson <dwg@au1.ibm.com>, IBM Corporation. 2005.
6 *
7 *
8 * This program is free software; you can redistribute it and/or

--- 20 unchanged lines hidden (view full) ---

29#include <assert.h>
30#include <ctype.h>
31#include <errno.h>
32#include <unistd.h>
33
34#include <libfdt_env.h>
35#include <fdt.h>
36
1#ifndef _DTC_H
2#define _DTC_H
3
4/*
5 * (C) Copyright David Gibson <dwg@au1.ibm.com>, IBM Corporation. 2005.
6 *
7 *
8 * This program is free software; you can redistribute it and/or

--- 20 unchanged lines hidden (view full) ---

29#include <assert.h>
30#include <ctype.h>
31#include <errno.h>
32#include <unistd.h>
33
34#include <libfdt_env.h>
35#include <fdt.h>
36
37#include "util.h"
38
39#ifdef DEBUG
40#define debug(fmt,args...) printf(fmt, ##args)
41#else
42#define debug(fmt,args...)
43#endif
44
45
37#define DEFAULT_FDT_VERSION 17
46#define DEFAULT_FDT_VERSION 17
47
38/*
39 * Command line options
40 */
41extern int quiet; /* Level of quietness */
42extern int reservenum; /* Number of memory reservation slots */
43extern int minsize; /* Minimum blob size */
44extern int padsize; /* Additional padding to blob */
48/*
49 * Command line options
50 */
51extern int quiet; /* Level of quietness */
52extern int reservenum; /* Number of memory reservation slots */
53extern int minsize; /* Minimum blob size */
54extern int padsize; /* Additional padding to blob */
55extern int phandle_format; /* Use linux,phandle or phandle properties */
45
56
46static inline void __attribute__((noreturn)) die(char * str, ...)
47{
48 va_list ap;
57#define PHANDLE_LEGACY 0x1
58#define PHANDLE_EPAPR 0x2
59#define PHANDLE_BOTH 0x3
49
60
50 va_start(ap, str);
51 fprintf(stderr, "FATAL ERROR: ");
52 vfprintf(stderr, str, ap);
53 exit(1);
54}
55
56static inline void *xmalloc(size_t len)
57{
58 void *new = malloc(len);
59
60 if (! new)
61 die("malloc() failed\n");
62
63 return new;
64}
65
66static inline void *xrealloc(void *p, size_t len)
67{
68 void *new = realloc(p, len);
69
70 if (! new)
71 die("realloc() failed (len=%d)\n", len);
72
73 return new;
74}
75
76typedef uint32_t cell_t;
77
78
79#define streq(a, b) (strcmp((a), (b)) == 0)
80#define strneq(a, b, n) (strncmp((a), (b), (n)) == 0)
81
82#define ALIGN(x, a) (((x) + (a) - 1) & ~((a) - 1))
83#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))

--- 163 unchanged lines hidden ---
61typedef uint32_t cell_t;
62
63
64#define streq(a, b) (strcmp((a), (b)) == 0)
65#define strneq(a, b, n) (strncmp((a), (b), (n)) == 0)
66
67#define ALIGN(x, a) (((x) + (a) - 1) & ~((a) - 1))
68#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))

--- 163 unchanged lines hidden ---