14fe996c2SAndrew Jeffery // SPDX-License-Identifier: Apache-2.0
24fe996c2SAndrew Jeffery // Copyright (C) 2018 IBM Corp.
34510a195SAndrew Jeffery
44510a195SAndrew Jeffery #include <assert.h>
54510a195SAndrew Jeffery
6*26558dbbSAndrew Jeffery #include "mboxd.h"
7457a6e5fSAndrew Jeffery #include "transport_mbox.h"
84510a195SAndrew Jeffery
94510a195SAndrew Jeffery #include "test/mbox.h"
104510a195SAndrew Jeffery #include "test/system.h"
114510a195SAndrew Jeffery
124510a195SAndrew Jeffery static const uint8_t command[] = {
134510a195SAndrew Jeffery 0x02, 0xaa, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00,
144510a195SAndrew Jeffery 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
154510a195SAndrew Jeffery };
164510a195SAndrew Jeffery
174510a195SAndrew Jeffery static const uint8_t response[] = {
184510a195SAndrew Jeffery 0x02, 0xaa, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
194510a195SAndrew Jeffery 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
204510a195SAndrew Jeffery };
214510a195SAndrew Jeffery
224510a195SAndrew Jeffery #define MEM_SIZE 3
234510a195SAndrew Jeffery #define ERASE_SIZE 1
244510a195SAndrew Jeffery #define N_WINDOWS 1
254510a195SAndrew Jeffery #define WINDOW_SIZE 1
264510a195SAndrew Jeffery
main(void)274510a195SAndrew Jeffery int main(void)
284510a195SAndrew Jeffery {
294510a195SAndrew Jeffery struct mbox_context *ctx;
304510a195SAndrew Jeffery int rc;
314510a195SAndrew Jeffery
324510a195SAndrew Jeffery system_set_reserved_size(MEM_SIZE);
334510a195SAndrew Jeffery system_set_mtd_sizes(MEM_SIZE, ERASE_SIZE);
344510a195SAndrew Jeffery
354510a195SAndrew Jeffery ctx = mbox_create_test_context(N_WINDOWS, WINDOW_SIZE);
364510a195SAndrew Jeffery
374510a195SAndrew Jeffery rc = mbox_command_dispatch(ctx, command, sizeof(command));
384510a195SAndrew Jeffery assert(rc == 1);
394510a195SAndrew Jeffery
404510a195SAndrew Jeffery rc = mbox_cmp(ctx, response, sizeof(response));
414510a195SAndrew Jeffery assert(rc == 0);
424510a195SAndrew Jeffery
434510a195SAndrew Jeffery return rc;
444510a195SAndrew Jeffery }
45