| Andrew Jeffery | 4fe996c | 2018-02-27 12:16:48 +1030 | [diff] [blame] | 1 | // SPDX-License-Identifier: Apache-2.0 | 
|  | 2 | // Copyright (C) 2018 IBM Corp. | 
| Andrew Jeffery | bcacb4e | 2017-04-13 13:45:13 +0930 | [diff] [blame] | 3 |  | 
|  | 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 |  | 
|  | 12 | static const uint8_t command[] = { | 
|  | 13 | 0x02, 0xaa, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 
|  | 14 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 | 
|  | 15 | }; | 
|  | 16 |  | 
|  | 17 | static const uint8_t response[] = { | 
|  | 18 | 0x02, 0xaa, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 
|  | 19 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, | 
|  | 20 | }; | 
|  | 21 |  | 
|  | 22 | #define MEM_SIZE	3 | 
|  | 23 | #define ERASE_SIZE	1 | 
|  | 24 | #define N_WINDOWS	1 | 
|  | 25 | #define WINDOW_SIZE	1 | 
|  | 26 |  | 
|  | 27 | #include <stdio.h> | 
|  | 28 |  | 
|  | 29 | int main(void) | 
|  | 30 | { | 
|  | 31 | struct mbox_context *ctx; | 
|  | 32 | int rc; | 
|  | 33 |  | 
|  | 34 | system_set_reserved_size(MEM_SIZE); | 
|  | 35 | system_set_mtd_sizes(MEM_SIZE, ERASE_SIZE); | 
|  | 36 |  | 
|  | 37 | ctx = mbox_create_test_context(N_WINDOWS, WINDOW_SIZE); | 
|  | 38 |  | 
|  | 39 | rc = mbox_command_dispatch(ctx, command, sizeof(command)); | 
|  | 40 | assert(rc == 2); | 
|  | 41 |  | 
|  | 42 | rc = mbox_cmp(ctx, response, sizeof(response)); | 
|  | 43 | assert(rc == 0); | 
|  | 44 |  | 
|  | 45 | return rc; | 
|  | 46 | } |