devices/ccat/module.h
author Patrick Bruenn <p.bruenn@beckhoff.com>
Thu, 05 Jun 2014 16:40:01 +0200
branchstable-1.5
changeset 2570 144e11d93e99
parent 2569 720172a7563f
child 2573 ad9a35065387
permissions -rw-r--r--
- don't use compat.h in the mainline driver
- correct constness of function pointer declarations
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>
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
    25
#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
    26
#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
    27
#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
    28
#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
    29
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
#define DRV_EXTRAVERSION "-ec"
2565
f7b06b264646 - restored examples/user/
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2554
diff changeset
    31
#define DRV_VERSION      "0.9" 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
    32
#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
    33
2551
000da5069f1a clean up CCatDefinitions.h
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2550
diff changeset
    34
#undef pr_fmt
000da5069f1a clean up CCatDefinitions.h
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2550
diff changeset
    35
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
000da5069f1a clean up CCatDefinitions.h
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2550
diff changeset
    36
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
    37
/**
2569
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
    38
 * CCAT function type identifiers (u16)
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
    39
 */
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
    40
enum ccat_info_t {
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
    41
	CCATINFO_NOTUSED = 0,
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
    42
	CCATINFO_EPCS_PROM = 0xf,
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
    43
	CCATINFO_ETHERCAT_MASTER_DMA = 0x14,
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
    44
	CCATINFO_COPY_BLOCK = 0x17,
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
    45
	CCATINFO_MAX
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
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
    48
/**
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
    49
 * struct ccat_bar - CCAT PCI Base Address Register(BAR) configuration
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
    50
 * @start: start address of this BAR
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
    51
 * @end: end address of this BAR
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
    52
 * @len: length of this BAR
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
    53
 * @flags: flags set on this BAR
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
    54
 * @ioaddr: ioremapped address of this bar
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
    55
 */
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
    56
struct ccat_bar {
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
    57
	unsigned long start;
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
    58
	unsigned long end;
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
    59
	unsigned long len;
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
    60
	unsigned long flags;
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
    61
	void __iomem *ioaddr;
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
    62
};
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
    63
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
    64
/**
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
    65
 * struct ccat_dma - CCAT DMA channel configuration
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
    66
 * @phys: device-viewed address(physical) of the associated DMA memory
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
    67
 * @virt: CPU-viewed address(virtual) of the associated DMA memory
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
    68
 * @size: number of bytes in the associated DMA memory
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
    69
 * @channel: CCAT DMA channel number
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
 * @dev: valid struct device pointer
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
    71
 */
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
    72
struct ccat_dma {
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
	dma_addr_t phys;
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
    74
	void *virt;
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
	size_t size;
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
	size_t channel;
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
    77
	struct device *dev;
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
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
extern void ccat_dma_free(struct ccat_dma *const dma);
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
extern int ccat_dma_init(struct ccat_dma *const dma, size_t channel,
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
			 void __iomem * const ioaddr, struct device *const dev);
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
/**
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
 * struct ccat_eth_frame - Ethernet frame with DMA descriptor header in front
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
 * @reservedn: is not used and should always be set to 0
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
 * @received: used for reception, is set to 1 by the CCAT when data was written
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
    88
 * @length: number of bytes in the frame including the DMA header
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
 * @sent: is set to 1 by the CCAT when data was transmitted
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
 * @timestamp: a 64 bit EtherCAT timestamp
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
    91
 * @data: the bytes of the ethernet frame
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_eth_frame {
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
    94
	u32 reserved1;
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
    95
	u32 received:1;
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
    96
	u32 reserved2:31;
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
    97
	u16 length;
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
    98
	u16 reserved3;
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
    99
	u32 sent:1;
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
   100
	u32 reserved4:31;
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
   101
	u64 timestamp;
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
   102
	u8 data[0x800 - 3 * sizeof(u64)];
2569
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
   103
#define CCAT_ETH_FRAME_HEAD_LEN offsetof(struct ccat_eth_frame, 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
   104
};
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
   105
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
   106
/**
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
   107
 * struct ccat_eth_register - CCAT register addresses in the PCI BAR
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
   108
 * @mii: address of the CCAT management interface register
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
   109
 * @tx_fifo: address of the CCAT TX DMA fifo register
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
   110
 * @rx_fifo: address of the CCAT RX DMA fifo register
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
   111
 * @mac: address of the CCAT media access control register
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
   112
 * @rx_mem: address of the CCAT register holding the RX DMA address
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
   113
 * @tx_mem: address of the CCAT register holding the TX DMA address
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
   114
 * @misc: address of a CCAT register holding miscellaneous information
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
   115
 */
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
   116
struct ccat_eth_register {
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
   117
	void __iomem *mii;
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
   118
	void __iomem *tx_fifo;
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
   119
	void __iomem *rx_fifo;
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
   120
	void __iomem *mac;
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
   121
	void __iomem *rx_mem;
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
   122
	void __iomem *tx_mem;
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
   123
	void __iomem *misc;
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
   124
};
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
   125
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
   126
/**
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
 * struct ccat_eth_dma_fifo - CCAT RX or TX DMA fifo
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
 * @add: callback used to add a frame to this fifo
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
   129
 * @reg: PCI register address of this DMA fifo
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
 * @dma: information about the associated DMA memory
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
 */
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
   132
struct ccat_eth_dma_fifo {
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
   133
	void (*add) (struct ccat_eth_frame *, struct ccat_eth_dma_fifo *);
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
   134
	void __iomem *reg;
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
   135
	struct ccat_dma dma;
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
   136
};
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
   137
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
   138
/**
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
   139
 * 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
   140
 * @pdev: pointer to the pci object allocated by the kernel
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
   141
 * @ethdev: CCAT Ethernet/EtherCAT Master (with DMA) function, NULL if function is not available or failed to initialize
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
   142
 * @update: CCAT Update function, NULL if function is not available or failed to initialize
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
   143
 * @bar [0] and [2] holding information about PCI BARs 0 and 2.
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
   144
 *
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
   145
 * One instance of a ccat_device should represent a physical CCAT. Since
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
   146
 * a CCAT is implemented as FPGA the available functions can vary so
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
   147
 * the function object pointers can be NULL.
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
   148
 * Extra note: you will recognize that PCI BAR1 is not used and is a
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
   149
 * waste of memory, thats true but right now, its very easy to use it
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
   150
 * this way. So we might optimize it later.
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
   151
 */
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
   152
struct ccat_device {
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
   153
	struct pci_dev *pdev;
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
   154
	struct ccat_eth_priv *ethdev;
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
   155
	struct ccat_update *update;
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
   156
	struct ccat_bar bar[3];	//TODO optimize this
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
};
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
   158
2569
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
   159
struct ccat_info_block
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
   160
{
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
   161
	u16 type;
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
   162
	u16 rev;
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
   163
	union {
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
   164
		u32 config;
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
   165
		struct {
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
   166
			u8 tx_dma_chan;
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
   167
			u8 rx_dma_chan;
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
   168
		};
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
   169
	};
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
   170
	u32 addr;
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
   171
	u32 size;
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
   172
};
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
   173
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
   174
/**
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
   175
 * struct ccat_eth_priv - CCAT Ethernet/EtherCAT Master function (netdev)
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
   176
 * @ccatdev: pointer to the parent struct ccat_device
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
   177
 * @netdev: the net_device structure used by the kernel networking stack
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
   178
 * @next_tx_frame: pointer to the next TX DMA descriptor, which the tx_thread should check for availablity
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
   179
 * @info: holds a copy of the CCAT Ethernet/EtherCAT Master function information block (read from PCI config space)
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
   180
 * @reg: register addresses in PCI config space of the Ethernet/EtherCAT Master function
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
   181
 * @rx_fifo: DMA fifo used for RX DMA descriptors
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
   182
 * @tx_fifo: DMA fifo used for TX DMA descriptors
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
   183
 * @poll_timer: interval timer used to poll CCAT for events like link changed, rx done, tx done
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
   184
 * @rx_bytes: number of bytes received -> reported with ndo_get_stats64()
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
   185
 * @rx_dropped: number of received frames, which were dropped -> reported with ndo_get_stats64()
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
   186
 * @tx_bytes: number of bytes send -> reported with ndo_get_stats64()
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
   187
 * @tx_dropped: number of frames requested to send, which were dropped -> reported with ndo_get_stats64()
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
   188
 */
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
   189
struct ccat_eth_priv {
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
   190
	const struct ccat_device *ccatdev;
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
   191
	struct net_device *netdev;
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
   192
	const struct ccat_eth_frame *next_tx_frame;
2569
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
   193
	struct ccat_info_block info;
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
   194
	struct ccat_eth_register reg;
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
   195
	struct ccat_eth_dma_fifo rx_fifo;
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
   196
	struct ccat_eth_dma_fifo tx_fifo;
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
   197
	struct hrtimer poll_timer;
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
   198
	atomic64_t rx_bytes;
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
   199
	atomic64_t rx_dropped;
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
   200
	atomic64_t tx_bytes;
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
   201
	atomic64_t tx_dropped;
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
   202
	ec_device_t *ecdev;
2570
144e11d93e99 - don't use compat.h in the mainline driver
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2569
diff changeset
   203
	void (*carrier_off) (struct net_device * netdev);
144e11d93e99 - don't use compat.h in the mainline driver
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2569
diff changeset
   204
	bool (*carrier_ok) (const struct net_device * netdev);
144e11d93e99 - don't use compat.h in the mainline driver
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2569
diff changeset
   205
	void (*carrier_on) (struct net_device * netdev);
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
   206
	void (*kfree_skb_any) (struct sk_buff * skb);
2570
144e11d93e99 - don't use compat.h in the mainline driver
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2569
diff changeset
   207
	void (*start_queue) (struct net_device * netdev);
144e11d93e99 - don't use compat.h in the mainline driver
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2569
diff changeset
   208
	void (*stop_queue) (struct net_device * netdev);
144e11d93e99 - don't use compat.h in the mainline driver
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2569
diff changeset
   209
	void (*tx_fifo_full) (struct ccat_eth_priv * priv,
144e11d93e99 - don't use compat.h in the mainline driver
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2569
diff changeset
   210
			      const struct ccat_eth_frame * frame);
144e11d93e99 - don't use compat.h in the mainline driver
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2569
diff changeset
   211
	void (*unregister) (struct net_device * netdev);
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
   212
};
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
   213
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
   214
/**
2569
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
   215
 * same as: typedef struct _CCatInfoBlockOffs from CCatDefinitions.h
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
   216
 * TODO add some checking facility outside of the linux tree
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
   217
 */
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
   218
struct ccat_mac_infoblock {
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
   219
	u32 reserved;
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
   220
	u32	mii;
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
   221
	u32	tx_fifo;
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
   222
	u32	mac;
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
   223
	u32	rx_mem;
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
   224
	u32	tx_mem;
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
   225
	u32	misc;
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
   226
};
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
   227
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
   228
struct ccat_mac_register
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
   229
{
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
   230
	/** MAC error register     @+0x0 */
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
   231
	u8 frame_len_err;
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
   232
	u8 rx_err;
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
   233
	u8 crc_err;
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
   234
	u8 link_lost_err;
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
   235
	u32 reserved1;
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
   236
	/** Buffer overflow errors @+0x8 */
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
   237
	u8 rx_mem_full;
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
   238
	u8 reserved2[7];
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
   239
	/** MAC frame counter      @+0x10 */
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
   240
	u32 tx_frames;
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
   241
	u32 rx_frames;
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
   242
	u64 reserved3;
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
   243
	/** MAC fifo level         @+0x20 */
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
   244
	u8 tx_fifo_level : 7;
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
   245
	u8 reserved4 : 1;
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
   246
	u8 reserved5[7];
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
   247
	/** TX memory full error   @+0x28 */
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
   248
	u8 tx_mem_full;
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
   249
	u8 reserved6[7];
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
   250
	u64 reserved8[9];
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
   251
	/** Connection             @+0x78 */
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
   252
	u8 mii_connected;
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
   253
};
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
   254
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
   255
/**
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
   256
 * struct ccat_update - CCAT Update function (update)
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
   257
 * @ccatdev: pointer to the parent struct ccat_device
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
   258
 * @ioaddr: PCI base address of the CCAT Update function
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
   259
 * dev: device number for this update function
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
   260
 * cdev: character device used for the CCAT Update function
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
   261
 * class: pointer to a device class used when registering the CCAT Update device
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
   262
 * @info: holds a copy of the CCAT Update function information block (read from PCI config space)
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
   263
 */
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
   264
struct ccat_update {
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
   265
	struct kref refcount;
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
   266
	void __iomem *ioaddr;
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
   267
	dev_t dev;
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
   268
	struct cdev cdev;
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
   269
	struct class *class;
2569
720172a7563f make ccat driver more linux compliant
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2567
diff changeset
   270
	struct ccat_info_block info;
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
   271
};
7e25950ea941 replace not working symlinks with real copies from the ccat main repository(git)
Patrick Bruenn <p.bruenn@beckhoff.com>
parents: 2549
diff changeset
   272
#endif /* #ifndef _CCAT_H_ */