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

Contains low level operations for flink. More...

#include "flinklib.h"
#include "flinkioctl.h"
#include "types.h"
#include "error.h"
#include "log.h"
#include "valid.h"
#include <sys/ioctl.h>
#include <unistd.h>
Include dependency graph for lowlevel.c:

Go to the source code of this file.

Functions

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...
 

Detailed Description

Contains low level operations for flink.

Contains functions to read from and write to the memory bank of flink devices directly. These functions can be used to communicate with user-defined flink subdevices.

Author
Martin Z├╝ger
Urs Graf

Definition in file lowlevel.c.

Function Documentation

int flink_ioctl ( flink_dev dev,
int  cmd,
void *  arg 
)

IOCTL operation for a flink device.

Parameters
devFlink device handle.
cmdIOCTL command.
argIOCTL arguments.
Returns
int: IOCTL return value or -1 in case of failure.

Definition at line 44 of file lowlevel.c.

Here is the caller graph for this function:

ssize_t flink_read ( flink_subdev subdev,
uint32_t  offset,
uint8_t  size,
void *  rdata 
)

Read from a flink subdevice.

Parameters
subdevSubdevice to read from.
offsetRead offset, relative to the subdevice base address.
sizeNof bytes to read.
rdataPointer to a buffer where the read bytes are written to.
Returns
ssize_t: Nof bytes read from the subdevcie or a negative error code.

Definition at line 71 of file lowlevel.c.

Here is the caller graph for this function:

int flink_read_bit ( flink_subdev subdev,
uint32_t  offset,
uint8_t  bit,
void *  rdata 
)

Read a single bit from a flink subdevice.

Parameters
subdevSubdevice to read from.
offsetRead offset, relative to the subdevice base address.
bitBit number to read in the byte given by offset.
rdataPointer to a buffer where the bit read should be written
Returns
int: 0 on succes, else -1.

Definition at line 149 of file lowlevel.c.

Here is the caller graph for this function:

ssize_t flink_write ( flink_subdev subdev,
uint32_t  offset,
uint8_t  size,
void *  wdata 
)

Write to a flink subdevice.

Parameters
subdevSubdevice to write to.
offsetWrite offset, relative to the subdevice base address.
sizeNof bytes to write.
wdataData to write.
Returns
ssize_t: Nof bytes written or -1 in case of error.

Definition at line 110 of file lowlevel.c.

Here is the caller graph for this function:

int flink_write_bit ( flink_subdev subdev,
uint32_t  offset,
uint8_t  bit,
void *  wdata 
)

Write a single bit to a flink subdevice.

Parameters
subdevSubdevice to write to.
offsetWrite offset, relative to the subdevice base address.
bitBit number to write in the byte given by offset.
wdataBit to write, a value of nonzero sets the bit, 0 clears the bit
Returns
int

Definition at line 187 of file lowlevel.c.

Here is the caller graph for this function: