changeset 653:094152d97ce7

Luna bring-up: workaround for slow LCD init sequence
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 07 May 2020 20:08:01 +0000
parents 41c03ea90403
children 8c0bd0b6447c
files src/aci2/aci/aci_pei.c src/cs/drivers/drv_app/r2d/lcds/luna/r2d_task_init_i.c src/cs/drivers/drv_app/r2d/r2d_task.c
diffstat 3 files changed, 30 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/aci2/aci/aci_pei.c	Thu May 07 08:06:31 2020 +0000
+++ b/src/aci2/aci/aci_pei.c	Thu May 07 20:08:01 2020 +0000
@@ -152,6 +152,10 @@
 
 extern const char firmware_version_str[];
 
+#if (MMI != 0)
+extern int r2d_is_running;
+#endif
+
 
 /*==== DEFINE =====================================================*/
 
@@ -1278,6 +1282,12 @@
       return PEI_ERROR;
   }
 
+/* FreeCalypso addition to fix R2D start race condition */
+#if (MMI != 0)
+  if (!r2d_is_running)
+    return PEI_ERROR;
+#endif
+
 #ifdef DTI
 #ifdef _SIMULATION_
   /*
--- a/src/cs/drivers/drv_app/r2d/lcds/luna/r2d_task_init_i.c	Thu May 07 08:06:31 2020 +0000
+++ b/src/cs/drivers/drv_app/r2d/lcds/luna/r2d_task_init_i.c	Thu May 07 20:08:01 2020 +0000
@@ -4,12 +4,17 @@
 
 static void r2d_refresh_task_init(void)
 {
-	UINT32  i;
-
 	/* reset pulse */
 	CNTL_RST_REG |= EXT_RESET;
 	rvf_delay(RVF_MS_TO_TICKS(10));
 	CNTL_RST_REG &= ~EXT_RESET;
+	/* finish the job in the running R2D refresh task */
+}
+
+void r2d_refresh_task_secondary_init(void)
+{
+	UINT32 i;
+
 	rvf_delay(RVF_MS_TO_TICKS(50));
 	/* start register init */
 	LCD_REG_WR(0x0001, 0x011c); // set SS and NL bit
--- a/src/cs/drivers/drv_app/r2d/r2d_task.c	Thu May 07 08:06:31 2020 +0000
+++ b/src/cs/drivers/drv_app/r2d/r2d_task.c	Thu May 07 20:08:01 2020 +0000
@@ -38,6 +38,9 @@
 
 extern INT16 r2d_g_refresh_disabled;
 
+/* FreeCalypso addition */
+int r2d_is_running;
+
 /*******************************************************************************
 ** Function         r2d_core
 **
@@ -45,16 +48,20 @@
 **					
 *******************************************************************************/
 T_RVM_RETURN r2d_core(void)
-{	
+{
 	BOOLEAN error_occured = FALSE;
 //	T_R2D_EVT * msg_ptr_rx, * msg_ptr_tx;
-	
+
 	//r2d_start();
 
-
-	rvf_send_trace("R2D REFRESH TASK STARTED",24, NULL_PARAM, 
-			   RV_TRACE_LEVEL_DEBUG_HIGH, R2D_USE_ID );
-	
+	rvf_send_trace("R2D REFRESH TASK STARTED", 24, NULL_PARAM,
+			RV_TRACE_LEVEL_DEBUG_HIGH, R2D_USE_ID);
+#ifdef CONFIG_TARGET_LUNA
+	r2d_refresh_task_secondary_init();
+	rvf_send_trace("R2D secondary init complete", 27, NULL_PARAM,
+			RV_TRACE_LEVEL_DEBUG_HIGH, R2D_USE_ID);
+#endif
+	r2d_is_running = 1;
 
 	/* loop to process messages */
 	while (error_occured == FALSE)