1/*
2 * Copyright 2017, Data61, CSIRO (ABN 41 687 119 230)
3 *
4 * SPDX-License-Identifier: BSD-2-Clause
5 */
6
7#include <camkes.h>
8#include <stdio.h>
9#include <stdlib.h>
10
11int run() {
12    const char *shello = "hello world";
13    const char *smore = "a longer string that will overflow the message registers on ARM";
14    char *s;
15    int i = 42, j;
16    int p, p1, p2;
17    float f = 273421.4274, g;
18    double d = 273421.4274, e;
19
20    printf("Starting the client\n");
21    printf("-------------------\n");
22
23    j = _fault_handler_echo_int(i);
24    printf("echo_int: %d -> %d\n",i, j);
25
26    g = _fault_handler_echo_float(f);
27    printf("echo_float: %f -> %f\n",f, g);
28
29    e = _fault_handler_echo_double(d);
30    printf("echo_double: %f -> %f\n",d, e);
31
32    j = _fault_handler_echo_mix(d);
33    printf("echo_mix: %f -> %d\n",d, j);
34
35    s = _fault_handler_echo_string(shello);
36    printf("echo_string: \"%s\" -> \"%s\"\n", shello, s);
37    free(s);
38
39    s = _fault_handler_echo_string(smore);
40    printf("echo_string: \"%s\" -> \"%s\"\n", smore, s);
41    free(s);
42
43    p = 123;
44    p2 = _fault_handler_echo_parameter(p, &p1);
45    printf("echo_parameter: %d -> %d (returned = %d)\n", p, p1, p2);
46
47    p = 100;
48    _fault_handler_increment_parameter(&p);
49    printf("increment_parameter: 100 -> %d\n", p);
50
51    printf("After the client\n");
52    return 0;
53}
54