diff options
Diffstat (limited to 'src/host/virt_phy/include')
16 files changed, 141 insertions, 113 deletions
diff --git a/src/host/virt_phy/include/Makefile.am b/src/host/virt_phy/include/Makefile.am index 6048a4b3..9d963a02 100644 --- a/src/host/virt_phy/include/Makefile.am +++ b/src/host/virt_phy/include/Makefile.am @@ -1,10 +1,3 @@ -noinst_HEADERS = \ - virtphy/logging.h \ - virtphy/osmo_mcast_sock.h \ - virtphy/l1ctl_sock.h \ - virtphy/virtual_um.h \ - virtphy/gsmtapl1_if.h \ - virtphy/virt_l1_sched.h \ - virtphy/common_util.h \ - virtphy/l1ctl_sap.h \ - virtphy/virt_l1_model.h +SUBDIRS = \ + osmocom \ + $(NULL) diff --git a/src/host/virt_phy/include/osmocom/Makefile.am b/src/host/virt_phy/include/osmocom/Makefile.am new file mode 100644 index 00000000..83c6385c --- /dev/null +++ b/src/host/virt_phy/include/osmocom/Makefile.am @@ -0,0 +1,3 @@ +SUBDIRS = \ + bb \ + $(NULL) diff --git a/src/host/virt_phy/include/osmocom/bb/Makefile.am b/src/host/virt_phy/include/osmocom/bb/Makefile.am new file mode 100644 index 00000000..9a4b939a --- /dev/null +++ b/src/host/virt_phy/include/osmocom/bb/Makefile.am @@ -0,0 +1,8 @@ +SUBDIRS = \ + virtphy \ + $(NULL) + +noinst_HEADERS = \ + l1ctl_proto.h \ + l1gprs.h \ + $(NULL) diff --git a/src/host/virt_phy/include/osmocom/bb/l1ctl_proto.h b/src/host/virt_phy/include/osmocom/bb/l1ctl_proto.h new file mode 120000 index 00000000..ee19b80e --- /dev/null +++ b/src/host/virt_phy/include/osmocom/bb/l1ctl_proto.h @@ -0,0 +1 @@ +../../../../../../include/l1ctl_proto.h
\ No newline at end of file diff --git a/src/host/virt_phy/include/osmocom/bb/l1gprs.h b/src/host/virt_phy/include/osmocom/bb/l1gprs.h new file mode 120000 index 00000000..3bf85176 --- /dev/null +++ b/src/host/virt_phy/include/osmocom/bb/l1gprs.h @@ -0,0 +1 @@ +../../../../../../include/l1gprs.h
\ No newline at end of file diff --git a/src/host/virt_phy/include/osmocom/bb/virtphy/Makefile.am b/src/host/virt_phy/include/osmocom/bb/virtphy/Makefile.am new file mode 100644 index 00000000..75846096 --- /dev/null +++ b/src/host/virt_phy/include/osmocom/bb/virtphy/Makefile.am @@ -0,0 +1,11 @@ +noinst_HEADERS = \ + logging.h \ + osmo_mcast_sock.h \ + l1ctl_sock.h \ + virtual_um.h \ + gsmtapl1_if.h \ + virt_l1_sched.h \ + common_util.h \ + l1ctl_sap.h \ + virt_l1_model.h \ + $(NULL) diff --git a/src/host/virt_phy/include/virtphy/common_util.h b/src/host/virt_phy/include/osmocom/bb/virtphy/common_util.h index 2585d069..2585d069 100644 --- a/src/host/virt_phy/include/virtphy/common_util.h +++ b/src/host/virt_phy/include/osmocom/bb/virtphy/common_util.h diff --git a/src/host/virt_phy/include/virtphy/gsmtapl1_if.h b/src/host/virt_phy/include/osmocom/bb/virtphy/gsmtapl1_if.h index 8dab6b28..c9e92525 100644 --- a/src/host/virt_phy/include/virtphy/gsmtapl1_if.h +++ b/src/host/virt_phy/include/osmocom/bb/virtphy/gsmtapl1_if.h @@ -2,9 +2,10 @@ #include <osmocom/core/msgb.h> #include <osmocom/core/gsmtap.h> -#include <virtphy/virtual_um.h> -#include <virtphy/l1ctl_sock.h> -#include <virtphy/virt_l1_model.h> + +#include <osmocom/bb/virtphy/virtual_um.h> +#include <osmocom/bb/virtphy/l1ctl_sock.h> +#include <osmocom/bb/virtphy/virt_l1_model.h> void gsmtapl1_init(struct l1_model_ms *model); void gsmtapl1_rx_from_virt_um_inst_cb(struct virt_um_inst *vui, diff --git a/src/host/virt_phy/include/osmocom/bb/virtphy/l1ctl_sap.h b/src/host/virt_phy/include/osmocom/bb/virtphy/l1ctl_sap.h new file mode 100644 index 00000000..e756c140 --- /dev/null +++ b/src/host/virt_phy/include/osmocom/bb/virtphy/l1ctl_sap.h @@ -0,0 +1,85 @@ +#pragma once + +#include <stdint.h> + +#include <osmocom/core/msgb.h> + +#include <osmocom/bb/virtphy/virtual_um.h> +#include <osmocom/bb/virtphy/l1ctl_sock.h> +#include <osmocom/bb/virtphy/virt_l1_model.h> +#include <osmocom/bb/l1ctl_proto.h> + +/* following sizes are used for message allocation */ +/* size of layer 3 header */ +#define L3_MSG_HEAD 4 +/* size of layer 3 payload */ +#define L3_MSG_DATA 200 +#define L3_MSG_SIZE (sizeof(struct l1ctl_hdr) + L3_MSG_HEAD + L3_MSG_DATA) + +/* lchan link ID */ +#define LID_SACCH 0x40 +#define LID_DEDIC 0x00 + +/* signature strengths for the ms */ +#define MIN_SIG_LEV_DBM -110 +#define MAX_SIG_LEV_DBM -63 + +/* Ignore all flags of the arfcn */ +#define ARFCN_NO_FLAGS_MASK 0x0fff + + +void l1ctl_sap_init(struct l1_model_ms *model); +void l1ctl_sap_exit(struct l1_model_ms *model); +void prim_pm_init(struct l1_model_ms *model); +void prim_pm_exit(struct l1_model_ms *model); +void l1ctl_sap_tx_to_l23_inst(struct l1_model_ms *model, struct msgb *msg); +void l1ctl_sap_rx_from_l23_inst_cb(struct l1ctl_sock_client *lsc, struct msgb *msg); +void l1ctl_sap_handler(struct l1_model_ms *ms, struct msgb *msg); + +/* utility methods */ +struct msgb *l1ctl_msgb_alloc(uint8_t msg_type); +struct msgb *l1ctl_create_l2_msg(int msg_type, uint32_t fn, uint16_t snr, + uint16_t arfcn); + +/* receive routines */ +void l1ctl_rx_fbsb_req(struct l1_model_ms *ms, struct msgb *msg); +void l1ctl_rx_dm_est_req(struct l1_model_ms *ms, struct msgb *msg); +void l1ctl_rx_dm_rel_req(struct l1_model_ms *ms, struct msgb *msg); +void l1ctl_rx_param_req(struct l1_model_ms *ms, struct msgb *msg); +void l1ctl_rx_dm_freq_req(struct l1_model_ms *ms, struct msgb *msg); +void l1ctl_rx_crypto_req(struct l1_model_ms *ms, struct msgb *msg); +void l1ctl_rx_rach_req(struct l1_model_ms *ms, struct msgb *msg); +void l1ctl_rx_data_req(struct l1_model_ms *ms, struct msgb *msg); +void l1ctl_rx_pm_req(struct l1_model_ms *ms, struct msgb *msg); +void l1ctl_rx_reset_req(struct l1_model_ms *ms, struct msgb *msg); +void l1ctl_rx_ccch_mode_req(struct l1_model_ms *ms, struct msgb *msg); +void l1ctl_rx_tch_mode_req(struct l1_model_ms *ms, struct msgb *msg); +void l1ctl_rx_neigh_pm_req(struct l1_model_ms *ms, struct msgb *msg); +void l1ctl_rx_traffic_req(struct l1_model_ms *ms, struct msgb *msg); +void l1ctl_rx_sim_req(struct l1_model_ms *ms, struct msgb *msg); +void l1ctl_rx_gprs_uldl_tbf_cfg_req(struct l1_model_ms *ms, struct msgb *msg); +void l1ctl_rx_gprs_ul_block_req(struct l1_model_ms *ms, struct msgb *msg); + +/* transmit routines */ +void l1ctl_tx_reset(struct l1_model_ms *ms, uint8_t msg_type, uint8_t reset_type); +void l1ctl_tx_rach_conf(struct l1_model_ms *ms, uint32_t fn, uint16_t arfcn); +void l1ctl_tx_data_conf(struct l1_model_ms *ms, uint32_t fn, uint16_t snr, uint16_t arfcn); +void l1ctl_tx_data_ind(struct l1_model_ms *ms, struct msgb *msg, uint16_t arfcn, uint8_t link_id, + uint8_t chan_nr, uint32_t fn, uint8_t snr, + uint8_t rxlev, uint8_t num_biterr, + uint8_t fire_crc); +void l1ctl_tx_traffic_conf(struct l1_model_ms *ms, uint32_t fn, uint16_t snr, uint16_t arfcn); +void l1ctl_tx_traffic_ind(struct l1_model_ms *ms, struct msgb *msg, uint16_t arfcn, uint8_t link_id, + uint8_t chan_nr, uint32_t fn, uint8_t snr, + uint8_t rxlev, uint8_t num_biterr, + uint8_t fire_crc); +void l1ctl_tx_pm_conf(struct l1_model_ms *ms, struct l1ctl_pm_req *pm_req); +void l1ctl_tx_fbsb_conf(struct l1_model_ms *ms, uint8_t res, uint16_t arfcn); +void l1ctl_tx_ccch_mode_conf(struct l1_model_ms *ms, uint8_t ccch_mode); +void l1ctl_tx_tch_mode_conf(struct l1_model_ms *ms, uint8_t tch_mode, uint8_t audio_mode); +void l1ctl_tx_gprs_dl_block_ind(struct l1_model_ms *ms, const struct msgb *msg, + uint32_t fn, uint8_t tn, uint8_t rxlev); + +/* scheduler functions */ +uint32_t sched_fn_ul(struct gsm_time cur_time, uint8_t chan_nr, + uint8_t link_id); diff --git a/src/host/virt_phy/include/virtphy/l1ctl_sock.h b/src/host/virt_phy/include/osmocom/bb/virtphy/l1ctl_sock.h index 2c98fa58..2c98fa58 100644 --- a/src/host/virt_phy/include/virtphy/l1ctl_sock.h +++ b/src/host/virt_phy/include/osmocom/bb/virtphy/l1ctl_sock.h diff --git a/src/host/virt_phy/include/virtphy/logging.h b/src/host/virt_phy/include/osmocom/bb/virtphy/logging.h index b22db992..1727453e 100644 --- a/src/host/virt_phy/include/virtphy/logging.h +++ b/src/host/virt_phy/include/osmocom/bb/virtphy/logging.h @@ -7,6 +7,7 @@ enum virtphy_log_cat { DL1C, DL1P, DVIRPHY, + DGPRS, DMAIN }; @@ -15,5 +16,5 @@ enum virtphy_log_cat { extern const struct log_info ms_log_info; -int ms_log_init(char *cat_mask); +int ms_log_init(void *ctx, const char *cat_mask); const char *getL1ctlPrimName(uint8_t type); diff --git a/src/host/virt_phy/include/virtphy/osmo_mcast_sock.h b/src/host/virt_phy/include/osmocom/bb/virtphy/osmo_mcast_sock.h index aa2013c6..aa2013c6 100644 --- a/src/host/virt_phy/include/virtphy/osmo_mcast_sock.h +++ b/src/host/virt_phy/include/osmocom/bb/virtphy/osmo_mcast_sock.h diff --git a/src/host/virt_phy/include/virtphy/virt_l1_model.h b/src/host/virt_phy/include/osmocom/bb/virtphy/virt_l1_model.h index 67c24bb6..94581f61 100644 --- a/src/host/virt_phy/include/virtphy/virt_l1_model.h +++ b/src/host/virt_phy/include/osmocom/bb/virtphy/virt_l1_model.h @@ -2,11 +2,12 @@ /* Per-MS specific state, closely attached to the L1CTL user progran */ -#include <virtphy/virtual_um.h> -#include <virtphy/l1ctl_sock.h> #include <osmocom/gsm/gsm_utils.h> #include <osmocom/core/timer.h> +#include <osmocom/bb/virtphy/virtual_um.h> +#include <osmocom/bb/virtphy/l1ctl_sock.h> + #define L1S_NUM_NEIGH_CELL 6 #define A5_KEY_LEN 8 @@ -15,7 +16,6 @@ enum ms_state { MS_STATE_IDLE_SYNCING, MS_STATE_IDLE_CAMPING, MS_STATE_DEDICATED, - MS_STATE_TBF }; @@ -27,7 +27,7 @@ struct l1_cell_info { uint8_t bsic; /* Combined or non-combined CCCH */ uint8_t ccch_mode; /* enum ccch_mode */ - /* whats the delta of the cells current GSM frame number + /* what's the delta of the cells current GSM frame number * compared to our current local frame number */ int32_t fn_offset; /* how much does the TPU need adjustment (delta) to synchronize @@ -68,22 +68,14 @@ struct l1_state_ms { struct { uint8_t chan_type; // like rsl chantype 08.58 -> Chapter 9.3.1 */ + uint16_t band_arfcn; uint8_t tn; // timeslot number 1-7 uint8_t subslot; // subslot of the dedicated channel, SDCCH/4:[0-3], SDCCH/8:[0-7] - uint8_t scn; // single-hop cellular network? (ununsed in virtual um) - uint8_t tsc; // training sequence code (ununsed in virtual um) - uint8_t h; // hopping enabled flag (ununsed in virtual um) + uint8_t scn; // single-hop cellular network? (unused in virtual um) + uint8_t tsc; // training sequence code (unused in virtual um) + uint8_t h; // hopping enabled flag (unused in virtual um) } dedicated; - struct { - struct { - uint8_t usf[8]; - struct llist_head tx_queue; - } ul; - struct { - uint8_t tfi[8]; - } dl; - } tbf; /* fbsb state */ struct { @@ -99,6 +91,12 @@ struct l1_state_ms { uint8_t arfcn_sig_lev_red_dbm[1024]; struct osmo_timer_list arfcn_sig_lev_timers[1024]; } meas; + struct { + uint16_t band_arfcn_from; + uint16_t band_arfcn_to; + /* timer between receiving PM_REQ and responding with PM_CONF */ + struct osmo_timer_list timer; + } req; } pm; }; @@ -108,6 +106,8 @@ struct l1_model_ms { struct l1ctl_sock_client *lsc; /* pointer to the (shared) GSMTAP/VirtUM socket to talk to BTS(s) */ struct virt_um_inst *vui; + /* GPRS state (MAC layer) */ + struct l1gprs_state *gprs; /* actual per-MS state */ struct l1_state_ms state; }; diff --git a/src/host/virt_phy/include/virtphy/virt_l1_sched.h b/src/host/virt_phy/include/osmocom/bb/virtphy/virt_l1_sched.h index b8d401ff..d5a1630f 100644 --- a/src/host/virt_phy/include/virtphy/virt_l1_sched.h +++ b/src/host/virt_phy/include/osmocom/bb/virtphy/virt_l1_sched.h @@ -1,9 +1,11 @@ #pragma once + #include <osmocom/core/msgb.h> -#include <virtphy/virt_l1_model.h> #include <osmocom/core/linuxlist.h> #include <osmocom/gsm/gsm_utils.h> -#include <virtphy/virt_l1_sched.h> + +#include <osmocom/bb/virtphy/virt_l1_model.h> +#include <osmocom/bb/virtphy/virt_l1_sched.h> struct l1_model_ms; diff --git a/src/host/virt_phy/include/virtphy/virtual_um.h b/src/host/virt_phy/include/osmocom/bb/virtphy/virtual_um.h index 52f2df64..fe060929 100644 --- a/src/host/virt_phy/include/virtphy/virtual_um.h +++ b/src/host/virt_phy/include/osmocom/bb/virtphy/virtual_um.h @@ -17,7 +17,9 @@ #define VIRT_UM_MSGB_SIZE 256 #define DEFAULT_MS_MCAST_GROUP "239.193.23.1" +#define DEFAULT_MS_MCAST_PORT 4729 /* IANA-registered port for GSMTAP */ #define DEFAULT_BTS_MCAST_GROUP "239.193.23.2" +#define DEFAULT_BTS_MCAST_PORT 4729 /* IANA-registered port for GSMTAP */ struct virt_um_inst { void *priv; @@ -27,7 +29,7 @@ struct virt_um_inst { struct virt_um_inst *virt_um_init( void *ctx, char *tx_mcast_group, uint16_t tx_mcast_port, - char *rx_mcast_group, uint16_t rx_mcast_port, + char *rx_mcast_group, uint16_t rx_mcast_port, int ttl, const char *dev_name, void (*recv_cb)(struct virt_um_inst *vui, struct msgb *msg)); void virt_um_destroy(struct virt_um_inst *vui); diff --git a/src/host/virt_phy/include/virtphy/l1ctl_sap.h b/src/host/virt_phy/include/virtphy/l1ctl_sap.h deleted file mode 100644 index 94174da4..00000000 --- a/src/host/virt_phy/include/virtphy/l1ctl_sap.h +++ /dev/null @@ -1,80 +0,0 @@ -#pragma once - -#include <stdint.h> -#include <osmocom/core/msgb.h> -#include <l1ctl_proto.h> -#include <virtphy/virtual_um.h> -#include <virtphy/l1ctl_sock.h> -#include <virtphy/virt_l1_model.h> - -/* following sizes are used for message allocation */ -/* size of layer 3 header */ -#define L3_MSG_HEAD 4 -/* size of layer 3 payload */ -#define L3_MSG_DATA 200 -#define L3_MSG_SIZE (sizeof(struct l1ctl_hdr) + L3_MSG_HEAD + L3_MSG_DATA) - -/* lchan link ID */ -#define LID_SACCH 0x40 -#define LID_DEDIC 0x00 - -/* signature strengths for the ms */ -#define MIN_SIG_LEV_DBM -110 -#define MAX_SIG_LEV_DBM -63 - -/* Ignore all flags of the arfcn */ -#define ARFCN_NO_FLAGS_MASK 0x0fff - - -void l1ctl_sap_init(struct l1_model_ms *model); -void l1ctl_sap_exit(struct l1_model_ms *model); -void prim_pm_init(struct l1_model_ms *model); -void prim_pm_exit(struct l1_model_ms *model); -void l1ctl_sap_tx_to_l23_inst(struct l1_model_ms *model, struct msgb *msg); -void l1ctl_sap_rx_from_l23_inst_cb(struct l1ctl_sock_client *lsc, struct msgb *msg); -void l1ctl_sap_rx_from_l23(struct msgb *msg); -void l1ctl_sap_handler(struct l1_model_ms *ms, struct msgb *msg); - -/* utility methods */ -struct msgb *l1ctl_msgb_alloc(uint8_t msg_type); -struct msgb *l1ctl_create_l2_msg(int msg_type, uint32_t fn, uint16_t snr, - uint16_t arfcn); - -/* receive routines */ -void l1ctl_rx_fbsb_req(struct l1_model_ms *, struct msgb *msg); -void l1ctl_rx_dm_est_req(struct l1_model_ms *, struct msgb *msg); -void l1ctl_rx_dm_rel_req(struct l1_model_ms *, struct msgb *msg); -void l1ctl_rx_param_req(struct l1_model_ms *, struct msgb *msg); -void l1ctl_rx_dm_freq_req(struct l1_model_ms *, struct msgb *msg); -void l1ctl_rx_crypto_req(struct l1_model_ms *, struct msgb *msg); -void l1ctl_rx_rach_req(struct l1_model_ms *, struct msgb *msg); -void l1ctl_rx_data_req(struct l1_model_ms *, struct msgb *msg); -void l1ctl_rx_pm_req(struct l1_model_ms *, struct msgb *msg); -void l1ctl_rx_reset_req(struct l1_model_ms *, struct msgb *msg); -void l1ctl_rx_ccch_mode_req(struct l1_model_ms *, struct msgb *msg); -void l1ctl_rx_tch_mode_req(struct l1_model_ms *, struct msgb *msg); -void l1ctl_rx_neigh_pm_req(struct l1_model_ms *, struct msgb *msg); -void l1ctl_rx_traffic_req(struct l1_model_ms *, struct msgb *msg); -void l1ctl_rx_sim_req(struct l1_model_ms *, struct msgb *msg); - -/* transmit routines */ -void l1ctl_tx_reset(struct l1_model_ms *, uint8_t msg_type, uint8_t reset_type); -void l1ctl_tx_rach_conf(struct l1_model_ms *, uint32_t fn, uint16_t arfcn); -void l1ctl_tx_data_conf(struct l1_model_ms *, uint32_t fn, uint16_t snr, uint16_t arfcn); -void l1ctl_tx_data_ind(struct l1_model_ms *, struct msgb *msg, uint16_t arfcn, uint8_t link_id, - uint8_t chan_nr, uint32_t fn, uint8_t snr, - uint8_t signal_dbm, uint8_t num_biterr, - uint8_t fire_crc); -void l1ctl_tx_traffic_conf(struct l1_model_ms *, uint32_t fn, uint16_t snr, uint16_t arfcn); -void l1ctl_tx_traffic_ind(struct l1_model_ms *, struct msgb *msg, uint16_t arfcn, uint8_t link_id, - uint8_t chan_nr, uint32_t fn, uint8_t snr, - uint8_t signal_dbm, uint8_t num_biterr, - uint8_t fire_crc); -void l1ctl_tx_pm_conf(struct l1_model_ms *, struct l1ctl_pm_req *pm_req); -void l1ctl_tx_fbsb_conf(struct l1_model_ms *, uint8_t res, uint16_t arfcn); -void l1ctl_tx_ccch_mode_conf(struct l1_model_ms *, uint8_t ccch_mode); -void l1ctl_tx_tch_mode_conf(struct l1_model_ms *, uint8_t tch_mode, uint8_t audio_mode); - -/* scheduler functions */ -uint32_t sched_fn_ul(struct gsm_time cur_time, uint8_t chan_nr, - uint8_t link_id); |