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

File diff suppressed because it is too large Load diff

View file

@ -1,353 +1,365 @@
/* /*
ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
You may obtain a copy of the License at You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0 http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
/** /**
* @file templates/halconf.h * @file templates/halconf.h
* @brief HAL configuration header. * @brief HAL configuration header.
* @details HAL configuration file, this file allows to enable or disable the * @details HAL configuration file, this file allows to enable or disable the
* various device drivers from your application. You may also use * various device drivers from your application. You may also use
* this file in order to override the device drivers default settings. * this file in order to override the device drivers default settings.
* *
* @addtogroup HAL_CONF * @addtogroup HAL_CONF
* @{ * @{
*/ */
#ifndef _HALCONF_H_ #ifndef _HALCONF_H_
#define _HALCONF_H_ #define _HALCONF_H_
#include "mcuconf.h" #define _CHIBIOS_HAL_CONF_
#define _CHIBIOS_HAL_CONF_VER_6_0_
/**
* @brief Enables the PAL subsystem. #include "mcuconf.h"
*/
#if !defined(HAL_USE_PAL) || defined(__DOXYGEN__) /**
#define HAL_USE_PAL TRUE * @brief Enables the PAL subsystem.
#endif */
#if !defined(HAL_USE_PAL) || defined(__DOXYGEN__)
/** #define HAL_USE_PAL TRUE
* @brief Enables the ADC subsystem. #endif
*/
#if !defined(HAL_USE_ADC) || defined(__DOXYGEN__) /**
#define HAL_USE_ADC FALSE * @brief Enables the ADC subsystem.
#endif */
#if !defined(HAL_USE_ADC) || defined(__DOXYGEN__)
/** #define HAL_USE_ADC FALSE
* @brief Enables the CAN subsystem. #endif
*/
#if !defined(HAL_USE_CAN) || defined(__DOXYGEN__) /**
#define HAL_USE_CAN FALSE * @brief Enables the CAN subsystem.
#endif */
#if !defined(HAL_USE_CAN) || defined(__DOXYGEN__)
/** #define HAL_USE_CAN FALSE
* @brief Enables the DAC subsystem. #endif
*/
#if !defined(HAL_USE_DAC) || defined(__DOXYGEN__) /**
#define HAL_USE_DAC FALSE * @brief Enables the DAC subsystem.
#endif */
#if !defined(HAL_USE_DAC) || defined(__DOXYGEN__)
/** #define HAL_USE_DAC FALSE
* @brief Enables the EXT subsystem. #endif
*/
#if !defined(HAL_USE_EXT) || defined(__DOXYGEN__) /**
#define HAL_USE_EXT FALSE * @brief Enables the EXT subsystem.
#endif */
#if !defined(HAL_USE_EXT) || defined(__DOXYGEN__)
/** #define HAL_USE_EXT FALSE
* @brief Enables the GPT subsystem. #endif
*/
#if !defined(HAL_USE_GPT) || defined(__DOXYGEN__) /**
#define HAL_USE_GPT FALSE * @brief Enables the GPT subsystem.
#endif */
#if !defined(HAL_USE_GPT) || defined(__DOXYGEN__)
/** #define HAL_USE_GPT FALSE
* @brief Enables the I2C subsystem. #endif
*/
#if !defined(HAL_USE_I2C) || defined(__DOXYGEN__) /**
#define HAL_USE_I2C FALSE * @brief Enables the I2C subsystem.
#endif */
#if !defined(HAL_USE_I2C) || defined(__DOXYGEN__)
/** #define HAL_USE_I2C FALSE
* @brief Enables the I2S subsystem. #endif
*/
#if !defined(HAL_USE_I2S) || defined(__DOXYGEN__) /**
#define HAL_USE_I2S FALSE * @brief Enables the I2S subsystem.
#endif */
#if !defined(HAL_USE_I2S) || defined(__DOXYGEN__)
/** #define HAL_USE_I2S FALSE
* @brief Enables the ICU subsystem. #endif
*/
#if !defined(HAL_USE_ICU) || defined(__DOXYGEN__) /**
#define HAL_USE_ICU FALSE * @brief Enables the ICU subsystem.
#endif */
#if !defined(HAL_USE_ICU) || defined(__DOXYGEN__)
/** #define HAL_USE_ICU FALSE
* @brief Enables the MAC subsystem. #endif
*/
#if !defined(HAL_USE_MAC) || defined(__DOXYGEN__) /**
#define HAL_USE_MAC FALSE * @brief Enables the MAC subsystem.
#endif */
#if !defined(HAL_USE_MAC) || defined(__DOXYGEN__)
/** #define HAL_USE_MAC FALSE
* @brief Enables the MMC_SPI subsystem. #endif
*/
#if !defined(HAL_USE_MMC_SPI) || defined(__DOXYGEN__) /**
#define HAL_USE_MMC_SPI FALSE * @brief Enables the MMC_SPI subsystem.
#endif */
#if !defined(HAL_USE_MMC_SPI) || defined(__DOXYGEN__)
/** #define HAL_USE_MMC_SPI FALSE
* @brief Enables the PWM subsystem. #endif
*/
#if !defined(HAL_USE_PWM) || defined(__DOXYGEN__) /**
#define HAL_USE_PWM FALSE * @brief Enables the PWM subsystem.
#endif */
#if !defined(HAL_USE_PWM) || defined(__DOXYGEN__)
/** #define HAL_USE_PWM FALSE
* @brief Enables the RTC subsystem. #endif
*/
#if !defined(HAL_USE_RTC) || defined(__DOXYGEN__) /**
#define HAL_USE_RTC FALSE * @brief Enables the RTC subsystem.
#endif */
#if !defined(HAL_USE_RTC) || defined(__DOXYGEN__)
/** #define HAL_USE_RTC FALSE
* @brief Enables the SDC subsystem. #endif
*/
#if !defined(HAL_USE_SDC) || defined(__DOXYGEN__) /**
#define HAL_USE_SDC FALSE * @brief Enables the SDC subsystem.
#endif */
#if !defined(HAL_USE_SDC) || defined(__DOXYGEN__)
/** #define HAL_USE_SDC FALSE
* @brief Enables the SERIAL subsystem. #endif
*/
#if !defined(HAL_USE_SERIAL) || defined(__DOXYGEN__) /**
#define HAL_USE_SERIAL FALSE * @brief Enables the SERIAL subsystem.
#endif */
#if !defined(HAL_USE_SERIAL) || defined(__DOXYGEN__)
/** #define HAL_USE_SERIAL FALSE
* @brief Enables the SERIAL over USB subsystem. #endif
*/
#if !defined(HAL_USE_SERIAL_USB) || defined(__DOXYGEN__) /**
#define HAL_USE_SERIAL_USB FALSE * @brief Enables the SERIAL over USB subsystem.
#endif */
#if !defined(HAL_USE_SERIAL_USB) || defined(__DOXYGEN__)
/** #define HAL_USE_SERIAL_USB FALSE
* @brief Enables the SPI subsystem. #endif
*/
#if !defined(HAL_USE_SPI) || defined(__DOXYGEN__) /**
#define HAL_USE_SPI FALSE * @brief Enables the SPI subsystem.
#endif */
#if !defined(HAL_USE_SPI) || defined(__DOXYGEN__)
/** #define HAL_USE_SPI FALSE
* @brief Enables the UART subsystem. #endif
*/
#if !defined(HAL_USE_UART) || defined(__DOXYGEN__) /**
#define HAL_USE_UART FALSE * @brief Enables the UART subsystem.
#endif */
#if !defined(HAL_USE_UART) || defined(__DOXYGEN__)
/** #define HAL_USE_UART FALSE
* @brief Enables the USB subsystem. #endif
*/
#if !defined(HAL_USE_USB) || defined(__DOXYGEN__) /**
#define HAL_USE_USB TRUE * @brief Enables the USB subsystem.
#endif */
#if !defined(HAL_USE_USB) || defined(__DOXYGEN__)
/** #define HAL_USE_USB TRUE
* @brief Enables the WDG subsystem. #endif
*/
#if !defined(HAL_USE_WDG) || defined(__DOXYGEN__) /**
#define HAL_USE_WDG FALSE * @brief Enables the WDG subsystem.
#endif */
#if !defined(HAL_USE_WDG) || defined(__DOXYGEN__)
/*===========================================================================*/ #define HAL_USE_WDG FALSE
/* ADC driver related settings. */ #endif
/*===========================================================================*/
/*===========================================================================*/
/** /* ADC driver related settings. */
* @brief Enables synchronous APIs. /*===========================================================================*/
* @note Disabling this option saves both code and data space.
*/ /**
#if !defined(ADC_USE_WAIT) || defined(__DOXYGEN__) * @brief Enables synchronous APIs.
#define ADC_USE_WAIT TRUE * @note Disabling this option saves both code and data space.
#endif */
#if !defined(ADC_USE_WAIT) || defined(__DOXYGEN__)
/** #define ADC_USE_WAIT TRUE
* @brief Enables the @p adcAcquireBus() and @p adcReleaseBus() APIs. #endif
* @note Disabling this option saves both code and data space.
*/ /**
#if !defined(ADC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) * @brief Enables the @p adcAcquireBus() and @p adcReleaseBus() APIs.
#define ADC_USE_MUTUAL_EXCLUSION TRUE * @note Disabling this option saves both code and data space.
#endif */
#if !defined(ADC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
/*===========================================================================*/ #define ADC_USE_MUTUAL_EXCLUSION TRUE
/* CAN driver related settings. */ #endif
/*===========================================================================*/
/*===========================================================================*/
/** /* CAN driver related settings. */
* @brief Sleep mode related APIs inclusion switch. /*===========================================================================*/
*/
#if !defined(CAN_USE_SLEEP_MODE) || defined(__DOXYGEN__) /**
#define CAN_USE_SLEEP_MODE TRUE * @brief Sleep mode related APIs inclusion switch.
#endif */
#if !defined(CAN_USE_SLEEP_MODE) || defined(__DOXYGEN__)
/*===========================================================================*/ #define CAN_USE_SLEEP_MODE TRUE
/* I2C driver related settings. */ #endif
/*===========================================================================*/
/*===========================================================================*/
/** /* I2C driver related settings. */
* @brief Enables the mutual exclusion APIs on the I2C bus. /*===========================================================================*/
*/
#if !defined(I2C_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) /**
#define I2C_USE_MUTUAL_EXCLUSION TRUE * @brief Enables the mutual exclusion APIs on the I2C bus.
#endif */
#if !defined(I2C_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
/*===========================================================================*/ #define I2C_USE_MUTUAL_EXCLUSION TRUE
/* MAC driver related settings. */ #endif
/*===========================================================================*/
/*===========================================================================*/
/** /* MAC driver related settings. */
* @brief Enables an event sources for incoming packets. /*===========================================================================*/
*/
#if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__) /**
#define MAC_USE_ZERO_COPY FALSE * @brief Enables the zero-copy API.
#endif */
#if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__)
/** #define MAC_USE_ZERO_COPY FALSE
* @brief Enables an event sources for incoming packets. #endif
*/
#if !defined(MAC_USE_EVENTS) || defined(__DOXYGEN__) /**
#define MAC_USE_EVENTS TRUE * @brief Enables an event sources for incoming packets.
#endif */
#if !defined(MAC_USE_EVENTS) || defined(__DOXYGEN__)
/*===========================================================================*/ #define MAC_USE_EVENTS TRUE
/* MMC_SPI driver related settings. */ #endif
/*===========================================================================*/
/*===========================================================================*/
/** /* MMC_SPI driver related settings. */
* @brief Delays insertions. /*===========================================================================*/
* @details If enabled this options inserts delays into the MMC waiting
* routines releasing some extra CPU time for the threads with /**
* lower priority, this may slow down the driver a bit however. * @brief Delays insertions.
* This option is recommended also if the SPI driver does not * @details If enabled this options inserts delays into the MMC waiting
* use a DMA channel and heavily loads the CPU. * routines releasing some extra CPU time for the threads with
*/ * lower priority, this may slow down the driver a bit however.
#if !defined(MMC_NICE_WAITING) || defined(__DOXYGEN__) * This option is recommended also if the SPI driver does not
#define MMC_NICE_WAITING TRUE * use a DMA channel and heavily loads the CPU.
#endif */
#if !defined(MMC_NICE_WAITING) || defined(__DOXYGEN__)
/*===========================================================================*/ #define MMC_NICE_WAITING TRUE
/* SDC driver related settings. */ #endif
/*===========================================================================*/
/*===========================================================================*/
/** /* SDC driver related settings. */
* @brief Number of initialization attempts before rejecting the card. /*===========================================================================*/
* @note Attempts are performed at 10mS intervals.
*/ /**
#if !defined(SDC_INIT_RETRY) || defined(__DOXYGEN__) * @brief Number of initialization attempts before rejecting the card.
#define SDC_INIT_RETRY 100 * @note Attempts are performed at 10mS intervals.
#endif */
#if !defined(SDC_INIT_RETRY) || defined(__DOXYGEN__)
/** #define SDC_INIT_RETRY 100
* @brief Include support for MMC cards. #endif
* @note MMC support is not yet implemented so this option must be kept
* at @p FALSE. /**
*/ * @brief Include support for MMC cards.
#if !defined(SDC_MMC_SUPPORT) || defined(__DOXYGEN__) * @note MMC support is not yet implemented so this option must be kept
#define SDC_MMC_SUPPORT FALSE * at @p FALSE.
#endif */
#if !defined(SDC_MMC_SUPPORT) || defined(__DOXYGEN__)
/** #define SDC_MMC_SUPPORT FALSE
* @brief Delays insertions. #endif
* @details If enabled this options inserts delays into the MMC waiting
* routines releasing some extra CPU time for the threads with /**
* lower priority, this may slow down the driver a bit however. * @brief Delays insertions.
*/ * @details If enabled this options inserts delays into the MMC waiting
#if !defined(SDC_NICE_WAITING) || defined(__DOXYGEN__) * routines releasing some extra CPU time for the threads with
#define SDC_NICE_WAITING TRUE * lower priority, this may slow down the driver a bit however.
#endif */
#if !defined(SDC_NICE_WAITING) || defined(__DOXYGEN__)
/*===========================================================================*/ #define SDC_NICE_WAITING TRUE
/* SERIAL driver related settings. */ #endif
/*===========================================================================*/
/*===========================================================================*/
/** /* SERIAL driver related settings. */
* @brief Default bit rate. /*===========================================================================*/
* @details Configuration parameter, this is the baud rate selected for the
* default configuration. /**
*/ * @brief Default bit rate.
#if !defined(SERIAL_DEFAULT_BITRATE) || defined(__DOXYGEN__) * @details Configuration parameter, this is the baud rate selected for the
#define SERIAL_DEFAULT_BITRATE 38400 * default configuration.
#endif */
#if !defined(SERIAL_DEFAULT_BITRATE) || defined(__DOXYGEN__)
/** #define SERIAL_DEFAULT_BITRATE 38400
* @brief Serial buffers size. #endif
* @details Configuration parameter, you can change the depth of the queue
* buffers depending on the requirements of your application. /**
* @note The default is 64 bytes for both the transmission and receive * @brief Serial buffers size.
* buffers. * @details Configuration parameter, you can change the depth of the queue
*/ * buffers depending on the requirements of your application.
#if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__) * @note The default is 16 bytes for both the transmission and receive
#define SERIAL_BUFFERS_SIZE 16 * buffers.
#endif */
#if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__)
/*===========================================================================*/ #define SERIAL_BUFFERS_SIZE 16
/* SERIAL_USB driver related setting. */ #endif
/*===========================================================================*/
/*===========================================================================*/
/** /* SERIAL_USB driver related setting. */
* @brief Serial over USB buffers size. /*===========================================================================*/
* @details Configuration parameter, the buffer size must be a multiple of
* the USB data endpoint maximum packet size. /**
* @note The default is 64 bytes for both the transmission and receive * @brief Serial over USB buffers size.
* buffers. * @details Configuration parameter, the buffer size must be a multiple of
*/ * the USB data endpoint maximum packet size.
#if !defined(SERIAL_USB_BUFFERS_SIZE) || defined(__DOXYGEN__) * @note The default is 64 bytes for both the transmission and receive
#define SERIAL_USB_BUFFERS_SIZE 256 * buffers.
#endif */
#if !defined(SERIAL_USB_BUFFERS_SIZE) || defined(__DOXYGEN__)
/*===========================================================================*/ #define SERIAL_USB_BUFFERS_SIZE 256
/* SPI driver related settings. */ #endif
/*===========================================================================*/
/*===========================================================================*/
/** /* SPI driver related settings. */
* @brief Enables synchronous APIs. /*===========================================================================*/
* @note Disabling this option saves both code and data space.
*/ /**
#if !defined(SPI_USE_WAIT) || defined(__DOXYGEN__) * @brief Enables synchronous APIs.
#define SPI_USE_WAIT TRUE * @note Disabling this option saves both code and data space.
#endif */
#if !defined(SPI_USE_WAIT) || defined(__DOXYGEN__)
/** #define SPI_USE_WAIT TRUE
* @brief Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs. #endif
* @note Disabling this option saves both code and data space.
*/ /**
#if !defined(SPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) * @brief Enables circular transfers APIs.
#define SPI_USE_MUTUAL_EXCLUSION TRUE * @note Disabling this option saves both code and data space.
#endif */
#if !defined(SPI_USE_CIRCULAR) || defined(__DOXYGEN__)
/*===========================================================================*/ #define SPI_USE_CIRCULAR FALSE
/* USB driver related settings. */ #endif
/*===========================================================================*/
/** /**
* @brief Enables synchronous APIs. * @brief Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs.
* @note Disabling this option saves both code and data space. * @note Disabling this option saves both code and data space.
*/ */
#if !defined(USB_USE_WAIT) || defined(__DOXYGEN__) #if !defined(SPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
#define USB_USE_WAIT TRUE #define SPI_USE_MUTUAL_EXCLUSION TRUE
#endif #endif
#endif /* _HALCONF_H_ */ /*===========================================================================*/
/* USB driver related settings. */
/** @} */ /*===========================================================================*/
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(USB_USE_WAIT) || defined(__DOXYGEN__)
#define USB_USE_WAIT TRUE
#endif
#endif /* _HALCONF_H_ */
/** @} */

View file

@ -1,5 +1,5 @@
/* /*
ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -14,8 +14,8 @@
limitations under the License. limitations under the License.
*/ */
#ifndef _MCUCONF_H_ #ifndef MCUCONF_H
#define _MCUCONF_H_ #define MCUCONF_H
#define STM32F103_MCUCONF #define STM32F103_MCUCONF
@ -56,6 +56,21 @@
#define STM32_PVD_ENABLE FALSE #define STM32_PVD_ENABLE FALSE
#define STM32_PLS STM32_PLS_LEV0 #define STM32_PLS STM32_PLS_LEV0
/*
* IRQ system settings.
*/
#define STM32_IRQ_EXTI0_PRIORITY 6
#define STM32_IRQ_EXTI1_PRIORITY 6
#define STM32_IRQ_EXTI2_PRIORITY 6
#define STM32_IRQ_EXTI3_PRIORITY 6
#define STM32_IRQ_EXTI4_PRIORITY 6
#define STM32_IRQ_EXTI5_9_PRIORITY 6
#define STM32_IRQ_EXTI10_15_PRIORITY 6
#define STM32_IRQ_EXTI16_PRIORITY 6
#define STM32_IRQ_EXTI17_PRIORITY 6
#define STM32_IRQ_EXTI18_PRIORITY 6
#define STM32_IRQ_EXTI19_PRIORITY 6
/* /*
* ADC driver system settings. * ADC driver system settings.
*/ */
@ -69,21 +84,6 @@
#define STM32_CAN_USE_CAN1 FALSE #define STM32_CAN_USE_CAN1 FALSE
#define STM32_CAN_CAN1_IRQ_PRIORITY 11 #define STM32_CAN_CAN1_IRQ_PRIORITY 11
/*
* EXT driver system settings.
*/
#define STM32_EXT_EXTI0_IRQ_PRIORITY 6
#define STM32_EXT_EXTI1_IRQ_PRIORITY 6
#define STM32_EXT_EXTI2_IRQ_PRIORITY 6
#define STM32_EXT_EXTI3_IRQ_PRIORITY 6
#define STM32_EXT_EXTI4_IRQ_PRIORITY 6
#define STM32_EXT_EXTI5_9_IRQ_PRIORITY 6
#define STM32_EXT_EXTI10_15_IRQ_PRIORITY 6
#define STM32_EXT_EXTI16_IRQ_PRIORITY 6
#define STM32_EXT_EXTI17_IRQ_PRIORITY 6
#define STM32_EXT_EXTI18_IRQ_PRIORITY 6
#define STM32_EXT_EXTI19_IRQ_PRIORITY 6
/* /*
* GPT driver system settings. * GPT driver system settings.
*/ */
@ -206,4 +206,9 @@
#define STM32_USB_USB1_HP_IRQ_PRIORITY 13 #define STM32_USB_USB1_HP_IRQ_PRIORITY 13
#define STM32_USB_USB1_LP_IRQ_PRIORITY 14 #define STM32_USB_USB1_LP_IRQ_PRIORITY 14
#endif /* _MCUCONF_H_ */ /*
* WDG driver system settings.
*/
#define STM32_WDG_USE_IWDG FALSE
#endif /* MCUCONF_H */

View file

@ -8,20 +8,20 @@ void timer_clear(void) {}
uint16_t timer_read(void) uint16_t timer_read(void)
{ {
return (uint16_t)ST2MS(chVTGetSystemTime()); return (uint16_t)TIME_I2MS(chVTGetSystemTime());
} }
uint32_t timer_read32(void) uint32_t timer_read32(void)
{ {
return ST2MS(chVTGetSystemTime()); return TIME_I2MS(chVTGetSystemTime());
} }
uint16_t timer_elapsed(uint16_t last) 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) 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 */ #endif /* NKRO_ENABLE */
/* arm the idle timer if boot protocol & idle */ /* arm the idle timer if boot protocol & idle */
osalSysLockFromISR(); 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(); osalSysUnlockFromISR();
} }
} }
@ -980,7 +980,7 @@ static bool usb_request_hook_cb(USBDriver *usbp) {
if(keyboard_idle) { if(keyboard_idle) {
#endif /* NKRO_ENABLE */ #endif /* NKRO_ENABLE */
osalSysLockFromISR(); 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(); osalSysUnlockFromISR();
} }
usbSetupTransfer(usbp, NULL, 0, NULL); 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); usbStartTransmitI(usbp, KBD_ENDPOINT, (uint8_t *)&keyboard_report_sent, KBD_EPSIZE);
} }
/* rearm the timer */ /* 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 /* do not rearm the timer if the condition above fails
@ -1270,7 +1270,7 @@ void console_in_cb(USBDriver *usbp, usbep_t ep) {
osalSysLockFromISR(); osalSysLockFromISR();
/* rearm the timer */ /* 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.*/ /* Freeing the buffer just transmitted, if it was not a zero size packet.*/
if (usbp->epc[CONSOLE_ENDPOINT]->in_state->txsize > 0U) { 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 */ /* check that the states of things are as they're supposed to */
if(usbGetDriverStateI(usbp) != USB_ACTIVE) { if(usbGetDriverStateI(usbp) != USB_ACTIVE) {
/* rearm the timer */ /* 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(); osalSysUnlockFromISR();
return; return;
} }
@ -1331,7 +1331,7 @@ static void console_flush_cb(void *arg) {
started.*/ started.*/
if (usbGetTransmitStatusI(usbp, CONSOLE_ENDPOINT)) { if (usbGetTransmitStatusI(usbp, CONSOLE_ENDPOINT)) {
/* rearm the timer */ /* 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(); osalSysUnlockFromISR();
return; return;
} }
@ -1351,7 +1351,7 @@ static void console_flush_cb(void *arg) {
} }
/* rearm the timer */ /* 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(); osalSysUnlockFromISR();
} }

View file

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