no-OS
maxim_pwm.h
Go to the documentation of this file.
1 /***************************************************************************/
39 #ifndef MAXIM_PWM_H_
40 #define MAXIM_PWM_H_
41 
42 #include "tmr.h"
43 #include "no_os_pwm.h"
44 #include "no_os_util.h"
45 
46 #define MAX_PWM_TMR_MAX_VAL NO_OS_GENMASK(15, 0)
47 #define MAX_PWM_PRESCALER_VAL(n) ((n - 1) * 16)
48 #define MAX_PWM_PRESCALER_TRUE(n) NO_OS_BIT((n) / 16)
49 #define MAX_PWM_GET_PRESCALER(n) NO_OS_BIT((n) - 1)
50 
52  mxc_gpio_vssel_t vssel;
53 };
54 
55 struct max_pwm_extra {
56  mxc_gpio_vssel_t vssel;
57  mxc_tmr_cfg_t tmr_cfg;
58 };
59 
63 extern const struct no_os_pwm_platform_ops max_pwm_ops;
64 
65 #endif // MAXIM_PWM_H_
no_os_alloc.h
no_os_pwm_desc::duty_cycle_ns
uint32_t duty_cycle_ns
Definition: no_os_pwm.h:107
no_os_pwm_init_param
Structure containing the init parameters needed by the PWM generator.
Definition: no_os_pwm.h:72
max_pwm_extra::tmr_cfg
mxc_tmr_cfg_t tmr_cfg
Definition: maxim_pwm.h:57
MAX_PWM_PRESCALER_TRUE
#define MAX_PWM_PRESCALER_TRUE(n)
Definition: maxim_pwm.h:48
no_os_pwm_desc::id
uint32_t id
Definition: no_os_pwm.h:103
no_os_units.h
Header file of Units.
max_pwm_set_period
int max_pwm_set_period(struct no_os_pwm_desc *desc, uint32_t period_ns)
Set the PWM period.
Definition: maxim_pwm.c:137
no_os_pwm_init_param::period_ns
uint32_t period_ns
Definition: no_os_pwm.h:76
NO_OS_DIV_ROUND_CLOSEST_ULL
#define NO_OS_DIV_ROUND_CLOSEST_ULL(x, y)
Definition: no_os_util.h:60
no_os_pwm_init_param::id
uint32_t id
Definition: no_os_pwm.h:74
no_os_calloc
void * no_os_calloc(size_t nitems, size_t size)
Allocate memory and return a pointer to it, set memory to 0.
Definition: chibios_alloc.c:60
MAX_PWM_TMR_MAX_VAL
#define MAX_PWM_TMR_MAX_VAL
Definition: maxim_pwm.h:46
max_pwm_get_duty_cycle
int max_pwm_get_duty_cycle(struct no_os_pwm_desc *desc, uint32_t *duty_cycle_ns)
Get the PWM duty cycle.
Definition: maxim_pwm.c:228
no_os_pwm_desc::period_ns
uint32_t period_ns
Definition: no_os_pwm.h:105
maxim_pwm.h
Maxim platform specific implementation PWM API.
max_pwm_ops
const struct no_os_pwm_platform_ops max_pwm_ops
Maxim specific PWM ops.
Definition: maxim_pwm.c:311
max_pwm_disable
int max_pwm_disable(struct no_os_pwm_desc *desc)
Disable the PWM.
Definition: maxim_pwm.c:86
maxim_pwm.h
Maxim platform specific implementation PWM API.
no_os_error.h
Error codes definition.
no_os_pwm_init_param::polarity
enum no_os_pwm_polarity polarity
Definition: no_os_pwm.h:82
MAX_PWM_GET_PRESCALER
#define MAX_PWM_GET_PRESCALER(n)
Definition: maxim_pwm.h:49
no_os_pwm_desc::polarity
enum no_os_pwm_polarity polarity
Definition: no_os_pwm.h:111
maxim_pwm.h
Maxim platform specific implementation PWM API.
maxim_pwm.h
Maxim platform specific implementation PWM API.
max_pwm_set_duty_cycle
int max_pwm_set_duty_cycle(struct no_os_pwm_desc *desc, uint32_t duty_cycle_ns)
Set the PWM duty cycle.
Definition: maxim_pwm.c:195
max_pwm_ops
const struct no_os_pwm_platform_ops max_pwm_ops
Maxim platform specific callbacks for the PWM API.
Definition: maxim_pwm.c:311
no_os_pwm_init_param::extra
void * extra
Definition: no_os_pwm.h:92
no_os_pwm_desc
Structure representing an PWM generator device.
Definition: no_os_pwm.h:99
no_os_pwm_init_param::duty_cycle_ns
uint32_t duty_cycle_ns
Definition: no_os_pwm.h:78
no_os_pwm_platform_ops
Structure holding PWM function pointers that point to the platform specific function.
Definition: no_os_pwm.h:131
no_os_pwm.h
Header file of PWM Interface.
no_os_pwm_desc::extra
void * extra
Definition: no_os_pwm.h:123
maxim_pwm.h
Maxim platform specific implementation PWM API.
no_os_free
void no_os_free(void *ptr)
Deallocate memory previously allocated by a call to no_os_calloc or no_os_malloc.
Definition: chibios_alloc.c:75
max_pwm_extra::vssel
mxc_gpio_vssel_t vssel
Definition: maxim_pwm.h:56
no_os_pwm_platform_ops::pwm_ops_enable
int32_t(* pwm_ops_enable)(struct no_os_pwm_desc *)
Definition: no_os_pwm.h:136
max_pwm_init_param::vssel
mxc_gpio_vssel_t vssel
Definition: maxim_pwm.h:52
max_pwm_init_param
Definition: maxim_pwm.h:51
max_pwm_init
int max_pwm_init(struct no_os_pwm_desc **desc, const struct no_os_pwm_init_param *param)
Initialize the PWM.
Definition: maxim_pwm.c:242
max_pwm_enable
int max_pwm_enable(struct no_os_pwm_desc *desc)
Enable the PWM.
Definition: maxim_pwm.c:74
NANO
#define NANO
Definition: no_os_units.h:56
max_pwm_remove
int max_pwm_remove(struct no_os_pwm_desc *desc)
Free the resources allocated by max_pwm_init().
Definition: maxim_pwm.c:296
no_os_util.h
Header file of utility functions.
maxim_pwm.h
Maxim platform specific implementation PWM API.
maxim_pwm.h
Maxim platform specific implementation PWM API.
MAX_PWM_PRESCALER_VAL
#define MAX_PWM_PRESCALER_VAL(n)
Definition: maxim_pwm.h:47
max_pwm_get_period
int max_pwm_get_period(struct no_os_pwm_desc *desc, uint32_t *period_ns)
Get the PWM period.
Definition: maxim_pwm.c:181
max_pwm_extra
Definition: maxim_pwm.h:55