1/* 2 * Copyright 2017, Data61, CSIRO (ABN 41 687 119 230) 3 * 4 * SPDX-License-Identifier: GPL-2.0-only 5 */ 6 7#include <camkes.h> 8 9static int global; 10 11static void callback(void *arg) { 12 int *ret = arg; 13 *ret = global; 14 int error = binsem_post(); 15 assert(!error); 16} 17 18int echo_echo(int i) { 19 int ret; 20 global = i; 21 int error = ready_reg_callback(callback, &ret); 22 assert(!error); 23 error = binsem_wait(); 24 assert(!error); 25 return ret; 26} 27