blob: 6d22bccfc957ff195b3d42fd01302b138303130d [file] [log] [blame]
Nico Huber83693c82016-10-08 22:17:55 +02001--
Nico Huberaf9cc9e2017-01-09 13:11:32 +01002-- Copyright (C) 2015-2017 secunet Security Networks AG
Nico Huber83693c82016-10-08 22:17:55 +02003--
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
Greg V3d3452f2019-10-08 02:05:05 +030084 procedure Read_eDP_Rates
85 (Link : in out DP_Link;
86 Port : in T);
87
Nico Huber83693c82016-10-08 22:17:55 +020088 procedure Preferred_Link_Setting
89 (Link : in out DP_Link;
90 Mode : in Mode_Type;
91 Success : out Boolean);
92
93 procedure Next_Link_Setting
94 (Link : in out DP_Link;
95 Mode : in Mode_Type;
96 Success : out Boolean);
97
Nico Huberaf9cc9e2017-01-09 13:11:32 +010098 pragma Warnings
99 (GNATprove, Off, "subprogram ""Dump_Link_Setting"" has no effect",
100 Reason => "It's only used for debugging");
101 procedure Dump_Link_Setting (Link : DP_Link);
102
Nico Huber83693c82016-10-08 22:17:55 +0200103 ----------------------------------------------------------------------------
104
105 M_N_Max : constant := 2 ** 24 - 1;
106
107 subtype M_Type is Int64 range 0 .. M_N_Max;
108 subtype N_Type is Int64 range 0 .. M_N_Max;
109
110 procedure Calculate_M_N
111 (Link : in DP_Link;
112 Mode : in Mode_Type;
113 Data_M : out M_Type;
114 Data_N : out N_Type;
115 Link_M : out M_Type;
116 Link_N : out N_Type);
117
118 ----------------------------------------------------------------------------
119
120 procedure Read_Link_Status
121 (Port : in T;
122 Status : out Link_Status;
123 Success : out Boolean);
124
125 function All_CR_Done
126 (Status : Link_Status;
127 Link : DP_Link)
128 return Boolean;
129
130 function All_EQ_Done
131 (Status : Link_Status;
132 Link : DP_Link)
133 return Boolean;
134
135 function Max_Requested_VS
136 (Status : Link_Status;
137 Link : DP_Link)
138 return DP_Voltage_Swing;
139
140 function Max_Requested_Emph
141 (Status : Link_Status;
142 Link : DP_Link)
143 return DP_Pre_Emph;
144
145end HW.GFX.DP_Info;