[platform][stm32f7xx] replace a few of the low level ST HAL routines with lk native ones
The routines that deal with time and waiting should use LK's api and quick mucking around with the systick timer.
This commit is contained in:
@@ -239,6 +239,7 @@ __weak void HAL_MspDeInit(void)
|
||||
* @param TickPriority: Tick interrupt priority.
|
||||
* @retval HAL status
|
||||
*/
|
||||
#if 0 // disabled for LK
|
||||
__weak HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority)
|
||||
{
|
||||
/*Configure the SysTick to have interrupt in 1ms time basis*/
|
||||
@@ -250,6 +251,7 @@ __weak HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority)
|
||||
/* Return function status */
|
||||
return HAL_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @}
|
||||
@@ -278,6 +280,7 @@ __weak HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority)
|
||||
* @{
|
||||
*/
|
||||
|
||||
#if 0 // disabled for LK
|
||||
/**
|
||||
* @brief This function is called to increment a global variable "uwTick"
|
||||
* used as application time base.
|
||||
@@ -354,6 +357,7 @@ __weak void HAL_ResumeTick(void)
|
||||
/* Enable SysTick Interrupt */
|
||||
SysTick->CTRL |= SysTick_CTRL_TICKINT_Msk;
|
||||
}
|
||||
#endif // LK
|
||||
|
||||
/**
|
||||
* @brief Returns the HAL revision
|
||||
|
||||
84
platform/stm32f7xx/STM32F7xx_HAL_Driver/lk_hal.c
Normal file
84
platform/stm32f7xx/STM32F7xx_HAL_Driver/lk_hal.c
Normal file
@@ -0,0 +1,84 @@
|
||||
/*
|
||||
* Copyright (c) 2015 Travis Geiselbrecht
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files
|
||||
* (the "Software"), to deal in the Software without restriction,
|
||||
* including without limitation the rights to use, copy, modify, merge,
|
||||
* publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
* and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#include <debug.h>
|
||||
#include <platform.h>
|
||||
#include <platform/stm32.h>
|
||||
|
||||
/* overrides for certain hal routines, implemented in terms of LK's api */
|
||||
|
||||
/**
|
||||
* @brief Provides a tick value in millisecond.
|
||||
* @retval tick value
|
||||
*/
|
||||
uint32_t HAL_GetTick(void)
|
||||
{
|
||||
return current_time();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function provides accurate delay (in milliseconds) based
|
||||
* on variable incremented.
|
||||
* @param Delay: specifies the delay time length, in milliseconds.
|
||||
* @retval None
|
||||
*/
|
||||
void HAL_Delay(__IO uint32_t Delay)
|
||||
{
|
||||
spin(Delay * 1000);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Suspend Tick increment.
|
||||
* @note In the default implementation , SysTick timer is the source of time base. It is
|
||||
* used to generate interrupts at regular time intervals. Once HAL_SuspendTick()
|
||||
* is called, the the SysTick interrupt will be disabled and so Tick increment
|
||||
* is suspended.
|
||||
* @retval None
|
||||
*/
|
||||
void HAL_SuspendTick(void)
|
||||
{
|
||||
/* we don't want any one calling this */
|
||||
PANIC_UNIMPLEMENTED;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Resume Tick increment.
|
||||
* @note In the default implementation , SysTick timer is the source of time base. It is
|
||||
* used to generate interrupts at regular time intervals. Once HAL_ResumeTick()
|
||||
* is called, the the SysTick interrupt will be enabled and so Tick increment
|
||||
* is resumed.
|
||||
* @retval None
|
||||
*/
|
||||
void HAL_ResumeTick(void)
|
||||
{
|
||||
/* we don't want any one calling this */
|
||||
PANIC_UNIMPLEMENTED;
|
||||
}
|
||||
|
||||
HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority)
|
||||
{
|
||||
/* Start the systick at 10ms. The kernel will later override this */
|
||||
HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq()/10000);
|
||||
|
||||
return HAL_OK;
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@ LOCAL_DIR := $(GET_LOCAL_DIR)
|
||||
GLOBAL_INCLUDES += $(LOCAL_DIR)/Inc
|
||||
|
||||
MODULE_SRCS += \
|
||||
$(LOCAL_DIR)/lk_hal.c \
|
||||
\
|
||||
$(LOCAL_DIR)/Src/stm32f7xx_hal.c \
|
||||
$(LOCAL_DIR)/Src/stm32f7xx_hal_adc.c \
|
||||
$(LOCAL_DIR)/Src/stm32f7xx_hal_adc_ex.c \
|
||||
|
||||
Reference in New Issue
Block a user