FreeCalypso > hg > freecalypso-tools
comparison 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 |
comparison
equal
deleted
inserted
replaced
149:c81d0e9ac3b4 | 150:45d8c175f9b5 |
---|---|
1 /* | |
2 * Old TM3 versions of ABB register read and write commands | |
3 */ | |
4 | |
5 #include <sys/types.h> | |
6 #include <stdio.h> | |
7 #include <string.h> | |
8 #include <strings.h> | |
9 #include <stdlib.h> | |
10 #include "pktmux.h" | |
11 #include "limits.h" | |
12 #include "localtypes.h" | |
13 #include "tm3.h" | |
14 #include "exitcodes.h" | |
15 | |
16 extern u_char rvi_msg[]; | |
17 extern int rvi_msg_len; | |
18 | |
19 cmd_oabbr(argc, argv) | |
20 char **argv; | |
21 { | |
22 u32 page, reg; | |
23 u_char cmdpkt[5]; | |
24 | |
25 page = strtoul(argv[1], 0, 0); | |
26 reg = strtoul(argv[2], 0, 0); | |
27 if (page > 1 || reg > 31) { | |
28 printf("error: argument(s) out of range\n"); | |
29 return(ERROR_USAGE); | |
30 } | |
31 cmdpkt[1] = CODEC_READ; | |
32 cmdpkt[2] = page << 5 | reg; | |
33 cmdpkt[3] = 0; | |
34 send_etm_cmd(cmdpkt, 3); | |
35 return(0); | |
36 } | |
37 | |
38 cmd_oabbw(argc, argv) | |
39 char **argv; | |
40 { | |
41 u32 page, reg, val; | |
42 u_char cmdpkt[7]; | |
43 | |
44 page = strtoul(argv[1], 0, 0); | |
45 reg = strtoul(argv[2], 0, 0); | |
46 val = strtoul(argv[3], 0, 16); | |
47 if (page > 1 || reg > 31 || val > 0x3FF) { | |
48 printf("error: argument(s) out of range\n"); | |
49 return(ERROR_USAGE); | |
50 } | |
51 cmdpkt[1] = CODEC_WRITE; | |
52 cmdpkt[2] = page << 5 | reg; | |
53 cmdpkt[3] = 0; | |
54 cmdpkt[4] = val; | |
55 cmdpkt[5] = val >> 8; | |
56 send_etm_cmd(cmdpkt, 5); | |
57 return(0); | |
58 } |