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 <clockserver_client.h>
20
21/*- set connection_name = configuration[me.parent.name].get('connection_name') -*/
22static clock_sys_t /*? connection_name?*/_server_wrapper;
23
24static int ClockServer_client_init(ps_io_ops_t *io_ops) {
25    int error = clockserver_interface_init(io_ops, /*? connection_name ?*/_init_clock, /*? connection_name ?*/_set_gate_mode,
26                                       /*? connection_name ?*/_get_freq, /*? connection_name ?*/_set_freq, /*? connection_name ?*/_register_child,
27                                       &/*? connection_name ?*/_server_wrapper);
28    if (error) {
29        ZF_LOGE("Failed to initialise the ClockServer interface");
30        return error;
31    }
32    /* Register these interfaces against the interface registration service. */
33    error = ps_interface_register(&io_ops->interface_registration_ops, PS_CLOCK_INTERFACE,
34                                  &clock_server_wrapper, NULL);
35    if (error) {
36        ZF_LOGE("Failed to register the ResetServer interface");
37        return error;
38    }
39
40    return 0;
41}
42
43CAMKES_PRE_INIT_MODULE_DEFINE(clock_client_setup, ClockServer_client_init);
44