49 static int read_nof_subdevices(
flink_dev* dev) {
52 dbg_print(
"reading number of subdevices...\n");
69 static int get_subdevices(
flink_dev* dev) {
123 dev->
fd = open(file_name, O_RDWR);
130 if(get_subdevices(dev) < 0) {
257 while(subdev != NULL) {
flink_subdev * flink_get_subdevice_by_id(flink_dev *dev, uint8_t subdev_id)
Find subdevice of a device with a given id.
uint32_t unique_id
Number of channels.
uint32_t nof_channels
Address space size.
Data structures for flink devices and subdevices.
uint8_t nof_subdevices
File descriptor of open flink device file.
flink_subdev * flink_get_subdevice_by_unique_id(flink_dev *dev, uint8_t unique_id)
Find subdevice of a device with a given unique id.
flink_dev * flink_open(const char *file_name)
Opens a flink device file.
int flink_close(flink_dev *dev)
Close an open flink device.
int flink_subdevice_select(flink_subdev *subdev, uint8_t exclusive)
Select a flink subdevice for further operations.
uint32_t flink_subdevice_get_nofchannels(flink_subdev *subdev)
Get the number of channels of a subdevice.
uint8_t flink_subdevice_get_id(flink_subdev *subdev)
Get the id of a subdevice.
uint8_t flink_subdevice_get_subfunction(flink_subdev *subdev)
Get the subfunction of a subdevice.
uint16_t flink_subdevice_get_function(flink_subdev *subdev)
Get the function of a subdevice.
uint32_t base_addr
Version of the function.
uint8_t sub_function_id
Identifies the function of the subdevice.
uint8_t function_version
Identifies the subtype of the subdevice.
flink_dev * parent
Unique id, must be unique for a certain subdevice.
uint8_t flink_subdevice_get_function_version(flink_subdev *subdev)
Get the function version of a subdevice.
flink userspace library, ioctl definitions.
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.
int validate_flink_subdev(flink_subdev *subdev)
Checks if flink subdevice belongs to the device.
uint16_t function_id
Identifies a subdevice within a device.
#define FLINK_EINVALSUBDEV
Contains validation functions for flink.
int flink_subdevice_reset(flink_subdev *subdev)
Reset a flink subdevice.
uint32_t flink_subdevice_get_unique_id(flink_subdev *subdev)
Get the unique id of a subdevice.
flink_subdev * subdevices
Number of subdevices.
uint32_t flink_subdevice_get_memsize(flink_subdev *subdev)
Get the memory size of a subdevice.
int validate_flink_dev(flink_dev *dev)
Checks if flink device was opened.
int flink_get_nof_subdevices(flink_dev *dev)
Returns the number of subdevices of a fink device.
uint32_t mem_size
Base address (logical)
uint32_t flink_subdevice_get_baseaddr(flink_subdev *subdev)
Get the base address of a subdevice.
#define dbg_print(fmt,...)