1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
// SPDX-License-Identifier: GPL-2.0+
/*
* (C) Copyright 2015
* Texas Instruments Incorporated - http://www.ti.com/
*/
#include <common.h>
#include <dm.h>
#include <errno.h>
#include <remoteproc.h>
#include <dm/test.h>
#include <test/ut.h>
/**
* dm_test_remoteproc_base() - test the operations after initializations
* @uts: unit test state
*
* Return: 0 if test passed, else error
*/
static int dm_test_remoteproc_base(struct unit_test_state *uts)
{
if (!rproc_is_initialized())
ut_assertok(rproc_init());
/* Ensure we are initialized */
ut_asserteq(true, rproc_is_initialized());
/* platform data device 1 */
ut_assertok(rproc_stop(0));
ut_assertok(rproc_reset(0));
/* -> invalid attempt tests */
ut_asserteq(-EINVAL, rproc_start(0));
ut_asserteq(-EINVAL, rproc_ping(0));
/* Valid tests */
ut_assertok(rproc_load(0, 1, 0));
ut_assertok(rproc_start(0));
ut_assertok(rproc_is_running(0));
ut_assertok(rproc_ping(0));
ut_assertok(rproc_reset(0));
ut_assertok(rproc_stop(0));
/* dt device device 1 */
ut_assertok(rproc_stop(1));
ut_assertok(rproc_reset(1));
ut_assertok(rproc_load(1, 1, 0));
ut_assertok(rproc_start(1));
ut_assertok(rproc_is_running(1));
ut_assertok(rproc_ping(1));
ut_assertok(rproc_reset(1));
ut_assertok(rproc_stop(1));
/* dt device device 2 */
ut_assertok(rproc_stop(0));
ut_assertok(rproc_reset(0));
/* -> invalid attempt tests */
ut_asserteq(-EINVAL, rproc_start(0));
ut_asserteq(-EINVAL, rproc_ping(0));
/* Valid tests */
ut_assertok(rproc_load(2, 1, 0));
ut_assertok(rproc_start(2));
ut_assertok(rproc_is_running(2));
ut_assertok(rproc_ping(2));
ut_assertok(rproc_reset(2));
ut_assertok(rproc_stop(2));
return 0;
}
DM_TEST(dm_test_remoteproc_base, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
|