blob: f981940ce18f71b6eb48ad3b6d8526439bd19b22 [file] [log] [blame]
Nico Huber83693c82016-10-08 22:17:55 +02001--
2-- Copyright (C) 2016 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
14with HW.GFX.GMA.Registers;
15
16package body HW.GFX.GMA.PLLs.DPLL_0 is
17
18 DPLL_CTRL1_DPLL0_LINK_RATE_MASK : constant := 7 * 2 ** 1;
19 DPLL_CTRL1_DPLL0_LINK_RATE_2700MHZ : constant := 0 * 2 ** 1;
20 DPLL_CTRL1_DPLL0_LINK_RATE_1350MHZ : constant := 1 * 2 ** 1;
21 DPLL_CTRL1_DPLL0_LINK_RATE_810MHZ : constant := 2 * 2 ** 1;
22 DPLL_CTRL1_DPLL0_LINK_RATE_1620MHZ : constant := 3 * 2 ** 1;
23 DPLL_CTRL1_DPLL0_LINK_RATE_1080MHZ : constant := 4 * 2 ** 1;
24 DPLL_CTRL1_DPLL0_LINK_RATE_2160MHZ : constant := 5 * 2 ** 1;
25 DPLL_CTRL1_DPLL0_OVERRIDE : constant := 1 * 2 ** 0;
26
27 procedure Check_Link_Rate
28 (Link_Rate : in DP_Bandwidth;
29 Success : out Boolean)
30 is
31 DPLL_Ctrl1 : Word32;
32 begin
33 Registers.Read (Registers.DPLL_CTRL1, DPLL_Ctrl1);
34
35 case DPLL_Ctrl1 and DPLL_CTRL1_DPLL0_LINK_RATE_MASK is
36 when DPLL_CTRL1_DPLL0_LINK_RATE_2700MHZ =>
37 Success := Link_Rate = DP_Bandwidth_5_4;
38 when DPLL_CTRL1_DPLL0_LINK_RATE_1350MHZ =>
39 Success := Link_Rate = DP_Bandwidth_2_7;
40 when DPLL_CTRL1_DPLL0_LINK_RATE_810MHZ =>
41 Success := Link_Rate = DP_Bandwidth_1_62;
42 when others =>
43 Success := False;
44 end case;
45 Success := Success and (DPLL_Ctrl1 and DPLL_CTRL1_DPLL0_OVERRIDE) /= 0;
46 end Check_Link_Rate;
47
48end HW.GFX.GMA.PLLs.DPLL_0;