2011-06-27 09:25:35 +00:00
|
|
|
#ifndef _FEMTO_L1_H
|
|
|
|
#define _FEMTO_L1_H
|
|
|
|
|
|
|
|
#include <osmocom/core/select.h>
|
|
|
|
#include <osmocom/core/write_queue.h>
|
2012-03-18 22:24:12 +00:00
|
|
|
#include <osmocom/core/gsmtap_util.h>
|
2012-10-28 09:58:41 +00:00
|
|
|
#include <osmocom/core/timer.h>
|
2011-06-27 09:25:35 +00:00
|
|
|
#include <osmocom/gsm/gsm_utils.h>
|
|
|
|
|
|
|
|
enum {
|
|
|
|
MQ_SYS_READ,
|
|
|
|
MQ_L1_READ,
|
2012-06-05 07:17:26 +00:00
|
|
|
#ifndef HW_SYSMOBTS_V1
|
2012-03-07 17:05:18 +00:00
|
|
|
MQ_TCH_READ,
|
|
|
|
MQ_PDTCH_READ,
|
2012-04-14 12:42:26 +00:00
|
|
|
#endif
|
2011-06-27 09:25:35 +00:00
|
|
|
_NUM_MQ_READ
|
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
|
|
|
MQ_SYS_WRITE,
|
|
|
|
MQ_L1_WRITE,
|
2012-06-05 07:17:26 +00:00
|
|
|
#ifndef HW_SYSMOBTS_V1
|
2012-03-07 17:05:18 +00:00
|
|
|
MQ_TCH_WRITE,
|
|
|
|
MQ_PDTCH_WRITE,
|
2012-04-14 12:42:26 +00:00
|
|
|
#endif
|
2011-06-27 09:25:35 +00:00
|
|
|
_NUM_MQ_WRITE
|
|
|
|
};
|
|
|
|
|
2013-01-21 13:02:34 +00:00
|
|
|
struct calib_send_state {
|
|
|
|
const char *path;
|
|
|
|
int last_file_idx;
|
|
|
|
};
|
|
|
|
|
2011-06-27 09:25:35 +00:00
|
|
|
struct femtol1_hdl {
|
|
|
|
struct gsm_time gsm_time;
|
|
|
|
uint32_t hLayer1; /* handle to the L1 instance in the DSP */
|
2011-07-05 10:21:27 +00:00
|
|
|
uint32_t dsp_trace_f;
|
2012-06-05 07:22:11 +00:00
|
|
|
int clk_cal;
|
2012-11-10 17:15:35 +00:00
|
|
|
int ul_power_target;
|
2012-03-17 13:08:51 +00:00
|
|
|
uint8_t clk_src;
|
2013-03-17 15:45:04 +00:00
|
|
|
float min_qual_rach;
|
|
|
|
float min_qual_norm;
|
2012-10-28 09:58:41 +00:00
|
|
|
char *calib_path;
|
2011-06-27 09:25:35 +00:00
|
|
|
struct llist_head wlc_list;
|
|
|
|
|
2012-03-18 22:24:12 +00:00
|
|
|
struct gsmtap_inst *gsmtap;
|
|
|
|
uint32_t gsmtap_sapi_mask;
|
|
|
|
|
2011-06-27 09:25:35 +00:00
|
|
|
void *priv; /* user reference */
|
|
|
|
|
2011-07-05 14:59:27 +00:00
|
|
|
struct osmo_timer_list alive_timer;
|
|
|
|
unsigned int alive_prim_cnt;
|
|
|
|
|
2011-06-27 09:25:35 +00:00
|
|
|
struct osmo_fd read_ofd[_NUM_MQ_READ]; /* osmo file descriptors */
|
|
|
|
struct osmo_wqueue write_q[_NUM_MQ_WRITE];
|
2011-09-09 12:10:57 +00:00
|
|
|
|
|
|
|
struct {
|
|
|
|
uint8_t dsp_version[3];
|
|
|
|
uint8_t fpga_version[3];
|
|
|
|
uint32_t band_support; /* bitmask of GSM_BAND_* */
|
|
|
|
} hw_info;
|
2013-01-21 13:02:34 +00:00
|
|
|
|
|
|
|
struct calib_send_state st;
|
2011-06-27 09:25:35 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#define msgb_l1prim(msg) ((GsmL1_Prim_t *)(msg)->l1h)
|
2012-03-15 20:27:21 +00:00
|
|
|
#define msgb_sysprim(msg) ((SuperFemto_Prim_t *)(msg)->l1h)
|
2011-06-27 09:25:35 +00:00
|
|
|
|
2013-01-22 06:37:41 +00:00
|
|
|
typedef int l1if_compl_cb(struct gsm_bts_trx *trx, struct msgb *l1_msg);
|
2011-06-27 09:25:35 +00:00
|
|
|
|
|
|
|
/* send a request primitive to the L1 and schedule completion call-back */
|
|
|
|
int l1if_req_compl(struct femtol1_hdl *fl1h, struct msgb *msg,
|
2013-01-22 14:22:55 +00:00
|
|
|
l1if_compl_cb *cb);
|
2013-01-16 14:38:07 +00:00
|
|
|
int l1if_gsm_req_compl(struct femtol1_hdl *fl1h, struct msgb *msg,
|
2013-01-21 11:27:15 +00:00
|
|
|
l1if_compl_cb *cb);
|
2011-06-27 09:25:35 +00:00
|
|
|
|
|
|
|
struct femtol1_hdl *l1if_open(void *priv);
|
|
|
|
int l1if_close(struct femtol1_hdl *hdl);
|
|
|
|
int l1if_reset(struct femtol1_hdl *hdl);
|
2011-06-29 18:42:14 +00:00
|
|
|
int l1if_activate_rf(struct femtol1_hdl *hdl, int on);
|
2011-07-05 10:21:27 +00:00
|
|
|
int l1if_set_trace_flags(struct femtol1_hdl *hdl, uint32_t flags);
|
2012-04-19 18:19:21 +00:00
|
|
|
int l1if_set_txpower(struct femtol1_hdl *fl1h, float tx_power);
|
2011-06-27 09:25:35 +00:00
|
|
|
|
|
|
|
struct msgb *l1p_msgb_alloc(void);
|
|
|
|
struct msgb *sysp_msgb_alloc(void);
|
|
|
|
|
2013-01-16 12:44:19 +00:00
|
|
|
uint32_t l1if_lchan_to_hLayer(struct gsm_lchan *lchan);
|
|
|
|
struct gsm_lchan *l1if_hLayer_to_lchan(struct gsm_bts_trx *trx, uint32_t hLayer);
|
2011-06-27 09:25:35 +00:00
|
|
|
|
2011-09-03 13:41:12 +00:00
|
|
|
/* tch.c */
|
2011-07-24 00:52:20 +00:00
|
|
|
int l1if_tch_rx(struct gsm_lchan *lchan, struct msgb *l1p_msg);
|
2011-09-03 13:41:12 +00:00
|
|
|
int l1if_tch_fill(struct gsm_lchan *lchan, uint8_t *l1_buffer);
|
2011-09-19 18:46:51 +00:00
|
|
|
struct msgb *gen_empty_tch_msg(struct gsm_lchan *lchan);
|
2011-07-24 00:52:20 +00:00
|
|
|
|
2012-12-18 23:37:09 +00:00
|
|
|
/* ciphering */
|
|
|
|
int l1if_set_ciphering(struct femtol1_hdl *fl1h,
|
|
|
|
struct gsm_lchan *lchan,
|
|
|
|
int dir_downlink);
|
|
|
|
|
2012-12-19 22:29:31 +00:00
|
|
|
/* calibration loading */
|
|
|
|
int calib_load(struct femtol1_hdl *fl1h);
|
|
|
|
|
2011-06-27 09:25:35 +00:00
|
|
|
#endif /* _FEMTO_L1_H */
|