2016-07-23 19:40:41 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <osmocom/core/linuxlist.h>
|
|
|
|
#include <osmocom/core/select.h>
|
|
|
|
#include <osmocom/core/timer.h>
|
2017-05-31 02:28:40 +00:00
|
|
|
#include <osmocom/core/fsm.h>
|
|
|
|
|
2017-06-09 13:53:20 +00:00
|
|
|
#include "scheduler.h"
|
2017-07-04 13:55:12 +00:00
|
|
|
#include "sched_trx.h"
|
2017-06-09 13:53:20 +00:00
|
|
|
|
2017-05-31 02:28:40 +00:00
|
|
|
enum trx_fsm_states {
|
|
|
|
TRX_STATE_OFFLINE = 0,
|
|
|
|
TRX_STATE_IDLE,
|
|
|
|
TRX_STATE_ACTIVE,
|
|
|
|
TRX_STATE_RSP_WAIT,
|
|
|
|
};
|
2016-07-23 19:40:41 +00:00
|
|
|
|
|
|
|
struct trx_instance {
|
|
|
|
struct osmo_fd trx_ofd_clck;
|
|
|
|
struct osmo_fd trx_ofd_ctrl;
|
|
|
|
struct osmo_fd trx_ofd_data;
|
|
|
|
|
|
|
|
struct osmo_timer_list trx_ctrl_timer;
|
|
|
|
struct llist_head trx_ctrl_list;
|
2017-05-31 02:28:40 +00:00
|
|
|
struct osmo_fsm_inst *fsm;
|
|
|
|
uint32_t prev_state;
|
2017-06-09 13:53:20 +00:00
|
|
|
|
|
|
|
/* Scheduler stuff */
|
|
|
|
struct trx_sched sched;
|
2017-07-04 13:55:12 +00:00
|
|
|
struct llist_head ts_list;
|
2016-07-23 19:40:41 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct trx_ctrl_msg {
|
|
|
|
struct llist_head list;
|
|
|
|
char cmd[128];
|
2017-05-31 02:28:40 +00:00
|
|
|
int retry_cnt;
|
2016-07-23 19:40:41 +00:00
|
|
|
int critical;
|
|
|
|
int cmd_len;
|
|
|
|
};
|
|
|
|
|
|
|
|
int trx_if_open(struct trx_instance **trx, const char *host, uint16_t port);
|
2017-05-31 02:28:40 +00:00
|
|
|
void trx_if_flush_ctrl(struct trx_instance *trx);
|
2016-07-23 19:40:41 +00:00
|
|
|
void trx_if_close(struct trx_instance *trx);
|
|
|
|
|
|
|
|
int trx_if_cmd_poweron(struct trx_instance *trx);
|
|
|
|
int trx_if_cmd_poweroff(struct trx_instance *trx);
|
2017-06-03 12:02:20 +00:00
|
|
|
int trx_if_cmd_echo(struct trx_instance *trx);
|
2016-07-23 19:40:41 +00:00
|
|
|
|
|
|
|
int trx_if_cmd_setpower(struct trx_instance *trx, int db);
|
|
|
|
int trx_if_cmd_adjpower(struct trx_instance *trx, int db);
|
|
|
|
|
|
|
|
int trx_if_cmd_setrxgain(struct trx_instance *trx, int db);
|
|
|
|
int trx_if_cmd_setmaxdly(struct trx_instance *trx, int dly);
|
|
|
|
|
|
|
|
int trx_if_cmd_rxtune(struct trx_instance *trx, uint16_t arfcn);
|
|
|
|
int trx_if_cmd_txtune(struct trx_instance *trx, uint16_t arfcn);
|
|
|
|
|
|
|
|
int trx_if_cmd_setslot(struct trx_instance *trx, uint8_t tn, uint8_t type);
|