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