![]() |
flinkLinux
flink Linux Kernel Modules
|
Function prototypes and data structures for core module. More...
#include <linux/types.h>
#include <linux/spinlock_types.h>
#include <linux/list.h>
#include <linux/fs.h>
Go to the source code of this file.
Data Structures | |
struct | flink_private_data |
Private data structure which is associated with a file. The user library communicates with the kernel modules through read and write system calls As a parameter a pointer to a file descriptor is passed. Within this structure the field will hold the information about which device and subdevice will be targeted. More... | |
struct | flink_bus_ops |
Functions to communicate with various bus communication modules. More... | |
struct | flink_subdevice |
Describes a subdevice. More... | |
struct | flink_device |
Describes a device. More... | |
struct | ioctl_bit_container_t |
Structure containing information for ioctl system calls accessing single bits. More... | |
struct | ioctl_container_t |
Structure containing information for ioctl system calls. More... | |
Macros | |
#define | UNKOWN_ERROR -1 |
#define | MAX_NOF_SUBDEVICES 256 |
#define | MAX_ADDRESS_SPACE 0x10000 |
#define | MAIN_HEADER_SIZE 16 |
#define | SUB_HEADER_SIZE 16 |
#define | SUBDEV_FUNCTION_OFFSET 0x0000 |
#define | SUBDEV_SIZE_OFFSET 0x0004 |
#define | SUBDEV_NOFCHANNELS_OFFSET 0x0008 |
#define | SUBDEV_UNIQUE_ID_OFFSET 0x000C |
#define | SUBDEV_STATUS_OFFSET 0x0010 |
#define | SUBDEV_CONFIG_OFFSET 0x0014 |
#define | INFO_FUNCTION_ID 0x00 |
#define | SELECT_SUBDEVICE 0x10 |
#define | SELECT_SUBDEVICE_EXCL 0x11 |
#define | SELECT_SUBDEVICE 0x10 |
#define | SELECT_SUBDEVICE_EXCL 0x11 |
#define | READ_NOF_SUBDEVICES 0x20 |
#define | READ_SUBDEVICE_INFO 0x21 |
#define | READ_SINGLE_BIT 0x30 |
#define | WRITE_SINGLE_BIT 0x31 |
#define | SELECT_AND_READ_BIT 0x40 |
#define | SELECT_AND_WRITE_BIT 0x41 |
#define | SELECT_AND_READ 0x42 |
#define | SELECT_AND_WRITE 0x43 |
#define | FLINKLIB_SUBDEVICE_SIZE (sizeof(struct flink_subdevice)-offsetof(struct flink_subdevice,id)) |
Functions | |
struct flink_device * | flink_device_alloc (void) |
Allocate a flink_device structure. More... | |
void | flink_device_init (struct flink_device *fdev, struct flink_bus_ops *bus_ops, struct module *mod) |
Initialize a flink_device structure. More... | |
int | flink_device_add (struct flink_device *fdev) |
Add a flink device to the system, making it live immediately. More... | |
int | flink_device_remove (struct flink_device *fdev) |
Remove a flink device from the system. More... | |
int | flink_device_delete (struct flink_device *fdev) |
Deletes a flink device and frees the allocated memory. All subdevices will be deleted, using flink_subdevice_remove() and flink_subdevice_delete(). More... | |
struct flink_device * | flink_get_device_by_id (u8 flink_device_id) |
Get a flink device by its id. More... | |
struct flink_device * | flink_get_device_by_cdev (struct cdev *char_device) |
Get a flink device by cdev. More... | |
struct list_head * | flink_get_device_list (void) |
Get a list with all devices. More... | |
struct flink_subdevice * | flink_subdevice_alloc (void) |
Allocate a flink_subdevice structure. More... | |
void | flink_subdevice_init (struct flink_subdevice *fsubdev) |
Initialize a flink_subdevice structure, making it ready to add to a flink_device with flink_subdevice_add() More... | |
int | flink_subdevice_add (struct flink_device *fdev, struct flink_subdevice *fsubdev) |
Add a flink subdevice to flink device. More... | |
int | flink_subdevice_remove (struct flink_subdevice *fsubdev) |
Remove a flink subdevice from the parent device. More... | |
int | flink_subdevice_delete (struct flink_subdevice *fsubdev) |
Deletes a flink subdevice and frees the allocated memory. More... | |
struct flink_subdevice * | flink_get_subdevice_by_id (struct flink_device *fdev, u8 flink_device_id) |
Get a flink subdevice by its id. More... | |
struct class * | flink_get_sysfs_class (void) |
Get a flink sysfs class. More... | |
int | flink_select_subdevice (struct file *f, u8 subdevice, bool exclusive) |
Select a subdevice for exclusive access. More... | |
Variables | |
const char * | fmit_lkm_lut [] |
Function prototypes and data structures for core module.
#define FLINKLIB_SUBDEVICE_SIZE (sizeof(struct flink_subdevice)-offsetof(struct flink_subdevice,id)) |
#define INFO_FUNCTION_ID 0x00 |
#define MAIN_HEADER_SIZE 16 |
#define MAX_ADDRESS_SPACE 0x10000 |
#define MAX_NOF_SUBDEVICES 256 |
#define READ_NOF_SUBDEVICES 0x20 |
#define READ_SINGLE_BIT 0x30 |
#define READ_SUBDEVICE_INFO 0x21 |
#define SELECT_AND_READ 0x42 |
#define SELECT_AND_READ_BIT 0x40 |
#define SELECT_AND_WRITE 0x43 |
#define SELECT_AND_WRITE_BIT 0x41 |
#define SELECT_SUBDEVICE 0x10 |
#define SELECT_SUBDEVICE 0x10 |
#define SELECT_SUBDEVICE_EXCL 0x11 |
#define SELECT_SUBDEVICE_EXCL 0x11 |
#define SUB_HEADER_SIZE 16 |
#define SUBDEV_CONFIG_OFFSET 0x0014 |
#define SUBDEV_FUNCTION_OFFSET 0x0000 |
#define SUBDEV_NOFCHANNELS_OFFSET 0x0008 |
#define SUBDEV_SIZE_OFFSET 0x0004 |
#define SUBDEV_STATUS_OFFSET 0x0010 |
#define SUBDEV_UNIQUE_ID_OFFSET 0x000C |
#define UNKOWN_ERROR -1 |
#define WRITE_SINGLE_BIT 0x31 |
int flink_device_add | ( | struct flink_device * | fdev | ) |
Add a flink device to the system, making it live immediately.
fdev | The flink device to add. |
struct flink_device* flink_device_alloc | ( | void | ) |
Allocate a flink_device structure.
int flink_device_delete | ( | struct flink_device * | fdev | ) |
Deletes a flink device and frees the allocated memory. All subdevices will be deleted, using flink_subdevice_remove() and flink_subdevice_delete().
fdev | The flink_device structure to delete. |
void flink_device_init | ( | struct flink_device * | fdev, |
struct flink_bus_ops * | bus_ops, | ||
struct module * | mod | ||
) |
Initialize a flink_device structure.
fdev | The structure to initialize |
bus_ops | The flink_bus_ops for this device, remember them when adding them to system with flink_device_add(). |
mod | The kernel module this flink uses for hardware access. |
int flink_device_remove | ( | struct flink_device * | fdev | ) |
Remove a flink device from the system.
fdev | The flink device to remove. |
struct flink_device* flink_get_device_by_cdev | ( | struct cdev * | char_device | ) |
Get a flink device by cdev.
char_device | Pointer to the cdev struct of a flink device. |
struct flink_device* flink_get_device_by_id | ( | u8 | id | ) |
Get a flink device by its id.
id | The id of the flink device. |
struct list_head* flink_get_device_list | ( | void | ) |
Get a list with all devices.
struct flink_subdevice* flink_get_subdevice_by_id | ( | struct flink_device * | fdev, |
u8 | id | ||
) |
Get a flink subdevice by its id.
fdev | The flink device containing the desired flink_subdevice. |
id | The id of the flink device. |
struct class* flink_get_sysfs_class | ( | void | ) |
Get a flink sysfs class.
int flink_select_subdevice | ( | struct file * | f, |
u8 | subdevice, | ||
bool | excl | ||
) |
Select a subdevice for exclusive access.
f | |
subdevice | |
excl |
int flink_subdevice_add | ( | struct flink_device * | fdev, |
struct flink_subdevice * | fsubdev | ||
) |
Add a flink subdevice to flink device.
fdev | The flink device to which the subdevice is added. |
@fsubdev | The flink subdevice to add. |
struct flink_subdevice* flink_subdevice_alloc | ( | void | ) |
Allocate a flink_subdevice structure.
int flink_subdevice_delete | ( | struct flink_subdevice * | fsubdev | ) |
Deletes a flink subdevice and frees the allocated memory.
fsubdev | The flink_subdevice structure to delete. |
void flink_subdevice_init | ( | struct flink_subdevice * | fsubdev | ) |
Initialize a flink_subdevice structure, making it ready to add to a flink_device with flink_subdevice_add()
fsubdev | The structure to initialize |
int flink_subdevice_remove | ( | struct flink_subdevice * | fsubdev | ) |
Remove a flink subdevice from the parent device.
fsubdev | The flink subdevice to remove. |
const char* fmit_lkm_lut[] |