2007-10-10 09:12:12 +02:00
|
|
|
#ifdef __ASSEMBLY__
|
|
|
|
#define ASM_CONST_LL(x) (x)
|
|
|
|
#else
|
|
|
|
#define ASM_CONST_LL(x) (x##ULL)
|
|
|
|
#endif
|
|
|
|
|
2017-10-06 14:07:30 +02:00
|
|
|
#define TEST_ADDR_1H ASM_CONST_LL(0xdeadbeef)
|
|
|
|
#define TEST_ADDR_1L ASM_CONST_LL(0x00000000)
|
|
|
|
#define TEST_ADDR_1 ((TEST_ADDR_1H << 32) | TEST_ADDR_1L)
|
|
|
|
#define TEST_SIZE_1H ASM_CONST_LL(0x00000000)
|
|
|
|
#define TEST_SIZE_1L ASM_CONST_LL(0x00100000)
|
|
|
|
#define TEST_SIZE_1 ((TEST_SIZE_1H << 32) | TEST_SIZE_1L)
|
|
|
|
#define TEST_ADDR_2H ASM_CONST_LL(0)
|
|
|
|
#define TEST_ADDR_2L ASM_CONST_LL(123456789)
|
|
|
|
#define TEST_ADDR_2 ((TEST_ADDR_2H << 32) | TEST_ADDR_2L)
|
|
|
|
#define TEST_SIZE_2H ASM_CONST_LL(0)
|
|
|
|
#define TEST_SIZE_2L ASM_CONST_LL(010000)
|
|
|
|
#define TEST_SIZE_2 ((TEST_SIZE_2H << 32) | TEST_SIZE_2L)
|
2007-10-10 09:12:12 +02:00
|
|
|
|
libfdt: Abolish _typed() variants, add _cell() variants
In a number of places through libfdt and its tests, we have *_typed()
macro variants on functions which use gcc's typeof and statement
expression extensions to allow passing literals where the underlying
function takes a buffer and size.
These seemed like a good idea at the time, but in fact they have some
problems. They use typeof and statement expressions, extensions I'd
prefer to avoid for portability. Plus, they have potential gotchas -
although they'll deal with the size of the thing passed, they won't
deal with other representation issues (like endianness) and results
could be very strange if the type of the expression passed isn't what
you think it is.
In fact, the only users of these _typed() macros were when the value
passed is a single cell (32-bit integer). Therefore, this patch
removes all these _typed() macros and replaces them with explicit
_cell() variants which handle a single 32-bit integer, and which also
perform endian convesions as appropriate.
With this in place, it now becomes easy to use standardized big-endian
representation for integer valued properties in the testcases,
regardless of the platform we're running on. We therefore do that,
which has the additional advantage that all the example trees created
during a test run are now byte-for-byte identical regardless of
platform.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2007-11-20 03:35:46 +01:00
|
|
|
#define TEST_VALUE_1 0xdeadbeef
|
|
|
|
#define TEST_VALUE_2 123456789
|
2006-11-27 06:21:28 +01:00
|
|
|
|
2017-10-06 14:07:30 +02:00
|
|
|
#define TEST_VALUE64_1H ASM_CONST_LL(0xdeadbeef)
|
|
|
|
#define TEST_VALUE64_1L ASM_CONST_LL(0x01abcdef)
|
|
|
|
#define TEST_VALUE64_1 ((TEST_VALUE64_1H << 32) | TEST_VALUE64_1L)
|
2012-06-01 06:12:37 +02:00
|
|
|
|
2007-11-12 23:59:38 +01:00
|
|
|
#define PHANDLE_1 0x2000
|
|
|
|
#define PHANDLE_2 0x2001
|
|
|
|
|
2006-11-27 06:21:28 +01:00
|
|
|
#define TEST_STRING_1 "hello world"
|
2007-10-17 04:39:10 +02:00
|
|
|
#define TEST_STRING_2 "nastystring: \a\b\t\n\v\f\r\\\""
|
|
|
|
#define TEST_STRING_3 "\xde\xad\xbe\xef"
|
2006-11-27 06:21:28 +01:00
|
|
|
|
2016-07-29 11:55:48 +02:00
|
|
|
#define TEST_STRING_4_PARTIAL "foobar"
|
|
|
|
#define TEST_STRING_4_RESULT "testfoobar"
|
|
|
|
|
2011-09-09 21:16:30 +02:00
|
|
|
#define TEST_CHAR1 '\r'
|
|
|
|
#define TEST_CHAR2 'b'
|
|
|
|
#define TEST_CHAR3 '\0'
|
|
|
|
#define TEST_CHAR4 '\''
|
|
|
|
#define TEST_CHAR5 '\xff'
|
|
|
|
|
2019-03-27 07:15:52 +01:00
|
|
|
#define TEST_MEMREGION_ADDR 0x12345678
|
|
|
|
#define TEST_MEMREGION_ADDR_HI 0x8765432100000000
|
|
|
|
#define TEST_MEMREGION_SIZE 0x9abcdef0
|
|
|
|
#define TEST_MEMREGION_SIZE_HI 0x0fedcba900000000
|
|
|
|
#define TEST_MEMREGION_SIZE_INC 0x1000
|
|
|
|
|
2006-11-27 06:21:28 +01:00
|
|
|
#ifndef __ASSEMBLY__
|
2017-10-18 07:59:43 +02:00
|
|
|
extern struct fdt_header test_tree1;
|
|
|
|
extern struct fdt_header truncated_property;
|
|
|
|
extern struct fdt_header bad_node_char;
|
|
|
|
extern struct fdt_header bad_node_format;
|
|
|
|
extern struct fdt_header bad_prop_char;
|
|
|
|
extern struct fdt_header ovf_size_strings;
|
2017-11-14 12:45:56 +01:00
|
|
|
extern struct fdt_header truncated_string;
|
2018-03-09 13:28:56 +01:00
|
|
|
extern struct fdt_header truncated_memrsv;
|
2021-03-23 01:09:25 +01:00
|
|
|
extern struct fdt_header two_roots;
|
2021-03-23 02:04:10 +01:00
|
|
|
extern struct fdt_header named_root;
|
2006-11-27 06:21:28 +01:00
|
|
|
#endif /* ! __ASSEMBLY */
|