1/*
2 * Copyright 2020, Data61
3 * Commonwealth Scientific and Industrial Research Organisation (CSIRO)
4 * ABN 41 687 119 230.
5 *
6 * This software may be distributed and modified according to the terms of
7 * the BSD 2-Clause license. Note that NO WARRANTY is provided.
8 * See "LICENSE_BSD2.txt" for details.
9 *
10 * @TAG(DATA61_BSD)
11 */
12
13#include <assert.h>
14#include <string.h>
15#include <errno.h>
16#include <camkes.h>
17#include <camkes/io.h>
18#include <utils/util.h>
19#include <resetserver_client.h>
20
21/*- set connection_name = configuration[me.parent.name].get('connection_name') -*/
22static reset_sys_t /*? connection_name?*/_server_wrapper;
23
24static int ResetServer_client_init(ps_io_ops_t *io_ops) {
25    int error = resetserver_interface_init(/*? connection_name?*/_assert_reset, /*? connection_name?*/_deassert_reset,
26                                       &/*? connection_name?*/_server_wrapper);
27    if (error) {
28        ZF_LOGE("Failed to initialise the ResetServer interface");
29        return error;
30    }
31    /* Register these interfaces against the interface registration service. */
32    error = ps_interface_register(&io_ops->interface_registration_ops, PS_RESET_INTERFACE,
33                                  &reset_server_wrapper, NULL);
34    if (error) {
35        ZF_LOGE("Failed to register the ResetServer interface");
36        return error;
37    }
38
39    return 0;
40}
41
42CAMKES_PRE_INIT_MODULE_DEFINE(reset_client_setup, ResetServer_client_init);
43