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