better code names & more performance info
This commit is contained in:
parent
5d476d79a4
commit
ffc9cf72e4
|
@ -1876,16 +1876,16 @@ typedef enum {
|
||||||
CUSTOM_ERR_ADC_USED = 6517,
|
CUSTOM_ERR_ADC_USED = 6517,
|
||||||
CUSTOM_ERR_ADC_DEPTH_SLOW = 6518,
|
CUSTOM_ERR_ADC_DEPTH_SLOW = 6518,
|
||||||
CUSTOM_ERR_ADC_DEPTH_FAST = 6519,
|
CUSTOM_ERR_ADC_DEPTH_FAST = 6519,
|
||||||
CUSTOM_ERR_6520 = 6520,
|
CUSTOM_ERR_ICU = 6520,
|
||||||
CUSTOM_ERR_6521 = 6521,
|
CUSTOM_ERR_ICU_AF = 6521,
|
||||||
CUSTOM_ERR_6522 = 6522,
|
CUSTOM_ERR_ICU_DRIVER = 6522,
|
||||||
CUSTOM_ERR_6523 = 6523,
|
CUSTOM_ERR_ICU_PIN = 6523,
|
||||||
CUSTOM_ERR_UNEXPECTED_SPI = 6524,
|
CUSTOM_ERR_UNEXPECTED_SPI = 6524,
|
||||||
CUSTOM_ERR_EXT_MODE = 6525,
|
CUSTOM_ERR_EXT_MODE = 6525,
|
||||||
CUSTOM_ERR_TIMER_OVERFLOW = 6526,
|
CUSTOM_ERR_TIMER_OVERFLOW = 6526,
|
||||||
CUSTOM_ERR_6527 = 6527,
|
CUSTOM_ERR_NULL_TIMER_CALLBACK = 6527,
|
||||||
CUSTOM_ERR_6528 = 6528,
|
CUSTOM_ERR_SCHEDULING_ERROR = 6528,
|
||||||
CUSTOM_ERR_6529 = 6529,
|
CUSTOM_ERR_LOGGING_NOT_READY = 6529,
|
||||||
CUSTOM_ERR_6530 = 6530,
|
CUSTOM_ERR_6530 = 6530,
|
||||||
CUSTOM_ERR_6531 = 6531,
|
CUSTOM_ERR_6531 = 6531,
|
||||||
CUSTOM_ERR_6532 = 6532,
|
CUSTOM_ERR_6532 = 6532,
|
||||||
|
|
|
@ -390,6 +390,7 @@ extern uint32_t maxLockTime;
|
||||||
extern uint32_t maxEventQueueTime;
|
extern uint32_t maxEventQueueTime;
|
||||||
extern uint32_t hipLastExecutionCount;
|
extern uint32_t hipLastExecutionCount;
|
||||||
extern uint32_t hwSetTimerTime;
|
extern uint32_t hwSetTimerTime;
|
||||||
|
extern uint32_t maxPrecisionTCallbackDuration;
|
||||||
|
|
||||||
extern int maxHowFarOff;
|
extern int maxHowFarOff;
|
||||||
extern uint32_t *cyccnt;
|
extern uint32_t *cyccnt;
|
||||||
|
@ -400,6 +401,7 @@ extern int vvtEventFallCounter;
|
||||||
void resetMaxValues() {
|
void resetMaxValues() {
|
||||||
#if (EFI_PROD_CODE || EFI_SIMULATOR) || defined(__DOXYGEN__)
|
#if (EFI_PROD_CODE || EFI_SIMULATOR) || defined(__DOXYGEN__)
|
||||||
maxEventQueueTime = triggerMaxDuration = 0;
|
maxEventQueueTime = triggerMaxDuration = 0;
|
||||||
|
maxPrecisionTCallbackDuration = 0;
|
||||||
#endif /* EFI_PROD_CODE || EFI_SIMULATOR */
|
#endif /* EFI_PROD_CODE || EFI_SIMULATOR */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -501,6 +503,7 @@ void triggerInfo(void) {
|
||||||
scheduleMsg(logger, "hwSetTimerTime %d", hwSetTimerTime);
|
scheduleMsg(logger, "hwSetTimerTime %d", hwSetTimerTime);
|
||||||
|
|
||||||
scheduleMsg(logger, "totalTriggerHandlerMaxTime=%d", triggerMaxDuration);
|
scheduleMsg(logger, "totalTriggerHandlerMaxTime=%d", triggerMaxDuration);
|
||||||
|
scheduleMsg(logger, "maxPrecisionTCallbackDuration=%d", maxPrecisionTCallbackDuration);
|
||||||
resetMaxValues();
|
resetMaxValues();
|
||||||
|
|
||||||
#endif /* EFI_PROD_CODE */
|
#endif /* EFI_PROD_CODE */
|
||||||
|
|
|
@ -34,7 +34,7 @@ static digital_input_s * finddigital_input_s(ICUDriver *driver) {
|
||||||
return ®isteredIcus.elements[i];
|
return ®isteredIcus.elements[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
firmwareError(CUSTOM_ERR_6520, "reader not found");
|
firmwareError(CUSTOM_ERR_ICU, "reader not found");
|
||||||
return (digital_input_s *) NULL;
|
return (digital_input_s *) NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ static void icuPeriordCallBack(ICUDriver *driver) {
|
||||||
|
|
||||||
static uint32_t getAlternateFunctions(ICUDriver *driver) {
|
static uint32_t getAlternateFunctions(ICUDriver *driver) {
|
||||||
if (driver == NULL) {
|
if (driver == NULL) {
|
||||||
firmwareError(CUSTOM_ERR_6521, "getAlternateFunctions(NULL)");
|
firmwareError(CUSTOM_ERR_ICU_AF, "getAlternateFunctions(NULL)");
|
||||||
return 0xffffffff;
|
return 0xffffffff;
|
||||||
}
|
}
|
||||||
#if STM32_ICU_USE_TIM1
|
#if STM32_ICU_USE_TIM1
|
||||||
|
@ -88,7 +88,7 @@ static uint32_t getAlternateFunctions(ICUDriver *driver) {
|
||||||
return GPIO_AF_TIM9;
|
return GPIO_AF_TIM9;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
firmwareError(CUSTOM_ERR_6522, "No such driver");
|
firmwareError(CUSTOM_ERR_ICU_DRIVER, "No such driver");
|
||||||
return 0xffffffff;
|
return 0xffffffff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,7 +115,7 @@ icuchannel_t getInputCaptureChannel(brain_pin_e hwPin) {
|
||||||
case GPIOE_11: // TIM1
|
case GPIOE_11: // TIM1
|
||||||
return ICU_CHANNEL_2;
|
return ICU_CHANNEL_2;
|
||||||
default:
|
default:
|
||||||
firmwareError(CUSTOM_ERR_6523, "Unexpected hw pin in getInputCaptureChannel %s", hwPortname(hwPin));
|
firmwareError(CUSTOM_ERR_ICU_PIN, "Unexpected hw pin in getInputCaptureChannel %s", hwPortname(hwPin));
|
||||||
return ICU_CHANNEL_1;
|
return ICU_CHANNEL_1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,9 @@
|
||||||
// https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=https%3a%2f%2fmy.st.com%2fpublic%2fSTe2ecommunities%2fmcu%2fLists%2fcortex_mx_stm32%2fInterrupt%20on%20CEN%20bit%20setting%20in%20TIM7&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B¤tviews=474
|
// https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=https%3a%2f%2fmy.st.com%2fpublic%2fSTe2ecommunities%2fmcu%2fLists%2fcortex_mx_stm32%2fInterrupt%20on%20CEN%20bit%20setting%20in%20TIM7&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B¤tviews=474
|
||||||
|
|
||||||
#if (EFI_PROD_CODE && HAL_USE_GPT) || defined(__DOXYGEN__)
|
#if (EFI_PROD_CODE && HAL_USE_GPT) || defined(__DOXYGEN__)
|
||||||
|
#include "efilib2.h"
|
||||||
|
|
||||||
|
uint32_t maxPrecisionTCallbackDuration = 0;
|
||||||
|
|
||||||
#define GPTDEVICE GPTD5
|
#define GPTDEVICE GPTD5
|
||||||
|
|
||||||
|
@ -79,7 +82,7 @@ static void callback(GPTDriver *gptp) {
|
||||||
(void)gptp;
|
(void)gptp;
|
||||||
timerCallbackCounter++;
|
timerCallbackCounter++;
|
||||||
if (globalTimerCallback == NULL) {
|
if (globalTimerCallback == NULL) {
|
||||||
firmwareError(CUSTOM_ERR_6527, "NULL globalTimerCallback");
|
firmwareError(CUSTOM_ERR_NULL_TIMER_CALLBACK, "NULL globalTimerCallback");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
isTimerPending = false;
|
isTimerPending = false;
|
||||||
|
@ -93,14 +96,19 @@ static void callback(GPTDriver *gptp) {
|
||||||
// chSysUnlockFromISR()
|
// chSysUnlockFromISR()
|
||||||
// ;
|
// ;
|
||||||
|
|
||||||
|
uint32_t before = GET_TIMESTAMP();
|
||||||
globalTimerCallback(NULL);
|
globalTimerCallback(NULL);
|
||||||
|
uint32_t precisionCallbackDuration = GET_TIMESTAMP() - before;
|
||||||
|
if (precisionCallbackDuration > maxPrecisionTCallbackDuration) {
|
||||||
|
maxPrecisionTCallbackDuration = precisionCallbackDuration;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void usTimerWatchDog(void) {
|
static void usTimerWatchDog(void) {
|
||||||
if (getTimeNowNt() >= lastSetTimerTimeNt + 2 * CORE_CLOCK) {
|
if (getTimeNowNt() >= lastSetTimerTimeNt + 2 * CORE_CLOCK) {
|
||||||
strcpy(buff, "no_event");
|
strcpy(buff, "no_event");
|
||||||
itoa10(&buff[8], lastSetTimerValue);
|
itoa10(&buff[8], lastSetTimerValue);
|
||||||
firmwareError(CUSTOM_ERR_6528, buff);
|
firmwareError(CUSTOM_ERR_SCHEDULING_ERROR, buff);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@ static bool intermediateLoggingBufferInited = false;
|
||||||
*/
|
*/
|
||||||
static ALWAYS_INLINE bool validateBuffer(Logging *logging, uint32_t extraLen) {
|
static ALWAYS_INLINE bool validateBuffer(Logging *logging, uint32_t extraLen) {
|
||||||
if (logging->buffer == NULL) {
|
if (logging->buffer == NULL) {
|
||||||
firmwareError(CUSTOM_ERR_6529, "Logging not initialized: %s", logging->name);
|
firmwareError(CUSTOM_ERR_LOGGING_NOT_READY, "Logging not initialized: %s", logging->name);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue