2 * Copyright (C) 2012-2013 Czech Technical University in Prague
4 * Created on: 31.7.2012
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <http://www.gnu.org/licenses/>.
25 * This file contains root of the list of the commands.
43 #include "cmd_netstats.h"
46 #include "cmd_sdram.h"
49 #include "cmd_motor_example.h"
50 #include "cmd_fr_basic_test.h"
59 * @brief Sleep the board
61 * @param[in] cmd_io Pointer to IO stack
62 * @param[in] des Pointer to command descriptor
63 * @param[in] param Parameters of command
64 * @return 0 when OK or error code
66 int cmd_do_sleep(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) {
67 hal_gpio_pin_set_value(PIN_DSC_CANNSTB, 1);
68 hal_gpio_pin_set_value(PIN_DSC_CANEN, 1);
69 hal_gpio_pin_set_value(PIN_DSC_LIN2NSLP, 1);
70 hal_gpio_pin_set_value(PIN_DSC_LIN1NSLP, 1);
71 vTaskDelay(10/portTICK_RATE_MS);
72 hal_gpio_pin_set_value(PIN_DSC_LIN2NSLP, 0);
73 hal_gpio_pin_set_value(PIN_DSC_LIN1NSLP, 0);
74 hal_gpio_pin_set_value(PIN_DSC_CANNSTB, 0);
80 int cmd_do_version(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) {
81 rpp_sci_printf("version=%s\n", GIT_VERSION);
87 /** Root list in which commands are stored */
88 cmd_des_t const **cmd_list;
90 /** Command descriptor for sleep command */
91 cmd_des_t const cmd_des_sleep={
93 "sleep","Sleep the board",
98 "=== Description ===\n"
100 "This command configures the LIN and CAN peripherals to enter sleep mode\n"
101 "and turn the whole device into sleep mode. External signal on CAN or\n"
102 "LIN will wake the device up.\n",
103 CMD_HANDLER(cmd_do_sleep), (void *)&cmd_list
106 /** Command descriptor for show help command */
107 cmd_des_t const cmd_des_help={
109 "help","Print help for commands",
114 "=== Description ===\n"
116 "This command without parameter prints the list of all available\n"
117 "commands with short help text for each of them. If a parameter is\n"
118 "provided, the command prints a long description for given command.\n",
119 CMD_HANDLER(cmd_do_help), (void *)&cmd_list
122 cmd_des_t const cmd_des_version={
124 "version","Print version of the software",
129 "=== Description ===\n"
131 "This command prints the version of the test software. The version\n"
132 "number is the output of 'git describe' command, i.e. it is composed\n"
133 "from the last tag in the git repository, the number of commits since\n"
134 "the tag and the abbreviated commit hash.\n"
139 " version=v0.2-109-ga81a9dd\n",
140 CMD_HANDLER(cmd_do_version),
143 /* ------------------------
144 * Command lists definitons
145 * ------------------------
148 /** @brief Main list of commands */
149 cmd_des_t const *cmd_list_main[]={
153 CMD_DES_INCLUDE_SUBLIST(cmd_list_adc),
154 CMD_DES_INCLUDE_SUBLIST(cmd_list_can),
155 CMD_DES_INCLUDE_SUBLIST(cmd_list_dac),
156 CMD_DES_INCLUDE_SUBLIST(cmd_list_din),
157 CMD_DES_INCLUDE_SUBLIST(cmd_list_emac),
158 CMD_DES_INCLUDE_SUBLIST(cmd_list_fray),
159 CMD_DES_INCLUDE_SUBLIST(cmd_list_hbr),
160 CMD_DES_INCLUDE_SUBLIST(cmd_list_hout),
161 CMD_DES_INCLUDE_SUBLIST(cmd_list_lin),
162 CMD_DES_INCLUDE_SUBLIST(cmd_list_lout),
163 CMD_DES_INCLUDE_SUBLIST(cmd_list_nc),
164 CMD_DES_INCLUDE_SUBLIST(cmd_list_netstats),
165 CMD_DES_INCLUDE_SUBLIST(cmd_list_pin),
166 CMD_DES_INCLUDE_SUBLIST(cmd_list_port),
167 CMD_DES_INCLUDE_SUBLIST(cmd_list_sdram),
168 CMD_DES_INCLUDE_SUBLIST(cmd_list_spi),
169 CMD_DES_INCLUDE_SUBLIST(cmd_list_vbat),
170 CMD_DES_INCLUDE_SUBLIST(cmd_list_motor_example),
171 CMD_DES_INCLUDE_SUBLIST(cmd_list_fr_basic_test),
175 /** Pointer to the root list */
176 cmd_des_t const **cmd_list = cmd_list_main;