2010-02-18 15:46:36 +00:00
|
|
|
#ifndef osmocom_data_h
|
|
|
|
#define osmocom_data_h
|
|
|
|
|
2018-11-21 03:54:48 +00:00
|
|
|
#include <osmocom/core/msgb.h>
|
2011-04-26 00:55:30 +00:00
|
|
|
#include <osmocom/core/select.h>
|
|
|
|
#include <osmocom/gsm/gsm_utils.h>
|
|
|
|
#include <osmocom/core/write_queue.h>
|
2010-02-18 15:46:36 +00:00
|
|
|
|
2010-04-05 11:26:09 +00:00
|
|
|
struct osmocom_ms;
|
|
|
|
|
2010-07-27 18:44:46 +00:00
|
|
|
/* FIXME no 'mobile' specific stuff should be here */
|
|
|
|
#include <osmocom/bb/mobile/support.h>
|
|
|
|
#include <osmocom/bb/mobile/settings.h>
|
|
|
|
#include <osmocom/bb/mobile/subscriber.h>
|
2011-09-19 17:49:22 +00:00
|
|
|
#include <osmocom/gsm/lapdm.h>
|
2010-09-11 10:42:29 +00:00
|
|
|
#include <osmocom/bb/common/sap_interface.h>
|
2010-07-27 18:44:46 +00:00
|
|
|
#include <osmocom/bb/mobile/gsm48_rr.h>
|
2010-10-24 13:30:17 +00:00
|
|
|
#include <osmocom/bb/common/sysinfo.h>
|
2010-07-27 18:44:46 +00:00
|
|
|
#include <osmocom/bb/mobile/gsm322.h>
|
|
|
|
#include <osmocom/bb/mobile/gsm48_mm.h>
|
|
|
|
#include <osmocom/bb/mobile/gsm48_cc.h>
|
2011-09-02 09:16:10 +00:00
|
|
|
#include <osmocom/bb/mobile/mncc_sock.h>
|
2010-09-18 19:15:15 +00:00
|
|
|
#include <osmocom/bb/common/sim.h>
|
2011-07-28 18:54:42 +00:00
|
|
|
#include <osmocom/bb/common/l1ctl.h>
|
2010-04-25 16:28:24 +00:00
|
|
|
|
2010-09-11 10:42:29 +00:00
|
|
|
struct osmosap_entity {
|
|
|
|
osmosap_cb_t msg_handler;
|
2015-04-28 13:57:54 +00:00
|
|
|
uint8_t sap_state;
|
|
|
|
uint16_t max_msg_size;
|
2010-09-11 10:42:29 +00:00
|
|
|
};
|
|
|
|
|
2011-07-28 18:54:42 +00:00
|
|
|
struct osmol1_entity {
|
|
|
|
int (*l1_traffic_ind)(struct osmocom_ms *ms, struct msgb *msg);
|
|
|
|
};
|
|
|
|
|
|
|
|
struct osmomncc_entity {
|
|
|
|
int (*mncc_recv)(struct osmocom_ms *ms, int msg_type, void *arg);
|
2011-09-02 09:16:10 +00:00
|
|
|
struct mncc_sock_state *sock_state;
|
2011-07-28 18:54:42 +00:00
|
|
|
uint32_t ref;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2010-07-16 10:52:38 +00:00
|
|
|
/* RX measurement statistics */
|
|
|
|
struct rx_meas_stat {
|
2010-08-14 17:10:26 +00:00
|
|
|
uint32_t last_fn;
|
2010-09-26 10:35:46 +00:00
|
|
|
|
|
|
|
/* cumulated values of current cell from SACCH dl */
|
2010-07-16 10:52:38 +00:00
|
|
|
uint32_t frames;
|
2010-08-14 17:10:26 +00:00
|
|
|
uint32_t snr;
|
2010-07-16 10:52:38 +00:00
|
|
|
uint32_t berr;
|
|
|
|
uint32_t rxlev;
|
2010-10-12 08:26:48 +00:00
|
|
|
|
|
|
|
/* counters loss criterion */
|
|
|
|
int16_t dsc, ds_fail;
|
|
|
|
int16_t s, rl_fail;
|
2010-07-16 10:52:38 +00:00
|
|
|
};
|
|
|
|
|
2017-11-15 11:25:47 +00:00
|
|
|
enum {
|
|
|
|
MS_SHUTDOWN_NONE = 0,
|
|
|
|
MS_SHUTDOWN_IMSI_DETACH = 1,
|
|
|
|
MS_SHUTDOWN_WAIT_RESET = 2,
|
|
|
|
MS_SHUTDOWN_COMPL = 3,
|
|
|
|
};
|
|
|
|
|
2010-02-18 15:46:36 +00:00
|
|
|
/* One Mobilestation for osmocom */
|
|
|
|
struct osmocom_ms {
|
2010-05-09 16:01:49 +00:00
|
|
|
struct llist_head entity;
|
2017-05-16 23:26:00 +00:00
|
|
|
char *name;
|
2011-05-15 12:23:14 +00:00
|
|
|
struct osmo_wqueue l2_wq, sap_wq;
|
2010-04-25 15:31:35 +00:00
|
|
|
uint16_t test_arfcn;
|
2011-07-28 18:54:42 +00:00
|
|
|
struct osmol1_entity l1_entity;
|
2010-03-02 17:47:01 +00:00
|
|
|
|
2017-11-15 09:19:07 +00:00
|
|
|
bool started, deleting;
|
|
|
|
uint8_t shutdown;
|
2010-04-25 16:28:24 +00:00
|
|
|
struct gsm_support support;
|
2010-05-23 20:53:32 +00:00
|
|
|
struct gsm_settings settings;
|
2010-04-25 16:28:24 +00:00
|
|
|
struct gsm_subscriber subscr;
|
2010-08-28 09:36:07 +00:00
|
|
|
struct gsm_sim sim;
|
2011-05-22 18:10:34 +00:00
|
|
|
struct lapdm_channel lapdm_channel;
|
2010-09-11 10:42:29 +00:00
|
|
|
struct osmosap_entity sap_entity;
|
2010-07-16 10:52:38 +00:00
|
|
|
struct rx_meas_stat meas;
|
2010-04-25 16:28:24 +00:00
|
|
|
struct gsm48_rrlayer rrlayer;
|
|
|
|
struct gsm322_plmn plmn;
|
|
|
|
struct gsm322_cellsel cellsel;
|
|
|
|
struct gsm48_mmlayer mmlayer;
|
|
|
|
struct gsm48_cclayer cclayer;
|
2011-07-28 18:54:42 +00:00
|
|
|
struct osmomncc_entity mncc_entity;
|
2010-04-25 16:28:24 +00:00
|
|
|
struct llist_head trans_list;
|
2017-11-08 13:59:06 +00:00
|
|
|
|
2018-11-21 03:54:48 +00:00
|
|
|
/* PHY info / features */
|
|
|
|
struct msgb *phy_info;
|
|
|
|
|
2017-11-08 13:59:06 +00:00
|
|
|
void *lua_state;
|
mobile: Create "ms" singleton for struct osmocom_ms
Make the MS the script is associated with accessible to lua. Provide
access to IMSI and IMEI. The IMSI might not be available at the given
time and just return an empty string.
Example lua usage:
print(osmo.ms():imsi());
print(osmo.ms():imei());
print(osmo.ms():shutdown_state())
print(osmo.ms():started())
function ms_started_cb(started)
print("MS started", started)
end
function ms_shutdown_cb(old_state, new_state)
print("MS shutdown", old_state, "->", new_state)
end
function sms_cb(sms, cause, valid)
print("SMS data cb", sms, cause, valid)
for i, v in pairs(sms) do
print(i, v)
end
end
function mm_cb(new_state, new_substate, old_substate)
if new_state == 19 and new_substate == 1 then
osmo.ms():sms_send_simple("1234", "21321324", "fooooooo", 23)
end
end
local cbs = {
Started=ms_started_cb,
Shutdown=ms_shutdown_cb,
Sms=sms_cb,
Mm=mm_cb
}
timer = osmo.timeout(20, function()
print("Timeout occurred after 20s")
end)
osmo.ms():register(cbs)
# Can fail. Best to wait for state changes...
print(osmo.ms().start())
print(osmo.ms().stop(true))
Change-Id: Ia3ace33d6ba4e904b1ff8e271a02d67777334a58
2017-11-13 09:36:18 +00:00
|
|
|
int lua_cb_ref;
|
2017-11-08 13:59:06 +00:00
|
|
|
char *lua_script;
|
2010-02-18 15:46:36 +00:00
|
|
|
};
|
|
|
|
|
2010-04-05 13:28:59 +00:00
|
|
|
enum osmobb_sig_subsys {
|
|
|
|
SS_L1CTL,
|
2010-11-13 18:45:09 +00:00
|
|
|
SS_GLOBAL,
|
2010-04-05 13:28:59 +00:00
|
|
|
};
|
|
|
|
|
2010-11-13 18:45:09 +00:00
|
|
|
enum osmobb_l1ctl_sig {
|
2010-05-19 19:41:24 +00:00
|
|
|
S_L1CTL_FBSB_ERR,
|
|
|
|
S_L1CTL_FBSB_RESP,
|
2010-04-05 13:28:59 +00:00
|
|
|
S_L1CTL_RESET,
|
|
|
|
S_L1CTL_PM_RES,
|
2010-04-05 14:21:36 +00:00
|
|
|
S_L1CTL_PM_DONE,
|
2010-06-28 13:33:14 +00:00
|
|
|
S_L1CTL_CCCH_MODE_CONF,
|
2010-09-26 17:06:06 +00:00
|
|
|
S_L1CTL_TCH_MODE_CONF,
|
2010-10-12 08:26:48 +00:00
|
|
|
S_L1CTL_LOSS_IND,
|
2011-07-17 07:36:49 +00:00
|
|
|
S_L1CTL_NEIGH_PM_IND,
|
2018-11-21 03:54:48 +00:00
|
|
|
S_L1CTL_NEGO_IND,
|
2010-04-05 13:28:59 +00:00
|
|
|
};
|
|
|
|
|
2010-11-13 18:45:09 +00:00
|
|
|
enum osmobb_global_sig {
|
|
|
|
S_GLOBAL_SHUTDOWN,
|
|
|
|
};
|
|
|
|
|
2010-09-26 10:35:46 +00:00
|
|
|
struct osmobb_fbsb_res {
|
|
|
|
struct osmocom_ms *ms;
|
|
|
|
int8_t snr;
|
|
|
|
uint8_t bsic;
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
uint16_t band_arfcn;
|
2010-09-26 10:35:46 +00:00
|
|
|
};
|
|
|
|
|
2010-04-05 13:28:59 +00:00
|
|
|
struct osmobb_meas_res {
|
|
|
|
struct osmocom_ms *ms;
|
|
|
|
uint16_t band_arfcn;
|
|
|
|
uint8_t rx_lev;
|
|
|
|
};
|
|
|
|
|
2010-06-28 13:33:14 +00:00
|
|
|
struct osmobb_ccch_mode_conf {
|
|
|
|
struct osmocom_ms *ms;
|
|
|
|
uint8_t ccch_mode;
|
|
|
|
};
|
|
|
|
|
2010-09-26 17:06:06 +00:00
|
|
|
struct osmobb_tch_mode_conf {
|
|
|
|
struct osmocom_ms *ms;
|
|
|
|
uint8_t tch_mode;
|
2011-07-28 18:54:42 +00:00
|
|
|
uint8_t audio_mode;
|
2010-09-26 17:06:06 +00:00
|
|
|
};
|
|
|
|
|
2011-07-17 07:36:49 +00:00
|
|
|
struct osmobb_neigh_pm_ind {
|
|
|
|
struct osmocom_ms *ms;
|
|
|
|
uint16_t band_arfcn;
|
|
|
|
uint8_t rx_lev;
|
|
|
|
};
|
|
|
|
|
2010-02-18 15:46:36 +00:00
|
|
|
#endif
|