| Arthur Heymans | 73ea032 | 2018-03-28 17:17:07 +0200 | [diff] [blame] | 1 | -- |
| 2 | -- Copyright (C) 2015-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; either version 2 of the License, or |
| 7 | -- (at your option) any later version. |
| 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.GMA.Config; |
| 16 | with HW.GFX.GMA.Registers; |
| 17 | |
| 18 | with HW.Debug; |
| 19 | with GNAT.Source_Info; |
| 20 | |
| 21 | use type HW.Word64; |
| 22 | |
| 23 | package body HW.GFX.GMA.GMCH.VGA is |
| 24 | |
| 25 | ADPA_DAC_ENABLE : constant := 1 * 2 ** 31; |
| 26 | ADPA_USE_VGA_HVPOLARITY : constant := 1 * 2 ** 15; |
| 27 | ADPA_VSYNC_DISABLE : constant := 1 * 2 ** 11; |
| 28 | ADPA_HSYNC_DISABLE : constant := 1 * 2 ** 10; |
| 29 | ADPA_VSYNC_ACTIVE_HIGH : constant := 1 * 2 ** 4; |
| 30 | ADPA_HSYNC_ACTIVE_HIGH : constant := 1 * 2 ** 3; |
| 31 | |
| 32 | ADPA_MASK : constant Word32 := |
| 33 | GMCH_PORT_PIPE_SELECT_MASK or |
| 34 | ADPA_DAC_ENABLE or |
| 35 | ADPA_VSYNC_DISABLE or |
| 36 | ADPA_HSYNC_DISABLE or |
| 37 | ADPA_VSYNC_ACTIVE_HIGH or |
| 38 | ADPA_HSYNC_ACTIVE_HIGH or |
| 39 | ADPA_USE_VGA_HVPOLARITY; |
| 40 | |
| 41 | ---------------------------------------------------------------------------- |
| 42 | |
| 43 | procedure On |
| 44 | (Pipe : Pipe_Index; |
| 45 | Mode : in Mode_Type) |
| 46 | is |
| 47 | Polarity : Word32 := 0; |
| 48 | begin |
| 49 | pragma Debug (Debug.Put_Line (GNAT.Source_Info.Enclosing_Entity)); |
| 50 | |
| 51 | if Mode.H_Sync_Active_High then |
| 52 | Polarity := Polarity or ADPA_HSYNC_ACTIVE_HIGH; |
| 53 | end if; |
| 54 | if Mode.V_Sync_Active_High then |
| 55 | Polarity := Polarity or ADPA_VSYNC_ACTIVE_HIGH; |
| 56 | end if; |
| 57 | |
| 58 | Registers.Unset_And_Set_Mask |
| 59 | (Register => Registers.GMCH_ADPA, |
| 60 | Mask_Unset => ADPA_MASK, |
| 61 | Mask_Set => ADPA_DAC_ENABLE or |
| 62 | GMCH_PORT_PIPE_SELECT (Pipe) or |
| 63 | Polarity); |
| 64 | end On; |
| 65 | |
| 66 | ---------------------------------------------------------------------------- |
| 67 | |
| 68 | procedure Off |
| 69 | is |
| 70 | begin |
| 71 | pragma Debug (Debug.Put_Line (GNAT.Source_Info.Enclosing_Entity)); |
| 72 | |
| 73 | Registers.Unset_And_Set_Mask |
| 74 | (Register => Registers.GMCH_ADPA, |
| 75 | Mask_Unset => ADPA_DAC_ENABLE, |
| 76 | Mask_Set => ADPA_HSYNC_DISABLE or |
| 77 | ADPA_VSYNC_DISABLE); |
| 78 | end Off; |
| 79 | |
| 80 | end HW.GFX.GMA.GMCH.VGA; |