xref: /openbmc/hiomapd/test/mbox.h (revision faeb88c0)
1 /*
2  * MBox Daemon Test File
3  *
4  * Copyright 2017 IBM
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  */
19 
20 #ifndef TEST_MBOX_H
21 #define TEST_MBOX_H
22 
23 #include <stddef.h>
24 #include <stdint.h>
25 
26 #include "../common.h"
27 #include "../mbox.h"
28 
29 #include "tmpf.h"
30 
31 struct mbox_context *mbox_create_test_context(int n_windows, size_t len);
32 
33 int mbox_set_mtd_data(struct mbox_context *context, const void *data,
34 		size_t len);
35 
36 void mbox_dump(struct mbox_context *context);
37 
38 int mbox_cmp(struct mbox_context *context, const uint8_t *expected, size_t len);
39 
40 int mbox_command_write(struct mbox_context *context, const uint8_t *command,
41 		size_t len);
42 
43 int mbox_command_dispatch(struct mbox_context *context, const uint8_t *command,
44 	size_t len);
45 
46 /* Helpers */
47 void dump_buf(const uint8_t *buf, size_t len);
48 
49 #endif /* TEST_MBOX_H */
50