[stm32][lptim]lptimer is register with hwtimer, only supports pm calls,the timer function is not supported

This commit is contained in:
wdfk-prog authored and Rbb666 committed 2024-07-19 11:51:39 +08:00
1 parent a837f2b8e9
commit fccd98747e
6 files changed
+382 -95

No files matched your search

@@ -52,8 +52,10 @@ if GetDepend(['RT_USING_DAC']):
if GetDepend(['RT_USING_CAN']):
src += ['drv_can.c']
if GetDepend(['RT_USING_PM', 'SOC_SERIES_STM32L4']):
if GetDepend(['RT_USING_PM']):
src += ['drv_pm.c']
if GetDepend(['BSP_USING_LPTIM']):
src += ['drv_lptim.c']
if GetDepend('BSP_USING_SDRAM'):
@@ -0,0 +1,67 @@
/*
* Copyright (c) 2006-2024 RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2024-07-11 wdfk-prog first version
*/
#ifndef __LPTIM_CONFIG_H__
#define __LPTIM_CONFIG_H__
#include <rtthread.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifndef LPTIM_DEV_INFO_CONFIG
#define LPTIM_DEV_INFO_CONFIG \
{ \
.maxfreq = 1000000, \
.minfreq = 3000, \
.maxcnt = 0xFFFF, \
.cntmode = HWTIMER_CNTMODE_UP, \
}
#endif /* TIM_DEV_INFO_CONFIG */
#ifdef BSP_USING_LPTIM1
#ifndef LPTIM1_CONFIG
#define LPTIM1_CONFIG \
{ \
.tim_handle.Instance = LPTIM1, \
.tim_irqn = LPTIM1_IRQn, \
.name = "lptim1", \
}
#endif /* LPTIM1_CONFIG */
#endif /* BSP_USING_LPTIM1 */
#ifdef BSP_USING_LPTIM2
#ifndef LPTIM2_CONFIG
#define LPTIM2_CONFIG \
{ \
.tim_handle.Instance = LPTIM2, \
.tim_irqn = LPTIM2_IRQn, \
.name = "lptim2", \
}
#endif /* LPTIM1_CONFIG */
#endif /* BSP_USING_LPTIM1 */
#ifdef BSP_USING_LPTIM3
#ifndef LPTIM3_CONFIG
#define LPTIM3_CONFIG \
{ \
.tim_handle.Instance = LPTIM3, \
.tim_irqn = LPTIM3_IRQn, \
.name = "lptim3", \
}
#endif /* LPTIM3_CONFIG */
#endif /* BSP_USING_LPTIM3 */
#ifdef __cplusplus
}
#endif
#endif /* __LPTIM_CONFIG_H__ */
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2006-2023, RT-Thread Development Team
* Copyright (c) 2006-2024 RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
@@ -122,6 +122,7 @@ extern "C" {
#include "h7/adc_config.h"
#include "h7/dac_config.h"
#include "h7/tim_config.h"
#include "h7/lptim_config.h"
#include "h7/sdio_config.h"
#include "h7/pwm_config.h"
#include "h7/usbd_config.h"
File diff suppressed because it is too large. Load diff
@@ -1,11 +1,12 @@
/*
* Copyright (c) 2006-2023, RT-Thread Development Team
* Copyright (c) 2006-2024 RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2019-05-06 Zero-Free first version
* 2024-07-04 wdfk-prog lptimer is register with hwtimer, only supports pm calls,the timer function is not supported
*/
#ifndef __DRV_PMTIMER_H__
@@ -13,11 +14,13 @@
#include <rtthread.h>
rt_uint32_t stm32l4_lptim_get_countfreq(void);
rt_uint32_t stm32l4_lptim_get_tick_max(void);
rt_uint32_t stm32l4_lptim_get_current_tick(void);
rt_err_t stm32l4_lptim_start(rt_uint32_t load);
void stm32l4_lptim_stop(void);
/* 0x20 - 0x3F udevice control commands*/
typedef enum
{
DRV_HW_LPTIMER_CTRL_GET_TICK_MAX = 0x20, /* get the maximum tick value*/
DRV_HW_LPTIMER_CTRL_GET_FREQ = 0X21, /* get the timer frequency*/
DRV_HW_LPTIMER_CTRL_START = 0X22, /* set the timeout value*/
DRV_HW_LPTIMER_CTRL_GET_COUNT = 0X23, /* get the current count value*/
} drv_hw_lptimer_ctrl_t;
#endif /* __DRV_PMTIMER_H__ */
+17
View File
@@ -224,6 +224,23 @@ menu "On-chip Peripheral Drivers"
endif
endif
menuconfig BSP_USING_LPTIM
bool "Enable lptimer"
default n
select RT_USING_LPTIMER
select RT_USING_HWTIMER
if BSP_USING_LPTIM
config BSP_USING_LPTIM1
bool "Enable LPTIM1"
default n
config BSP_USING_LPTIM2
bool "Enable LPTIM2"
default n
config BSP_USING_LPTIM3
bool "Enable LPTIM3"
default n
endif
menuconfig BSP_USING_SPI
bool "Enable SPI"
default n