blob: 4fe4079f1f5879db3194a61c2733c48414e0b8df [file] [log] [blame]
Duy Truong790f06d2013-02-13 16:38:12 -08001/* Copyright (c) 2008-2009, The Linux Foundation. All rights reserved.
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 */
13/*
14 * DAL remote test device API.
15 */
16
17#include <linux/kernel.h>
18
19#include <mach/dal.h>
20
21#define REMOTE_UNITTEST_DEVICEID 0xDA1DA1DA
22
23enum {
24 DALRPC_TEST_API_0 = DALDEVICE_FIRST_DEVICE_API_IDX,
25 DALRPC_TEST_API_1,
26 DALRPC_TEST_API_2,
27 DALRPC_TEST_API_3,
28 DALRPC_TEST_API_4,
29 DALRPC_TEST_API_5,
30 DALRPC_TEST_API_6,
31 DALRPC_TEST_API_7,
32 DALRPC_TEST_API_8,
33 DALRPC_TEST_API_9,
34 DALRPC_TEST_API_10,
35 DALRPC_TEST_API_11,
36 DALRPC_TEST_API_12,
37 DALRPC_TEST_API_13,
38 DALRPC_TEST_API_14,
39 DALRPC_TEST_API_15,
40 DALRPC_TEST_API_16,
41 DALRPC_TEST_API_17
42};
43
44#define REMOTE_UNITTEST_INARG_1 0x01010101
45#define REMOTE_UNITTEST_INARG_2 0x20202020
46#define REMOTE_UNITTEST_INARG_3 0x12121212
47#define REMOTE_UNITTEST_INPUT_HANDLE 0xDA1FDA1F
48#define REMOTE_UNITTEST_OUTARG_1 0xBEEFDEAD
49
50#define REMOTE_UNITTEST_REGULAR_EVENT 0
51#define REMOTE_UNITTEST_CALLBACK_EVENT 1
52
53#define REMOTE_UNITTEST_BAD_PARAM 0x10
54
55struct remote_test_data {
56 uint32_t regular_event;
57 uint32_t test[32];
58 uint32_t payload_event;
59};
60
61static int remote_unittest_0(void *handle, uint32_t s1)
62{
63 return dalrpc_fcn_0(DALRPC_TEST_API_0, handle, s1);
64}
65
66static int remote_unittest_1(void *handle, uint32_t s1, uint32_t s2)
67{
68 return dalrpc_fcn_1(DALRPC_TEST_API_1, handle, s1, s2);
69}
70
71static int remote_unittest_2(void *handle, uint32_t s1, uint32_t *p_s2)
72{
73 return dalrpc_fcn_2(DALRPC_TEST_API_2, handle, s1, p_s2);
74}
75
76static int remote_unittest_3(void *handle, uint32_t s1, uint32_t s2,
77 uint32_t s3)
78{
79 return dalrpc_fcn_3(DALRPC_TEST_API_3, handle, s1, s2, s3);
80}
81
82static int remote_unittest_4(void *handle, uint32_t s1, uint32_t s2,
83 uint32_t *p_s3)
84{
85 return dalrpc_fcn_4(DALRPC_TEST_API_4, handle, s1, s2, p_s3);
86}
87
88static int remote_unittest_5(void *handle, const void *ibuf, uint32_t ilen)
89{
90 return dalrpc_fcn_5(DALRPC_TEST_API_5, handle, ibuf, ilen);
91}
92
93static int remote_unittest_6(void *handle, uint32_t s1, const void *ibuf,
94 uint32_t ilen)
95{
96 return dalrpc_fcn_6(DALRPC_TEST_API_6, handle, s1, ibuf, ilen);
97}
98
99static int remote_unittest_7(void *handle, const void *ibuf, uint32_t ilen,
100 void *obuf, uint32_t olen, uint32_t *oalen)
101{
102 return dalrpc_fcn_7(DALRPC_TEST_API_7, handle, ibuf, ilen, obuf,
103 olen, oalen);
104}
105
106static int remote_unittest_8(void *handle, const void *ibuf, uint32_t ilen,
107 void *obuf, uint32_t olen)
108{
109 return dalrpc_fcn_8(DALRPC_TEST_API_8, handle, ibuf, ilen, obuf, olen);
110}
111
112static int remote_unittest_9(void *handle, void *obuf, uint32_t olen)
113{
114 return dalrpc_fcn_9(DALRPC_TEST_API_9, handle, obuf, olen);
115}
116
117static int remote_unittest_10(void *handle, uint32_t s1, const void *ibuf,
118 uint32_t ilen, void *obuf, uint32_t olen,
119 uint32_t *oalen)
120{
121 return dalrpc_fcn_10(DALRPC_TEST_API_10, handle, s1, ibuf, ilen, obuf,
122 olen, oalen);
123}
124
125static int remote_unittest_11(void *handle, uint32_t s1, void *obuf,
126 uint32_t olen)
127{
128 return dalrpc_fcn_11(DALRPC_TEST_API_11, handle, s1, obuf, olen);
129}
130
131static int remote_unittest_12(void *handle, uint32_t s1, void *obuf,
132 uint32_t olen, uint32_t *oalen)
133{
134 return dalrpc_fcn_12(DALRPC_TEST_API_12, handle, s1, obuf, olen,
135 oalen);
136}
137
138static int remote_unittest_13(void *handle, const void *ibuf, uint32_t ilen,
139 const void *ibuf2, uint32_t ilen2, void *obuf,
140 uint32_t olen)
141{
142 return dalrpc_fcn_13(DALRPC_TEST_API_13, handle, ibuf, ilen, ibuf2,
143 ilen2, obuf, olen);
144}
145
146static int remote_unittest_14(void *handle, const void *ibuf, uint32_t ilen,
147 void *obuf, uint32_t olen, void *obuf2,
148 uint32_t olen2, uint32_t *oalen2)
149{
150 return dalrpc_fcn_14(DALRPC_TEST_API_14, handle, ibuf, ilen, obuf,
151 olen, obuf2, olen2, oalen2);
152}
153
154static int remote_unittest_15(void *handle, const void *ibuf, uint32_t ilen,
155 const void *ibuf2, uint32_t ilen2, void *obuf,
156 uint32_t olen, uint32_t *oalen, void *obuf2,
157 uint32_t olen2)
158{
159 return dalrpc_fcn_15(DALRPC_TEST_API_15, handle, ibuf, ilen, ibuf2,
160 ilen2, obuf, olen, oalen, obuf2, olen2);
161}
162
163static int remote_unittest_eventcfg(void *handle, const void *ibuf,
164 uint32_t ilen)
165{
166 return dalrpc_fcn_5(DALRPC_TEST_API_16, handle, ibuf, ilen);
167}
168
169static int remote_unittest_eventtrig(void *handle, uint32_t event_idx)
170{
171 return dalrpc_fcn_0(DALRPC_TEST_API_17, handle, event_idx);
172}