FreeCalypso > hg > freecalypso-tools
changeset 137:79e71354ba7b
fc-tmsh: ttr response handling implemented
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Mon, 20 Feb 2017 02:38:06 +0000 |
parents | da4d4af80fdd |
children | 3803f838e1f3 |
files | rvinterf/tmsh/etmbasic.c rvinterf/tmsh/l1resp.c |
diffstat | 2 files changed, 43 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/rvinterf/tmsh/etmbasic.c Mon Feb 20 02:25:53 2017 +0000 +++ b/rvinterf/tmsh/etmbasic.c Mon Feb 20 02:38:06 2017 +0000 @@ -142,7 +142,9 @@ l1tm_ttw_response(); return; case TX_TEMPLATE_READ: - print_etm_pkt_raw("TX_TEMPLATE_READ response"); + if (rvi_msg_len < 5) + goto runt; + l1tm_ttr_response(); return; case MISC_PARAM_WRITE: if (rvi_msg_len < 5)
--- a/rvinterf/tmsh/l1resp.c Mon Feb 20 02:25:53 2017 +0000 +++ b/rvinterf/tmsh/l1resp.c Mon Feb 20 02:38:06 2017 +0000 @@ -13,6 +13,7 @@ unsigned rftr_table_index, rftr_table_size; u_char rftr_table_data[MAX_RF_TABLE_SIZE]; +u_char ttr_ramp_data[32]; void l1tm_response_nodata(op) @@ -303,6 +304,7 @@ if (j == 0 || j == 8) *dp++ = ' '; sprintf(dp, " %02X", rftr_table_data[i++]); + dp += 3; } async_msg_output(buf); } @@ -328,3 +330,41 @@ } async_msg_output("ttw OK"); } + +void +l1tm_ttr_response() +{ + char buf[80], *dp; + unsigned i; + + if (rvi_msg[3]) { + if (rvi_msg_len == 5) { + sprintf(buf, "ttr error %u (0x%02X)", + rvi_msg[3], rvi_msg[3]); + async_msg_output(buf); + } else + print_etm_pkt_raw("ttr long error response"); + return; + } + if (rvi_msg_len != 38) { + print_etm_pkt_raw("ttr response wrong length"); + return; + } + sprintf(buf, "ttr index %u:", rvi_msg[4]); + async_msg_output(buf); + bcopy(rvi_msg + 5, ttr_ramp_data, 32); + strcpy(buf, "ramp-up "); + dp = buf + 9; + for (i = 0; i < 16; i++) { + sprintf(dp, "%4u", ttr_ramp_data[i]); + dp += 4; + } + async_msg_output(buf); + strcpy(buf, "ramp-down"); + dp = buf + 9; + for (i = 0; i < 16; i++) { + sprintf(dp, "%4u", ttr_ramp_data[i+16]); + dp += 4; + } + async_msg_output(buf); +}