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 <gpiomuxserver.h> 20 21/*- set connection_name = configuration[me.parent.name].get('connection_name') -*/ 22static gpio_sys_t /*? connection_name?*/_server_wrapper; 23 24static int GPIOServer_client_init(ps_io_ops_t *io_ops) { 25 26 int error = gpiomuxserver_gpio_interface_init(/*? connection_name?*/_init_pin, /*? connection_name?*/_set_level, /*? connection_name?*/_read_level, 27 &/*? connection_name?*/_server_wrapper); 28 if (error) { 29 ZF_LOGE("Failed to initialise the GPIOMUXServer 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_GPIO_INTERFACE, 34 &gpio_server_wrapper, NULL); 35 if (error) { 36 ZF_LOGE("Failed to register the GPIOMUXServer interface"); 37 return error; 38 } 39 return 0; 40} 41 42CAMKES_PRE_INIT_MODULE_DEFINE(gpio_client_setup, GPIOServer_client_init); 43