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