From 5abc25c85236af77a807b8e180fff20924c1362d Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Wed, 12 Jul 2017 23:09:54 +0200 Subject: [PATCH] VIRT-PHY: Make sure heaer files are part of 'make dist' Change-Id: Ib4cd0463da1cf22e04a1debfed55a33f7b6542d4 --- src/host/virt_phy/Makefile.am | 2 +- src/host/virt_phy/configure.ac | 1 + src/host/virt_phy/include/Makefile.am | 10 + .../virt_phy/include/layer1/mframe_sched.h | 68 ------ src/host/virt_phy/include/layer1/sync.h | 204 ------------------ src/host/virt_phy/include/layer1/tdma_sched.h | 73 ------- 6 files changed, 12 insertions(+), 346 deletions(-) create mode 100644 src/host/virt_phy/include/Makefile.am delete mode 100644 src/host/virt_phy/include/layer1/mframe_sched.h delete mode 100644 src/host/virt_phy/include/layer1/sync.h delete mode 100644 src/host/virt_phy/include/layer1/tdma_sched.h diff --git a/src/host/virt_phy/Makefile.am b/src/host/virt_phy/Makefile.am index 38bdf12e4..629ce0f74 100644 --- a/src/host/virt_phy/Makefile.am +++ b/src/host/virt_phy/Makefile.am @@ -1,2 +1,2 @@ -SUBDIRS = src +SUBDIRS = include src dist_doc_DATA = README diff --git a/src/host/virt_phy/configure.ac b/src/host/virt_phy/configure.ac index 860082e77..c8012c996 100644 --- a/src/host/virt_phy/configure.ac +++ b/src/host/virt_phy/configure.ac @@ -22,6 +22,7 @@ dnl Checks for typedefs, structures and compiler characteristics AC_CONFIG_FILES([ Makefile + include/Makefile src/Makefile ]) AC_OUTPUT diff --git a/src/host/virt_phy/include/Makefile.am b/src/host/virt_phy/include/Makefile.am new file mode 100644 index 000000000..6048a4b3b --- /dev/null +++ b/src/host/virt_phy/include/Makefile.am @@ -0,0 +1,10 @@ +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 diff --git a/src/host/virt_phy/include/layer1/mframe_sched.h b/src/host/virt_phy/include/layer1/mframe_sched.h deleted file mode 100644 index ecdb1ec8f..000000000 --- a/src/host/virt_phy/include/layer1/mframe_sched.h +++ /dev/null @@ -1,68 +0,0 @@ -#ifndef _L1_MFRAME_SCHED_H -#define _L1_MFRAME_SCHED_H - -#include - -enum mframe_task { - MF_TASK_BCCH_NORM, - MF_TASK_BCCH_EXT, - MF_TASK_CCCH, - MF_TASK_CCCH_COMB, - - MF_TASK_SDCCH4_0, - MF_TASK_SDCCH4_1, - MF_TASK_SDCCH4_2, - MF_TASK_SDCCH4_3, - - MF_TASK_SDCCH8_0, - MF_TASK_SDCCH8_1, - MF_TASK_SDCCH8_2, - MF_TASK_SDCCH8_3, - MF_TASK_SDCCH8_4, - MF_TASK_SDCCH8_5, - MF_TASK_SDCCH8_6, - MF_TASK_SDCCH8_7, - - MF_TASK_TCH_F_EVEN, - MF_TASK_TCH_F_ODD, - MF_TASK_TCH_H_0, - MF_TASK_TCH_H_1, - - MF_TASK_NEIGH_PM51_C0T0, - MF_TASK_NEIGH_PM51, - MF_TASK_NEIGH_PM26E, - MF_TASK_NEIGH_PM26O, - - /* Test task: send Normal Burst in all timeslots */ - MF_TASK_UL_ALL_NB, -}; - -enum mf_sched_item_flag { - MF_F_SACCH = (1 << 0), -}; - -/* The scheduler itself */ -struct mframe_scheduler { - uint32_t tasks; - uint32_t tasks_tgt; - uint32_t safe_fn; -}; - -uint8_t mframe_task2chan_nr(enum mframe_task mft, uint8_t ts); - -/* Enable a specific task */ -void mframe_enable(enum mframe_task task_id); - -/* Disable a specific task */ -void mframe_disable(enum mframe_task task_id); - -/* Replace the current active set by the new one */ -void mframe_set(uint32_t tasks); - -/* Schedule mframe_sched_items according to current MF TASK list */ -void mframe_schedule(void); - -/* reset the scheduler, disabling all tasks */ -void mframe_reset(void); - -#endif /* _MFRAME_SCHED_H */ diff --git a/src/host/virt_phy/include/layer1/sync.h b/src/host/virt_phy/include/layer1/sync.h deleted file mode 100644 index dae85a1a9..000000000 --- a/src/host/virt_phy/include/layer1/sync.h +++ /dev/null @@ -1,204 +0,0 @@ -#ifndef _L1_SYNC_H -#define _L1_SYNC_H - -#include -#include -#include -#include -#include - -/* structure representing L1 sync information about a cell */ -struct l1_cell_info { - /* on which ARFCN (+band) is the cell? */ - uint16_t arfcn; - /* what's the BSIC of the cell (from SCH burst decoding) */ - 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 - * compared to our current local frame number */ - int32_t fn_offset; - /* how much does the TPU need adjustment (delta) to synchronize - * with the cells burst */ - uint32_t time_alignment; - /* FIXME: should we also store the AFC value? */ -}; - -enum l1s_chan { - L1S_CHAN_MAIN, - L1S_CHAN_SACCH, - L1S_CHAN_TRAFFIC, - _NUM_L1S_CHAN -}; - -enum l1_compl { - L1_COMPL_FB, - L1_COMPL_RACH, - L1_COMPL_TX_NB, - L1_COMPL_TX_TCH, -}; - -typedef void l1_compl_cb(enum l1_compl c); - -#define L1S_NUM_COMPL 32 -#define L1S_NUM_NEIGH_CELL 6 - -struct l1s_h0 { - uint16_t arfcn; -}; - -struct l1s_h1 { - uint8_t hsn; - uint8_t maio; - uint8_t n; - uint16_t ma[64]; -}; - -struct l1s_state { - struct gsm_time current_time; /* current GSM time */ - struct gsm_time next_time; /* GSM time at next TMDMA irq */ - - /* the cell on which we are camping right now */ - struct l1_cell_info serving_cell; - - /* neighbor cell sync info */ - struct l1_cell_info neigh_cell[L1S_NUM_NEIGH_CELL]; - - /* TDMA scheduler */ - struct tdma_scheduler tdma_sched; - - /* Multiframe scheduler */ - struct mframe_scheduler mframe_sched; - - /* The current TPU offset register */ - uint32_t tpu_offset; - int32_t tpu_offset_correction; - - /* TX parameters */ - int8_t ta; - uint8_t tx_power; - - /* TCH */ - uint8_t tch_mode; - uint8_t tch_sync; - uint8_t audio_mode; - - /* Transmit queues of pending packets for main DCCH and ACCH */ - struct llist_head tx_queue[_NUM_L1S_CHAN]; - struct msgb *tx_meas; - - /* Which L1A completions are scheduled right now */ - uint32_t scheduled_compl; - /* callbacks for each of the completions */ - l1_compl_cb *completion[L1S_NUM_COMPL]; - - /* Structures below are for L1-task specific parameters, used - * to communicate between l1-sync and l1-async (l23_api) */ - struct { - uint8_t mode; /* FB_MODE 0/1 */ - } fb; - - struct { - /* power measurement l1 task */ - unsigned int mode; - union { - struct { - uint16_t arfcn_start; - uint16_t arfcn_next; - uint16_t arfcn_end; - } range; - }; - struct msgb *msg; - } pm; - - struct { - uint8_t ra; - } rach; - - struct { - enum { - GSM_DCHAN_NONE = 0, - GSM_DCHAN_SDCCH_4, - GSM_DCHAN_SDCCH_8, - GSM_DCHAN_TCH_H, - GSM_DCHAN_TCH_F, - GSM_DCHAN_UNKNOWN, - } type; - - uint8_t scn; - uint8_t tsc; - uint8_t tn; - uint8_t h; - - union { - struct l1s_h0 h0; - struct l1s_h1 h1; - }; - - uint8_t st_tsc; - uint8_t st_tn; - uint8_t st_h; - - union { - struct l1s_h0 st_h0; - struct l1s_h1 st_h1; - }; - } dedicated; - - /* neighbour cell power measurement process */ - struct { - uint8_t n, second; - uint8_t pos; - uint8_t running; - uint16_t band_arfcn[64]; - uint8_t tn[64]; - uint8_t level[64]; - } neigh_pm; -}; - -extern struct l1s_state l1s; - -struct l1s_meas_hdr { - uint16_t snr; /* signal/noise ratio */ - int16_t toa_qbit; /* time of arrival (qbits) */ - int16_t pm_dbm8; /* power level in dbm/8 */ - int16_t freq_err; /* Frequency error in Hz */ -}; - -int16_t l1s_snr_int(uint16_t snr); -uint16_t l1s_snr_fract(uint16_t snr); - -void l1s_dsp_abort(void); - -void l1s_tx_apc_helper(uint16_t arfcn); - -/* schedule a completion */ -void l1s_compl_sched(enum l1_compl c); - -void l1s_init(void); - -/* reset the layer1 as part of synchronizing to a new cell */ -void l1s_reset(void); - -/* init.c */ -void layer1_init(void); - -/* A debug macro to print every TDMA frame */ -#ifdef DEBUG_EVERY_TDMA -#define putchart(x) putchar(x) -#else -#define putchart(x) -#endif - -/* Convert an angle in fx1.15 notatinon into Hz */ -#define BITFREQ_DIV_2PI 43104 /* 270kHz / 2 * pi */ -#define BITFREQ_DIV_PI 86208 /* 270kHz / pi */ -#define ANG2FREQ_SCALING (2<<15) /* 2^15 scaling factor for fx1.15 */ -#define ANGLE_TO_FREQ(angle) ((int16_t)angle * BITFREQ_DIV_PI / ANG2FREQ_SCALING) - -void l1s_reset_hw(void); -void synchronize_tdma(struct l1_cell_info *cinfo); -void l1s_time_inc(struct gsm_time *time, uint32_t delta_fn); -void l1s_time_dump(const struct gsm_time *time); - -#endif /* _L1_SYNC_H */ diff --git a/src/host/virt_phy/include/layer1/tdma_sched.h b/src/host/virt_phy/include/layer1/tdma_sched.h deleted file mode 100644 index f58d59bb9..000000000 --- a/src/host/virt_phy/include/layer1/tdma_sched.h +++ /dev/null @@ -1,73 +0,0 @@ -#ifndef _L1_TDMA_SCHED_H -#define _L1_TDMA_SCHED_H - -#include - -/* TDMA scheduler */ - -/* The idea of this scheduler is that we have a circular buffer of buckets, - * where each bucket corresponds to one future TDMA frame [interrupt]. Each - * bucket contains of a list of callbacks which are executed when the bucket - * index reaches that particular bucket. */ - -#define TDMASCHED_NUM_FRAMES 25 -#define TDMASCHED_NUM_CB 8 - -#define TDMA_IFLG_TPU (1<<0) -#define TDMA_IFLG_DSP (1<<1) - -typedef int tdma_sched_cb(uint8_t p1, uint8_t p2, uint16_t p3); - -/* A single item in a TDMA scheduler bucket */ -struct tdma_sched_item { - tdma_sched_cb *cb; - uint8_t p1; - uint8_t p2; - uint16_t p3; - int16_t prio; - uint16_t flags; /* TDMA_IFLG_xxx */ -}; - -/* A bucket inside the TDMA scheduler */ -struct tdma_sched_bucket { - struct tdma_sched_item item[TDMASCHED_NUM_CB]; - uint8_t num_items; -}; - -/* The scheduler itself, consisting of buckets and a current index */ -struct tdma_scheduler { - struct tdma_sched_bucket bucket[TDMASCHED_NUM_FRAMES]; - uint8_t cur_bucket; -}; - -/* Schedule an item at 'frame_offset' TDMA frames in the future */ -int tdma_schedule(uint8_t frame_offset, tdma_sched_cb *cb, - uint8_t p1, uint8_t p2, uint16_t p3, int16_t prio); - -/* Schedule a set of items starting from 'frame_offset' TDMA frames in the future */ -int tdma_schedule_set(uint8_t frame_offset, const struct tdma_sched_item *item_set, uint16_t p3); - -/* Scan current frame scheduled items for flags */ -uint16_t tdma_sched_flag_scan(void); - -/* Execute pre-scheduled events for current frame */ -int tdma_sched_execute(void); - -/* Advance TDMA scheduler to the next bucket */ -void tdma_sched_advance(void); - -/* reset the scheduler; erase all scheduled items */ -void tdma_sched_reset(void); - -/* debug function: print number of entries of all TDMA buckets */ -void tdma_sched_dump(void); - - -extern int tdma_end_set(uint8_t p1, uint8_t p2, uint16_t p3); -#define SCHED_ITEM(x, p, y, z) { .cb = x, .p1 = y, .p2 = z, .prio = p, .flags = 0 } -#define SCHED_ITEM_DT(x, p, y, z) { .cb = x, .p1 = y, .p2 = z, .prio = p, \ - .flags = TDMA_IFLG_TPU | TDMA_IFLG_DSP } -#define SCHED_END_FRAME() { .cb = NULL, .p1 = 0, .p2 = 0 } -#define SCHED_END_SET() { .cb = &tdma_end_set, .p1 = 0, .p2 = 0 } - -#endif /* _L1_TDMA_SCHED_H */