2017-01-09 16:05:31 +00:00
|
|
|
/* osmocom includes */
|
|
|
|
|
|
|
|
#include <osmocom/core/msgb.h>
|
|
|
|
#include <osmocom/core/select.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
2017-02-06 13:14:31 +00:00
|
|
|
#include <virtphy/virtual_um.h>
|
|
|
|
#include <virtphy/l1ctl_sock.h>
|
|
|
|
#include <virtphy/virt_l1_model.h>
|
|
|
|
#include <virtphy/l1ctl_sap.h>
|
|
|
|
#include <virtphy/gsmtapl1_if.h>
|
|
|
|
#include <virtphy/logging.h>
|
2017-01-09 16:05:31 +00:00
|
|
|
|
2017-02-09 16:59:54 +00:00
|
|
|
int main( int argc, char *argv[] )
|
2017-01-09 16:05:31 +00:00
|
|
|
{
|
|
|
|
// init loginfo
|
|
|
|
static struct l1_model_ms *model;
|
2017-02-09 16:59:54 +00:00
|
|
|
char * l1ctl_sock_path = NULL;
|
|
|
|
|
|
|
|
// get path from commandline argument
|
|
|
|
if( argc > 1 ) {
|
|
|
|
l1ctl_sock_path = argv[1];
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-02-02 17:50:02 +00:00
|
|
|
//ms_log_init("DL1C,1:DVIRPHY,1");
|
|
|
|
ms_log_init("DL1C,1");
|
2017-01-09 16:05:31 +00:00
|
|
|
//ms_log_init("DL1C,8:DVIRPHY,8");
|
|
|
|
|
|
|
|
LOGP(DVIRPHY, LOGL_INFO, "Virtual physical layer starting up...\n");
|
|
|
|
|
|
|
|
model = l1_model_ms_init(NULL);
|
|
|
|
|
|
|
|
// TODO: make this configurable
|
2017-02-02 17:50:02 +00:00
|
|
|
model->vui = virt_um_init(NULL, DEFAULT_BTS_MCAST_GROUP,
|
2017-02-06 13:14:31 +00:00
|
|
|
DEFAULT_BTS_MCAST_PORT, DEFAULT_MS_MCAST_GROUP,
|
|
|
|
DEFAULT_MS_MCAST_PORT, gsmtapl1_rx_from_virt_um_inst_cb);
|
2017-02-09 16:59:54 +00:00
|
|
|
model->lsi = l1ctl_sock_init(NULL, l1ctl_sap_rx_from_l23_inst_cb, l1ctl_sock_path);
|
2017-01-09 16:05:31 +00:00
|
|
|
|
|
|
|
gsmtapl1_init(model);
|
|
|
|
l1ctl_sap_init(model);
|
|
|
|
|
2017-02-09 16:59:54 +00:00
|
|
|
LOGP(DVIRPHY, LOGL_INFO, "Virtual physical layer ready...\n \
|
|
|
|
Waiting for l23 app on", l1ctl_sock_path);
|
2017-01-09 16:05:31 +00:00
|
|
|
|
|
|
|
while (1) {
|
|
|
|
// handle osmocom fd READ events (l1ctl-unix-socket, virtual-um-mcast-socket)
|
|
|
|
osmo_select_main(0);
|
|
|
|
// handle outgoing l1ctl primitives to l2
|
|
|
|
// TODO implement scheduler for uplink messages
|
|
|
|
}
|
|
|
|
|
|
|
|
l1_model_ms_destroy(model);
|
|
|
|
|
|
|
|
// not reached
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|