devices/ccat/module.h
author Florian Pose <fp@igh.de>
Wed, 13 Dec 2017 15:39:13 +0100
branchstable-1.5
changeset 2693 8051d05cb935
parent 2684 56587a22d05c
permissions -rw-r--r--
Improved buffer overflow messages.
2550
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
     1
/**
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
     2
    Network Driver for Beckhoff CCAT communication controller
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
     3
    Copyright (C) 2014  Beckhoff Automation GmbH
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
     4
    Author: Patrick Bruenn <p.bruenn@beckhoff.com>
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
     5
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
     6
    This program is free software; you can redistribute it and/or modify
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
     7
    it under the terms of the GNU General Public License as published by
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
     8
    the Free Software Foundation; either version 2 of the License, or
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
     9
    (at your option) any later version.
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
    10
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
    11
    This program is distributed in the hope that it will be useful,
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
    12
    but WITHOUT ANY WARRANTY; without even the implied warranty of
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
    13
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
    14
    GNU General Public License for more details.
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
    15
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
    16
    You should have received a copy of the GNU General Public License along
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
    17
    with this program; if not, write to the Free Software Foundation, Inc.,
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
    18
    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
    19
*/
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
    20
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
    21
#ifndef _CCAT_H_
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
    22
#define _CCAT_H_
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
    23
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
    24
#include <linux/cdev.h>
2636
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
    25
#include <linux/fs.h>
2567
d70aad2f131f - use short kernel types, add empty lines after variable declaration to conform better with linux coding style
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2565
diff changeset
    26
#include <linux/hrtimer.h>
2550
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
    27
#include <linux/kernel.h>
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
    28
#include <linux/pci.h>
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
    29
#include "../ecdev.h"
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
    30
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
    31
#define DRV_EXTRAVERSION "-ec"
2654
b3f6b3e5ef29 devices/ccat: revert "limit rx processing to one frame per poll"
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2638
diff changeset
    32
#define DRV_VERSION      "0.15" DRV_EXTRAVERSION
2550
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
    33
#define DRV_DESCRIPTION  "Beckhoff CCAT Ethernet/EtherCAT Network Driver"
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
    34
2551
000da5069f1a clean up CCatDefinitions.h
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2550
diff changeset
    35
#undef pr_fmt
000da5069f1a clean up CCatDefinitions.h
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2550
diff changeset
    36
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
000da5069f1a clean up CCatDefinitions.h
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2550
diff changeset
    37
2638
5995331a55fe update ccat driver to v0.14
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2636
diff changeset
    38
extern const struct ccat_driver eth_eim_driver;
5995331a55fe update ccat driver to v0.14
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2636
diff changeset
    39
extern const struct ccat_driver eth_dma_driver;
2684
56587a22d05c Do not build GPIO part of CCAT if GPIO is not configured in kernel.
Florian Pose <fp@igh.de>
parents: 2654
diff changeset
    40
#ifdef CONFIG_GPIO
2638
5995331a55fe update ccat driver to v0.14
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2636
diff changeset
    41
extern const struct ccat_driver gpio_driver;
2684
56587a22d05c Do not build GPIO part of CCAT if GPIO is not configured in kernel.
Florian Pose <fp@igh.de>
parents: 2654
diff changeset
    42
#endif
2638
5995331a55fe update ccat driver to v0.14
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2636
diff changeset
    43
extern const struct ccat_driver sram_driver;
5995331a55fe update ccat driver to v0.14
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2636
diff changeset
    44
extern const struct ccat_driver update_driver;
2636
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
    45
2684
56587a22d05c Do not build GPIO part of CCAT if GPIO is not configured in kernel.
Florian Pose <fp@igh.de>
parents: 2654
diff changeset
    46
2550
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
    47
/**
2569
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
    48
 * CCAT function type identifiers (u16)
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
    49
 */
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
    50
enum ccat_info_t {
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
    51
	CCATINFO_NOTUSED = 0,
2636
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
    52
	CCATINFO_ETHERCAT_NODMA = 0x3,
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
    53
	CCATINFO_GPIO = 0xd,
2569
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
    54
	CCATINFO_EPCS_PROM = 0xf,
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
    55
	CCATINFO_ETHERCAT_MASTER_DMA = 0x14,
2636
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
    56
	CCATINFO_SRAM = 0x16,
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
    57
};
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
    58
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
    59
struct ccat_cdev {
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
    60
	atomic_t in_use;
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
    61
	void __iomem *ioaddr;
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
    62
	size_t iosize;
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
    63
	dev_t dev;
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
    64
	struct cdev cdev;
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
    65
	struct ccat_class *class;
2569
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
    66
};
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
    67
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
    68
/**
2636
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
    69
 * struct cdev_buffer
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
    70
 * @ccdev: referenced character device
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
    71
 * @data: buffer used for write operations
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
    72
 * @size: number of bytes written to the data buffer
2550
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
    73
 */
2636
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
    74
struct cdev_buffer {
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
    75
	struct ccat_cdev *ccdev;
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
    76
	size_t size;
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
    77
	char data[];
2550
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
    78
};
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
    79
2636
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
    80
extern int ccat_cdev_open(struct inode *const i, struct file *const f);
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
    81
extern int ccat_cdev_release(struct inode *const i, struct file *const f);
2550
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
    82
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
    83
/**
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
    84
 * struct ccat_device - CCAT device representation
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
    85
 * @pdev: pointer to the pci object allocated by the kernel
2636
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
    86
 * @bar_0: holding information about PCI BAR 0
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
    87
 * @bar_2: holding information about PCI BAR 2 (optional)
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
    88
 * @functions: list of available (driver loaded) FPGA functions
2550
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
    89
 *
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
    90
 * One instance of a ccat_device should represent a physical CCAT. Since
2636
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
    91
 * a CCAT is implemented as FPGA the available functions can vary.
2550
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
    92
 */
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
    93
struct ccat_device {
2636
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
    94
	void *pdev;
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
    95
	void __iomem *bar_0;
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
    96
	void __iomem *bar_2;
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
    97
	struct list_head functions;
2550
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
    98
};
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
    99
2573
ad9a35065387 remove print.* from release tree
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2570
diff changeset
   100
struct ccat_info_block {
2569
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
   101
	u16 type;
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
   102
	u16 rev;
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
   103
	union {
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
   104
		u32 config;
2636
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
   105
		u8 num_gpios;
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
   106
		struct {
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
   107
			u16 tx_size;
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
   108
			u16 rx_size;
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
   109
		};
2569
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
   110
		struct {
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
   111
			u8 tx_dma_chan;
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
   112
			u8 rx_dma_chan;
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
   113
		};
2636
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
   114
		struct {
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
   115
			u8 sram_width;
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
   116
			u8 sram_size;
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
   117
			u16 reserved;
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
   118
		};
2569
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
   119
	};
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
   120
	u32 addr;
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
   121
	u32 size;
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
   122
};
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
   123
2636
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
   124
struct ccat_function {
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
   125
	const struct ccat_driver *drv;
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
   126
	struct ccat_device *ccat;
2569
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
   127
	struct ccat_info_block info;
2636
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
   128
	struct list_head list;
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
   129
	void *private_data;
2550
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
   130
};
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
   131
2636
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
   132
struct ccat_class {
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
   133
	dev_t dev;
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
   134
	struct class *class;
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
   135
	atomic_t instances;
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
   136
	const unsigned count;
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
   137
	struct ccat_cdev *devices;
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
   138
	const char *name;
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
   139
	struct file_operations fops;
2573
ad9a35065387 remove print.* from release tree
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2570
diff changeset
   140
};
ad9a35065387 remove print.* from release tree
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2570
diff changeset
   141
2636
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
   142
extern void ccat_cdev_remove(struct ccat_function *func);
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
   143
extern int ccat_cdev_probe(struct ccat_function *func,
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
   144
			   struct ccat_class *cdev_class, size_t iosize);
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
   145
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
   146
/**
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
   147
 * struct ccat_driver - CCAT FPGA function
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
   148
 * @probe: add device instance
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
   149
 * @remove: remove device instance
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
   150
 * @type: type of the FPGA function supported by this driver
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
   151
 * @cdev_class: if not NULL that driver supports ccat_class_init()/_exit()
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
   152
 */
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
   153
struct ccat_driver {
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
   154
	int (*probe) (struct ccat_function * func);
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
   155
	void (*remove) (struct ccat_function * drv);
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
   156
	enum ccat_info_t type;
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
   157
	struct ccat_class *cdev_class;
2569
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
   158
};
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
   159
2550
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
   160
#endif /* #ifndef _CCAT_H_ */