flinklib
flinklib: flink C library for Linux
|
Go to the source code of this file.
Macros | |
#define | REGISTER_WITH 4 |
#define | HEADER_SIZE 16 |
#define | SUBHEADER_SIZE 16 |
#define | STATUS_OFFSET 0x0010 |
#define | CONFIG_OFFSET 0x0014 |
#define | INFO_DESC_SIZE 28 |
#define | PWM_BASECLK_OFFSET 0x0000 |
#define | PWM_FIRSTPWM_OFFSET 0x0004 |
#define | PPWA_BASECLK_OFFSET 0x0000 |
#define | PPWA_FIRSTPPWA_OFFSET 0x0004 |
#define | ANALOG_INPUT_FIRST_VALUE_OFFSET 0x0004 |
#define | ANALOG_OUTPUT_FIRST_VALUE_OFFSET 0x0004 |
#define | WD_FIRST_COUNTER_OFFSET 0x0004 |
#define | RESET_BIT 0 |
#define | NONEXCL_ACCESS 0 |
#define | EXCL_ACCESS 1 |
#define | FLINK_OUTPUT 1 |
#define | FLINK_INPUT 0 |
#define | EXIT_SUCCESS 0 |
#define | EXIT_ERROR -1 |
Typedefs | |
typedef struct _flink_dev | flink_dev |
typedef struct _flink_subdev | flink_subdev |
Functions | |
flink_dev * | flink_open (const char *file_name) |
Opens a flink device file. More... | |
int | flink_close (flink_dev *dev) |
Close an open flink device. More... | |
int | flink_ioctl (flink_dev *dev, int cmd, void *arg) |
IOCTL operation for a flink device. More... | |
ssize_t | flink_read (flink_subdev *subdev, uint32_t offset, uint8_t size, void *rdata) |
Read from a flink subdevice. More... | |
ssize_t | flink_write (flink_subdev *subdev, uint32_t offset, uint8_t size, void *wdata) |
Write to a flink subdevice. More... | |
int | flink_read_bit (flink_subdev *subdev, uint32_t offset, uint8_t bit, void *rdata) |
Read a single bit from a flink subdevice. More... | |
int | flink_write_bit (flink_subdev *subdev, uint32_t offset, uint8_t bit, void *wdata) |
Write a single bit to a flink subdevice. More... | |
int | flink_get_nof_subdevices (flink_dev *dev) |
Returns the number of subdevices of a fink device. More... | |
flink_subdev * | flink_get_subdevice_by_id (flink_dev *dev, uint8_t subdev_id) |
Find subdevice of a device with a given id. More... | |
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. More... | |
uint8_t | flink_subdevice_get_id (flink_subdev *subdev) |
Get the id of a subdevice. More... | |
uint16_t | flink_subdevice_get_function (flink_subdev *subdev) |
Get the function of a subdevice. More... | |
uint8_t | flink_subdevice_get_subfunction (flink_subdev *subdev) |
Get the subfunction of a subdevice. More... | |
uint8_t | flink_subdevice_get_function_version (flink_subdev *subdev) |
Get the function version of a subdevice. More... | |
uint32_t | flink_subdevice_get_baseaddr (flink_subdev *subdev) |
Get the base address of a subdevice. More... | |
uint32_t | flink_subdevice_get_memsize (flink_subdev *subdev) |
Get the memory size of a subdevice. More... | |
uint32_t | flink_subdevice_get_nofchannels (flink_subdev *subdev) |
Get the number of channels of a subdevice. More... | |
uint32_t | flink_subdevice_get_unique_id (flink_subdev *subdev) |
Get the unique id of a subdevice. More... | |
int | flink_subdevice_select (flink_subdev *subdev, uint8_t exclusive) |
Select a flink subdevice for further operations. More... | |
int | flink_subdevice_reset (flink_subdev *subdev) |
Reset a flink subdevice. More... | |
const char * | flink_subdevice_id2str (uint8_t subdev_id) |
int | flink_info_get_description (flink_subdev *subdev, char *value) |
Reads the description field of an info subdevice. More... | |
int | flink_analog_in_get_resolution (flink_subdev *subdev, uint32_t *resolution) |
Reads the resolution of a analog input subdevice. More... | |
int | flink_analog_in_get_value (flink_subdev *subdev, uint32_t channel, uint32_t *value) |
Reads an analog input channel. More... | |
int | flink_analog_out_get_resolution (flink_subdev *subdev, uint32_t *resolution) |
Reads the resolution of a analog output subdevice. More... | |
int | flink_analog_out_set_value (flink_subdev *subdev, uint32_t channel, uint32_t value) |
Writes an analog output channel. More... | |
int | flink_dio_set_direction (flink_subdev *subdev, uint32_t channel, uint8_t output) |
Configures a channel as input or output. More... | |
int | flink_dio_set_value (flink_subdev *subdev, uint32_t channel, uint8_t high) |
Sets a output channel to a value. More... | |
int | flink_dio_get_value (flink_subdev *subdev, uint32_t channel, uint8_t *value) |
Reads an input channel. More... | |
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_get_baseclock (flink_subdev *subdev, uint32_t *frequency) |
Reads the base clock of a PWM subdevice. More... | |
int | flink_pwm_set_period (flink_subdev *subdev, uint32_t channel, uint32_t period) |
Sets the PWM period. More... | |
int | flink_pwm_get_period (flink_subdev *subdev, uint32_t channel, uint32_t *period) |
Gets the PWM period. More... | |
int | flink_pwm_set_hightime (flink_subdev *subdev, uint32_t channel, uint32_t hightime) |
Sets the PWM hightime. More... | |
int | flink_pwm_get_hightime (flink_subdev *subdev, uint32_t channel, uint32_t *hightime) |
Gets the PWM hightime. More... | |
int | flink_ppwa_get_baseclock (flink_subdev *subdev, uint32_t *frequency) |
Reads the base clock of a PPWA subdevice. More... | |
int | flink_ppwa_get_period (flink_subdev *subdev, uint32_t channel, uint32_t *period) |
Reads the PPWA period. More... | |
int | flink_ppwa_get_hightime (flink_subdev *subdev, uint32_t channel, uint32_t *hightime) |
Reads the PPWA hightime. More... | |
int | flink_wd_get_baseclock (flink_subdev *subdev, uint32_t *base_clk) |
Reads the base clock of a watchdog subdevice. More... | |
int | flink_wd_get_status (flink_subdev *subdev, uint8_t *status) |
Reads the status word of a watchdog subdevice. More... | |
int | flink_wd_set_counter (flink_subdev *subdev, uint32_t value) |
Presets the watchdog counter. More... | |
int | flink_wd_arm (flink_subdev *subdev) |
Starts the watchdog counter. More... | |
#define ANALOG_INPUT_FIRST_VALUE_OFFSET 0x0004 |
Definition at line 60 of file flinklib.h.
#define ANALOG_OUTPUT_FIRST_VALUE_OFFSET 0x0004 |
Definition at line 61 of file flinklib.h.
#define CONFIG_OFFSET 0x0014 |
Definition at line 54 of file flinklib.h.
#define EXCL_ACCESS 1 |
Definition at line 66 of file flinklib.h.
#define EXIT_ERROR -1 |
Definition at line 129 of file flinklib.h.
#define EXIT_SUCCESS 0 |
Definition at line 128 of file flinklib.h.
#define FLINK_INPUT 0 |
Definition at line 98 of file flinklib.h.
#define FLINK_OUTPUT 1 |
Definition at line 97 of file flinklib.h.
#define HEADER_SIZE 16 |
Definition at line 51 of file flinklib.h.
#define INFO_DESC_SIZE 28 |
Definition at line 55 of file flinklib.h.
#define NONEXCL_ACCESS 0 |
Definition at line 65 of file flinklib.h.
#define PPWA_BASECLK_OFFSET 0x0000 |
Definition at line 58 of file flinklib.h.
#define PPWA_FIRSTPPWA_OFFSET 0x0004 |
Definition at line 59 of file flinklib.h.
#define PWM_BASECLK_OFFSET 0x0000 |
Definition at line 56 of file flinklib.h.
#define PWM_FIRSTPWM_OFFSET 0x0004 |
Definition at line 57 of file flinklib.h.
#define REGISTER_WITH 4 |
Definition at line 50 of file flinklib.h.
#define RESET_BIT 0 |
Definition at line 63 of file flinklib.h.
#define STATUS_OFFSET 0x0010 |
Definition at line 53 of file flinklib.h.
#define SUBHEADER_SIZE 16 |
Definition at line 52 of file flinklib.h.
#define WD_FIRST_COUNTER_OFFSET 0x0004 |
Definition at line 62 of file flinklib.h.
typedef struct _flink_dev flink_dev |
Definition at line 29 of file flinklib.h.
typedef struct _flink_subdev flink_subdev |
Definition at line 30 of file flinklib.h.
int flink_analog_in_get_resolution | ( | flink_subdev * | subdev, |
uint32_t * | resolution | ||
) |
int flink_analog_in_get_value | ( | flink_subdev * | subdev, |
uint32_t | channel, | ||
uint32_t * | value | ||
) |
int flink_analog_out_get_resolution | ( | flink_subdev * | subdev, |
uint32_t * | resolution | ||
) |
int flink_analog_out_set_value | ( | flink_subdev * | subdev, |
uint32_t | channel, | ||
uint32_t | value | ||
) |
int flink_close | ( | flink_dev * | dev | ) |
int flink_counter_get_count | ( | flink_subdev * | subdev, |
uint32_t | channel, | ||
uint32_t * | data | ||
) |
int flink_counter_set_mode | ( | flink_subdev * | subdev, |
uint8_t | mode | ||
) |
int flink_dio_get_value | ( | flink_subdev * | subdev, |
uint32_t | channel, | ||
uint8_t * | value | ||
) |
int flink_dio_set_direction | ( | flink_subdev * | subdev, |
uint32_t | channel, | ||
uint8_t | output | ||
) |
Configures a channel as input or output.
subdev | Subdevice containing the channel. |
channel | Channel number. |
output | Value, a value of nonzero configures the channel as output. |
Definition at line 38 of file dio.c.
int flink_dio_set_value | ( | flink_subdev * | subdev, |
uint32_t | channel, | ||
uint8_t | value | ||
) |
int flink_get_nof_subdevices | ( | flink_dev * | dev | ) |
flink_subdev* flink_get_subdevice_by_id | ( | flink_dev * | dev, |
uint8_t | subdev_id | ||
) |
flink_subdev* flink_get_subdevice_by_unique_id | ( | flink_dev * | dev, |
uint32_t | unique_id | ||
) |
int flink_info_get_description | ( | flink_subdev * | subdev, |
char * | desc | ||
) |
int flink_ioctl | ( | flink_dev * | dev, |
int | cmd, | ||
void * | arg | ||
) |
IOCTL operation for a flink device.
dev | Flink device handle. |
cmd | IOCTL command. |
arg | IOCTL arguments. |
Definition at line 44 of file lowlevel.c.
flink_dev* flink_open | ( | const char * | file_name | ) |
int flink_ppwa_get_baseclock | ( | flink_subdev * | subdev, |
uint32_t * | frequency | ||
) |
int flink_ppwa_get_hightime | ( | flink_subdev * | subdev, |
uint32_t | channel, | ||
uint32_t * | hightime | ||
) |
int flink_ppwa_get_period | ( | flink_subdev * | subdev, |
uint32_t | channel, | ||
uint32_t * | period | ||
) |
int flink_pwm_get_baseclock | ( | flink_subdev * | subdev, |
uint32_t * | frequency | ||
) |
int flink_pwm_get_hightime | ( | flink_subdev * | subdev, |
uint32_t | channel, | ||
uint32_t * | hightime | ||
) |
int flink_pwm_get_period | ( | flink_subdev * | subdev, |
uint32_t | channel, | ||
uint32_t * | period | ||
) |
int flink_pwm_set_hightime | ( | flink_subdev * | subdev, |
uint32_t | channel, | ||
uint32_t | hightime | ||
) |
int flink_pwm_set_period | ( | flink_subdev * | subdev, |
uint32_t | channel, | ||
uint32_t | period | ||
) |
ssize_t flink_read | ( | flink_subdev * | subdev, |
uint32_t | offset, | ||
uint8_t | size, | ||
void * | rdata | ||
) |
Read from a flink subdevice.
subdev | Subdevice to read from. |
offset | Read offset, relative to the subdevice base address. |
size | Nof bytes to read. |
rdata | Pointer to a buffer where the read bytes are written to. |
Definition at line 71 of file lowlevel.c.
int flink_read_bit | ( | flink_subdev * | subdev, |
uint32_t | offset, | ||
uint8_t | bit, | ||
void * | rdata | ||
) |
Read a single bit from a flink subdevice.
subdev | Subdevice to read from. |
offset | Read offset, relative to the subdevice base address. |
bit | Bit number to read in the byte given by offset. |
rdata | Pointer to a buffer where the bit read should be written |
Definition at line 149 of file lowlevel.c.
uint32_t flink_subdevice_get_baseaddr | ( | flink_subdev * | subdev | ) |
uint16_t flink_subdevice_get_function | ( | flink_subdev * | subdev | ) |
uint8_t flink_subdevice_get_function_version | ( | flink_subdev * | subdev | ) |
uint8_t flink_subdevice_get_id | ( | flink_subdev * | subdev | ) |
uint32_t flink_subdevice_get_memsize | ( | flink_subdev * | subdev | ) |
uint32_t flink_subdevice_get_nofchannels | ( | flink_subdev * | subdev | ) |
uint8_t flink_subdevice_get_subfunction | ( | flink_subdev * | subdev | ) |
uint32_t flink_subdevice_get_unique_id | ( | flink_subdev * | subdev | ) |
const char* flink_subdevice_id2str | ( | uint8_t | subdev_id | ) |
int flink_subdevice_reset | ( | flink_subdev * | subdev | ) |
int flink_subdevice_select | ( | flink_subdev * | subdev, |
uint8_t | exclusive | ||
) |
int flink_wd_arm | ( | flink_subdev * | subdev | ) |
int flink_wd_get_baseclock | ( | flink_subdev * | subdev, |
uint32_t * | base_clk | ||
) |
int flink_wd_get_status | ( | flink_subdev * | subdev, |
uint8_t * | status | ||
) |
int flink_wd_set_counter | ( | flink_subdev * | subdev, |
uint32_t | counter | ||
) |
ssize_t flink_write | ( | flink_subdev * | subdev, |
uint32_t | offset, | ||
uint8_t | size, | ||
void * | wdata | ||
) |
Write to a flink subdevice.
subdev | Subdevice to write to. |
offset | Write offset, relative to the subdevice base address. |
size | Nof bytes to write. |
wdata | Data to write. |
Definition at line 110 of file lowlevel.c.
int flink_write_bit | ( | flink_subdev * | subdev, |
uint32_t | offset, | ||
uint8_t | bit, | ||
void * | wdata | ||
) |
Write a single bit to a flink subdevice.
subdev | Subdevice to write to. |
offset | Write offset, relative to the subdevice base address. |
bit | Bit number to write in the byte given by offset. |
wdata | Bit to write, a value of nonzero sets the bit, 0 clears the bit |
Definition at line 187 of file lowlevel.c.