view rvinterf/tmsh/abb.c @ 1014:961efadd530a default tip

fc-shell TCH DL handler: add support for CSD modes TCH DL capture mechanism in FC Tourmaline firmware has been extended to support CSD modes in addition to speech - add the necessary support on the host tools side. It needs to be noted that this mechanism in its present state does NOT provide the debug utility value that was sought: as we learned only after the code was implemented, TI's DSP has a misfeature in that the buffer we are reading (a_dd_0[]) is zeroed out when the IDS block is enabled, i.e., we are reading all zeros and not the real DL bits we were after. But since the code has already been written, we are keeping it - perhaps we can do some tests with IDS disabled.
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 26 Nov 2024 06:27:43 +0000
parents 2159f260ed13
children
line wrap: on
line source

/*
 * In this module we are going to implement commands dealing with the ABB.
 */

#include <sys/types.h>
#include <stdio.h>
#include <string.h>
#include <strings.h>
#include <stdlib.h>
#include "pktmux.h"
#include "limits.h"
#include "localtypes.h"
#include "etm.h"
#include "exitcodes.h"

extern u_char rvi_msg[];
extern int rvi_msg_len;

cmd_abbr(argc, argv)
	char **argv;
{
	u32 page, reg;
	u_char cmdpkt[5];

	page = strtoul(argv[1], 0, 0);
	reg = strtoul(argv[2], 0, 0);
	if (page > 1 || reg > 31) {
		printf("error: argument(s) out of range\n");
		return(ERROR_USAGE);
	}
	cmdpkt[1] = ETM_CORE;
	cmdpkt[2] = TMCORE_OPC_CODEC_RD;
	cmdpkt[3] = page << 5 | reg;
	send_etm_cmd(cmdpkt, 3);
	return(0);
}

void
abbr_response()
{
	unsigned pg, reg, val;
	char buf[80];

	if (rvi_msg[3]) {
		print_etm_pkt_raw("abbr error");
		return;
	}
	if (rvi_msg_len != 9) {
		print_etm_pkt_raw("abbr malformed resp");
		return;
	}
	pg = rvi_msg[5] >> 5;
	reg = rvi_msg[5] & 0x1F;
	val = rvi_msg[6] | rvi_msg[7] << 8;
	sprintf(buf, "abbr %u %u: %03X", pg, reg, val);
	async_msg_output(buf);
}

cmd_abbw(argc, argv)
	char **argv;
{
	u32 page, reg, val;
	u_char cmdpkt[7];

	page = strtoul(argv[1], 0, 0);
	reg = strtoul(argv[2], 0, 0);
	val = strtoul(argv[3], 0, 16);
	if (page > 1 || reg > 31 || val > 0x3FF) {
		printf("error: argument(s) out of range\n");
		return(ERROR_USAGE);
	}
	cmdpkt[1] = ETM_CORE;
	cmdpkt[2] = TMCORE_OPC_CODEC_WR;
	cmdpkt[3] = page << 5 | reg;
	cmdpkt[4] = val;
	cmdpkt[5] = val >> 8;
	send_etm_cmd(cmdpkt, 5);
	return(0);
}

void
abbw_response()
{
	unsigned pg, reg;
	char buf[80];

	if (rvi_msg[3]) {
		print_etm_pkt_raw("abbw error");
		return;
	}
	if (rvi_msg_len != 7) {
		print_etm_pkt_raw("abbw malformed resp");
		return;
	}
	pg = rvi_msg[5] >> 5;
	reg = rvi_msg[5] & 0x1F;
	sprintf(buf, "abbw %u %u OK", pg, reg);
	async_msg_output(buf);
}