]> Git Repo - J-u-boot.git/blame - test/dm/mailbox.c
dm: core: Create a new header file for 'compat' features
[J-u-boot.git] / test / dm / mailbox.c
CommitLineData
83d290c5 1// SPDX-License-Identifier: GPL-2.0
8961b524
SW
2/*
3 * Copyright (c) 2016, NVIDIA CORPORATION.
8961b524
SW
4 */
5
6#include <common.h>
7#include <dm.h>
336d4615 8#include <malloc.h>
8961b524
SW
9#include <dm/test.h>
10#include <asm/mbox.h>
11#include <test/ut.h>
12
13static int dm_test_mailbox(struct unit_test_state *uts)
14{
15 struct udevice *dev;
16 uint32_t msg;
17
18 ut_assertok(uclass_get_device_by_name(UCLASS_MISC, "mbox-test", &dev));
19 ut_assertok(sandbox_mbox_test_get(dev));
20
21 ut_asserteq(-ETIMEDOUT, sandbox_mbox_test_recv(dev, &msg));
22 ut_assertok(sandbox_mbox_test_send(dev, 0xaaff9955UL));
23 ut_assertok(sandbox_mbox_test_recv(dev, &msg));
24 ut_asserteq(msg, 0xaaff9955UL ^ SANDBOX_MBOX_PING_XOR);
25 ut_asserteq(-ETIMEDOUT, sandbox_mbox_test_recv(dev, &msg));
26
27 ut_assertok(sandbox_mbox_test_free(dev));
28
29 return 0;
30}
31DM_TEST(dm_test_mailbox, DM_TESTF_SCAN_FDT);
This page took 0.18966 seconds and 4 git commands to generate.