Anton Staaf | a4ea2fa | 2011-09-09 12:16:30 -0700 | [diff] [blame] | 1 | /* |
| 2 | * libfdt - Flat Device Tree manipulation |
| 3 | * Testcase for character literals in dtc |
| 4 | * Copyright (C) 2006 David Gibson, IBM Corporation. |
| 5 | * Copyright (C) 2011 The Chromium Authors. All rights reserved. |
| 6 | * |
| 7 | * This library is free software; you can redistribute it and/or |
| 8 | * modify it under the terms of the GNU Lesser General Public License |
| 9 | * as published by the Free Software Foundation; either version 2.1 of |
| 10 | * the License, or (at your option) any later version. |
| 11 | * |
| 12 | * This library is distributed in the hope that it will be useful, but |
| 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 | * Lesser General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU Lesser General Public |
| 18 | * License along with this library; if not, write to the Free Software |
| 19 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 20 | */ |
| 21 | #include <stdlib.h> |
| 22 | #include <stdio.h> |
| 23 | #include <string.h> |
| 24 | #include <stdint.h> |
| 25 | |
| 26 | #include <fdt.h> |
| 27 | #include <libfdt.h> |
| 28 | |
| 29 | #include "tests.h" |
| 30 | #include "testdata.h" |
| 31 | |
| 32 | int main(int argc, char *argv[]) |
| 33 | { |
| 34 | void *fdt; |
| 35 | uint32_t expected_cells[5]; |
| 36 | |
| 37 | expected_cells[0] = cpu_to_fdt32((unsigned char)TEST_CHAR1); |
| 38 | expected_cells[1] = cpu_to_fdt32((unsigned char)TEST_CHAR2); |
| 39 | expected_cells[2] = cpu_to_fdt32((unsigned char)TEST_CHAR3); |
| 40 | expected_cells[3] = cpu_to_fdt32((unsigned char)TEST_CHAR4); |
| 41 | expected_cells[4] = cpu_to_fdt32((unsigned char)TEST_CHAR5); |
| 42 | |
| 43 | test_init(argc, argv); |
| 44 | fdt = load_blob_arg(argc, argv); |
| 45 | |
| 46 | check_getprop(fdt, 0, "char-literal-cells", |
| 47 | sizeof(expected_cells), expected_cells); |
| 48 | |
| 49 | PASS(); |
| 50 | } |