view rvinterf/lowlevel/format_fc.c @ 928:65953c172f24

rvinterf/lowlevel: new hex dump format
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 23 May 2023 05:23:19 +0000
parents 4e243402f453
children a38430e03e73
line wrap: on
line source

/*
 * 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 <sys/types.h>
#include <stdio.h>
#include <string.h>
#include <strings.h>
#include "../include/pktmux.h"
#include "../include/limits.h"

extern u_char rxpkt[];
extern size_t rxpkt_len;

extern void output_cont();

static char fmtbuf[MAX_PKT_FROM_TARGET*8];	/* size it generously */

void
print_ati_output()
{
	strcpy(fmtbuf, "ATI: ");
	safe_print_trace(rxpkt + 1, (int)rxpkt_len - 1, fmtbuf + 5);
	output_line(fmtbuf);
}

void
print_fc_lld_msg()
{
	strcpy(fmtbuf, "LLD: ");
	safe_print_trace(rxpkt + 1, (int)rxpkt_len - 1, fmtbuf + 5);
	output_line(fmtbuf);
}

void
print_tch_output_raw()
{
	output_line("Rx TCH packet");
	packet_hex_dump(rxpkt, (unsigned) rxpkt_len, output_cont);
}

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);
}