Hardware Abstraction Layer for FreeRTOS
pwm_prv.h
Go to the documentation of this file.
1
/* SPDX-License-Identifier: MIT */
2
/*
3
* Author: Andreas Werner <kernel@andy89.org>
4
* Date: 2016
5
*/
6
#ifndef PWM_PRV_
7
#define PWM_PRV_
8
#ifndef PWM_PRV
9
# error "Never include this file out of a PWM driver"
10
#endif
11
#include <FreeRTOS.h>
12
#include <semphr.h>
13
#include <stdint.h>
14
#include <stdbool.h>
15
#include <
hal.h
>
16
#define PWM_ALREDY_INITED 1
17
int32_t
pwm_generic_init
(
struct
pwm *pwm);
18
#define PWM_ADDDEV(ns, p) HAL_ADDDEV(pwm, ns, p)
19
HAL_DEFINE_GLOBAL_ARRAY
(pwm);
20
#define PWM_GET_DEV(index) HAL_GET_DEV(pwm, index)
21
#ifndef CONFIG_PWM_MULTI
22
# define PWM_OPS(ns)
23
# define PWM_INIT_DEV(ns)
24
25
# define PWM_INIT(ns, index) struct pwm *pwm_init(uint32_t index)
26
# define PWM_DEINIT(ns, p) int32_t pwm_deinit(struct pwm *p)
27
28
# define PWM_SET_PERIOD(ns, p, us) int32_t pwm_setPeriod(struct pwm *p, uint64_t us)
29
# define PWM_SET_DUTY_CYCLE(ns, p, us) int32_t pwm_setDutyCycle(struct pwm *p, uint64_t us)
30
#else
31
# define PWM_OPS(ns) const struct pwm_ops ns##_pwm_ops = { \
32
.pwm_init = &ns##_pwm_init,\
33
.pwm_deinit = &ns##_pwm_deinit,\
34
.pwm_setPeriod = &ns##_pwm_setPeriod, \
35
.pwm_setDutyCycle = &ns##_pwm_setDutyCycle, \
36
}
37
# define PWM_INIT_DEV(ns) .gen.ops = &ns##_pwm_ops,
38
39
# define PWM_INIT(ns, index) struct pwm *ns##_pwm_init(uint32_t index)
40
# define PWM_DEINIT(ns, p) int32_t ns##_pwm_deinit(struct pwm *p)
41
42
# define PWM_SET_PERIOD(ns, p, us) int32_t ns##_pwm_setPeriod(struct pwm *p, uint64_t us)
43
# define PWM_SET_DUTY_CYCLE(ns, p, us) int32_t ns##_pwm_setDutyCycle(struct pwm *p, uint64_t us)
44
#endif
45
#endif
hal.h
HAL_DEFINE_GLOBAL_ARRAY
HAL_DEFINE_GLOBAL_ARRAY(pwm)
pwm_generic_init
int32_t pwm_generic_init(struct pwm *pwm)
driver
include
pwm_prv.h
Generated on Tue Aug 17 2021 15:19:23 for Hardware Abstraction Layer for FreeRTOS by
1.8.20