aos/usr/shelly/shelly.h
2022-05-31 17:33:55 +02:00

54 lines
1.4 KiB
C

/*
* Copyright (c) 2019, ETH Zurich.
* All rights reserved.
*
* This file is distributed under the terms in the attached LICENSE file.
* If you do not find this file, copies can be found by writing to:
* ETH Zurich D-INFK, Universitaetstrasse 6, CH-8092 Zurich. Attn: Systems Group.
*/
#ifndef SHELLY_H_
#define SHELLY_H_
// #define SHELLY_DEBUG_ON 1
#if defined(SHELLY_DEBUG_ON)
#define SHELLY_DEBUG(x...) debug_printf("[SHELLY_DEBUG] " x);
#else
#define SHELLY_DEBUG(x, ...) ((void)0)
#endif
#include <drivers/lpuart.h>
#include <drivers/gic_dist.h>
#include <aos/ump_chan.h>
#define ASCII_NL 10 // < new line
#define ASCII_CR 13 // < carriage return
#define ASCII_EOF 4 // < end of file
#define ASCII_EOT 3 // < end of text
#define SHELLY_BUF_SIZE 2048
//state that is shared for all clients
struct shelly_st_global {
struct waitset * ws;
void * lpuart_base; // < virtual address of the lpuart device registers
void * gic_base; // < virtual address of the gic device registers
struct lpuart_s * uart_s; // < state of the uart driver
struct gic_dist_s * gic_s; // < state of the gic driver
u_int32_t num_clients;
char buf[SHELLY_BUF_SIZE];
size_t buffer_i;
};
//state that different for each client
struct shelly_st_local {
uint32_t client_id;
struct ump_recv_chan * recv_chan;
struct ump_send_chan * send_chan;
};
#endif // ndef SHELLY_H_