devices/ccat/module.h
author Patrick Bruenn <p.bruenn@beckhoff.com>
Mon, 26 Oct 2015 08:28:10 +0100
branchstable-1.5
changeset 2637 1d9be5716dee
parent 2636 0613017547fe
child 2638 5995331a55fe
permissions -rw-r--r--
fix ccat startup stall. In case the dma memory was allocated above 4 GB limit, CCAT is unable to access it.
-> limit the dma_mask to 32-bit to omit this situation
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"
2636
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
    32
#define DRV_VERSION      "0.13" 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
2636
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
    38
extern struct ccat_driver eth_eim_driver;
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
    39
extern struct ccat_driver eth_dma_driver;
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
    40
extern struct ccat_driver gpio_driver;
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
    41
extern struct ccat_driver sram_driver;
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
    42
extern struct ccat_driver update_driver;
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
    43
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
    44
/**
2569
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
    45
 * CCAT function type identifiers (u16)
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
    46
 */
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
    47
enum ccat_info_t {
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
    48
	CCATINFO_NOTUSED = 0,
2636
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
    49
	CCATINFO_ETHERCAT_NODMA = 0x3,
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
    50
	CCATINFO_GPIO = 0xd,
2569
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
    51
	CCATINFO_EPCS_PROM = 0xf,
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
    52
	CCATINFO_ETHERCAT_MASTER_DMA = 0x14,
2636
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
    53
	CCATINFO_SRAM = 0x16,
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
    54
};
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
    55
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
    56
struct ccat_cdev {
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
    57
	atomic_t in_use;
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
    58
	void __iomem *ioaddr;
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
    59
	size_t iosize;
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
    60
	dev_t dev;
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
    61
	struct cdev cdev;
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
    62
	struct ccat_class *class;
2569
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
    63
};
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
    64
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
    65
/**
2636
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
    66
 * struct cdev_buffer
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
    67
 * @ccdev: referenced character device
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
    68
 * @data: buffer used for write operations
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
    69
 * @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
    70
 */
2636
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
    71
struct cdev_buffer {
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
    72
	struct ccat_cdev *ccdev;
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
    73
	size_t size;
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
    74
	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
    75
};
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
    76
2636
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
    77
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
    78
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
    79
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
    80
/**
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
    81
 * 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
    82
 * @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
    83
 * @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
    84
 * @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
    85
 * @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
    86
 *
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
    87
 * 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
    88
 * 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
    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
struct ccat_device {
2636
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
    91
	void *pdev;
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
    92
	void __iomem *bar_0;
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
    93
	void __iomem *bar_2;
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
    94
	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
    95
};
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
    96
2573
ad9a35065387 remove print.* from release tree
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2570
diff changeset
    97
struct ccat_info_block {
2569
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
    98
	u16 type;
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
    99
	u16 rev;
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
   100
	union {
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
   101
		u32 config;
2636
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
   102
		u8 num_gpios;
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
   103
		struct {
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
   104
			u16 tx_size;
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
   105
			u16 rx_size;
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
   106
		};
2569
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
   107
		struct {
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
   108
			u8 tx_dma_chan;
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
   109
			u8 rx_dma_chan;
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
   110
		};
2636
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
   111
		struct {
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
   112
			u8 sram_width;
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
   113
			u8 sram_size;
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
   114
			u16 reserved;
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
   115
		};
2569
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
   116
	};
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
   117
	u32 addr;
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
   118
	u32 size;
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
2636
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
   121
struct ccat_function {
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
   122
	const struct ccat_driver *drv;
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
   123
	struct ccat_device *ccat;
2569
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
   124
	struct ccat_info_block info;
2636
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
   125
	struct list_head list;
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
   126
	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
   127
};
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
   128
2636
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
   129
struct ccat_class {
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
   130
	dev_t dev;
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
   131
	struct class *class;
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
   132
	atomic_t instances;
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
   133
	const unsigned count;
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
   134
	struct ccat_cdev *devices;
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
   135
	const char *name;
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
   136
	struct file_operations fops;
2573
ad9a35065387 remove print.* from release tree
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2570
diff changeset
   137
};
ad9a35065387 remove print.* from release tree
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2570
diff changeset
   138
2636
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
   139
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
   140
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
   141
			   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
   142
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
   143
/**
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
   144
 * struct ccat_driver - CCAT FPGA function
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
   145
 * @probe: add device instance
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
   146
 * @remove: remove device instance
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
   147
 * @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
   148
 * @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
   149
 */
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
   150
struct ccat_driver {
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
   151
	int (*probe) (struct ccat_function * func);
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
   152
	void (*remove) (struct ccat_function * drv);
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
   153
	enum ccat_info_t type;
0613017547fe update ccat driver to v0.13
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2578
diff changeset
   154
	struct ccat_class *cdev_class;
2569
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
   155
};
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
   156
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
   157
#endif /* #ifndef _CCAT_H_ */