2016-11-26 00:21:26 +08:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2016 Linaro Limited.
|
|
|
|
*
|
2017-01-19 09:01:01 +08:00
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
2016-11-26 00:21:26 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @file Header file for the STM32 PWM driver.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __PWM_STM32_H__
|
|
|
|
#define __PWM_STM32_H__
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/** Configuration data */
|
|
|
|
struct pwm_stm32_config {
|
|
|
|
uint32_t pwm_base;
|
|
|
|
/* clock subsystem driving this peripheral */
|
2017-01-24 18:09:06 +08:00
|
|
|
#ifdef CONFIG_CLOCK_CONTROL_STM32_CUBE
|
|
|
|
struct stm32_pclken pclken;
|
|
|
|
#else
|
2017-01-30 18:55:39 +08:00
|
|
|
#if defined(CONFIG_SOC_SERIES_STM32F1X)
|
2016-11-26 00:21:26 +08:00
|
|
|
clock_control_subsys_t clock_subsys;
|
|
|
|
#elif defined(CONFIG_SOC_SERIES_STM32F4X)
|
|
|
|
struct stm32f4x_pclken pclken;
|
|
|
|
#endif
|
2017-01-24 18:09:06 +08:00
|
|
|
#endif /* CONFIG_CLOCK_CONTROL_STM32_CUBE */
|
2016-11-26 00:21:26 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/** Runtime driver data */
|
|
|
|
struct pwm_stm32_data {
|
|
|
|
/* PWM peripheral handler */
|
|
|
|
TIM_HandleTypeDef hpwm;
|
|
|
|
/* Prescaler for PWM output clock
|
|
|
|
* Value used to divide the TIM clock.
|
|
|
|
* Min = 0x0000U, Max = 0xFFFFU
|
|
|
|
*/
|
|
|
|
uint32_t pwm_prescaler;
|
|
|
|
/* clock device */
|
|
|
|
struct device *clock;
|
|
|
|
};
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* __PWM_STM32_H__ */
|