trau_sync: make sync pattern configurable

When a trau sync fsm is allocated, the user must set the sync pattern,
which can not be changed during the whole fsm lifecycle. However on
codec changes it might be necessary to change the sync pattern on the
fly.

- Add function to change the sync pattern

Change-Id: I1caff93b4c8eace8ba8cd6e32e996a9e1503232b
Related: OS#2659
This commit is contained in:
Philipp Maier 2020-08-07 17:13:57 +02:00
parent 2f80b93528
commit 8d15001910
2 changed files with 9 additions and 1 deletions

View File

@ -17,3 +17,4 @@ osmo_trau_sync_alloc(void *ctx, const char *name, frame_out_cb_t frame_out_cb,
enum osmo_tray_sync_pat_id pat_id, void *user_data);
void osmo_trau_sync_rx_ubits(struct osmo_fsm_inst *fi, const ubit_t *bits, size_t n_bits);
void osmo_trau_sync_set_pat(struct osmo_fsm_inst *fi, enum osmo_tray_sync_pat_id pat_id);

View File

@ -499,7 +499,6 @@ osmo_trau_sync_alloc(void *ctx, const char *name, frame_out_cb_t frame_out_cb,
tss->out_cb = frame_out_cb;
tss->user_data = user_data;
/* FIXME: this must be configurable */
tss->pattern = &sync_patterns[pat_id];
/* An unusued E1 timeslot normally would send an idle signal that
@ -511,6 +510,14 @@ osmo_trau_sync_alloc(void *ctx, const char *name, frame_out_cb_t frame_out_cb,
return fi;
}
void osmo_trau_sync_set_pat(struct osmo_fsm_inst *fi, enum osmo_tray_sync_pat_id pat_id)
{
struct trau_rx_sync_state *tss = fi->priv;
tss->pattern = &sync_patterns[pat_id];
osmo_fsm_inst_state_chg(fi, FRAME_ALIGNMENT_LOST, 0, 0);
}
void osmo_trau_sync_rx_ubits(struct osmo_fsm_inst *fi, const ubit_t *bits, size_t n_bits)
{
struct ubit_buf ubb;