IgH EtherCAT Master  1.6.9
cdev.c File Reference

EtherCAT master character device. More...

Go to the source code of this file.

Data Structures

struct  ec_cdev_priv_t
 Private data structure for file handles. More...

Macros

#define DEBUG   0
 Set to 1 to enable device operations debugging.
#define FAULT_RETURN_TYPE   vm_fault_t
 This is the kernel version from which the .fault member of the vm_operations_struct is usable.
#define VM_DONTDUMP   VM_RESERVED
 VM_RESERVED disappeared in 3.7.

Functions

static int eccdev_open (struct inode *inode, struct file *filp)
 Called when the cdev is opened.
static int eccdev_release (struct inode *inode, struct file *filp)
 Called when the cdev is closed.
static long eccdev_ioctl (struct file *filp, unsigned int cmd, unsigned long arg)
 Called when an ioctl() command is issued.
static int eccdev_mmap (struct file *filp, struct vm_area_struct *vma)
 Memory-map callback for the EtherCAT character device.
static FAULT_RETURN_TYPE eccdev_vma_fault (struct vm_fault *vmf)
 Page fault callback for a virtual memory area.
int ec_cdev_init (ec_cdev_t *cdev, ec_master_t *master, dev_t dev_num)
 Constructor.
void ec_cdev_clear (ec_cdev_t *cdev)
 Destructor.

Variables

static struct file_operations eccdev_fops
 File operation callbacks for the EtherCAT character device.
struct vm_operations_struct eccdev_vm_ops
 Callbacks for a virtual memory area retrieved with ecdevc_mmap().

Detailed Description

EtherCAT master character device.

Definition in file cdev.c.

Macro Definition Documentation

◆ DEBUG

#define DEBUG   0

Set to 1 to enable device operations debugging.

Definition at line 42 of file cdev.c.

◆ FAULT_RETURN_TYPE

#define FAULT_RETURN_TYPE   vm_fault_t

This is the kernel version from which the .fault member of the vm_operations_struct is usable.

Definition at line 58 of file cdev.c.

◆ VM_DONTDUMP

#define VM_DONTDUMP   VM_RESERVED

VM_RESERVED disappeared in 3.7.

Definition at line 210 of file cdev.c.

Function Documentation

◆ eccdev_open()

int eccdev_open ( struct inode * inode,
struct file * filp )
static

Called when the cdev is opened.

Definition at line 137 of file cdev.c.

◆ eccdev_release()

int eccdev_release ( struct inode * inode,
struct file * filp )
static

Called when the cdev is closed.

Definition at line 167 of file cdev.c.

◆ eccdev_ioctl()

long eccdev_ioctl ( struct file * filp,
unsigned int cmd,
unsigned long arg )
static

Called when an ioctl() command is issued.

Definition at line 192 of file cdev.c.

◆ eccdev_mmap()

int eccdev_mmap ( struct file * filp,
struct vm_area_struct * vma )
static

Memory-map callback for the EtherCAT character device.

The actual mapping will be done in the eccdev_vma_nopage() callback of the virtual memory area.

Returns
Always zero (success).

Definition at line 220 of file cdev.c.

◆ eccdev_vma_fault()

FAULT_RETURN_TYPE eccdev_vma_fault ( struct vm_fault * vmf)
static

Page fault callback for a virtual memory area.

Called at the first access on a virtual-memory area retrieved with ecdev_mmap().

Returns
Zero on success, otherwise a negative error code.
Parameters
vmfFault data.

Definition at line 249 of file cdev.c.

◆ ec_cdev_init()

int ec_cdev_init ( ec_cdev_t * cdev,
ec_master_t * master,
dev_t dev_num )

Constructor.

Returns
0 in case of success, else < 0
Parameters
cdevEtherCAT master character device.
masterParent master.
dev_numDevice number.

Definition at line 100 of file cdev.c.

◆ ec_cdev_clear()

void ec_cdev_clear ( ec_cdev_t * cdev)

Destructor.

Parameters
cdevEtherCAT XML device

Definition at line 126 of file cdev.c.

Variable Documentation

◆ eccdev_fops

struct file_operations eccdev_fops
static
Initial value:
= {
.owner = THIS_MODULE,
.open = eccdev_open,
.release = eccdev_release,
.unlocked_ioctl = eccdev_ioctl,
.mmap = eccdev_mmap
}
static int eccdev_release(struct inode *, struct file *)
Called when the cdev is closed.
Definition cdev.c:167
static int eccdev_mmap(struct file *, struct vm_area_struct *)
Memory-map callback for the EtherCAT character device.
Definition cdev.c:220
static long eccdev_ioctl(struct file *, unsigned int, unsigned long)
Called when an ioctl() command is issued.
Definition cdev.c:192
static int eccdev_open(struct inode *, struct file *)
Called when the cdev is opened.
Definition cdev.c:137

File operation callbacks for the EtherCAT character device.

Definition at line 71 of file cdev.c.

◆ eccdev_vm_ops

struct vm_operations_struct eccdev_vm_ops
Initial value:
= {
}
static FAULT_RETURN_TYPE eccdev_vma_fault(struct vm_fault *)
Page fault callback for a virtual memory area.
Definition cdev.c:249

Callbacks for a virtual memory area retrieved with ecdevc_mmap().

Definition at line 81 of file cdev.c.