From 423aeefc4047038417b8da49aa5887553ffcfad3 Mon Sep 17 00:00:00 2001 From: Vadim Yanitskiy Date: Wed, 31 May 2017 09:28:40 +0700 Subject: host/trxcon: integrate osmo-fsm framework This change introduces the following state machines: - trxcon_app_fsm - main application state machine. This state machine handles different events, raised from program modules (such as trx_if.c or l1ctl.c). - l1ctl_link_fsm - L1CTL server state machine. - trx_interface_fsm - TRX interface state machine. The program modules (such as trx_if.c or l1ctl.c) should be as much independent from each other as possible. In other words, one module should not call methods from another, e.g. L1CTL handlers are not able to send any command to transceiver directly. Instead of that, they should use shared event set to notify the main state machine about something. Depending on current state and received event, main state machine 'decides' what to do. This approach would allow to easily reuse the source code almost 'as is' anywhere outside the project. Change-Id: I7ee6fc891abe5f775f5b7ebbf093181a97950dea --- src/host/trxcon/trxcon.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 src/host/trxcon/trxcon.h (limited to 'src/host/trxcon/trxcon.h') diff --git a/src/host/trxcon/trxcon.h b/src/host/trxcon/trxcon.h new file mode 100644 index 00000000..a7a3a65f --- /dev/null +++ b/src/host/trxcon/trxcon.h @@ -0,0 +1,19 @@ +#pragma once + +#define GEN_MASK(state) (0x01 << state) + +enum trxcon_fsm_states { + TRXCON_STATE_IDLE = 0, + TRXCON_STATE_MANAGED, +}; + +enum trxcon_fsm_events { + /* L1CTL specific events */ + L1CTL_EVENT_CONNECT, + L1CTL_EVENT_DISCONNECT, + + /* TRX specific events */ + TRX_EVENT_RESET_IND, + TRX_EVENT_RSP_ERROR, + TRX_EVENT_OFFLINE, +}; -- cgit v1.2.3