view target-utils/lunadrv/lcdout.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 db9a8e88e63f
children
line wrap: on
line source

/*
 * Generic LCD output operations are implemented here.  All of the basic
 * LCD controller registers needed for these operations are the same
 * between ILI9225, ILI9225G and ST7775R controllers.
 */

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

set_lcd_addr_region(xstart, xend, ystart, yend)
{
	/* set window area */
	LCD_REG_WR(0x36, xend);
	LCD_REG_WR(0x37, xstart);
	LCD_REG_WR(0x38, yend);
	LCD_REG_WR(0x39, ystart);
	/* set current write address */
	LCD_REG_WR(0x20, xstart);
	LCD_REG_WR(0x21, ystart);
	/* set up for GRAM write */
	LCD_IR = 0x22;
}

void
cmd_fill(argbulk)
	char *argbulk;
{
	char *argv[2];
	u_long pixval;
	unsigned n;

	if (parse_args(argbulk, 1, 1, argv, 0) < 0)
		return;
	if (parse_hexarg(argv[0], 4, &pixval) < 0) {
		printf("ERROR: arg must be a valid 16-bit hex value\n");
		return;
	}
	set_lcd_addr_region(0, 175, 0, 219);
	for (n = 0; n < 176 * 220; n++)
		LCD_DR = pixval;
}

void
cmd_rect(argbulk)
	char *argbulk;
{
	char *argv[6];
	u_long pixval;
	int xstart, xend, ystart, yend;
	int npix;

	if (parse_args(argbulk, 5, 5, argv, 0) < 0)
		return;
	xstart = atoi(argv[0]);
	if (xstart < 0 || xstart > 175) {
range_err:	printf("ERROR: coordinate arg out of range\n");
		return;
	}
	xend = atoi(argv[1]);
	if (xend < 0 || xend > 175)
		goto range_err;
	ystart = atoi(argv[2]);
	if (ystart < 0 || ystart > 219)
		goto range_err;
	yend = atoi(argv[3]);
	if (yend < 0 || yend > 219)
		goto range_err;
	if (xend < xstart || yend < ystart) {
		printf("ERROR: negative range\n");
		return;
	}
	if (parse_hexarg(argv[4], 4, &pixval) < 0) {
		printf("ERROR: pixel arg must be a valid 16-bit hex value\n");
		return;
	}
	set_lcd_addr_region(xstart, xend, ystart, yend);
	npix = (xend + 1 - xstart) * (yend + 1 - ystart);
	while (npix--)
		LCD_DR = pixval;
}

void
cmd_mem2lcd(argbulk)
	char *argbulk;
{
	char *argv[2];
	u_long addr;
	const u16 *rdmem;
	unsigned n;

	if (parse_args(argbulk, 1, 1, argv, 0) < 0)
		return;
	if (parse_hexarg(argv[0], 8, &addr) < 0) {
		printf("ERROR: argument must be a valid 32-bit hex address\n");
		return;
	}
	if (addr & 1) {
		printf("ERROR: unaligned address\n");
		return;
	}
	rdmem = (const u16 *) addr;
	set_lcd_addr_region(0, 175, 0, 219);
	for (n = 0; n < 176 * 220; n++)
		LCD_DR = *rdmem++;
}