tm_sband_get_feature_select.lua 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. function tm_sband_get_feature_select(buffer, pinfo, tree, sband_get_feature_select, offset)
  2. -- Define ProtoFields
  3. local f_crc16 = ProtoField.uint16("sband_get_feature_select.Crc16", "Crc16", base.HEX)
  4. local f_reserve_0 = ProtoField.uint16("sband_get_feature_select.Reserve_0", "Reserve_0", base.HEX)
  5. local f_more_xmt_mod = ProtoField.uint8("sband_get_feature_select.MoreXmtMod", "MoreXmtMod", base.DEC)
  6. local f_xmt_offset_mod = ProtoField.uint8("sband_get_feature_select.XmtOffsetMod", "XmtOffsetMod", base.DEC)
  7. local f_rs_mode = ProtoField.uint8("sband_get_feature_select.RsMode", "RsMode", base.DEC)
  8. local f_xmt_ch0_en = ProtoField.uint8("sband_get_feature_select.XmtCh0_En", "XmtCh0_En", base.DEC)
  9. local f_xmt_ch1_en = ProtoField.uint8("sband_get_feature_select.XmtCh1_En", "XmtCh1_En", base.DEC)
  10. local f_rcv_ch0_en = ProtoField.uint8("sband_get_feature_select.RcvCh0_En", "RcvCh0_En", base.DEC)
  11. local f_rcv_ch1_en = ProtoField.uint8("sband_get_feature_select.RcvCh1_En", "RcvCh1_En", base.DEC)
  12. local f_rcv_ch0_gain_max = ProtoField.uint8("sband_get_feature_select.RcvCh0_GainMax", "RcvCh0_GainMax", base.DEC)
  13. local f_rcv_ch1_gain_max = ProtoField.uint8("sband_get_feature_select.RcvCh1_GainMax", "RcvCh1_GainMax", base.DEC)
  14. local f_disable_xmt_symb_freq_change = ProtoField.uint8("sband_get_feature_select.DisableXmtSymbFreqChange", "DisableXmtSymbFreqChange", base.DEC)
  15. local f_disable_rcv_symb_freq_change = ProtoField.uint8("sband_get_feature_select.DisableRcvSymbFreqChange", "DisableRcvSymbFreqChange", base.DEC)
  16. local f_disable_xmt_up_sampling = ProtoField.uint8("sband_get_feature_select.DisableXmtUpSampling", "DisableXmtUpSampling", base.DEC)
  17. local f_reserve_1 = ProtoField.uint32("sband_get_feature_select.Reserve_1", "Reserve_1", base.HEX)
  18. local f_xmt_symb_freq = ProtoField.uint16("sband_get_feature_select.XmtSymbFreq", "XmtSymbFreq", base.HEX)
  19. local f_rcv_symb_freq = ProtoField.uint16("sband_get_feature_select.RcvSymbFreq", "RcvSymbFreq", base.HEX)
  20. local f_reserve_3 = ProtoField.uint32("sband_get_feature_select.Reserve_3", "Reserve_3", base.HEX)
  21. -- Register the fields in the protocol
  22. sband_get_feature_select.fields = {
  23. f_crc16, f_reserve_0, f_more_xmt_mod, f_xmt_offset_mod, f_rs_mode,
  24. f_xmt_ch0_en, f_xmt_ch1_en, f_rcv_ch0_en, f_rcv_ch1_en, f_rcv_ch0_gain_max,
  25. f_rcv_ch1_gain_max, f_disable_xmt_symb_freq_change, f_disable_rcv_symb_freq_change,
  26. f_disable_xmt_up_sampling, f_reserve_1, f_xmt_symb_freq, f_rcv_symb_freq, f_reserve_3
  27. }
  28. -- Create the subtree for tm_sband_get_feature_select
  29. local subtree = tree:add(sband_get_feature_select, buffer(), "TM SBAND GET FEATURE SELECT")
  30. -- Parse the 16-bit `Crc16`
  31. subtree:add(f_crc16, buffer(offset, 2))
  32. offset = offset + 2
  33. -- Parse the 10-bit `Reserve_0`
  34. local value
  35. local data = buffer(offset, 2):le_uint()
  36. value = data & 0x3ff
  37. subtree:add(f_reserve_0, value)
  38. -- Parse `MoreXmtMod` (1 bit)
  39. value = (data >> 10) & 1
  40. subtree:add(f_more_xmt_mod,value)
  41. -- Parse `XmtOffsetMod` (1 bit)
  42. value = (data >> 11) & 1
  43. subtree:add(f_xmt_offset_mod, value)
  44. -- Parse `RsMode` (4 bits)
  45. value = (data >> 12) & 0xf000
  46. subtree:add(f_rs_mode, value)
  47. offset = offset + 2
  48. data = buffer(offset , 4):le_uint()
  49. value = data & 1
  50. subtree:add(f_xmt_ch0_en, value)
  51. -- Parse `XmtCh1_En` (1 bit)
  52. value = (data >> 1) & 1
  53. subtree:add(f_xmt_ch1_en, value)
  54. -- Parse `RcvCh0_En` (1 bit)
  55. value = (data >> 2) & 1
  56. subtree:add(f_rcv_ch0_en, value )
  57. -- Parse `RcvCh1_En` (1 bit)
  58. value = (data >> 3) & 1
  59. subtree:add(f_rcv_ch1_en, value)
  60. -- Parse `RcvCh0_GainMax` (1 bit)
  61. value = (data >> 4) & 1
  62. subtree:add(f_rcv_ch0_gain_max, value)
  63. -- Parse `RcvCh1_GainMax` (1 bit)
  64. value = (data >> 5) & 1
  65. subtree:add(f_rcv_ch1_gain_max, value)
  66. -- Parse `DisableXmtSymbFreqChange` (1 bit)
  67. value = (data >> 6) & 1
  68. subtree:add(f_disable_xmt_symb_freq_change, value)
  69. -- Parse `DisableRcvSymbFreqChange` (1 bit)
  70. value = (data >> 7) & 1
  71. subtree:add(f_disable_rcv_symb_freq_change, value)
  72. -- Parse `DisableXmtUpSampling` (1 bit)
  73. value = (data >> 8) & 1
  74. subtree:add(f_disable_xmt_up_sampling, value)
  75. -- Parse `Reserve_1` (23 bits)
  76. value = (data >> 9) & 0x03ffffff
  77. subtree:add(f_reserve_1, value)
  78. offset = offset + 4
  79. -- Parse `XmtSymbFreq` (16 bits)
  80. subtree:add(f_xmt_symb_freq, buffer(offset, 2):le_uint())
  81. offset = offset + 2
  82. -- Parse `RcvSymbFreq` (16 bits)
  83. subtree:add(f_rcv_symb_freq, buffer(offset, 2):le_uint())
  84. offset = offset + 2
  85. -- Parse `Reserve_3` (32 bits)
  86. subtree:add(f_reserve_3, buffer(offset, 4):le_uint())
  87. offset = offset + 4
  88. end