changeset 162:595192258bc9

gsm-fw: RTC SWE enabled
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Mon, 18 Nov 2013 00:52:05 +0000
parents 98be4841eeb7
children 5e0e41cd7c9f
files gsm-fw/bsp/niq32.c gsm-fw/bsp/rtc/rtc_functions.c gsm-fw/riviera/rv/rv_defined_swe.h
diffstat 3 files changed, 29 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/gsm-fw/bsp/niq32.c	Mon Nov 18 00:08:43 2013 +0000
+++ b/gsm-fw/bsp/niq32.c	Mon Nov 18 00:52:05 2013 +0000
@@ -34,6 +34,7 @@
 #include "armio.h"
 
 #include "../serial/serialswitch.h"
+#include "rtc/rtc_config.h"
 
 #if 0
 
@@ -374,7 +375,7 @@
 
 void IQ_Rtc_Handler(void)
 {
-#if 0 //(OP_L1_STANDALONE == 0)
+#if CONFIG_GSM //(OP_L1_STANDALONE == 0)
   RTC_ItTimerHandle();
 #endif
 }
@@ -390,7 +391,7 @@
 #if ((CHIPSET == 4) || (CHIPSET == 5) || (CHIPSET == 6) || (CHIPSET == 7) || (CHIPSET == 8) || (CHIPSET == 9) || (CHIPSET == 10) || (CHIPSET == 11) || (CHIPSET == 12))
 void IQ_RtcA_Handler(void)
 {
-  #if 0 //(OP_L1_STANDALONE == 0)
+  #if 1 //(OP_L1_STANDALONE == 0)
     /* INTH_DISABLEONEIT(IQ_RTC_ALARM); *//* RTC ALARM IT  */
     if ( (* (SYS_WORD8 *) RTC_STATUS_REG) & RTC_ALARM )
       RTC_ItAlarmHandle();
--- a/gsm-fw/bsp/rtc/rtc_functions.c	Mon Nov 18 00:08:43 2013 +0000
+++ b/gsm-fw/bsp/rtc/rtc_functions.c	Mon Nov 18 00:52:05 2013 +0000
@@ -178,11 +178,13 @@
 
 extern T_RTC_ENV_CTRL_BLK* rtc_env_ctrl_blk;
 
+#if CONFIG_GSM
 /* Number of 32 Khz clock */
 static UINT32 rtc_nb_32khz = 0;
 
 /* Number of high frequency clock */
 static UINT32 rtc_nb_hf = 0;
+#endif
 
 static NU_HISR hisr;
 char hisrStack[512];
@@ -340,16 +342,33 @@
 
    /* Enable IRQ9 and IRQ10 */
    #if (CHIPSET == 12)
-     F_INTH_ENABLE_ONE_IT(C_INTH_RTC_TIMER_IT);
      F_INTH_ENABLE_ONE_IT(C_INTH_RTC_ALARM_IT);
    #else
-     IQ_Unmask(IQ_RTC_TIMER);
      IQ_Unmask(IQ_RTC_ALARM);
    #endif
 
+   /*
+    * FreeCalypso change: the RTC periodic interrupt is used in
+    * conjunction with the ULPD gauging mechanism, and the latter
+    * appears to be controlled by some code in L1-land.
+    * Therefore, we are going to enable this interrupt only when
+    * building with L1 enabled.
+    */
+#if CONFIG_GSM
+   #if (CHIPSET == 12)
+     F_INTH_ENABLE_ONE_IT(C_INTH_RTC_TIMER_IT);
+   #else
+     IQ_Unmask(IQ_RTC_TIMER);
+   #endif
+#endif
+
    while (RTC_TEST_BUSY);
    RTC_SET_EVENT_TIMER(RTC_EVERY_MIN); /* Set timer every minute */
+#if CONFIG_GSM
    RTC_ENABLE_IT_TIMER;
+#else
+   RTC_DISABLE_IT_TIMER;
+#endif
    RTC_DISABLE_IT_ALARM;
 
    rvf_enable();
@@ -671,7 +690,7 @@
       return FALSE;
 }
 
-
+#if CONFIG_GSM
 /*******************************************************************************
  *
  *                               RTC_ItTimerHandle
@@ -726,7 +745,7 @@
 /*NU_Activate_HISR(&hisr); tmp*/
 
 }
-
+#endif
 
 /*******************************************************************************
  *
@@ -747,6 +766,7 @@
    RTC_FREE_AL_ITLINE;
 }
 
+#if CONFIG_GSM
 /*******************************************************************************
  *
  *                               RTC_GaugingHandler
@@ -763,7 +783,7 @@
    rtc_nb_hf =   ( ((*(volatile UINT16 *)ULDP_COUNTER_HI_FREQ_MSB_REG) * 0x10000) +
             (*(volatile UINT16 *)ULDP_COUNTER_HI_FREQ_LSB_REG) );
 }
-
+#endif
 
 /*******************************************************************************
  *
--- a/gsm-fw/riviera/rv/rv_defined_swe.h	Mon Nov 18 00:08:43 2013 +0000
+++ b/gsm-fw/riviera/rv/rv_defined_swe.h	Mon Nov 18 00:52:05 2013 +0000
@@ -52,6 +52,7 @@
  * littering config.h with them.
  */
 
+#define	RVM_RTC_SWE
 #define	RVM_SPI_SWE
 
 /* ------------------------------------------------------------------