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 <bpmpserver_client.h>
20
21/*- set connection_name = configuration[me.parent.name].get('connection_name') -*/
22static struct tx2_bpmp /*? connection_name?*/_server_wrapper;
23extern void */*? connection_name ?*/_buf;
24size_t /*? connection_name ?*/_get_size(void);
25
26static int BPMPServer_client_init(ps_io_ops_t *io_ops) {
27    int error = bpmpserver_interface_init(/*? connection_name ?*/_buf, /*? connection_name ?*/_get_size(), /*? connection_name ?*/_call, &/*? connection_name?*/_server_wrapper);
28    if (error) {
29        ZF_LOGE("Failed to initialise the BPMP server client interface");
30        return -1;
31    }
32
33    error = ps_interface_register(&io_ops->interface_registration_ops, TX2_BPMP_INTERFACE,
34                                  &/*? connection_name?*/_server_wrapper, NULL);
35    if (error) {
36        ZF_LOGE("Failed to register the BPMP interface");
37        return -1;
38    }
39
40    return 0;
41}
42
43CAMKES_PRE_INIT_MODULE_DEFINE(bpmp_client_setup, BPMPServer_client_init);
44