trxcon: merge 'sched_trx.h' and 'scheduler.h' into 'l1sched.h'

Change-Id: Ide1e3ccdf32fdc255acc943e0c0936d15cf0c680
Related: OS#5599, OS#3761
This commit is contained in:
Vadim Yanitskiy 2022-07-04 22:25:27 +07:00
parent 38373ee20f
commit eff2d52e75
19 changed files with 48 additions and 68 deletions

View File

@ -2,8 +2,7 @@ noinst_HEADERS = \
l1ctl_proto.h \ l1ctl_proto.h \
l1ctl_link.h \ l1ctl_link.h \
l1ctl.h \ l1ctl.h \
scheduler.h \ l1sched.h \
sched_trx.h \
trx_if.h \ trx_if.h \
logging.h \ logging.h \
trxcon.h \ trxcon.h \

View File

@ -1,5 +1,6 @@
#pragma once #pragma once
#include <time.h>
#include <stdint.h> #include <stdint.h>
#include <stdbool.h> #include <stdbool.h>
@ -7,10 +8,11 @@
#include <osmocom/core/utils.h> #include <osmocom/core/utils.h>
#include <osmocom/gsm/protocol/gsm_04_08.h> #include <osmocom/gsm/protocol/gsm_04_08.h>
#include <osmocom/gsm/gsm_utils.h> #include <osmocom/gsm/gsm_utils.h>
#include <osmocom/gsm/gsm0502.h>
#include <osmocom/core/linuxlist.h> #include <osmocom/core/linuxlist.h>
#include <osmocom/core/timer.h>
#include <osmocom/bb/trxcon/logging.h> #include <osmocom/bb/trxcon/logging.h>
#include <osmocom/bb/trxcon/scheduler.h>
#define GSM_BURST_LEN 148 #define GSM_BURST_LEN 148
#define GSM_BURST_PL_LEN 116 #define GSM_BURST_PL_LEN 116
@ -41,9 +43,15 @@
/* Forward declaration to avoid mutual include */ /* Forward declaration to avoid mutual include */
struct l1sched_lchan_state; struct l1sched_lchan_state;
struct l1sched_meas_set; struct l1sched_meas_set;
struct l1sched_state;
struct trx_instance; struct trx_instance;
struct l1sched_ts; struct l1sched_ts;
enum l1sched_clck_state {
L1SCHED_CLCK_ST_WAIT,
L1SCHED_CLCK_ST_OK,
};
enum l1sched_burst_type { enum l1sched_burst_type {
L1SCHED_BURST_GMSK, L1SCHED_BURST_GMSK,
L1SCHED_BURST_8PSK, L1SCHED_BURST_8PSK,
@ -301,6 +309,26 @@ struct l1sched_ts_prim {
uint8_t payload[0]; uint8_t payload[0];
}; };
/*! One scheduler instance */
struct l1sched_state {
/*! Clock state */
enum l1sched_clck_state state;
/*! Local clock source */
struct timespec clock;
/*! Count of processed frames */
uint32_t fn_counter_proc;
/*! Local frame counter advance */
uint32_t fn_counter_advance;
/*! Count of lost frames */
uint32_t fn_counter_lost;
/*! Frame callback timer */
struct osmo_timer_list clock_timer;
/*! Frame callback */
void (*clock_cb)(struct l1sched_state *sched);
/*! Private data (e.g. pointer to trx instance) */
void *data;
};
extern const struct l1sched_lchan_desc l1sched_lchan_desc[_L1SCHED_CHAN_MAX]; extern const struct l1sched_lchan_desc l1sched_lchan_desc[_L1SCHED_CHAN_MAX];
const struct l1sched_tdma_multiframe *l1sched_mframe_layout( const struct l1sched_tdma_multiframe *l1sched_mframe_layout(
enum gsm_phys_chan_config config, int tn); enum gsm_phys_chan_config config, int tn);
@ -413,3 +441,6 @@ bool l1sched_tchh_block_map_fn(enum l1sched_lchan_type chan,
/* Measurement history */ /* Measurement history */
void l1sched_lchan_meas_push(struct l1sched_lchan_state *lchan, const struct l1sched_meas_set *meas); void l1sched_lchan_meas_push(struct l1sched_lchan_state *lchan, const struct l1sched_meas_set *meas);
void l1sched_lchan_meas_avg(struct l1sched_lchan_state *lchan, unsigned int n); void l1sched_lchan_meas_avg(struct l1sched_lchan_state *lchan, unsigned int n);
int l1sched_clck_handle(struct l1sched_state *sched, uint32_t fn);
void l1sched_clck_reset(struct l1sched_state *sched);

View File

@ -1,38 +0,0 @@
#pragma once
#include <stdint.h>
#include <time.h>
#include <osmocom/core/timer.h>
#include <osmocom/gsm/gsm0502.h>
enum l1sched_clck_state {
L1SCHED_CLCK_ST_WAIT,
L1SCHED_CLCK_ST_OK,
};
/* Forward structure declaration */
struct l1sched_state;
/*! One scheduler instance */
struct l1sched_state {
/*! Clock state */
enum l1sched_clck_state state;
/*! Local clock source */
struct timespec clock;
/*! Count of processed frames */
uint32_t fn_counter_proc;
/*! Local frame counter advance */
uint32_t fn_counter_advance;
/*! Count of lost frames */
uint32_t fn_counter_lost;
/*! Frame callback timer */
struct osmo_timer_list clock_timer;
/*! Frame callback */
void (*clock_cb)(struct l1sched_state *sched);
/*! Private data (e.g. pointer to trx instance) */
void *data;
};
int l1sched_clck_handle(struct l1sched_state *sched, uint32_t fn);
void l1sched_clck_reset(struct l1sched_state *sched);

View File

@ -5,8 +5,7 @@
#include <osmocom/core/timer.h> #include <osmocom/core/timer.h>
#include <osmocom/core/fsm.h> #include <osmocom/core/fsm.h>
#include <osmocom/bb/trxcon/scheduler.h> #include <osmocom/bb/trxcon/l1sched.h>
#include <osmocom/bb/trxcon/sched_trx.h>
#define TRXC_BUF_SIZE 1024 #define TRXC_BUF_SIZE 1024
#define TRXD_BUF_SIZE 512 #define TRXD_BUF_SIZE 512

View File

@ -40,7 +40,7 @@
#include <osmocom/bb/trxcon/l1ctl_proto.h> #include <osmocom/bb/trxcon/l1ctl_proto.h>
#include <osmocom/bb/trxcon/trx_if.h> #include <osmocom/bb/trxcon/trx_if.h>
#include <osmocom/bb/trxcon/sched_trx.h> #include <osmocom/bb/trxcon/l1sched.h>
static const char *arfcn2band_name(uint16_t arfcn) static const char *arfcn2band_name(uint16_t arfcn)
{ {

View File

@ -38,7 +38,7 @@
#include <osmocom/core/timer_compat.h> #include <osmocom/core/timer_compat.h>
#include <osmocom/gsm/a5.h> #include <osmocom/gsm/a5.h>
#include <osmocom/bb/trxcon/scheduler.h> #include <osmocom/bb/trxcon/l1sched.h>
#include <osmocom/bb/trxcon/logging.h> #include <osmocom/bb/trxcon/logging.h>
#include <osmocom/bb/trxcon/trx_if.h> #include <osmocom/bb/trxcon/trx_if.h>

View File

@ -37,8 +37,7 @@
#include <osmocom/gsm/protocol/gsm_08_58.h> #include <osmocom/gsm/protocol/gsm_08_58.h>
#include <osmocom/bb/trxcon/l1ctl_proto.h> #include <osmocom/bb/trxcon/l1ctl_proto.h>
#include <osmocom/bb/trxcon/scheduler.h> #include <osmocom/bb/trxcon/l1sched.h>
#include <osmocom/bb/trxcon/sched_trx.h>
#include <osmocom/bb/trxcon/logging.h> #include <osmocom/bb/trxcon/logging.h>
#include <osmocom/bb/trxcon/trxcon.h> #include <osmocom/bb/trxcon/trxcon.h>
#include <osmocom/bb/trxcon/trx_if.h> #include <osmocom/bb/trxcon/trx_if.h>

View File

@ -26,7 +26,7 @@
#include <osmocom/gsm/protocol/gsm_08_58.h> #include <osmocom/gsm/protocol/gsm_08_58.h>
#include <osmocom/core/gsmtap.h> #include <osmocom/core/gsmtap.h>
#include <osmocom/bb/trxcon/sched_trx.h> #include <osmocom/bb/trxcon/l1sched.h>
/* Forward declaration of handlers */ /* Forward declaration of handlers */
int rx_data_fn(struct trx_instance *trx, struct l1sched_ts *ts, int rx_data_fn(struct trx_instance *trx, struct l1sched_ts *ts,

View File

@ -31,8 +31,7 @@
#include <osmocom/coding/gsm0503_coding.h> #include <osmocom/coding/gsm0503_coding.h>
#include <osmocom/bb/trxcon/l1ctl_proto.h> #include <osmocom/bb/trxcon/l1ctl_proto.h>
#include <osmocom/bb/trxcon/scheduler.h> #include <osmocom/bb/trxcon/l1sched.h>
#include <osmocom/bb/trxcon/sched_trx.h>
#include <osmocom/bb/trxcon/logging.h> #include <osmocom/bb/trxcon/logging.h>
#include <osmocom/bb/trxcon/trx_if.h> #include <osmocom/bb/trxcon/trx_if.h>
#include <osmocom/bb/trxcon/l1ctl.h> #include <osmocom/bb/trxcon/l1ctl.h>

View File

@ -31,8 +31,7 @@
#include <osmocom/coding/gsm0503_coding.h> #include <osmocom/coding/gsm0503_coding.h>
#include <osmocom/bb/trxcon/l1ctl_proto.h> #include <osmocom/bb/trxcon/l1ctl_proto.h>
#include <osmocom/bb/trxcon/scheduler.h> #include <osmocom/bb/trxcon/l1sched.h>
#include <osmocom/bb/trxcon/sched_trx.h>
#include <osmocom/bb/trxcon/logging.h> #include <osmocom/bb/trxcon/logging.h>
#include <osmocom/bb/trxcon/trx_if.h> #include <osmocom/bb/trxcon/trx_if.h>
#include <osmocom/bb/trxcon/l1ctl.h> #include <osmocom/bb/trxcon/l1ctl.h>

View File

@ -32,8 +32,7 @@
#include <osmocom/coding/gsm0503_coding.h> #include <osmocom/coding/gsm0503_coding.h>
#include <osmocom/bb/trxcon/l1ctl_proto.h> #include <osmocom/bb/trxcon/l1ctl_proto.h>
#include <osmocom/bb/trxcon/scheduler.h> #include <osmocom/bb/trxcon/l1sched.h>
#include <osmocom/bb/trxcon/sched_trx.h>
#include <osmocom/bb/trxcon/logging.h> #include <osmocom/bb/trxcon/logging.h>
#include <osmocom/bb/trxcon/trx_if.h> #include <osmocom/bb/trxcon/trx_if.h>
#include <osmocom/bb/trxcon/l1ctl.h> #include <osmocom/bb/trxcon/l1ctl.h>

View File

@ -33,8 +33,7 @@
#include <osmocom/codec/codec.h> #include <osmocom/codec/codec.h>
#include <osmocom/bb/trxcon/l1ctl_proto.h> #include <osmocom/bb/trxcon/l1ctl_proto.h>
#include <osmocom/bb/trxcon/scheduler.h> #include <osmocom/bb/trxcon/l1sched.h>
#include <osmocom/bb/trxcon/sched_trx.h>
#include <osmocom/bb/trxcon/logging.h> #include <osmocom/bb/trxcon/logging.h>
#include <osmocom/bb/trxcon/trx_if.h> #include <osmocom/bb/trxcon/trx_if.h>
#include <osmocom/bb/trxcon/l1ctl.h> #include <osmocom/bb/trxcon/l1ctl.h>

View File

@ -36,8 +36,7 @@
#include <osmocom/codec/codec.h> #include <osmocom/codec/codec.h>
#include <osmocom/bb/trxcon/l1ctl_proto.h> #include <osmocom/bb/trxcon/l1ctl_proto.h>
#include <osmocom/bb/trxcon/scheduler.h> #include <osmocom/bb/trxcon/l1sched.h>
#include <osmocom/bb/trxcon/sched_trx.h>
#include <osmocom/bb/trxcon/logging.h> #include <osmocom/bb/trxcon/logging.h>
#include <osmocom/bb/trxcon/trx_if.h> #include <osmocom/bb/trxcon/trx_if.h>
#include <osmocom/bb/trxcon/l1ctl.h> #include <osmocom/bb/trxcon/l1ctl.h>

View File

@ -31,8 +31,7 @@
#include <osmocom/coding/gsm0503_coding.h> #include <osmocom/coding/gsm0503_coding.h>
#include <osmocom/bb/trxcon/l1ctl_proto.h> #include <osmocom/bb/trxcon/l1ctl_proto.h>
#include <osmocom/bb/trxcon/scheduler.h> #include <osmocom/bb/trxcon/l1sched.h>
#include <osmocom/bb/trxcon/sched_trx.h>
#include <osmocom/bb/trxcon/logging.h> #include <osmocom/bb/trxcon/logging.h>
#include <osmocom/bb/trxcon/trx_if.h> #include <osmocom/bb/trxcon/trx_if.h>
#include <osmocom/bb/trxcon/l1ctl.h> #include <osmocom/bb/trxcon/l1ctl.h>

View File

@ -25,7 +25,7 @@
#include <osmocom/gsm/gsm_utils.h> #include <osmocom/gsm/gsm_utils.h>
#include <osmocom/bb/trxcon/sched_trx.h> #include <osmocom/bb/trxcon/l1sched.h>
/* Non-combined CCCH */ /* Non-combined CCCH */
static const struct l1sched_tdma_frame frame_bcch[51] = { static const struct l1sched_tdma_frame frame_bcch[51] = {

View File

@ -29,8 +29,7 @@
#include <osmocom/gsm/protocol/gsm_04_08.h> #include <osmocom/gsm/protocol/gsm_04_08.h>
#include <osmocom/bb/trxcon/scheduler.h> #include <osmocom/bb/trxcon/l1sched.h>
#include <osmocom/bb/trxcon/sched_trx.h>
#include <osmocom/bb/trxcon/trx_if.h> #include <osmocom/bb/trxcon/trx_if.h>
#include <osmocom/bb/trxcon/logging.h> #include <osmocom/bb/trxcon/logging.h>

View File

@ -32,8 +32,7 @@
#include <osmocom/core/linuxlist.h> #include <osmocom/core/linuxlist.h>
#include <osmocom/bb/trxcon/l1ctl_proto.h> #include <osmocom/bb/trxcon/l1ctl_proto.h>
#include <osmocom/bb/trxcon/scheduler.h> #include <osmocom/bb/trxcon/l1sched.h>
#include <osmocom/bb/trxcon/sched_trx.h>
#include <osmocom/bb/trxcon/trx_if.h> #include <osmocom/bb/trxcon/trx_if.h>
#include <osmocom/bb/trxcon/logging.h> #include <osmocom/bb/trxcon/logging.h>

View File

@ -43,7 +43,6 @@
#include <osmocom/bb/trxcon/trxcon.h> #include <osmocom/bb/trxcon/trxcon.h>
#include <osmocom/bb/trxcon/trx_if.h> #include <osmocom/bb/trxcon/trx_if.h>
#include <osmocom/bb/trxcon/logging.h> #include <osmocom/bb/trxcon/logging.h>
#include <osmocom/bb/trxcon/scheduler.h>
static struct value_string trx_evt_names[] = { static struct value_string trx_evt_names[] = {
{ 0, NULL } /* no events? */ { 0, NULL } /* no events? */

View File

@ -45,8 +45,7 @@
#include <osmocom/bb/trxcon/l1ctl.h> #include <osmocom/bb/trxcon/l1ctl.h>
#include <osmocom/bb/trxcon/l1ctl_link.h> #include <osmocom/bb/trxcon/l1ctl_link.h>
#include <osmocom/bb/trxcon/l1ctl_proto.h> #include <osmocom/bb/trxcon/l1ctl_proto.h>
#include <osmocom/bb/trxcon/scheduler.h> #include <osmocom/bb/trxcon/l1sched.h>
#include <osmocom/bb/trxcon/sched_trx.h>
#define COPYRIGHT \ #define COPYRIGHT \
"Copyright (C) 2016-2020 by Vadim Yanitskiy <axilirator@gmail.com>\n" \ "Copyright (C) 2016-2020 by Vadim Yanitskiy <axilirator@gmail.com>\n" \