auto-sync
This commit is contained in:
parent
99394e436a
commit
11898863e2
|
@ -0,0 +1,18 @@
|
|||
/**
|
||||
* @file efiGpio.cpp
|
||||
*
|
||||
* @date Sep 26, 2014
|
||||
* @author Andrey Belomutskiy, (c) 2012-2014
|
||||
*/
|
||||
|
||||
#include "main.h"
|
||||
#include "efiGpio.h"
|
||||
#include "io_pins.h"
|
||||
|
||||
// todo: clean this mess, this should become 'static'/private
|
||||
OutputPin outputs[IO_PIN_COUNT];
|
||||
|
||||
|
||||
int getLogicPinValue(OutputPin * outputPin) {
|
||||
return outputPin->currentLogicValue;
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
/**
|
||||
* @file efiGpio.h
|
||||
*
|
||||
* @date Sep 26, 2014
|
||||
* @author Andrey Belomutskiy, (c) 2012-2014
|
||||
*/
|
||||
#ifndef EFIGPIO_H_
|
||||
#define EFIGPIO_H_
|
||||
|
||||
#include "main.h"
|
||||
|
||||
/**
|
||||
* @brief Single output pin reference and state
|
||||
*/
|
||||
typedef struct {
|
||||
#if EFI_PROD_CODE
|
||||
GPIO_TypeDef *port;
|
||||
int pin;
|
||||
#endif /* EFI_PROD_CODE */
|
||||
/**
|
||||
* we track current pin status so that we do not touch the actual hardware if we want to write new pin bit
|
||||
* which is same as current pin value. This maybe helps in case of status leds, but maybe it's a total over-engineering
|
||||
*/
|
||||
int currentLogicValue;
|
||||
} OutputPin;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
int getLogicPinValue(OutputPin * outputPin);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* EFIGPIO_H_ */
|
|
@ -4,4 +4,5 @@ SYSTEMSRC = \
|
|||
|
||||
SYSTEMSRC_CPP = $(PROJECT_DIR)/controllers/system/pwm_generator_logic.cpp \
|
||||
$(PROJECT_DIR)/controllers/system/event_queue.cpp \
|
||||
$(PROJECT_DIR)/controllers/system/efiGpio.cpp \
|
||||
$(PROJECT_DIR)/controllers/system/SingleTimerExecutor.cpp
|
|
@ -47,10 +47,6 @@ void initOutputPin(const char *msg, OutputPin *outputPin, GPIO_TypeDef *port, ui
|
|||
initOutputPinExt(msg, outputPin, port, pinNumber, PAL_MODE_OUTPUT_PUSHPULL);
|
||||
}
|
||||
|
||||
int getLogicPinValue(OutputPin * outputPin) {
|
||||
return outputPin->currentLogicValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set's the value of the pin. On this layer the value is assigned as is, without any conversion.
|
||||
*/
|
||||
|
|
|
@ -9,25 +9,12 @@
|
|||
#ifndef GPIO_HELPER_H_
|
||||
#define GPIO_HELPER_H_
|
||||
|
||||
#include "efiGpio.h"
|
||||
|
||||
#define INITIAL_PIN_STATE -1
|
||||
|
||||
|
||||
/**
|
||||
* @brief Single output pin reference and state
|
||||
*/
|
||||
typedef struct {
|
||||
GPIO_TypeDef *port;
|
||||
int pin;
|
||||
/**
|
||||
* we track current pin status so that we do not touch the actual hardware if we want to write new pin bit
|
||||
* which is same as current pin value. This maybe helps in case of status leds, but maybe it's a total over-engineering
|
||||
*/
|
||||
int currentLogicValue;
|
||||
} OutputPin;
|
||||
|
||||
void initOutputPin(const char *msg, OutputPin *outputPin, GPIO_TypeDef *port, uint32_t pinNumber);
|
||||
void initOutputPinExt(const char *msg, OutputPin *outputPin, GPIO_TypeDef *port, uint32_t pinNumber, iomode_t mode);
|
||||
int getLogicPinValue(OutputPin * outputPin);
|
||||
void setPinValue(OutputPin * outputPin, int electricalValue, int logicValue);
|
||||
|
||||
#endif /* GPIO_HELPER_H_ */
|
||||
|
|
|
@ -26,7 +26,7 @@ extern board_configuration_s *boardConfiguration;
|
|||
static Logging logger;
|
||||
|
||||
static pin_output_mode_e *pinDefaultState[IO_PIN_COUNT];
|
||||
static OutputPin outputs[IO_PIN_COUNT];
|
||||
extern OutputPin outputs[IO_PIN_COUNT];
|
||||
static io_pin_e leds[] = { LED_WARNING, LED_RUNNING, LED_ERROR, LED_COMMUNICATION_1, LED_DEBUG, LED_EXT_1,
|
||||
LED_CHECK_ENGINE };
|
||||
|
||||
|
|
|
@ -235,5 +235,5 @@ void firmwareError(const char *fmt, ...) {
|
|||
}
|
||||
|
||||
int getRusEfiVersion(void) {
|
||||
return 20140925;
|
||||
return 20140926;
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include "main.h"
|
||||
#include "chprintf.h"
|
||||
#include "rusEfiFunctionalTest.h"
|
||||
#include "framework.h"
|
||||
|
||||
#define SHELL_WA_SIZE THD_WA_SIZE(4096)
|
||||
#define CONSOLE_WA_SIZE THD_WA_SIZE(4096)
|
||||
|
|
|
@ -5,5 +5,73 @@
|
|||
* @author Andrey Belomutskiy, (c) 2012-2014
|
||||
*/
|
||||
|
||||
#include "main.h"
|
||||
#include "framework.h"
|
||||
|
||||
uint64_t getTimeNowNt(void) {
|
||||
return getTimeNowUs() * US_TO_NT_MULTIPLIER;
|
||||
}
|
||||
|
||||
uint64_t getTimeNowUs(void) {
|
||||
return chTimeNow() * (1000000 / CH_FREQUENCY);
|
||||
}
|
||||
|
||||
efitimems_t currentTimeMillis(void) {
|
||||
return getTimeNowUs() / 1000;
|
||||
}
|
||||
|
||||
int getTimeNowSeconds(void) {
|
||||
return chTimeNow() / CH_FREQUENCY;
|
||||
}
|
||||
|
||||
int getRusEfiVersion(void) {
|
||||
return 239;
|
||||
}
|
||||
|
||||
static size_t wt_writes(void *ip, const uint8_t *bp, size_t n) {
|
||||
printToWin32Console((char*)bp);
|
||||
return CONSOLE_PORT->vmt->write(CONSOLE_PORT, bp, n);
|
||||
}
|
||||
|
||||
static size_t wt_reads(void *ip, uint8_t *bp, size_t n) {
|
||||
return CONSOLE_PORT->vmt->read(CONSOLE_PORT, bp, n);
|
||||
}
|
||||
|
||||
static msg_t wt_putt(void *instance, uint8_t b, systime_t time) {
|
||||
return CONSOLE_PORT->vmt->putt(CONSOLE_PORT, b, time);
|
||||
}
|
||||
|
||||
static msg_t wt_gett(void *instance, systime_t time) {
|
||||
return CONSOLE_PORT->vmt->gett(CONSOLE_PORT, time);
|
||||
}
|
||||
|
||||
static size_t wt_writet(void *instance, const uint8_t *bp,
|
||||
size_t n, systime_t time) {
|
||||
return CONSOLE_PORT->vmt->writet(CONSOLE_PORT, bp, n, time);
|
||||
}
|
||||
|
||||
static size_t wt_readt(void *instance, uint8_t *bp, size_t n, systime_t time) {
|
||||
return CONSOLE_PORT->vmt->readt(CONSOLE_PORT, bp, n, time);
|
||||
}
|
||||
|
||||
static char putMessageBuffer[2];
|
||||
|
||||
static msg_t wt_put(void *ip, uint8_t b) {
|
||||
putMessageBuffer[0] = b;
|
||||
putMessageBuffer[1] = 0;
|
||||
printToWin32Console((char*)putMessageBuffer);
|
||||
// cputs("wt_put");
|
||||
return CONSOLE_PORT->vmt->put(CONSOLE_PORT, b);
|
||||
}
|
||||
|
||||
static msg_t wt_get(void *ip) {
|
||||
// cputs("wt_get");
|
||||
//return 0;
|
||||
return CONSOLE_PORT->vmt->get(CONSOLE_PORT);
|
||||
}
|
||||
|
||||
static const struct Win32TestStreamVMT vmt = { wt_writes, wt_reads, wt_put, wt_get, wt_putt, wt_gett, wt_writet, wt_readt };
|
||||
|
||||
void initTestStream(TestStream *ts) {
|
||||
ts->vmt = &vmt;
|
||||
}
|
||||
|
|
|
@ -7,8 +7,15 @@
|
|||
#ifndef FRAMEWORK_H_
|
||||
#define FRAMEWORK_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
void initTestStream(TestStream *ts);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* FRAMEWORK_H_ */
|
||||
|
|
|
@ -103,54 +103,6 @@ void printPendingMessages(void) {
|
|||
waveChart.publishChartIfFull();
|
||||
}
|
||||
|
||||
static size_t wt_writes(void *ip, const uint8_t *bp, size_t n) {
|
||||
printToWin32Console((char*)bp);
|
||||
return CONSOLE_PORT->vmt->write(CONSOLE_PORT, bp, n);
|
||||
}
|
||||
|
||||
static size_t wt_reads(void *ip, uint8_t *bp, size_t n) {
|
||||
return CONSOLE_PORT->vmt->read(CONSOLE_PORT, bp, n);
|
||||
}
|
||||
|
||||
static msg_t wt_putt(void *instance, uint8_t b, systime_t time) {
|
||||
return CONSOLE_PORT->vmt->putt(CONSOLE_PORT, b, time);
|
||||
}
|
||||
|
||||
static msg_t wt_gett(void *instance, systime_t time) {
|
||||
return CONSOLE_PORT->vmt->gett(CONSOLE_PORT, time);
|
||||
}
|
||||
|
||||
static size_t wt_writet(void *instance, const uint8_t *bp,
|
||||
size_t n, systime_t time) {
|
||||
return CONSOLE_PORT->vmt->writet(CONSOLE_PORT, bp, n, time);
|
||||
}
|
||||
|
||||
static size_t wt_readt(void *instance, uint8_t *bp, size_t n, systime_t time) {
|
||||
return CONSOLE_PORT->vmt->readt(CONSOLE_PORT, bp, n, time);
|
||||
}
|
||||
|
||||
static char putMessageBuffer[2];
|
||||
|
||||
static msg_t wt_put(void *ip, uint8_t b) {
|
||||
putMessageBuffer[0] = b;
|
||||
putMessageBuffer[1] = 0;
|
||||
printToWin32Console((char*)putMessageBuffer);
|
||||
// cputs("wt_put");
|
||||
return CONSOLE_PORT->vmt->put(CONSOLE_PORT, b);
|
||||
}
|
||||
|
||||
static msg_t wt_get(void *ip) {
|
||||
// cputs("wt_get");
|
||||
//return 0;
|
||||
return CONSOLE_PORT->vmt->get(CONSOLE_PORT);
|
||||
}
|
||||
|
||||
static const struct Win32TestStreamVMT vmt = { wt_writes, wt_reads, wt_put, wt_get, wt_putt, wt_gett, wt_writet, wt_readt };
|
||||
|
||||
void initTestStream(TestStream *ts) {
|
||||
ts->vmt = &vmt;
|
||||
}
|
||||
|
||||
int isSerialOverTcpReady;
|
||||
|
||||
bool isConsoleReady(void) {
|
||||
|
@ -190,23 +142,3 @@ SerialDriver * getConsoleChannel(void) {
|
|||
void chDbgPanic3(const char *msg, const char * file, int line) {
|
||||
onFatalError(msg, file, line);
|
||||
}
|
||||
|
||||
uint64_t getTimeNowNt(void) {
|
||||
return getTimeNowUs() * US_TO_NT_MULTIPLIER;
|
||||
}
|
||||
|
||||
uint64_t getTimeNowUs(void) {
|
||||
return chTimeNow() * (1000000 / CH_FREQUENCY);
|
||||
}
|
||||
|
||||
efitimems_t currentTimeMillis(void) {
|
||||
return getTimeNowUs() / 1000;
|
||||
}
|
||||
|
||||
int getTimeNowSeconds(void) {
|
||||
return chTimeNow() / CH_FREQUENCY;
|
||||
}
|
||||
|
||||
int getRusEfiVersion(void) {
|
||||
return 239;
|
||||
}
|
||||
|
|
|
@ -14,7 +14,6 @@ extern "C"
|
|||
#endif /* __cplusplus */
|
||||
|
||||
void rusEfiFunctionalTest(void);
|
||||
void initTestStream(TestStream *ts);
|
||||
void printPendingMessages(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
Loading…
Reference in New Issue