1/*
2 * Copyright 2017, Data61, CSIRO (ABN 41 687 119 230)
3 *
4 * SPDX-License-Identifier: BSD-2-Clause
5 */
6
7/* CAmkES provides a generated header that prototypes all the relevant
8 * generated symbols.
9 */
10#include <camkes.h>
11
12#include <ringbuffer/ringbuffer.h>
13#include <stdbool.h>
14#include <stdlib.h>
15
16/* This function is invoked by the main CAmkES thread in this component. */
17int run(void) {
18    ringbuffer_t *input = rb_new((void*)keyboard_input, sizeof(*keyboard_input));
19    if (input == NULL) {
20        abort();
21    }
22
23    ringbuffer_t *output = rb_new((void*)framebuffer, sizeof(*framebuffer));
24    if (output == NULL) {
25        abort();
26    }
27
28    /* Obviously a real Linux would be doing more than just passing through
29     * characters here. In particular, network communication.
30     */
31    while (true) {
32        char c = (char)rb_receive_byte(input);
33        rb_transmit_byte(output, (unsigned char)c);
34    }
35
36    return 0;
37}
38