# HG changeset patch # User Mychaela Falconia # Date 1458505434 0 # Node ID 009d5bf2ff4cafd8a4a890809322fea1eedb30a9 # Parent 5f919af515f1cc8fbdba4e0d91823909ce913bc5 rvinterf/lowlevel: formatting of FC-specific packet types split off into format_fc.c diff -r 5f919af515f1 -r 009d5bf2ff4c rvinterf/lowlevel/Makefile --- a/rvinterf/lowlevel/Makefile Sun Mar 20 19:59:19 2016 +0000 +++ b/rvinterf/lowlevel/Makefile Sun Mar 20 20:23:54 2016 +0000 @@ -4,10 +4,11 @@ INSTBIN=/usr/local/bin LIBG23= ../libg23/libg23.a -RVTDUMP_OBJS= format.o openport.o output.o packetrx.o rvtdump.o +RVTDUMP_OBJS= format.o format_fc.o openport.o output.o packetrx.o rvtdump.o -RVINTERF_OBJS= clientcmd.o format.o localsock.o logsent.o openport.o output.o \ - packetrx.o packettx.o pktfwd.o rviflcd.o rvifmain.o +RVINTERF_OBJS= clientcmd.o format.o format_fc.o localsock.o logsent.o \ + openport.o output.o packetrx.o packettx.o pktfwd.o rviflcd.o \ + rvifmain.o TFC139_OBJS= format.o openport.o output.o packetrx.o packettx.o tfc139.o diff -r 5f919af515f1 -r 009d5bf2ff4c rvinterf/lowlevel/format.c --- a/rvinterf/lowlevel/format.c Sun Mar 20 19:59:19 2016 +0000 +++ b/rvinterf/lowlevel/format.c Sun Mar 20 20:23:54 2016 +0000 @@ -121,72 +121,6 @@ } void -print_ati_output() -{ - int i, c; - char *dp; - - dp = fmtbuf; - strcpy(dp, "ATI: "); - dp += 5; - for (i = 1; i < rxpkt_len; i++) { - c = rxpkt[i]; - if (c & 0x80) { - *dp++ = 'M'; - *dp++ = '-'; - c &= 0x7F; - } - if (c < 0x20) { - *dp++ = '^'; - *dp++ = c + '@'; - } else if (c == 0x7F) { - *dp++ = '^'; - *dp++ = '?'; - } else - *dp++ = c; - } - *dp = '\0'; - output_line(fmtbuf); -} - -void -print_fc_lld_msg() -{ - int i, c; - char *dp; - - dp = fmtbuf; - strcpy(dp, "LLD: "); - dp += 5; - for (i = 1; i < rxpkt_len; i++) { - c = rxpkt[i]; - if (c & 0x80) { - *dp++ = 'M'; - *dp++ = '-'; - c &= 0x7F; - } - if (c < 0x20) { - *dp++ = '^'; - *dp++ = c + '@'; - } else if (c == 0x7F) { - *dp++ = '^'; - *dp++ = '?'; - } else - *dp++ = c; - } - *dp = '\0'; - output_line(fmtbuf); -} - -void -report_extui_packet() -{ - sprintf(fmtbuf, "LCD OUT: row %u col %u-%u", rxpkt[1], rxpkt[2], - rxpkt[2] + (rxpkt_len - 3) / 2 - 1); - output_line(fmtbuf); -} - -void print_unknown_packet() { int i; diff -r 5f919af515f1 -r 009d5bf2ff4c rvinterf/lowlevel/format_fc.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rvinterf/lowlevel/format_fc.c Sun Mar 20 20:23:54 2016 +0000 @@ -0,0 +1,82 @@ +/* + * This module has been split off from format.c; it implements the decoding + * of those Rx packet types which have been invented in FreeCalypso. + */ + +#include +#include +#include +#include +#include "../include/pktmux.h" +#include "../include/limits.h" + +extern u_char rxpkt[]; +extern size_t rxpkt_len; + +static char fmtbuf[MAX_PKT_FROM_TARGET*8]; /* size it generously */ + +void +print_ati_output() +{ + int i, c; + char *dp; + + dp = fmtbuf; + strcpy(dp, "ATI: "); + dp += 5; + for (i = 1; i < rxpkt_len; i++) { + c = rxpkt[i]; + if (c & 0x80) { + *dp++ = 'M'; + *dp++ = '-'; + c &= 0x7F; + } + if (c < 0x20) { + *dp++ = '^'; + *dp++ = c + '@'; + } else if (c == 0x7F) { + *dp++ = '^'; + *dp++ = '?'; + } else + *dp++ = c; + } + *dp = '\0'; + output_line(fmtbuf); +} + +void +print_fc_lld_msg() +{ + int i, c; + char *dp; + + dp = fmtbuf; + strcpy(dp, "LLD: "); + dp += 5; + for (i = 1; i < rxpkt_len; i++) { + c = rxpkt[i]; + if (c & 0x80) { + *dp++ = 'M'; + *dp++ = '-'; + c &= 0x7F; + } + if (c < 0x20) { + *dp++ = '^'; + *dp++ = c + '@'; + } else if (c == 0x7F) { + *dp++ = '^'; + *dp++ = '?'; + } else + *dp++ = c; + } + *dp = '\0'; + output_line(fmtbuf); +} + +void +report_extui_packet() +{ + sprintf(fmtbuf, "LCD OUT: row %u col %u-%u", rxpkt[1], rxpkt[2], + rxpkt[2] + (rxpkt_len - 3) / 2 - 1); + output_line(fmtbuf); +}