Moved remotely
git-svn-id: file:///srv/dev-disk-by-uuid-17e88007-4d0c-45e0-8757-cacfcc458630/repositories/svn/Diplomarbeit@110 9fe90eed-be63-e94b-8204-d34ff4c2ff93
This commit is contained in:
@@ -0,0 +1,422 @@
|
||||
/* ---------------------------------------------------------------------------
|
||||
* menu.c (c) 2008 Micro-key bv
|
||||
* ---------------------------------------------------------------------------
|
||||
* Micro-key bv
|
||||
* Industrieweg 28, 9804 TG Noordhorn
|
||||
* Postbus 92, 9800 AB Zuidhorn
|
||||
* The Netherlands
|
||||
* Tel: +31 594 503020
|
||||
* Fax: +31 594 505825
|
||||
* Email: support@microkey.nl
|
||||
* Web: www.microkey.nl
|
||||
* ---------------------------------------------------------------------------
|
||||
* Description:
|
||||
* ---------------------------------------------------------------------------
|
||||
* Version(s): 0.1, Apr 01, 2008, MMi
|
||||
* Creation.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* System include files
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
/* Compiler includes */
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/* Hardware includes */
|
||||
#include "lpc23xx.h"
|
||||
#include "types.h"
|
||||
|
||||
/* FreeRTOS includes */
|
||||
#include "FreeRTOS.h"
|
||||
#include "Task.h"
|
||||
#include "semphr.h"
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Application include files
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "topoftest.h"
|
||||
#include "menu.h"
|
||||
#include "menufunctions.h"
|
||||
#include "menuargs.h"
|
||||
#include "dac.h"
|
||||
#include "adc.h"
|
||||
#include "dio.h"
|
||||
#include "logging.h"
|
||||
#include "SerOut.h"
|
||||
|
||||
#include "ledfunctions.h"
|
||||
#include "taskfunctions.h"
|
||||
#include "BusProtocol.h"
|
||||
|
||||
#include "remote_tests.h"
|
||||
#include "remote_misc.h"
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local constant and macro definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Global variable definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
extern const char *command_table[NUMBER_OF_COMMANDS];
|
||||
extern const fpointer command_pointer[NUMBER_OF_COMMANDS];
|
||||
extern UINT8 cmd_table_offset[ALPHABET_DIGITS];
|
||||
extern const char * menuHelptextArray [NUMBER_OF_COMMANDS];
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local variable definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
UINT32 arg1 = 0;
|
||||
UINT32 arg2 = 0;
|
||||
UINT32 arg3 = 0;
|
||||
|
||||
BOOLEAN quit = FALSE;
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local function definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
void TABfunction (char * command);
|
||||
|
||||
|
||||
|
||||
void CallMenu(void)
|
||||
{
|
||||
/* local Variable Declaration */
|
||||
UINT32 bytesreceived = 0;
|
||||
static UINT8 receiveString[60];
|
||||
static UINT8 backupString[60];
|
||||
UINT8 buffer;
|
||||
BOOLEAN receive;
|
||||
|
||||
char separator[] = " ";
|
||||
char *commandt;
|
||||
char *pcmd;
|
||||
char *arg1t;
|
||||
char *arg2t;
|
||||
char *arg3t;
|
||||
UINT8 command[15];
|
||||
UINT8 cmd_len;
|
||||
|
||||
UINT8 loopcnt;
|
||||
BOOLEAN callhelp = FALSE;
|
||||
|
||||
|
||||
do /* do-while loop for Main Menu */
|
||||
{
|
||||
/* Display PROMPT to Console */
|
||||
serWrite(MenuPort, strlen("\n\r\n\rCMD> "), (UINT8 *)"\n\r\n\rCMD> ");
|
||||
|
||||
/* Reset String input Variables */
|
||||
buffer = 0;
|
||||
bytesreceived = 0;
|
||||
|
||||
commandt = 0;
|
||||
cmd_len = 0;
|
||||
arg1 = 0;
|
||||
arg2 = 0;
|
||||
arg3 = 0;
|
||||
|
||||
do /* do-while loop for String input */
|
||||
{
|
||||
if ((receive = serGet(MenuPort, &buffer) == TRUE))
|
||||
{
|
||||
if (buffer == '\t')
|
||||
{
|
||||
receiveString[bytesreceived] = '\0';
|
||||
TABfunction((char *) receiveString);
|
||||
}
|
||||
|
||||
/* Detection of Escape characters. VT100 Commands are 4 Bytes,
|
||||
* so software takes out three more bytes from the buffer.
|
||||
*/
|
||||
else if (buffer == 27)
|
||||
{
|
||||
serGet(MenuPort, &buffer);
|
||||
serGet(MenuPort, &buffer);
|
||||
// serGet(MenuPort, &buffer);
|
||||
|
||||
/* Detection for LEFT and RIGHT Arrow keys.
|
||||
* Future implementation may be done for advanced shell
|
||||
*/
|
||||
if (buffer =='A')
|
||||
{
|
||||
serWrite(MenuPort, strlen("\x1B[1B"), (UINT8 *)"\x1B[1B");
|
||||
/* UP arrow Key detected */
|
||||
if (bytesreceived == 0)
|
||||
{
|
||||
/* If Cursor is on the beginning position */
|
||||
strcpy ((char *)receiveString, (char *)backupString);
|
||||
bytesreceived = strlen((char *)backupString);
|
||||
serWrite(MenuPort, bytesreceived, backupString);
|
||||
}
|
||||
}
|
||||
// else if (buffer == 'B')
|
||||
// {
|
||||
// /* DOWN arrow Key detected */
|
||||
// }
|
||||
//
|
||||
// else if (buffer == 'C')
|
||||
// {
|
||||
// /* RIGHT arrow Key detected */
|
||||
// bytesreceived++;
|
||||
// }
|
||||
// else if (buffer == 'D')
|
||||
// {
|
||||
// /* LEFT arrow Key detected */
|
||||
// if (bytesreceived > 0)
|
||||
// {
|
||||
// /* If cursor is not on first position */
|
||||
// bytesreceived--;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// /* Move Cursor one position to right (VT100) */
|
||||
// serWrite(SerOutPort, sizeof("\x1B[1C"), "\x1B[1C");
|
||||
// }
|
||||
// }
|
||||
else
|
||||
{
|
||||
/* Any other Control Key detected. Read and ignore */
|
||||
serGet(MenuPort, &buffer);
|
||||
}
|
||||
}
|
||||
|
||||
else if (buffer == 127)
|
||||
{
|
||||
/* If pressed key was BackSpace (NOTE KEYCODE, NOT 0x08)*/
|
||||
if (bytesreceived > 0)
|
||||
{
|
||||
/* Cursor is not first position, step back in array */
|
||||
receiveString[bytesreceived--] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Cursor ist on first position, do not step back */
|
||||
/* Move Cursor one position to right (VT100) */
|
||||
serWrite(SerOutPort, strlen("\x1B[1C"), (UINT8 *)"\x1B[1C");
|
||||
}
|
||||
}
|
||||
else if (buffer == 13)
|
||||
{
|
||||
receiveString[bytesreceived] = '\0';
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Write Byte in String and increase String index */
|
||||
receiveString[bytesreceived] = buffer;
|
||||
bytesreceived++;
|
||||
}
|
||||
vTaskDelay(10); /* Share Calculation Time */
|
||||
}
|
||||
}while (buffer != 13); /*Read input until ENTER-Key */
|
||||
|
||||
writeLog(LogInput, MenuPort, menuMessage, (char *)receiveString);
|
||||
|
||||
/* Copy actual received command string to a backup string */
|
||||
strcpy ((char *)backupString, (char *)receiveString);
|
||||
sendString (MenuPort, GotoNewLine, menuMessage,
|
||||
"receiveString: ", (char *)receiveString, Dummy);
|
||||
sendString (MenuPort, GotoNewLine, menuMessage,
|
||||
"backupString: ", (char *)backupString, Dummy);
|
||||
|
||||
/* Split command and arguments with strtok() function, where a
|
||||
* SPACE letter is used as devider.
|
||||
*/
|
||||
commandt = strtok ((char *)receiveString, (char *)separator);
|
||||
arg1t = strtok (NULL, (char *)separator);
|
||||
arg2t = strtok (NULL, (char *)separator);
|
||||
arg3t = strtok (NULL, (char *)separator);
|
||||
|
||||
if ((pcmd = strstr ((char *)commandt, "_help")) != NULL)
|
||||
{
|
||||
callhelp = TRUE;
|
||||
sendString (MenuPort, GotoNewLine, menuMessage,
|
||||
"Help Stat recognised ", Dummy, Dummy);
|
||||
|
||||
/* Copy command to an own string */
|
||||
cmd_len = strlen (commandt);
|
||||
strncpy ((char *)command, commandt, (cmd_len - 5));
|
||||
command[cmd_len - 5] = '\0';
|
||||
}
|
||||
else
|
||||
{
|
||||
callhelp = FALSE;
|
||||
|
||||
/* Copy command to an own string */
|
||||
strcpy ((char *)command, commandt);
|
||||
|
||||
/* Detect if arguments are given dezimal or hexadezimal. Detection
|
||||
* looks for a leading "0x" on the string. Afterwards, the given
|
||||
* Value is transformed to an integer value with sscanf. No Error
|
||||
* checking. The value is transformed step by step until the string-
|
||||
* end token or the first not-hex symbol.
|
||||
*/
|
||||
if ((arg1t[0] == 48) && (arg1t[1] == 120))
|
||||
{
|
||||
/* First Argument is given in Hex, transform value */
|
||||
sscanf((char *)(arg1t), "%x", &arg1);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* First argument is given dezimal, cast to integer */
|
||||
arg1 = (UINT32) atoi((char *) (arg1t));
|
||||
}
|
||||
|
||||
if ((arg2t[0] == 48) && (arg2t[1] == 120))
|
||||
{
|
||||
/* Second Argument is given in Hex, transform value */
|
||||
sscanf((char *)(arg2t), "%x", &arg2);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Second argument is given dezimal, cast to integer */
|
||||
arg2 = (UINT32) atoi((char *) (arg2t));
|
||||
}
|
||||
|
||||
if ((arg3t[0] == 48) && (arg3t[1] == 120))
|
||||
{
|
||||
/* Third Argument is given in Hex, transform value */
|
||||
sscanf((char *)(arg3t), "%x", &arg3);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Third argument is given dezimal, cast to integer */
|
||||
arg3 = (UINT32) atoi((char *) (arg3t));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
sendString (MenuPort, GotoNewLine, menuMessage,
|
||||
"commandt: ", (char *)commandt, Dummy);
|
||||
sendString (MenuPort, FALSE, menuMessage,
|
||||
"\tcommand: ", (char *)command, Dummy);
|
||||
sendString (MenuPort, GotoNewLine, menuMessage,
|
||||
"arg1t: ", (char *)arg1t, Dummy);
|
||||
sendString (MenuPort, FALSE, menuMessage,
|
||||
"\targ1: ", ItoDStr(arg1), Dummy);
|
||||
sendString (MenuPort, GotoNewLine, menuMessage,
|
||||
"arg2t: ", (char *)arg2t, Dummy);
|
||||
sendString (MenuPort, FALSE, menuMessage,
|
||||
"\targ2: ", ItoDStr(arg2), Dummy);
|
||||
sendString (MenuPort, GotoNewLine, menuMessage,
|
||||
"arg3t: ", (char *)arg3t, Dummy);
|
||||
sendString (MenuPort, FALSE, menuMessage,
|
||||
"\targ3: ", ItoDStr(arg3), Dummy);
|
||||
|
||||
|
||||
/* Advanced Search algorithm for commands */
|
||||
/* Menu structure is based on 2 tables for the commands and one more
|
||||
* as offset.
|
||||
* The given command is first checked on a valid first letter. If
|
||||
* valid, this letter is compared with the offset table. If an offset
|
||||
* is defines for the first letter, at least commands with this first
|
||||
* letter exist. Do a string compare starting at the address in the
|
||||
* command array given by the offset for the first letter. This
|
||||
* prevents of scanning all commands beginning with a different letter
|
||||
*/
|
||||
|
||||
if ((command[0] >= 97) && (command[0] <= 122))
|
||||
{
|
||||
/* First sign of command is within specified Range */
|
||||
if (cmd_table_offset[(command[0] - 97)] != 0xFF)
|
||||
{
|
||||
/* If Offset for specified letter is available */
|
||||
for (loopcnt = (cmd_table_offset[(command[0] - 97)]);
|
||||
loopcnt < NUMBER_OF_COMMANDS;
|
||||
loopcnt++)
|
||||
{
|
||||
/* Try to find the typed in command starting on the
|
||||
* offset position given with the first letter.
|
||||
*/
|
||||
if (strcmp ((char *)command, command_table[loopcnt]) == 0)
|
||||
{
|
||||
/* Found a valid command!
|
||||
* Use the found array-index to grip the corresponding
|
||||
* function pointer from pointer-array
|
||||
*/
|
||||
if (callhelp == FALSE)
|
||||
{
|
||||
(*command_pointer[loopcnt])();
|
||||
}
|
||||
else
|
||||
{
|
||||
sendString (MenuPort, TRUE, importantMessage,
|
||||
(char *) menuHelptextArray[loopcnt], Dummy, Dummy);
|
||||
// debugPrint((char *)menuHelptextArray[loopcnt]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (loopcnt == (NUMBER_OF_COMMANDS - 1))
|
||||
{
|
||||
/* No valid command was found. give Error Emssage */
|
||||
sendString (MenuPort, TRUE, importantMessage,
|
||||
(char *) command," - No such command!", Dummy);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* No Offset available for the specified letter */
|
||||
sendString (MenuPort, TRUE, importantMessage,
|
||||
(char *) command," - No such command!", Dummy);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* First letter is out of the specified Range */
|
||||
sendString (MenuPort, TRUE, importantMessage,
|
||||
(char *) command," - No such command!", Dummy);
|
||||
}
|
||||
|
||||
|
||||
receiveString[0] = '\0';
|
||||
|
||||
vTaskDelay(100);
|
||||
} while (quit == FALSE);
|
||||
}
|
||||
|
||||
|
||||
void TABfunction (char * command)
|
||||
{
|
||||
UINT32 loopcnt;
|
||||
UINT32 commandlength;
|
||||
|
||||
commandlength = strlen (command);
|
||||
serWrite (MenuPort, strlen ("\n\r\t\t"), (UINT8 *)"\n\r\t\t");
|
||||
|
||||
if ((command[0] >= 97) && (command[0] <= 122))
|
||||
{
|
||||
/* First sign of command is within specified Range */
|
||||
if (cmd_table_offset[(command[0] - 97)] != 0xFF)
|
||||
{
|
||||
/* If Offset for specified letter is available */
|
||||
for (loopcnt = (cmd_table_offset[(command[0] - 97)]);
|
||||
loopcnt < NUMBER_OF_COMMANDS;
|
||||
loopcnt++)
|
||||
{
|
||||
if (strncmp ((char *)command, command_table[loopcnt], commandlength) == 0)
|
||||
{
|
||||
sendString (MenuPort, FALSE, importantMessage,
|
||||
" ", (char *)command_table[loopcnt], Dummy);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/* Display PROMPT to Console */
|
||||
serWrite(MenuPort, strlen("\n\r\n\rCMD> "), (UINT8 *)"\n\r\n\rCMD> ");
|
||||
serWrite (MenuPort, strlen (command), (UINT8 *)command);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
/* ---------------------------------------------------------------------------
|
||||
* testmenu.h (c) 2008 Micro-key bv
|
||||
* ---------------------------------------------------------------------------
|
||||
* Micro-key bv
|
||||
* Industrieweg 28, 9804 TG Noordhorn
|
||||
* Postbus 92, 9800 AB Zuidhorn
|
||||
* The Netherlands
|
||||
* Tel: +31 594 503020
|
||||
* Fax: +31 594 505825
|
||||
* Email: support@microkey.nl
|
||||
* Web: www.microkey.nl
|
||||
* ---------------------------------------------------------------------------
|
||||
* Description:
|
||||
* Headfile for the CMD Prompt File testmenu.c
|
||||
* ---------------------------------------------------------------------------
|
||||
* Version(s): 0.1, Apr 01, 2008, MMi
|
||||
* Creation.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef TESTMENU_H_
|
||||
#define TESTMENU_H_
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* System include files.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "lpc23xx.h"
|
||||
#include "types.h"
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Application include files.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Constant and macro definitions.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Type definitions.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Variable declarations.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function declarations.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function: CallMenu
|
||||
*
|
||||
* Function to display a simplyfied PROMPT on COM-Port.
|
||||
*
|
||||
* Parameter: void
|
||||
*
|
||||
* Return: void
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
void CallMenu(void);
|
||||
|
||||
|
||||
#endif /*TESTMENU_H_*/
|
||||
@@ -0,0 +1,383 @@
|
||||
/* ---------------------------------------------------------------------------
|
||||
* menuargs.c (c) 2008 Micro-key bv
|
||||
* ---------------------------------------------------------------------------
|
||||
* Micro-key bv
|
||||
* Industrieweg 28, 9804 TG Noordhorn
|
||||
* Postbus 92, 9800 AB Zuidhorn
|
||||
* The Netherlands
|
||||
* Tel: +31 594 503020
|
||||
* Fax: +31 594 505825
|
||||
* Email: support@microkey.nl
|
||||
* Web: www.microkey.nl
|
||||
* ---------------------------------------------------------------------------
|
||||
* Description:
|
||||
* ---------------------------------------------------------------------------
|
||||
* Version(s): 0.1, Nov 13, 2008, MMi
|
||||
* Creation.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* System include files
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
/* Compiler includes */
|
||||
#include <string.h>
|
||||
|
||||
#include "LPC23xx.h"
|
||||
#include "types.h"
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Application include files
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "menuargs.h"
|
||||
#include "menufunctions.h"
|
||||
|
||||
#include "SerOut.h"
|
||||
|
||||
#include "can.h"
|
||||
|
||||
#include "remote_tests.h"
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local constant and macro definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#define ASCII_START 97
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Global variable definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local variable definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* Make Sure that at least the first letter of this is in alphabetical order*/
|
||||
const char *command_table[NUMBER_OF_COMMANDS] =
|
||||
{
|
||||
"aio",
|
||||
"battery",
|
||||
"bus",
|
||||
"canread",
|
||||
"cantest",
|
||||
"canwrite",
|
||||
"ccin",
|
||||
"ccout",
|
||||
"cdel",
|
||||
"cload",
|
||||
"confin",
|
||||
"confout",
|
||||
"cslave",
|
||||
"curout",
|
||||
"curin",
|
||||
"cvin",
|
||||
"cvout",
|
||||
"digiin",
|
||||
"digiout",
|
||||
"dio",
|
||||
"eeprom",
|
||||
"fattest",
|
||||
"help",
|
||||
"initSD",
|
||||
"initTest",
|
||||
"ledclean",
|
||||
"ledtest",
|
||||
"listlocal",
|
||||
// "listremoteattach",
|
||||
"logenable",
|
||||
"logmount",
|
||||
"logstart",
|
||||
"logstop",
|
||||
"ls",
|
||||
"menudebug",
|
||||
"mmc",
|
||||
"power",
|
||||
"quit",
|
||||
"readrtc",
|
||||
"remotecall",
|
||||
"rtc",
|
||||
"run",
|
||||
"stat_cal",
|
||||
"stat_def",
|
||||
"stat_kill",
|
||||
"stat_show",
|
||||
"stat_showall",
|
||||
"setmux",
|
||||
"setrtc",
|
||||
"tasksdelete",
|
||||
"volin",
|
||||
"volout"
|
||||
};
|
||||
|
||||
/* Make Sure that at least the first letter of this is in alphabetical order*/
|
||||
const fpointer command_pointer[NUMBER_OF_COMMANDS] =
|
||||
{
|
||||
m_aio,
|
||||
m_battery,
|
||||
m_bus,
|
||||
m_canread,
|
||||
m_cantest,
|
||||
m_canwrite,
|
||||
m_ccin,
|
||||
m_ccout,
|
||||
m_cdel,
|
||||
m_cload,
|
||||
m_confin,
|
||||
m_confout,
|
||||
m_cslave,
|
||||
m_curout,
|
||||
m_curin,
|
||||
m_cvin,
|
||||
m_cvout,
|
||||
m_digiin,
|
||||
m_digiout,
|
||||
m_dio,
|
||||
m_eeprom,
|
||||
m_fattest,
|
||||
m_help,
|
||||
m_initSD,
|
||||
r_TestInit,
|
||||
m_clean,
|
||||
m_ledtest,
|
||||
m_listLocalattachments,
|
||||
// m_listremoteattachments,
|
||||
m_logEnable,
|
||||
m_sdMount,
|
||||
m_logStart,
|
||||
m_logStop,
|
||||
m_loglist,
|
||||
m_menuDebug,
|
||||
m_mmc,
|
||||
m_power,
|
||||
m_quit,
|
||||
m_readRTC,
|
||||
m_callRemoteFunction,
|
||||
m_rtc,
|
||||
m_run,
|
||||
m_c_cal,
|
||||
m_c_def,
|
||||
m_c_kill,
|
||||
m_c_stat,
|
||||
m_c_show,
|
||||
m_switchMux,
|
||||
m_setRTC,
|
||||
m_tasksdelete,
|
||||
m_volin,
|
||||
m_volout,
|
||||
};
|
||||
|
||||
/* Array to store the offsets to the first letters of commands */
|
||||
UINT8 cmd_table_offset[ALPHABET_DIGITS];
|
||||
|
||||
const char * menuHelptextArray [NUMBER_OF_COMMANDS] =
|
||||
{
|
||||
"\n\r\n\r\taio arg1 arg2\n\r\ttests the analogue in- and outputs"
|
||||
"\n\r\n\r\t\targ1: device number. 0 sets up a self test"
|
||||
"\n\r\t\targ2: test type (0: MB, 1: EB) (Only on remote test)",
|
||||
|
||||
"\n\r\n\r\tbattery arg1\n\r\ttests the battery supply of a remote device"
|
||||
"\n\r\n\r\t\targ1: device number. 0 is self device",
|
||||
|
||||
"\n\r\n\r\tbus\n\r\ttests the local bus connections with transmit and receive strings",
|
||||
|
||||
"\n\r\n\r\tcanread\n\r\tPrints out the actual frame received on CAN",
|
||||
|
||||
"\n\r\n\r\tcantest\n\r\tTests the CAN interface with a Self Test",
|
||||
|
||||
"\n\r\n\r\tcanwrite arg1 arg2 arg3\n\r\twrites a message in a CAN frame"
|
||||
"\n\r\n\r\t\targ1 - Bits 0-10: Identifier, 13-15: Interface Number, 16-19: Data Length"
|
||||
"\n\r\t\targ2 - first 4 Bytes of Message"
|
||||
"\n\r\t\targ3 - last 4 Bytes of Message",
|
||||
|
||||
"\n\r\n\r\tccin\n\r\tcalibrate the local analogue current inputs"
|
||||
"\n\r\tPut calibration Value (e.g.20 mA) on each line separately when asked for",
|
||||
|
||||
"\n\r\n\r\tccout\n\r\tcalibrate the local analogue current outputs"
|
||||
"\n\r\tOnly useful with already calibrated analogue current inputs"
|
||||
"\n\r\tConnect outputs 0-5 to inputs 0-5. Software works automated",
|
||||
|
||||
"\n\r\n\r\tcdel arg1 arg2\n\r\tDeletes and resets the calibration values in eeprom"
|
||||
"\n\r\n\r\t\targ1: number of target device"
|
||||
"\n\r\t\targ2=0-3: kind of values to reset - 0=VI, 1=VO, 2=CI, 3=CO",
|
||||
|
||||
"\n\r\n\r\tcload arg1 arg2\n\r\treloads calibration values from EEPROM to system"
|
||||
"\n\r\n\r\t\targ1: number of target device"
|
||||
"\n\r\t\targ2=0-3: kind of values to reset - 0=VI, 1=VO, 2=CI, 3=CO",
|
||||
|
||||
"\n\r\n\r\tconfin arg1 arg2\n\r\tConfigures an analogue input on local device"
|
||||
"\n\r\n\r\t\targ1=0-7, 9: chose channel 0-7 or chose all channels with 9"
|
||||
"\n\r\t\targ2=0-1: 0: Sets mode to Voltage, 1: Sets mode to Current",
|
||||
|
||||
"\n\r\n\r\tconfout arg1 arg2\n\r\tConfigures an analogue input on local device"
|
||||
"\n\r\n\r\t\targ1=0-5, 9: chose channel 0-7 or chose all channels with 9"
|
||||
"\n\r\t\targ2=0-1: 0: Sets mode to Voltage, 1: Sets mode to Current",
|
||||
|
||||
"\n\r\n\r\tcslave\n\r\tcalibrates the slave with number 2",
|
||||
|
||||
"\n\r\n\r\tcurout arg1 arg2 arg3\n\r\tDrives an analogue Output with current value"
|
||||
"\n\r\n\r\t\targ1: device number"
|
||||
"\n\r\t\targ2=0-5: channel number"
|
||||
"\n\r\t\targ3=0-20000: value",
|
||||
|
||||
"\n\r\n\r\tcurin arg1 arg2\n\r\t Reads the actual current value from a analogue input"
|
||||
"\n\r\n\r\t\targ1: device number"
|
||||
"\n\r\t\targ2: channel number",
|
||||
|
||||
"\n\r\n\r\tcvin\n\r\tCalibrates the analogue voltage inputs"
|
||||
"\n\r\tPut calibration value (e.g.10 V) on all inputs at the same time."
|
||||
"\n\r\tSoftware works automated",
|
||||
|
||||
"\n\r\n\r\tcvout\n\r\tCalibrate the analogue voltage outputs"
|
||||
"\n\r\tOnly useful with already calibrated analogue voltage inputs"
|
||||
"\n\r\tConnect outputs 0-5 to inputs 0-5. Software works automated",
|
||||
|
||||
"\n\r\n\r\tdigiin arg1 arg2\n\r\tReads the actual value of a digital input"
|
||||
"\n\r\n\r\t\targ1: device number"
|
||||
"\n\r\t\targ2: channel number",
|
||||
|
||||
"\n\r\n\r\tdigiout arg1 arg2 arg3\n\r\tWrites to a digital output"
|
||||
"\n\r\n\r\t\targ1: device number"
|
||||
"\n\r\t\targ2: channel number"
|
||||
"\n\r\t\targ3=0-1: 0: FALSE/LOW, 1: TRUE/HIGH",
|
||||
|
||||
"\n\r\n\r\tdio arg1 arg2\n\r\tTests the digital in- and outputs"
|
||||
"\n\r\n\r\t\targ1: device number. 0 sets up a self test"
|
||||
"\n\r\t\targ2: test type (0: MB, 1: EB) (Only on remote test)",
|
||||
|
||||
"\n\r\n\r\teeprom arg1\n\r\tTests the connection and algorithms of the EEPROM"
|
||||
"\n\r\n\r\t\targ1: device number. 0 sets up a self test",
|
||||
|
||||
"\n\r\n\r\tfattest\n\r\tTest sequence for FAT Filesystem on SD/MMC",
|
||||
|
||||
"\n\r\n\r\thelp\n\r\tCALLS HELP, WHAT ELSE???",
|
||||
|
||||
"\n\r\n\r\tinitSD\n\r\tInitialises the SD Card",
|
||||
|
||||
"\n\r\n\r\tinitTest\n\r\tInitialises the remote test applications",
|
||||
|
||||
"\n\r\n\r\tledclean arg1\n\r\tSets all digital output LEDs to OFF"
|
||||
"\n\r\n\r\t\targ1: device number",
|
||||
|
||||
"\n\r\n\r\tledtest arg1\n\r\tTests all LEDs available"
|
||||
"\n\r\n\r\t\targ1: device number. 0 sets up a self test",
|
||||
|
||||
"\n\r\n\r\tlistlocalattach\n\r\tLists all local bus-attached functions",
|
||||
|
||||
// "\n\r\n\r\tlistremoteattach\n\r\tLists all remote bus-attached functions",
|
||||
|
||||
"\n\r\n\r\tlogenable arg1\n\r\tEnables/Disables Output logging"
|
||||
"\n\r\n\r\targ1=0-1: 0: disable, 1: enable",
|
||||
|
||||
"\n\r\n\r\tlogmount\n\r\tmounts the SD Card to file system",
|
||||
|
||||
"\n\r\n\r\tlogstart arg1\n\r\tStarts logging on file"
|
||||
"\n\r\n\r\targ1: serial number of device and filename of log-file",
|
||||
|
||||
"\n\r\n\r\tlogstop\n\r\tstops logging on file",
|
||||
|
||||
"\n\r\n\r\tls\n\rlists all existing logfiles",
|
||||
|
||||
"\n\r\n\r\tmenudebug arg1\n\r\tEnables detailed messages from the menu"
|
||||
"\n\r\n\r\t\targ1=0-1: 1: enable, 0: disable",
|
||||
|
||||
"\n\r\n\r\tmmc arg1\n\r\tTests the memory card interface"
|
||||
"\n\r\n\r\t\targ1: device number. 0 sets up a self test",
|
||||
|
||||
"\n\r\n\r\tpower arg1\n\r\tTests the devices power connections"
|
||||
"\n\r\n\r\t\targ1: device number. 0 sets up a self test",
|
||||
|
||||
"\n\r\n\r\tquit\n\r\tEXITS MENU",
|
||||
|
||||
"\n\r\n\r\treadrtc\n\r\tReads the RTC",
|
||||
|
||||
"\n\r\n\r\tremotecall arg1 arg2 arg3\n\r\tCalls remote functions on Salve"
|
||||
"\n\r\n\r\t\targ1: Remote function number"
|
||||
"\n\r\t\targ2: Number of function parameters"
|
||||
"\n\r\t\targ3: Function paramters",
|
||||
|
||||
"\n\r\n\r\trtc arg1\n\r\tTests the RealTime Clock"
|
||||
"\n\r\n\r\t\targ1: device number. 0 sets up a self test",
|
||||
|
||||
"\n\r\n\r\trun\n\r\tRuns a complete test sequence",
|
||||
|
||||
"\n\r\n\r\tstat_cal arg1\n\r\tSets the status of the analogue in- and outputs to CALIBRATED"
|
||||
"\n\r\n\r\t\targ1: device number. 0 is self device",
|
||||
|
||||
"\n\r\n\r\tstat_def arg1\n\r\tSets the status of the analogue in- and outputs to DEFAULT"
|
||||
"\n\r\n\r\t\targ1: device number. 0 is self device",
|
||||
|
||||
"\n\r\n\r\tstat_kill arg1\n\r\tDeletes the status of the analogue in- and outputs"
|
||||
"\n\r\n\r\targ1: device number. 0 is self device",
|
||||
|
||||
"\n\r\n\r\tstat_show arg1 arg2\n\r\tShows the status of the analogue in- and outputs"
|
||||
"\n\r\n\r\t\targ1: device number"
|
||||
"\n\r\t\targ2: Status type - 0=VI, 1=VO, 2=CI, 3=CO",
|
||||
|
||||
"\n\r\n\r\tstat_showall arg1\n\r\tShows the status of ALL analogue in- and outputs"
|
||||
"\n\r\n\r\t\targ1: device number",
|
||||
|
||||
"\n\r\n\r\tsetMux arg1 arg2\n\r\tSets the in- and ouput mux devices"
|
||||
"\n\r\n\r\t\targ1: Mux type (0: DI; 1: DO; 2: AI; 3: AO)"
|
||||
"\n\r\t\targ2: Mode (0: Main board; 1: Extension board)",
|
||||
|
||||
"\n\r\n\r\tsetRTC arg1 arg2 arg3\n\r\tSets Date and Time in the RTC"
|
||||
"\n\r\n\r\targ1:|day|hour|minutes|seconds| (each 8 bit)"
|
||||
"\n\r\targ2: |0|0|0|0|month|dayOfWeek (each 8 bit)"
|
||||
"\n\r\targ3: |dayOfYear|year| (each 16 bit)",
|
||||
|
||||
"\n\r\n\r\ttasksdelete\n\r\tDeletes all testLED tasks",
|
||||
|
||||
"\n\r\n\r\tvolin arg1 arg2\n\r\tReads actual value on analogue voltage input"
|
||||
"\n\r\n\r\t\targ1: device number. 0 is self device"
|
||||
"\n\r\t\targ2=0-7: channel number",
|
||||
|
||||
"\n\r\n\r\tvolout arg1 arg2 arg3\n\r\tDrives analogue voltage output"
|
||||
"\n\r\n\r\t\targ1: device number. 0 is self device"
|
||||
"\n\r\t\targ2=0-5: channel number"
|
||||
"\n\r\t\targ3=0-10000: Value"
|
||||
|
||||
|
||||
};
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local function definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
void menuInit (void)
|
||||
{
|
||||
UINT8 loopcnt = 0;
|
||||
UINT8 asciicnt;
|
||||
BOOLEAN breakout;
|
||||
|
||||
/* Calculate Array-Offsets for each possible first letter
|
||||
* The actual Letter is mentioned in asciicnt, which starts with dezimal
|
||||
* code of the first, small letter (a = 97).
|
||||
*/
|
||||
for (asciicnt = ASCII_START; asciicnt < (ASCII_START + ALPHABET_DIGITS); asciicnt++)
|
||||
{
|
||||
loopcnt = 0;
|
||||
breakout = FALSE;
|
||||
/* Perform search as long as no accordance was found or array ends */
|
||||
while (breakout == FALSE)
|
||||
{
|
||||
if (loopcnt < NUMBER_OF_COMMANDS)
|
||||
{
|
||||
if (command_table[loopcnt][0] == asciicnt)
|
||||
{
|
||||
/* Accordance found! Save Offset in offset-array */
|
||||
cmd_table_offset[(asciicnt - ASCII_START)] = loopcnt;
|
||||
breakout = TRUE; /* Enable breakout of loop */
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* No Accordance found. Save "NO OFFSET" to offset-array */
|
||||
cmd_table_offset[(asciicnt - ASCII_START)] = 0xFF;
|
||||
breakout = TRUE; /* Enable breakout of loop */
|
||||
}
|
||||
loopcnt++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
/* ---------------------------------------------------------------------------
|
||||
* menuargs.h (c) 2008 Micro-key bv
|
||||
* ---------------------------------------------------------------------------
|
||||
* Micro-key bv
|
||||
* Industrieweg 28, 9804 TG Noordhorn
|
||||
* Postbus 92, 9800 AB Zuidhorn
|
||||
* The Netherlands
|
||||
* Tel: +31 594 503020
|
||||
* Fax: +31 594 505825
|
||||
* Email: support@microkey.nl
|
||||
* Web: www.microkey.nl
|
||||
* ---------------------------------------------------------------------------
|
||||
* Description:
|
||||
* ---------------------------------------------------------------------------
|
||||
* Version(s): 0.1, Nov 13, 2008, MMi
|
||||
* Creation.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef MENUARGS_H_
|
||||
#define MENUARGS_H_
|
||||
/* ---------------------------------------------------------------------------
|
||||
* System include files.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Application include files.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Constant and macro definitions.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#define ALPHABET_DIGITS 26
|
||||
#define NUMBER_OF_COMMANDS 55
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Type definitions.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
typedef void (*fpointer)(void);
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Variable declarations.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function declarations.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
void menuInit (void);
|
||||
|
||||
#endif /*MENUARGS_H_*/
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,119 @@
|
||||
/* ---------------------------------------------------------------------------
|
||||
* menufunctions.h (c) 2008 Micro-key bv
|
||||
* ---------------------------------------------------------------------------
|
||||
* Micro-key bv
|
||||
* Industrieweg 28, 9804 TG Noordhorn
|
||||
* Postbus 92, 9800 AB Zuidhorn
|
||||
* The Netherlands
|
||||
* Tel: +31 594 503020
|
||||
* Fax: +31 594 505825
|
||||
* Email: support@microkey.nl
|
||||
* Web: www.microkey.nl
|
||||
* ---------------------------------------------------------------------------
|
||||
* Description:
|
||||
* ---------------------------------------------------------------------------
|
||||
* Version(s): 0.1, Nov 14, 2008, MMi
|
||||
* Creation.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef MENUFUNCTIONS_H_
|
||||
#define MENUFUNCTIONS_H_
|
||||
/* ---------------------------------------------------------------------------
|
||||
* System include files.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Application include files.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Constant and macro definitions.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Type definitions.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Variable declarations.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function declarations.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
void m_run (void);
|
||||
/*
|
||||
* INPUT AND OUTPUT SECTION
|
||||
*/
|
||||
void m_confout (void);
|
||||
void m_confin (void);
|
||||
void m_switchMux(void);
|
||||
void m_curout (void);
|
||||
void m_volout (void);
|
||||
void m_digiout (void);
|
||||
void m_volin (void);
|
||||
void m_curin (void);
|
||||
void m_digiin (void);
|
||||
void m_canread (void);
|
||||
void m_canwrite (void);
|
||||
/*
|
||||
* CALIBRATION SECTION
|
||||
*/
|
||||
void m_cvout (void);
|
||||
void m_cvin (void);
|
||||
void m_ccout (void);
|
||||
void m_ccin (void);
|
||||
void m_cdel (void);
|
||||
void m_cload (void);
|
||||
void m_c_stat (void);
|
||||
void m_c_kill (void);
|
||||
void m_c_def (void);
|
||||
void m_c_cal (void);
|
||||
void m_c_show (void);
|
||||
void m_cslave(void);
|
||||
/*
|
||||
* TEST COMMAND SECTION
|
||||
*/
|
||||
void m_battery (void);
|
||||
void m_ledtest (void);
|
||||
void m_dio (void);
|
||||
void m_aio(void);
|
||||
void m_bus (void);
|
||||
void m_cantest (void);
|
||||
void m_eeprom (void);
|
||||
void m_mmc (void);
|
||||
void m_power(void);
|
||||
void m_rtc (void);
|
||||
void m_fattest (void);
|
||||
/*
|
||||
* LOGGING SECTION
|
||||
*/
|
||||
void m_initSD (void);
|
||||
void m_sdMount (void);
|
||||
void m_logEnable (void);
|
||||
void m_logStart (void);
|
||||
void m_logStop (void);
|
||||
void m_loglist (void);
|
||||
/*
|
||||
* MISC SECTION
|
||||
*/
|
||||
void m_setRTC (void);
|
||||
void m_readRTC (void);
|
||||
void m_callRemoteFunction (void);
|
||||
void m_listLocalattachments (void);
|
||||
void m_clean(void);
|
||||
void m_tasksdelete(void);
|
||||
void m_quit(void);
|
||||
void m_help(void);
|
||||
void m_menuDebug (void);
|
||||
|
||||
|
||||
|
||||
#endif /*MENUFUNCTIONS_H_*/
|
||||
Reference in New Issue
Block a user