Rev 15 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 15 | Rev 81 | ||
---|---|---|---|
1 | // ./pts -a 0x1000000 -v 1 -w 2 turn LED ON |
1 | // ./pts -a 0x1000000 -v 1 -w 2 turn LED ON |
2 | // ./pts -a 0x1000000 -v 1 -w 1 turn LED OFF |
2 | // ./pts -a 0x1000000 -v 1 -w 1 turn LED OFF |
3 | #include <stdlib.h> |
3 | #include <stdlib.h> |
4 | #include <stdio.h> |
4 | #include <stdio.h> |
5 | #include <stdint.h> |
5 | #include <stdint.h> |
6 | #include <ctype.h> |
6 | #include <ctype.h> |
7 | #include <unistd.h> |
7 | #include <unistd.h> |
8 | #include <string.h> |
8 | #include <string.h> |
9 | #include "PtsModule.h" |
9 | #include "PtsModule.h" |
10 | #include <getopt.h> |
10 | #include <getopt.h> |
11 | 11 | ||
12 | void Delay(double t){ |
12 | void Delay(double t){ |
13 | usleep(t*1e6); |
13 | usleep(t*1e6); |
14 | } |
14 | } |
15 | 15 | ||
16 | 16 | ||
17 | uint32_t ptaddr=0; |
17 | uint32_t ptaddr=0; |
18 | 18 | ||
19 | int Pts_write(uint32_t addr, uint32_t data ){ |
19 | int Pts_write(uint32_t addr, uint32_t data ){ |
- | 20 | fprintf(stderr, "Pts_write ADDR 0x%04x 0x%04x ",addr,ptaddr+addr ); |
|
- | 21 | int nb=VME_A32D32_W(ptaddr+addr,&data); |
|
- | 22 | fprintf(stderr, " nb=%d\n",nb); |
|
- | 23 | return nb; |
|
- | 24 | } |
|
- | 25 | ||
- | 26 | int Pts_Mwrite(uint32_t addr, uint32_t data ){ |
|
20 |
|
27 | VME_A32D32_MW(ptaddr+addr,&data); |
21 | return |
28 | return 1; |
22 | } |
29 | } |
23 | 30 | ||
24 | int Pts_read(uint32_t addr, uint32_t *data ){ |
31 | int Pts_read(uint32_t addr, uint32_t *data ){ |
- | 32 | fprintf(stderr, "Pts_read ADDR 0x%04x 0x%04x ",addr,ptaddr+addr ); |
|
25 | VME_A32D32_R(ptaddr+addr,data); |
33 | int nb=VME_A32D32_R(ptaddr+addr,data); |
- | 34 | fprintf(stderr, " nb=%d\n",nb); |
|
26 | return |
35 | return nb; |
27 | } |
36 | } |
28 | 37 | ||
29 | 38 | ||
30 | int Pts_erase( int verbose ) { |
39 | int Pts_erase( int verbose ) { |
31 | uint32_t dum; |
40 | uint32_t dum = 0; |
32 | Pts_write( ADR_CSR1, 0 ); |
41 | Pts_write( ADR_CSR1, 0 ); |
33 | Delay(0.1); |
42 | Delay(0.1); |
34 | Pts_read( ADR_CSR1, &dum); |
43 | Pts_read( ADR_CSR1, &dum); |
35 | if( verbose ) |
44 | if( verbose ) fprintf( stderr, "CSR1(0x%02x) = 0x%04x <<<<\n", ADR_CSR1, |
36 | dum & 0xffff ); |
45 | dum & 0xffff ); |
37 | Pts_write( ADR_CSR1, CSR1_PROGRAM_ ); |
46 | Pts_write( ADR_CSR1, CSR1_PROGRAM_ ); |
38 | Delay(0.1); |
47 | Delay(0.1); |
39 | Pts_read( ADR_CSR1, &dum); |
48 | Pts_read( ADR_CSR1, &dum); |
40 | if( verbose ) |
49 | if( verbose ) fprintf(stderr, "CSR1(0x%02x) = 0x%04x >>>>>\n", ADR_CSR1, |
41 | dum & 0xffff ); |
50 | dum & 0xffff ); |
42 | return 1; |
51 | return 1; |
43 | } |
52 | } |
44 | /* |
53 | /* |
45 | int Pts_configure( const char *filename, int mode, int verbose ) { |
54 | int Pts_configure( const char *filename, int mode, int verbose ) { |
46 | int len = strlen( filename ); |
55 | int len = strlen( filename ); |
47 | if( len > 4 ) { |
56 | if( len > 4 ) { |
48 | const char *p = filename+len-4; |
57 | const char *p = filename+len-4; |
49 | if( strcmp(p,".bit")==0 ) return Pts_configure_bit( filename, mode, verbose ); |
58 | if( strcmp(p,".bit")==0 ) return Pts_configure_bit( filename, mode, verbose ); |
50 | if( strcmp(p,".rbt")==0 ) return Pts_configure_rbt( filename, mode, verbose ); |
59 | if( strcmp(p,".rbt")==0 ) return Pts_configure_rbt( filename, mode, verbose ); |
51 | } |
60 | } |
52 | if( verbose ) fprintf( stderr, "Bad filename: \"%s\" .\n" ); |
61 | if( verbose ) fprintf( stderr, "Bad filename: \"%s\" .\n" ); |
53 | return -1; |
62 | return -1; |
54 | } |
63 | } |
55 | 64 | ||
56 | int PtsModule::configure_rbt( const char *filename, int mode, int verbose ) { |
65 | int PtsModule::configure_rbt( const char *filename, int mode, int verbose ) { |
57 | long n, pos; |
66 | long n, pos; |
58 | char cs[1024]; |
67 | char cs[1024]; |
59 | FILE *fp; |
68 | FILE *fp; |
60 | if( ( fp = fopen( filename, "r" ) ) == NULL ) { |
69 | if( ( fp = fopen( filename, "r" ) ) == NULL ) { |
61 | if( verbose ) fprintf( stderr, "cannot open \"%s\"\n", filename ); |
70 | if( verbose ) fprintf( stderr, "cannot open \"%s\"\n", filename ); |
62 | return -1; |
71 | return -1; |
63 | } |
72 | } |
64 | if( verbose ) printf( "file \"%s\" opened.\n", filename ); |
73 | if( verbose ) printf( "file \"%s\" opened.\n", filename ); |
65 | |
74 | |
66 | do{ |
75 | do{ |
67 | pos = ftell(fp); |
76 | pos = ftell(fp); |
68 | fgets( cs, sizeof(cs), fp ); |
77 | fgets( cs, sizeof(cs), fp ); |
69 | puts(cs); |
78 | puts(cs); |
70 | n=strlen(cs); |
79 | n=strlen(cs); |
71 | } while( n==0 || strspn( cs, " \t\n01" )!=n ); |
80 | } while( n==0 || strspn( cs, " \t\n01" )!=n ); |
72 | fseek( fp, pos, SEEK_SET ); |
81 | fseek( fp, pos, SEEK_SET ); |
73 | 82 | ||
74 | long nchar = 0; |
83 | long nchar = 0; |
75 | if( mode == SLAVESERIAL_MODE ) { |
84 | if( mode == SLAVESERIAL_MODE ) { |
76 | write( ADR_MODE, SLAVESERIAL_MODE ); |
85 | write( ADR_MODE, SLAVESERIAL_MODE ); |
77 | erase( verbose ); |
86 | erase( verbose ); |
78 | int c; |
87 | int c; |
79 | const long bit_per_dot = BYTE_PER_DOT*8; |
88 | const long bit_per_dot = BYTE_PER_DOT*8; |
80 | while( (c=getc(fp))!=EOF ){ |
89 | while( (c=getc(fp))!=EOF ){ |
81 | if( c=='0' || c=='1' ) { |
90 | if( c=='0' || c=='1' ) { |
82 | write( ADR_CFG, c=='0' ? 0 : 1 ); |
91 | write( ADR_CFG, c=='0' ? 0 : 1 ); |
83 | nchar++; |
92 | nchar++; |
84 | if( verbose && ++nchar%bit_per_dot==0 ) putchar('.'); |
93 | if( verbose && ++nchar%bit_per_dot==0 ) putchar('.'); |
85 | } |
94 | } |
86 | else if( isspace(c) ) continue; |
95 | else if( isspace(c) ) continue; |
87 | else { |
96 | else { |
88 | fprintf( stderr, "(%ld) illegal character : %c\n", nchar, c ); |
97 | fprintf( stderr, "(%ld) illegal character : %c\n", nchar, c ); |
89 | fclose(fp); |
98 | fclose(fp); |
90 | return -1; |
99 | return -1; |
91 | } |
100 | } |
92 | } |
101 | } |
93 | } else if(mode == SELECTMAP_MODE) { |
102 | } else if(mode == SELECTMAP_MODE) { |
94 | if(verbose) fprintf(stderr, "\nselectmap mode (rbt file) not supported\n"); |
103 | if(verbose) fprintf(stderr, "\nselectmap mode (rbt file) not supported\n"); |
95 | return -1; |
104 | return -1; |
96 | } else { |
105 | } else { |
97 | if(verbose) fprintf(stderr, "\nIllegal mode\n"); |
106 | if(verbose) fprintf(stderr, "\nIllegal mode\n"); |
98 | return -1; |
107 | return -1; |
99 | } |
108 | } |
100 | if(verbose) printf("\ntotal %ld bits\n", nchar); |
109 | if(verbose) printf("\ntotal %ld bits\n", nchar); |
101 | fclose(fp); |
110 | fclose(fp); |
102 | return check_configure( verbose ); |
111 | return check_configure( verbose ); |
103 | } |
112 | } |
104 | */ |
113 | */ |
105 | int Pts_configure_bit( const char *filename, int mode, int verbose ) { |
114 | int Pts_configure_bit( const char *filename, int mode, int verbose ) { |
106 | int c,j; |
115 | int c,j; |
107 | int dummyword; |
116 | int dummyword; |
108 | FILE *fp; |
117 | FILE *fp; |
109 | const long byte_per_dot = BYTE_PER_DOT; |
118 | const long byte_per_dot = BYTE_PER_DOT; |
110 | unsigned long nchar = 0; |
119 | unsigned long nchar = 0; |
111 | 120 | ||
112 | if( ( fp = fopen( filename, "rb" ) ) == NULL ) { |
121 | if( ( fp = fopen( filename, "rb" ) ) == NULL ) { |
113 | if( verbose ) fprintf( stderr, "cannot open \"%s\"\n", filename ); |
122 | if( verbose ) fprintf( stderr, "cannot open \"%s\"\n", filename ); |
114 | return -1; |
123 | return -1; |
115 | } |
124 | } |
116 | if(verbose) printf( " |
125 | if(verbose) printf( "Verbose= %d File \"%s\" opened.\n", verbose ,filename ); |
117 | 126 | ||
118 | /* ------------------------------------------------------------ *\ |
127 | /* ------------------------------------------------------------ *\ |
119 | The data for the configuration start from 0xffff_ffff_aa99_aa66 |
128 | The data for the configuration start from 0xffff_ffff_aa99_aa66 |
120 | ( cf. xapp138; we don't know the definition of the BIT file ) |
129 | ( cf. xapp138; we don't know the definition of the BIT file ) |
121 | \* ------------------------------------------------------------ */ |
130 | \* ------------------------------------------------------------ */ |
122 | dummyword = 0; |
131 | dummyword = 0; |
123 | do{ |
132 | do{ |
124 | if( (c = getc( fp )) == EOF ) { |
133 | if( (c = getc( fp )) == EOF ) { |
125 | if(verbose) fprintf(stderr, "EOF detected. Exit.\n"); |
134 | if(verbose) fprintf(stderr, "EOF detected. Exit.\n"); |
126 | return -1; |
135 | return -1; |
127 | } |
136 | } |
128 | (c == 0xff) ? dummyword++ : (dummyword=0); |
137 | (c == 0xff) ? dummyword++ : (dummyword=0); |
129 | } while( dummyword < 4 ); |
138 | } while( dummyword < 4 ); |
130 | 139 | ||
131 | // const long byte_per_dot = BYTE_PER_DOT; |
140 | // const long byte_per_dot = BYTE_PER_DOT; |
132 | // unsigned long nchar = 0; |
141 | // unsigned long nchar = 0; |
- | 142 | ||
133 | if( mode == SLAVESERIAL_MODE ) { |
143 | if( mode == SLAVESERIAL_MODE ) { |
134 | if(verbose) |
144 | if(verbose) fprintf(stderr, "slave serial mode"); |
135 | Pts_write( ADR_MODE, mode ); |
145 | Pts_write( ADR_MODE, mode ); |
136 | Pts_erase( verbose ); |
146 | Pts_erase( verbose ); |
137 | for( j=0; j<32; j++ ) Pts_write( ADR_CFG, 0x1 ); |
147 | for( j=0; j<32; j++ ) Pts_write( ADR_CFG, 0x1 ); |
- | 148 | while(!feof(fp)) |
|
- | 149 | { |
|
- | 150 | int nb = fread(&c,1,1,fp); |
|
- | 151 | if (nb<=0) continue; |
|
138 |
|
152 | //while( (c=getc(fp))!=EOF ){ |
139 | for( j=0; j<8; j++ ) Pts_write( ADR_CFG, (c>>(7-j))&0x1 ); |
153 | for( j=0; j<8; j++ ) Pts_write( ADR_CFG, (c>>(7-j))&0x1 ); |
140 | nchar++; |
154 | nchar++; |
141 | if( verbose && nchar%byte_per_dot==0 ) putchar('.'); |
155 | if( verbose && nchar%byte_per_dot==0 ) putchar('.'); |
142 | } |
156 | } |
143 | } else if( mode == SELECTMAP_MODE ) { |
157 | } else if( mode == SELECTMAP_MODE ) { |
144 | if( verbose ) |
158 | if( verbose ) fprintf(stderr, "select map mode ...."); |
- | 159 | ||
145 | Pts_write( ADR_MODE, SELECTMAP_MODE ); |
160 | Pts_write( ADR_MODE, SELECTMAP_MODE ); |
146 | Pts_erase( verbose ); |
161 | Pts_erase( verbose ); |
- | 162 | ||
- | 163 | fprintf(stderr, "-------------\n"); |
|
- | 164 | ||
- | 165 | //if( verbose ) fprintf(stderr, "program ....\n"); |
|
- | 166 | ||
- | 167 | for( j=0; j<4; j++ ) { |
|
- | 168 | fprintf(stderr, "%d ------------\n", j); |
|
147 |
|
169 | Pts_write( ADR_CFG, 0xff ); |
- | 170 | } |
|
- | 171 | fprintf(stderr, "at line %d -------------\n", __LINE__); |
|
- | 172 | VME_MWRST(); |
|
- | 173 | while(!feof(fp)) |
|
- | 174 | { |
|
- | 175 | int nb = fread(&c,1,1,fp); |
|
- | 176 | if (nb<=0) continue; |
|
148 |
|
177 | // while ( (c=getc(fp))!=EOF ){ |
- | 178 | if (feof(fp)) { |
|
- | 179 | if(verbose) fprintf(stderr, "feof detected. Exit.\n"); |
|
- | 180 | return -1; |
|
- | 181 | } |
|
149 | int cc = 0; |
182 | int cc = 0; |
150 | for(j=0; j<8; j++) cc |= ((c&(1<<j))>>j)<<(7-j); |
183 | for(j=0; j<8; j++) cc |= ((c&(1<<j))>>j)<<(7-j); |
- | 184 | //fprintf(stderr, "s"); |
|
151 |
|
185 | Pts_Mwrite( ADR_CFG, cc ); |
152 | nchar++; |
186 | nchar++; |
153 | if( verbose && nchar%byte_per_dot==0 ) |
187 | if( verbose && nchar%byte_per_dot==0 ) { |
- | 188 | fprintf(stderr, "#"); |
|
- | 189 | VME_MWEXEC(); |
|
- | 190 | VME_MWRST(); |
|
- | 191 | fprintf(stderr, "."); |
|
- | 192 | } |
|
154 | } |
193 | } |
155 | } else { |
194 | } else { |
156 | if(verbose) fprintf(stderr, "\nIllegal mode\n"); |
195 | if(verbose) fprintf(stderr, "\nIllegal mode\n"); |
157 | return -1; |
196 | return -1; |
158 | } |
197 | } |
159 | if(verbose) |
198 | if(verbose) fprintf(stderr, "\ntotal %ld bits\n", nchar); |
160 | fclose(fp); |
199 | if (fp) fclose(fp); |
161 | return Pts_check_configure( verbose ); |
200 | return Pts_check_configure( verbose ); |
162 | } |
201 | } |
163 | 202 | ||
164 | int Pts_check_configure( int verbose ) { |
203 | int Pts_check_configure( int verbose ) { |
165 | uint32_t csr1_value; |
204 | uint32_t csr1_value; |
166 | Pts_read(ADR_CSR1,&csr1_value); |
205 | Pts_read(ADR_CSR1,&csr1_value); |
167 | if(verbose) printf("CSR1(0x%02x)=0x%04x\n",ADR_CSR1,csr1_value&0xffff); |
206 | if(verbose) printf("CSR1(0x%02x)=0x%04x\n",ADR_CSR1,csr1_value&0xffff); |
168 | if(csr1_value&CSR1_DONE) { |
207 | if(csr1_value&CSR1_DONE) { |
169 | if(verbose) |
208 | if(verbose) fprintf(stderr, "configure complete.\n"); |
170 | return 1; |
209 | return 1; |
171 | } else { |
210 | } else { |
172 | if(verbose) |
211 | if(verbose) fprintf(stderr, "configure not complete.\n"); |
173 | return -1; |
212 | return -1; |
174 | } |
213 | } |
175 | } |
214 | } |
176 | 215 | ||
177 | int Pts_reset( int verbose ) { |
216 | int Pts_reset( int verbose ) { |
178 | Pts_write(ADR_CSR0,1); |
217 | Pts_write(ADR_CSR0,1); |
179 | if( verbose ) printf( "CSR0(0x%02x) = 0x01\n", ADR_CSR0 ); |
218 | if( verbose ) printf( "CSR0(0x%02x) = 0x01\n", ADR_CSR0 ); |
180 | return 1; |
219 | return 1; |
181 | } |
220 | } |
182 | 221 | ||
183 | int Pts_write_csr( int verbose, uint32_t value ) { |
222 | int Pts_write_csr( int verbose, uint32_t value ) { |
184 | Pts_write(ADR_CSR0,value); |
223 | Pts_write(ADR_CSR0,value); |
185 | if( verbose ) printf( "Pts_write_csr 0x%08x\n", value ); |
224 | if( verbose ) printf( "Pts_write_csr 0x%08x\n", value ); |
186 | return 1; |
225 | return 1; |
187 | } |
226 | } |
188 | 227 | ||
189 | 228 | ||
190 | void help(char *argv){ |
229 | void help(char *argv){ |
191 | printf("Usage: %s -a <ptsaddr> -v <verbose> -c .... Pts_check_configure\n", argv); |
230 | printf("Usage: %s -a <ptsaddr> -v <verbose> -c .... Pts_check_configure\n", argv); |
192 | printf("Usage: %s -a <ptsaddr> -v <verbose> -i <filename> -b mode (2) ... Pts_configure_bit\n", argv); |
231 | printf("Usage: %s -a <ptsaddr> -v <verbose> -i <filename> -b mode (2) ... Pts_configure_bit\n", argv); |
193 | printf("Usage: %s -a <ptsaddr> -v <verbose> -e .... Pts_erase\n", argv); |
232 | printf("Usage: %s -a <ptsaddr> -v <verbose> -e .... Pts_erase\n", argv); |
194 | printf("Usage: %s -a <ptsaddr> -v <verbose> -x .... Pts_reset\n", argv); |
233 | printf("Usage: %s -a <ptsaddr> -v <verbose> -x .... Pts_reset\n", argv); |
195 | printf("Usage: %s -a <ptsaddr> -v <verbose> -c .... Pts_check_configure\n", argv); |
234 | printf("Usage: %s -a <ptsaddr> -v <verbose> -c .... Pts_check_configure\n", argv); |
196 | printf("Usage: %s -a <ptsaddr> -v <verbose> -r .... vme read\n", argv); |
235 | printf("Usage: %s -a <ptsaddr> -v <verbose> -r .... vme read\n", argv); |
197 | printf("Usage: %s -a <ptsaddr> -v <verbose> -w <value> .... vme write\n", argv); |
236 | printf("Usage: %s -a <ptsaddr> -v <verbose> -w <value> .... vme write\n", argv); |
198 | printf("Usage: %s -a <ptsaddr> -v <verbose> -s <value> .... Pts_write_csr\n", argv); |
237 | printf("Usage: %s -a <ptsaddr> -v <verbose> -s <value> .... Pts_write_csr\n", argv); |
199 | printf("Example: %s --address 0x1000000 --verbose 1 --erase\n", argv); |
238 | printf("Example: %s --address 0x1000000 --verbose 1 --erase\n", argv); |
200 | printf("Example: %s --address 0x1000000 --verbose 1 --input pts_scaler.bit --load-bit 2\n", argv); |
239 | printf("Example: %s --address 0x1000000 --verbose 1 --input pts_scaler.bit --load-bit 2\n", argv); |
201 | printf("Example: %s --address 0x1000004 --write-csr 0x7600\n", argv); |
240 | printf("Example: %s --address 0x1000004 --write-csr 0x7600\n", argv); |
202 | } |
241 | } |
203 | 242 | ||
204 | 243 | ||
205 | 244 | ||
206 | static const char *optString = "v:rxea:cs:w:i:b:h"; |
245 | static const char *optString = "v:rxea:cs:w:i:b:h"; |
207 | static const struct option longOpts[] = { |
246 | static const struct option longOpts[] = { |
208 | { "verbose", required_argument, NULL, 'v' }, |
247 | { "verbose", required_argument, NULL, 'v' }, |
209 | { "reset" , no_argument, NULL, 'x' }, |
248 | { "reset" , no_argument, NULL, 'x' }, |
210 | { "erase" , no_argument, NULL, 'e' }, |
249 | { "erase" , no_argument, NULL, 'e' }, |
211 | { "address", required_argument, NULL, 'a' }, |
250 | { "address", required_argument, NULL, 'a' }, |
212 | { "check-configure", no_argument, NULL, 'c' }, |
251 | { "check-configure", no_argument, NULL, 'c' }, |
213 | { "write-csr", required_argument , NULL, 's' }, |
252 | { "write-csr", required_argument , NULL, 's' }, |
214 | { "input", required_argument , NULL, 'i' }, |
253 | { "input", required_argument , NULL, 'i' }, |
215 | { "load-bit", required_argument , NULL, 'b' }, |
254 | { "load-bit", required_argument , NULL, 'b' }, |
216 | { "read", no_argument , NULL, 'r' }, |
255 | { "read", no_argument , NULL, 'r' }, |
217 | { "write",required_argument , NULL, 'w' }, |
256 | { "write",required_argument , NULL, 'w' }, |
218 | { "help", no_argument, NULL, 'h' }, |
257 | { "help", no_argument, NULL, 'h' }, |
219 | { NULL, no_argument, NULL, 0 } |
258 | { NULL, no_argument, NULL, 0 } |
220 | }; |
259 | }; |
221 | 260 | ||
222 | int main (int argc, char ** argv){ |
261 | int main (int argc, char ** argv){ |
223 | 262 | ||
224 | uint32_t value; |
263 | uint32_t value; |
225 | 264 | ||
226 | int verbose=0; |
265 | int verbose=0; |
227 | char filename[256]="file.bit"; |
266 | char filename[256]="file.bit"; |
228 | int c; |
267 | int c; |
229 | opterr = 0; |
268 | opterr = 0; |
230 | int longIndex = 0; |
269 | int longIndex = 0; |
231 | 270 | ||
232 | if (argc<2) { |
271 | if (argc<2) { |
233 | help(argv[0]); |
272 | help(argv[0]); |
234 | exit(-1); |
273 | exit(-1); |
235 | } |
274 | } |
236 | 275 | ||
237 | VME_START(NULL); |
276 | VME_START(NULL); |
238 | 277 | ||
239 | c = getopt_long( argc, argv, optString, longOpts, &longIndex ); |
278 | c = getopt_long( argc, argv, optString, longOpts, &longIndex ); |
240 | while( c != -1 ) |
279 | while( c != -1 ) |
241 | 280 | ||
242 | // while ((c = getopt (argc, argv, "v:xrea:csw:i:b:h")) != -1) |
281 | // while ((c = getopt (argc, argv, "v:xrea:csw:i:b:h")) != -1) |
243 | { |
282 | { |
244 | switch (c) |
283 | switch (c) |
245 | { |
284 | { |
246 | case 'v': |
285 | case 'v': |
247 | verbose = atoi(optarg); |
286 | verbose = atoi(optarg); |
248 | break; |
287 | break; |
249 | case 'x': |
288 | case 'x': |
250 | Pts_reset(verbose); |
289 | Pts_reset(verbose); |
251 | break; // reset |
290 | break; // reset |
252 | case 'e': |
291 | case 'e': |
253 | Pts_erase(verbose); |
292 | Pts_erase(verbose); |
254 | break; // erase |
293 | break; // erase |
255 | case 'a': |
294 | case 'a': |
256 | ptaddr = strtoul (optarg,NULL,0); |
295 | ptaddr = strtoul (optarg,NULL,0); |
257 | break; // address |
296 | break; // address |
258 | case 'c': |
297 | case 'c': |
259 | Pts_check_configure( verbose ); |
298 | Pts_check_configure( verbose ); |
260 | break; |
299 | break; |
261 | case 'w': |
300 | case 'w': |
262 | value = strtoul (optarg,NULL,0); |
301 | value = strtoul (optarg,NULL,0); |
263 | Pts_write( 0 , value ); |
302 | Pts_write( 0 , value ); |
264 | break; |
303 | break; |
265 | case 'r': |
304 | case 'r': |
266 | value = 0; |
305 | value = 0; |
267 | Pts_read( 0 , &value ); |
306 | Pts_read( 0 , &value ); |
268 | break; |
307 | break; |
269 | case 's': |
308 | case 's': |
270 | value = strtoul (optarg,NULL,0); |
309 | value = strtoul (optarg,NULL,0); |
271 | Pts_write_csr( verbose, value ); |
310 | Pts_write_csr( verbose, value ); |
272 | break; |
311 | break; |
273 | case 'i': |
312 | case 'i': |
274 | sprintf(filename,"%s",optarg); |
313 | sprintf(filename,"%s",optarg); |
275 | break; // data width |
314 | break; // data width |
276 | case 'b': |
315 | case 'b': |
277 | //#define SELECTMAP_MODE 2 |
316 | //#define SELECTMAP_MODE 2 |
278 | //#define SLAVESERIAL_MODE 3 |
317 | //#define SLAVESERIAL_MODE 3 |
279 | value = strtoul (optarg,NULL,0); |
318 | value = strtoul (optarg,NULL,0); |
280 | Pts_configure_bit( filename, value, verbose ); |
319 | Pts_configure_bit( filename, value, verbose ); |
281 | break; |
320 | break; |
282 | case 'h': |
321 | case 'h': |
283 | help(argv[0]); |
322 | help(argv[0]); |
284 | break; |
323 | break; |
285 | default: |
324 | default: |
286 | printf("Unknown command %c\n",c); |
325 | printf("Unknown command %c\n",c); |
287 | } |
326 | } |
288 | c = getopt_long( argc, argv, optString, longOpts, &longIndex ); |
327 | c = getopt_long( argc, argv, optString, longOpts, &longIndex ); |
289 | } |
328 | } |
290 | VME_STOP(); |
329 | VME_STOP(); |
291 | } |
330 | } |
292 | 331 | ||
293 | 332 |