tm_comms_uhf_dbg_cb.lua 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. function tm_comms_uhf_dbg_cb(buffer, pinfo, tree, comms_uhf_dbg_cb, offset)
  2. -- Define ProtoFields
  3. local f_state = ProtoField.uint8("comms_uhf_dbg_cb.state", "UHF FSM State", base.DEC)
  4. local f_uhf_sch_gs_cont = ProtoField.uint8("comms_uhf_dbg_cb.uhf_sch_gs_cont", "UHF Scheduler Ground Contact Status", base.DEC)
  5. local f_uhf_gs_cont_valid = ProtoField.uint8("comms_uhf_dbg_cb.uhf_gs_cont_valid", "UHF Ground Contact Valid", base.DEC)
  6. local f_uhf_uart_cmd_rx_cnt = ProtoField.uint32("comms_uhf_dbg_cb.uhf_uart_cmd_rx_cnt", "UHF UART Command RX Count", base.DEC)
  7. local f_uhf_uart_cmd_tx_cnt = ProtoField.uint32("comms_uhf_dbg_cb.uhf_uart_cmd_tx_cnt", "UHF UART Command TX Count", base.DEC)
  8. local f_uhf_uart_data_rx_cnt = ProtoField.uint32("comms_uhf_dbg_cb.uhf_uart_data_rx_cnt", "UHF UART Data RX Count", base.DEC)
  9. local f_uhf_uart_data_tx_cnt = ProtoField.uint32("comms_uhf_dbg_cb.uhf_uart_data_tx_cnt", "UHF UART Data TX Count", base.DEC)
  10. local f_uhf_tm_tx_cnt = ProtoField.uint32("comms_uhf_dbg_cb.uhf_tm_tx_cnt", "UHF TM TX Count to CSP", base.DEC)
  11. local f_uhf_tc_rx_cnt = ProtoField.uint32("comms_uhf_dbg_cb.uhf_tc_rx_cnt", "UHF TC RX Count from CSP", base.DEC)
  12. local f_uhf_tm_tx_fail_cnt = ProtoField.uint32("comms_uhf_dbg_cb.uhf_tm_tx_fail_cnt", "UHF TM TX Fail Count in CSP", base.DEC)
  13. -- Register the fields in the protocol
  14. comms_uhf_dbg_cb.fields = {
  15. f_state, f_uhf_sch_gs_cont, f_uhf_gs_cont_valid,
  16. f_uhf_uart_cmd_rx_cnt, f_uhf_uart_cmd_tx_cnt, f_uhf_uart_data_rx_cnt, f_uhf_uart_data_tx_cnt,
  17. f_uhf_tm_tx_cnt, f_uhf_tc_rx_cnt, f_uhf_tm_tx_fail_cnt
  18. }
  19. -- Create a subtree for the structure
  20. local subtree = tree:add(comms_uhf_dbg_cb, buffer(), "TM COMMS UHF GET DBG CB INFO")
  21. -- Parse each field
  22. subtree:add(f_state, buffer(offset, 1):le_uint())
  23. offset = offset + 1
  24. subtree:add(f_uhf_sch_gs_cont, buffer(offset, 1):le_uint())
  25. offset = offset + 1
  26. subtree:add(f_uhf_gs_cont_valid, buffer(offset, 1):le_uint())
  27. offset = offset + 1
  28. -- Padding (if necessary)
  29. --offset = offset + 1
  30. subtree:add_le(f_uhf_uart_cmd_rx_cnt, buffer(offset, 4):le_uint())
  31. offset = offset + 4
  32. subtree:add_le(f_uhf_uart_cmd_tx_cnt, buffer(offset, 4):le_uint())
  33. offset = offset + 4
  34. subtree:add_le(f_uhf_uart_data_rx_cnt, buffer(offset, 4):le_uint())
  35. offset = offset + 4
  36. subtree:add_le(f_uhf_uart_data_tx_cnt, buffer(offset, 4):le_uint())
  37. offset = offset + 4
  38. subtree:add_le(f_uhf_tm_tx_cnt, buffer(offset, 4):le_uint())
  39. offset = offset + 4
  40. subtree:add_le(f_uhf_tc_rx_cnt, buffer(offset, 4):le_uint())
  41. offset = offset + 4
  42. subtree:add_le(f_uhf_tm_tx_fail_cnt, buffer(offset, 4):le_uint())
  43. offset = offset + 4
  44. end