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 <camkes.h>
14#undef PACKED
15#include <pico_stack.h>
16
17/*- set connection_name = configuration[me.parent.name].get('connection_name') -*/
18
19
20static int startup_picotcp(ps_io_ops_t *io_ops) {
21    return pico_stack_init();
22}
23typedef int (*register_callback_handler_fn_t)(seL4_Word badge, const char*, void (*callback_handler)(seL4_Word, void *),
24                                              void *cookie);
25
26int init_pico_post(ps_io_ops_t *io_ops, seL4_Word timer_badge, int (*timer_periodic)(int p_tid, uint64_t p_ns),
27	              const char *ip_addr, const char* multicast_addr_, register_callback_handler_fn_t callback_handler);
28
29int pico_base_timer_periodic(int p_tid, uint64_t p_ns);
30
31static int init_pico(ps_io_ops_t *io_ops) {
32
33    return init_pico_post(io_ops, /*? connection_name ?*/_timer_notification_badge(), /*? connection_name ?*/_timer_periodic, /*? connection_name ?*/_ip_addr, /*? connection_name ?*/_multicast_addr, single_threaded_component_register_handler);
34}
35CAMKES_ENV_INIT_MODULE_DEFINE(/*? connection_name ?*/_setup_env, startup_picotcp);
36
37CAMKES_POST_INIT_MODULE_DEFINE(/*? connection_name ?*/_setup, init_pico);
38