2017-06-08 18:10:05 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <time.h>
|
|
|
|
|
|
|
|
#include <osmocom/core/timer.h>
|
2020-06-16 21:30:17 +00:00
|
|
|
#include <osmocom/gsm/gsm0502.h>
|
2018-09-12 10:54:24 +00:00
|
|
|
|
2017-06-08 18:10:05 +00:00
|
|
|
enum tdma_sched_clck_state {
|
|
|
|
SCH_CLCK_STATE_WAIT,
|
|
|
|
SCH_CLCK_STATE_OK,
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Forward structure declaration */
|
|
|
|
struct trx_sched;
|
|
|
|
|
|
|
|
/*! \brief One scheduler instance */
|
|
|
|
struct trx_sched {
|
|
|
|
/*! \brief Clock state */
|
2020-06-16 21:33:48 +00:00
|
|
|
enum tdma_sched_clck_state state;
|
2017-06-08 18:10:05 +00:00
|
|
|
/*! \brief Local clock source */
|
2018-08-17 12:38:01 +00:00
|
|
|
struct timespec clock;
|
2017-06-08 18:10:05 +00:00
|
|
|
/*! \brief Count of processed frames */
|
|
|
|
uint32_t fn_counter_proc;
|
2017-11-23 13:05:00 +00:00
|
|
|
/*! \brief Local frame counter advance */
|
|
|
|
uint32_t fn_counter_advance;
|
2020-06-16 21:37:05 +00:00
|
|
|
/*! \brief Count of lost frames */
|
2017-06-08 18:10:05 +00:00
|
|
|
uint32_t fn_counter_lost;
|
|
|
|
/*! \brief Frame callback timer */
|
|
|
|
struct osmo_timer_list clock_timer;
|
|
|
|
/*! \brief Frame callback */
|
|
|
|
void (*clock_cb)(struct trx_sched *sched);
|
|
|
|
/*! \brief Private data (e.g. pointer to trx instance) */
|
|
|
|
void *data;
|
|
|
|
};
|
|
|
|
|
|
|
|
int sched_clck_handle(struct trx_sched *sched, uint32_t fn);
|
2017-07-27 10:33:38 +00:00
|
|
|
void sched_clck_reset(struct trx_sched *sched);
|