blob: 2149737c3d6fca3d2a00626ecf4c36c51d20dd1b [file] [log] [blame]
Andrew Jeffery4fe996c2018-02-27 12:16:48 +10301// SPDX-License-Identifier: Apache-2.0
2// Copyright (C) 2018 IBM Corp.
Andrew Jefferyc1e7db32017-04-12 14:36:10 +09303
4#include <assert.h>
5
6#include "mbox.h"
7#include "mboxd_msg.h"
8
9#include "test/mbox.h"
10#include "test/system.h"
11
12static const uint8_t command[] = {
13 0x02, 0xaa, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
14 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
15};
16
17static const uint8_t response[] = {
18 0x02, 0xaa, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
19 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
20};
21
22#define MEM_SIZE 3
23#define ERASE_SIZE 1
24#define N_WINDOWS 1
25#define WINDOW_SIZE 1
26
27int main(void)
28{
29 struct mbox_context *ctx;
30 int rc;
31
32 system_set_reserved_size(MEM_SIZE);
33 system_set_mtd_sizes(MEM_SIZE, ERASE_SIZE);
34
35 ctx = mbox_create_test_context(N_WINDOWS, WINDOW_SIZE);
36
37 rc = mbox_command_dispatch(ctx, command, sizeof(command));
38 assert(rc == 1);
39
40 rc = mbox_cmp(ctx, response, sizeof(response));
41 assert(rc == 0);
42
43 return rc;
44}