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#include <camkes/debug.h>
11
12int global_number = 34;
13
14int run() {
15    const char *shello = "hello world";
16    const char *smore = "a longer string that will overflow the message registers on ARM";
17    char *s;
18    int i = 42, j;
19    int p, p1, p2;
20    float f = 273421.4274, g;
21    double d = 273421.4274, e;
22
23    printf("Starting the client\n");
24    printf("-------------------\n");
25    camkes_software_breakpoint();
26    j = a_echo_int(i);
27    printf("echo_int: %d -> %d\n",i, j);
28
29    g = a_echo_float(f);
30    printf("echo_float: %f -> %f\n",f, g);
31
32    e = a_echo_double(d);
33    printf("echo_double: %f -> %f\n",d, e);
34    camkes_software_breakpoint();
35
36    j = a_echo_mix(d);
37    printf("echo_mix: %f -> %d\n",d, j);
38
39    s = a_echo_string(shello);
40    printf("echo_string: \"%s\" -> \"%s\"\n", shello, s);
41    free(s);
42
43    global_number = 50;
44    s = a_echo_string(smore);
45    printf("echo_string: \"%s\" -> \"%s\"\n", smore, s);
46    free(s);
47    printf("%d\n", global_number);
48
49    p = 123;
50    p2 = a_echo_parameter(p, &p1);
51    printf("echo_parameter: %d -> %d (returned = %d)\n", p, p1, p2);
52
53    p = 100;
54    a_increment_parameter(&p);
55    printf("increment_parameter: 100 -> %d\n", p);
56
57    printf("After the client\n");
58    return 0;
59}
60