ChimeraTK-DeviceAccess
03.18.00
pciedev_io_compat.h
Go to the documentation of this file.
1
// SPDX-FileCopyrightText: Deutsches Elektronen-Synchrotron DESY, MSK, ChimeraTK Project <chimeratk-support@desy.de>
2
// SPDX-License-Identifier: LGPL-3.0-or-later
3
#pragma once
4
5
// This is C code from the kernel driver. Turn off the C++ linter warnings
6
// NOLINTBEGIN
7
8
#include <linux/ioctl.h>
/* needed for the _IOW etc stuff used later */
9
#include <linux/types.h>
10
#include <sys/time.h>
11
12
#define RW_D8 0x0
13
#define RW_D16 0x1
14
#define RW_D32 0x2
15
#define RW_DMA 0x3
16
#define RW_INFO 0x4
17
#define DMA_DATA_OFFSET 6
18
#define DMA_DATA_OFFSET_BYTE 24
19
#define PCIEDEV_DMA_SYZE 4096
20
#define PCIEDEV_DMA_MIN_SYZE 128
21
22
#define IOCTRL_R 0x00
23
#define IOCTRL_W 0x01
24
#define IOCTRL_ALL 0x02
25
26
#define BAR0 0
27
#define BAR1 1
28
#define BAR2 2
29
#define BAR3 3
30
#define BAR4 4
31
#define BAR5 5
32
33
/* generic register access */
34
struct
device_rw
{
35
unsigned
int
offset_rw
;
/* offset in address */
36
unsigned
int
data_rw
;
/* data to set or returned read data */
37
unsigned
int
mode_rw
;
/* mode of rw (RW_D8, RW_D16, RW_D32) */
38
unsigned
int
barx_rw
;
/* BARx (0, 1, 2, 3, 4, 5) */
39
unsigned
int
size_rw
;
/* transfer size in bytes */
40
unsigned
int
rsrvd_rw
;
/* transfer size in bytes */
41
};
42
typedef
struct
device_rw
device_rw
;
43
44
struct
device_ioctrl_data
{
45
unsigned
int
offset
;
46
unsigned
int
data
;
47
unsigned
int
cmd
;
48
unsigned
int
reserved
;
49
};
50
typedef
struct
device_ioctrl_data
device_ioctrl_data
;
51
52
struct
device_ioctrl_dma
{
53
unsigned
int
dma_offset
;
54
unsigned
int
dma_size
;
55
unsigned
int
dma_cmd
;
// value to DMA Control register
56
unsigned
int
dma_pattern
;
// DMA BAR num
57
unsigned
int
dma_reserved1
;
// DMA Control register offset (31:16) DMA Length
58
// register offset (15:0)
59
unsigned
int
dma_reserved2
;
// DMA Read/Write Source register offset (31:16)
60
// Destination register offset (15:0)
61
};
62
typedef
struct
device_ioctrl_dma
device_ioctrl_dma
;
63
64
struct
device_ioctrl_time
{
65
struct
timeval
start_time
;
66
struct
timeval
stop_time
;
67
};
68
typedef
struct
device_ioctrl_time
device_ioctrl_time
;
69
70
/* Use 'o' as magic number */
71
#define PCIEDOOCS_IOC '0'
72
#define PCIEDEV_PHYSICAL_SLOT _IOWR(PCIEDOOCS_IOC, 60, int)
73
#define PCIEDEV_DRIVER_VERSION _IOWR(PCIEDOOCS_IOC, 61, int)
74
#define PCIEDEV_FIRMWARE_VERSION _IOWR(PCIEDOOCS_IOC, 62, int)
75
#define PCIEDEV_GET_DMA_TIME _IOWR(PCIEDOOCS_IOC, 70, int)
76
#define PCIEDEV_WRITE_DMA _IOWR(PCIEDOOCS_IOC, 71, int)
77
#define PCIEDEV_READ_DMA _IOWR(PCIEDOOCS_IOC, 72, int)
78
#define PCIEDEV_SET_IRQ _IOWR(PCIEDOOCS_IOC, 73, int)
79
#define PCIEDOOCS_IOC_MINNR 60
80
#define PCIEDOOCS_IOC_MAXNR 63
81
#define PCIEDOOCS_IOC_DMA_MINNR 70
82
#define PCIEDOOCS_IOC_DMA_MAXNR 74
83
84
// NOLINTEND
device_ioctrl_data
Definition:
pciedev_io_compat.h:44
device_ioctrl_dma::dma_cmd
unsigned int dma_cmd
Definition:
pciedev_io_compat.h:55
device_ioctrl_data::cmd
unsigned int cmd
Definition:
pciedev_io_compat.h:47
device_ioctrl_data::reserved
unsigned int reserved
Definition:
pciedev_io_compat.h:48
device_ioctrl_data::offset
unsigned int offset
Definition:
pciedev_io_compat.h:45
device_ioctrl_time
Definition:
pciedev_io_compat.h:64
device_ioctrl_dma
Definition:
pciedev_io_compat.h:52
device_ioctrl_time::start_time
struct timeval start_time
Definition:
pciedev_io_compat.h:65
device_ioctrl_dma::dma_reserved2
unsigned int dma_reserved2
Definition:
pciedev_io_compat.h:59
device_rw::offset_rw
unsigned int offset_rw
Definition:
pciedev_io_compat.h:35
device_ioctrl_dma::dma_reserved1
unsigned int dma_reserved1
Definition:
pciedev_io_compat.h:57
device_rw::barx_rw
unsigned int barx_rw
Definition:
pciedev_io_compat.h:38
device_ioctrl_dma::dma_size
unsigned int dma_size
Definition:
pciedev_io_compat.h:54
device_ioctrl_dma::dma_offset
unsigned int dma_offset
Definition:
pciedev_io_compat.h:53
device_rw
Definition:
pciedev_io_compat.h:34
device_rw::size_rw
unsigned int size_rw
Definition:
pciedev_io_compat.h:39
device_ioctrl_data::data
unsigned int data
Definition:
pciedev_io_compat.h:46
device_ioctrl_dma::dma_pattern
unsigned int dma_pattern
Definition:
pciedev_io_compat.h:56
device_ioctrl_time::stop_time
struct timeval stop_time
Definition:
pciedev_io_compat.h:66
device_rw::rsrvd_rw
unsigned int rsrvd_rw
Definition:
pciedev_io_compat.h:40
device_rw::data_rw
unsigned int data_rw
Definition:
pciedev_io_compat.h:36
device_rw::mode_rw
unsigned int mode_rw
Definition:
pciedev_io_compat.h:37
sources
ChimeraTK-DeviceAccess
backends
pcie
include
pciedev_io_compat.h
Generated by
1.8.17