obc_dissector.lua 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. function obc_dissector(buffer, pinfo, tree, TC_TM_PROTOCOL, offset, instance)
  2. local f_timestamp1 = ProtoField.uint64("TC_TM_PROTOCOL.timestamp_obc", "Timestamp", base.DEC)
  3. local f_fsm_state = ProtoField.uint8("TC_TM_PROTOCOL.fsm_state", "Fsm State", base.DEC)
  4. local f_num_resets = ProtoField.uint8("TC_TM_PROTOCOL.num_resets", "Num of resets", base.DEC)
  5. local f_io_error = ProtoField.uint16("TC_TM_PROTOCOL.io_error", "IO error", base.DEC)
  6. local f_sys_error = ProtoField.uint8("TC_TM_PROTOCOL.sys_error", "Sys error", base.DEC)
  7. local f_cpu_until = ProtoField.float("TC_TM_PROTOCOL.cpu_until", "Cpu Until", base.DEC)
  8. local f_iram_rem_heap = ProtoField.uint32("TC_TM_PROTOCOL.iram_rem_heap", "Iram rem heap", base.DEC)
  9. local f_eram_rem_heap = ProtoField.uint32("TC_TM_PROTOCOL.eram_rem_heap", "Eram rem heap", base.DEC)
  10. local f_uptime = ProtoField.uint32("TC_TM_PROTOCOL.uptime", "Uptime", base.DEC)
  11. local f_reset_cause = ProtoField.uint8("TC_TM_PROTOCOL.reset_cause", "Reset cause", base.DEC)
  12. local f_task_count = ProtoField.uint8("TC_TM_PROTOCOL.task_count", "Task Count", base.DEC)
  13. local ipc_fail_cntr = ProtoField.uint16("TC_TM_PROTOCOL.ipc_fail_cntr", "Ipc Fail Cntr", base.DEC)
  14. -- Add the fields to the protocol
  15. TC_TM_PROTOCOL.fields = {
  16. f_timestamp1, f_fsm_state, f_num_resets,f_io_error, f_sys_error, f_cpu_until, f_iram_rem_heap,
  17. f_eram_rem_heap, f_uptime, f_reset_cause, f_task_count, f_ipc_fail_cntr
  18. }
  19. local subtree = tree:add(TC_TM_PROTOCOL, buffer(), "OBC")
  20. for i=0, instance-1 do
  21. local subtree1 = subtree:add(TC_TM_PROTOCOL, buffer(), "Instance "..i)
  22. -- dissect timestamp
  23. local data1
  24. --for i=0, 8 do
  25. --data1 = buffer(offset, 8):le_uint()
  26. subtree1:add(f_timestamp1, buffer(offset, 8):le_uint64())
  27. offset = offset + 8
  28. --dissect fsm_state
  29. --local data2 = buffer(offset,1):le_uint()
  30. subtree1:add(f_fsm_state, buffer(offset,1):le_uint())
  31. offset = offset + 1
  32. --dissect f_num_resets
  33. local data3 = buffer(offset,1):le_uint()
  34. subtree1:add(f_num_resets, data3)
  35. offset = offset + 1
  36. --dissect io_error
  37. subtree1:add(f_io_error , buffer(offset, 2):le_uint())
  38. offset = offset + 2
  39. --dissect sys_error
  40. --local data2 = buffer(offset,1):le_uint()
  41. subtree1:add(f_sys_error, buffer(offset, 1):le_uint())
  42. offset = offset + 1
  43. --dissect f_cpu_until
  44. local cpu_value = buffer(offset, 4):le_float()
  45. local formatted_value = string.format("%.6f", cpu_value)
  46. subtree1:add(f_cpu_until, formatted_value)
  47. offset = offset + 4
  48. --dissect f_iram_rem_heap
  49. subtree1:add(f_iram_rem_heap, buffer(offset, 4):le_uint())
  50. offset = offset + 4
  51. --dissect f_eram_rem_heap
  52. subtree1:add(f_eram_rem_heap, buffer(offset, 4):le_uint())
  53. offset = offset + 4
  54. --dissect f_uptime
  55. subtree1:add(f_uptime, buffer(offset, 4):le_uint())
  56. offset = offset + 4
  57. --dissect f_reset_cause
  58. subtree1:add(f_reset_cause, buffer(offset, 1):le_uint())
  59. offset = offset + 1
  60. --dissect f_task_count
  61. local task_count = buffer(offset, 1):le_uint()
  62. subtree1:add(f_task_count, buffer(offset, 1):le_uint())
  63. offset = offset + 1
  64. for i=0, task_count - 1 do
  65. local fail = buffer(offset, 2):le_uint()
  66. if fail == 0 then
  67. i = i + 2
  68. offset = offset + 2
  69. else
  70. subtree1:add(f_ipc_fail_cntr, buffer(offset, 2):le_uint())
  71. offset = offset + 2
  72. i = i + 2
  73. end
  74. end
  75. end
  76. end