![]() |
no-OS
|
#include <stdlib.h>#include "no_os_pwm.h"#include "axi_pwm_extra.h"#include "no_os_axi_io.h"#include "no_os_util.h"#include "no_os_alloc.h"#include "no_os_error.h"Macros | |
| #define | AXI_PWMGEN_REG_CORE_VERSION 0x00 |
| #define | AXI_PWMGEN_REG_ID 0x04 |
| #define | AXI_PWMGEN_REG_SCRATCHPAD 0x08 |
| #define | AXI_PWMGEN_REG_CORE_MAGIC 0x0C |
| #define | AXI_PWMGEN_REG_CONFIG 0x10 |
| #define | AXI_PWMGEN_REG_NPWM 0x14 |
| #define | AXI_PWMGEN_CHX_PERIOD(p, ch) |
| #define | AXI_PWMGEN_CHX_DUTY(p, ch) |
| #define | AXI_PWMGEN_CHX_PHASE(p, ch) |
| #define | AXI_PWMGEN_TEST_DATA 0x5A0F0081 |
| #define | AXI_PWMGEN_LOAD_CONIG NO_OS_BIT(1) |
| #define | AXI_PWMGEN_RESET NO_OS_BIT(0) |
| #define | AXI_PWMGEN_CHANNEL_DISABLE 0 |
| #define | AXI_PWMGEN_MAX_CHANNELS(p) |
| #define | NSEC_PER_USEC 1000L |
| #define | USEC_PER_SEC 1000000L |
| #define | AXI_PWMGEN_VERSION_MAJOR(x) |
| #define | AXI_PWMGEN_VERSION_MINOR(x) |
| #define | AXI_PWMGEN_VERSION_PATCH(x) |
Functions | |
| int32_t | axi_pwm_enable (struct no_os_pwm_desc *desc) |
| Enable PWM generator device. | |
| int32_t | axi_pwm_disable (struct no_os_pwm_desc *desc) |
| Disable PWM generator device. | |
| int32_t | axi_pwm_set_period (struct no_os_pwm_desc *desc, uint32_t period_ns) |
| Set period of PWM generator device. | |
| int32_t | axi_pwm_get_period (struct no_os_pwm_desc *desc, uint32_t *period_ns) |
| Get period of PWM generator device. | |
| int32_t | axi_pwm_set_duty_cycle (struct no_os_pwm_desc *desc, uint32_t duty_cycle_ns) |
| Set duty cycle of PWM generator device. | |
| int32_t | axi_pwm_get_duty_cycle (struct no_os_pwm_desc *desc, uint32_t *duty_cycle_ns) |
| Get duty cycle of PWM generator device. | |
| int32_t | axi_pwm_set_phase (struct no_os_pwm_desc *desc, uint32_t phase_ns) |
| Set phase of PWM generator device. | |
| int32_t | axi_pwm_get_phase (struct no_os_pwm_desc *desc, uint32_t *phase_ns) |
| Get phase of PWM generator device. | |
| int32_t | axi_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. | |
| int32_t | axi_pwm_remove (struct no_os_pwm_desc *desc) |
| Free the memory allocated by axi_pwmgen_init(). | |
Variables | |
| const struct no_os_pwm_platform_ops | axi_pwm_ops |
| AXI platform specific PWM platform ops structure. | |
| #define AXI_PWMGEN_CHANNEL_DISABLE 0 |
| #define AXI_PWMGEN_CHX_DUTY | ( | p, | |
| ch ) |
| #define AXI_PWMGEN_CHX_PERIOD | ( | p, | |
| ch ) |
| #define AXI_PWMGEN_CHX_PHASE | ( | p, | |
| ch ) |
| #define AXI_PWMGEN_LOAD_CONIG NO_OS_BIT(1) |
| #define AXI_PWMGEN_MAX_CHANNELS | ( | p | ) |
| #define AXI_PWMGEN_REG_CONFIG 0x10 |
| #define AXI_PWMGEN_REG_CORE_MAGIC 0x0C |
| #define AXI_PWMGEN_REG_CORE_VERSION 0x00 |
| #define AXI_PWMGEN_REG_ID 0x04 |
| #define AXI_PWMGEN_REG_NPWM 0x14 |
| #define AXI_PWMGEN_REG_SCRATCHPAD 0x08 |
| #define AXI_PWMGEN_RESET NO_OS_BIT(0) |
| #define AXI_PWMGEN_TEST_DATA 0x5A0F0081 |
| #define AXI_PWMGEN_VERSION_MAJOR | ( | x | ) |
| #define AXI_PWMGEN_VERSION_MINOR | ( | x | ) |
| #define AXI_PWMGEN_VERSION_PATCH | ( | x | ) |
| #define NSEC_PER_USEC 1000L |
| #define USEC_PER_SEC 1000000L |
| int32_t axi_pwm_disable | ( | struct no_os_pwm_desc * | desc | ) |
Disable PWM generator device.
| [in] | desc | - Decriptor containing PWM generator parameters. |
| int32_t axi_pwm_enable | ( | struct no_os_pwm_desc * | desc | ) |
Enable PWM generator device.
| [in] | desc | - Decriptor containing PWM generator parameters. |
| int32_t axi_pwm_get_duty_cycle | ( | struct no_os_pwm_desc * | desc, |
| uint32_t * | duty_cycle_ns ) |
Get duty cycle of PWM generator device.
| [in] | desc | - Decriptor containing PWM generator parameters. |
| [out] | duty_cycle_ns | - PWM duty cycle. |
| int32_t axi_pwm_get_period | ( | struct no_os_pwm_desc * | desc, |
| uint32_t * | period_ns ) |
Get period of PWM generator device.
| [in] | desc | - Decriptor containing PWM generator parameters. |
| [out] | period_ns | - PWM period. |
| int32_t axi_pwm_get_phase | ( | struct no_os_pwm_desc * | desc, |
| uint32_t * | phase_ns ) |
Get phase of PWM generator device.
| [in] | desc | - Decriptor containing PWM generator parameters. |
| [out] | phase_ns | - PWM phase. |
| int32_t axi_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.
| [out] | desc | - Decriptor containing PWM generator parameters. |
| [in] | param | - Structure containing the PWM generator init parameters. |
Check if channel is out of hw available range
| int32_t axi_pwm_remove | ( | struct no_os_pwm_desc * | desc | ) |
Free the memory allocated by axi_pwmgen_init().
| [in] | desc | - Pointer to the device handler. |
| int32_t axi_pwm_set_duty_cycle | ( | struct no_os_pwm_desc * | desc, |
| uint32_t | duty_cycle_ns ) |
Set duty cycle of PWM generator device.
| [in] | desc | - Decriptor containing PWM generator parameters. |
| [in] | duty_cycle_ns | - PWM duty cycle. |
| int32_t axi_pwm_set_period | ( | struct no_os_pwm_desc * | desc, |
| uint32_t | period_ns ) |
Set period of PWM generator device.
| [in] | desc | - Decriptor containing PWM generator parameters. |
| [in] | period_ns | - PWM period. |
| int32_t axi_pwm_set_phase | ( | struct no_os_pwm_desc * | desc, |
| uint32_t | phase_ns ) |
Set phase of PWM generator device.
| [in] | desc | - Decriptor containing PWM generator parameters. |
| [in] | phase_ns | - PWM phase. |
| const struct no_os_pwm_platform_ops axi_pwm_ops |
AXI platform specific PWM platform ops structure.
AXI specific PWM platform ops structure.