| Nico Huber | 7ad2d65 | 2016-12-07 15:19:32 +0100 | [diff] [blame] | 1 | -- |
| Nico Huber | abb16d9 | 2018-05-29 01:44:26 +0200 | [diff] [blame] | 2 | -- Copyright (C) 2015-2018 secunet Security Networks AG |
| Nico Huber | 7ad2d65 | 2016-12-07 15:19:32 +0100 | [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 |
| 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.Registers; |
| Arthur Heymans | 636390c | 2018-03-28 16:52:13 +0200 | [diff] [blame] | 16 | with HW.GFX.GMA.Config; |
| Nico Huber | 7ad2d65 | 2016-12-07 15:19:32 +0100 | [diff] [blame] | 17 | |
| 18 | private package HW.GFX.GMA.Transcoder |
| 19 | is |
| 20 | |
| Tim Wawrzynczak | 4be2e75 | 2022-09-09 10:37:06 -0600 | [diff] [blame^] | 21 | procedure Enable_Pipe_Clock (Pipe : Pipe_Index; Port_Cfg : Port_Config); |
| 22 | procedure Configure (Pipe : Pipe_Index; Port_Cfg : Port_Config; Scale : Boolean); |
| Nico Huber | 7ad2d65 | 2016-12-07 15:19:32 +0100 | [diff] [blame] | 23 | procedure Setup (Pipe : Pipe_Index; Port_Cfg : Port_Config); |
| Nico Huber | abb16d9 | 2018-05-29 01:44:26 +0200 | [diff] [blame] | 24 | procedure On |
| 25 | (Pipe : Pipe_Index; |
| 26 | Port_Cfg : Port_Config; |
| 27 | Dither : Boolean; |
| 28 | Scale : Boolean); |
| Nico Huber | 7ad2d65 | 2016-12-07 15:19:32 +0100 | [diff] [blame] | 29 | |
| 30 | procedure Off (Pipe : Pipe_Index); |
| 31 | procedure Clk_Off (Pipe : Pipe_Index); |
| 32 | |
| Angel Pons | 3f86b0b | 2020-07-18 00:22:32 +0200 | [diff] [blame] | 33 | procedure PSR_Off; |
| 34 | |
| Nico Huber | 7ad2d65 | 2016-12-07 15:19:32 +0100 | [diff] [blame] | 35 | function BPC_Conf (BPC : BPC_Type; Dither : Boolean) return Word32; |
| 36 | |
| 37 | private |
| 38 | |
| 39 | type Transcoder_Index is (Trans_EDP, Trans_A, Trans_B, Trans_C); |
| 40 | |
| 41 | type Transcoder_Regs is |
| 42 | record |
| 43 | HTOTAL : Registers.Registers_Index; |
| 44 | HBLANK : Registers.Registers_Index; |
| 45 | HSYNC : Registers.Registers_Index; |
| 46 | VTOTAL : Registers.Registers_Index; |
| 47 | VBLANK : Registers.Registers_Index; |
| 48 | VSYNC : Registers.Registers_Index; |
| 49 | CONF : Registers.Registers_Index; |
| 50 | DATA_M1 : Registers.Registers_Index; |
| 51 | DATA_N1 : Registers.Registers_Index; |
| 52 | LINK_M1 : Registers.Registers_Index; |
| 53 | LINK_N1 : Registers.Registers_Index; |
| 54 | DDI_FUNC_CTL : Registers.Registers_Index; |
| 55 | MSA_MISC : Registers.Registers_Index; |
| 56 | CLK_SEL : Registers.Registers_Invalid_Index; |
| Tim Wawrzynczak | 4be2e75 | 2022-09-09 10:37:06 -0600 | [diff] [blame^] | 57 | PIPE_ARB_CTL : Registers.Registers_Invalid_Index; |
| Nico Huber | 7ad2d65 | 2016-12-07 15:19:32 +0100 | [diff] [blame] | 58 | end record; |
| 59 | |
| 60 | type Transcoder_Array is array (Transcoder_Index) of Transcoder_Regs; |
| 61 | |
| Arthur Heymans | 636390c | 2018-03-28 16:52:13 +0200 | [diff] [blame] | 62 | PIPE_DATA_M1 : constant array (0 .. 1) of Registers.Registers_Index := |
| 63 | (if Config.Has_GMCH_DP_Transcoder then |
| 64 | (0 => Registers.PIPEA_GMCH_DATA_M, |
| 65 | 1 => Registers.PIPEB_GMCH_DATA_M) |
| 66 | else |
| 67 | (0 => Registers.PIPEA_DATA_M1, |
| 68 | 1 => Registers.PIPEB_DATA_M1)); |
| 69 | PIPE_DATA_N1 : constant array (0 .. 1) of Registers.Registers_Index := |
| 70 | (if Config.Has_GMCH_DP_Transcoder then |
| 71 | (0 => Registers.PIPEA_GMCH_DATA_N, |
| 72 | 1 => Registers.PIPEB_GMCH_DATA_N) |
| 73 | else |
| 74 | (0 => Registers.PIPEA_DATA_N1, |
| 75 | 1 => Registers.PIPEB_DATA_N1)); |
| 76 | PIPE_LINK_M1 : constant array (0 .. 1) of Registers.Registers_Index := |
| 77 | (if Config.Has_GMCH_DP_Transcoder then |
| 78 | (0 => Registers.PIPEA_GMCH_LINK_M, |
| 79 | 1 => Registers.PIPEB_GMCH_LINK_M) |
| 80 | else |
| 81 | (0 => Registers.PIPEA_LINK_M1, |
| 82 | 1 => Registers.PIPEB_LINK_M1)); |
| 83 | PIPE_LINK_N1 : constant array (0 .. 1) of Registers.Registers_Index := |
| 84 | (if Config.Has_GMCH_DP_Transcoder then |
| 85 | (0 => Registers.PIPEA_GMCH_LINK_N, |
| 86 | 1 => Registers.PIPEB_GMCH_LINK_N) |
| 87 | else |
| 88 | (0 => Registers.PIPEA_LINK_N1, |
| 89 | 1 => Registers.PIPEB_LINK_N1)); |
| 90 | |
| Nico Huber | 7ad2d65 | 2016-12-07 15:19:32 +0100 | [diff] [blame] | 91 | Transcoders : constant Transcoder_Array := |
| 92 | (Trans_EDP => |
| 93 | (HTOTAL => Registers.HTOTAL_EDP, |
| 94 | HBLANK => Registers.HBLANK_EDP, |
| 95 | HSYNC => Registers.HSYNC_EDP, |
| 96 | VTOTAL => Registers.VTOTAL_EDP, |
| 97 | VBLANK => Registers.VBLANK_EDP, |
| 98 | VSYNC => Registers.VSYNC_EDP, |
| 99 | CONF => Registers.PIPE_EDP_CONF, |
| 100 | DATA_M1 => Registers.PIPE_EDP_DATA_M1, |
| 101 | DATA_N1 => Registers.PIPE_EDP_DATA_N1, |
| 102 | LINK_M1 => Registers.PIPE_EDP_LINK_M1, |
| 103 | LINK_N1 => Registers.PIPE_EDP_LINK_N1, |
| 104 | DDI_FUNC_CTL => Registers.PIPE_EDP_DDI_FUNC_CTL, |
| 105 | MSA_MISC => Registers.PIPE_EDP_MSA_MISC, |
| Tim Wawrzynczak | 4be2e75 | 2022-09-09 10:37:06 -0600 | [diff] [blame^] | 106 | CLK_SEL => Registers.Invalid_Register, |
| 107 | PIPE_ARB_CTL => Registers.Invalid_Register), |
| Nico Huber | 7ad2d65 | 2016-12-07 15:19:32 +0100 | [diff] [blame] | 108 | Trans_A => |
| 109 | (HTOTAL => Registers.HTOTAL_A, |
| 110 | HBLANK => Registers.HBLANK_A, |
| 111 | HSYNC => Registers.HSYNC_A, |
| 112 | VTOTAL => Registers.VTOTAL_A, |
| 113 | VBLANK => Registers.VBLANK_A, |
| 114 | VSYNC => Registers.VSYNC_A, |
| 115 | CONF => Registers.PIPEACONF, |
| Arthur Heymans | 636390c | 2018-03-28 16:52:13 +0200 | [diff] [blame] | 116 | DATA_M1 => PIPE_DATA_M1 (0), |
| 117 | DATA_N1 => PIPE_DATA_N1 (0), |
| 118 | LINK_M1 => PIPE_LINK_M1 (0), |
| 119 | LINK_N1 => PIPE_LINK_N1 (0), |
| Nico Huber | 7ad2d65 | 2016-12-07 15:19:32 +0100 | [diff] [blame] | 120 | DDI_FUNC_CTL => Registers.PIPEA_DDI_FUNC_CTL, |
| 121 | MSA_MISC => Registers.PIPEA_MSA_MISC, |
| Tim Wawrzynczak | 4be2e75 | 2022-09-09 10:37:06 -0600 | [diff] [blame^] | 122 | CLK_SEL => Registers.TRANSA_CLK_SEL, |
| 123 | PIPE_ARB_CTL => Registers.PIPEA_ARB_CTL), |
| Nico Huber | 7ad2d65 | 2016-12-07 15:19:32 +0100 | [diff] [blame] | 124 | Trans_B => |
| 125 | (HTOTAL => Registers.HTOTAL_B, |
| 126 | HBLANK => Registers.HBLANK_B, |
| 127 | HSYNC => Registers.HSYNC_B, |
| 128 | VTOTAL => Registers.VTOTAL_B, |
| 129 | VBLANK => Registers.VBLANK_B, |
| 130 | VSYNC => Registers.VSYNC_B, |
| 131 | CONF => Registers.PIPEBCONF, |
| Arthur Heymans | 636390c | 2018-03-28 16:52:13 +0200 | [diff] [blame] | 132 | DATA_M1 => PIPE_DATA_M1 (1), |
| 133 | DATA_N1 => PIPE_DATA_N1 (1), |
| 134 | LINK_M1 => PIPE_LINK_M1 (1), |
| 135 | LINK_N1 => PIPE_LINK_N1 (1), |
| Nico Huber | 7ad2d65 | 2016-12-07 15:19:32 +0100 | [diff] [blame] | 136 | DDI_FUNC_CTL => Registers.PIPEB_DDI_FUNC_CTL, |
| 137 | MSA_MISC => Registers.PIPEB_MSA_MISC, |
| Tim Wawrzynczak | 4be2e75 | 2022-09-09 10:37:06 -0600 | [diff] [blame^] | 138 | CLK_SEL => Registers.TRANSB_CLK_SEL, |
| 139 | PIPE_ARB_CTL => Registers.PIPEB_ARB_CTL), |
| Nico Huber | 7ad2d65 | 2016-12-07 15:19:32 +0100 | [diff] [blame] | 140 | Trans_C => |
| 141 | (HTOTAL => Registers.HTOTAL_C, |
| 142 | HBLANK => Registers.HBLANK_C, |
| 143 | HSYNC => Registers.HSYNC_C, |
| 144 | VTOTAL => Registers.VTOTAL_C, |
| 145 | VBLANK => Registers.VBLANK_C, |
| 146 | VSYNC => Registers.VSYNC_C, |
| 147 | CONF => Registers.PIPECCONF, |
| 148 | DATA_M1 => Registers.PIPEC_DATA_M1, |
| 149 | DATA_N1 => Registers.PIPEC_DATA_N1, |
| 150 | LINK_M1 => Registers.PIPEC_LINK_M1, |
| 151 | LINK_N1 => Registers.PIPEC_LINK_N1, |
| 152 | DDI_FUNC_CTL => Registers.PIPEC_DDI_FUNC_CTL, |
| 153 | MSA_MISC => Registers.PIPEC_MSA_MISC, |
| Tim Wawrzynczak | 4be2e75 | 2022-09-09 10:37:06 -0600 | [diff] [blame^] | 154 | CLK_SEL => Registers.TRANSC_CLK_SEL, |
| 155 | PIPE_ARB_CTL => Registers.PIPEC_ARB_CTL)); |
| Nico Huber | 7ad2d65 | 2016-12-07 15:19:32 +0100 | [diff] [blame] | 156 | |
| 157 | end HW.GFX.GMA.Transcoder; |