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 "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 timer_desc *timer[ADUCM3029_TIMERS_NUMS];
54  struct pwm_desc *pwm[ADUCM3029_TIMERS_NUMS];
55  struct 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 ssize_t get_pwm_attr(void *device, char *buf, size_t len,
63  const struct iio_ch_info *channel, intptr_t priv);
64 ssize_t set_pwm_attr(void *device, char *buf, size_t len,
65  const struct iio_ch_info *channel, intptr_t priv);
66 
67 ssize_t get_global_attr(void *device, char *buf, size_t len,
68  const struct iio_ch_info *channel, intptr_t priv);
69 ssize_t set_global_attr(void *device, char *buf, size_t len,
70  const struct iio_ch_info *channel, intptr_t priv);
71 
72 ssize_t get_gpio_attr(void *device, char *buf, size_t len,
73  const struct iio_ch_info *channel, intptr_t priv);
74 ssize_t set_gpio_attr(void *device, char *buf, size_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: adc.h:55
IS_ERR_VALUE
#define IS_ERR_VALUE(x)
Definition: error.h:65
pwm_enable
int32_t pwm_enable(struct pwm_desc *desc)
Enable PWM generator device.
Definition: axi_pwm.c:107
timer_init
int32_t timer_init(struct timer_desc **desc, struct timer_init_param *param)
Initialize a instance of a timer.
Definition: timer.c:111
END_ATTRIBUTES_ARRAY
#define END_ATTRIBUTES_ARRAY
Definition: iio_types.h:107
aducm3029_adc_init
int32_t aducm3029_adc_init(struct adc_desc **desc, struct adc_init_param *param)
Allocate adc_desc and initialize adc.
Definition: adc.c:126
iio_channel
Struct describing the scan type.
Definition: iio_types.h:159
adc_desc
Adc descriptor.
Definition: adc.c:53
pwm_get_polarity
int32_t pwm_get_polarity(struct pwm_desc *desc, enum pwm_polarity *polarity)
Definition: pwm.c:293
timer_init_param
Structure holding the parameters for timer initialization.
Definition: timer.h:72
iio_ch_info
Structure holding channel attributess.
Definition: iio_types.h:94
timer_start
int32_t timer_start(struct timer_desc *desc)
Enable counting in the timer instance.
Definition: timer.c:200
PWM_POLARITY_HIGH
@ PWM_POLARITY_HIGH
Definition: pwm.h:57
pwm_get_period
int32_t pwm_get_period(struct pwm_desc *desc, uint32_t *period_ns)
Get period of PWM generator device.
Definition: axi_pwm.c:178
gpio_direction_output
int32_t gpio_direction_output(struct gpio_desc *desc, uint8_t value)
Enable the output direction of the specified GPIO.
Definition: gpio.c:124
pwm_init
int32_t pwm_init(struct pwm_desc **desc, const struct pwm_init_param *param)
Initialize the pwm axi generator and the handler associated with it.
Definition: axi_pwm.c:278
srt_to_uint32
uint32_t srt_to_uint32(const char *str)
device
Definition: ad9361_util.h:75
adc.h
Interface of adc.c.
mdelay
void mdelay(uint32_t msecs)
Wait until msecs milliseconds passed.
Definition: delay.c:129
gpio_get_direction
int32_t gpio_get_direction(struct gpio_desc *desc, uint8_t *direction)
Get the direction of the specified GPIO.
Definition: gpio.c:142
pwm_disable
int32_t pwm_disable(struct pwm_desc *desc)
Disable PWM generator device.
Definition: axi_pwm.c:128
pwm_init_param
Structure containing the init parameters needed by the PWM generator.
Definition: pwm.h:66
gpio_init_param
Structure holding the parameters for GPIO initialization.
Definition: gpio.h:71
pwm_set_duty_cycle
int32_t pwm_set_duty_cycle(struct pwm_desc *desc, uint32_t duty_cycle_ns)
Set duty cycle of PWM generator device.
Definition: axi_pwm.c:193
pwm_set_period
int32_t pwm_set_period(struct pwm_desc *desc, uint32_t period_ns)
Set period of PWM generator device.
Definition: axi_pwm.c:150
pwm_polarity
pwm_polarity
Possible polarities of the PWM signal.
Definition: pwm.h:55
timer.h
Timer control module header.
iio_attribute
Structure holding pointers to show and store functions.
Definition: iio_types.h:120
aducm3029_adc_update_active_channels
int32_t aducm3029_adc_update_active_channels(struct adc_desc *desc, uint32_t mask)
Activate adc channels.
Definition: adc.c:68
error.h
Error codes definition.
delay.h
Header file of Delay functions.
gpio_desc
Structure holding the GPIO descriptor.
Definition: gpio.h:84
timer_stop
int32_t timer_stop(struct timer_desc *desc)
Stop counting the timer instance.
Definition: timer.c:226
gpio_direction_input
int32_t gpio_direction_input(struct gpio_desc *desc)
Enable the input direction of the specified GPIO.
Definition: gpio.c:108
gpio_set_value
int32_t gpio_set_value(struct gpio_desc *desc, uint8_t value)
Set the value of the specified GPIO.
Definition: gpio.c:160
gpio_get
int32_t gpio_get(struct gpio_desc **desc, const struct gpio_init_param *param)
Obtain the GPIO decriptor.
Definition: gpio.c:55
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: adc.c:88
pwm_desc
Structure representing an PWM generator device.
Definition: pwm.h:85
adc_scan_type
struct scan_type adc_scan_type
Definition: iio_adc_demo.c:51
iio_channel::attributes
struct iio_attribute * attributes
Definition: iio_types.h:177
iio_types.h
Header file for iio_types.
iio_device::num_ch
uint16_t num_ch
Definition: iio_types.h:201
gpio_init_param::number
int32_t number
Definition: gpio.h:73
gpio.h
Header file of GPIO Interface.
NULL
#define NULL
Definition: wrapper.h:64
SUCCESS
#define SUCCESS
Definition: error.h:52
aducm3029_adc_remove
int32_t aducm3029_adc_remove(struct adc_desc *desc)
Dealocate resources allocated by aducm3029_adc_init.
Definition: adc.c:191
iio_ch_info::ch_num
int16_t ch_num
Definition: iio_types.h:96
iio_device
Structure holding channels and attributes of a device.
Definition: iio_types.h:199
timer_counter_set
int32_t timer_counter_set(struct timer_desc *desc, uint32_t new_val)
Set a new value for the timer.
Definition: timer.c:307
iio_aducm3029.h
iio description of aducm3029 uc
timer_counter_get
int32_t timer_counter_get(struct timer_desc *desc, uint32_t *counter)
Get the value the timer is at.
Definition: timer.c:254
timer_init_param::id
uint16_t id
Definition: timer.h:74
scan_type
Definition: iio_types.h:142
pwm.h
Header file of PWM Interface.
gpio_remove
int32_t gpio_remove(struct gpio_desc *desc)
Free the resources allocated by gpio_get().
Definition: gpio.c:95
pwm_init_param::id
uint32_t id
Definition: pwm.h:68
pwm_remove
int32_t pwm_remove(struct pwm_desc *desc)
Free the memory allocated by axi_pwmgen_init().
Definition: axi_pwm.c:371
udelay
void udelay(uint32_t usecs)
Wait until usecs microseconds passed.
Definition: delay.c:117
ADUCM3029_ADC_NUM_CH
#define ADUCM3029_ADC_NUM_CH
Definition: adc.h:46
gpio_get_value
int32_t gpio_get_value(struct gpio_desc *desc, uint8_t *value)
Get the value of the specified GPIO.
Definition: gpio.c:177
pwm_get_duty_cycle
int32_t pwm_get_duty_cycle(struct pwm_desc *desc, uint32_t *duty_cycle_ns)
Get duty cycle of PWM generator device.
Definition: axi_pwm.c:223
util.h
Implementation of utility functions.
FAILURE
#define FAILURE
Definition: error.h:56
pwm_set_polarity
int32_t pwm_set_polarity(struct pwm_desc *desc, enum pwm_polarity polarity)
Definition: pwm.c:281
timer_desc
Structure holding timer descriptor.
Definition: timer.h:57
scan_type::realbits
uint8_t realbits
Definition: iio_types.h:146