KM3NeT CLB  2.0
KM3NeT CLB v2 Embedded Software
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
shell_sfp.c
1 /*
2  * KM3NeT CLB v2 Firmware
3  * ----------------------
4  *
5  * Copyright 2013 KM3NeT Collaboration
6  *
7  * All Rights Reserved.
8  *
9  *
10  * File : shell_tests.c
11  * Created : 14 mrt. 2013
12  * Author : Vincent van Beveren
13  */
14 
15 #include <stdbool.h>
16 #include <stdio.h>
17 
18 #include <stdlib.h>
19 
20 #include "drv/wb/wrx.h"
21 #include "modules/wltune.h"
22 
23 
24 const char cmd_sfp_help[] = "SFP utils sfp [tune up|tune down]";
25 
26 // WRX_TUNE_PROC_NONE = 0,
27 // WRX_TUNE_PROC_EOPTOLINK,
28 // WRX_TUNE_PROC_OESOLUTIONS
29 
30 bool cmd_sfp_exec(int argc, const char *args[])
31 {
32 
33  if (argc >= 2) {
34  wltune_update_info();
35 
36  if (wlTuneInfo.tuneword == 65535) {
37  puts("Tune word error");
38  return false;
39  }
40 
41  if (strcmp(args[0], "tune") == 0) {
42  if (strcmp(args[1], "up") == 0) {
43  wltune_set_word(wlTuneInfo.tuneword + 1);
44  }
45  if (strcmp(args[1], "down") == 0)
46  {
47  wltune_set_word(wlTuneInfo.tuneword - 1);
48  }
49  if (strcmp(args[1], "set") == 0)
50  {
51  int32_t v = atoi(args[2]);
52  wltune_set_word(v);
53  }
54 
55  if (strcmp(args[1], "ack") == 0)
56  {
57  wltune_ack();
58  }
59  }
60  } else {
61  puts("sfp tune [cmd]");
62  puts("where cmd is:");
63  puts(" up - single dac value up");
64  puts(" down - single dac value down");
65  puts(" set [#] - set specific dac value (use with care!)");
66  puts(" ack - acknowledge dac value [otherwise will be set back]");
67  }
68  wltune_update_info();
69  wltune_show_info();
70 
71  return true;
72 }
73 
WhiteRabbit exchange exchanges information between the 2nd LM32 and WhiteRabbit though a small client...