| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 1 | -- |
| Nico Huber | af9cc9e | 2017-01-09 13:11:32 +0100 | [diff] [blame] | 2 | -- Copyright (C) 2015-2017 secunet Security Networks AG |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 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 Huber | 125a29e | 2016-10-18 00:23:54 +0200 | [diff] [blame] | 6 | -- the Free Software Foundation; either version 2 of the License, or |
| 7 | -- (at your option) any later version. |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 8 | -- |
| 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 | |
| 15 | with HW.GFX.DP_Aux_Ch; |
| 16 | |
| 17 | private generic |
| 18 | |
| 19 | type T (<>) is limited private; |
| 20 | |
| 21 | with package Aux_Ch is new DP_Aux_Ch (T => T, others => <>); |
| 22 | |
| 23 | package 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 | |
| Nico Huber | 420e863 | 2022-09-04 13:04:49 +0200 | [diff] [blame^] | 66 | type Link_Status_Padding is mod 2**15; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 67 | type Link_Status is record |
| 68 | Lanes : Lanes_Status; |
| 69 | Interlane_Align_Done : Boolean; |
| Nico Huber | 420e863 | 2022-09-04 13:04:49 +0200 | [diff] [blame^] | 70 | Padding : Link_Status_Padding; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 71 | Adjust_Requests : Adjust_Requests_Array; |
| 72 | end record; |
| 73 | for Link_Status use record |
| 74 | Lanes at 16#00# range 0 .. 15; |
| 75 | Interlane_Align_Done at 16#02# range 0 .. 0; |
| Nico Huber | 420e863 | 2022-09-04 13:04:49 +0200 | [diff] [blame^] | 76 | Padding at 16#02# range 1 .. 15; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 77 | Adjust_Requests at 16#04# range 0 .. 15; |
| 78 | end record; |
| Nico Huber | 420e863 | 2022-09-04 13:04:49 +0200 | [diff] [blame^] | 79 | for Link_Status'Size use 48; |
| 80 | for Link_Status'Object_Size use 48; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 81 | |
| 82 | ---------------------------------------------------------------------------- |
| 83 | |
| 84 | procedure Read_Caps |
| 85 | (Link : in out DP_Link; |
| 86 | Port : in T; |
| 87 | Success : out Boolean); |
| 88 | |
| Greg V | 3d3452f | 2019-10-08 02:05:05 +0300 | [diff] [blame] | 89 | procedure Read_eDP_Rates |
| 90 | (Link : in out DP_Link; |
| 91 | Port : in T); |
| 92 | |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 93 | procedure Preferred_Link_Setting |
| 94 | (Link : in out DP_Link; |
| 95 | Mode : in Mode_Type; |
| 96 | Success : out Boolean); |
| 97 | |
| 98 | procedure Next_Link_Setting |
| 99 | (Link : in out DP_Link; |
| 100 | Mode : in Mode_Type; |
| 101 | Success : out Boolean); |
| 102 | |
| Nico Huber | af9cc9e | 2017-01-09 13:11:32 +0100 | [diff] [blame] | 103 | pragma Warnings |
| 104 | (GNATprove, Off, "subprogram ""Dump_Link_Setting"" has no effect", |
| 105 | Reason => "It's only used for debugging"); |
| 106 | procedure Dump_Link_Setting (Link : DP_Link); |
| 107 | |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 108 | ---------------------------------------------------------------------------- |
| 109 | |
| 110 | M_N_Max : constant := 2 ** 24 - 1; |
| 111 | |
| 112 | subtype M_Type is Int64 range 0 .. M_N_Max; |
| 113 | subtype N_Type is Int64 range 0 .. M_N_Max; |
| 114 | |
| 115 | procedure Calculate_M_N |
| 116 | (Link : in DP_Link; |
| 117 | Mode : in Mode_Type; |
| 118 | Data_M : out M_Type; |
| 119 | Data_N : out N_Type; |
| 120 | Link_M : out M_Type; |
| 121 | Link_N : out N_Type); |
| 122 | |
| 123 | ---------------------------------------------------------------------------- |
| 124 | |
| 125 | procedure Read_Link_Status |
| 126 | (Port : in T; |
| 127 | Status : out Link_Status; |
| 128 | Success : out Boolean); |
| 129 | |
| 130 | function All_CR_Done |
| 131 | (Status : Link_Status; |
| 132 | Link : DP_Link) |
| 133 | return Boolean; |
| 134 | |
| 135 | function All_EQ_Done |
| 136 | (Status : Link_Status; |
| 137 | Link : DP_Link) |
| 138 | return Boolean; |
| 139 | |
| 140 | function Max_Requested_VS |
| 141 | (Status : Link_Status; |
| 142 | Link : DP_Link) |
| 143 | return DP_Voltage_Swing; |
| 144 | |
| 145 | function Max_Requested_Emph |
| 146 | (Status : Link_Status; |
| 147 | Link : DP_Link) |
| 148 | return DP_Pre_Emph; |
| 149 | |
| 150 | end HW.GFX.DP_Info; |