From 2cdb97f1663c48f359fc39f3ff642d01099226c0 Mon Sep 17 00:00:00 2001 From: Vadim Yanitskiy Date: Mon, 19 Oct 2020 14:17:38 +0700 Subject: library/L1CTL_Types: fix definition of L1ctlDmEstReq In osmocom-bb 'struct l1ctl_dm_est_req' is defined as follows: struct l1ctl_dm_est_req { uint8_t tsc; uint8_t h; union { struct l1ctl_h0 h0; struct l1ctl_h1 h1; }, uint8_t tch_mode; uint8_t audio_mode; } __attribute__((packed)); so the overall size of the union is size of the biggest member: sizeof(struct l1ctl_h0) is 2 sizeof(struct l1ctl_h1) is 132 Therefore we need to fix our definitions: - introduce 'record L1ctlH0' (with padding), - introduce 'union L1ctlH0H1': - move hopping indicator to L1ctl{H0,H1}, - use it as 'TAG' in 'union L1ctlH0H1'. Change-Id: I53964f794260f0676cc2771a7acbb679befb06d5 Related: OS#4799 --- library/L1CTL_Types.ttcn | 50 +++++++++++++++++++++++++++++++----------------- 1 file changed, 32 insertions(+), 18 deletions(-) diff --git a/library/L1CTL_Types.ttcn b/library/L1CTL_Types.ttcn index 5c909665..00503e66 100644 --- a/library/L1CTL_Types.ttcn +++ b/library/L1CTL_Types.ttcn @@ -296,8 +296,15 @@ module L1CTL_Types { octetstring l2_payload } with { variant "" }; + type record L1ctlH0 { + uint8_t h, + Arfcn arfcn, + octetstring padding length(130) + } with { variant "" }; + type record length(0..64) of Arfcn L1ctlMA; type record L1ctlH1 { + uint8_t h, uint8_t hsn, uint8_t maio, uint8_t n, @@ -314,15 +321,17 @@ module L1CTL_Types { * variant (ma) "PADDING(128)" */ }; + type union L1ctlH0H1 { + L1ctlH0 h0, + L1ctlH1 h1 + } with { variant "TAG(h0, h = 0; h1, h = 1)" }; + type record L1ctlDmEstReq { GsmTsc tsc, - uint8_t h, - Arfcn arfcn optional, - L1ctlH1 hopping optional, + L1ctlH0H1 h0h1, L1ctlTchMode tch_mode, L1ctlAudioMode audio_mode - } with { variant (arfcn) "PRESENCE(h = 0)" - variant (hopping) "PRESENCE(h = 1)" }; + } with { variant "" }; type record L1ctlReset { L1ctlResetType reset_type, @@ -590,9 +599,13 @@ module L1CTL_Types { modifies ts_L1CTL_DM_EST_REQ := { payload := { dm_est_req := { - h := 0, - arfcn := { false, arfcn }, - hopping := omit + h0h1 := { + h0 := { + h := 0, + arfcn := { false, arfcn }, + padding := f_pad_oct(''O, 130, '00'O) + } + } } } } @@ -605,16 +618,17 @@ module L1CTL_Types { modifies ts_L1CTL_DM_EST_REQ := { payload := { dm_est_req := { - h := 1, - arfcn := omit, - hopping := { - hsn := hsn, - maio := maio, - n := sizeof(ma), - spare := '00'O, - ma := ma, - /* See https://bugs.eclipse.org/bugs/show_bug.cgi?id=562849 */ - padding := f_pad_oct(''O, (64 - sizeof(ma)) * 2, '00'O) + h0h1 := { + h1 := { + h := 1, + hsn := hsn, + maio := maio, + n := sizeof(ma), + spare := '00'O, + ma := ma, + /* See https://bugs.eclipse.org/bugs/show_bug.cgi?id=562849 */ + padding := f_pad_oct(''O, (64 - sizeof(ma)) * 2, '00'O) + } } } } -- cgit v1.2.3