comparison autocal/l1tmops.c @ 17:0645344feee5

autocal/l1tmops.c: started implementing basic operations
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 22 May 2017 18:30:24 +0000
parents 1c4abfe8bcd9
children af77b95feeba
comparison
equal deleted inserted replaced
16:1c4abfe8bcd9 17:0645344feee5
45 fprintf(stderr, "DUT error: TM response has wrong CID\n"); 45 fprintf(stderr, "DUT error: TM response has wrong CID\n");
46 exit(ERROR_TARGET); 46 exit(ERROR_TARGET);
47 } 47 }
48 return(0); 48 return(0);
49 } 49 }
50
51 do_tms(arg)
52 {
53 u_char cmdpkt[5];
54
55 cmdpkt[1] = TM_MODE_SET;
56 cmdpkt[2] = arg;
57 cmdpkt[3] = arg >> 8;
58 l1tm_pkt_exch(cmdpkt, 3);
59 if (rvi_msg[3]) {
60 fprintf(stderr, "DUT error %u in response to tms\n",
61 rvi_msg[3]);
62 exit(ERROR_TARGET);
63 }
64 if (rvi_msg_len != 5) {
65 fprintf(stderr, "DUT error: tms response wrong length\n");
66 exit(ERROR_TARGET);
67 }
68 return(0);
69 }
70
71 do_rfe(arg)
72 {
73 u_char cmdpkt[5];
74
75 cmdpkt[1] = RF_ENABLE;
76 cmdpkt[2] = arg;
77 cmdpkt[3] = arg >> 8;
78 l1tm_pkt_exch(cmdpkt, 3);
79 if (rvi_msg[3]) {
80 fprintf(stderr, "DUT error %u in response to rfe\n",
81 rvi_msg[3]);
82 exit(ERROR_TARGET);
83 }
84 return(0);
85 }
86
87 do_rfpw(index, value)
88 {
89 u_char cmdpkt[7];
90
91 cmdpkt[1] = RF_PARAM_WRITE;
92 cmdpkt[2] = index;
93 cmdpkt[3] = index >> 8;
94 cmdpkt[4] = value;
95 cmdpkt[5] = value >> 8;
96 l1tm_pkt_exch(cmdpkt, 5);
97 if (rvi_msg[3]) {
98 fprintf(stderr, "DUT error %u in response to rfpw\n",
99 rvi_msg[3]);
100 exit(ERROR_TARGET);
101 }
102 if (rvi_msg_len != 6) {
103 fprintf(stderr, "DUT error: rfpw response wrong length\n");
104 exit(ERROR_TARGET);
105 }
106 if (rvi_msg[4] != index) {
107 fprintf(stderr, "DUT error: rfpw response wrong index\n");
108 exit(ERROR_TARGET);
109 }
110 return(0);
111 }
112
113 set_std_band(std, band)
114 {
115 u_char cmdpkt[7];
116
117 cmdpkt[1] = RF_PARAM_WRITE;
118 cmdpkt[2] = STD_BAND_FLAG;
119 cmdpkt[3] = 0;
120 cmdpkt[4] = std;
121 cmdpkt[5] = band;
122 l1tm_pkt_exch(cmdpkt, 5);
123 if (rvi_msg[3]) {
124 fprintf(stderr, "DUT error %u in response to rfpw\n",
125 rvi_msg[3]);
126 exit(ERROR_TARGET);
127 }
128 if (rvi_msg_len != 6) {
129 fprintf(stderr, "DUT error: rfpw response wrong length\n");
130 exit(ERROR_TARGET);
131 }
132 if (rvi_msg[4] != STD_BAND_FLAG) {
133 fprintf(stderr, "DUT error: rfpw response wrong index\n");
134 exit(ERROR_TARGET);
135 }
136 return(0);
137 }