flinklib
flinklib: flink C library for Linux
base.c File Reference

Contains the base functionality for flink. More...

#include "flinklib.h"
#include "flinkioctl.h"
#include "types.h"
#include "valid.h"
#include "error.h"
#include "log.h"
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
Include dependency graph for base.c:

Go to the source code of this file.

Functions

flink_devflink_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_get_nof_subdevices (flink_dev *dev)
 Returns the number of subdevices of a fink device. More...
 
int flink_subdevice_reset (flink_subdev *subdev)
 Reset a flink subdevice. More...
 
int flink_subdevice_select (flink_subdev *subdev, uint8_t exclusive)
 Select a flink subdevice for further operations. More...
 
flink_subdevflink_get_subdevice_by_id (flink_dev *dev, uint8_t subdev_id)
 Find subdevice of a device with a given id. More...
 
flink_subdevflink_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...
 

Detailed Description

Contains the base functionality for flink.

Contains functions to initialize, add and remove flink devices and subdevices

Author
Martin Z├╝ger
Urs Graf

Definition in file base.c.

Function Documentation

int flink_close ( flink_dev dev)

Close an open flink device.

Parameters
devdevice to close.
Returns
int: 0 on success, -1 in case of failure.

Definition at line 146 of file base.c.

Here is the caller graph for this function:

int flink_get_nof_subdevices ( flink_dev dev)

Returns the number of subdevices of a fink device.

Parameters
devDevice to read
Returns
int: Number of flink devices or -1 in case of error.

Definition at line 167 of file base.c.

Here is the caller graph for this function:

flink_subdev* flink_get_subdevice_by_id ( flink_dev dev,
uint8_t  subdev_id 
)

Find subdevice of a device with a given id.

Parameters
devDevice to search.
subdev_idId of subdevice.
Returns
flink_subdev*: Pointer to the subdevice or NULL in case of error.

Definition at line 223 of file base.c.

Here is the caller graph for this function:

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.

Parameters
devDevice to search.
unique_idUnique id of subdevice.
Returns
flink_subdev*: Pointer to the subdevice or NULL in case of error.

Definition at line 246 of file base.c.

Here is the caller graph for this function:

flink_dev* flink_open ( const char *  file_name)

Opens a flink device file.

Parameters
file_nameDevice file (null terminated array).
Returns
flink_dev*: Pointer to the opened flink device or NULL in case of error.

Definition at line 113 of file base.c.

Here is the caller graph for this function:

uint32_t flink_subdevice_get_baseaddr ( flink_subdev subdev)

Get the base address of a subdevice.

Parameters
subdevThe subdevice.
Returns
uint32_t: Returns the base address.

Definition at line 306 of file base.c.

uint16_t flink_subdevice_get_function ( flink_subdev subdev)

Get the function of a subdevice.

Parameters
subdevThe subdevice.
Returns
uint16_t: Returns the function id.

Definition at line 279 of file base.c.

Here is the caller graph for this function:

uint8_t flink_subdevice_get_function_version ( flink_subdev subdev)

Get the function version of a subdevice.

Parameters
subdevThe subdevice.
Returns
uint8_t: Returns the function version.

Definition at line 297 of file base.c.

uint8_t flink_subdevice_get_id ( flink_subdev subdev)

Get the id of a subdevice.

Parameters
subdevThe subdevice.
Returns
uint8_t: Id of the subdevice.

Definition at line 270 of file base.c.

uint32_t flink_subdevice_get_memsize ( flink_subdev subdev)

Get the memory size of a subdevice.

Parameters
subdevThe subdevice.
Returns
uint32_t: Returns the memory size.

Definition at line 315 of file base.c.

uint32_t flink_subdevice_get_nofchannels ( flink_subdev subdev)

Get the number of channels of a subdevice.

Parameters
subdevThe subdevice.
Returns
uint32_t: Returns the number of channels.

Definition at line 324 of file base.c.

Here is the caller graph for this function:

uint8_t flink_subdevice_get_subfunction ( flink_subdev subdev)

Get the subfunction of a subdevice.

Parameters
subdevThe subdevice.
Returns
uint8_t: Returns the subfunction id.

Definition at line 288 of file base.c.

Here is the caller graph for this function:

uint32_t flink_subdevice_get_unique_id ( flink_subdev subdev)

Get the unique id of a subdevice.

Parameters
subdevThe subdevice.
Returns
uint32_t: Returns the unique id.

Definition at line 333 of file base.c.

Here is the caller graph for this function:

int flink_subdevice_reset ( flink_subdev subdev)

Reset a flink subdevice.

Parameters
subdevSubdevice to reset
Returns
int: 0 on success, else -1.

Definition at line 183 of file base.c.

Here is the caller graph for this function:

int flink_subdevice_select ( flink_subdev subdev,
uint8_t  exclusive 
)

Select a flink subdevice for further operations.

Parameters
subdevSubdevice to select.
exclusiveBlock access to this subdevice for other processes.
Returns
int: 0 on success, else -1.

Definition at line 206 of file base.c.