FreeCalypso > hg > freecalypso-sw
annotate rvinterf/asyncshell/poweroff.c @ 992:a7b0b426f9ca
target-utils: boot ROM UART autodetection revamped
The new implementation should work with both the familiar Calypso C035
boot ROM version found in our regular targets as well as the older
Calypso F741979B version found on the vintage D-Sample board.
author | Mychaela Falconia <falcon@ivan.Harhan.ORG> |
---|---|
date | Wed, 30 Dec 2015 21:28:41 +0000 |
parents | bd873572ef2c |
children |
rev | line source |
---|---|
889
1b1683cda154
fc-shell: implemented poweroff and tgtreset commands
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
1 /* |
1b1683cda154
fc-shell: implemented poweroff and tgtreset commands
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
2 * fc-shell poweroff and tgtreset commands |
1b1683cda154
fc-shell: implemented poweroff and tgtreset commands
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
3 */ |
1b1683cda154
fc-shell: implemented poweroff and tgtreset commands
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
4 |
1b1683cda154
fc-shell: implemented poweroff and tgtreset commands
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
5 #include <sys/types.h> |
1b1683cda154
fc-shell: implemented poweroff and tgtreset commands
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
6 #include <stdio.h> |
1b1683cda154
fc-shell: implemented poweroff and tgtreset commands
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
7 #include <stdlib.h> |
1b1683cda154
fc-shell: implemented poweroff and tgtreset commands
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
8 #include "pktmux.h" |
1b1683cda154
fc-shell: implemented poweroff and tgtreset commands
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
9 #include "etm.h" |
1b1683cda154
fc-shell: implemented poweroff and tgtreset commands
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
10 |
1b1683cda154
fc-shell: implemented poweroff and tgtreset commands
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
11 send_etm_cmd(buf, len) |
1b1683cda154
fc-shell: implemented poweroff and tgtreset commands
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
12 u_char *buf; |
1b1683cda154
fc-shell: implemented poweroff and tgtreset commands
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
13 { |
1b1683cda154
fc-shell: implemented poweroff and tgtreset commands
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
14 int i, c; |
1b1683cda154
fc-shell: implemented poweroff and tgtreset commands
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
15 |
1b1683cda154
fc-shell: implemented poweroff and tgtreset commands
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
16 buf[0] = RVT_TM_HEADER; |
1b1683cda154
fc-shell: implemented poweroff and tgtreset commands
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
17 c = 0; |
1b1683cda154
fc-shell: implemented poweroff and tgtreset commands
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
18 for (i = 1; i <= len; i++) |
1b1683cda154
fc-shell: implemented poweroff and tgtreset commands
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
19 c ^= buf[i]; |
1b1683cda154
fc-shell: implemented poweroff and tgtreset commands
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
20 buf[i] = c; |
1b1683cda154
fc-shell: implemented poweroff and tgtreset commands
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
21 send_pkt_to_target(buf, len + 2); |
965
bd873572ef2c
fc-shell: one-shot command mode implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
889
diff
changeset
|
22 return 0; |
889
1b1683cda154
fc-shell: implemented poweroff and tgtreset commands
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
23 } |
1b1683cda154
fc-shell: implemented poweroff and tgtreset commands
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
24 |
1b1683cda154
fc-shell: implemented poweroff and tgtreset commands
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
25 cmd_poweroff() |
1b1683cda154
fc-shell: implemented poweroff and tgtreset commands
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
26 { |
1b1683cda154
fc-shell: implemented poweroff and tgtreset commands
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
27 u_char cmdpkt[7]; |
1b1683cda154
fc-shell: implemented poweroff and tgtreset commands
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
28 |
1b1683cda154
fc-shell: implemented poweroff and tgtreset commands
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
29 cmdpkt[1] = ETM_CORE; |
1b1683cda154
fc-shell: implemented poweroff and tgtreset commands
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
30 cmdpkt[2] = TMCORE_OPC_CODEC_WR; |
1b1683cda154
fc-shell: implemented poweroff and tgtreset commands
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
31 cmdpkt[3] = 30; /* VRPCDEV */ |
1b1683cda154
fc-shell: implemented poweroff and tgtreset commands
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
32 cmdpkt[4] = 0x01; /* low 8 bits */ |
1b1683cda154
fc-shell: implemented poweroff and tgtreset commands
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
33 cmdpkt[5] = 0; /* high 2 bits */ |
965
bd873572ef2c
fc-shell: one-shot command mode implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
889
diff
changeset
|
34 return send_etm_cmd(cmdpkt, 5); |
889
1b1683cda154
fc-shell: implemented poweroff and tgtreset commands
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
35 } |
1b1683cda154
fc-shell: implemented poweroff and tgtreset commands
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
36 |
1b1683cda154
fc-shell: implemented poweroff and tgtreset commands
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
37 cmd_tgtreset() |
1b1683cda154
fc-shell: implemented poweroff and tgtreset commands
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
38 { |
1b1683cda154
fc-shell: implemented poweroff and tgtreset commands
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
39 u_char cmdpkt[4]; |
1b1683cda154
fc-shell: implemented poweroff and tgtreset commands
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
40 |
1b1683cda154
fc-shell: implemented poweroff and tgtreset commands
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
41 cmdpkt[1] = ETM_CORE; |
1b1683cda154
fc-shell: implemented poweroff and tgtreset commands
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
42 cmdpkt[2] = TMCORE_OPC_RESET; |
965
bd873572ef2c
fc-shell: one-shot command mode implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
889
diff
changeset
|
43 return send_etm_cmd(cmdpkt, 2); |
889
1b1683cda154
fc-shell: implemented poweroff and tgtreset commands
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
44 } |