summaryrefslogtreecommitdiffstats
path: root/src/utils
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/Makefile.am4
-rw-r--r--src/utils/Makefile.in8
-rw-r--r--src/utils/bs11_config.c73
-rw-r--r--src/utils/isdnsync.c1
-rw-r--r--src/utils/rs232.c22
5 files changed, 52 insertions, 56 deletions
diff --git a/src/utils/Makefile.am b/src/utils/Makefile.am
index 2351f8a46..c2d2085b0 100644
--- a/src/utils/Makefile.am
+++ b/src/utils/Makefile.am
@@ -1,6 +1,6 @@
INCLUDES = $(all_includes) -I$(top_srcdir)/include -I$(top_builddir)
-AM_CFLAGS=-Wall $(LIBOSMOCORE_CFLAGS) $(LIBOSMOVTY_CFLAGS) $(COVERAGE_CFLAGS)
-AM_LDFLAGS = $(LIBOSMOCORE_LIBS) $(COVERAGE_LDFLAGS)
+AM_CFLAGS=-Wall $(LIBOSMOCORE_CFLAGS) $(LIBOSMOGSM_CFLAGS) $(LIBOSMOVTY_CFLAGS) $(COVERAGE_CFLAGS)
+AM_LDFLAGS = $(LIBOSMOCORE_LIBS) $(LIBOSMOGSM_LIBS) $(COVERAGE_LDFLAGS)
bin_PROGRAMS = bs11_config isdnsync
diff --git a/src/utils/Makefile.in b/src/utils/Makefile.in
index 17e8ad6e6..25f0f4ea4 100644
--- a/src/utils/Makefile.in
+++ b/src/utils/Makefile.in
@@ -36,7 +36,7 @@ bin_PROGRAMS = bs11_config$(EXEEXT) isdnsync$(EXEEXT)
subdir = src/utils
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/configure.in
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
@@ -111,6 +111,8 @@ LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBOSMOCORE_CFLAGS = @LIBOSMOCORE_CFLAGS@
LIBOSMOCORE_LIBS = @LIBOSMOCORE_LIBS@
+LIBOSMOGSM_CFLAGS = @LIBOSMOGSM_CFLAGS@
+LIBOSMOGSM_LIBS = @LIBOSMOGSM_LIBS@
LIBOSMOSCCP_CFLAGS = @LIBOSMOSCCP_CFLAGS@
LIBOSMOSCCP_LIBS = @LIBOSMOSCCP_LIBS@
LIBOSMOVTY_CFLAGS = @LIBOSMOVTY_CFLAGS@
@@ -180,8 +182,8 @@ top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
INCLUDES = $(all_includes) -I$(top_srcdir)/include -I$(top_builddir)
-AM_CFLAGS = -Wall $(LIBOSMOCORE_CFLAGS) $(LIBOSMOVTY_CFLAGS) $(COVERAGE_CFLAGS)
-AM_LDFLAGS = $(LIBOSMOCORE_LIBS) $(COVERAGE_LDFLAGS)
+AM_CFLAGS = -Wall $(LIBOSMOCORE_CFLAGS) $(LIBOSMOGSM_CFLAGS) $(LIBOSMOVTY_CFLAGS) $(COVERAGE_CFLAGS)
+AM_LDFLAGS = $(LIBOSMOCORE_LIBS) $(LIBOSMOGSM_LIBS) $(COVERAGE_LDFLAGS)
bs11_config_SOURCES = bs11_config.c rs232.c
bs11_config_LDADD = $(top_builddir)/src/libcommon/libcommon.a \
$(top_builddir)/src/libabis/libabis.a \
diff --git a/src/utils/bs11_config.c b/src/utils/bs11_config.c
index eaed8b75d..41acd6920 100644
--- a/src/utils/bs11_config.c
+++ b/src/utils/bs11_config.c
@@ -30,16 +30,16 @@
#include <fcntl.h>
#include <signal.h>
-#include <sys/types.h>
#include <sys/stat.h>
#include <openbsc/gsm_data.h>
#include <openbsc/abis_nm.h>
-#include <osmocore/msgb.h>
-#include <osmocore/tlv.h>
+#include <osmocom/core/msgb.h>
+#include <osmocom/gsm/tlv.h>
#include <openbsc/debug.h>
-#include <osmocore/select.h>
+#include <osmocom/core/select.h>
#include <openbsc/rs232.h>
+#include <osmocom/core/application.h>
/* state of our bs11_config application */
enum bs11cfg_state {
@@ -51,29 +51,27 @@ enum bs11cfg_state {
};
static enum bs11cfg_state bs11cfg_state = STATE_NONE;
static char *command, *value;
-struct timer_list status_timer;
+struct osmo_timer_list status_timer;
-static const u_int8_t obj_li_attr[] = {
+static const uint8_t obj_li_attr[] = {
NM_ATT_BS11_BIT_ERR_THESH, 0x09, 0x00,
NM_ATT_BS11_L1_PROT_TYPE, 0x00,
NM_ATT_BS11_LINE_CFG, 0x00,
};
-static const u_int8_t obj_bbsig0_attr[] = {
+static const uint8_t obj_bbsig0_attr[] = {
NM_ATT_BS11_RSSI_OFFS, 0x02, 0x00, 0x00,
NM_ATT_BS11_DIVERSITY, 0x01, 0x00,
};
-static const u_int8_t obj_pa0_attr[] = {
+static const uint8_t obj_pa0_attr[] = {
NM_ATT_BS11_TXPWR, 0x01, BS11_TRX_POWER_GSM_30mW,
};
static const char *trx1_password = "1111111111";
#define TEI_OML 25
-static const u_int8_t too_fast[] = { 0x12, 0x80, 0x00, 0x00, 0x02, 0x02 };
-
-static struct log_target *stderr_target;
+static const uint8_t too_fast[] = { 0x12, 0x80, 0x00, 0x00, 0x02, 0x02 };
/* dummy function to keep gsm_data.c happy */
-struct counter *counter_alloc(const char *name)
+struct osmo_counter *osmo_counter_alloc(const char *name)
{
return NULL;
}
@@ -113,8 +111,8 @@ static int create_objects(struct gsm_bts *bts)
static int create_trx1(struct gsm_bts *bts)
{
- u_int8_t bbsig1_attr[sizeof(obj_bbsig0_attr)+12];
- u_int8_t *cur = bbsig1_attr;
+ uint8_t bbsig1_attr[sizeof(obj_bbsig0_attr)+12];
+ uint8_t *cur = bbsig1_attr;
struct gsm_bts_trx *trx = gsm_bts_trx_num(bts, 1);
if (!trx)
@@ -127,7 +125,7 @@ static int create_trx1(struct gsm_bts *bts)
sleep(1);
cur = tlv_put(cur, NM_ATT_BS11_PASSWORD, 10,
- (u_int8_t *)trx1_password);
+ (uint8_t *)trx1_password);
memcpy(cur, obj_bbsig0_attr, sizeof(obj_bbsig0_attr));
abis_nm_bs11_create_object(bts, BS11_OBJ_BBSIG, 1,
sizeof(bbsig1_attr), bbsig1_attr);
@@ -217,7 +215,7 @@ static const char *bs11_link_state[] = {
[0x02] = "Restoring",
};
-static const char *linkstate_name(u_int8_t linkstate)
+static const char *linkstate_name(uint8_t linkstate)
{
if (linkstate > ARRAY_SIZE(bs11_link_state))
return "Unknown";
@@ -234,7 +232,7 @@ static const char *mbccu_load[] = {
[5] = "Load",
};
-static const char *mbccu_load_name(u_int8_t linkstate)
+static const char *mbccu_load_name(uint8_t linkstate)
{
if (linkstate > ARRAY_SIZE(mbccu_load))
return "Unknown";
@@ -242,7 +240,7 @@ static const char *mbccu_load_name(u_int8_t linkstate)
return mbccu_load[linkstate];
}
-static const char *bts_phase_name(u_int8_t phase)
+static const char *bts_phase_name(uint8_t phase)
{
switch (phase) {
case BS11_STATE_WARM_UP:
@@ -280,7 +278,7 @@ static const char *bts_phase_name(u_int8_t phase)
}
}
-static const char *trx_power_name(u_int8_t pwr)
+static const char *trx_power_name(uint8_t pwr)
{
switch (pwr) {
case BS11_TRX_POWER_GSM_2W:
@@ -304,7 +302,7 @@ static const char *trx_power_name(u_int8_t pwr)
}
}
-static const char *pll_mode_name(u_int8_t mode)
+static const char *pll_mode_name(uint8_t mode)
{
switch (mode) {
case BS11_LI_PLL_LOCKED:
@@ -316,7 +314,7 @@ static const char *pll_mode_name(u_int8_t mode)
}
}
-static const char *cclk_acc_name(u_int8_t acc)
+static const char *cclk_acc_name(uint8_t acc)
{
switch (acc) {
case 0:
@@ -330,7 +328,7 @@ static const char *cclk_acc_name(u_int8_t acc)
}
}
-static const char *bport_lcfg_name(u_int8_t lcfg)
+static const char *bport_lcfg_name(uint8_t lcfg)
{
switch (lcfg) {
case BS11_LINE_CFG_STAR:
@@ -378,7 +376,7 @@ static const char *obj_name(struct abis_om_fom_hdr *foh)
static void print_state(struct tlv_parsed *tp)
{
if (TLVP_PRESENT(tp, NM_ATT_BS11_BTS_STATE)) {
- u_int8_t phase, mbccu;
+ uint8_t phase, mbccu;
if (TLVP_LEN(tp, NM_ATT_BS11_BTS_STATE) >= 1) {
phase = *TLVP_VAL(tp, NM_ATT_BS11_BTS_STATE);
printf("PHASE: %u %-20s ", phase & 0xf,
@@ -392,7 +390,7 @@ static void print_state(struct tlv_parsed *tp)
}
if (TLVP_PRESENT(tp, NM_ATT_BS11_E1_STATE) &&
TLVP_LEN(tp, NM_ATT_BS11_E1_STATE) >= 1) {
- u_int8_t e1_state = *TLVP_VAL(tp, NM_ATT_BS11_E1_STATE);
+ uint8_t e1_state = *TLVP_VAL(tp, NM_ATT_BS11_E1_STATE);
printf("Abis-link: %-9s ", linkstate_name(e1_state & 0xf));
}
printf("\n");
@@ -420,7 +418,7 @@ static int print_attr(struct tlv_parsed *tp)
#endif
if (TLVP_PRESENT(tp, NM_ATT_ABIS_CHANNEL) &&
TLVP_LEN(tp, NM_ATT_ABIS_CHANNEL) >= 3) {
- const u_int8_t *chan = TLVP_VAL(tp, NM_ATT_ABIS_CHANNEL);
+ const uint8_t *chan = TLVP_VAL(tp, NM_ATT_ABIS_CHANNEL);
printf("\tE1 Channel: Port=%u Timeslot=%u ",
chan[0], chan[1]);
if (chan[2] == 0xff)
@@ -442,23 +440,23 @@ static int print_attr(struct tlv_parsed *tp)
}
if (TLVP_PRESENT(tp, NM_ATT_BS11_PLL) &&
TLVP_LEN(tp, NM_ATT_BS11_PLL) >= 4) {
- const u_int8_t *vp = TLVP_VAL(tp, NM_ATT_BS11_PLL);
+ const uint8_t *vp = TLVP_VAL(tp, NM_ATT_BS11_PLL);
printf("\tPLL Set Value=%d, Work Value=%d\n",
vp[0] << 8 | vp[1], vp[2] << 8 | vp[3]);
}
if (TLVP_PRESENT(tp, NM_ATT_BS11_CCLK_ACCURACY) &&
TLVP_LEN(tp, NM_ATT_BS11_CCLK_ACCURACY) >= 1) {
- const u_int8_t *acc = TLVP_VAL(tp, NM_ATT_BS11_CCLK_ACCURACY);
+ const uint8_t *acc = TLVP_VAL(tp, NM_ATT_BS11_CCLK_ACCURACY);
printf("\tCCLK Accuracy: %s (%d)\n", cclk_acc_name(*acc), *acc);
}
if (TLVP_PRESENT(tp, NM_ATT_BS11_CCLK_TYPE) &&
TLVP_LEN(tp, NM_ATT_BS11_CCLK_TYPE) >= 1) {
- const u_int8_t *acc = TLVP_VAL(tp, NM_ATT_BS11_CCLK_TYPE);
+ const uint8_t *acc = TLVP_VAL(tp, NM_ATT_BS11_CCLK_TYPE);
printf("\tCCLK Type=%d\n", *acc);
}
if (TLVP_PRESENT(tp, NM_ATT_BS11_LINE_CFG) &&
TLVP_LEN(tp, NM_ATT_BS11_LINE_CFG) >= 1) {
- const u_int8_t *lcfg = TLVP_VAL(tp, NM_ATT_BS11_LINE_CFG);
+ const uint8_t *lcfg = TLVP_VAL(tp, NM_ATT_BS11_LINE_CFG);
printf("\tLine Configuration: %s (%d)\n",
bport_lcfg_name(*lcfg), *lcfg);
}
@@ -689,7 +687,7 @@ int handle_serial_msg(struct msgb *rx_msg)
printf("\n%sATTRIBUTES:\n", obj_name(foh));
abis_nm_tlv_parse(&tp, g_bts, foh->data, oh->length-sizeof(*foh));
rc = print_attr(&tp);
- //hexdump(foh->data, oh->length-sizeof(*foh));
+ //osmo_hexdump(foh->data, oh->length-sizeof(*foh));
break;
case NM_MT_BS11_SET_ATTR_ACK:
printf("SET ATTRIBUTE ObjClass=0x%02x ObjInst=(%d,%d,%d) ACK\n",
@@ -732,7 +730,7 @@ int handle_serial_msg(struct msgb *rx_msg)
abis_nm_bs11_factory_logon(g_bts, 1);
break;
case STATE_LOGON_ACK:
- bsc_schedule_timer(&status_timer, 5, 0);
+ osmo_timer_schedule(&status_timer, 5, 0);
break;
default:
break;
@@ -818,7 +816,7 @@ static void handle_options(int argc, char **argv)
serial_port = optarg;
break;
case 'b':
- log_parse_category_mask(stderr_target, optarg);
+ log_parse_category_mask(osmo_stderr_target, optarg);
break;
case 's':
fname_software = optarg;
@@ -875,10 +873,7 @@ int main(int argc, char **argv)
struct gsm_network *gsmnet;
int rc;
- log_init(&log_info);
- stderr_target = log_target_create_stderr();
- log_add_target(stderr_target);
- log_set_all_filter(stderr_target, 1);
+ osmo_init_logging(&log_info);
handle_options(argc, argv);
bts_model_bs11_init();
@@ -887,8 +882,8 @@ int main(int argc, char **argv)
fprintf(stderr, "Unable to allocate gsm network\n");
exit(1);
}
- g_bts = gsm_bts_alloc(gsmnet, GSM_BTS_TYPE_BS11, HARDCODED_TSC,
- HARDCODED_BSIC);
+ g_bts = gsm_bts_alloc_register(gsmnet, GSM_BTS_TYPE_BS11, HARDCODED_TSC,
+ HARDCODED_BSIC);
rc = rs232_setup(serial_port, delay_ms, g_bts);
if (rc < 0) {
@@ -904,7 +899,7 @@ int main(int argc, char **argv)
status_timer.cb = status_timer_cb;
while (1) {
- bsc_select_main(0);
+ osmo_select_main(0);
}
abis_nm_bs11_factory_logon(g_bts, 0);
diff --git a/src/utils/isdnsync.c b/src/utils/isdnsync.c
index 1c4aa5d6e..d8fca761b 100644
--- a/src/utils/isdnsync.c
+++ b/src/utils/isdnsync.c
@@ -23,7 +23,6 @@
#include <string.h>
#include <unistd.h>
#include <sys/ioctl.h>
-#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
diff --git a/src/utils/rs232.c b/src/utils/rs232.c
index 75505710f..4e35cb06a 100644
--- a/src/utils/rs232.c
+++ b/src/utils/rs232.c
@@ -27,8 +27,8 @@
#include <termios.h>
#include <fcntl.h>
-#include <osmocore/select.h>
-#include <osmocore/msgb.h>
+#include <osmocom/core/select.h>
+#include <osmocom/core/msgb.h>
#include <openbsc/debug.h>
#include <openbsc/gsm_data.h>
#include <openbsc/rs232.h>
@@ -36,7 +36,7 @@
/* adaption layer from GSM 08.59 + 12.21 to RS232 */
struct serial_handle {
- struct bsc_fd fd;
+ struct osmo_fd fd;
struct llist_head tx_queue;
struct msgb *rx_msg;
@@ -51,13 +51,13 @@ static struct serial_handle _ser_handle, *ser_handle = &_ser_handle;
#define LAPD_HDR_LEN 10
-static int handle_ser_write(struct bsc_fd *bfd);
+static int handle_ser_write(struct osmo_fd *bfd);
/* callback from abis_nm */
int _abis_nm_sendmsg(struct msgb *msg, int to_trx_oml)
{
struct serial_handle *sh = ser_handle;
- u_int8_t *lapd;
+ uint8_t *lapd;
unsigned int len;
msg->l2h = msg->data;
@@ -88,7 +88,7 @@ int _abis_nm_sendmsg(struct msgb *msg, int to_trx_oml)
}
/* select.c callback in case we can write to the RS232 */
-static int handle_ser_write(struct bsc_fd *bfd)
+static int handle_ser_write(struct osmo_fd *bfd)
{
struct serial_handle *sh = bfd->data;
struct msgb *msg;
@@ -100,7 +100,7 @@ static int handle_ser_write(struct bsc_fd *bfd)
return 0;
}
- DEBUGP(DMI, "RS232 TX: %s\n", hexdump(msg->data, msg->len));
+ DEBUGP(DMI, "RS232 TX: %s\n", osmo_hexdump(msg->data, msg->len));
/* send over serial line */
written = write(bfd->fd, msg->data, msg->len);
@@ -119,7 +119,7 @@ static int handle_ser_write(struct bsc_fd *bfd)
#define SERIAL_ALLOC_SIZE 300
/* select.c callback in case we can read from the RS232 */
-static int handle_ser_read(struct bsc_fd *bfd)
+static int handle_ser_read(struct osmo_fd *bfd)
{
struct serial_handle *sh = bfd->data;
struct msgb *msg;
@@ -173,7 +173,7 @@ static int handle_ser_read(struct bsc_fd *bfd)
if (msg->len > LAPD_HDR_LEN)
msg->l2h = msg->data + LAPD_HDR_LEN;
- DEBUGP(DMI, "RS232 RX: %s\n", hexdump(msg->data, msg->len));
+ DEBUGP(DMI, "RS232 RX: %s\n", osmo_hexdump(msg->data, msg->len));
rc = handle_serial_msg(msg);
}
}
@@ -182,7 +182,7 @@ static int handle_ser_read(struct bsc_fd *bfd)
}
/* select.c callback */
-static int serial_fd_cb(struct bsc_fd *bfd, unsigned int what)
+static int serial_fd_cb(struct osmo_fd *bfd, unsigned int what)
{
int rc = 0;
@@ -237,7 +237,7 @@ int rs232_setup(const char *serial_port, unsigned int delay_ms,
ser_handle->fd.data = ser_handle;
ser_handle->delay_ms = delay_ms;
ser_handle->bts = bts;
- rc = bsc_register_fd(&ser_handle->fd);
+ rc = osmo_fd_register(&ser_handle->fd);
if (rc < 0) {
fprintf(stderr, "could not register FD: %s\n",
strerror(rc));