10 #include <linux/types.h>
11 #include <linux/spinlock_types.h>
12 #include <linux/list.h>
16 #define UNKOWN_ERROR -1
48 #define MAX_NOF_SUBDEVICES 256
99 #define MAX_ADDRESS_SPACE 0x10000
102 #define MAIN_HEADER_SIZE 16 // byte
103 #define SUB_HEADER_SIZE 16 // byte
104 #define SUBDEV_FUNCTION_OFFSET 0x0000 // byte
105 #define SUBDEV_SIZE_OFFSET 0x0004 // byte
106 #define SUBDEV_NOFCHANNELS_OFFSET 0x0008 // byte
107 #define SUBDEV_UNIQUE_ID_OFFSET 0x000C // byte
108 #define SUBDEV_STATUS_OFFSET 0x0010 // byte
109 #define SUBDEV_CONFIG_OFFSET 0x0014 // byte
112 #define INFO_FUNCTION_ID 0x00
117 #define SELECT_SUBDEVICE 0x10
118 #define SELECT_SUBDEVICE_EXCL 0x11
119 #define SELECT_SUBDEVICE 0x10
120 #define SELECT_SUBDEVICE_EXCL 0x11
121 #define READ_NOF_SUBDEVICES 0x20
122 #define READ_SUBDEVICE_INFO 0x21
123 #define READ_SINGLE_BIT 0x30
124 #define WRITE_SINGLE_BIT 0x31
125 #define SELECT_AND_READ_BIT 0x40
126 #define SELECT_AND_WRITE_BIT 0x41
127 #define SELECT_AND_READ 0x42
128 #define SELECT_AND_WRITE 0x43
149 #define FLINKLIB_SUBDEVICE_SIZE (sizeof(struct flink_subdevice)-offsetof(struct flink_subdevice,id))
uint8_t subdevice
Definition: flink.h:142
u32 unique_id
Number of channels.
Definition: flink.h:60
struct list_head * flink_get_device_list(void)
Get a list with all devices.
Definition: flink_core.c:974
struct flink_subdevice * flink_subdevice_alloc(void)
Allocate a flink_subdevice structure.
Definition: flink_core.c:982
u8 nof_subdevices
Identifies a device.
Definition: flink.h:68
struct list_head list
Definition: flink.h:66
uint8_t subdevice
Definition: flink.h:136
struct flink_subdevice * flink_get_subdevice_by_id(struct flink_device *fdev, u8 flink_device_id)
Get a flink subdevice by its id.
Definition: flink_core.c:1078
uint8_t size
Definition: flink.h:144
Structure containing information for ioctl system calls accessing single bits.
Definition: flink.h:132
u16(* read16)(struct flink_device *, u32 addr)
read 1 byte
Definition: flink.h:39
int flink_device_add(struct flink_device *fdev)
Add a flink device to the system, making it live immediately.
Definition: flink_core.c:842
void * data
Definition: flink.h:145
struct flink_device * flink_get_device_by_cdev(struct cdev *char_device)
Get a flink device by cdev.
Definition: flink_core.c:950
u8 function_version
Identifies the subtype of the subdevice.
Definition: flink.h:56
struct flink_device * fdev
Definition: flink.h:31
struct list_head subdevices
Number of subdevices.
Definition: flink.h:69
uint32_t offset
Definition: flink.h:143
struct device * sysfs_device
Pointer to cdev structure.
Definition: flink.h:74
int flink_subdevice_remove(struct flink_subdevice *fsubdev)
Remove a flink subdevice from the parent device.
Definition: flink_core.c:1038
struct class * flink_get_sysfs_class(void)
Get a flink sysfs class.
Definition: flink_core.c:1103
Functions to communicate with various bus communication modules.
Definition: flink.h:37
struct cdev * char_device
Bus specific data.
Definition: flink.h:73
int(* write32)(struct flink_device *, u32 addr, u32 val)
write 2 bytes
Definition: flink.h:43
u8 sub_function_id
Identifies the function of the subdevice.
Definition: flink.h:55
u32(* address_space_size)(struct flink_device *)
write 4 bytes
Definition: flink.h:44
uint8_t value
Definition: flink.h:135
uint8_t bit
Definition: flink.h:134
u32 base_addr
Version of the function.
Definition: flink.h:57
struct flink_device * flink_device_alloc(void)
Allocate a flink_device structure.
Definition: flink_core.c:814
int flink_subdevice_delete(struct flink_subdevice *fsubdev)
Deletes a flink subdevice and frees the allocated memory.
Definition: flink_core.c:1060
int flink_device_remove(struct flink_device *fdev)
Remove a flink device from the system.
Definition: flink_core.c:872
struct flink_device * parent
Linked list of all subdevices of a device.
Definition: flink.h:52
int flink_subdevice_add(struct flink_device *fdev, struct flink_subdevice *fsubdev)
Add a flink subdevice to flink device.
Definition: flink_core.c:1006
const char * fmit_lkm_lut[]
Definition: flink_fmi.c:3
u8 id
Linked list of all devices.
Definition: flink.h:67
Private data structure which is associated with a file. The user library communicates with the kernel...
Definition: flink.h:30
u8 id
Pointer to device which this subdevice belongs.
Definition: flink.h:53
Describes a device.
Definition: flink.h:65
void flink_device_init(struct flink_device *fdev, struct flink_bus_ops *bus_ops, struct module *mod)
Initialize a flink_device structure.
Definition: flink_core.c:829
struct flink_bus_ops * bus_ops
Linked list of all subdevices of this device.
Definition: flink.h:70
u32 mem_size
Base address (logical)
Definition: flink.h:58
struct flink_subdevice * current_subdevice
Definition: flink.h:32
struct flink_device * flink_get_device_by_id(u8 flink_device_id)
Get a flink device by its id.
Definition: flink_core.c:925
int(* write16)(struct flink_device *, u32 addr, u16 val)
write 1 byte
Definition: flink.h:42
int flink_select_subdevice(struct file *f, u8 subdevice, bool exclusive)
Select a subdevice for exclusive access.
Definition: flink_core.c:1114
void * bus_data
Pointer to bus interface modul used for this device.
Definition: flink.h:72
Structure containing information for ioctl system calls.
Definition: flink.h:141
u32(* read32)(struct flink_device *, u32 addr)
read 2 bytes
Definition: flink.h:40
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...
Definition: flink_core.c:995
int(* write8)(struct flink_device *, u32 addr, u8 val)
read 4 bytes
Definition: flink.h:41
uint32_t offset
Definition: flink.h:133
struct list_head list
Definition: flink.h:51
Describes a subdevice.
Definition: flink.h:50
u16 function_id
Identifies a subdevice within a device.
Definition: flink.h:54
struct module * appropriated_module
Pointer to structure defining the bus operation functions of this device.
Definition: flink.h:71
u32 nof_channels
Address space size.
Definition: flink.h:59
u8(* read8)(struct flink_device *, u32 addr)
Definition: flink.h:38
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().
Definition: flink_core.c:897