comparison rvinterf/asyncshell/poweroff.c @ 889:1b1683cda154

fc-shell: implemented poweroff and tgtreset commands
author Space Falcon <falcon@ivan.Harhan.ORG>
date Sun, 28 Jun 2015 16:52:06 +0000
parents
children bd873572ef2c
comparison
equal deleted inserted replaced
888:0590cfd5803f 889:1b1683cda154
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 void
12 send_etm_cmd(buf, len)
13 u_char *buf;
14 {
15 int i, c;
16
17 buf[0] = RVT_TM_HEADER;
18 c = 0;
19 for (i = 1; i <= len; i++)
20 c ^= buf[i];
21 buf[i] = c;
22 send_pkt_to_target(buf, len + 2);
23 }
24
25 void
26 cmd_poweroff()
27 {
28 u_char cmdpkt[7];
29
30 cmdpkt[1] = ETM_CORE;
31 cmdpkt[2] = TMCORE_OPC_CODEC_WR;
32 cmdpkt[3] = 30; /* VRPCDEV */
33 cmdpkt[4] = 0x01; /* low 8 bits */
34 cmdpkt[5] = 0; /* high 2 bits */
35 send_etm_cmd(cmdpkt, 5);
36 }
37
38 void
39 cmd_tgtreset()
40 {
41 u_char cmdpkt[4];
42
43 cmdpkt[1] = ETM_CORE;
44 cmdpkt[2] = TMCORE_OPC_RESET;
45 send_etm_cmd(cmdpkt, 2);
46 }