FreeCalypso > hg > freecalypso-sw
comparison rvinterf/asyncshell/poweroff.c @ 965:bd873572ef2c
fc-shell: one-shot command mode implemented
author | Mychaela Falconia <falcon@ivan.Harhan.ORG> |
---|---|
date | Sat, 07 Nov 2015 00:00:46 +0000 |
parents | 1b1683cda154 |
children |
comparison
equal
deleted
inserted
replaced
964:373af5f74e39 | 965:bd873572ef2c |
---|---|
6 #include <stdio.h> | 6 #include <stdio.h> |
7 #include <stdlib.h> | 7 #include <stdlib.h> |
8 #include "pktmux.h" | 8 #include "pktmux.h" |
9 #include "etm.h" | 9 #include "etm.h" |
10 | 10 |
11 void | |
12 send_etm_cmd(buf, len) | 11 send_etm_cmd(buf, len) |
13 u_char *buf; | 12 u_char *buf; |
14 { | 13 { |
15 int i, c; | 14 int i, c; |
16 | 15 |
18 c = 0; | 17 c = 0; |
19 for (i = 1; i <= len; i++) | 18 for (i = 1; i <= len; i++) |
20 c ^= buf[i]; | 19 c ^= buf[i]; |
21 buf[i] = c; | 20 buf[i] = c; |
22 send_pkt_to_target(buf, len + 2); | 21 send_pkt_to_target(buf, len + 2); |
22 return 0; | |
23 } | 23 } |
24 | 24 |
25 void | |
26 cmd_poweroff() | 25 cmd_poweroff() |
27 { | 26 { |
28 u_char cmdpkt[7]; | 27 u_char cmdpkt[7]; |
29 | 28 |
30 cmdpkt[1] = ETM_CORE; | 29 cmdpkt[1] = ETM_CORE; |
31 cmdpkt[2] = TMCORE_OPC_CODEC_WR; | 30 cmdpkt[2] = TMCORE_OPC_CODEC_WR; |
32 cmdpkt[3] = 30; /* VRPCDEV */ | 31 cmdpkt[3] = 30; /* VRPCDEV */ |
33 cmdpkt[4] = 0x01; /* low 8 bits */ | 32 cmdpkt[4] = 0x01; /* low 8 bits */ |
34 cmdpkt[5] = 0; /* high 2 bits */ | 33 cmdpkt[5] = 0; /* high 2 bits */ |
35 send_etm_cmd(cmdpkt, 5); | 34 return send_etm_cmd(cmdpkt, 5); |
36 } | 35 } |
37 | 36 |
38 void | |
39 cmd_tgtreset() | 37 cmd_tgtreset() |
40 { | 38 { |
41 u_char cmdpkt[4]; | 39 u_char cmdpkt[4]; |
42 | 40 |
43 cmdpkt[1] = ETM_CORE; | 41 cmdpkt[1] = ETM_CORE; |
44 cmdpkt[2] = TMCORE_OPC_RESET; | 42 cmdpkt[2] = TMCORE_OPC_RESET; |
45 send_etm_cmd(cmdpkt, 2); | 43 return send_etm_cmd(cmdpkt, 2); |
46 } | 44 } |