view rvinterf/tmsh/audiocmd.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 0f2db8baf8db
children
line wrap: on
line source

/*
 * ETM audio commands
 */

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

cmd_aul(argc, argv)
	char **argv;
{
	u_char cmdpkt[MAX_PKT_TO_TARGET], *dp;
	int slen;

	slen = strlen(argv[1]);
	if (slen > 9) {
		printf("error: audio config name is limited to 9 chars\n");
		return(ERROR_USAGE);
	}
	dp = cmdpkt + 1;
	*dp++ = ETM_AUDIO;
	*dp++ = 'L';
	strcpy(dp, argv[1]);
	dp += slen + 1;
	send_etm_cmd(cmdpkt, dp - cmdpkt - 1);
	return(0);
}

cmd_aus(argc, argv)
	char **argv;
{
	u_char cmdpkt[MAX_PKT_TO_TARGET], *dp;
	int slen;

	slen = strlen(argv[1]);
	if (slen > 9) {
		printf("error: audio config name is limited to 9 chars\n");
		return(ERROR_USAGE);
	}
	dp = cmdpkt + 1;
	*dp++ = ETM_AUDIO;
	*dp++ = 'S';
	strcpy(dp, argv[1]);
	dp += slen + 1;
	send_etm_cmd(cmdpkt, dp - cmdpkt - 1);
	return(0);
}

cmd_aur(argc, argv)
	char **argv;
{
	unsigned param;
	u_char cmdpkt[5];

	param = strtoul(argv[1], 0, 0);
	if (param > 255) {
		printf("error: argument is too large\n");
		return(ERROR_USAGE);
	}
	cmdpkt[1] = ETM_AUDIO;
	cmdpkt[2] = 'R';
	cmdpkt[3] = param;
	send_etm_cmd(cmdpkt, 3);
	return(0);
}

cmd_auw(argc, argv)
	char **argv;
{
	u32 param, v;
	u_char cmdpkt[MAX_PKT_TO_TARGET];
	int di;
	char **ap;

	param = strtoul(argv[1], 0, 0);
	if (param > 255) {
		printf("error: parameter index argument is too large\n");
		return(ERROR_USAGE);
	}
	cmdpkt[1] = ETM_AUDIO;
	cmdpkt[2] = 'W';
	cmdpkt[3] = param;
	di = 4;
	for (ap = argv + 2; *ap; ap++) {
		v = strtol(*ap, 0, 0);
		cmdpkt[di++] = v;
		cmdpkt[di++] = v >> 8;
	}
	send_etm_cmd(cmdpkt, di - 1);
	return(0);
}

cmd_auw_fir(argc, argv)
	char **argv;
{
	u_char cmdpkt[67];
	int rc;

	cmdpkt[1] = ETM_AUDIO;
	cmdpkt[2] = 'W';
	if (!strcmp(argv[1], "ul"))
		cmdpkt[3] = 5;	/* AUDIO_MICROPHONE_FIR */
	else if (!strcmp(argv[1], "dl"))
		cmdpkt[3] = 9;	/* AUDIO_SPEAKER_FIR */
	else {
		printf("error: first argument must be dl or ul\n");
		return(ERROR_USAGE);
	}
	rc = read_fir_coeff_table(argv[2], cmdpkt + 4);
	if (rc)
		return(rc);
	send_etm_cmd(cmdpkt, 65);
	return(0);
}