make some change to complie stm32_f103_onekey with new version of Chibios (#583)

This commit is contained in:
rxy0424 2018-11-07 07:08:08 +08:00 committed by hasu@tmk
parent a0b5bf4b67
commit 8345571e1d
6 changed files with 1117 additions and 909 deletions

View file

@ -8,20 +8,20 @@ void timer_clear(void) {}
uint16_t timer_read(void)
{
return (uint16_t)ST2MS(chVTGetSystemTime());
return (uint16_t)TIME_I2MS(chVTGetSystemTime());
}
uint32_t timer_read32(void)
{
return ST2MS(chVTGetSystemTime());
return TIME_I2MS(chVTGetSystemTime());
}
uint16_t timer_elapsed(uint16_t last)
{
return (uint16_t)(ST2MS(chVTTimeElapsedSinceX(MS2ST(last))));
return (uint16_t)(TIME_I2MS(chVTTimeElapsedSinceX(TIME_MS2I(last))));
}
uint32_t timer_elapsed32(uint32_t last)
{
return ST2MS(chVTTimeElapsedSinceX(MS2ST(last)));
return TIME_I2MS(chVTTimeElapsedSinceX(TIME_MS2I(last)));
}

View file

@ -963,7 +963,7 @@ static bool usb_request_hook_cb(USBDriver *usbp) {
#endif /* NKRO_ENABLE */
/* arm the idle timer if boot protocol & idle */
osalSysLockFromISR();
chVTSetI(&keyboard_idle_timer, 4*MS2ST(keyboard_idle), keyboard_idle_timer_cb, (void *)usbp);
chVTSetI(&keyboard_idle_timer, 4*TIME_MS2I(keyboard_idle), keyboard_idle_timer_cb, (void *)usbp);
osalSysUnlockFromISR();
}
}
@ -980,7 +980,7 @@ static bool usb_request_hook_cb(USBDriver *usbp) {
if(keyboard_idle) {
#endif /* NKRO_ENABLE */
osalSysLockFromISR();
chVTSetI(&keyboard_idle_timer, 4*MS2ST(keyboard_idle), keyboard_idle_timer_cb, (void *)usbp);
chVTSetI(&keyboard_idle_timer, 4*TIME_MS2I(keyboard_idle), keyboard_idle_timer_cb, (void *)usbp);
osalSysUnlockFromISR();
}
usbSetupTransfer(usbp, NULL, 0, NULL);
@ -1111,7 +1111,7 @@ static void keyboard_idle_timer_cb(void *arg) {
usbStartTransmitI(usbp, KBD_ENDPOINT, (uint8_t *)&keyboard_report_sent, KBD_EPSIZE);
}
/* rearm the timer */
chVTSetI(&keyboard_idle_timer, 4*MS2ST(keyboard_idle), keyboard_idle_timer_cb, (void *)usbp);
chVTSetI(&keyboard_idle_timer, 4*TIME_MS2I(keyboard_idle), keyboard_idle_timer_cb, (void *)usbp);
}
/* do not rearm the timer if the condition above fails
@ -1270,7 +1270,7 @@ void console_in_cb(USBDriver *usbp, usbep_t ep) {
osalSysLockFromISR();
/* rearm the timer */
chVTSetI(&console_flush_timer, MS2ST(CONSOLE_FLUSH_MS), console_flush_cb, (void *)usbp);
chVTSetI(&console_flush_timer, TIME_MS2I(CONSOLE_FLUSH_MS), console_flush_cb, (void *)usbp);
/* Freeing the buffer just transmitted, if it was not a zero size packet.*/
if (usbp->epc[CONSOLE_ENDPOINT]->in_state->txsize > 0U) {
@ -1322,7 +1322,7 @@ static void console_flush_cb(void *arg) {
/* check that the states of things are as they're supposed to */
if(usbGetDriverStateI(usbp) != USB_ACTIVE) {
/* rearm the timer */
chVTSetI(&console_flush_timer, MS2ST(CONSOLE_FLUSH_MS), console_flush_cb, (void *)usbp);
chVTSetI(&console_flush_timer, TIME_MS2I(CONSOLE_FLUSH_MS), console_flush_cb, (void *)usbp);
osalSysUnlockFromISR();
return;
}
@ -1331,7 +1331,7 @@ static void console_flush_cb(void *arg) {
started.*/
if (usbGetTransmitStatusI(usbp, CONSOLE_ENDPOINT)) {
/* rearm the timer */
chVTSetI(&console_flush_timer, MS2ST(CONSOLE_FLUSH_MS), console_flush_cb, (void *)usbp);
chVTSetI(&console_flush_timer, TIME_MS2I(CONSOLE_FLUSH_MS), console_flush_cb, (void *)usbp);
osalSysUnlockFromISR();
return;
}
@ -1351,7 +1351,7 @@ static void console_flush_cb(void *arg) {
}
/* rearm the timer */
chVTSetI(&console_flush_timer, MS2ST(CONSOLE_FLUSH_MS), console_flush_cb, (void *)usbp);
chVTSetI(&console_flush_timer, TIME_MS2I(CONSOLE_FLUSH_MS), console_flush_cb, (void *)usbp);
osalSysUnlockFromISR();
}

View file

@ -142,6 +142,7 @@ CSRC = $(STARTUPSRC) \
$(PLATFORMSRC) \
$(BOARDSRC) \
$(STREAMSSRC) \
$(LIBSRC) \
$(TMK_DIR)/protocol/chibios/usb_main.c \
$(TMK_DIR)/protocol/chibios/main.c \
$(SRC)
@ -177,7 +178,7 @@ ASMXSRC = $(STARTUPASM) $(PORTASM) $(OSALASM)
INCDIR = $(CHIBIOS)/os/license \
$(STARTUPINC) $(KERNINC) $(PORTINC) $(OSALINC) \
$(HALINC) $(PLATFORMINC) $(BOARDINC) $(TESTINC) \
$(STREAMSINC) $(CHIBIOS)/os/various \
$(STREAMSINC) $(LIBINC) $(CHIBIOS)/os/various \
$(TMK_DIR) $(COMMON_DIR) $(TMK_DIR)/protocol/chibios \
$(TMK_DIR)/protocol $(TARGET_DIR)
@ -256,6 +257,6 @@ endif
RULESPATH = $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC
ifeq ("$(wildcard $(RULESPATH)/rules.mk)","")
RULESPATH = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC
RULESPATH = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC/mk
endif
include $(RULESPATH)/rules.mk