blob: 4f8ef0299d2e471d0cab6b093811d892e87fc4f2 [file] [log] [blame]
Nico Huber83693c82016-10-08 22:17:55 +02001--
2-- Copyright (C) 2015 secunet Security Networks AG
3--
4-- This program is free software; you can redistribute it and/or modify
5-- it under the terms of the GNU General Public License as published by
Nico Huber125a29e2016-10-18 00:23:54 +02006-- the Free Software Foundation; either version 2 of the License, or
7-- (at your option) any later version.
Nico Huber83693c82016-10-08 22:17:55 +02008--
9-- This program is distributed in the hope that it will be useful,
10-- but WITHOUT ANY WARRANTY; without even the implied warranty of
11-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12-- GNU General Public License for more details.
13--
14
15with HW.GFX.DP_Aux_Ch;
16
17private generic
18
19 type T (<>) is limited private;
20
21 with package Aux_Ch is new DP_Aux_Ch (T => T, others => <>);
22
23package HW.GFX.DP_Info is
24
25 type DP_Voltage_Swing is (VS_Level_0, VS_Level_1, VS_Level_2, VS_Level_3);
26
27 type DP_Pre_Emph is (Emph_Level_0, Emph_Level_1, Emph_Level_2, Emph_Level_3);
28
29 type Train_Set is record
30 Voltage_Swing : DP_Voltage_Swing;
31 Pre_Emph : DP_Pre_Emph;
32 end record;
33
34 type Training_Pattern is (TP_1, TP_2, TP_3, TP_Idle, TP_None);
35
36 ----------------------------------------------------------------------------
37
38 type Lane_Index is new Natural range 0 .. 3;
39
40 type Lane_Status is record
41 CR_Done : Boolean;
42 Channel_EQ_Done : Boolean;
43 Symbol_Locked : Boolean;
44 Reserved : Boolean;
45 end record;
46 for Lane_Status use record
47 CR_Done at 16#00# range 0 .. 0;
48 Channel_EQ_Done at 16#00# range 1 .. 1;
49 Symbol_Locked at 16#00# range 2 .. 2;
50 Reserved at 16#00# range 3 .. 3;
51 end record;
52 type Lanes_Status is array (Lane_Index) of Lane_Status;
53 pragma Pack (Lanes_Status);
54
55 type Adjust_Request is record
56 Voltage_Swing : DP_Voltage_Swing;
57 Pre_Emph : DP_Pre_Emph;
58 end record;
59 for Adjust_Request use record
60 Voltage_Swing at 16#00# range 0 .. 1;
61 Pre_Emph at 16#00# range 2 .. 3;
62 end record;
63 type Adjust_Requests_Array is array (Lane_Index) of Adjust_Request;
64 pragma Pack (Adjust_Requests_Array);
65
66 type Link_Status is record
67 Lanes : Lanes_Status;
68 Interlane_Align_Done : Boolean;
69 Adjust_Requests : Adjust_Requests_Array;
70 end record;
71 for Link_Status use record
72 Lanes at 16#00# range 0 .. 15;
73 Interlane_Align_Done at 16#02# range 0 .. 0;
74 Adjust_Requests at 16#04# range 0 .. 15;
75 end record;
76
77 ----------------------------------------------------------------------------
78
79 procedure Read_Caps
80 (Link : in out DP_Link;
81 Port : in T;
82 Success : out Boolean);
83
84 procedure Preferred_Link_Setting
85 (Link : in out DP_Link;
86 Mode : in Mode_Type;
87 Success : out Boolean);
88
89 procedure Next_Link_Setting
90 (Link : in out DP_Link;
91 Mode : in Mode_Type;
92 Success : out Boolean);
93
94 ----------------------------------------------------------------------------
95
96 M_N_Max : constant := 2 ** 24 - 1;
97
98 subtype M_Type is Int64 range 0 .. M_N_Max;
99 subtype N_Type is Int64 range 0 .. M_N_Max;
100
101 procedure Calculate_M_N
102 (Link : in DP_Link;
103 Mode : in Mode_Type;
104 Data_M : out M_Type;
105 Data_N : out N_Type;
106 Link_M : out M_Type;
107 Link_N : out N_Type);
108
109 ----------------------------------------------------------------------------
110
111 procedure Read_Link_Status
112 (Port : in T;
113 Status : out Link_Status;
114 Success : out Boolean);
115
116 function All_CR_Done
117 (Status : Link_Status;
118 Link : DP_Link)
119 return Boolean;
120
121 function All_EQ_Done
122 (Status : Link_Status;
123 Link : DP_Link)
124 return Boolean;
125
126 function Max_Requested_VS
127 (Status : Link_Status;
128 Link : DP_Link)
129 return DP_Voltage_Swing;
130
131 function Max_Requested_Emph
132 (Status : Link_Status;
133 Link : DP_Link)
134 return DP_Pre_Emph;
135
136end HW.GFX.DP_Info;