]> rtime.felk.cvut.cz Git - fpga/lx-cpu1/lx-rocon.git/blob - sw/app/rocon/appl_tests.c
RoCoN: USB CDC ACM target for command processor implemented.
[fpga/lx-cpu1/lx-rocon.git] / sw / app / rocon / appl_tests.c
1 #include <system_def.h>
2 #include <stdio.h>
3 #include <unistd.h>
4 #include <string.h>
5 #include <ctype.h>
6 #include <stddef.h>
7 #include <malloc.h>
8 #include <utils.h>
9 #include <cmd_proc.h>
10 #include <hal_gpio.h>
11 #include <hal_machperiph.h>
12 #include <LPC17xx.h>
13 #include <lpcTIM.h>
14 #include <spi_drv.h>
15 #include <pxmc.h>
16 #include <inttypes.h>
17
18 #include <ul_log.h>
19 #include <ul_logreg.h>
20
21 #include "appl_defs.h"
22 #include "appl_fpga.h"
23 #include "appl_pxmc.h"
24 #include "pxmcc_types.h"
25 #include "pxmcc_interface.h"
26
27 #ifdef CONFIG_OC_MTD_DRV_SYSLESS
28 #include <mtd_spi_drv.h>
29 #endif
30
31 int cmd_do_test_memusage(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
32 {
33   void *maxaddr;
34   char str[40];
35
36   maxaddr = sbrk(0);
37
38   snprintf(str, sizeof(str), "memusage maxaddr 0x%08lx\n", (unsigned long)maxaddr);
39   cmd_io_write(cmd_io, str, strlen(str));
40
41   return 0;
42 }
43
44 int cmd_do_test_adc(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
45 {
46   printf("ADC: %ld %ld %ld %ld %ld\n", (LPC_ADC->DR[0] & 0xFFF0) >> 4,
47          (LPC_ADC->DR[1] & 0xFFF0) >> 4,
48          (LPC_ADC->DR[2] & 0xFFF0) >> 4,
49          (LPC_ADC->DR[3] & 0xFFF0) >> 4,
50          (LPC_ADC->DR[7] & 0xFFF0) >> 4);
51   return 0;
52 }
53
54 #ifdef APPL_WITH_DISTORE_EEPROM_USER
55 int cmd_do_test_distore(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
56 {
57   appl_distore_user_set_check4change();
58   return 0;
59 }
60
61 int cmd_do_test_diload(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
62 {
63   appl_distore_user_restore();
64   return 0;
65 }
66 #endif /*APPL_WITH_DISTORE_EEPROM_USER*/
67
68 int cmd_do_test_loglevel_cb(ul_log_domain_t *domain, void *context)
69 {
70   char s[30];
71   cmd_io_t *cmd_io = (cmd_io_t *)context;
72
73   s[sizeof(s) - 1] = 0;
74   snprintf(s, sizeof(s) - 1, "%s (%d)\n\r", domain->name, domain->level);
75   cmd_io_puts(cmd_io, s);
76   return 0;
77 }
78
79 int cmd_do_test_loglevel(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
80 {
81   int res = 0;
82   char *line;
83   line = param[1];
84
85   if (!line || (si_skspace(&line), !*line))
86   {
87     ul_logreg_for_each_domain(cmd_do_test_loglevel_cb, cmd_io);
88   }
89   else
90   {
91     res = ul_log_domain_arg2levels(line);
92   }
93
94   return res >= 0 ? 0 : CMDERR_BADPAR;
95 }
96
97 int cmd_do_spimst_blocking(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
98 {
99   int res;
100   int opchar;
101   char *p = param[3];
102   int spi_chan = (int)(intptr_t)des->info[0];
103   uint8_t *tx_buff = NULL;
104   uint8_t *rx_buff = NULL;
105   long addr = 0;
106   int len = 0;
107   spi_drv_t *spi_drv;
108
109   if ((opchar = cmd_opchar_check(cmd_io, des, param)) < 0)
110     return opchar;
111
112   if (opchar != ':')
113     return -CMDERR_OPCHAR;
114
115   if (spi_chan == -1)
116     spi_chan = *param[1] - '0';
117
118   spi_drv = spi_find_drv(NULL, spi_chan);
119
120   if (spi_drv == NULL)
121     return -CMDERR_BADSUF;
122
123   p = param[3];
124
125   si_skspace(&p);
126
127   if (isdigit((int)*p))
128   {
129     if (si_long(&p, &addr, 16) < 0)
130       return -CMDERR_BADPAR;
131   }
132
133   if (si_fndsep(&p, "({") < 0)
134     return -CMDERR_BADSEP;
135
136   if ((res = si_add_to_arr(&p, (void **)&tx_buff, &len, 16, 1, "})")) < 0)
137     return -CMDERR_BADPAR;
138
139   rx_buff = malloc(len);
140
141   res = -1;
142
143   if (rx_buff != NULL)
144     res = spi_transfer(spi_drv, addr, len, tx_buff, rx_buff);
145
146   if (res < 0)
147   {
148     printf("SPI! %02lX ERROR\n", addr);
149   }
150   else
151   {
152     int i;
153     printf("SPI! %02lX ", addr);
154     printf("TX(");
155
156     for (i = 0; i < len; i++)
157       printf("%s%02X", i ? "," : "", tx_buff[i]);
158
159     printf(") RX(");
160
161     for (i = 0; i < len; i++)
162       printf("%s%02X", i ? "," : "", rx_buff[i]);
163
164     printf(")");
165     printf("\n");
166     return 0;
167   }
168
169   if (rx_buff)
170     free(rx_buff);
171
172   if (tx_buff)
173     free(tx_buff);
174
175   return 0;
176 }
177
178 int cmd_do_mtdspitest(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
179 {
180   int res;
181   unsigned char id_buff[3];
182
183   res = mtd_spi_read_jedec_id(&mtd_spi_state, id_buff, 3);
184   if (res < 0) {
185     printf("mtd_spi_read_jedec_id returned %d\n", res);
186     return -1;
187   }
188
189   printf("mtd_spi_read_jedec_id 0x%02x 0x%02x 0x%02x \n",
190          id_buff[0], id_buff[1], id_buff[2]);
191
192   res = mtd_spi_set_protect_mode(&mtd_spi_state, 0, 0);
193   if (res < 0) {
194     printf("mtd_spi_set_protect_mode returned %d\n", res);
195     return -1;
196   }
197
198   return 0;
199 }
200
201 #ifdef SDRAM_BASE
202 int sdram_access_test(void)
203 {
204   unsigned int *ptr;
205   unsigned int pattern;
206   size_t ramsz = SDRAM_SIZE;
207   size_t cnt;
208   lt_mstime_t tic;
209   size_t blksz, i;
210
211   lt_mstime_update();
212   tic = actual_msec;
213
214   pattern = 0x12abcdef;
215
216   for (cnt = ramsz / sizeof(*ptr), ptr = (typeof(ptr))SDRAM_BASE; cnt--;)
217   {
218     *(ptr++) = pattern;
219     pattern = pattern + 0x87654321;
220   }
221
222   lt_mstime_update();
223   printf("SDRAM write %d ms\n", (int)(lt_msdiff_t)(actual_msec - tic));
224
225   lt_mstime_update();
226   tic = actual_msec;
227
228   pattern = 0x12abcdef;
229
230   for (cnt = ramsz / sizeof(*ptr), ptr = (typeof(ptr))SDRAM_BASE; cnt--;)
231   {
232     if (*ptr != pattern)
233     {
234       printf("SDRAM error modify at %p (%08x)\n", ptr, *ptr ^ pattern);
235       return -1;
236     }
237
238     *(ptr++) = ~pattern;
239     pattern = pattern + 0x87654321;
240   }
241
242   lt_mstime_update();
243   printf("SDRAM modify %d ms\n", (int)(lt_msdiff_t)(actual_msec - tic));
244
245   lt_mstime_update();
246   tic = actual_msec;
247
248   pattern = 0x12abcdef;
249
250   for (cnt = ramsz / sizeof(*ptr), ptr = (typeof(ptr))SDRAM_BASE; cnt--;)
251   {
252     if (*(ptr++) != ~pattern)
253     {
254       printf("SDRAM error read at %p (%08x)\n", ptr, *ptr ^ pattern);
255       return -1;
256     }
257
258     pattern = pattern + 0x87654321;
259   }
260
261   lt_mstime_update();
262   printf("SDRAM read %d ms\n", (int)(lt_msdiff_t)(actual_msec - tic));
263
264   lt_mstime_update();
265   tic = actual_msec;
266
267   pattern = 0;
268
269   for (cnt = ramsz / sizeof(*ptr), ptr = (typeof(ptr))SDRAM_BASE; cnt--;)
270   {
271     pattern += *(ptr++);
272   }
273
274   lt_mstime_update();
275   printf("SDRAM sum %d ms res 0x%08x\n", (int)(lt_msdiff_t)(actual_msec - tic), pattern);
276
277   for (blksz = 1; blksz < 256 ; blksz *= 2)
278   {
279     lt_mstime_update();
280     tic = actual_msec;
281
282     pattern = 0;
283
284     for (cnt = ramsz / sizeof(*ptr); cnt; cnt -= blksz)
285     {
286       ptr = (typeof(ptr))SDRAM_BASE;
287
288       //ptr = (typeof(ptr))cmd_do_test_memusage;
289       //ptr = (typeof(ptr))&ptr;
290       for (i = blksz; i--;)
291         pattern += *(ptr++);
292     }
293
294     lt_mstime_update();
295     printf("SDRAM sum %d blksz %d ms res 0x%08x\n", (int)(lt_msdiff_t)(actual_msec - tic), (int)blksz, pattern);
296   }
297
298   return 0;
299 }
300
301 int cmd_do_testsdram(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
302 {
303   sdram_access_test();
304   return 0;
305 }
306 #endif /*SDRAM_BASE*/
307
308 int cmd_do_testlxpwrrx(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
309 {
310   char *ps = param[1];
311   long mode = 0;
312   uint32_t *ptr;
313
314   if (ps != NULL) {
315     si_skspace(&ps);
316     if (*ps) {
317       if (si_ulong(&ps, &mode, 0) < 0)
318         return -CMDERR_BADPAR;
319     }
320   }
321   pxmc_rocon_rx_data_hist_buff = NULL;
322   pxmc_rocon_rx_data_hist_mode = mode;
323
324  #ifndef PXMC_ROCON_TIMED_BY_RX_DONE
325   pxmc_rocon_rx_done_isr_setup(pxmc_rocon_rx_done_isr);
326  #endif /*PXMC_ROCON_TIMED_BY_RX_DONE*/
327   pxmc_rocon_rx_data_hist_buff_end = (void *)(FPGA_CONFIGURATION_FILE_ADDRESS +
328                                          0x80000);
329   ptr = (void *)FPGA_CONFIGURATION_FILE_ADDRESS;
330   if (mode != 0) {
331     *(ptr++) = '10XL';
332     *(ptr++) = mode;
333   }
334   pxmc_rocon_rx_data_hist_buff = (void *)ptr;
335   return 0;
336 }
337
338 int cmd_do_testlxpwrstat(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
339 {
340   printf("lxpwrrx period %ld latency %ld max %ld\n",
341          (long)pxmc_rocon_rx_cycle_time, (long)pxmc_rocon_rx_irq_latency,
342          (long)pxmc_rocon_rx_irq_latency_max);
343   return 0;
344 }
345
346 #include <math.h>
347
348 int cmd_do_testfncapprox(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
349 {
350   char *ps = param[1];
351   unsigned long fnc;
352   unsigned long val;
353   unsigned long res;
354   long diff;
355   long diff_max = 0;
356   unsigned int  xb;
357   uint32_t x;
358   uint32_t xl;
359   double   xf;
360   int64_t  yl;
361   long count = 1;
362   long step = 1 << (30-7-18+1  +4);
363
364   si_skspace(&ps);
365   if (si_ulong(&ps, &fnc, 0) < 0)
366       return -CMDERR_BADPAR;
367
368   si_skspace(&ps);
369   if (!strcmp(ps, "all")) {
370     val = 0;
371     count = 0x80000000UL / step;
372     if (fnc == 1) {
373       val = 1;
374     }
375   } else {
376     if (si_ulong(&ps, &val, 0) < 0)
377         return -CMDERR_BADPAR;
378   }
379
380   for (; count--;  val += step) {
381
382     if (fnc == 1) {
383       x = val;
384       xb = __builtin_clz(x);
385       xl = x << xb;
386     } else {
387       xl = val;
388     }
389
390     fpga_fncapprox_base[fnc] = xl;
391
392     /* dummy read to provide time to function aproximator to proceed computation */
393     res = fpga_fncapprox_base[fnc];
394     res = fpga_fncapprox_base[fnc];
395
396     switch (fnc) {
397       case 0:
398         yl = xl;
399       case 1:
400         yl = (1LL << 62) / xl;
401         break;
402       case 2:
403         xf = (double)xl * M_PI / 2.0 / (1UL << 30);
404         yl = round(sin(xf) * (1UL << 16));
405         break;
406       case 3:
407         xf = (double)xl * M_PI / 2.0 / (1UL << 30);
408         yl = round(cos(xf) * (1UL << 16));
409         break;
410       default:
411       yl = 0;
412     }
413
414     diff = yl - res;
415
416     if ((diff > 0) && (diff > diff_max))
417       diff_max = diff;
418     else if ((diff < 0) && (-diff > diff_max))
419       diff_max = -diff;
420
421   }
422
423   val -= step;
424
425   printf("fnc=%ld val=0x%08lx res=0x%08lx ref=0x%08lx diff=%ld max %ld\n",
426          fnc, val, res, (unsigned long)yl, diff, diff_max);
427
428   return 0;
429 }
430
431 int cmd_do_testtumblefw(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
432 {
433   char *ps = param[1];
434   long pwm_d;
435   long pwm_q;
436   pxmc_state_t *mcs = pxmc_main_list.pxml_arr[0];
437   volatile pxmcc_data_t *mcc_data = pxmc_rocon_mcc_data();
438
439   pxmcc_axis_enable(mcs, 0);
440
441   si_skspace(&ps);
442   if (si_long(&ps, &pwm_d, 0) < 0)
443       return -CMDERR_BADPAR;
444
445   si_skspace(&ps);
446   if (si_ulong(&ps, &pwm_q, 0) < 0)
447         return -CMDERR_BADPAR;
448
449
450   if (0) {
451     pxmcc_axis_setup(mcs, PXMCC_MODE_BLDC);
452   }
453   pxmc_clear_flags(mcs,PXMS_ENO_m|PXMS_ENG_m|PXMS_ENR_m|PXMS_BSY_m);
454   pxmcc_axis_pwm_dq_out(mcs, pwm_d, pwm_q);
455   pxmcc_axis_enable(mcs, 1);
456
457   if (0) {
458     mcc_data->axis[1].inp_info = 0;
459     mcc_data->axis[1].out_info = 3;
460     mcc_data->axis[1].pwmtx_info = (12 << 0) | (13 << 8) | (14 << 16);
461     mcc_data->axis[1].mode = PXMCC_MODE_BLDC;
462     mcc_data->axis[1].ccflg = 1;
463     mcc_data->axis[2].inp_info = 0;
464     mcc_data->axis[2].out_info = 6;
465     mcc_data->axis[2].pwmtx_info = (15 << 0) | (16 << 8) | (18 << 16);
466     mcc_data->axis[2].mode = PXMCC_MODE_BLDC;
467     mcc_data->axis[2].ccflg = 1;
468     mcc_data->axis[3].inp_info = 0;
469     mcc_data->axis[3].out_info = 9;
470     mcc_data->axis[3].pwmtx_info = (19 << 0) | (20 << 8) | (21 << 16);
471     mcc_data->axis[3].mode = PXMCC_MODE_BLDC;
472     mcc_data->axis[3].ccflg = 1;
473   }
474
475   printf("spd %ld act_idle %"PRIu32" min_idle %"PRIu32" avail %lu pwm_cycle %"PRIu32"\n",
476          mcs->pxms_as, mcc_data->common.act_idle, mcc_data->common.min_idle,
477          (mcc_data->common.pwm_cycle + 6) / 6, mcc_data->common.pwm_cycle);
478   mcc_data->common.min_idle = 0x7fff;
479
480   return 0;
481 }
482
483 #define CK_IRC_WORDS 16
484 #define CK_TX_WORDS  16
485 #define CK_RX_WORDS  16
486
487 #define CK_IRC_START ((uint32_t*)fpga_irc[0])
488 #define CK_TX_START  (fpga_lx_master_transmitter_base+9)
489 #define CK_RX_START  (fpga_lx_master_receiver_base+44)
490
491 typedef struct ck_state_t {
492   uint32_t ck_irc_base[CK_IRC_WORDS];
493   uint32_t ck_irc_read[CK_IRC_WORDS];
494   uint32_t ck_tx_base[CK_TX_WORDS];
495   uint32_t ck_tx_read[CK_TX_WORDS];
496   uint32_t ck_rx_base[CK_RX_WORDS];
497   uint32_t ck_rx_read[CK_RX_WORDS];
498
499   uint32_t ck_irc_err;
500   uint32_t ck_tx_err;
501   uint32_t ck_rx_err;
502 } ck_state_t;
503
504 int cmd_do_testtumblebus(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
505 {
506   int i;
507   int cycles = 10000;
508   static ck_state_t *ckst = NULL;
509   if (ckst == NULL)
510     ckst = malloc(sizeof(*ckst));
511   if (ckst == NULL)
512     return 1;
513
514   ckst->ck_irc_err = 0;
515   ckst->ck_tx_err = 0;
516   ckst->ck_rx_err = 0;
517
518   for (i = 0; i < CK_IRC_WORDS; i++)
519     ckst->ck_irc_base[i] = CK_IRC_START[i];
520
521   for (i = 0; i < CK_TX_WORDS; i++)
522     ckst->ck_tx_base[i] = CK_TX_START[i];
523
524   for (i = 0; i < CK_RX_WORDS; i++)
525     ckst->ck_rx_base[i] = CK_RX_START[i];
526
527   while (cycles--) {
528     if (!ckst->ck_irc_err) {
529       for (i = 0; i < CK_IRC_WORDS; i++)
530         ckst->ck_irc_read[i] = CK_IRC_START[i];
531       for (i = 0; i < CK_IRC_WORDS; i++)
532         if (ckst->ck_irc_read[i] != ckst->ck_irc_base[i]) {
533           ckst->ck_irc_err++;
534           printf("irc+%x %08"PRIx32" != %08"PRIx32"\n",
535                  i, ckst->ck_irc_read[i], ckst->ck_irc_base[i]);
536         }
537     }
538
539     if (!ckst->ck_tx_err) {
540       for (i = 0; i < CK_TX_WORDS; i++)
541         ckst->ck_tx_read[i] = CK_TX_START[i];
542       for (i = 0; i < CK_TX_WORDS; i++)
543         if (ckst->ck_tx_read[i] != ckst->ck_tx_base[i]) {
544           ckst->ck_tx_err++;
545           printf("tx+%x %08"PRIx32" != %08"PRIx32"\n",
546                  i, ckst->ck_tx_read[i], ckst->ck_tx_base[i]);
547         }
548     }
549
550     if (!ckst->ck_rx_err) {
551       for (i = 0; i < CK_RX_WORDS; i++)
552         ckst->ck_rx_read[i] = CK_RX_START[i];
553       for (i = 0; i < CK_RX_WORDS; i++)
554         if (ckst->ck_rx_read[i] != ckst->ck_rx_base[i]) {
555           ckst->ck_rx_err++;
556           printf("rx+%x %08"PRIx32" != %08"PRIx32"\n",
557                  i, ckst->ck_rx_read[i], ckst->ck_rx_base[i]);
558         }
559     }
560   }
561
562   return 0;
563 }
564
565 int cmd_do_testcuradc(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
566 {
567   char *ps = param[1];
568   long pwm_chan_a;
569   long pwm_chan_b;
570   long pwm_b = 0;
571   pxmc_state_t *mcs;
572   volatile pxmcc_data_t *mcc_data = pxmc_rocon_mcc_data();
573   int i;
574   long cur_a;
575   long cur_b;
576   long pwm_cycle = mcc_data->common.pwm_cycle;
577
578   si_skspace(&ps);
579   if (si_long(&ps, &pwm_chan_a, 0) < 0)
580       return -CMDERR_BADPAR;
581
582   si_skspace(&ps);
583   if (si_ulong(&ps, &pwm_chan_b, 0) < 0)
584         return -CMDERR_BADPAR;
585
586   if (pwm_chan_a >= PXMCC_CURADC_CHANNELS)
587     return -CMDERR_BADPAR;
588
589   if (pwm_chan_b >= PXMCC_CURADC_CHANNELS)
590     return -CMDERR_BADPAR;
591
592   si_skspace(&ps);
593   if (*ps) {
594     if (si_ulong(&ps, &pwm_b, 0) < 0)
595           return -CMDERR_BADPAR;
596     pxmc_for_each_mcs(i, mcs) {
597       /* PXMS_ENI_m - check if input (IRC) update is enabled */
598       if (mcs->pxms_flg & (PXMS_ENR_m | PXMS_ENO_m)) {
599         pxmc_axis_release(mcs);
600       }
601     }
602
603     for (i = 0; i < 16; i++) {
604       if (i == pwm_chan_a) {
605         if (pxmc_rocon_pwm_direct_wr(i, 0, 1) < 0)
606           return -CMDERR_EIO;
607       } else if (i == pwm_chan_b) {
608         if (pxmc_rocon_pwm_direct_wr(i, pwm_b, 1) < 0)
609           return -CMDERR_EIO;
610       } else {
611         pxmc_rocon_pwm_direct_wr(i, 0, 0);
612       }
613     }
614   }
615
616   cur_a = mcc_data->curadc[pwm_chan_a].cur_val;
617   cur_b = mcc_data->curadc[pwm_chan_b].cur_val;
618   if (pwm_b < pwm_cycle)
619     cur_b = (pwm_cycle * cur_b + pwm_cycle / 2) / (pwm_cycle - pwm_b);
620
621   printf("ch %2ld pwm %5ld cur %7ld\n", pwm_chan_a, 0l, cur_a);
622   printf("ch %2ld pwm %5ld cur %7ld\n", pwm_chan_b, pwm_b, cur_b);
623
624   return 0;
625 }
626
627 int cmd_do_curadc(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
628 {
629   int chan;
630   volatile pxmcc_data_t *mcc_data = pxmc_rocon_mcc_data();
631   volatile pxmcc_curadc_data_t *curadc;
632   int subcmd = (int)des->info[0];
633
634   for (chan = 0; chan < PXMCC_CURADC_CHANNELS; chan++) {
635     curadc = mcc_data->curadc + chan;
636     switch (subcmd) {
637       case 0:
638         printf("%s%ld", chan?",":"", (long)curadc->cur_val);
639         break;
640       case 1:
641         printf("%s%ld", chan?",":"", (long)curadc->siroladc_offs);
642         break;
643       case 2:
644         curadc->siroladc_offs += curadc->cur_val;
645         break;
646     }
647   }
648
649   if (subcmd < 2)
650     printf("\n");
651
652   return 0;
653 }
654
655 cmd_des_t const cmd_des_test_memusage = {0, 0,
656                 "memusage", "report memory usage", cmd_do_test_memusage,
657 {
658   0,
659   0
660 }
661                                         };
662
663 cmd_des_t const cmd_des_test_adc = {0, 0,
664                                     "testadc", "adc test", cmd_do_test_adc,
665 {
666   0,
667   0
668 }
669                                    };
670
671 #ifdef APPL_WITH_DISTORE_EEPROM_USER
672 cmd_des_t const cmd_des_test_distore = {0, 0,
673                                         "testdistore", "test DINFO store", cmd_do_test_distore,
674 {
675   0,
676   0
677 }
678                                        };
679
680 cmd_des_t const cmd_des_test_diload = {0, 0,
681                                        "testdiload", "test DINFO load", cmd_do_test_diload,
682 {
683   0,
684   0
685 }
686                                       };
687 #endif /*APPL_WITH_DISTORE_EEPROM_USER*/
688
689 cmd_des_t const cmd_des_test_loglevel = {0, 0,
690                 "loglevel", "select logging level",
691                 cmd_do_test_loglevel, {}
692                                         };
693
694 cmd_des_t const cmd_des_spimst = {0, CDESM_OPCHR | CDESM_WR,
695                                   "SPIMST", "SPI master communication request",
696                                   cmd_do_spimst_blocking, {(void *)0}
697                                  };
698
699 cmd_des_t const cmd_des_spimstx = {0, CDESM_OPCHR | CDESM_WR,
700                                    "SPIMST#", "SPI# master communication request",
701                                    cmd_do_spimst_blocking, {(void *) - 1}
702                                   };
703
704 cmd_des_t const cmd_des_mtdspitest = {0, 0,
705                                    "mtdspitest", "test SPI connected Flash",
706                                    cmd_do_mtdspitest, {(void *) - 1}
707                                   };
708
709 #ifdef SDRAM_BASE
710 cmd_des_t const cmd_des_testsdram = {0, 0,
711                                      "testsdram", "test SDRAM",
712                                      cmd_do_testsdram, {(void *)0}
713                                     };
714 #endif /*SDRAM_BASE*/
715
716
717 cmd_des_t const cmd_des_testlxpwrrx = {0, 0,
718                                      "testlxpwrrx", "capture data stream from lxpwr",
719                                      cmd_do_testlxpwrrx, {(void *)0}
720                                     };
721
722 cmd_des_t const cmd_des_testlxpwrstat = {0, 0,
723                                      "testlxpwrstat", "lxpwr interrupt statistic",
724                                      cmd_do_testlxpwrstat, {(void *)0}
725                                     };
726
727 cmd_des_t const cmd_des_testfncapprox = {0, 0,
728                                      "testfncapprox", "test of function approximator",
729                                      cmd_do_testfncapprox, {(void *)0}
730                                     };
731
732 cmd_des_t const cmd_des_testtumblefw = {0, 0,
733                                      "testtumblefw", "test Tumble coprocesor firmware",
734                                      cmd_do_testtumblefw, {(void *)0}
735                                     };
736
737 cmd_des_t const cmd_des_testtumblebus = {0, 0,
738                                      "testtumblebus", "test Tumble coprocesor bus",
739                                      cmd_do_testtumblebus, {(void *)0}
740                                     };
741
742 cmd_des_t const cmd_des_testcuradc = {0, 0,
743                                      "testcuradc", "test current adc channel calibration",
744                                      cmd_do_testcuradc, {(void *)0}
745                                     };
746
747 cmd_des_t const cmd_des_showcuradc = {0, 0,
748                                      "showcuradc", "print current ADC offsets",
749                                      cmd_do_curadc, {(void *)0}
750                                     };
751
752 cmd_des_t const cmd_des_showcuradcoffs = {0, 0,
753                                      "showcuradcoffs", "print current ADC offsets",
754                                      cmd_do_curadc, {(void *)1}
755                                     };
756
757 cmd_des_t const cmd_des_calcuradcoffs = {0, 0,
758                                      "calcuradcoffs", "calibrate current ADC offsets",
759                                      cmd_do_curadc, {(void *)2}
760                                     };
761
762 cmd_des_t const *const cmd_appl_tests[] =
763 {
764   &cmd_des_test_memusage,
765   &cmd_des_test_adc,
766 #ifdef APPL_WITH_DISTORE_EEPROM_USER
767   &cmd_des_test_distore,
768   &cmd_des_test_diload,
769 #endif /*APPL_WITH_DISTORE_EEPROM_USER*/
770   &cmd_des_test_loglevel,
771   &cmd_des_spimst,
772   &cmd_des_spimstx,
773   &cmd_des_mtdspitest,
774 #ifdef SDRAM_BASE
775   &cmd_des_testsdram,
776 #endif /*SDRAM_BASE*/
777   &cmd_des_testlxpwrrx,
778   &cmd_des_testlxpwrstat,
779   &cmd_des_testfncapprox,
780   &cmd_des_testtumblefw,
781   &cmd_des_testtumblebus,
782   &cmd_des_testcuradc,
783   &cmd_des_showcuradc,
784   &cmd_des_showcuradcoffs,
785   &cmd_des_calcuradcoffs,
786   NULL
787 };