view target-utils/buzplayer/pwt.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 7c02cc7f28df
children
line wrap: on
line source

/*
 * Commands for exercising the Calypso buzzer in PWT mode.
 */

#include <sys/types.h>
#include <strings.h>
#include "types.h"

extern u_long strtoul();

#define	ASIC_CONF_REG	(*(volatile u16 *) 0xFFFEF008)
#define	PWT_MODE_MASK	0x0020

#define	PWT_FRC_REG	(*(volatile u8 *) 0xFFFE8800)
#define	PWT_VCR_REG	(*(volatile u8 *) 0xFFFE8801)
#define	PWT_GCR_REG	(*(volatile u8 *) 0xFFFE8802)

void
pwt_on()
{
	ASIC_CONF_REG |= PWT_MODE_MASK;
	PWT_GCR_REG = 0x01;
}

void
pwt_off()
{
	ASIC_CONF_REG &= ~PWT_MODE_MASK;
	PWT_GCR_REG = 0;
}

void
cmd_pwt(argbulk)
	char *argbulk;
{
	char *argv[2];

	if (parse_args(argbulk, 1, 1, argv, 0) < 0)
		return;
	if (!strcmp(argv[0], "on"))
		pwt_on();
	else if (!strcmp(argv[0], "off"))
		pwt_off();
	else
		printf("ERROR: \"on\" or \"off\" argument expected\n");
}

void
cmd_bzt(argbulk)
	char *argbulk;
{
	char *argv[3];
	u32 note, vol;
	int c;

	if (parse_args(argbulk, 1, 2, argv, 0) < 0)
		return;
	note = strtoul(argv[0], 0, 0);
	if (note > 47) {
		printf("ERROR: note argument out of range\n");
		return;
	}
	if (argv[1]) {
		vol = strtoul(argv[1], 0, 0);
		if (vol > 63) {
			printf("ERROR: volume argument out of range\n");
			return;
		}
	} else
		vol = 63;
	pwt_on();
	PWT_FRC_REG = note;
	PWT_VCR_REG = (vol << 1) | 1;
	for (;;) {
		c = serial_in_poll();
		if (c >= 0)
			break;
	}
	PWT_VCR_REG = 0;
}