blob: 4e15e612c13e5feab26f7bf031744ce65a91392b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
/* 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;
/* GPIO alternate function - only needed for STM32F0 family */
int gpio_alt_func;
};
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 */
|