diff options
Diffstat (limited to 'chip/stm32/pwm_chip.h')
-rw-r--r-- | chip/stm32/pwm_chip.h | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/chip/stm32/pwm_chip.h b/chip/stm32/pwm_chip.h new file mode 100644 index 0000000000..d588dabeaa --- /dev/null +++ b/chip/stm32/pwm_chip.h @@ -0,0 +1,37 @@ +/* Copyright (c) 2013 The Chromium OS Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* STM32-specific PWM module for Chrome EC */ + +#ifndef __CROS_EC_STM32_PWM_H +#define __CROS_EC_STM32_PWM_H + +/* Data structure to define PWM channels. */ +struct pwm_t { + /* + * Timer powering the PWM channel. Must use STM32_TIM(x) to + * initialize + */ + struct { + int id; + uintptr_t base; + } tim; + /* Channel ID within the timer */ + int channel; + /* PWM channel flags. See include/pwm.h */ + uint32_t flags; + /* GPIO pin corresponding to the PWM channel */ + enum gpio_signal pin; +}; + +extern const struct pwm_t pwm_channels[]; + +/* Macro to fill in both timer ID and register base */ +#define STM32_TIM(x) {x, STM32_TIM_BASE(x)} + +/* Plain ID mapping for readability */ +#define STM32_TIM_CH(x) (x) + +#endif /* __CROS_EC_STM32_PWM_H */ |