/* * Optional HS + kernel RX FIFO diagnostics for pog422_uartd. * * Enable: #define POG422_UARTD_HS_DIAG 1 (default) * Disable: #define POG422_UARTD_HS_DIAG 0 then rebuild * * Remove later: * 1. Delete this file * 2. Remove pog422_uartd_hs_diag.h include and HS_DIAG blocks in pog422_uartd.c * 3. Revert POG422_IPC_HS_DIAG / Python IPC_HS_DIAG + bridge handler * * events.jsonl: ev=hs_fifo_diag on bridge pos 3/4 */ #ifndef POG422_UARTD_HS_DIAG_H #define POG422_UARTD_HS_DIAG_H #include #define POG422_UARTD_HS_DIAG 1 #if POG422_UARTD_HS_DIAG #define POG422_IPC_HS_DIAG 9u #define POG422_HS_DIAG_RISE 0u #define POG422_HS_DIAG_FALL_PRE 1u #define POG422_HS_DIAG_FALL_POST 2u typedef struct __attribute__((packed)) { uint64_t mono_ns; uint8_t phase; /* POG422_HS_DIAG_* */ uint8_t slv_in; uint8_t cap_burst_on_fall; uint8_t reserved; uint32_t fifo_avail; /* FIONREAD — kernel tty RX queue */ uint32_t hw_fifo_avail; /* XR21 RX_FIFO_COUNT @ 0x044 — chip FIFO */ uint32_t cap_len; uint32_t drain_bytes; /* bytes read() this HS fall */ uint8_t probe_off; /* cap_buf offset of probe[0] */ uint8_t probe_len; uint8_t probe[8]; /* 9D.. or F2.. triplet when present */ uint64_t driver_rx_chars; /* XR_GET_RX_STATS.chars_inserted at emit time */ } pog422_ipc_hs_diag_t; #endif /* POG422_UARTD_HS_DIAG */ #endif /* POG422_UARTD_HS_DIAG_H */