no-OS
no_os_pwm.h
Go to the documentation of this file.
1 /***************************************************************************/
39 #ifndef _NO_OS_PWM_H_
40 #define _NO_OS_PWM_H_
41 
42 /******************************************************************************/
43 /***************************** Include Files **********************************/
44 /******************************************************************************/
45 #include <stdint.h>
46 #include <stdbool.h>
47 
48 /******************************************************************************/
49 /*************************** Types Declarations *******************************/
50 /******************************************************************************/
60 };
61 
68  uint32_t id;
70  uint32_t period_ns;
72  uint32_t duty_cycle_ns;
74  uint32_t phase_ns;
78  void *extra;
79 };
80 
87  uint32_t id;
89  uint32_t period_ns;
91  uint32_t duty_cycle_ns;
93  uint32_t phase_ns;
97  bool enabled;
99  void *extra;
100 };
101 
102 /******************************************************************************/
103 /************************ Functions Declarations ******************************/
104 /******************************************************************************/
105 /* Initialize the PWM generator device */
106 int32_t no_os_pwm_init(struct no_os_pwm_desc **desc,
107  const struct no_os_pwm_init_param *param);
108 
109 /* Free the resources used by the PWM generator device */
110 int32_t no_os_pwm_remove(struct no_os_pwm_desc *desc);
111 
112 /* Enable PWM generator device */
113 int32_t no_os_pwm_enable(struct no_os_pwm_desc *desc);
114 
115 /* Disable PWM generator device */
116 int32_t no_os_pwm_disable(struct no_os_pwm_desc *desc);
117 
118 /* Set period of PWM generator device */
119 int32_t no_os_pwm_set_period(struct no_os_pwm_desc *desc,
120  uint32_t period_ns);
121 
122 /* Get period of PWM generator device */
123 int32_t no_os_pwm_get_period(struct no_os_pwm_desc *desc,
124  uint32_t *period_ns);
125 
126 /* Set duty cycle of PWM generator device */
127 int32_t no_os_pwm_set_duty_cycle(struct no_os_pwm_desc *desc,
128  uint32_t duty_cycle_ns);
129 
130 /* Get period of PWM generator device */
131 int32_t no_os_pwm_get_duty_cycle(struct no_os_pwm_desc *desc,
132  uint32_t *duty_cycle_ns);
133 
134 /* Set the phase of PWM generator channel */
135 int32_t no_os_pwm_set_phase(struct no_os_pwm_desc *desc,
136  uint32_t phase_ns);
137 
138 /* Get the phase of PWM generator channel */
139 int32_t no_os_pwm_get_phase(struct no_os_pwm_desc *desc,
140  uint32_t *phase_ns);
141 
142 /* Set polarity of PWM generator device */
143 int32_t no_os_pwm_set_polarity(struct no_os_pwm_desc *desc,
144  enum no_os_pwm_polarity polarity);
145 
146 /* Set polarity of PWM generator device */
147 int32_t no_os_pwm_get_polarity(struct no_os_pwm_desc *desc,
148  enum no_os_pwm_polarity *polarity);
149 
150 #endif // _NO_OS_PWM_H_
no_os_pwm_desc::duty_cycle_ns
uint32_t duty_cycle_ns
Definition: no_os_pwm.h:91
no_os_pwm_init_param
Structure containing the init parameters needed by the PWM generator.
Definition: no_os_pwm.h:66
no_os_pwm_remove
int32_t no_os_pwm_remove(struct no_os_pwm_desc *desc)
Free the memory allocated by axi_pwmgen_init().
Definition: axi_pwm.c:372
no_os_pwm_desc::id
uint32_t id
Definition: no_os_pwm.h:87
no_os_pwm_init_param::period_ns
uint32_t period_ns
Definition: no_os_pwm.h:70
no_os_pwm_set_polarity
int32_t no_os_pwm_set_polarity(struct no_os_pwm_desc *desc, enum no_os_pwm_polarity polarity)
Definition: aducm3029_pwm.c:281
no_os_pwm_desc::phase_ns
uint32_t phase_ns
Definition: no_os_pwm.h:93
no_os_pwm_init_param::id
uint32_t id
Definition: no_os_pwm.h:68
no_os_pwm_polarity
no_os_pwm_polarity
Possible polarities of the PWM signal.
Definition: no_os_pwm.h:55
no_os_pwm_set_period
int32_t no_os_pwm_set_period(struct no_os_pwm_desc *desc, uint32_t period_ns)
Set period of PWM generator device.
Definition: axi_pwm.c:150
no_os_pwm_desc::period_ns
uint32_t period_ns
Definition: no_os_pwm.h:89
no_os_pwm_get_phase
int32_t no_os_pwm_get_phase(struct no_os_pwm_desc *desc, uint32_t *phase_ns)
Get phase of PWM generator device.
Definition: axi_pwm.c:266
no_os_pwm_get_period
int32_t no_os_pwm_get_period(struct no_os_pwm_desc *desc, uint32_t *period_ns)
Get period of PWM generator device.
Definition: axi_pwm.c:178
no_os_pwm_enable
int32_t no_os_pwm_enable(struct no_os_pwm_desc *desc)
Enable PWM generator device.
Definition: axi_pwm.c:107
no_os_pwm_init_param::polarity
enum no_os_pwm_polarity polarity
Definition: no_os_pwm.h:76
no_os_pwm_disable
int32_t no_os_pwm_disable(struct no_os_pwm_desc *desc)
Disable PWM generator device.
Definition: axi_pwm.c:128
no_os_pwm_set_phase
int32_t no_os_pwm_set_phase(struct no_os_pwm_desc *desc, uint32_t phase_ns)
Set phase of PWM generator device.
Definition: axi_pwm.c:239
no_os_pwm_desc::polarity
enum no_os_pwm_polarity polarity
Definition: no_os_pwm.h:95
no_os_pwm_desc::enabled
bool enabled
Definition: no_os_pwm.h:97
no_os_pwm_init_param::extra
void * extra
Definition: no_os_pwm.h:78
no_os_pwm_get_polarity
int32_t no_os_pwm_get_polarity(struct no_os_pwm_desc *desc, enum no_os_pwm_polarity *polarity)
Definition: aducm3029_pwm.c:293
NO_OS_PWM_POLARITY_HIGH
@ NO_OS_PWM_POLARITY_HIGH
Definition: no_os_pwm.h:57
no_os_pwm_set_duty_cycle
int32_t no_os_pwm_set_duty_cycle(struct no_os_pwm_desc *desc, uint32_t duty_cycle_ns)
Set duty cycle of PWM generator device.
Definition: axi_pwm.c:193
no_os_pwm_desc
Structure representing an PWM generator device.
Definition: no_os_pwm.h:85
no_os_pwm_init_param::duty_cycle_ns
uint32_t duty_cycle_ns
Definition: no_os_pwm.h:72
no_os_pwm_init
int32_t no_os_pwm_init(struct no_os_pwm_desc **desc, const struct no_os_pwm_init_param *param)
Initialize the pwm axi generator and the handler associated with it.
Definition: axi_pwm.c:280
no_os_pwm_desc::extra
void * extra
Definition: no_os_pwm.h:99
no_os_pwm_get_duty_cycle
int32_t no_os_pwm_get_duty_cycle(struct no_os_pwm_desc *desc, uint32_t *duty_cycle_ns)
Get duty cycle of PWM generator device.
Definition: axi_pwm.c:224
no_os_pwm_init_param::phase_ns
uint32_t phase_ns
Definition: no_os_pwm.h:74
NO_OS_PWM_POLARITY_LOW
@ NO_OS_PWM_POLARITY_LOW
Definition: no_os_pwm.h:59