view rvinterf/asyncshell/poweroff.c @ 923:10b4bed10192

gsm-fw/L1: fix for the DSP patch corruption bug The L1 code we got from the LoCosto fw contains a feature for DSP CPU load measurement. This feature is a LoCosto-ism, i.e., not applicable to earlier DBB chips (Calypso) with their respective earlier DSP ROMs. Most of the code dealing with that feature is conditionalized as #if (DSP >= 38), but one spot was missed, and the MCU code was writing into an API word dealing with this feature. In TCS211 this DSP API word happens to be used by the DSP code patch, hence that write was corrupting the patched DSP code.
author Mychaela Falconia <falcon@ivan.Harhan.ORG>
date Mon, 19 Oct 2015 17:13:56 +0000
parents 1b1683cda154
children bd873572ef2c
line wrap: on
line source

/*
 * fc-shell poweroff and tgtreset commands
 */

#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#include "pktmux.h"
#include "etm.h"

void
send_etm_cmd(buf, len)
	u_char *buf;
{
	int i, c;

	buf[0] = RVT_TM_HEADER;
	c = 0;
	for (i = 1; i <= len; i++)
		c ^= buf[i];
	buf[i] = c;
	send_pkt_to_target(buf, len + 2);
}

void
cmd_poweroff()
{
	u_char cmdpkt[7];

	cmdpkt[1] = ETM_CORE;
	cmdpkt[2] = TMCORE_OPC_CODEC_WR;
	cmdpkt[3] = 30;		/* VRPCDEV */
	cmdpkt[4] = 0x01;	/* low 8 bits */
	cmdpkt[5] = 0;		/* high 2 bits */
	send_etm_cmd(cmdpkt, 5);
}

void
cmd_tgtreset()
{
	u_char cmdpkt[4];

	cmdpkt[1] = ETM_CORE;
	cmdpkt[2] = TMCORE_OPC_RESET;
	send_etm_cmd(cmdpkt, 2);
}