-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathhw_pcie_cvp_constants.h
executable file
·92 lines (84 loc) · 3.49 KB
/
hw_pcie_cvp_constants.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
/*
* Copyright (c) 2014, Altera Corporation.
* All rights reserved.
*
* This software is available to you under a choice of one of two
* licenses. You may choose to be licensed under the terms of the GNU
* General Public License (GPL) Version 2, available from the file
* COPYING in the main directory of this source tree, or the
* BSD 3-Clause license below:
*
* Redistribution and use in source and binary forms, with or
* without modification, are permitted provided that the following
* conditions are met:
*
* - Redistributions of source code must retain the above
* copyright notice, this list of conditions and the following
* disclaimer.
*
* - Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* - Neither Altera nor the names of its contributors may be
* used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
/* Constants for access VSEC section of hard PCIe block in devices
* that support Configuration via Protocol (CvP). */
/* All data in this file is taken from qquartus/pgm/h/cvp_drv.h and
* quartus/pgm/cvp_dr/cvp_drv.c */
/* Configuration data is written to this offset, BAR 0 */
#define OFFSET_NONE 0x0
/* offset of VSEC within configuration space */
#define OFFSET_VSEC 0x200
/* offset of sections of VSEC, relative to OFFSET_VSEC */
#define OFFSET_ALTERA_MARKER 0x08
#define OFFSET_CVP_STATUS 0x1E
#define OFFSET_CVP_MODE_CTRL 0x20
#define OFFSET_CVP_NUMCLKS 0X21
#define OFFSET_CVP_DATA 0x28
#define OFFSET_CVP_PROG_CTRL 0x2C
#define OFFSET_UNC_IE_STATUS 0x34
#define OFFSET_UNC_IE_MASK 0x38
#define OFFSET_C_IE_STATUS 0x3C
#define OFFSET_C_IE_MASK 0x40
/* bit masks to extract specific bit value from 8-bit VSEC value. */
#define MASK_DATA_ENCRYPTED 0x01 // bit 0 of CVP_STATUS
#define MASK_DATA_COMPRESSED 0x02 // bit 1 of CVP_STATUS
#define MASK_CVP_CONFIG_READY 0x04 // bit 2 of CVP_STATUS
#define MASK_CVP_CONFIG_ERROR 0x08 // bit 3 of CVP_STATUS
#define MASK_CVP_EN 0x10 // bit 4 of CVP_STATUS
#define MASK_USER_MODE 0x20 // bit 5 of CVP_STATUS
#define MASK_PLD_CLK_IN_USE 0x01 // bit 8 of CVP_STATUS (ie, bit 0 of byte offset CVP_STATUS+1)
#define MASK_CVP_MODE 0x01 // bit 0 of CVP_MODE_CTRL
#define MASK_HIP_CLK_SEL 0X02 // bit 1 of CVP_MODE_CTRL
#define MASK_CVP_CONFIG 0x01 // bit 0 of CVP_PROG_CTRL
#define MASK_START_XFER 0x02 // bit 1 of CVP_PROG_CTRL
#define MASK_CVP_CFG_ERR_LATCH 0x20 // bit 5 of UNC_IE_STATUS
/* VSEC bit definitions.
* The driver will map VSEC_BITs to offset and mask above. */
enum VSEC_BIT {
DATA_ENCRYPTED = 0,
DATA_COMPRESSED,
CVP_CONFIG_READY,
CVP_CONFIG_ERROR,
CVP_EN,
USER_MODE,
PLD_CLK_IN_USE,
CVP_MODE,
HIP_CLK_SEL,
CVP_CONFIG,
START_XFER,
CVP_CFG_ERR_LATCH
};