19 #include <sys/types.h> 50 #define REGISTER_WITH 4 // byte 51 #define HEADER_SIZE 16 // byte 52 #define SUBHEADER_SIZE 16 // byte 53 #define STATUS_OFFSET 0x0010 // byte 54 #define CONFIG_OFFSET 0x0014 // byte 55 #define INFO_DESC_SIZE 28 // byte 56 #define PWM_BASECLK_OFFSET 0x0000 // byte 57 #define PWM_FIRSTPWM_OFFSET 0x0004 // byte 58 #define PPWA_BASECLK_OFFSET 0x0000 // byte 59 #define PPWA_FIRSTPPWA_OFFSET 0x0004 // byte 60 #define ANALOG_INPUT_FIRST_VALUE_OFFSET 0x0004 // byte 61 #define ANALOG_OUTPUT_FIRST_VALUE_OFFSET 0x0004 // byte 62 #define WD_FIRST_COUNTER_OFFSET 0x0004 // byte 65 #define NONEXCL_ACCESS 0 97 #define FLINK_OUTPUT 1 128 #define EXIT_SUCCESS 0 129 #define EXIT_ERROR -1 135 #endif // FLINKLIB_H_ uint32_t unique_id
Number of channels.
int flink_ppwa_get_period(flink_subdev *subdev, uint32_t channel, uint32_t *period)
Reads the PPWA period.
uint8_t flink_subdevice_get_function_version(flink_subdev *subdev)
Get the function version of a subdevice.
flink_dev * flink_open(const char *file_name)
Opens a flink device file.
uint8_t flink_subdevice_get_id(flink_subdev *subdev)
Get the id of a subdevice.
int flink_pwm_set_hightime(flink_subdev *subdev, uint32_t channel, uint32_t hightime)
Sets the PWM hightime.
int flink_dio_set_value(flink_subdev *subdev, uint32_t channel, uint8_t high)
Sets a output channel to a value.
int flink_close(flink_dev *dev)
Close an open flink device.
int flink_get_nof_subdevices(flink_dev *dev)
Returns the number of subdevices of a fink device.
int flink_wd_set_counter(flink_subdev *subdev, uint32_t value)
Presets the watchdog counter.
int flink_analog_in_get_value(flink_subdev *subdev, uint32_t channel, uint32_t *value)
Reads an analog input channel.
int flink_pwm_get_hightime(flink_subdev *subdev, uint32_t channel, uint32_t *hightime)
Gets the PWM hightime.
int flink_wd_arm(flink_subdev *subdev)
Starts the watchdog counter.
int flink_analog_out_get_resolution(flink_subdev *subdev, uint32_t *resolution)
Reads the resolution of a analog output subdevice.
uint32_t flink_subdevice_get_unique_id(flink_subdev *subdev)
Get the unique id of a subdevice.
ssize_t flink_read(flink_subdev *subdev, uint32_t offset, uint8_t size, void *rdata)
Read from a flink subdevice.
uint32_t flink_subdevice_get_baseaddr(flink_subdev *subdev)
Get the base address of a subdevice.
uint8_t flink_subdevice_get_subfunction(flink_subdev *subdev)
Get the subfunction of a subdevice.
int flink_ppwa_get_baseclock(flink_subdev *subdev, uint32_t *frequency)
Reads the base clock of a PPWA subdevice.
int flink_subdevice_reset(flink_subdev *subdev)
Reset a flink subdevice.
int flink_dio_get_value(flink_subdev *subdev, uint32_t channel, uint8_t *value)
Reads an input channel.
int flink_write_bit(flink_subdev *subdev, uint32_t offset, uint8_t bit, void *wdata)
Write a single bit to a flink subdevice.
int flink_ioctl(flink_dev *dev, int cmd, void *arg)
IOCTL operation for a flink device.
flink_subdev * flink_get_subdevice_by_id(flink_dev *dev, uint8_t subdev_id)
Find subdevice of a device with a given id.
int flink_info_get_description(flink_subdev *subdev, char *value)
Reads the description field of an info subdevice.
const char * flink_subdevice_id2str(uint8_t subdev_id)
int flink_read_bit(flink_subdev *subdev, uint32_t offset, uint8_t bit, void *rdata)
Read a single bit from a flink subdevice.
int flink_counter_set_mode(flink_subdev *subdev, uint8_t mode)
int flink_counter_get_count(flink_subdev *subdev, uint32_t channel, uint32_t *data)
int flink_pwm_set_period(flink_subdev *subdev, uint32_t channel, uint32_t period)
Sets the PWM period.
int flink_pwm_get_baseclock(flink_subdev *subdev, uint32_t *frequency)
Reads the base clock of a PWM subdevice.
uint32_t flink_subdevice_get_memsize(flink_subdev *subdev)
Get the memory size of a subdevice.
int flink_dio_set_direction(flink_subdev *subdev, uint32_t channel, uint8_t output)
Configures a channel as input or output.
int flink_subdevice_select(flink_subdev *subdev, uint8_t exclusive)
Select a flink subdevice for further operations.
int flink_wd_get_status(flink_subdev *subdev, uint8_t *status)
Reads the status word of a watchdog subdevice.
int flink_analog_in_get_resolution(flink_subdev *subdev, uint32_t *resolution)
Reads the resolution of a analog input subdevice.
uint16_t flink_subdevice_get_function(flink_subdev *subdev)
Get the function of a subdevice.
int flink_ppwa_get_hightime(flink_subdev *subdev, uint32_t channel, uint32_t *hightime)
Reads the PPWA hightime.
int flink_wd_get_baseclock(flink_subdev *subdev, uint32_t *base_clk)
Reads the base clock of a watchdog subdevice.
flink userspace library, strings for subdevice functions.
uint32_t flink_subdevice_get_nofchannels(flink_subdev *subdev)
Get the number of channels of a subdevice.
int flink_pwm_get_period(flink_subdev *subdev, uint32_t channel, uint32_t *period)
Gets the PWM period.
ssize_t flink_write(flink_subdev *subdev, uint32_t offset, uint8_t size, void *wdata)
Write to a flink subdevice.
int flink_analog_out_set_value(flink_subdev *subdev, uint32_t channel, uint32_t value)
Writes an analog output channel.
flink_subdev * flink_get_subdevice_by_unique_id(flink_dev *dev, uint32_t unique_id)
Find subdevice of a device with a given unique id.