Rob Herring | c4ffc05 | 2019-06-20 15:19:41 -0600 | [diff] [blame] | 1 | // SPDX-License-Identifier: LGPL-2.1-or-later |
Anton Staaf | a4ea2fa | 2011-09-09 12:16:30 -0700 | [diff] [blame] | 2 | /* |
| 3 | * libfdt - Flat Device Tree manipulation |
| 4 | * Testcase for character literals in dtc |
| 5 | * Copyright (C) 2006 David Gibson, IBM Corporation. |
| 6 | * Copyright (C) 2011 The Chromium Authors. All rights reserved. |
Anton Staaf | a4ea2fa | 2011-09-09 12:16:30 -0700 | [diff] [blame] | 7 | */ |
| 8 | #include <stdlib.h> |
| 9 | #include <stdio.h> |
| 10 | #include <string.h> |
| 11 | #include <stdint.h> |
| 12 | |
Anton Staaf | a4ea2fa | 2011-09-09 12:16:30 -0700 | [diff] [blame] | 13 | #include <libfdt.h> |
| 14 | |
| 15 | #include "tests.h" |
| 16 | #include "testdata.h" |
| 17 | |
| 18 | int main(int argc, char *argv[]) |
| 19 | { |
| 20 | void *fdt; |
David Gibson | bad5b28 | 2017-03-06 12:08:53 +1100 | [diff] [blame] | 21 | fdt32_t expected_cells[5]; |
Anton Staaf | a4ea2fa | 2011-09-09 12:16:30 -0700 | [diff] [blame] | 22 | |
| 23 | expected_cells[0] = cpu_to_fdt32((unsigned char)TEST_CHAR1); |
| 24 | expected_cells[1] = cpu_to_fdt32((unsigned char)TEST_CHAR2); |
| 25 | expected_cells[2] = cpu_to_fdt32((unsigned char)TEST_CHAR3); |
| 26 | expected_cells[3] = cpu_to_fdt32((unsigned char)TEST_CHAR4); |
| 27 | expected_cells[4] = cpu_to_fdt32((unsigned char)TEST_CHAR5); |
| 28 | |
| 29 | test_init(argc, argv); |
| 30 | fdt = load_blob_arg(argc, argv); |
| 31 | |
| 32 | check_getprop(fdt, 0, "char-literal-cells", |
| 33 | sizeof(expected_cells), expected_cells); |
| 34 | |
| 35 | PASS(); |
| 36 | } |