[processor-sdk/performance-audio-sr.git] / psdk_cust / pdk_k2g_1_0_1_2_eng / packages / ti / board / diag / lcd / src / evmk2g_dss_panel.c
1 /*
2 * Copyright (c) 2016, Texas Instruments Incorporated
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 *
12 * * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 *
16 * * Neither the name of Texas Instruments Incorporated nor the names of
17 * its contributors may be used to endorse or promote products derived
18 * from this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 *
32 */
34 /**
35 *
36 * \file evmk2g_dss_panel.c
37 *
38 * \brief This file contains DSS Panel specific functions.
39 *
40 ******************************************************************************/
42 #include "platform_internal.h"
43 #include "keystone_pll.h"
45 #if (PLATFORM_DSS_IN)
47 dispCfg_t dispCfg = { 0, DSS_LCD_TYPE_ACTIVE, 3, 0};
48 dmaCfg_t vidDmaCfg = {0x09FF, 0x09F8, 1, 1, 0x00080000, 2, 0, 0, 0, 0, 7};
50 dssInfo_t dssInfo;
52 extern void init_pll(const pllcConfig *data);
54 /**
55 * \brief This function initializes LCD Panel module.
56 *
57 * This function should be called before using any other DSS functions.
58 * This function configures the LCD parameters and then configures DSS.
59 *
60 * \param
61 * pLcdCfg - pointer to LCD configuration
62 *
63 * \return
64 * DSS_RET_OK - If successful
65 * DSS_RET_FAILED - If failure
66 *
67 */
68 DSS_RET lcdPanelInit(lcdCfg_t *pLcdCfg)
69 {
70 DSS_RET status = DSS_RET_OK;
71 pllcConfig pll_data;
74 memcpy(&dssInfo.lcdCfg, pLcdCfg, sizeof(lcdCfg_t));
75 memcpy(&dssInfo.dispCfg, &dispCfg, sizeof(dispCfg_t));
76 memcpy(&dssInfo.vidDmaCfg, &vidDmaCfg, sizeof(dmaCfg_t));
77 memset(&dssInfo.tmgCfg, 0, sizeof(tmgCfg_t));
79 /* Configure PLL for LCD PCLK - 24MHz input clock */
80 pll_data.pll = CSL_PLL_DSS;
81 pll_data.pll_m = 12; // Multiply by 12
82 pll_data.pll_d = 4; // Divide by 4
83 pll_data.pll_od = 8; // Divide by 8
85 init_pll(&pll_data);
87 status = dssInit(&dssInfo);
88 #if (PLATFORM_DEBUG)
89 dssDumpReg(&dssInfo);
90 #endif
92 return status;
93 }
96 /**
97 * \brief Display color bar on the LCD
98 *
99 * This function calls the function to put the color bar information on the framebuffer
100 * and hence displays the Color bar on the LCD screen
101 *
102 * \param
103 * pLcdCfg - pointer to LCD configuration
104 *
105 * \return
106 * None
107 *
108 */
109 void lcdColorBarDisplay(lcdCfg_t *pLcdCfg)
110 {
111 dssInitFrameBuffer(RGB888_GENERATE, pLcdCfg->LcdWidth, pLcdCfg->LcdHeight);
112 }
114 #ifdef DISPLAY_LOGO
115 void lcdLogoDisplay(void)
116 {
117 dssFillFrameBuffer();
118 }
119 #endif
120 /**
121 * \brief Display a single color on the LCD screen
122 *
123 * This function calls the function to put a single color passed as an argument
124 * on the framebuffer and hence displays the Color screen on the LCD screen
125 *
126 * \param
127 * pLcdCfg - pointer to LCD configuration
128 * color - Color to be displayed on the screen.
129 *
130 * \return
131 * None
132 *
133 */
134 void lcdColorDisplay(lcdCfg_t *pLcdCfg, int color)
135 {
136 dssFrameBufferColor( pLcdCfg, color );
137 }
139 #endif /* #if (PLATFORM_DSS_IN) */
141 /* Nothing past this point */