no-OS
iio_aducm3029.h
Go to the documentation of this file.
1 /***************************************************************************/
40 #ifdef IIO_SUPPORT
41 
42 #ifndef IIO_ADCUM3029
43 #define IIO_ADCUM3029
44 
45 #include "iio_types.h"
46 #include "aducm3029_adc.h"
47 
48 #define ADUCM3029_TIMERS_NUMS 3
49 #define ADUCM3029_GPIOS_NUMS 44
50 
51 struct iio_aducm3029_desc {
52  struct adc_desc *adc;
53  struct no_os_timer_desc *timer[ADUCM3029_TIMERS_NUMS];
54  struct no_os_pwm_desc *pwm[ADUCM3029_TIMERS_NUMS];
55  struct no_os_gpio_desc *gpio[ADUCM3029_GPIOS_NUMS];
56  uint32_t current_gpio;
57 };
58 
59 extern struct iio_aducm3029_desc g_aducm3029_desc;
60 extern struct iio_device const iio_aducm3029_desc;
61 
62 int get_pwm_attr(void *device, char *buf, uint32_t len,
63  const struct iio_ch_info *channel, intptr_t priv);
64 int set_pwm_attr(void *device, char *buf, uint32_t len,
65  const struct iio_ch_info *channel, intptr_t priv);
66 
67 int get_global_attr(void *device, char *buf, uint32_t len,
68  const struct iio_ch_info *channel, intptr_t priv);
69 int set_global_attr(void *device, char *buf, uint32_t len,
70  const struct iio_ch_info *channel, intptr_t priv);
71 
72 int get_gpio_attr(void *device, char *buf, uint32_t len,
73  const struct iio_ch_info *channel, intptr_t priv);
74 int set_gpio_attr(void *device, char *buf, uint32_t len,
75  const struct iio_ch_info *channel, intptr_t priv);
76 
77 int32_t iio_aducm3029_adc_set_mask(struct iio_aducm3029_desc *desc,
78  uint32_t mask);
79 int32_t iio_aducm3029_adc_read(struct iio_aducm3029_desc *desc, uint16_t *buff,
80  uint32_t nb_samples);
81 
82 enum iio_pwm_attributes {
83  PWM_ENABLE,
84  PWM_PERIOD,
85  PWM_DUTY_CYCLE,
86  PWM_POLARITY_IS_HIGH
87 };
88 
89 enum iio_gpio_attributes {
90  GPIO_ENABLE,
91  GPIO_VALUE,
92  GPIO_DIRECTION_OUTPUT,
93  GPIO_NUMBER,
94 };
95 
96 enum global_attributes {
97  PINMUX_PORT_0,
98  PINMUX_PORT_1,
99  PINMUX_PORT_2,
100  ADC_ENABLE
101 };
102 
103 #endif
104 
105 #endif //IIO_SUPPORT
adc_init_param
This can be extended in the future, no utility for the moment.
Definition: aducm3029_adc.h:55
aducm3029_pwm_ops
const struct no_os_pwm_platform_ops aducm3029_pwm_ops
ADUCM3029 platform specific PWM platform ops structure.
Definition: aducm3029_pwm.c:308
no_os_gpio_init_param
Structure holding the parameters for GPIO initialization.
Definition: no_os_gpio.h:85
END_ATTRIBUTES_ARRAY
#define END_ATTRIBUTES_ARRAY
Definition: iio_types.h:121
no_os_pwm_init_param
Structure containing the init parameters needed by the PWM generator.
Definition: no_os_pwm.h:72
PWM_PERIOD
#define PWM_PERIOD
Definition: parameters.h:101
iio_channel
Struct describing the scan type.
Definition: iio_types.h:173
adc_desc
Adc descriptor.
Definition: aducm3029_adc.c:54
GPIO_PORT
#define GPIO_PORT
Definition: parameters.h:62
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:85
iio_ch_info
Structure holding channel attributess.
Definition: iio_types.h:108
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:227
NO_OS_IS_ERR_VALUE
#define NO_OS_IS_ERR_VALUE(x)
Definition: no_os_error.h:56
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:249
device
Definition: ad9361_util.h:75
no_os_gpio_init_param::number
int32_t number
Definition: no_os_gpio.h:89
no_os_pwm_init_param::id
uint32_t id
Definition: no_os_pwm.h:74
NO_OS_ARRAY_SIZE
#define NO_OS_ARRAY_SIZE(x)
Definition: no_os_util.h:53
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:61
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:130
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:139
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:157
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:104
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:69
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:121
iio_attribute
Structure holding pointers to show and store functions.
Definition: iio_types.h:134
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:127
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:110
aducm3029_adc_remove
int32_t aducm3029_adc_remove(struct adc_desc *desc)
Dealocate resources allocated by aducm3029_adc_init.
Definition: aducm3029_adc.c:192
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:269
no_os_gpio_desc
Structure holding the GPIO descriptor.
Definition: no_os_gpio.h:102
NO_OS_PWM_POLARITY_HIGH
@ NO_OS_PWM_POLARITY_HIGH
Definition: no_os_pwm.h:63
ADUCM3029_ADC_NUM_CH
#define ADUCM3029_ADC_NUM_CH
Definition: aducm3029_adc.h:46
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:175
no_os_pwm_desc
Structure representing an PWM generator device.
Definition: no_os_pwm.h:99
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:57
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:55
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:178
no_os_pwm.h
Header file of PWM Interface.
adc_scan_type
struct scan_type adc_scan_type
Definition: iio_adc_demo.c:233
iio_channel::attributes
struct iio_attribute * attributes
Definition: iio_types.h:191
iio_types.h
Header file for iio_types.
iio_device::num_ch
uint16_t num_ch
Definition: iio_types.h:257
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:203
iio_ch_info::ch_num
int16_t ch_num
Definition: iio_types.h:110
iio_device
Structure holding channels and attributes of a device.
Definition: iio_types.h:252
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:193
no_os_gpio.h
Header file of GPIO Interface.
scan_type
Definition: iio_types.h:156
no_os_timer_desc
Structure holding timer descriptor.
Definition: no_os_timer.h:63
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:89
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:153
scan_type::realbits
uint8_t realbits
Definition: iio_types.h:160