2013-06-22 05:11:53 +02:00
|
|
|
/**
|
|
|
|
* Provides prototypes for available shell commands
|
|
|
|
*
|
2014-02-14 17:17:25 +01:00
|
|
|
* Copyright (C) 2014 INRIA.
|
2013-06-22 05:11:53 +02:00
|
|
|
*
|
2014-07-31 20:15:03 +02:00
|
|
|
* 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.
|
2013-09-05 12:31:07 +02:00
|
|
|
*
|
2013-08-06 16:36:37 +02:00
|
|
|
*
|
2013-06-22 05:11:53 +02:00
|
|
|
*
|
|
|
|
* @ingroup shell_commands
|
|
|
|
* @{
|
|
|
|
* @file shell_commands.c
|
|
|
|
* @brief sets up the system shell command struct
|
|
|
|
* @author Oliver Hahm <oliver.hahm@inria.fr>
|
2013-06-27 16:16:57 +02:00
|
|
|
* @author Zakaria Kasmi <zkasmi@inf.fu-berlin.de>
|
2014-01-31 09:45:01 +01:00
|
|
|
* @author Ludwig Ortmann <ludwig.ortmann@fu-berlin.de>
|
2013-09-05 12:31:07 +02:00
|
|
|
*
|
2013-09-05 12:41:43 +02:00
|
|
|
* @note $Id: shell_commands.c 3855 2013-09-05 12:54:57 kasmi $
|
2013-06-22 05:11:53 +02:00
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
|
2010-11-04 14:24:31 +01:00
|
|
|
#include <stdlib.h>
|
2013-12-16 17:54:58 +01:00
|
|
|
#include "shell_commands.h"
|
2010-10-01 15:24:43 +02:00
|
|
|
|
2014-02-21 19:10:24 +01:00
|
|
|
extern void _reboot_handler(int argc, char **argv);
|
2014-02-25 10:07:41 +01:00
|
|
|
|
|
|
|
#ifdef MODULE_CONFIG
|
2014-02-21 19:10:24 +01:00
|
|
|
extern void _id_handler(int argc, char **argv);
|
2014-02-25 10:07:41 +01:00
|
|
|
#endif
|
|
|
|
|
2014-02-25 10:08:58 +01:00
|
|
|
#ifdef MODULE_LPC_COMMON
|
2014-02-21 19:10:24 +01:00
|
|
|
extern void _heap_handler(int argc, char **argv);
|
2014-02-25 10:08:58 +01:00
|
|
|
#endif
|
2010-12-01 16:26:48 +01:00
|
|
|
|
2010-11-04 15:05:51 +01:00
|
|
|
#ifdef MODULE_PS
|
2014-02-21 19:10:24 +01:00
|
|
|
extern void _ps_handler(int argc, char **argv);
|
2010-11-04 18:16:39 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef MODULE_SHT11
|
2014-02-21 19:10:24 +01:00
|
|
|
extern void _get_temperature_handler(int argc, char **argv);
|
|
|
|
extern void _get_humidity_handler(int argc, char **argv);
|
|
|
|
extern void _get_weather_handler(int argc, char **argv);
|
|
|
|
extern void _set_offset_handler(int argc, char **argv);
|
2010-11-04 15:05:51 +01:00
|
|
|
#endif
|
|
|
|
|
2014-11-05 19:53:30 +01:00
|
|
|
#ifdef MODULE_ISL29020
|
|
|
|
extern void _get_isl29020_init_handler(int argc, char **argv);
|
|
|
|
extern void _get_isl29020_read_handler(int argc, char **argv);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef MODULE_LPS331AP
|
|
|
|
extern void _get_lps331ap_init_handler(int argc, char **argv);
|
|
|
|
extern void _get_lps331ap_read_handler(int argc, char **argv);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef MODULE_L3G4200D
|
|
|
|
extern void _get_l3g4200d_init_handler(int argc, char **argv);
|
|
|
|
extern void _get_l3g4200d_read_handler(int argc, char **argv);
|
|
|
|
#endif
|
|
|
|
|
2014-11-05 14:58:18 +01:00
|
|
|
#ifdef MODULE_LSM303DLHC
|
|
|
|
extern void _get_lsm303dlhc_init_handler(int argc, char **argv);
|
|
|
|
extern void _get_lsm303dlhc_read_handler(int argc, char **argv);
|
|
|
|
#endif
|
|
|
|
|
2010-11-05 23:43:14 +01:00
|
|
|
#ifdef MODULE_LTC4150
|
2014-02-21 19:10:24 +01:00
|
|
|
extern void _get_current_handler(int argc, char **argv);
|
|
|
|
extern void _reset_current_handler(int argc, char **argv);
|
2010-11-05 23:43:14 +01:00
|
|
|
#endif
|
|
|
|
|
2014-11-20 11:48:21 +01:00
|
|
|
#if FEATURE_PERIPH_RTC
|
|
|
|
extern void _rtc_handler(int argc, char **argv);
|
|
|
|
#endif
|
|
|
|
|
2014-01-16 07:39:33 +01:00
|
|
|
#ifdef CPU_X86
|
|
|
|
extern void _x86_lspci(int argc, char **argv);
|
|
|
|
#endif
|
2014-01-31 09:45:01 +01:00
|
|
|
|
|
|
|
/* configure available commands for each transceiver device: */
|
2012-03-01 22:12:25 +01:00
|
|
|
#ifdef MODULE_TRANSCEIVER
|
2014-01-31 09:45:01 +01:00
|
|
|
#ifdef DBG_IGNORE
|
|
|
|
#define _TC_IGN
|
|
|
|
#endif
|
2014-09-23 01:30:37 +02:00
|
|
|
#if (defined(MODULE_CC110X) || defined(MODULE_CC110X_LEGACY) || defined(MODULE_CC2420) || defined(MODULE_AT86RF231) || defined(MODULE_NATIVENET))
|
2014-01-31 09:45:01 +01:00
|
|
|
#define _TC_ADDR
|
|
|
|
#define _TC_CHAN
|
|
|
|
#define _TC_MON
|
|
|
|
#define _TC_SEND
|
|
|
|
#endif
|
2014-01-21 17:08:27 +01:00
|
|
|
#if (defined(MODULE_CC2420) || defined(MODULE_AT86RF231) || defined(MODULE_NATIVENET))
|
|
|
|
#define _TC_LONG_ADDR
|
2014-01-31 09:45:01 +01:00
|
|
|
#define _TC_PAN
|
|
|
|
#endif
|
|
|
|
#else /* WITHOUT MODULE_TRANSCEIVER */
|
2014-10-26 22:02:18 +01:00
|
|
|
#ifdef MODULE_CC110X_LEGACY_CSMA
|
2014-02-21 19:10:24 +01:00
|
|
|
extern void _cc110x_get_set_address_handler(int argc, char **argv);
|
|
|
|
extern void _cc110x_get_set_channel_handler(int argc, char **argv);
|
2010-11-09 17:08:35 +01:00
|
|
|
#endif
|
2012-03-01 22:12:25 +01:00
|
|
|
#endif
|
2010-11-09 17:08:35 +01:00
|
|
|
|
2010-11-27 10:50:18 +01:00
|
|
|
#ifdef MODULE_TRANSCEIVER
|
2014-01-31 09:45:01 +01:00
|
|
|
#ifdef _TC_ADDR
|
2014-02-21 19:10:24 +01:00
|
|
|
extern void _transceiver_get_set_address_handler(int argc, char **argv);
|
2010-11-27 10:50:18 +01:00
|
|
|
#endif
|
2014-01-21 17:08:27 +01:00
|
|
|
#ifdef _TC_LONG_ADDR
|
|
|
|
extern void _transceiver_get_set_long_addr_handler(int argc, char **argv);
|
|
|
|
#endif
|
2014-01-31 09:45:01 +01:00
|
|
|
#ifdef _TC_CHAN
|
2014-02-21 19:10:24 +01:00
|
|
|
extern void _transceiver_get_set_channel_handler(int argc, char **argv);
|
2010-11-27 10:50:18 +01:00
|
|
|
#endif
|
2014-01-31 09:45:01 +01:00
|
|
|
#ifdef _TC_SEND
|
2014-02-21 19:10:24 +01:00
|
|
|
extern void _transceiver_send_handler(int argc, char **argv);
|
2013-05-02 08:45:47 +02:00
|
|
|
#endif
|
2014-01-31 09:45:01 +01:00
|
|
|
#ifdef _TC_MON
|
2014-02-21 19:10:24 +01:00
|
|
|
extern void _transceiver_monitor_handler(int argc, char **argv);
|
2013-05-02 08:45:47 +02:00
|
|
|
#endif
|
2014-01-31 09:45:01 +01:00
|
|
|
#ifdef _TC_PAN
|
2014-02-21 19:10:24 +01:00
|
|
|
extern void _transceiver_get_set_pan_handler(int argc, char **argv);
|
2014-01-31 09:45:01 +01:00
|
|
|
#endif
|
|
|
|
#ifdef _TC_IGN
|
2014-02-21 19:10:24 +01:00
|
|
|
extern void _transceiver_set_ignore_handler(int argc, char **argv);
|
2013-08-08 11:08:33 +02:00
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2014-05-23 18:18:40 +02:00
|
|
|
#ifdef MODULE_L2_PING
|
|
|
|
extern void _l2_ping_req_handler(int argc, char **argv);
|
|
|
|
extern void _l2_ping_probe_handler(int argc, char **argv);
|
|
|
|
extern void _l2_ping_get_probe_handler(int argc, char **argv);
|
|
|
|
#endif
|
|
|
|
|
2013-12-25 18:28:11 +01:00
|
|
|
#ifdef MODULE_NET_IF
|
|
|
|
extern void _net_if_ifconfig(int argc, char **argv);
|
|
|
|
#endif
|
|
|
|
|
2014-03-09 11:01:10 +01:00
|
|
|
#ifdef MODULE_RPL
|
|
|
|
extern void _rpl_route_handler(int argc, char **argv);
|
|
|
|
#endif
|
|
|
|
|
2011-12-12 17:50:22 +01:00
|
|
|
#ifdef MODULE_MCI
|
2014-02-21 19:10:24 +01:00
|
|
|
extern void _get_sectorsize(int argc, char **argv);
|
|
|
|
extern void _get_blocksize(int argc, char **argv);
|
|
|
|
extern void _get_sectorcount(int argc, char **argv);
|
|
|
|
extern void _read_sector(int argc, char **argv);
|
|
|
|
extern void _read_bytes(int argc, char **argv);
|
2011-12-12 17:50:22 +01:00
|
|
|
#endif
|
|
|
|
|
2014-01-20 11:08:42 +01:00
|
|
|
#ifdef MODULE_RANDOM
|
2014-02-21 19:10:24 +01:00
|
|
|
extern void _mersenne_init(int argc, char **argv);
|
|
|
|
extern void _mersenne_get(int argc, char **argv);
|
2014-01-20 11:08:42 +01:00
|
|
|
#endif
|
|
|
|
|
2010-10-01 15:24:43 +02:00
|
|
|
const shell_command_t _shell_command_list[] = {
|
2014-02-14 17:17:25 +01:00
|
|
|
{"reboot", "Reboot the node", _reboot_handler},
|
2014-02-25 10:07:41 +01:00
|
|
|
#ifdef MODULE_CONFIG
|
|
|
|
{"id", "Gets or sets the node's id.", _id_handler},
|
|
|
|
#endif
|
2013-09-19 13:47:23 +02:00
|
|
|
#ifdef MODULE_LPC_COMMON
|
2013-09-05 12:31:07 +02:00
|
|
|
{"heap", "Shows the heap state for the LPC2387 on the command shell.", _heap_handler},
|
2013-09-19 13:47:23 +02:00
|
|
|
#endif
|
2010-10-01 15:24:43 +02:00
|
|
|
#ifdef MODULE_PS
|
2010-11-04 15:05:51 +01:00
|
|
|
{"ps", "Prints information about running threads.", _ps_handler},
|
2010-11-04 18:16:39 +01:00
|
|
|
#endif
|
|
|
|
#ifdef MODULE_SHT11
|
2010-11-05 23:43:14 +01:00
|
|
|
{"temp", "Prints measured temperature.", _get_temperature_handler},
|
|
|
|
{"hum", "Prints measured humidity.", _get_humidity_handler},
|
|
|
|
{"weather", "Prints measured humidity and temperature.", _get_weather_handler},
|
2013-06-22 05:11:53 +02:00
|
|
|
{"offset", "Set temperature offset.", _set_offset_handler},
|
2010-11-05 23:43:14 +01:00
|
|
|
#endif
|
2014-11-05 19:53:30 +01:00
|
|
|
#ifdef MODULE_ISL29020
|
|
|
|
{"isl29020_init", "Initializes the isl29020 sensor driver.", _get_isl29020_init_handler},
|
|
|
|
{"isl29020_read", "Prints data from the isl29020 sensor.", _get_isl29020_read_handler},
|
|
|
|
#endif
|
|
|
|
#ifdef MODULE_LPS331AP
|
|
|
|
{"lps331ap_init", "Initializes the lps331ap sensor driver.", _get_lps331ap_init_handler},
|
|
|
|
{"lps331ap_read", "Prints data from the lps331ap sensor.", _get_lps331ap_read_handler},
|
|
|
|
#endif
|
|
|
|
#ifdef MODULE_L3G4200D
|
|
|
|
{"l3g4200d_init", "Initializes the l3g4200d sensor driver.", _get_l3g4200d_init_handler},
|
|
|
|
{"l3g4200d_read", "Prints data from the l3g4200d sensor.", _get_l3g4200d_read_handler},
|
|
|
|
#endif
|
2014-11-05 14:58:18 +01:00
|
|
|
#ifdef MODULE_LSM303DLHC
|
|
|
|
{"lsm303dlhc_init", "Initializes the lsm303dlhc sensor driver.", _get_lsm303dlhc_init_handler},
|
|
|
|
{"lsm303dlhc_read", "Prints data from the lsm303dlhc sensor.", _get_lsm303dlhc_read_handler},
|
|
|
|
#endif
|
2010-11-05 23:43:14 +01:00
|
|
|
#ifdef MODULE_LTC4150
|
2013-06-22 05:11:53 +02:00
|
|
|
{"cur", "Prints current and average power consumption.", _get_current_handler},
|
|
|
|
{"rstcur", "Resets coulomb counter.", _reset_current_handler},
|
2010-11-09 17:08:35 +01:00
|
|
|
#endif
|
2012-03-01 22:12:25 +01:00
|
|
|
#ifdef MODULE_TRANSCEIVER
|
2014-01-31 09:45:01 +01:00
|
|
|
#ifdef _TC_ADDR
|
|
|
|
{"addr", "Gets or sets the address for the transceiver", _transceiver_get_set_address_handler},
|
2010-11-27 10:50:18 +01:00
|
|
|
#endif
|
2014-01-21 17:08:27 +01:00
|
|
|
#ifdef _TC_LONG_ADDR
|
|
|
|
{"eui64", "Gets or sets the EUI-64 for the transceiver", _transceiver_get_set_long_addr_handler},
|
|
|
|
#endif
|
2014-01-31 09:45:01 +01:00
|
|
|
#ifdef _TC_CHAN
|
|
|
|
{"chan", "Gets or sets the channel for the transceiver", _transceiver_get_set_channel_handler},
|
2012-03-01 22:12:25 +01:00
|
|
|
#endif
|
2014-01-31 09:45:01 +01:00
|
|
|
#ifdef _TC_SEND
|
|
|
|
{"txtsnd", "Sends a text message to a given node via the transceiver", _transceiver_send_handler},
|
2010-11-27 10:50:18 +01:00
|
|
|
#endif
|
2014-01-31 09:45:01 +01:00
|
|
|
#ifdef _TC_PAN
|
|
|
|
{"pan", "Gets or sets the pan id for the transceiver", _transceiver_get_set_pan_handler},
|
2011-12-12 17:50:22 +01:00
|
|
|
#endif
|
2014-01-31 09:45:01 +01:00
|
|
|
#ifdef _TC_MON
|
|
|
|
{"monitor", "Enables or disables address checking for the transceiver", _transceiver_monitor_handler},
|
2013-05-02 08:45:47 +02:00
|
|
|
#endif
|
2014-01-31 09:45:01 +01:00
|
|
|
#ifdef _TC_IGN
|
|
|
|
{"ign", "Ignore the address at the transceiver", _transceiver_set_ignore_handler},
|
2013-05-02 08:45:47 +02:00
|
|
|
#endif
|
2014-01-31 09:45:01 +01:00
|
|
|
#else /* WITHOUT MODULE_TRANSCEIVER */
|
2014-10-26 22:02:18 +01:00
|
|
|
#ifdef MODULE_CC110X_LEGACY_CSMA
|
2014-01-31 09:45:01 +01:00
|
|
|
{"addr", "Gets or sets the address for the CC1100 transceiver", _cc110x_get_set_address_handler},
|
|
|
|
{"chan", "Gets or sets the channel for the CC1100 transceiver", _cc110x_get_set_channel_handler},
|
2013-08-08 11:08:33 +02:00
|
|
|
#endif
|
|
|
|
#endif
|
2014-05-23 18:18:40 +02:00
|
|
|
#ifdef MODULE_L2_PING
|
|
|
|
{"l2_ping", "Sends link layer ping requests", _l2_ping_req_handler},
|
|
|
|
{"l2_probe", "Sends link layer probes", _l2_ping_probe_handler},
|
|
|
|
{"l2_probe_stats", "Get statistics about received probes", _l2_ping_get_probe_handler},
|
|
|
|
#endif
|
2013-12-25 18:28:11 +01:00
|
|
|
#ifdef MODULE_NET_IF
|
|
|
|
{"ifconfig", "Configures a network interface", _net_if_ifconfig},
|
|
|
|
#endif
|
2014-03-09 11:01:10 +01:00
|
|
|
#ifdef MODULE_RPL
|
|
|
|
{"route", "Shows the routing table", _rpl_route_handler},
|
|
|
|
#endif
|
2011-12-12 17:50:22 +01:00
|
|
|
#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},
|
2014-01-20 11:08:42 +01:00
|
|
|
#endif
|
|
|
|
#ifdef MODULE_RANDOM
|
|
|
|
{ "mersenne_init", "initializes the PRNG", _mersenne_init },
|
|
|
|
{ "mersenne_get", "returns 32 bit of pseudo randomness", _mersenne_get },
|
2014-01-16 07:39:33 +01:00
|
|
|
#endif
|
2014-11-20 11:48:21 +01:00
|
|
|
#if FEATURE_PERIPH_RTC
|
|
|
|
{"rtc", "control RTC peripheral interface", _rtc_handler},
|
|
|
|
#endif
|
2014-01-16 07:39:33 +01:00
|
|
|
#ifdef CPU_X86
|
|
|
|
{"lspci", "Lists PCI devices", _x86_lspci},
|
2010-10-01 15:24:43 +02:00
|
|
|
#endif
|
2010-11-04 15:05:51 +01:00
|
|
|
{NULL, NULL, NULL}
|
2010-10-01 15:24:43 +02:00
|
|
|
};
|