Blame view

RIOT/sys/shell/commands/shell_commands.c 7.47 KB
a752c7ab   elopes   add first test an...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
  /*
   * Copyright (C) 2014  INRIA.
   *
   * This file is subject to the terms and conditions of the GNU Lesser
   * General Public License v2.1. See the file LICENSE in the top level
   * directory for more details.
   */
  
  /**
   * @ingroup     sys_shell_commands
   * @{
   *
   * @file
   * @brief       Provides prototypes and sets up available shell commands
   *
   * @author      Oliver Hahm <oliver.hahm@inria.fr>
   * @author      Zakaria Kasmi <zkasmi@inf.fu-berlin.de>
   * @author      Ludwig KnΓΌpfer <ludwig.knuepfer@fu-berlin.de>
   *
   * @}
   */
  
  #include <stdlib.h>
  #include "shell_commands.h"
  
  extern int _reboot_handler(int argc, char **argv);
  
  #ifdef MODULE_CONFIG
  extern int _id_handler(int argc, char **argv);
  #endif
  
  #ifdef MODULE_LPC_COMMON
  extern int _heap_handler(int argc, char **argv);
  #endif
  
  #ifdef MODULE_PS
  extern int _ps_handler(int argc, char **argv);
  #endif
  
  #ifdef MODULE_SHT11
  extern int _get_temperature_handler(int argc, char **argv);
  extern int _get_humidity_handler(int argc, char **argv);
  extern int _get_weather_handler(int argc, char **argv);
  extern int _set_offset_handler(int argc, char **argv);
  #endif
  
  #ifdef MODULE_LTC4150
  extern int _get_current_handler(int argc, char **argv);
  extern int _reset_current_handler(int argc, char **argv);
  #endif
  
  #ifdef MODULE_AT30TSE75X
  extern int _at30tse75x_handler(int argc, char **argv);
  #endif
  
  #ifdef MODULE_SAUL_REG
  extern int _saul(int argc, char **argv);
  #endif
  
  #if FEATURE_PERIPH_RTC
  extern int _rtc_handler(int argc, char **argv);
  #endif
  
  #ifdef CPU_X86
  extern int _x86_lspci(int argc, char **argv);
  #endif
  
  #ifdef MODULE_MCI
  extern int _get_sectorsize(int argc, char **argv);
  extern int _get_blocksize(int argc, char **argv);
  extern int _get_sectorcount(int argc, char **argv);
  extern int _read_sector(int argc, char **argv);
  extern int _read_bytes(int argc, char **argv);
  #endif
  
  #ifdef MODULE_GNRC_ICMPV6_ECHO
  #ifdef MODULE_XTIMER
  extern int _icmpv6_ping(int argc, char **argv);
  #endif
  #endif
  
  #ifdef MODULE_RANDOM
  extern int _random_init(int argc, char **argv);
  extern int _random_get(int argc, char **argv);
  #endif
  
  #ifdef MODULE_GNRC_IPV6_NIB
  extern int _gnrc_ipv6_nib(int argc, char **argv);
  #endif
  
  #ifdef MODULE_GNRC_NETIF
  extern int _netif_config(int argc, char **argv);
  extern int _netif_send(int argc, char **argv);
  #endif
  
  #ifdef MODULE_GNRC_NETIF2
  extern int _gnrc_netif2_config(int argc, char **argv);
  #ifdef MODULE_GNRC_TXTSND
  extern int _gnrc_netif2_send(int argc, char **argv);
  #endif
  #endif
  
  #ifdef MODULE_FIB
  extern int _fib_route_handler(int argc, char **argv);
  #endif
  
  #ifdef MODULE_GNRC_IPV6_NC
  extern int _ipv6_nc_manage(int argc, char **argv);
  extern int _ipv6_nc_routers(int argc, char **argv);
  #endif
  
  #ifdef MODULE_GNRC_IPV6_WHITELIST
  extern int _whitelist(int argc, char **argv);
  #endif
  
  #ifdef MODULE_GNRC_IPV6_BLACKLIST
  extern int _blacklist(int argc, char **argv);
  #endif
  
  #ifdef MODULE_GNRC_RPL
  extern int _gnrc_rpl(int argc, char **argv);
  #endif
  
  #ifdef MODULE_GNRC_SIXLOWPAN_CTX
  #ifdef MODULE_GNRC_SIXLOWPAN_ND_BORDER_ROUTER
  extern int _gnrc_6ctx(int argc, char **argv);
  #endif
  #endif
  
  #ifdef MODULE_CCN_LITE_UTILS
  extern int _ccnl_open(int argc, char **argv);
  extern int _ccnl_content(int argc, char **argv);
  extern int _ccnl_interest(int argc, char **argv);
  extern int _ccnl_fib(int argc, char **argv);
  #endif
  
  #ifdef MODULE_SNTP
  extern int _ntpdate(int argc, char **argv);
  #endif
  
  #ifdef MODULE_VFS
  extern int _vfs_handler(int argc, char **argv);
  extern int _ls_handler(int argc, char **argv);
  #endif
  
  #ifdef MODULE_CONN_CAN
  extern int _can_handler(int argc, char **argv);
  #endif
  
  const shell_command_t _shell_command_list[] = {
      {"reboot", "Reboot the node", _reboot_handler},
  #ifdef MODULE_CONFIG
      {"id", "Gets or sets the node's id.", _id_handler},
  #endif
  #ifdef MODULE_LPC_COMMON
      {"heap", "Shows the heap state for the LPC2387 on the command shell.", _heap_handler},
  #endif
  #ifdef MODULE_PS
      {"ps", "Prints information about running threads.", _ps_handler},
  #endif
  #ifdef MODULE_SHT11
      {"temp", "Prints measured temperature.", _get_temperature_handler},
      {"hum", "Prints measured humidity.", _get_humidity_handler},
      {"weather", "Prints measured humidity and temperature.", _get_weather_handler},
      {"offset", "Set temperature offset.", _set_offset_handler},
  #endif
  #ifdef MODULE_LTC4150
      {"cur", "Prints current and average power consumption.", _get_current_handler},
      {"rstcur", "Resets coulomb counter.", _reset_current_handler},
  #endif
  #ifdef MODULE_AT30TSE75X
      {"at30tse75x", "Test AT30TSE75X temperature sensor", _at30tse75x_handler},
  #endif
  #ifdef MODULE_MCI
      {DISK_READ_SECTOR_CMD, "Reads the specified sector of inserted memory card", _read_sector},
      {DISK_READ_BYTES_CMD, "Reads the specified bytes from inserted memory card", _read_bytes},
      {DISK_GET_SECTOR_SIZE, "Get the sector size of inserted memory card", _get_sectorsize},
      {DISK_GET_SECTOR_COUNT, "Get the sector count of inserted memory card", _get_sectorcount},
      {DISK_GET_BLOCK_SIZE, "Get the block size of inserted memory card", _get_blocksize},
  #endif
  #ifdef MODULE_GNRC_ICMPV6_ECHO
  #ifdef MODULE_XTIMER
      { "ping6", "Ping via ICMPv6", _icmpv6_ping },
  #endif
  #endif
  #ifdef MODULE_RANDOM
      { "random_init", "initializes the PRNG", _random_init },
      { "random_get", "returns 32 bit of pseudo randomness", _random_get },
  #endif
  #if FEATURE_PERIPH_RTC
      {"rtc", "control RTC peripheral interface",  _rtc_handler},
  #endif
  #ifdef CPU_X86
      {"lspci", "Lists PCI devices", _x86_lspci},
  #endif
  #ifdef MODULE_GNRC_IPV6_NIB
      {"nib", "Configure neighbor information base", _gnrc_ipv6_nib},
  #endif
  #if defined(MODULE_GNRC_NETIF) && !defined(MODULE_GNRC_NETIF2)
      {"ifconfig", "Configure network interfaces", _netif_config},
  #ifdef MODULE_GNRC_TXTSND
      {"txtsnd", "Sends a custom string as is over the link layer", _netif_send },
  #endif
  #endif
  #ifdef MODULE_GNRC_NETIF2
      {"ifconfig", "Configure network interfaces", _gnrc_netif2_config},
  #ifdef MODULE_GNRC_TXTSND
      {"txtsnd", "Sends a custom string as is over the link layer", _gnrc_netif2_send },
  #endif
  #endif
  #ifdef MODULE_FIB
      {"fibroute", "Manipulate the FIB (info: 'fibroute [add|del]')", _fib_route_handler},
  #endif
  #ifdef MODULE_GNRC_IPV6_NC
      {"ncache", "manage neighbor cache by hand", _ipv6_nc_manage },
      {"routers", "IPv6 default router list", _ipv6_nc_routers },
  #endif
  #ifdef MODULE_GNRC_IPV6_WHITELIST
      {"whitelist", "whitelists an address for receival ('whitelist [add|del|help]')", _whitelist },
  #endif
  #ifdef MODULE_GNRC_IPV6_BLACKLIST
      {"blacklist", "blacklists an address for receival ('blacklist [add|del|help]')", _blacklist },
  #endif
  #ifdef MODULE_GNRC_RPL
      {"rpl", "rpl configuration tool ('rpl help' for more information)", _gnrc_rpl },
  #endif
  #ifdef MODULE_GNRC_SIXLOWPAN_CTX
  #ifdef MODULE_GNRC_SIXLOWPAN_ND_BORDER_ROUTER
      {"6ctx", "6LoWPAN context configuration tool", _gnrc_6ctx },
  #endif
  #endif
  #ifdef MODULE_SAUL_REG
      {"saul", "interact with sensors and actuators using SAUL", _saul },
  #endif
  #ifdef MODULE_CCN_LITE_UTILS
      { "ccnl_open", "opens an interface or socket", _ccnl_open },
      { "ccnl_int", "sends an interest", _ccnl_interest },
      { "ccnl_cont", "create content and populated it", _ccnl_content },
      { "ccnl_fib", "shows or modifies the CCN-Lite FIB", _ccnl_fib },
  #endif
  #ifdef MODULE_SNTP
      { "ntpdate", "synchronizes with a remote time server", _ntpdate },
  #endif
  #ifdef MODULE_VFS
      {"vfs", "virtual file system operations", _vfs_handler},
      {"ls", "list files", _ls_handler},
  #endif
  #ifdef MODULE_CONN_CAN
      {"can", "CAN commands", _can_handler},
  #endif
      {NULL, NULL, NULL}
  };