no-OS
Macros | Functions
no_os_pwm.c File Reference

Implementation of no_os_pwm.c. More...

#include "no_os_pwm.h"
#include "stdlib.h"
#include "no_os_error.h"
#include <drivers/tmr/adi_tmr.h>
#include <drivers/pwr/adi_pwr.h>
Include dependency graph for no_os_pwm.c:

Macros

#define NO_OS_NS_PER_SEC   1000000000
 

Functions

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. More...
 
int32_t no_os_pwm_remove (struct no_os_pwm_desc *desc)
 Free the memory allocated by axi_pwmgen_init(). More...
 
int32_t no_os_pwm_enable (struct no_os_pwm_desc *desc)
 Enable PWM generator device. More...
 
int32_t no_os_pwm_disable (struct no_os_pwm_desc *desc)
 Disable PWM generator device. More...
 
int32_t no_os_pwm_set_period (struct no_os_pwm_desc *desc, uint32_t period_ns)
 Set period of PWM generator device. More...
 
int32_t no_os_pwm_get_period (struct no_os_pwm_desc *desc, uint32_t *period_ns)
 Get period of PWM generator device. More...
 
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. More...
 
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. More...
 
int32_t no_os_pwm_set_polarity (struct no_os_pwm_desc *desc, enum no_os_pwm_polarity polarity)
 
int32_t no_os_pwm_get_polarity (struct no_os_pwm_desc *desc, enum no_os_pwm_polarity *polarity)
 

Detailed Description

Implementation of no_os_pwm.c.

Author
Mihail Chindris (mihai.nosp@m.l.ch.nosp@m.indri.nosp@m.s@an.nosp@m.alog..nosp@m.com)

Copyright 2020(c) Analog Devices, Inc.

All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Macro Definition Documentation

◆ NO_OS_NS_PER_SEC

#define NO_OS_NS_PER_SEC   1000000000

Function Documentation

◆ no_os_pwm_disable()

int32_t no_os_pwm_disable ( struct no_os_pwm_desc desc)

Disable PWM generator device.

Parameters
[in]desc- Decriptor containing PWM generator parameters.
Returns
0 in case of success, -1 otherwise.
Here is the caller graph for this function:

◆ no_os_pwm_enable()

int32_t no_os_pwm_enable ( struct no_os_pwm_desc desc)

Enable PWM generator device.

Parameters
[in]desc- Decriptor containing PWM generator parameters.
Returns
0 in case of success, -1 otherwise.
Here is the caller graph for this function:

◆ 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.

Parameters
[in]desc- Decriptor containing PWM generator parameters.
[out]duty_cycle_ns- PWM duty cycle.
Returns
0 in case of success, -1 otherwise.

◆ 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.

Parameters
[in]desc- Decriptor containing PWM generator parameters.
[out]period_ns- PWM period.
Returns
0 in case of success, -1 otherwise.

◆ no_os_pwm_get_polarity()

int32_t no_os_pwm_get_polarity ( struct no_os_pwm_desc desc,
enum no_os_pwm_polarity polarity 
)

◆ 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.

Parameters
[out]desc- Decriptor containing PWM generator parameters.
[in]param- Structure containing the PWM generator init parameters.
Returns
0 in case of success, -1 otherwise.
Here is the caller graph for this function:

◆ no_os_pwm_remove()

int32_t no_os_pwm_remove ( struct no_os_pwm_desc desc)

Free the memory allocated by axi_pwmgen_init().

Parameters
[in]desc- Pointer to the device handler.
Returns
0 in case of success, -1 otherwise
Here is the caller graph for this function:

◆ 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.

Parameters
[in]desc- Decriptor containing PWM generator parameters.
[in]duty_cycle_ns- PWM duty cycle.
Returns
0 in case of success, -1 otherwise.

◆ 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.

Parameters
[in]desc- Decriptor containing PWM generator parameters.
[in]period_ns- PWM period.
Returns
0 in case of success, -1 otherwise.

◆ no_os_pwm_set_polarity()

int32_t no_os_pwm_set_polarity ( struct no_os_pwm_desc desc,
enum no_os_pwm_polarity  polarity 
)