no-OS
iio_aducm3029.h
Go to the documentation of this file.
1 /***************************************************************************/
34 #ifdef IIO_SUPPORT
35 
36 #ifndef IIO_ADCUM3029
37 #define IIO_ADCUM3029
38 
39 #include "iio_types.h"
40 #include "aducm3029_adc.h"
41 
42 #define ADUCM3029_TIMERS_NUMS 3
43 #define ADUCM3029_GPIOS_NUMS 44
44 
45 struct iio_aducm3029_desc {
46  struct adc_desc *adc;
47  struct no_os_timer_desc *timer[ADUCM3029_TIMERS_NUMS];
48  struct no_os_pwm_desc *pwm[ADUCM3029_TIMERS_NUMS];
49  struct no_os_gpio_desc *gpio[ADUCM3029_GPIOS_NUMS];
50  uint32_t current_gpio;
51 };
52 
53 extern struct iio_aducm3029_desc g_aducm3029_desc;
54 extern struct iio_device const iio_aducm3029_desc;
55 
56 int get_pwm_attr(void *device, char *buf, uint32_t len,
57  const struct iio_ch_info *channel, intptr_t priv);
58 int set_pwm_attr(void *device, char *buf, uint32_t len,
59  const struct iio_ch_info *channel, intptr_t priv);
60 
61 int get_global_attr(void *device, char *buf, uint32_t len,
62  const struct iio_ch_info *channel, intptr_t priv);
63 int set_global_attr(void *device, char *buf, uint32_t len,
64  const struct iio_ch_info *channel, intptr_t priv);
65 
66 int get_gpio_attr(void *device, char *buf, uint32_t len,
67  const struct iio_ch_info *channel, intptr_t priv);
68 int set_gpio_attr(void *device, char *buf, uint32_t len,
69  const struct iio_ch_info *channel, intptr_t priv);
70 
71 int32_t iio_aducm3029_adc_set_mask(struct iio_aducm3029_desc *desc,
72  uint32_t mask);
73 int32_t iio_aducm3029_adc_read(struct iio_aducm3029_desc *desc, uint16_t *buff,
74  uint32_t nb_samples);
75 
76 enum iio_pwm_attributes {
77  PWM_ENABLE,
78  PWM_PERIOD,
79  PWM_DUTY_CYCLE,
80  PWM_POLARITY_IS_HIGH
81 };
82 
83 enum iio_gpio_attributes {
84  GPIO_ENABLE,
85  GPIO_VALUE,
86  GPIO_DIRECTION_OUTPUT,
87  GPIO_NUMBER,
88 };
89 
90 enum global_attributes {
91  PINMUX_PORT_0,
92  PINMUX_PORT_1,
93  PINMUX_PORT_2,
94  ADC_ENABLE
95 };
96 
97 #endif
98 
99 #endif //IIO_SUPPORT
adc_init_param
This can be extended in the future, no utility for the moment.
Definition: aducm3029_adc.h:49
aducm3029_pwm_ops
const struct no_os_pwm_platform_ops aducm3029_pwm_ops
ADUCM3029 platform specific PWM platform ops structure.
Definition: aducm3029_pwm.c:302
no_os_gpio_init_param
Structure holding the parameters for GPIO initialization.
Definition: no_os_gpio.h:79
END_ATTRIBUTES_ARRAY
#define END_ATTRIBUTES_ARRAY
Definition: iio_types.h:116
no_os_pwm_init_param
Structure containing the init parameters needed by the PWM generator.
Definition: no_os_pwm.h:66
iio_channel
Struct describing the scan type.
Definition: iio_types.h:168
adc_desc
Adc descriptor.
Definition: aducm3029_adc.c:48
GPIO_PORT
#define GPIO_PORT
Definition: parameters.h:56
no_os_pwm_remove
int32_t no_os_pwm_remove(struct no_os_pwm_desc *desc)
Free the resources allocated by no_os_pwm_init().
Definition: no_os_pwm.c:79
iio_ch_info
Structure holding channel attributess.
Definition: iio_types.h:103
no_os_gpio_get_value
int32_t no_os_gpio_get_value(struct no_os_gpio_desc *desc, uint8_t *value)
Get the value of the specified GPIO.
Definition: no_os_gpio.c:221
NO_OS_IS_ERR_VALUE
#define NO_OS_IS_ERR_VALUE(x)
Definition: no_os_error.h:50
no_os_pwm_set_polarity
int32_t no_os_pwm_set_polarity(struct no_os_pwm_desc *desc, enum no_os_pwm_polarity polarity)
Set the PWM polarity.
Definition: no_os_pwm.c:243
device
Definition: ad9361_util.h:69
no_os_gpio_init_param::number
int32_t number
Definition: no_os_gpio.h:83
no_os_pwm_init_param::id
uint32_t id
Definition: no_os_pwm.h:68
PWM_PERIOD
#define PWM_PERIOD
Definition: parameters.h:76
NO_OS_ARRAY_SIZE
#define NO_OS_ARRAY_SIZE(x)
Definition: no_os_util.h:49
no_os_str_to_uint32
uint32_t no_os_str_to_uint32(const char *str)
no_os_pwm_polarity
no_os_pwm_polarity
Possible polarities of the PWM signal.
Definition: no_os_pwm.h:55
no_os_gpio_direction_input
int32_t no_os_gpio_direction_input(struct no_os_gpio_desc *desc)
Enable the input direction of the specified GPIO.
Definition: no_os_gpio.c:124
no_os_pwm_set_period
int32_t no_os_pwm_set_period(struct no_os_pwm_desc *desc, uint32_t period_ns)
Set the PWM period value.
Definition: no_os_pwm.c:133
no_os_pwm_get_period
int32_t no_os_pwm_get_period(struct no_os_pwm_desc *desc, uint32_t *period_ns)
Get the PWM period value.
Definition: no_os_pwm.c:151
no_os_error.h
Error codes definition.
no_os_pwm_enable
int32_t no_os_pwm_enable(struct no_os_pwm_desc *desc)
Enable PWM signal generation.
Definition: no_os_pwm.c:98
aducm3029_adc_update_active_channels
int32_t aducm3029_adc_update_active_channels(struct adc_desc *desc, uint32_t mask)
Activate adc channels.
Definition: aducm3029_adc.c:63
aducm3029_pwm.h
Header file for aducm3029 pwm specifics.
no_os_pwm_disable
int32_t no_os_pwm_disable(struct no_os_pwm_desc *desc)
Disable PWM signal generation.
Definition: no_os_pwm.c:115
iio_attribute
Structure holding pointers to show and store functions.
Definition: iio_types.h:129
aducm3029_adc_init
int32_t aducm3029_adc_init(struct adc_desc **desc, struct adc_init_param *param)
Allocate adc_desc and initialize adc.
Definition: aducm3029_adc.c:121
no_os_gpio_remove
int32_t no_os_gpio_remove(struct no_os_gpio_desc *desc)
Free the resources allocated by no_os_gpio_get().
Definition: no_os_gpio.c:104
aducm3029_adc_remove
int32_t aducm3029_adc_remove(struct adc_desc *desc)
Dealocate resources allocated by aducm3029_adc_init.
Definition: aducm3029_adc.c:186
no_os_pwm_get_polarity
int32_t no_os_pwm_get_polarity(struct no_os_pwm_desc *desc, enum no_os_pwm_polarity *polarity)
Get the PWM polarity.
Definition: no_os_pwm.c:263
no_os_gpio_desc
Structure holding the GPIO descriptor.
Definition: no_os_gpio.h:96
NO_OS_PWM_POLARITY_HIGH
@ NO_OS_PWM_POLARITY_HIGH
Definition: no_os_pwm.h:57
ADUCM3029_ADC_NUM_CH
#define ADUCM3029_ADC_NUM_CH
Definition: aducm3029_adc.h:40
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 the PWM duty cycle.
Definition: no_os_pwm.c:169
no_os_pwm_desc
Structure representing an PWM generator device.
Definition: no_os_pwm.h:93
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 peripheral.
Definition: no_os_pwm.c:51
no_os_gpio_get
int32_t no_os_gpio_get(struct no_os_gpio_desc **desc, const struct no_os_gpio_init_param *param)
Obtain the GPIO decriptor.
Definition: no_os_gpio.c:49
no_os_gpio_get_direction
int32_t no_os_gpio_get_direction(struct no_os_gpio_desc *desc, uint8_t *direction)
Get the direction of the specified GPIO.
Definition: no_os_gpio.c:172
no_os_pwm.h
Header file of PWM Interface.
adc_scan_type
struct scan_type adc_scan_type
Definition: iio_adc_demo.c:227
iio_channel::attributes
struct iio_attribute * attributes
Definition: iio_types.h:186
iio_types.h
Header file for iio_types.
iio_device::num_ch
uint16_t num_ch
Definition: iio_types.h:252
aducm3029_adc.h
Interface of aducm3029_adc.c.
NULL
#define NULL
Definition: wrapper.h:64
no_os_gpio_set_value
int32_t no_os_gpio_set_value(struct no_os_gpio_desc *desc, uint8_t value)
Set the value of the specified GPIO.
Definition: no_os_gpio.c:197
iio_ch_info::ch_num
int16_t ch_num
Definition: iio_types.h:105
iio_device
Structure holding channels and attributes of a device.
Definition: iio_types.h:247
iio_aducm3029.h
iio description of aducm3029 uc
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 the PWM duty cycle.
Definition: no_os_pwm.c:187
no_os_gpio.h
Header file of GPIO Interface.
scan_type
Definition: iio_types.h:151
no_os_timer_desc
Structure holding timer descriptor.
Definition: no_os_timer.h:57
aducm3029_adc_read
int32_t aducm3029_adc_read(struct adc_desc *desc, uint16_t *buff, uint32_t nb_samples)
Read adc data. aducm3029_adc_update_active_channels should be called in order to enable channeles.
Definition: aducm3029_adc.c:83
no_os_util.h
Header file of utility functions.
no_os_gpio_direction_output
int32_t no_os_gpio_direction_output(struct no_os_gpio_desc *desc, uint8_t value)
Enable the output direction of the specified GPIO.
Definition: no_os_gpio.c:147
scan_type::realbits
uint8_t realbits
Definition: iio_types.h:155