comparison rvinterf/asyncshell/poweroff.c @ 0:e7502631a0f9

initial import from freecalypso-sw rev 1033:5ab737ac3ad7
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 11 Jun 2016 00:13:35 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:e7502631a0f9
1 /*
2 * fc-shell poweroff and tgtreset commands
3 */
4
5 #include <sys/types.h>
6 #include <stdio.h>
7 #include <stdlib.h>
8 #include "pktmux.h"
9 #include "etm.h"
10
11 send_etm_cmd(buf, len)
12 u_char *buf;
13 {
14 int i, c;
15
16 buf[0] = RVT_TM_HEADER;
17 c = 0;
18 for (i = 1; i <= len; i++)
19 c ^= buf[i];
20 buf[i] = c;
21 send_pkt_to_target(buf, len + 2);
22 return 0;
23 }
24
25 cmd_poweroff()
26 {
27 u_char cmdpkt[7];
28
29 cmdpkt[1] = ETM_CORE;
30 cmdpkt[2] = TMCORE_OPC_CODEC_WR;
31 cmdpkt[3] = 30; /* VRPCDEV */
32 cmdpkt[4] = 0x01; /* low 8 bits */
33 cmdpkt[5] = 0; /* high 2 bits */
34 return send_etm_cmd(cmdpkt, 5);
35 }
36
37 cmd_tgtreset()
38 {
39 u_char cmdpkt[4];
40
41 cmdpkt[1] = ETM_CORE;
42 cmdpkt[2] = TMCORE_OPC_RESET;
43 return send_etm_cmd(cmdpkt, 2);
44 }