FreeCalypso > hg > freecalypso-tools
annotate rvinterf/tmsh/abbtm3.c @ 150:45d8c175f9b5
fc-tmsh: oabbr and oabbw command sending implemented
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 05 Mar 2017 09:07:01 +0000 |
parents | |
children | 74b9aeb25d79 |
rev | line source |
---|---|
150
45d8c175f9b5
fc-tmsh: oabbr and oabbw command sending implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
45d8c175f9b5
fc-tmsh: oabbr and oabbw command sending implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 * Old TM3 versions of ABB register read and write commands |
45d8c175f9b5
fc-tmsh: oabbr and oabbw command sending implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 */ |
45d8c175f9b5
fc-tmsh: oabbr and oabbw command sending implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 |
45d8c175f9b5
fc-tmsh: oabbr and oabbw command sending implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 #include <sys/types.h> |
45d8c175f9b5
fc-tmsh: oabbr and oabbw command sending implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 #include <stdio.h> |
45d8c175f9b5
fc-tmsh: oabbr and oabbw command sending implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 #include <string.h> |
45d8c175f9b5
fc-tmsh: oabbr and oabbw command sending implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 #include <strings.h> |
45d8c175f9b5
fc-tmsh: oabbr and oabbw command sending implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 #include <stdlib.h> |
45d8c175f9b5
fc-tmsh: oabbr and oabbw command sending implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 #include "pktmux.h" |
45d8c175f9b5
fc-tmsh: oabbr and oabbw command sending implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 #include "limits.h" |
45d8c175f9b5
fc-tmsh: oabbr and oabbw command sending implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 #include "localtypes.h" |
45d8c175f9b5
fc-tmsh: oabbr and oabbw command sending implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 #include "tm3.h" |
45d8c175f9b5
fc-tmsh: oabbr and oabbw command sending implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 #include "exitcodes.h" |
45d8c175f9b5
fc-tmsh: oabbr and oabbw command sending implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 |
45d8c175f9b5
fc-tmsh: oabbr and oabbw command sending implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 extern u_char rvi_msg[]; |
45d8c175f9b5
fc-tmsh: oabbr and oabbw command sending implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 extern int rvi_msg_len; |
45d8c175f9b5
fc-tmsh: oabbr and oabbw command sending implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 |
45d8c175f9b5
fc-tmsh: oabbr and oabbw command sending implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 cmd_oabbr(argc, argv) |
45d8c175f9b5
fc-tmsh: oabbr and oabbw command sending implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 char **argv; |
45d8c175f9b5
fc-tmsh: oabbr and oabbw command sending implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 { |
45d8c175f9b5
fc-tmsh: oabbr and oabbw command sending implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 u32 page, reg; |
45d8c175f9b5
fc-tmsh: oabbr and oabbw command sending implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 u_char cmdpkt[5]; |
45d8c175f9b5
fc-tmsh: oabbr and oabbw command sending implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 |
45d8c175f9b5
fc-tmsh: oabbr and oabbw command sending implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 page = strtoul(argv[1], 0, 0); |
45d8c175f9b5
fc-tmsh: oabbr and oabbw command sending implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 reg = strtoul(argv[2], 0, 0); |
45d8c175f9b5
fc-tmsh: oabbr and oabbw command sending implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
27 if (page > 1 || reg > 31) { |
45d8c175f9b5
fc-tmsh: oabbr and oabbw command sending implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 printf("error: argument(s) out of range\n"); |
45d8c175f9b5
fc-tmsh: oabbr and oabbw command sending implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 return(ERROR_USAGE); |
45d8c175f9b5
fc-tmsh: oabbr and oabbw command sending implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 } |
45d8c175f9b5
fc-tmsh: oabbr and oabbw command sending implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 cmdpkt[1] = CODEC_READ; |
45d8c175f9b5
fc-tmsh: oabbr and oabbw command sending implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
32 cmdpkt[2] = page << 5 | reg; |
45d8c175f9b5
fc-tmsh: oabbr and oabbw command sending implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
33 cmdpkt[3] = 0; |
45d8c175f9b5
fc-tmsh: oabbr and oabbw command sending implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
34 send_etm_cmd(cmdpkt, 3); |
45d8c175f9b5
fc-tmsh: oabbr and oabbw command sending implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
35 return(0); |
45d8c175f9b5
fc-tmsh: oabbr and oabbw command sending implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
36 } |
45d8c175f9b5
fc-tmsh: oabbr and oabbw command sending implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
37 |
45d8c175f9b5
fc-tmsh: oabbr and oabbw command sending implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
38 cmd_oabbw(argc, argv) |
45d8c175f9b5
fc-tmsh: oabbr and oabbw command sending implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
39 char **argv; |
45d8c175f9b5
fc-tmsh: oabbr and oabbw command sending implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
40 { |
45d8c175f9b5
fc-tmsh: oabbr and oabbw command sending implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
41 u32 page, reg, val; |
45d8c175f9b5
fc-tmsh: oabbr and oabbw command sending implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
42 u_char cmdpkt[7]; |
45d8c175f9b5
fc-tmsh: oabbr and oabbw command sending implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
43 |
45d8c175f9b5
fc-tmsh: oabbr and oabbw command sending implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
44 page = strtoul(argv[1], 0, 0); |
45d8c175f9b5
fc-tmsh: oabbr and oabbw command sending implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
45 reg = strtoul(argv[2], 0, 0); |
45d8c175f9b5
fc-tmsh: oabbr and oabbw command sending implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
46 val = strtoul(argv[3], 0, 16); |
45d8c175f9b5
fc-tmsh: oabbr and oabbw command sending implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
47 if (page > 1 || reg > 31 || val > 0x3FF) { |
45d8c175f9b5
fc-tmsh: oabbr and oabbw command sending implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
48 printf("error: argument(s) out of range\n"); |
45d8c175f9b5
fc-tmsh: oabbr and oabbw command sending implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
49 return(ERROR_USAGE); |
45d8c175f9b5
fc-tmsh: oabbr and oabbw command sending implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
50 } |
45d8c175f9b5
fc-tmsh: oabbr and oabbw command sending implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
51 cmdpkt[1] = CODEC_WRITE; |
45d8c175f9b5
fc-tmsh: oabbr and oabbw command sending implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
52 cmdpkt[2] = page << 5 | reg; |
45d8c175f9b5
fc-tmsh: oabbr and oabbw command sending implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
53 cmdpkt[3] = 0; |
45d8c175f9b5
fc-tmsh: oabbr and oabbw command sending implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
54 cmdpkt[4] = val; |
45d8c175f9b5
fc-tmsh: oabbr and oabbw command sending implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
55 cmdpkt[5] = val >> 8; |
45d8c175f9b5
fc-tmsh: oabbr and oabbw command sending implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
56 send_etm_cmd(cmdpkt, 5); |
45d8c175f9b5
fc-tmsh: oabbr and oabbw command sending implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
57 return(0); |
45d8c175f9b5
fc-tmsh: oabbr and oabbw command sending implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
58 } |