auto-sync

This commit is contained in:
rusEfi 2015-03-08 17:07:31 -05:00
parent 727e0a4245
commit dd4fb60dd6
9 changed files with 30 additions and 44 deletions

View File

@ -486,10 +486,18 @@ struct context {
#define port_wait_for_interrupt()
#endif
void chDbgStackOverflowPanic(Thread *otp);
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
void chDbgStackOverflowPanic(Thread *otp);
int getRemainingStack(Thread *otp);
#ifdef __cplusplus
}
#endif /* __cplusplus */
/**
* @brief Performs a context switch between two threads.
* @details This is the most critical code in any port, this function

View File

@ -112,7 +112,7 @@ static bool getConsoleLine(BaseSequentialStream *chp, char *line, unsigned size)
// todo: this is ugly as hell!
static char consoleInput[] = " ";
void (*console_line_callback)(char *);
CommandHandler console_line_callback;
static bool is_serial_over_uart;
@ -200,7 +200,7 @@ static void switchToBinaryProtocol(void) {
scheduleMsg(logger, "switching to binary protocol");
}
void startConsole(Logging *sharedLogger, void (*console_line_callback_p)(char *)) {
void startConsole(Logging *sharedLogger, CommandHandler console_line_callback_p) {
logger = sharedLogger;
console_line_callback = console_line_callback_p;

View File

@ -11,12 +11,7 @@
#include <ch.h>
#include <hal.h>
#ifndef TRUE
#define TRUE 1
#endif
#ifndef FALSE
#define FALSE 0
#endif
typedef void (*CommandHandler)(char *);
#include "efifeatures.h"
#include "datalogging.h"
@ -24,16 +19,11 @@
#define GET_CONSOLE_MODE_VALUE() palReadPad(CONSOLE_MODE_SWITCH_PORT, CONSOLE_MODE_SWITCH_PIN)
#define SHOULD_INGORE_FLASH() (palReadPad(CONFIG_RESET_SWITCH_PORT, CONFIG_RESET_SWITCH_PIN) == 0)
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
SerialDriver * getConsoleChannel(void);
void consolePutChar(int x);
void consoleOutputBuffer(const uint8_t *buf, int size);
void startConsole(Logging *sharedLogger, void (*console_line_callback_p)(char *));
void startConsole(Logging *sharedLogger, CommandHandler console_line_callback_p);
bool isSerialOverUart(void);
#if EFI_PROD_CODE || EFI_SIMULATOR || EFI_EGT
@ -42,8 +32,4 @@ bool isConsoleReady(void);
#define isConsoleReady() true
#endif
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* CONSOLE_IO_H_ */

View File

@ -15,14 +15,4 @@
void initializeConsole(Logging *sharedLogger);
void print(const char *fmt, ...);
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* RFICONSOLE_H_ */

View File

@ -97,7 +97,7 @@ extern persistent_config_container_s persistentState;
static efitimems_t previousWriteReportMs = 0;
static uint8_t crcReadBuffer[300];
static char crcReadBuffer[300];
extern uint8_t crcWriteBuffer[300];
static int ts_serial_ready(void) {
@ -405,7 +405,7 @@ void runBinaryProtocolLoop(void) {
continue;
}
recieved = chnReadTimeout(getTsSerialDevice(), crcReadBuffer, 1, MS2ST(TS_READ_TIMEOUT));
recieved = chnReadTimeout(getTsSerialDevice(), (uint8_t*)crcReadBuffer, 1, MS2ST(TS_READ_TIMEOUT));
if (recieved != 1) {
tunerStudioError("ERROR: did not receive command");
continue;
@ -526,6 +526,11 @@ void handleTestCommand(void) {
tunerStudioWriteData((const uint8_t *) " ts_p_alive\r\n", 8);
}
static void handleExecuteCommand(char *data, int incomingPacketSize) {
data[incomingPacketSize] = 0;
}
/**
* @return true if legacy command was processed, false otherwise
*/
@ -597,12 +602,14 @@ bool handlePlainCommand(uint8_t command) {
}
}
int tunerStudioHandleCrcCommand(uint8_t *data, int incomingPacketSize) {
int tunerStudioHandleCrcCommand(char *data, int incomingPacketSize) {
char command = data[0];
data++;
if (command == TS_HELLO_COMMAND || command == TS_HELLO_COMMAND_DEPRECATED) {
tunerStudioDebug("got Query command");
handleQueryCommand(TS_CRC);
} else if (command == TS_EXECUTE) {
handleExecuteCommand(data, incomingPacketSize);
} else if (command == TS_OUTPUT_COMMAND) {
handleOutputChannelsCommand(TS_CRC);
} else if (command == TS_PAGE_COMMAND) {

View File

@ -30,7 +30,7 @@ typedef struct {
} tunerstudio_counters_s;
bool handlePlainCommand(uint8_t command);
int tunerStudioHandleCrcCommand(uint8_t *data, int incomingPacketSize);
int tunerStudioHandleCrcCommand(char *data, int incomingPacketSize);
void handleTestCommand(void);
void handleQueryCommand(ts_response_format_e mode);

View File

@ -33,6 +33,7 @@ typedef enum {
#define TS_READ_COMMAND 'R'
#define TS_PAGE_COMMAND 'P'
#define TS_COMMAND_F 'F'
#define TS_EXECUTE 'E'
#define TS_SINGLE_WRITE_COMMAND 'W'
#define TS_CHUNK_WRITE_COMMAND 'C'

View File

@ -10,6 +10,8 @@
#include <math.h>
#include "efilib.h"
#ifdef __cplusplus
extern "C"
{
@ -17,7 +19,6 @@ extern "C"
#include "global.h"
#include "efilib.h"
#include "rusefi.h"
#include "efifeatures.h"

View File

@ -26,22 +26,15 @@
// number of microseconds in one period of given frequency (per second)
#define frequency2periodUs(freq) ((1000000.0f) / (freq))
#ifndef FALSE
#define FALSE 0
#endif
#ifndef TRUE
#define TRUE (!FALSE)
#endif
#define ERROR_CODE 311223344
const char * boolToString(bool value);
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
#define ERROR_CODE 311223344
const char * boolToString(bool value);
uint32_t efiStrlen(const char *param);
int efiPow10(int param);
bool startsWith(const char *line, const char *prefix);