vty: Implement VTY cfg parsing for current parameters

At this stage, osmo-trx still uses the cmdline parameters top run the
device, but it is already able to parse all the same parameters from a
cfg file through the VTY and filling a trx_ctx structure which will be
later used to drive the device. Device config can be printed in the VTY
with "show trx".

Change-Id: Ie084c1b30b63f91c6e7640832ec1797d9e813832
diff --git a/CommonLibs/trx_vty.h b/CommonLibs/trx_vty.h
index 74af31b..c921722 100644
--- a/CommonLibs/trx_vty.h
+++ b/CommonLibs/trx_vty.h
@@ -2,12 +2,67 @@
 
 #include <osmocom/vty/command.h>
 
+#include "config_defs.h"
+
 extern struct vty_app_info g_vty_info;
 
+#define TRX_CHAN_MAX 8
+
+/* Samples-per-symbol for downlink path
+ *     4 - Uses precision modulator (more computation, less distortion)
+ *     1 - Uses minimized modulator (less computation, more distortion)
+ *
+ *     Other values are invalid. Receive path (uplink) is always
+ *     downsampled to 1 sps. Default to 4 sps for all cases.
+ */
+#define DEFAULT_TX_SPS		4
+
+/*
+ * Samples-per-symbol for uplink (receiver) path
+ *     Do not modify this value. EDGE configures 4 sps automatically on
+ *     B200/B210 devices only. Use of 4 sps on the receive path for other
+ *     configurations is not supported.
+ */
+#define DEFAULT_RX_SPS		1
+
+/* Default configuration parameters */
+#define DEFAULT_TRX_PORT	5700
+#define DEFAULT_TRX_IP		"127.0.0.1"
+#define DEFAULT_CHANS		1
+
+struct trx_ctx;
+
+struct trx_chan {
+	struct trx_ctx *trx; /* backpointer */
+	unsigned int idx; /* channel index */
+	char *rx_path;
+	char *tx_path;
+};
+
 struct trx_ctx {
 	struct {
 		char *bind_addr;
+		char *remote_addr;
+		char *dev_args;
+		unsigned int base_port;
+		unsigned int tx_sps;
+		unsigned int rx_sps;
+		unsigned int rtsc;
+		bool rtsc_set;
+		unsigned int rach_delay;
+		bool rach_delay_set;
+		enum ReferenceType clock_ref;
+		enum FillerType filler;
+		bool multi_arfcn;
+		double offset;
+		double rssi_offset;
+		bool swap_channels;
+		bool egprs;
+		unsigned int sched_rr;
+		unsigned int num_chans;
+		struct trx_chan chans[TRX_CHAN_MAX];
 	} cfg;
 };
 
 int trx_vty_init(struct trx_ctx* trx);
+struct trx_ctx *vty_trx_ctx_alloc(void *talloc_ctx);