changeset 305:4dccc9d3305f

gsm-fw: checking in DAR from Leonardo source
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Sun, 16 Mar 2014 05:48:58 +0000
parents e0ca3ca46a06
children 81bee6125882
files gsm-fw/services/dar/dar_api.c gsm-fw/services/dar/dar_api.h gsm-fw/services/dar/dar_const_i.h gsm-fw/services/dar/dar_diagnose.c gsm-fw/services/dar/dar_diagnose_i.h gsm-fw/services/dar/dar_emergency.c gsm-fw/services/dar/dar_emergency.h gsm-fw/services/dar/dar_env.c gsm-fw/services/dar/dar_env.h gsm-fw/services/dar/dar_error_hdlr.c gsm-fw/services/dar/dar_error_hdlr_i.h gsm-fw/services/dar/dar_gbl_var.c gsm-fw/services/dar/dar_gen.h gsm-fw/services/dar/dar_handle_message.c gsm-fw/services/dar/dar_handle_message.h gsm-fw/services/dar/dar_macro_i.h gsm-fw/services/dar/dar_messages_i.h gsm-fw/services/dar/dar_msg_ft.c gsm-fw/services/dar/dar_msg_ft.h gsm-fw/services/dar/dar_pool_size.h gsm-fw/services/dar/dar_structs_i.h gsm-fw/services/dar/dar_task.c gsm-fw/services/dar/dar_watchdog.c gsm-fw/services/dar/dar_watchdog.h
diffstat 24 files changed, 3864 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gsm-fw/services/dar/dar_api.c	Sun Mar 16 05:48:58 2014 +0000
@@ -0,0 +1,789 @@
+/****************************************************************************/
+/*                                                                           */
+/*  File Name:  dar_api.c                                                   */
+/*                                                                          */
+/*  Purpose:  This file contains all the functions used to service          */
+/*            primitives.                                                   */
+/*                                                                          */
+/*  Version   0.1                                                           */
+/*                                                                          */
+/*  Date               Modification                                         */
+/*  ----------------------------------------------------------------------  */
+/*  2 October 2001  Create                                                  */
+/*                                                                          */
+/*  Author    - Stephanie Gerthoux                                          */
+/*                                                                          */
+/* (C) Copyright 2001 by Texas Instruments Incorporated, All Rights Reserved*/
+/****************************************************************************/
+
+#include "rv/rv_defined_swe.h"
+
+  
+#ifdef RVM_DAR_SWE
+   #ifndef _WINDOWS
+      #include "swconfig.cfg"
+      #include "sys.cfg"
+      #include "l1sw.cfg"
+      #include "chipset.cfg"
+   #endif
+
+   #include "abb/abb.h"
+   #include "rv/rv_general.h"
+   #include "rvm/rvm_gen.h"
+   #include "dar/dar_api.h"
+   #include "dar/dar_env.h"    
+   #include "dar/dar_error_hdlr_i.h"
+   #include "dar/dar_messages_i.h"
+   #include "dar/dar_msg_ft.h"
+   #include "dar/dar_macro_i.h" 
+   #include "dar/dar_diagnose_i.h"
+   #include "dar/dar_const_i.h"
+   #include "dar/dar_emergency.h"
+
+
+   #ifndef _WINDOWS
+      /* enable the timer */
+      #include "memif/mem.h"
+      #include "timer/timer.h"
+      #include "inth/iq.h"
+      #if (CHIPSET == 12)
+        #include "inth/sys_inth.h"
+      #endif
+   #endif
+
+
+   /**** Global variable ****/
+   /* Define load timer */
+   static UINT16 dar_load_tim = 0x0;
+
+   /* Increment variable */
+   static BOOLEAN dar_increment = TRUE;
+
+   /* DAR previous status */
+   T_DAR_RECOVERY_STATUS   dar_previous_status;
+
+   /* DAR previous exception*/
+   UINT8    dar_previous_exception;
+
+    /**** Define extern variables ****/
+   /* Get the status of the system */
+   extern T_DAR_RECOVERY_STATUS dar_current_status;
+
+   /* dar_exception_status : to get the status of the exception */
+   extern UINT8 dar_exception_status;
+
+   /* Define the recovery buffer */
+   extern UINT8 dar_recovery_buffer[DAR_RECOVERY_DATA_MAX_BUFFER_SIZE];
+
+   /* Define a pointer to the Global Environment Control block   */
+   extern T_DAR_ENV_CTRL_BLK *dar_gbl_var_p;
+
+   /* **************************************************************************** */
+   /*                                RECOVERY                                      */
+   /* **************************************************************************** */
+
+   /********************************************************************************/
+   /*                                                                              */
+   /*    Function Name:   dar_recovery_get_status                                  */
+   /*                                                                              */
+   /*    Purpose:  This function is called by the MMI at the beginning of the      */
+   /*              procedure, in order to get the status of the last reset of      */
+   /*              the system.                                                     */
+   /*                                                                              */
+   /*    Input Parameters:                                                         */
+   /*        Dar recovery status                                                   */
+   /*                                                                              */
+   /*    Output Parameters:                                                        */
+   /*         Validation of the function execution.                                */  
+   /*                                                                              */
+   /*    Note:                                                                     */
+   /*        None.                                                                 */
+   /*                                                                              */
+   /*    Revision History:                                                         */
+   /*        None.                                                                 */
+   /*                                                                              */
+   /********************************************************************************/
+   T_RV_RET dar_recovery_get_status(T_DAR_RECOVERY_STATUS* status)
+   {
+      /* Variable to know the status of th Omega VRPC register */
+      UINT16 dar_pwr_status;
+
+      *status = dar_previous_status;
+      switch (dar_previous_status)
+      {
+         case (DAR_WATCHDOG):
+         {
+      	   DAR_SEND_TRACE("Dar Entity: Status of the last reset of the system = WATCHDOG",RV_TRACE_LEVEL_DEBUG_HIGH);
+            break;
+         }
+         case (DAR_NORMAL_SCUTTLING):
+         {
+      	   DAR_SEND_TRACE("Dar Entity: Status of the last reset of the system = NORMAL SCUTTLING",RV_TRACE_LEVEL_DEBUG_HIGH);
+            break;
+         }
+         case (DAR_EMERGENCY_SCUTTLING):
+         {
+      	   DAR_SEND_TRACE("Dar Entity: Status of the last reset of the system = EMERGENCY SCUTTLING",RV_TRACE_LEVEL_DEBUG_HIGH);
+            switch (dar_previous_exception)
+            {
+                case (DAR_EXCEPTION_DATA_ABORT):
+                {
+      	            DAR_SEND_TRACE(" A DATA ABORT exception has occured",RV_TRACE_LEVEL_DEBUG_HIGH);
+                     break;
+                }
+                
+                case (DAR_EXCEPTION_PREFETCH_ABORT):
+                {
+      	            DAR_SEND_TRACE("          A PREFETCH ABORT exception has occured",RV_TRACE_LEVEL_DEBUG_HIGH);
+                     break;
+                }
+                
+                case (DAR_EXCEPTION_UNDEFINED):
+                {
+      	            DAR_SEND_TRACE("          A UNDEFINED INSTRUCTION exception has occured",RV_TRACE_LEVEL_DEBUG_HIGH);
+                     break;
+                }
+                
+                case (DAR_EXCEPTION_SWI):
+                {
+      	            DAR_SEND_TRACE("          A SWI exception has occured",RV_TRACE_LEVEL_DEBUG_HIGH);
+                     break;
+                }
+                
+                case (DAR_EXCEPTION_RESERVED):
+                {
+      	            DAR_SEND_TRACE("          A RESERVED exception has occured",RV_TRACE_LEVEL_DEBUG_HIGH);
+                     break;
+                }
+
+                default:
+               {
+       	         DAR_SEND_TRACE("          An error has been detected",RV_TRACE_LEVEL_DEBUG_HIGH);
+                  break;
+               }
+
+            }
+
+            break;
+         }
+         default:
+         {
+            #if (_GSM==1) || (defined _WINDOWS)
+               dar_pwr_status = ABB_Read_Status();
+
+               #if ((ANLG_FAM == 1) || (ANLG_FAM == 2))
+               if (dar_pwr_status & ONBSTS)
+               #elif (ANLG_FAM == 3)
+               if (dar_pwr_status & PWONBSTS)
+               #endif
+               {			    
+	               /* Switch on Condition on ON BUTTON Push */
+          	      DAR_SEND_TRACE("Dar Entity: Status of the last reset of the system = POWER ON/OFF",RV_TRACE_LEVEL_DEBUG_HIGH);
+                  break;
+               }
+               else
+               {
+                  /* Branch to a reset at adress 0 */
+          	      DAR_SEND_TRACE("Dar Entity: Status of the last reset of the system = BRANCH to adress 0",RV_TRACE_LEVEL_DEBUG_HIGH);
+                  break;
+               }
+            #else
+               /* the SPI is not available in BOARD_TEST configuration */
+        	      DAR_SEND_TRACE("Dar Entity: Status of the last reset of the system = POWER ON/OFF or BRANCH to adress 0",RV_TRACE_LEVEL_DEBUG_HIGH);
+            #endif
+         }
+      }/* switch */
+
+      return(RV_OK);	
+
+   } /* dar_recovery_get_status */
+
+   /********************************************************************************/
+   /*                                                                              */
+   /*    Function Name:   dar_recovery_config                                      */
+   /*                                                                              */
+   /*    Purpose:  This function is used to store a callback function that will be */
+   /*              called by the recovery system when a recovery procedure has     */
+   /*              been initiated                                                  */
+   /*                                                                              */
+   /*    Input Parameters:                                                         */
+   /*        dar callback function                                                 */
+   /*                                                                              */
+   /*    Output Parameters:                                                        */
+   /*        Validation of the function execution.                                 */  
+   /*                                                                              */
+   /*    Note:                                                                     */
+   /*        None.                                                                 */
+   /*                                                                              */
+   /*    Revision History:                                                         */
+   /*        None.                                                                 */
+   /*                                                                              */
+   /********************************************************************************/
+   T_RV_RET dar_recovery_config(T_RV_RET (*dar_store_recovery_data)
+                                                      (T_DAR_BUFFER      buffer_p,
+                                                      UINT16            length))
+   {   
+      /* call the callback function */
+      dar_gbl_var_p->entity_dar_callback = dar_store_recovery_data; 
+
+      return(RV_OK);
+   } /* dar_recovery_config */
+
+   /********************************************************************************/
+   /*                                                                              */
+   /*    Function Name:   dar_get_recovery_data                                    */
+   /*                                                                              */
+   /*    Purpose:  This function is used to retrieve data that have been stored    */
+   /*              in the buffer just before a reset.                              */
+   /*                                                                              */
+   /*    Input Parameters:                                                         */
+   /*       - the buffer in whom important data have been stored before the reset  */
+   /*       - the length of the buffer                                             */
+   /*                                                                              */
+   /*    Output Parameters:                                                        */
+   /*        Validation of the function execution.                                 */  
+   /*                                                                              */
+   /*    Note:                                                                     */
+   /*        None.                                                                 */
+   /*                                                                              */
+   /*    Revision History:                                                         */
+   /*        None.                                                                 */
+   /*                                                                              */
+   /********************************************************************************/
+   T_RV_RET dar_get_recovery_data( T_DAR_BUFFER buffer_p, UINT16   length )                                                                               
+   { 
+      /* Local variables */
+      UINT8 i; 
+
+	   if (buffer_p != NULL)
+      {
+         if(length <= DAR_RECOVERY_DATA_MAX_BUFFER_SIZE)
+         {
+            /* Retrieve data that have been stored in the global buffer */
+            for(i=0;i<length;i++)
+            {
+               buffer_p[i] = dar_recovery_buffer[i];
+            }
+         }
+
+         else
+         /* the lenth is longer than DAR_RECOVERY_DATA_MAX_BUFFER_SIZE */
+         {
+            /* So retrieve "DAR_RECOVERY_DATA_MAX_BUFFER_SIZE" data that have been stored */
+            /* in the global buffer, the other data (length -"DAR_RECOVERY_DATA_MAX_BUFFER_SIZE") */
+            /* are lost*/
+            for(i=0;i<DAR_RECOVERY_DATA_MAX_BUFFER_SIZE;i++)
+            {
+                buffer_p[i] = dar_recovery_buffer[i];
+            }
+
+            DAR_SEND_TRACE_PARAM("Bytes nb that haven't be saved due to not enough memory space ",(DAR_RECOVERY_DATA_MAX_BUFFER_SIZE-length),DAR_WARNING);
+         }
+      } /* if (buffer_p != NULL) */
+    
+      return(RV_OK);
+
+   } /* dar_get_recovery_data */
+
+
+   /* **************************************************************************** */
+   /*                                  WATCHDOG                                    */
+   /* **************************************************************************** */
+
+   /********************************************************************************/
+   /*                                                                              */
+   /*    Function Name:   dar_start_watchdog_timer                                 */
+   /*                                                                              */
+   /*    Purpose:  This function uses the timer as a general purpose timer instead */
+   /*              of Watchdog. It loads the timer , starts it and then unmasks    */
+   /*              the interrupt.                                                  */
+   /*                                                                              */
+   /*    Input Parameters:                                                         */
+   /*        time's interval in milliseconds before the timer expires              */
+   /*                                                                              */
+   /*    Output Parameters:                                                        */
+   /*        Validation of the function execution.                                 */  
+   /*                                                                              */
+   /*    Note:                                                                     */
+   /*        None.                                                                 */
+   /*                                                                              */
+   /*    Revision History:                                                         */
+   /*        None.                                                                 */
+   /*                                                                              */
+   /********************************************************************************/
+   T_RV_RET   dar_start_watchdog_timer(UINT16 timer_expiration_value)
+   {
+      DAR_SEND_TRACE("DAR Watchdog timer",RV_TRACE_LEVEL_DEBUG_LOW);
+
+      /* use Watchdog timer set as a general purpose timer                     */
+      /* Calculate the load value thanks to the formula:                       */
+      /*      timer_expiration_value * 1000 = Tclk * (DAR_LOAD_TIM+1)*2^(PTV+1)*/
+      /*      (in Watchdog mode, the value of PTV is fixed to 7)               */
+      dar_load_tim = ((timer_expiration_value * 1000)/(1.078*256))-1;
+
+      #ifndef _WINDOWS
+       /* Load "dar_load_tim" value */
+       TIMER_WriteValue(dar_load_tim);
+
+       /* Start timer with PTV = 7, no autoreload, free = 0 */
+       *(volatile UINT16*)TIMER_CNTL_REG = 0x0E80;
+
+       /* Unmask IRQ0 */
+       #if (CHIPSET == 12)
+         F_INTH_ENABLE_ONE_IT(C_INTH_WATCHDOG_IT);
+       #else
+         IQ_Unmask(IQ_WATCHDOG);
+       #endif
+      #endif
+   
+      return(RV_OK);
+
+   } /* dar_start_watchdog_timer */
+
+   /********************************************************************************/
+   /*                                                                              */
+   /*    Function Name:   dar_reload_watchdog_timer                                */
+   /*                                                                              */
+   /*    Purpose:  This function is used to maintain the timer in reloading it     */
+   /*              periodically before it expires                                  */
+   /*                                                                              */
+   /*    Input Parameters:                                                         */
+   /*        None                                                                  */
+   /*                                                                              */
+   /*    Output Parameters:                                                        */
+   /*        Validation of the function execution.                                 */  
+   /*                                                                              */
+   /*    Note:                                                                     */
+   /*        None.                                                                 */
+   /*                                                                              */
+   /*    Revision History:                                                         */
+   /*        None.                                                                 */
+   /*                                                                              */
+   /********************************************************************************/
+   T_RV_RET   dar_reload_watchdog_timer()
+   {
+      #ifndef _WINDOWS
+
+       DAR_SEND_TRACE("Reload Watchdog ",RV_TRACE_LEVEL_DEBUG_LOW);
+
+       /* Stop the timer */
+       *(volatile UINT16*)TIMER_CNTL_REG = 0x0E00;
+
+       /* Reload the timer with a different value each time */
+       if (dar_increment == TRUE)
+       {
+            TIMER_WriteValue(++dar_load_tim);
+            dar_increment = FALSE;
+       }
+       else
+       {
+            TIMER_WriteValue(--dar_load_tim);
+            dar_increment = TRUE;
+       }
+
+       /* Restart timer with PTV = 7, no autoreload, free = 0 */
+       *(volatile UINT16*)TIMER_CNTL_REG = 0x0E80;
+      #endif
+
+      return(RV_OK);
+
+   } /* dar_reload_watchdog_timer */
+
+   /********************************************************************************/
+   /*                                                                              */
+   /*    Function Name:   dar_stop_watchdog_timer                                  */
+   /*                                                                              */
+   /*    Purpose:  This function stops the timer used as a general purpose timer   */
+   /*              instead of watchdog                                             */
+   /*                                                                              */
+   /*    Input Parameters:                                                         */
+   /*        None                                                                  */
+   /*                                                                              */
+   /*    Output Parameters:                                                        */
+   /*        Validation of the function execution.                                 */  
+   /*                                                                              */
+   /*    Note:                                                                     */
+   /*        None.                                                                 */
+   /*                                                                              */
+   /*    Revision History:                                                         */
+   /*        None.                                                                 */
+   /*                                                                              */
+   /********************************************************************************/
+   T_RV_RET   dar_stop_watchdog_timer()
+   {
+      #ifndef _WINDOWS
+       /* Stop the timer */
+       *(volatile UINT16*)TIMER_CNTL_REG = 0x0E00;
+
+       /* Mask IRQ0 */
+       #if (CHIPSET == 12)
+         F_INTH_DISABLE_ONE_IT(C_INTH_WATCHDOG_IT);
+       #else
+         IQ_Mask(IQ_WATCHDOG);
+       #endif
+      #endif
+
+      return(RV_OK);
+
+   } /* dar_stop_watchdog_timer */
+
+
+   /* **************************************************************************** */
+   /*                                  RESET                                       */
+   /* **************************************************************************** */
+
+   /********************************************************************************/
+   /*                                                                              */
+   /*    Function Name:   dar_reset_system                                         */
+   /*                                                                              */
+   /*    Purpose:  This function can be used to reset the system voluntarily       */
+   /*                                                                              */
+   /*    Input Parameters:                                                         */
+   /*        None                                                                  */
+   /*                                                                              */
+   /*    Output Parameters:                                                        */
+   /*        Validation of the function execution.                                 */  
+   /*                                                                              */
+   /*    Note:                                                                     */
+   /*        None.                                                                 */
+   /*                                                                              */
+   /*    Revision History:                                                         */
+   /*        None.                                                                 */
+   /*                                                                              */
+   /********************************************************************************/
+   T_RV_RET   dar_reset_system(void)
+   {
+
+      /* Update the DAR recovery status */
+      dar_current_status = DAR_NORMAL_SCUTTLING;
+
+      /* Call the MMI callback function to save some parameters before reset */
+      dar_gbl_var_p->entity_dar_callback(dar_recovery_buffer,DAR_RECOVERY_DATA_MAX_BUFFER_SIZE);
+
+      /* Send a trace before the reset of the system */
+      DAR_SEND_TRACE("Voluntary reset of the system",RV_TRACE_LEVEL_DEBUG_HIGH);
+
+      dar_reset();
+
+      return(RV_OK); 
+   }
+
+   /* **************************************************************************** */
+   /*                                DIAGNOSE                                      */
+   /* **************************************************************************** */
+
+   /********************************************************************************/
+   /*                                                                              */
+   /*    Function Name:   dar_diagnose_swe_filter  		    			                   */
+   /*                                                                              */
+   /*    Purpose: This function is called to configure the Diagnose filtering.     */
+   /*             It allows to determine what Software Entity ( dar_use_id )       */
+   /*             wants to use the Diagnose and allows to indicate the level       */
+   /*             threshold of the diagnose messages. (Warning or Debug)           */
+   /*                                                                              */
+   /*    Input Parameters:                                                         */
+   /*         - the dar use id                                                     */
+   /*         - the dar level                                                      */
+   /*											                                                         */
+   /*    Output Parameters:                                                        */
+   /*        Validation of the function execution.								                 */
+   /*                                                                              */
+   /*                                                                              */
+   /*    Note:                                                                     */
+   /*        None                                                                  */
+   /*                                                                              */
+   /********************************************************************************/
+
+   T_RV_RET dar_diagnose_swe_filter ( T_RVM_USE_ID  dar_use_id, 
+                                     T_DAR_LEVEL   dar_level)
+   {
+      /* Declare local variables */
+      T_RVF_MB_STATUS       mb_status   = RVF_GREEN;
+      T_DAR_FILTER_START   *use_id_p = NULL;
+
+      /************************** dar_diagnose_swe_filter function   ***************/
+
+      if (dar_gbl_var_p == NULL )
+      {
+         dar_error_trace(DAR_ENTITY_NOT_START);
+         return(RV_NOT_READY);
+      }
+       
+      /* allocate the memory for the message to send */
+      mb_status = rvf_get_buf (dar_gbl_var_p->mb_dar,
+                               sizeof (T_DAR_FILTER_START),
+                               (T_RVF_BUFFER **) (&use_id_p));
+
+      /* If insufficient resources, then report a memory error and abort.          */
+      if (mb_status == RVF_YELLOW)
+      {
+         /* deallocate the memory */
+         rvf_free_buf((T_RVF_BUFFER *)use_id_p);
+         dar_error_trace(DAR_ENTITY_NO_MEMORY);
+         return (RV_NOT_SUPPORTED);
+      }
+      else
+      if (mb_status == RVF_RED)
+      {
+         dar_error_trace(DAR_ENTITY_NO_MEMORY);
+         return (RV_MEMORY_ERR);
+      }
+
+      /* fill the message id       */
+      use_id_p ->os_hdr.msg_id = DAR_FILTER_REQ;
+
+      /* fill the addr source id */
+      use_id_p->os_hdr.src_addr_id = dar_gbl_var_p->addrId;
+
+      /* fill the message parameters (group, mask and level) */
+      use_id_p->use_msg_parameter.group_nb = (dar_use_id>>16)& 0x7FFF;
+      use_id_p->use_msg_parameter.mask     = (dar_use_id)&0xFFFF;
+      use_id_p->use_msg_parameter.level    = dar_level;
+
+      /* send the messsage to the DAR entity */
+      rvf_send_msg (dar_gbl_var_p->addrId, 
+                    use_id_p);
+
+      return (RV_OK);
+
+	 
+   } /* dar_diagnose_swe_filter */
+
+   /********************************************************************************/
+   /*                                                                              */
+   /*    Function Name:   dar_diagnose_write                                       */
+   /*                                                                              */
+   /*    Purpose:  This function is called to store diagnose data in RAM buffer    */
+   /*                                                                              */
+   /*                                                                              */
+   /*    Input Parameters:                                                         */
+   /*        Pointer to the message to store                                       */
+   /*        Data Format, ( the Binary format is not supported)                    */
+   /*        Data level,                                                           */
+   /*        Data Use Id,                                                          */
+   /*                                                                              */
+   /*    Output Parameters:                                                        */
+   /*         Validation of the diagnose execution.                                */
+   /*                                                                              */
+   /*                                                                              */
+   /*                                                                              */
+   /*    Revision History:                                                         */
+   /*        None.                                                                 */
+   /*                                                                              */
+   /********************************************************************************/
+   T_RV_RET dar_diagnose_write(  T_DAR_INFO    *buffer_p,
+                                 T_DAR_FORMAT  format,
+                                 T_DAR_LEVEL   diagnose_info_level,
+                                 T_RVM_USE_ID  dar_use_id)
+   {
+      /* Declare local variables */
+      UINT8 index =0 ; /* local index */
+
+      /* Check if the dar_use_id group_nb exists */
+      /* If the group exists... */
+      if(dar_search_group((dar_use_id>>16)& 0x7FFF,&index) == RV_OK)
+      {
+         /* Check the Dar level   */
+         switch(diagnose_info_level) 
+         {
+            case DAR_WARNING:
+            { 
+               /* The DAR entity wants to process Warning messages */
+               /* check if the mask_warning is in the dar_filter array */
+               if (((dar_gbl_var_p ->dar_filter_array[index].mask_warning) 
+                      & ((dar_use_id)&0xFFFF)) !=0)
+               {
+                  /* The Warning messages must be diagnosed */
+                  dar_send_write_data( buffer_p, format, diagnose_info_level, dar_use_id);
+               }
+
+               else
+               { 
+                  /* There is no mask_warning for this use_id in the dar_filter array   */
+                  /* The warning messages can't be diagnosed                            */
+                  DAR_TRACE_WARNING("The Warning messages can't be diagnosed");
+               }
+
+               break;
+            } /* case DAR_WARNING */
+
+            case DAR_DEBUG:
+            {
+               /* The DAR entity wants to process Debug messages       */
+               /* Check if the mask_debug is in the dar_filter array */
+
+               if (((dar_gbl_var_p ->dar_filter_array[index].mask_debug) 
+                      & ((dar_use_id)&0xFFFF)) !=0) 
+               {
+                  /* The Debug messages must be diagnosed */
+                  dar_send_write_data( buffer_p, format, diagnose_info_level, dar_use_id);
+               }
+            
+               else
+               { 
+                  /* There is no mask_debug for this use_id in the dar_filter array    */
+                  /* The debug messages can't be diagnosed                             */
+                  DAR_TRACE_WARNING("The Debug messages can't be diagnosed");
+               }
+               break;
+            } /* case DAR_DEBUG */
+
+            default:
+            {
+               /* Unknow level has been received */
+               DAR_TRACE_WARNING("A DAR unknow level has been received ");
+               break; 
+            }
+         } /* switch(msg_p->use_msg_parameter.level) */
+      } /* if (search_group(dar_use_id.group_nb,&index)== RV_OK) */
+      
+      else
+      {
+        /* An unknow group message has been received */
+        DAR_TRACE_WARNING("A DAR unknow group level message has been received ");
+      }
+      
+      return (RV_OK);
+   } /* dar_diagnose_write */
+
+
+   /********************************************************************************/
+   /*                                                                              */
+   /*    Function Name:   dar_diagnose_generate_emergency                          */
+   /*                                                                              */
+   /*    Purpose:  This function is called to store diagnose data in RAM buffer    */
+   /*              when an emergency has been detected and goes to emergency       */
+   /*              (automatic reset)                                               */
+   /*                                                                              */
+   /*                                                                              */
+   /*                                                                              */
+   /*    Input Parameters:                                                         */
+   /*        Pointer to the message to store                                       */
+   /*        Data Format, ( the Binary format is not supported)                    */
+   /*        Data Use Id,                                                          */
+   /*                                                                              */
+   /*    Output Parameters:                                                        */
+   /*         Validation of the diagnose execution.                                */
+   /*                                                                              */
+   /*                                                                              */
+   /*                                                                              */
+   /*    Revision History:                                                         */
+   /*        None.                                                                 */
+   /*                                                                              */
+   /********************************************************************************/
+   T_RV_RET dar_diagnose_generate_emergency(  T_DAR_INFO    *buffer_p,
+                                              T_DAR_FORMAT  format,
+                                              T_RVM_USE_ID  dar_use_id)
+   {
+      if (dar_gbl_var_p != NULL)
+      {
+         /* Process the diagnose emergency */
+         dar_process_emergency(buffer_p, format, dar_use_id, DAR_EMERGENCY_RESET|DAR_NEW_ENTRY);
+           
+         return (RV_OK);
+      }
+      else
+      {
+         return (RV_NOT_READY);
+      }
+
+   } /* dar_diagnose_write */
+
+    	   
+   /********************************************************************************/
+   /*                                                                              */
+   /*    Function Name:   dar_diagnose_write_emergency                             */
+   /*                                                                              */
+   /*    Purpose:  This function is called to store diagnose data in RAM buffer    */
+   /*              when an emergency has been detected. Data is written directly   */
+   /*              compared to dar_diagnode_write where data is sent to DAR        */
+   /*              via messages. Depending on the passed flags a RESET will be     */                                              
+   /*              done.                                                           */
+   /*                                                                              */
+   /*                                                                              */
+   /*    Input Parameters:                                                         */
+   /*        Pointer to the message to store                                       */
+   /*        Data Format, ( the Binary format is not supported)                    */
+   /*        Data Use Id,                                                          */
+   /*        Flags                                                                 */
+   /*                                                                              */
+   /*    Output Parameters:                                                        */
+   /*         Validation of the diagnose execution.                                */
+   /*                                                                              */
+   /*                                                                              */
+   /*                                                                              */
+   /*    Revision History:                                                         */
+   /*        None.                                                                 */
+   /*                                                                              */
+   /********************************************************************************/
+   T_RV_RET dar_diagnose_write_emergency(  T_DAR_INFO    *buffer_p,
+                                           T_DAR_FORMAT  format,
+                                           T_RVM_USE_ID  dar_use_id,
+                                           UINT32 flags)
+   {
+      if (dar_gbl_var_p != NULL)
+      {
+         /* Process the diagnose emergency */
+         dar_process_emergency(buffer_p, format, dar_use_id, flags);
+           
+         return (RV_OK);
+      }
+      else
+      {
+         return (RV_NOT_READY);
+      }
+
+   } /* dar_diagnose_write_emergency */
+   
+#else
+
+   /* ************************************************ */
+   /*            THE DAR ENTITY IS DISABLED            */
+   /* ************************************************ */
+
+   #include "rv/rv_general.h"
+   #include "rvm/rvm_gen.h"
+   #include "rvm/rvm_priorities.h"
+   #include "rvf/rvf_target.h"
+   #include "rvf/rvf_i.h"
+   #include "dar/dar_gen.h"
+
+   T_RV_RET dar_diagnose_swe_filter ( T_RVM_USE_ID  dar_use_id, 
+                                      T_DAR_LEVEL   dar_level)
+   {
+         return (RV_OK);
+
+   } /* dar_diagnose_swe_filter */
+   
+
+   T_RV_RET dar_diagnose_write(  T_DAR_INFO    *buffer_p,
+                                 T_DAR_FORMAT  format,
+                                 T_DAR_LEVEL   diagnose_info_level,
+                                 T_RVM_USE_ID  dar_use_id)
+   {
+         return (RV_OK);
+
+   } /* dar_diagnose_write */
+
+        
+   
+   T_RV_RET dar_diagnose_generate_emergency(  T_DAR_INFO    *buffer_p,
+                                              T_DAR_FORMAT  format,
+                                              T_RVM_USE_ID  dar_use_id)
+   {
+
+         return (RV_OK);
+
+   } /* dar_diagnose_generate_emergency */
+
+
+   T_RV_RET dar_diagnose_write_emergency(  T_DAR_INFO    *buffer_p,
+                                           T_DAR_FORMAT  format,
+                                           T_RVM_USE_ID  dar_use_id,
+                                           UINT32 flags)
+   {
+         return (RV_OK);
+   } /* dar_diagnose_write_emergency */
+    	   
+
+#endif /* #ifdef RVM_DAR_SWE */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gsm-fw/services/dar/dar_api.h	Sun Mar 16 05:48:58 2014 +0000
@@ -0,0 +1,157 @@
+/****************************************************************************/
+/*                                                                          */
+/*  File Name:  dar_api.h                                                   */
+/*                                                                          */
+/*  Purpose:  This file contains data structures and functions prototypes   */
+/*            used to send events to the DAR SWE.                           */
+/*                                                                          */
+/*  Version   0.1                                                           */
+/*                                                                          */
+/*  Date                Modification                                        */
+/*  ------------------------------------                                    */
+/*  26 September 2001   Create                                              */
+/*                                                                          */
+/*  Author       Stephanie Gerthoux                                         */
+/*                                                                          */
+/* (C) Copyright 2001 by Texas Instruments Incorporated, All Rights Reserved*/
+/****************************************************************************/
+
+#include "rv/rv_defined_swe.h"
+#include "rvm/rvm_api.h"
+
+/* file used in recovery case */
+#include "main/sys_types.h" 
+
+#include "dar/dar_gen.h"
+
+#ifdef RVM_DAR_SWE
+
+   #ifndef __DAR_API_H_
+      #define __DAR_API_H_
+
+      #ifdef __cplusplus
+         extern "C"
+            {
+      #endif
+
+      /***** Events   *****/
+      #define DAR_EVENTS_MASK                                  (0x5000)
+      #define DAR_EVENT_EXTERN                                 (0x0C00)
+
+      /***** Definitions *****/
+      /*Define DAR use parameters */ 
+      typedef struct
+      { 
+         UINT16 group_nb;
+         UINT16 mask;
+      }T_DAR_USE_ID;
+
+      typedef struct
+      {
+         T_RV_HDR   os_hdr;
+         INT8       status;
+      } T_DAR_STATUS;
+
+      /********************************************************************************/
+      /*                               RECOVERY                                       */
+      /********************************************************************************/
+
+      /***** Events   *****/
+      #define DAR_RECOVERY_CONFIG                            (0x0001|DAR_EVENT_EXTERN)
+   
+      /***** Definitions ******/
+      /* Define return parameters. */
+      typedef UINT16 T_DAR_RECOVERY_STATUS;
+      /* possible values */
+      #define DAR_POWER_ON_OFF            (0x0)       /* Power ON/OFF */
+      #define DAR_WATCHDOG                (0xDD11)    /* Watchdog reset */
+      #define DAR_NORMAL_SCUTTLING        (0xDD22)    /* Recovery module has decided to active the reset */
+      #define DAR_EMERGENCY_SCUTTLING     (0xDD33)    /* Emergency detection */
+
+      /* Define Recovery configuration parameters */
+      typedef struct{
+         UINT16            msg_id;          /* id of the message     */
+         T_DAR_BUFFER      buffer_p;        /* pointer on the buffer */
+         UINT8             length;          /* buffer length         */
+      } T_DAR_RECOVERY_CONFIG;
+
+      /* Define register parameters */
+      #define DAR_NAME_MAX_LEN		(15)
+      typedef char T_DAR_NAME[DAR_NAME_MAX_LEN];
+
+      /***** Prototype *****/
+      /* Get and reset the status of the DAR entity */
+      T_RV_RET dar_recovery_get_status(T_DAR_RECOVERY_STATUS* status);
+      T_RV_RET dar_recovery_config(T_RV_RET (*dar_store_recovery_data)( T_DAR_BUFFER buffer_p,
+                                                                        UINT16 length));
+      T_RV_RET dar_get_recovery_data(T_DAR_BUFFER buffer_p,UINT16 length );                                                         
+
+     /********************************************************************************/
+     /*                               WATCHDOG                                       */
+     /********************************************************************************/
+    
+     /***** Prototype *****/
+     T_RV_RET  dar_start_watchdog_timer(UINT16 timer);
+     T_RV_RET  dar_reload_watchdog_timer(void);
+     T_RV_RET  dar_stop_watchdog_timer(void);
+
+
+     /********************************************************************************/
+     /*                                RESET                                         */
+     /********************************************************************************/
+    
+     /***** Prototype *****/
+     T_RV_RET  dar_reset_system(void);
+
+
+     /********************************************************************************/
+     /*                              DIAGNOSE                                        */
+     /********************************************************************************/
+
+     /***** Definitions *****/
+
+     /* DAR level messages value ( Error, Warning or debug )  */
+     /*   define with 8 bits: - the first for Error level     */
+     /*                       - the second for Warning level  */
+     /*                       - the other bits for debug level*/
+
+     /* Error level :    1000 0000 in binary*/
+     #define DAR_ERROR                               (0x80)
+     /* Warning level :  0100 0000 in binary*/
+     #define DAR_WARNING                             (0x40)
+     /* Debug level :    0000 0001 in binary*/
+     #define DAR_DEBUG                               (0x01)
+     /* None level :     0000 0000 in binary*/
+     #define DAR_NO_DIAGNOSE                         (0x00)
+     /* Exception level  1111 1111 in binary*/
+     #define DAR_EXCEPTION                           (0xFF)
+     /* Causes a reset, if set when calling dar_diagnose_write_emergency() */
+     #define DAR_EMERGENCY_RESET               (0x00000001)
+     /* New data is appended to last entry, if set when calling dar_diagnose_write_emergency() */
+     #define DAR_NEW_ENTRY                     (0x00000002)
+
+     /***** Prototype *****/
+     /* Diagnose prototypes */
+     T_RV_RET dar_diagnose_swe_filter (  T_RVM_USE_ID  dar_use_id, 
+                                         T_DAR_LEVEL    dar_level);
+
+     T_RV_RET dar_diagnose_write(  T_DAR_INFO    *buffer_p,
+                                   T_DAR_FORMAT  format,
+                                   T_DAR_LEVEL   diagnose_info_level,
+                                   T_RVM_USE_ID  dar_use_id);
+
+     T_RV_RET dar_diagnose_write_emergency(  T_DAR_INFO    *buffer_p,
+                                             T_DAR_FORMAT  format,
+                                             T_RVM_USE_ID  dar_use_id,
+                                             UINT32 flags);
+
+     T_RV_RET dar_diagnose_generate_emergency(  T_DAR_INFO    *buffer_p,
+                                                T_DAR_FORMAT  format,
+                                                T_RVM_USE_ID  dar_use_id);
+  
+     #ifdef __cplusplus
+       } 
+     #endif
+
+   #endif /* __DAR_API_H_ */
+#endif /* #ifdef RVM_DAR_SWE */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gsm-fw/services/dar/dar_const_i.h	Sun Mar 16 05:48:58 2014 +0000
@@ -0,0 +1,113 @@
+/****************************************************************************/
+/*                                                                          */
+/*   File Name:   dar_const_i.h                                             */
+/*                                                                          */
+/*   Purpose:   Internal constants used by DAR instance                     */
+/*                                                                          */
+/*                                                                          */
+/*   Version    0.1                                                         */
+/*                                                                          */
+/*   Date                        Modification                               */
+/*   ------------------------------------                                   */
+/*   26 Septembre 2001    Create                                            */
+/*                                                                          */
+/*   Author          Stephanie Gerthoux                                     */
+/*                                                                          */
+/*                                                                          */
+/* (C) Copyright 2001 by Texas Instruments Incorporated, All Rights Reserved*/
+/****************************************************************************/
+
+#include "rv/rv_defined_swe.h"
+
+#ifdef RVM_DAR_SWE
+
+   #ifndef __DAR_CONST_I_H_
+      #define __DAR_CONST_I_H_
+
+       #include "config/chipset.cfg"
+
+      #ifdef __cplusplus
+         extern "C"
+            {
+      #endif
+
+      /* Define a mask used to identify the events */
+      #define DAR_EVENT_EXTERN                            (0x0C00)
+      #define DAR_EVENT_INTERN                            (0x0300)
+
+      /* The DAR task run without any time out */
+      #define DAR_NOT_TIME_OUT                            (0)
+
+      /* The DAR entity processes only the messages send to the following mail box */
+      #define DAR_MBOX                                    (RVF_TASK_MBOX_0)
+
+      /* The DAR entity takes into account only the following events: */
+      #define DAR_TASK_MBOX_EVT_MASK                      (RVF_TASK_MBOX_0_EVT_MASK)
+
+      /* The DAR entity waits all event type */
+      #define DAR_ALL_EVENT_FLAGS                         (0xFFFF)
+
+      /* The DAR use max group elements used */
+      #define DAR_MAX_GROUP_NB                            (4)
+
+      /* RAM max buffer size    */
+      #define DAR_MAX_BUFFER_SIZE                         (3000)
+
+      /* Recovery data max buffer size    */
+      #define DAR_RECOVERY_DATA_MAX_BUFFER_SIZE           (50)
+
+      /* Dar invalid value    */
+      #define DAR_INVALID_VALUE                           (0xFFFF)
+      
+      /* Dar initialization */
+      #define DAR_INITIALIZATION_VALUE                    (0x0000)
+
+      /* Define the Watchdog timer register mode */
+      #define WATCHDOG_TIM_MODE                           (0xFFFFF804)
+
+	  
+      #if ((CHIPSET == 7) || (CHIPSET == 8) || (CHIPSET == 10) || (CHIPSET == 11))
+	      /* Define the Debug Unit register mode */
+		  #define DAR_DEBUG_UNIT_REGISTER                     (0x03C00000)
+      #elif	(CHIPSET == 12)
+		 /* Define the Debug Unit register mode */
+		  #define DAR_DEBUG_UNIT_REGISTER                     (0x09F00000)
+      #endif  
+
+      /* Mask to enable the Debug Unit Module */
+      #define ENABLE_DU_MASK                              (0xF7FF)
+
+      /* Mask to disable the Debug Unit Module */
+      #define DISABLE_DU_MASK                             (0x0800)
+
+      /* Extra Control register CONF Adress */
+      #define DAR_DU_EXTRA_CONTROL_REG                    (0xFFFFFB10)
+     
+      /* Define the size of the Debug Unit register      */
+      /* This size is 64 words of 32 bits = 64*4 bytes */ 
+      /* Size in bytes */
+      #define DEBUG_UNIT_BYTES_SIZE                       (256)
+      /* Define the size in words */
+      #define DEBUG_UNIT_WORD_SIZE                        (64) 
+
+      /* Define the size of the X_dump _buffer */
+      /* This size is specified in the gsm_cs_amd4_lj3_test.cmd (in "system" directory) */
+      /* Its size is 38*32 bits = 38*4 bytes = 152 bytes */
+      #define DAR_X_DUMP_BUFFER_SIZE                      (152)
+           
+      /* Define the exceptions */
+      #define DAR_NO_ABORT_EXCEPTION                      (0)
+      #define DAR_EXCEPTION_DATA_ABORT                    (1)
+      #define DAR_EXCEPTION_PREFETCH_ABORT                (2)
+      #define DAR_EXCEPTION_UNDEFINED                     (3)
+      #define DAR_EXCEPTION_SWI                           (4)
+      #define DAR_EXCEPTION_RESERVED                      (5)
+
+      #ifdef __cplusplus
+          }
+      #endif
+   #endif /* __DAR_CONST_I_H_ */
+#endif /* #ifdef RVM_DAR_SWE */
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gsm-fw/services/dar/dar_diagnose.c	Sun Mar 16 05:48:58 2014 +0000
@@ -0,0 +1,355 @@
+/****************************************************************************/
+/*                                                                          */
+/*  File Name:  dar_diagnose.c                                              */
+/*                                                                          */
+/*  Purpose:   This function contains the DAR diagnose functions            */
+/*                                                                          */
+/*                                                                          */
+/*  Version   0.1                                                           */
+/*                                                                          */
+/*  Date                 Modification                                       */
+/*  ------------------------------------                                    */
+/*  18 October 2001    Create                                               */
+/*                                                                          */
+/*  Author     Stephanie Gerthoux                                           */
+/*                                                                          */
+/* (C) Copyright 2001 by Texas Instruments Incorporated, All Rights Reserved*/
+/****************************************************************************/
+
+#include "rv/rv_defined_swe.h"
+#ifdef RVM_DAR_SWE
+   #ifndef _WINDOWS
+     #include "timer/timer.h"
+   #endif
+
+   #include "rv/rv_general.h"
+   #include "rvm/rvm_gen.h"
+   #include "rvm/rvm_priorities.h"
+   #include "dar/dar_api.h"
+   #include "dar/dar_structs_i.h"
+   #include "dar/dar_env.h"
+   #include "rvf/rvf_target.h"
+   #include "dar/dar_const_i.h"
+   #include "dar/dar_macro_i.h"
+   #include "dar/dar_messages_i.h"
+   #include "dar/dar_error_hdlr_i.h"
+   //#include "rvf/rvf_i.h"
+
+   /**** Global variables ****/
+
+   /* Define a pointer to the Global Environment Control block   */
+   extern T_DAR_ENV_CTRL_BLK *dar_gbl_var_p;
+
+
+
+   /********************************************************************************/
+   /* Function         dar_search_group                                            */
+   /*                                                                              */
+   /* Description      This function checks if the use_id group_nb exists:         */
+   /*                                                                              */
+   /********************************************************************************/
+   T_RV_RET dar_search_group(UINT16 group, UINT8 *index_p)
+   {
+      /* Declare local variables */   
+      UINT8 i=0;
+
+      /* Check if the DAR entity is started */
+      if (dar_gbl_var_p != NULL )
+      {
+         /* Search in the dar_filter_array if the group exists */
+         for (i=0;i< DAR_MAX_GROUP_NB; i++)
+         {
+            if(dar_gbl_var_p->dar_filter_array[i].group_nb == group)
+            {
+               *index_p=i;
+               //DAR_SEND_TRACE_PARAM("dar filter_array index",*index_p,RV_TRACE_LEVEL_DEBUG_LOW);
+               return(RV_OK);
+            }
+         }
+         return(RV_NOT_SUPPORTED);
+      }
+      else
+      {
+         return(RV_NOT_READY);
+      }
+   }
+
+   /********************************************************************************/
+   /* Function         dar_add_group                                               */
+   /*                                                                              */
+   /* Description      This function research the index of the first free group    */
+   /*                                                                              */
+   /********************************************************************************/
+   T_RV_RET dar_add_group(UINT8 *index_p)
+   {
+      /* Declare local variables */
+      UINT8 i=0;
+
+      /* Check if the DAR entity is started */
+      if (dar_gbl_var_p == NULL )
+      {
+         dar_error_trace(DAR_ENTITY_NOT_START);
+         return(RV_NOT_READY);
+      }
+
+      /* Search in the dar_filter_array the first free group */
+      for (i=0;i< DAR_MAX_GROUP_NB; i++)
+      {
+         if(dar_gbl_var_p->dar_filter_array[i].group_nb == DAR_INITIALIZATION_VALUE)
+         {
+            *index_p=i;
+            return(RV_OK);
+         }
+      }
+      return(RV_NOT_SUPPORTED);
+   }
+
+
+   /********************************************************************************/
+   /*                                                                              */
+   /*    Function Name:   dar_send_write_data  								                     */
+   /*                                                                              */
+   /*    Purpose: This function is called to send write data in the DAR mailbox    */
+   /*                                                                              */
+   /*    Input Parameters:                                                         */
+   /*        Pointer to the message to store                                       */
+   /*        Data Format,                                                          */
+   /*        Data level,                                                           */
+   /*        Data Use Id,                                                          */  
+   /*                                                       											 */                                                      
+   /*    Output Parameters:                                                        */
+   /*        Validation of the function execution.								                 */
+   /*                                                                              */
+   /*    Note:                                                                     */
+   /*        None                                                                  */
+   /*                                                                              */
+   /********************************************************************************/
+
+   T_RV_RET dar_send_write_data (  T_DAR_INFO    *buffer_p,
+                                   T_DAR_FORMAT  format,
+                                   T_DAR_LEVEL   diagnose_info_level,
+                                   T_RVM_USE_ID  dar_use_id)
+   {
+      /* Declare local variables */
+      T_RVF_MB_STATUS      mb_status         = RVF_GREEN;
+      T_DAR_WRITE_START   *write_data_p      = NULL;
+
+      /************************** dar_send_write_data **********************/
+
+      if (dar_gbl_var_p != NULL )
+      {
+         /* allocate the memory for the message to send */
+         mb_status = rvf_get_buf (dar_gbl_var_p->mb_dar,
+                                  sizeof (T_DAR_WRITE_START),
+                                  (T_RVF_BUFFER **) (&write_data_p));
+
+         /* If insufficient resources, then report a memory error and abort.*/
+         if (mb_status == RVF_YELLOW)
+         {
+            /* deallocate the memory */
+            rvf_free_buf((T_RVF_BUFFER *)write_data_p);
+            dar_error_trace(DAR_ENTITY_NO_MEMORY);
+            return (RV_NOT_SUPPORTED);
+         }
+         else
+         if (mb_status == RVF_RED)
+         {
+            dar_error_trace(DAR_ENTITY_NO_MEMORY);
+            return (RV_MEMORY_ERR);
+         }
+
+         /* fill the message id         */
+         write_data_p->os_hdr.msg_id = DAR_WRITE_REQ;
+
+         /* fill the addr source id     */
+         write_data_p->os_hdr.src_addr_id = dar_gbl_var_p->addrId;
+
+         /* fill the message parameters */
+         write_data_p->data_write.char_p              = buffer_p ;
+         write_data_p->data_write.data_format         = format;
+         write_data_p->data_write.level               = diagnose_info_level;
+         write_data_p->data_write.use_id.group_nb     = (dar_use_id>>16)& 0x7FFF;
+         write_data_p->data_write.use_id.mask         = (dar_use_id)&0xFFFF;
+
+         /* send the messsage to the DAR entity */
+         rvf_send_msg (dar_gbl_var_p->addrId, 
+                       write_data_p);
+
+         return (RV_OK);
+      }
+      else
+      {
+          return(RV_NOT_READY);
+      }
+
+	 
+   } /* dar_send_write_data */
+
+   /********************************************************************************/
+   /* Function         dar_reset                                                   */
+   /*                                                                              */
+   /* Description      This function is used to reset the system                   */
+   /*                                                                              */
+   /*    Input Parameters:                                                         */
+   /*        None                                                                  */  
+   /*                                                       											 */                                                      
+   /*    Output Parameters:                                                        */
+   /*        Validation of the function execution.							                   */
+   /*                                                                              */
+   /*    Note:                                                                     */
+   /*        None                                                                  */
+   /*                                                                              */
+   /********************************************************************************/
+   T_RV_RET dar_reset(void)
+   {
+      #ifndef _WINDOWS
+         /* Declare global variable*/
+         volatile UINT16 *register_p;
+         volatile UINT8   i;
+
+      
+         /* enable the Watchdog timer */
+         TM_EnableWatchdog();
+
+         /* Reset the system with the Watchdog */
+         /* initialize the adress of the watchdog timer pointer */
+         register_p = (volatile UINT16 *)WATCHDOG_TIM_MODE;
+
+         /* Write the 0xF5 value to the Watchdog timer mode register to disable the Watchdog*/
+         /* Note the bit 15 must be unchanged ( bit 15 = 1 -> 0x8000)*/
+         *register_p =0x80F5;
+
+         /* Wait a couple of time to be sure that this register has a new value */
+         for (i=0;i<100;i++);
+
+         /* After having received 0xF5 in the Watchdog timer mode register, if the */
+         /* second write access is differennt from 0xA0, ARM core is reset         */
+         /*   The ARM HW core is reset + branch to adress 0x0000 ( SW reset)       */
+         *register_p=0x80F5;
+
+         /* Wait until the ARM reset */
+         while(1);
+      #endif
+
+      return(RV_OK);
+   } /* dar_reset */
+
+
+   /********************************************************************************/
+   /*                                                                              */     
+   /* Function         dar_read_mbox                                               */
+   /*                                                                              */
+   /* Description      Called by the dar to read a buffer from its mailboxes.      */
+   /*                  when the Operating System is out                            */
+   /* Input Parameters:                                                            */
+   /*        None                                                                  */  
+   /*                                                       							  */                                                      
+   /* Output Parameters:                                                           */
+   /*        NULL if the mailbox was empty, else the address of a buffer           */
+   /*                                                                              */
+   /********************************************************************************/
+
+   void * dar_read_mbox (UINT8 mbox)
+   {   
+      // void * p_buf	= NULL;
+      // T_RVF_INTERNAL_BUF * p_hdr;
+	 
+      /* Verify if DAR's global struct was set by RVM, then read the mailbox */
+      if (dar_gbl_var_p != NULL )
+	  return rvf_read_addr_mbox (dar_gbl_var_p->addrId, mbox);
+
+      return NULL;
+      
+      // Check if the DAR entity is started 
+      /*if (dar_gbl_var_p != NULL )
+      {
+
+         if ( OSTaskQFirst[dar_gbl_var_p->addrId][mbox] )// if the chained list is not empty 
+         {   
+            p_hdr = OSTaskQFirst[dar_gbl_var_p->addrId][mbox];
+            OSTaskQFirst[dar_gbl_var_p->addrId][mbox] = p_hdr->p_next;
+
+            p_hdr->p_next = NULL;
+
+            #if RVF_ENABLE_BUF_LINKAGE_CHECK
+              RVF_SET_BUF_UNLINKED(p_hdr);	// change buffer status 
+            #endif
+
+            p_buf = (UINT8 *)p_hdr + sizeof(T_RVF_INTERNAL_BUF);
+         }
+      }
+      return (p_buf); */
+   } // dar_read_mbox 
+ 
+#else
+
+   /* ******************************************************* */
+   /*            THE DAR ENTITY IS DISABLED                   */
+   /* ******************************************************* */
+   #ifndef _WINDOWS
+	   #include "config/swconfig.cfg"
+	   #include "config/sys.cfg"
+       #include "config/chipset.cfg"
+       #include "timer/timer.h"
+   #endif
+
+   #include "rv/rv_general.h"
+   #include "rvm/rvm_gen.h"
+   #include "rvm/rvm_priorities.h"
+   #include "rvf/rvf_target.h"
+   //#include "rvf/rvf_i.h"
+
+   /* Define the Watchdog timer register mode */
+   #define WATCHDOG_TIM_MODE                           (0xFFFFF804)
+
+
+   /********************************************************************************/
+   /* Function         dar_reset                                                   */
+   /*                                                                              */
+   /* Description      This function is used to reset the system                   */
+   /*                                                                              */
+   /*    Input Parameters:                                                         */
+   /*        None                                                                  */  
+   /*                                                       	 				   */                                                      
+   /*    Output Parameters:                                                        */
+   /*        Validation of the function execution.							       */
+   /*                                                                              */
+   /*    Note:                                                                     */
+   /*        None                                                                  */
+   /*                                                                              */
+   /********************************************************************************/
+   T_RV_RET dar_reset(void)
+   {
+      #ifndef _WINDOWS
+         /* Declare global variable*/
+         volatile UINT16 *register_p;
+         volatile UINT8   i;
+
+      
+         /* enable the Watchdog timer */
+         TM_EnableWatchdog();
+
+         /* Reset the system with the Watchdog */
+         /* initialize the adress of the watchdog timer pointer */
+         register_p = (volatile UINT16 *)WATCHDOG_TIM_MODE;
+
+         /* Write the 0xF5 value to the Watchdog timer mode register to disable the Watchdog*/
+         /* Note the bit 15 must be unchanged ( bit 15 = 1 -> 0x8000)*/
+         *register_p =0x80F5;
+
+         /* Wait a couple of time to be sure that this register has a new value */
+         for (i=0;i<100;i++);
+
+         /* After having received 0xF5 in the Watchdog timer mode register, if the */
+         /* second write access is differennt from 0xA0, ARM core is reset         */
+         /*   The ARM HW core is reset + branch to adress 0x0000 ( SW reset)       */
+         *register_p=0x80F5;
+
+         /* Wait until the ARM reset */
+         while(1);
+      #endif
+
+      return(RV_OK);
+   } /* dar_reset */
+
+#endif /* #ifdef RVM_DAR_SWE */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gsm-fw/services/dar/dar_diagnose_i.h	Sun Mar 16 05:48:58 2014 +0000
@@ -0,0 +1,45 @@
+/****************************************************************************/
+/*                                                                          */
+/*  File Name:  dar_diagnose_i.h                                            */
+/*                                                                          */
+/*  Purpose:   This function contains the functions prototypes of the DAR   */ 
+/*             entity diagnose functions.                                   */
+/*                                                                          */
+/*  Version   0.1                                                           */
+/*                                                                          */
+/*  Date                 Modification                                       */
+/*  ------------------------------------                                    */
+/*  18 October 2001    Create                                               */
+/*                                                                          */
+/*  Author     Stephanie Gerthoux                                           */
+/*                                                                          */
+/* (C) Copyright 2001 by Texas Instruments Incorporated, All Rights Reserved*/
+/****************************************************************************/
+
+#include "rv/rv_defined_swe.h"
+#ifdef RVM_DAR_SWE
+
+   #ifndef __DAR_DIAGNOSE_I_H_
+   #define __DAR_DIAGNOSE_I_H_
+
+   #include "rvm/rvm_gen.h"
+
+   /* Search a group in the dar array*/
+   T_RV_RET dar_search_group(UINT16 group, UINT8 *index_p);
+
+   /* Add a group in the dar array*/
+   T_RV_RET dar_add_group(UINT8 *index_p);
+
+   /* Send write data prototype */
+   T_RV_RET dar_send_write_data (  T_DAR_INFO    *buffer_p,
+                                   T_DAR_FORMAT  format,
+                                   T_DAR_LEVEL   diagnose_info_level,
+                                   T_RVM_USE_ID  dar_use_id);
+
+   /* Reset the system */
+   T_RV_RET dar_reset(void);
+
+
+   #endif /* _DAR_DIAGNOSE_I_H_ */
+
+#endif /* #ifdef RVM_DAR_SWE */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gsm-fw/services/dar/dar_emergency.c	Sun Mar 16 05:48:58 2014 +0000
@@ -0,0 +1,562 @@
+/****************************************************************************/
+/*                                                                          */
+/*  File Name:  dar_emergency.c                                             */
+/*                                                                          */
+/*  Purpose:   This function is called when the DAR entity has detected     */
+/*             an  emergency  ( Error or exception)                         */
+/*                                                                          */
+/*                                                                          */
+/*  Version   0.1                                                           */
+/*                                                                          */
+/*  Date                 Modification                                       */
+/*  ------------------------------------                                    */
+/*  17 October 2001    Create                                               */
+/*                                                                          */
+/*  Author     Stephanie Gerthoux                                           */
+/*                                                                          */
+/* (C) Copyright 2001 by Texas Instruments Incorporated, All Rights Reserved*/
+/****************************************************************************/
+
+#include "rv/rv_defined_swe.h"
+#ifdef RVM_DAR_SWE
+   /* ************************************************ */
+   /*            THE DAR ENTITY IS ENABLED             */
+   /* ************************************************ */
+
+   #include <string.h>
+   #include "rvm/rvm_gen.h"
+   #include "dar/dar_api.h"
+   #include "dar/dar_macro_i.h"
+   #include "dar/dar_messages_i.h"
+   #include "dar/dar_const_i.h"
+   #include "dar/dar_diagnose_i.h"
+   #include "dar/dar_msg_ft.h"
+
+   #ifndef _WINDOWS
+      #include "timer/timer.h"
+   #endif
+
+   /**** Global variable ****/
+   /* index used in the circular buffer*/
+   extern UINT16 dar_current_index;
+
+   /* Write buffer*/
+   extern char dar_write_buffer[DAR_MAX_BUFFER_SIZE];
+
+   /* Get the dar current status */
+   extern T_DAR_RECOVERY_STATUS dar_current_status;
+
+   /* Get the dar exception status */
+   extern UINT8 dar_exception_status;
+
+   /* Define a pointer to the Global Environment Control block   */
+   extern T_DAR_ENV_CTRL_BLK *dar_gbl_var_p;
+
+   /* Define the recovery buffer */
+   extern UINT8   dar_recovery_buffer[DAR_RECOVERY_DATA_MAX_BUFFER_SIZE];
+
+   /* Ram buffer that contains the Debug Unit register */
+   extern UINT32  debug_RAM[DEBUG_UNIT_WORD_SIZE];
+
+
+   /**** Extern functions ****/
+   extern void * dar_read_mbox (UINT8 mbox);
+
+   extern void exception(void);
+
+
+   /********************************************************************************/
+   /*                                                                              */
+   /*    Function Name:   dar_process_emergency                                    */
+   /*                                                                              */
+   /*    Purpose:  This function is called to process emergency data and to store  */ 
+   /*              them in RAM buffer when an emergency has been detected          */
+   /*                                                                              */
+   /*                                                                              */
+   /*    Input Parameters:                                                         */
+   /*        Pointer to the message to store                                       */
+   /*        Data Format, ( the Binary format is not supported)                    */
+   /*        Data Use Id,                                                          */
+   /*        Flags                                                                 */
+   /*                                                                              */
+   /*    Output Parameters:                                                        */
+   /*         Validation of the diagnose execution.                                */
+   /*                                                                              */
+   /*                                                                              */
+   /*                                                                              */
+   /*    Revision History:                                                         */
+   /*        None.                                                                 */
+   /*                                                                              */
+   /********************************************************************************/
+   T_RV_RET dar_process_emergency( T_DAR_INFO    *buffer_p,
+                                   T_DAR_FORMAT  format,
+                                   T_RVM_USE_ID  dar_use_id,
+                                   UINT32 flags)
+   {
+      /* Declare local variables */
+      UINT32    i = 0;
+      UINT32    length = 0;
+      T_RV_HDR   *msg_p = ( T_RV_HDR*) dar_read_mbox(DAR_MBOX);
+
+      /**** Update the DAR recovery status ****/
+      dar_current_status = DAR_EMERGENCY_SCUTTLING;
+
+      /**** Empty the mail box before the reset of the system ****/
+      while(msg_p != NULL)
+      {
+         /* If it's a Write message, store it in the RAM      */
+         /* ( it is not interesting to store filter message ) */
+         if ((msg_p->msg_id) == DAR_WRITE_REQ)
+         {
+            /* store the message in the RAM*/
+            dar_write_data_in_buffer((T_DAR_WRITE_START *)msg_p);
+         }
+
+         /* free the Header of the message */
+         rvf_free_buf((T_RVF_BUFFER *) msg_p);
+
+         /* Read the next message */ 
+         msg_p = ( T_RV_HDR*) dar_read_mbox(DAR_MBOX);
+
+      } /* while (msg_p != NULL) */
+
+      /**** Store emergency data in RAM buffer ****/            
+      /* Diagnose string length */
+      length = (UINT16) strlen(buffer_p);
+
+      /**** Check if the DAR entity is started ****/
+      if (dar_gbl_var_p != NULL )
+      {
+         /* Data format */
+         dar_gbl_var_p->format = format;
+      }
+
+      if ( flags & DAR_NEW_ENTRY )
+      {
+      /**   Circular buffer to store data **/
+      /* Add 0xFF to separate 2 strings */
+      dar_write_buffer[dar_current_index] = 0xF; 
+      DAR_PLUS_PLUS(dar_current_index); /* to detected if it is the end of the buffer */
+      dar_write_buffer[dar_current_index] = 0xF; 
+      DAR_PLUS_PLUS(dar_current_index); /* to detected if it is the end of the buffer */
+
+      /* The group_nb is 16 bit length, and the buffer is an UINT8 length */
+      /* So the group_nb must be stocked by dividing it in 2 parts */
+      dar_write_buffer[dar_current_index] = ((dar_use_id>>16)& 0x7FFF)>>8;
+                                         /*add the 8 first bits of the Use id group*/
+      DAR_PLUS_PLUS(dar_current_index);
+      dar_write_buffer[dar_current_index] = (dar_use_id>>16)& 0x7FFF;
+                                         /*add the 8 last bits of the Use id group*/
+      DAR_PLUS_PLUS(dar_current_index);
+
+      /* The mask is 16 bit length, and the buffer is an UINT8 length */
+      /* So the mask must be stocked by dividing it in 2 parts */
+      dar_write_buffer[dar_current_index] = ((dar_use_id)&0xFFFF)>>8;
+                                         /* add the 8 first bits of the Use id mask */
+      DAR_PLUS_PLUS(dar_current_index);
+      dar_write_buffer[dar_current_index] = (dar_use_id)&0xFFFF;
+                                         /* add the 8 last bits of the Use id mask */
+      DAR_PLUS_PLUS(dar_current_index);
+
+      /* Add the dar_level data */
+      dar_write_buffer[dar_current_index] = DAR_ERROR;
+      DAR_PLUS_PLUS(dar_current_index);
+      }
+
+      /* circular buffer to store diagnose data in RAM buffer */
+      for (i=0; i < length; i++ )
+      {
+         /* copy string in the RAM char by char*/
+         dar_write_buffer[dar_current_index]=buffer_p[i];
+      
+         /* detection of the end of the buffer */
+         /* When current = DAR_MAX_BUFFER_SIZE , current = 0 */
+         DAR_PLUS_PLUS(dar_current_index); 
+      }
+
+      /* DAR information is redirected to standard trace */
+      //DAR_SEND_TRACE("Circular buffer :",RV_TRACE_LEVEL_ERROR);
+      //rvf_send_trace(buffer_p, length, NULL_PARAM, RV_TRACE_LEVEL_ERROR, DAR_USE_ID); 
+
+      /* Trace the buffer (used for debug) */
+      rvf_delay(RVF_MS_TO_TICKS(1000));
+   
+
+      /**** Check if the DAR entity is started ****/
+      if (dar_gbl_var_p != NULL )
+      {
+         if (dar_gbl_var_p->entity_dar_callback != NULL )
+         {
+            /* Call the MMI callback function to save some parameters before reset */
+            dar_gbl_var_p->entity_dar_callback(dar_recovery_buffer,DAR_RECOVERY_DATA_MAX_BUFFER_SIZE);
+         }
+      }
+
+      /* The system is reset if requested */
+      if ( flags & DAR_EMERGENCY_RESET )
+      {
+        dar_reset();
+      }
+      return(RV_OK);
+    
+   } /* dar_process_emergency */
+
+
+   /********************************************************************************/
+   /*                                                                              */
+   /*    Function Name:   dar_exception_arm_undefined                              */
+   /*                                                                              */
+   /*    Purpose:  This function is called to process ARM undefined instruction    */ 
+   /*              exception and to store this exception in the RAM buffer         */
+   /*                                                                              */
+   /*    Input Parameters:                                                         */
+   /*         None                                                                 */
+   /*                                                                              */
+   /*    Output Parameters:                                                        */
+   /*         Validation of the diagnose execution.                                */
+   /*                                                                              */
+   /*                                                                              */
+   /*                                                                              */
+   /*    Revision History:                                                         */
+   /*        None.                                                                 */
+   /*                                                                              */
+   /********************************************************************************/
+   void dar_exception_arm_undefined(void)
+   {
+      /* Declare local variables */
+      T_DAR_INFO *buffer_p= " DAR Emergency exception : ARM undefined ";/*exception data to store*/
+
+      /* Update the DAR recovery status */
+      dar_current_status = DAR_EMERGENCY_SCUTTLING;
+
+      /* Update the DAR exception status */
+      dar_exception_status = DAR_EXCEPTION_UNDEFINED;
+
+      /* Empty the mail box and store data in RAM buffer */
+      dar_empty_mb_and_save_data(buffer_p); 
+
+      /* Check if the DAR entity is started */
+      if (dar_gbl_var_p != NULL )
+      {
+         if (dar_gbl_var_p->entity_dar_callback != NULL)
+         {
+            /* Call the MMI callback function to save some parameters before reset */
+            dar_gbl_var_p->entity_dar_callback(dar_recovery_buffer,DAR_RECOVERY_DATA_MAX_BUFFER_SIZE);
+         }
+      }
+
+      #ifndef _WINDOWS
+         /* branch to "exception" defined in the int.s*/
+         exception();   
+      #endif
+      
+   } /* dar_exception_arm_undefined */
+
+   /********************************************************************************/
+   /*                                                                              */
+   /*    Function Name:   dar_exception_arm_swi                                    */
+   /*                                                                              */
+   /*    Purpose:  This function is called to process ARM SW Interrupt exception   */ 
+   /*              and to store this exception in the RAM buffer                   */
+   /*                                                                              */
+   /*    Input Parameters:                                                         */
+   /*         None                                                                 */
+   /*                                                                              */
+   /*    Output Parameters:                                                        */
+   /*         Validation of the diagnose execution.                                */
+   /*                                                                              */
+   /*                                                                              */
+   /*                                                                              */
+   /*    Revision History:                                                         */
+   /*        None.                                                                 */
+   /*                                                                              */
+   /********************************************************************************/
+   void dar_exception_arm_swi(void)
+   {
+      /* Declare local variables */
+      T_DAR_INFO *buffer_p= " DAR Emergency exception : ARM SWI ";/*exception data to store*/
+
+      /* Update the DAR recovery status */
+      dar_current_status = DAR_EMERGENCY_SCUTTLING;
+
+      /* Update the DAR exception status */
+      dar_exception_status = DAR_EXCEPTION_SWI;
+
+      /* Empty the mail box and store data in RAM buffer */
+      dar_empty_mb_and_save_data(buffer_p);
+
+      /* Check if the DAR entity is started */
+      if (dar_gbl_var_p != NULL )
+      {
+         if ( dar_gbl_var_p->entity_dar_callback != NULL)
+         {
+            /* Call the MMI callback function to save some parameters before reset */
+            dar_gbl_var_p->entity_dar_callback(dar_recovery_buffer,DAR_RECOVERY_DATA_MAX_BUFFER_SIZE);
+         }
+      }
+
+      #ifndef _WINDOWS
+        /* branch to "exception" defined in the int.s*/
+        exception();   
+      #endif
+      
+   } /* dar_exception_arm_swi */
+
+   /********************************************************************************/
+   /*                                                                              */
+   /*    Function Name:   dar_exception_arm_abort_prefetch                         */
+   /*                                                                              */
+   /*    Purpose:  This function is called to process ARM abort prefetch exception */ 
+   /*              and to store this exception in the RAM buffer                   */
+   /*                                                                              */
+   /*    Input Parameters:                                                         */
+   /*         None                                                                 */
+   /*                                                                              */
+   /*    Output Parameters:                                                        */
+   /*         Validation of the diagnose execution.                                */
+   /*                                                                              */
+   /*                                                                              */
+   /*                                                                              */
+   /*    Revision History:                                                         */
+   /*        None.                                                                 */
+   /*                                                                              */
+   /********************************************************************************/
+   void dar_exception_arm_abort_prefetch(void)
+   {
+      #ifndef _WINDOWS
+         /* Local variable */
+         UINT8 i;
+      #endif
+
+   	  #if ((CHIPSET == 7) || (CHIPSET == 8) || (CHIPSET == 10) || (CHIPSET == 11) || (CHIPSET == 12))
+	      /* Debug unit pointer */
+	      volatile UINT32 *debug_register_p;
+	  #endif
+
+      /* Declare local variables */
+      T_DAR_INFO *buffer_p = " DAR Emergency exception : ARM abort prefetch";/*exception data to store*/
+      
+      /* Update the DAR recovery status */
+      dar_current_status   = DAR_EMERGENCY_SCUTTLING;
+
+      /* Update the DAR exception status */
+      dar_exception_status = DAR_EXCEPTION_PREFETCH_ABORT;
+
+      /* Empty the mail box and store data in RAM buffer */
+      dar_empty_mb_and_save_data(buffer_p);
+
+      /* Check if the DAR entity is started */
+      if (dar_gbl_var_p != NULL )
+      {
+         if (dar_gbl_var_p->entity_dar_callback != NULL)
+         {
+            /* Call the MMI callback function to save some parameters before reset */
+            dar_gbl_var_p->entity_dar_callback(dar_recovery_buffer,DAR_RECOVERY_DATA_MAX_BUFFER_SIZE);
+         }
+      }
+
+   	  #if ((CHIPSET == 7) || (CHIPSET == 8) || (CHIPSET == 10) || (CHIPSET == 11) || (CHIPSET == 12))
+	      /* Initialize the adress of the Debug Unit pointer */
+		  debug_register_p = (volatile UINT32*) DAR_DEBUG_UNIT_REGISTER;
+	  #endif    
+
+      #ifndef _WINDOWS
+     	  #if ((CHIPSET == 7) || (CHIPSET == 8) || (CHIPSET == 10) || (CHIPSET == 11) || (CHIPSET == 12))
+	         /* Save the Debug Unit into the RAM */
+		     for (i=0; i<DEBUG_UNIT_WORD_SIZE; i++ )
+	         {
+		        debug_RAM[i] = *debug_register_p;
+			    debug_register_p++;
+			 }
+		  #endif
+
+         /* branch to "exception" defined in the int.s*/
+         exception();    
+      #endif
+      
+   } /* dar_exception_arm_abort_prefetch */
+
+   /********************************************************************************/
+   /*                                                                              */
+   /*    Function Name:   dar_exception_arm_abort_data                             */
+   /*                                                                              */
+   /*    Purpose:  This function is called to process ARM abort data exception     */ 
+   /*              and to store this exception in the RAM buffer                   */
+   /*                                                                              */
+   /*    Input Parameters:                                                         */
+   /*         None                                                                 */
+   /*                                                                              */
+   /*    Output Parameters:                                                        */
+   /*         Validation of the diagnose execution.                                */
+   /*                                                                              */
+   /*                                                                              */
+   /*                                                                              */
+   /*    Revision History:                                                         */
+   /*        None.                                                                 */
+   /*                                                                              */
+   /********************************************************************************/
+   void dar_exception_arm_abort_data(void)
+   {
+      #ifndef _WINDOWS
+         /* Local variable */
+         UINT8 i;
+      #endif
+
+   	  #if ((CHIPSET == 7) || (CHIPSET == 8) || (CHIPSET == 10) || (CHIPSET == 11) || (CHIPSET == 12))
+	      /* Debug unit pointer */
+	      volatile UINT32 *debug_register_p;
+	  #endif
+
+      /* Declare local variables */
+      T_DAR_INFO *buffer_p= " DAR Emergency exception : ARM abort data";/*exception data to store*/
+
+      /* Update the DAR recovery status */
+      dar_current_status = DAR_EMERGENCY_SCUTTLING;
+
+      /* Update the DAR exception status */
+      dar_exception_status = DAR_EXCEPTION_DATA_ABORT;
+
+      /* Empty the mail box and store data in RAM buffer */
+      dar_empty_mb_and_save_data(buffer_p);
+
+      /* Check if the DAR entity is started */
+      if (dar_gbl_var_p != NULL )
+      {
+         if (dar_gbl_var_p->entity_dar_callback != NULL)
+         {
+
+            /* Call the MMI callback function to save some parameters before reset */
+            dar_gbl_var_p->entity_dar_callback(dar_recovery_buffer,DAR_RECOVERY_DATA_MAX_BUFFER_SIZE);
+         }
+      }
+
+	  #if ((CHIPSET == 7) || (CHIPSET == 8) || (CHIPSET == 10) || (CHIPSET == 11) || (CHIPSET == 12))
+		/* Initialize the adress of the Debug Unit pointer */
+		debug_register_p = (volatile UINT32*) DAR_DEBUG_UNIT_REGISTER;
+	  #endif
+
+      #ifndef _WINDOWS
+		 #if ((CHIPSET == 7) || (CHIPSET == 8) || (CHIPSET == 10) || (CHIPSET == 11) || (CHIPSET == 12))
+			/* Save the Debug Unit into the RAM */
+			for (i=0; i<DEBUG_UNIT_WORD_SIZE; i++ )
+			{
+				debug_RAM[i] = *debug_register_p;
+				debug_register_p++;
+			}
+		 #endif
+		
+		 /* branch to "exception" defined in the int.s*/
+         exception();    
+      #endif
+     
+   } /* dar_exception_arm_abort_data */
+
+   /********************************************************************************/
+   /*                                                                              */
+   /*    Function Name:   dar_exception_arm_reserved                               */
+   /*                                                                              */
+   /*    Purpose:  This function is called to process ARM exception                */ 
+   /*              and to store this exception in the RAM buffer                   */
+   /*                                                                              */
+   /*    Input Parameters:                                                         */
+   /*         None                                                                 */
+   /*                                                                              */
+   /*    Output Parameters:                                                        */
+   /*         Validation of the diagnose execution.                                */
+   /*                                                                              */
+   /*                                                                              */
+   /*                                                                              */
+   /*    Revision History:                                                         */
+   /*        None.                                                                 */
+   /*                                                                              */
+   /********************************************************************************/
+   void dar_exception_arm_reserved(void)
+   {
+      /* Declare local variables */
+      T_DAR_INFO *buffer_p= " DAR Emergency exception : ARM reserved";/*exception data to store*/
+
+      /* Update the DAR recovery status */
+      dar_current_status = DAR_EMERGENCY_SCUTTLING;
+
+      /* Update the DAR exception status */
+      dar_exception_status = DAR_EXCEPTION_RESERVED;
+   
+      /* Empty the mail box and store data in RAM buffer */
+      dar_empty_mb_and_save_data(buffer_p);
+
+      /* Check if the DAR entity is started */
+      if (dar_gbl_var_p != NULL )
+      {
+         if (dar_gbl_var_p->entity_dar_callback != NULL)
+         {
+            /* Call the MMI callback function to save some parameters before reset */
+            dar_gbl_var_p->entity_dar_callback(dar_recovery_buffer,DAR_RECOVERY_DATA_MAX_BUFFER_SIZE);
+         }
+      }
+
+      #ifndef _WINDOWS
+         /* branch to "exception" defined in the int.s*/
+         exception();    
+      #endif
+
+   } /* dar_exception_arm_reserved */
+
+  /********************************************************************************/
+  /*                                                                              */
+  /*    Function Name:   dar_exception                                            */
+  /*                                                                              */
+  /*    Purpose:  This function is called to vector exceptions to the correct     */
+  /*              handler                                                         */
+  /*                                                                              */
+  /*    Input Parameters:                                                         */
+  /*         abort type  which come from int.s ( -> magic number)                 */
+  /*                                                                              */
+  /*    Output Parameters:                                                        */
+  /*         Validation of the diagnose execution.                                */
+  /*                                                                              */
+  /*                                                                              */
+  /*                                                                              */
+  /*    Revision History:                                                         */
+  /*        None.                                                                 */
+  /*                                                                              */
+  /********************************************************************************/
+  void dar_exception(int abort_type)
+  {
+      switch (abort_type)
+      {
+         /* magic numbers come from int.s  There is no way to make compiler derived 
+          * constants out of them  
+          */
+         case 1:
+         dar_exception_arm_undefined();
+         break;
+         case 2:
+         dar_exception_arm_swi();
+         break;
+         case 3:
+         dar_exception_arm_abort_prefetch();
+         break;
+         case 4:
+         dar_exception_arm_abort_data();
+         break;
+         case 5:
+         dar_exception_arm_reserved();
+         break;
+      }
+  } /* dar_exception */
+
+#else
+   /* ************************************************ */
+   /*            THE DAR ENTITY IS DISABLED            */
+   /* ************************************************ */
+
+   void dar_exception(int abort_type)
+   {
+      #ifndef _WINDOWS
+         /* branch to "exception" defined in the int.s*/
+         exception();   
+      #endif
+   } /* dar_exception */
+
+#endif /* #ifdef RVM_DAR_SWE */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gsm-fw/services/dar/dar_emergency.h	Sun Mar 16 05:48:58 2014 +0000
@@ -0,0 +1,43 @@
+/****************************************************************************/
+/*                                                                          */
+/*  File Name:  dar_emergency.h                                             */
+/*                                                                          */
+/*  Purpose:   This function contains the functions prototypes of the DAR   */ 
+/*             entity when emergencies occured.                             */
+/*                                                                          */
+/*  Version   0.1                                                           */
+/*                                                                          */
+/*  Date                 Modification                                       */
+/*  ------------------------------------                                    */
+/*  17 October 2001    Create                                               */
+/*                                                                          */
+/*  Author     Stephanie Gerthoux                                           */
+/*                                                                          */
+/* (C) Copyright 2001 by Texas Instruments Incorporated, All Rights Reserved*/
+/****************************************************************************/
+
+#ifndef __DAR_EMERGENCY_H_
+#define __DAR_EMERGENCY_H_
+
+  #include "rv/rv_defined_swe.h"
+
+  #ifdef RVM_DAR_SWE
+
+    #include "rvm/rvm_gen.h"
+
+    /* Functions prototypes */
+    T_RV_RET dar_process_emergency( T_DAR_INFO    *buffer_p,
+                                    T_DAR_FORMAT  format,
+                                    T_RVM_USE_ID  dar_use_id,
+                                    UINT32 flags);
+    void dar_exception_arm_undefined(void);
+    void dar_exception_arm_swi(void);
+    void dar_exception_arm_abort_prefetch(void);
+    void dar_exception_arm_abort_data(void);
+    void dar_exception_arm_reserved(void);
+
+  #endif /* #ifdef RVM_DAR_SWE */
+
+  void dar_exception(int abort_type);
+
+#endif /* __DAR_EMERGENCY_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gsm-fw/services/dar/dar_env.c	Sun Mar 16 05:48:58 2014 +0000
@@ -0,0 +1,282 @@
+/****************************************************************************/
+/*                                                                          */
+/*  File Name:  dar_env.c                                                   */
+/*                                                                          */
+/*  Purpose:  This file contains routines that will be called in order to:  */
+/*            - notify the Environment of the diagnose's Memory Banks       */
+/*              requirements,                                               */
+/*            - set diagnose's addr and memory banks IDs                    */
+/*            - initialize all the diagnose's data structures,              */
+/*            - start the diagnose's task                                   */
+/*            - stop the diagnose's task                                    */
+/*            - kill the diagnose's task                                    */
+/*                                                                          */
+/*  Version   0.1                                                           */
+/*                                                                          */
+/*  Date                 Modification                                       */
+/*  ------------------------------------                                    */
+/*  26 September 2001    Create                                             */
+/*                                                                          */
+/*  Author     Stephanie Gerthoux                                           */
+/*                                                                          */
+/* (C) Copyright 2001 by Texas Instruments Incorporated, All Rights Reserved*/
+/****************************************************************************/
+
+#include "rv/rv_defined_swe.h"
+#ifdef RVM_DAR_SWE
+   #include "rv/rv_general.h"
+   #include "rvm/rvm_gen.h"
+   #include "rvm/rvm_priorities.h"
+   #include "rvm/rvm_use_id_list.h"
+   #include "dar/dar_api.h"
+   #include "dar/dar_env.h"
+   #include "dar/dar_macro_i.h"
+
+   #include <string.h>
+
+   extern T_RV_RET dar_core(void);
+
+   /**** Initialisation of the pointer to the Global Environment Control block ****/
+   T_DAR_ENV_CTRL_BLK *dar_gbl_var_p = NULL;
+
+   /**** Define extern variables ****/
+   /* Get the last status of the system */
+   extern T_DAR_RECOVERY_STATUS dar_current_status;
+  
+   /* Get the last exception of the system */
+   extern UINT8 dar_exception_status;
+
+   /* Define the recovery buffer */
+   extern UINT32 dar_recovery_buffer;
+
+   /* DAR previous status */
+   extern T_DAR_RECOVERY_STATUS  dar_previous_status;
+
+   /* DAR previous status */
+   extern UINT8  dar_previous_exception;
+
+   /********************************************************************************/
+   /* Function   : dar_get_info                                                    */
+   /*                                                                              */
+   /* Description : This function is called by the RV Environment to learn         */
+   /*               diagnose requirements in terms of memory, SWEs...              */
+   /*                                                                              */
+   /* Parameters  : T_RVM_INFO_SWE  * swe_info: pointer to the structure to fill   */
+   /*               containing infos related to the diagnose SWE.                  */
+   /*                                                                              */
+   /* Return      :  T_RV_RETURN                                                   */
+   /*                                                                              */
+   /* History      : 0.1 (26-September-2001)                                       */
+   /*                                                                              */
+   /*                                                                              */
+   /********************************************************************************/
+   T_RVM_RETURN dar_get_info(T_RVM_INFO_SWE  *infoSWEnt)
+   {
+      /* SWE info */
+      infoSWEnt->swe_type = RVM_SWE_TYPE_4;
+      infoSWEnt->type_info.type4.swe_use_id = DAR_USE_ID;
+
+      memcpy( infoSWEnt->type_info.type4.swe_name, "DAR", sizeof("DAR") );
+
+      infoSWEnt->type_info.type4.stack_size = DAR_STACK_SIZE;
+      infoSWEnt->type_info.type4.priority   = RVM_DAR_TASK_PRIORITY;
+
+
+      /* Set the return path */
+      infoSWEnt->type_info.type4.return_path.callback_func	= NULL;
+      infoSWEnt->type_info.type4.return_path.addr_id	      = 0;
+
+  
+      /* memory bank info */
+      infoSWEnt->type_info.type4.nb_mem_bank = 0x01;
+ 
+      /* Memory bank used to receive/send the message to/from the entity */
+      memcpy ((UINT8 *) 	infoSWEnt->type_info.type4.mem_bank[0].bank_name, "DAR_MB", sizeof("DAR_MB"));
+      infoSWEnt->type_info.type4.mem_bank[0].initial_params.size          = DAR_MB_SIZE;
+      infoSWEnt->type_info.type4.mem_bank[0].initial_params.watermark     = DAR_MB_WATERMARK;
+
+      /* linked SWE info */ 
+      /* this SWE requires the FFS SWE to run */
+      
+      infoSWEnt->type_info.type4.nb_linked_swe   = 0x01;
+      infoSWEnt->type_info.type4.linked_swe_id[0]= FFS_USE_ID;
+
+      /* generic functions */
+      infoSWEnt->type_info.type4.set_info = dar_set_info;
+      infoSWEnt->type_info.type4.init     = dar_init;
+      infoSWEnt->type_info.type4.core     = dar_core;
+      infoSWEnt->type_info.type4.stop     = dar_stop;
+      infoSWEnt->type_info.type4.kill     = dar_kill;
+
+      return RVM_OK;
+   }
+
+   /**************** End of dar_get_info function ********************************/
+
+   /********************************************************************************/
+   /* Function   : dar_set_info                                                    */
+   /*                                                                              */
+   /* Description : This function is called by the RV Environment to inform        */
+   /*               the diagnose SWE about addr_id, mb_id and error function.      */
+   /*                                                                              */
+   /* Parameters  : - T_RVF_ADDR_ID  addrId: address Id                            */
+   /*               - T_RVF_MB_ID mb_id[]: array of memory bank ids.               */
+   /*               - callback function to call in case of unrecoverable error.    */
+   /*                                                                              */
+   /* Return      : T_RVM_RETURN                                                   */
+   /*                                                                              */
+   /* History    : 0.1 (27-September-2001 )                                        */
+   /*                                                                              */
+   /*                                                                              */
+   /********************************************************************************/
+   T_RVM_RETURN dar_set_info(T_RVF_ADDR_ID addrId,
+                             T_RV_RETURN   return_path[],
+                             T_RVF_MB_ID   mbId[],
+                             T_RVM_RETURN  (*callBackFctError) ( T_RVM_NAME SWEntName,
+                                                                 T_RVM_RETURN errorCause,
+                                                                 T_RVM_ERROR_TYPE errorType,
+                                                                 T_RVM_STRING errorMsg) )
+   {
+
+      /* Declare local variable.*/
+      T_RVF_MB_STATUS mb_status = RVF_GREEN;
+
+      /* Allocate memory required to store the Global Environment control Block. */
+      mb_status = rvf_get_buf(mbId[0], 
+                              sizeof(T_DAR_ENV_CTRL_BLK), 
+                              (T_RVF_BUFFER **) & dar_gbl_var_p);
+
+      /* If insufficient resources to properly run the DAR's task, then abort.   */
+      switch (mb_status)
+      {
+         case RVF_GREEN:
+         {
+            /* Initialize the Global Environment Control Block */
+            memset((UINT8 *) dar_gbl_var_p,
+                   0x00,
+                   sizeof (T_DAR_ENV_CTRL_BLK));
+
+            /* Store the memory bank IDs assigned to the DAR */
+            dar_gbl_var_p->mb_dar = mbId[0];
+
+            /* Store the addr ID assigned to the DAR */
+            dar_gbl_var_p->addrId = addrId;
+
+            /* Store the function to be called whenever any unrecoverable */
+            /* error occurs.                                              */
+            dar_gbl_var_p->callBackFctError = callBackFctError; 
+            DAR_SEND_TRACE(" Diagnose And Recovery (env). DAR's information set ",
+                           RV_TRACE_LEVEL_DEBUG_LOW);
+            break;
+         }
+         case RVF_YELLOW:
+         {
+            rvf_free_buf((T_RVF_BUFFER *) dar_gbl_var_p);
+            DAR_TRACE_WARNING(" DAR memory warning (orange memory)");
+            return (RV_MEMORY_ERR);
+         }
+         default:
+         {
+            DAR_TRACE_WARNING(" DAR memory warning (red memory)");
+            return (RV_MEMORY_ERR);
+         }
+      } /* switch (mb_status) */
+
+      return (RV_OK);
+   } /*************** End of dar_set_info function ********************************/
+
+
+
+   /********************************************************************************/
+   /* Function   : dar_init                                                        */
+   /*                                                                              */
+   /* Description : This function is called by the RV Environment to initialize the*/ 
+   /*               diagnose SWE before creating the task and calling dar_start.   */
+   /*                                                                              */
+   /* Parameters  : None                                                           */
+   /*                                                                              */
+   /* Return      : T_RVM_RETURN                                                   */
+   /*                                                                              */
+   /* History    : 0.1 (27-September-2001)                                         */
+   /*                                                                              */
+   /*                                                                              */
+   /********************************************************************************/
+   T_RVM_RETURN dar_init(void)
+   {
+      /*** Declare local variables ***/
+      UINT16 i = 0;    
+    
+      /*** Initialization of the DAR global structure ***/
+
+      /* Initialization of the dar_filter_array */ 
+      for (i=0;i<DAR_MAX_GROUP_NB;i++)
+      {
+         dar_gbl_var_p ->dar_filter_array[i].group_nb     = DAR_INITIALIZATION_VALUE;
+         dar_gbl_var_p ->dar_filter_array[i].mask_warning = DAR_INITIALIZATION_VALUE;
+         dar_gbl_var_p ->dar_filter_array[i].mask_debug   = DAR_INITIALIZATION_VALUE;
+      }
+
+      /*Initialization of the index and the free index */
+      dar_gbl_var_p ->index       = DAR_INVALID_VALUE;
+      dar_gbl_var_p ->free_index  = DAR_INVALID_VALUE;
+
+      /*** Value of the DAR recovery status ***/
+      dar_previous_status = dar_current_status;           
+
+      /* erase the dar_current_status value */
+      dar_current_status = DAR_POWER_ON_OFF;          
+
+      /*** Value of the DAR exception status ***/
+      dar_previous_exception = dar_exception_status;           
+
+      /* erase the dar_exception_status value */
+      dar_exception_status = DAR_NO_ABORT_EXCEPTION;          
+
+      return RV_OK;
+   }
+
+
+   /*************************************************************************************/
+   /* Function    : dar_stop                                                            */
+   /*                                                                                   */
+   /* Description : This function is called by the RV Environment to stop the diagnose  */
+   /*               SWE.                                                                */
+   /*                                                                                   */
+   /* Parameters  : None                                                                */
+   /*                                                                                   */
+   /* Return      : T_RVM_RETURN                                                        */
+   /*                                                                                   */
+   /* History     : 0.1 (27-September-2001)                                             */
+   /*                                                                                   */
+   /*                                                                                   */
+   /*************************************************************************************/
+   T_RVM_RETURN dar_stop(void)
+   {
+      /* other SWEs have not been killed yet, DAR can send messages to other SWEs        */
+
+      return RV_OK;
+   }
+
+
+   /*************************************************************************************/
+   /* Function   :  dar_kill                                                            */
+   /*                                                                                   */
+   /* Description : This function is called by the RV Environment to kill the diagnose  */
+   /*               SWE, after the diagnose_stop function has been called.              */
+   /*                                                                                   */
+   /* Parameters  : None                                                                */
+   /*                                                                                   */
+   /* Return      : T_RVM_RETURN                                                        */
+   /*                                                                                   */
+   /* History     : 0.1 (27-September-2001)                                             */
+   /*                                                                                   */
+   /*                                                                                   */
+   /*************************************************************************************/
+   T_RVM_RETURN dar_kill (void)
+   {
+      /* free all memory buffer previously allocated */
+      rvf_free_buf ((T_RVF_BUFFER *) dar_gbl_var_p);
+      return RV_OK;
+   }
+
+#endif /* #ifdef RVM_DAR_SWE */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gsm-fw/services/dar/dar_env.h	Sun Mar 16 05:48:58 2014 +0000
@@ -0,0 +1,59 @@
+/****************************************************************************/
+/*                                                                          */
+/*  File Name:  dar_env.h                                                   */
+/*                                                                          */
+/*  Purpose:  This file contains prototypes for Riviera Environment related */
+/*            functions used to get info, start and stop the diagnose block.*/
+/*                                                                          */
+/*  Version   0.1                                                           */
+/*                                                                          */
+/*  Date               Modification                                         */
+/*  ------------------------------------                                    */
+/*  26 september 2001  Create                                               */
+/*                                                                          */
+/*  Author    Stephanie Gerthoux                                            */
+/*                                                                          */
+/* (C) Copyright 2001 by Texas Instruments Incorporated, All Rights Reserved*/
+/****************************************************************************/
+
+#include "rv/rv_defined_swe.h"
+#ifdef RVM_DAR_SWE
+   #include "dar/dar_structs_i.h"
+
+   #include "dar/dar_pool_size.h"	/* Stack & Memory Bank sizes definitions */
+
+
+   #ifndef __DAR_ENV_H_
+      #define __DAR_ENV_H_
+
+      /* memory bank size and watermark */
+      #define DAR_MB_SIZE            DAR_MB1_SIZE
+      #define DAR_MB_WATERMARK       DAR_MB_SIZE
+
+      /* definition of RVT state*/
+      typedef INT8 T_DAR_STATE;
+
+      /* possible values */
+      #define DAR_STARTED            (0)
+      #define DAR_NOT_STARTED        (-1)
+
+      /* generic functions declarations */
+      T_RVM_RETURN dar_get_info (T_RVM_INFO_SWE   *infoSWEnt);
+
+      T_RVM_RETURN dar_set_info(T_RVF_ADDR_ID addrId,
+                                T_RV_RETURN    return_path[],
+                                T_RVF_MB_ID    mbId[],
+                                T_RVM_RETURN  (*callBackFctError) ( T_RVM_NAME SWEntName,
+                                                                    T_RVM_RETURN errorCause,
+                                                                    T_RVM_ERROR_TYPE errorType,
+                                                                    T_RVM_STRING errorMsg) );
+
+      T_RVM_RETURN dar_init (void);
+
+      T_RVM_RETURN dar_stop (void);
+
+      T_RVM_RETURN dar_kill (void);
+
+   #endif /*__DAR_ENV_H_*/
+
+#endif /* #ifdef RVM_DAR_SWE */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gsm-fw/services/dar/dar_error_hdlr.c	Sun Mar 16 05:48:58 2014 +0000
@@ -0,0 +1,146 @@
+/****************************************************************************/
+/*                                                                          */
+/*  File Name:  dar_error_hdlr.c                                            */
+/*                                                                          */
+/*  Purpose:  This file contains routines used to report unrecoverable      */
+/*                 memory errors that might occur.                          */
+/*                                                                          */
+/*  Version   0.1                                                           */
+/*                                                                          */
+/*  Date               Modification                                         */
+/*  ------------------------------------------------------------------------*/
+/*  27 September 2001  Create                                               */
+/*                                                                          */
+/*  Author:  Stephanie Gerthoux                                             */
+/*                                                                          */
+/* (C) Copyright 2001 by Texas Instruments Incorporated, All Rights Reserved*/
+/****************************************************************************/
+
+#include "rv/rv_defined_swe.h"
+#ifdef RVM_DAR_SWE
+
+   #include "rv/rv_general.h"
+   #include "rvf/rvf_api.h"
+   #include "dar/dar_error_hdlr_i.h"
+   #include "dar/dar_macro_i.h"
+
+   /********************************************************************************/
+   /*                                                                              */
+   /*    Function Name:   dar_error_trace                                          */
+   /*                                                                              */
+   /*    Purpose:         This function is used to report error occured during the */
+   /*                     diagnose entity execution                                */
+   /*                                                                              */
+   /*    Input Parameters:                                                         */
+   /*        status       - Contains the error code to be reported.                */
+   /*                                                                              */
+   /*    Output Parameters:                                                        */
+   /*        None.                                                                 */
+   /*                                                                              */
+   /*    Global Parameters:                                                        */
+   /*        None.                                                                 */
+   /*                                                                              */
+   /*    Note:                                                                     */
+   /*        None.                                                                 */
+   /*                                                                              */
+   /*    Revision History:                                                         */
+   /*       27 September 01           Create                                       */
+   /*                                                                              */
+   /********************************************************************************/
+   void dar_error_trace(UINT8 error_id)
+   {
+      switch(error_id)
+      {
+         case DAR_ENTITY_NOT_START:
+         {
+            DAR_SEND_TRACE("DAR entity not started.",RV_TRACE_LEVEL_ERROR);
+            break;
+         }
+
+         case DAR_ENTITY_NO_MEMORY:
+         {
+            DAR_SEND_TRACE("DAR entity has not enough memory",RV_TRACE_LEVEL_ERROR);
+            break;
+         }
+
+         case DAR_ENTITY_BAD_PARAMETER:
+         {
+            DAR_SEND_TRACE("DAR entity has bad parameters",RV_TRACE_LEVEL_ERROR);
+            break;
+         }
+
+         case DAR_ERROR_STOP_EVENT:
+         {
+            DAR_SEND_TRACE("DAR entity has received a stop error event",RV_TRACE_LEVEL_ERROR);
+            break;
+         }
+
+         case DAR_ERROR_START_EVENT:
+         {
+             DAR_SEND_TRACE("DAR entity has received a start error event",RV_TRACE_LEVEL_ERROR);
+             break;
+         }
+
+         case DAR_ENTITY_BAD_MESSAGE:
+         {
+            DAR_SEND_TRACE("DAR entity has received a bad message",RV_TRACE_LEVEL_ERROR);
+            break;
+         }  
+      }
+   }
+   /************************* End of dar_error_trace function **********************/
+
+   /********************************************************************************/
+   /*                                                                              */
+   /*    Function Name:   dar_ffs_error_trace                                      */
+   /*                                                                              */
+   /*    Purpose:         This function is used to report error occured during the */
+   /*                     dar entity execution                                     */
+   /*                                                                              */
+   /*    Input Parameters:                                                         */
+   /*        status       - Contains the error code to be reported.                */
+   /*                                                                              */
+   /*    Output Parameters:                                                        */
+   /*        None.                                                                 */
+   /*                                                                              */
+   /*    Global Parameters:                                                        */
+   /*        None.                                                                 */
+   /*                                                                              */
+   /*    Note:                                                                     */
+   /*        None.                                                                 */
+   /*                                                                              */
+   /*    Revision History:                                                         */
+   /*       29 october 01           Create                                         */
+   /*                                                                              */
+   /********************************************************************************/
+   void dar_ffs_error_trace(UINT8 error_id)
+   {
+      switch(error_id)
+      {
+         case DAR_ENTITY_NO_MEMORY:
+         {
+            DAR_SEND_TRACE("DAR FFS entity has not enough memory",RV_TRACE_LEVEL_ERROR);
+            break;
+         }
+         case DAR_ENTITY_FILE_ERROR:
+         {
+            DAR_SEND_TRACE("DAR FFS entity has received a wrong file name or the flash is not formatted",RV_TRACE_LEVEL_ERROR);
+            break;
+         }
+
+         case DAR_ENTITY_FILE_NO_SAVED:
+         {
+            DAR_SEND_TRACE("DAR FFS entity has not saved the file",RV_TRACE_LEVEL_ERROR);
+            break;
+         }
+
+         case DAR_ENTITY_FILE_NO_CLOSE:
+         {
+            DAR_SEND_TRACE("DAR FFS entity has not closed the file",RV_TRACE_LEVEL_ERROR);
+            break;
+         }
+      } /* switch(error_id) */
+   } /* dar_ffs_error_trace */
+   /************************* End of dar_ffs_error_trace function **********************/
+
+#endif /* #ifdef RVM_DAR_SWE */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gsm-fw/services/dar/dar_error_hdlr_i.h	Sun Mar 16 05:48:58 2014 +0000
@@ -0,0 +1,39 @@
+/****************************************************************************/
+/*                                                                          */
+/*  File Name:  dar_error_hdlr_i.h                                          */
+/*                                                                          */
+/*  Purpose:  This file contains routines used to report unrecoverable      */
+/*            memory errors that might occur.                               */
+/*                                                                          */
+/*  Version   0.1                                                           */
+/*                                                                          */
+/*  Date               Modification                                         */
+/*  ----------------------------------------------------------------------  */
+/*  27 September 2001  Create                                               */
+/*                                                                          */
+/*  Author  Stephanie Gerthoux                                              */
+/*                                                                          */
+/* (C) Copyright 2001 by Texas Instruments Incorporated, All Rights Reserved*/
+/****************************************************************************/
+
+#include "rv/rv_defined_swe.h"
+#ifdef RVM_DAR_SWE
+   #ifndef   _DAR_ERROR_HDLR_I_H
+      #define   _DAR_ERROR_HDLR_I_H
+         
+      /* Id of the error trace */
+      #define DAR_ENTITY_NOT_START         (0)
+      #define DAR_ENTITY_NO_MEMORY         (1)
+      #define DAR_ERROR_STOP_EVENT         (2)
+      #define DAR_ERROR_START_EVENT        (3)
+      #define DAR_ENTITY_BAD_PARAMETER     (4)
+      #define DAR_ENTITY_BAD_MESSAGE       (5)
+      #define DAR_ENTITY_FILE_ERROR        (7)
+      #define DAR_ENTITY_FILE_NO_SAVED     (8)
+      #define DAR_ENTITY_FILE_NO_CLOSE     (9)
+
+      void dar_error_trace(UINT8 error_id);
+      void dar_ffs_error_trace(UINT8 error_id);
+
+   #endif
+#endif /* #ifdef RVM_DAR_SWE */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gsm-fw/services/dar/dar_gbl_var.c	Sun Mar 16 05:48:58 2014 +0000
@@ -0,0 +1,46 @@
+/****************************************************************************/
+/*                                                                          */
+/*  File Name:  dar_gbl_var.c                                               */
+/*                                                                          */
+/*  Purpose:    This function contains the global variables that are        */
+/*              not initialized in the .bss                                 */
+/*              ----------------------------                                */
+/*              These variables are stored in the .bss_dar section          */
+/*                                                                          */
+/*  Version   0.1                                                           */
+/*                                                                          */
+/*  Date                 Modification                                       */
+/*  ------------------------------------                                    */
+/*  29 October 2001    Create                                               */
+/*                                                                          */
+/*  Author     Stephanie Gerthoux                                           */
+/*                                                                          */
+/* (C) Copyright 2001 by Texas Instruments Incorporated, All Rights Reserved*/
+/****************************************************************************/
+
+#include "rv/rv_defined_swe.h"
+#ifdef RVM_DAR_SWE
+  
+   #include "rv/general.h"
+   #include "rv/rv_general.h"
+   #include "dar/dar_api.h"
+   #include "dar/dar_const_i.h"
+
+   /**** Global variables ****/
+   /* Buffer used to save some parameters before a reset */
+   UINT8    dar_recovery_buffer[DAR_RECOVERY_DATA_MAX_BUFFER_SIZE];
+  
+   /* dar_current_status : to get the status of the system*/
+   T_DAR_RECOVERY_STATUS dar_current_status;
+
+   /* dar_exception_status : to get the status of the exception */
+   UINT8    dar_exception_status;
+
+   /* Write buffer*/
+   char    dar_write_buffer[DAR_MAX_BUFFER_SIZE];
+
+   /* Ram buffer that contains the Debug Unit register */
+   UINT32  debug_RAM[DEBUG_UNIT_WORD_SIZE];
+
+#endif /* #ifdef RVM_DAR_SWE */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gsm-fw/services/dar/dar_gen.h	Sun Mar 16 05:48:58 2014 +0000
@@ -0,0 +1,44 @@
+/********************************************************************************/
+/*                                                                              */
+/*    File Name:   dar_gen.h                                                    */
+/*                                                                              */
+/*    Purpose:     This file contain general definitions of DAR Module.         */
+/*                                                                              */
+/*    Note:                                                                     */
+/*        None.                                                                 */
+/*                                                                              */
+/*    Revision History:                                                         */
+/*       9 October 2001      Stephanie Gerthoux        Create                   */
+/*                                                                              */
+/* (C) Copyright 2001 by Texas Instruments Incorporated, All Rights Reserved.   */
+/*                                                                              */
+/********************************************************************************/
+
+#ifndef __DAR_GEN_H__
+#define __DAR_GEN_H__
+
+   #include "rv/general.h"
+
+
+   /**** Type definitions ****/
+
+   /** Dar data format : ASCII or binary **/ 
+   typedef INT8 T_DAR_FORMAT;
+   /* possible values */
+   #define DAR_ASCII_FORMAT     (0)   /* ASCII format */
+   #define DAR_BINARY_FORMAT    (-1)  /* Binary format */
+
+   /** DAR data level ( Error / Warning / Debug) **/
+   typedef UINT8 T_DAR_LEVEL;
+
+   typedef UINT8* T_DAR_BUFFER;
+
+   typedef char T_DAR_INFO;
+
+   /** DAR callback function **/
+   typedef void (*DAR_CALLBACK_FUNC)(T_DAR_BUFFER, UINT16);
+
+   /** DAR Level Default definition **/
+   #define DAR_LEVEL_DEFAULT     (DAR_ERROR)
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gsm-fw/services/dar/dar_handle_message.c	Sun Mar 16 05:48:58 2014 +0000
@@ -0,0 +1,85 @@
+/****************************************************************************/
+/*                                                                          */
+/*  File Name:  dar_handle_message.c                                        */
+/*                                                                          */
+/*  Purpose:   This function is called when the DAR entity receives a new   */
+/*             message in its mailbox.                                      */
+/*                                                                          */
+/*                                                                          */
+/*  Version   0.1                                                           */
+/*                                                                          */
+/*  Date                 Modification                                       */
+/*  ------------------------------------                                    */
+/*  17 October 2001    Create                                               */
+/*                                                                          */
+/*  Author     Stephanie Gerthoux                                           */
+/*                                                                          */
+/* (C) Copyright 2001 by Texas Instruments Incorporated, All Rights Reserved*/
+/****************************************************************************/
+
+#include "rv/rv_defined_swe.h"
+#ifdef RVM_DAR_SWE
+
+   #include "rv/rv_general.h"
+   #include "rvm/rvm_gen.h"
+   #include "rvm/rvm_priorities.h"
+   #include "dar/dar_api.h"
+   #include "dar/dar_env.h"
+   #include "dar/dar_macro_i.h"
+   #include "dar/dar_messages_i.h"
+   #include "dar/dar_msg_ft.h"
+
+   /********************************************************************************/
+   /* Function         dar_handle_message                                          */
+   /*                                                                              */
+   /* Description      This function is called every time the DAR entity received  */
+   /*                  a new message in its mailbox                                */
+   /*                                                                              */
+   /********************************************************************************/
+
+   T_RV_RET dar_handle_msg(T_RV_HDR	*msg_p)
+   {
+      /* Declare local variables */
+      T_RV_RET status = RVF_GREEN;
+
+      if (msg_p != NULL)
+      {
+         switch (msg_p->msg_id)
+         {
+            case DAR_FILTER_REQ:
+            {
+               //DAR_SEND_TRACE_PARAM("DAR Diagnose with the msg", msg_p->msg_id, RV_TRACE_LEVEL_DEBUG_LOW);
+               /* process the dar filter */
+               dar_filter_request((T_DAR_FILTER_START *)msg_p);
+               break;
+            }
+
+            case DAR_WRITE_REQ:
+            {
+               //DAR_SEND_TRACE_PARAM("DAR Diagnose with the msg", msg_p->msg_id, RV_TRACE_LEVEL_DEBUG_LOW);
+               /* process the dar to write */
+               dar_write_data_in_buffer((T_DAR_WRITE_START *)msg_p);
+               break;
+            }
+      
+            default: 
+            {
+               /* Unknow message has been received */
+               DAR_TRACE_WARNING("A DAR unknow message has been received ");
+               break; 
+            };
+         } /* switch (msg_p->msg_id) */
+  
+         /* Free message buffer */
+         status = rvf_free_buf((T_RVF_BUFFER *)msg_p);
+         if (status != RVF_GREEN)
+         {
+            DAR_SEND_TRACE(" DAR ERROR (env). A wrong message is deallocated ",
+                            RV_TRACE_LEVEL_ERROR);
+         }
+      } /* if (msg_p != NULL) */
+  
+      return RV_OK;
+   }
+
+#endif /* #ifdef RVM_DAR_SWE */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gsm-fw/services/dar/dar_handle_message.h	Sun Mar 16 05:48:58 2014 +0000
@@ -0,0 +1,32 @@
+/****************************************************************************/
+/*                                                                          */
+/*  File Name:  dar_handle_message.h                                        */
+/*                                                                          */
+/*  Purpose:   This function contains the functions prototypes of the DAR   */ 
+/*             entity handle messages.                                      */
+/*                                                                          */
+/*  Version   0.1                                                           */
+/*                                                                          */
+/*  Date                 Modification                                       */
+/*  ------------------------------------                                    */
+/*  17 October 2001    Create                                               */
+/*                                                                          */
+/*  Author     Stephanie Gerthoux                                           */
+/*                                                                          */
+/* (C) Copyright 2001 by Texas Instruments Incorporated, All Rights Reserved*/
+/****************************************************************************/
+
+#include "rv/rv_defined_swe.h"
+#ifdef RVM_DAR_SWE
+
+   #ifndef __DAR_HANDLE_MESSAGE_H_
+   #define __DAR_HANDLE_MESSAGE_H_
+
+      #include "rvm/rvm_gen.h"
+
+      /* Handle message prototype */
+      T_RV_RET dar_handle_msg(T_RV_HDR	*msg_p);
+
+   #endif /* __DAR_HANDLE_MESSAGE_H_ */
+
+#endif /* #ifdef RVM_DAR_SWE */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gsm-fw/services/dar/dar_macro_i.h	Sun Mar 16 05:48:58 2014 +0000
@@ -0,0 +1,54 @@
+/********************************************************************************/
+/*                                                                              */
+/*    File Name:   dar_macro_i.h                                                */
+/*                                                                              */
+/*    Purpose:     This header contains the generic structures and constants    */
+/*                 that are used by the Diagnose And Recovery layer.            */
+/*                                                                              */
+/*    Note:                                                                     */
+/*        None.                                                                 */
+/*                                                                              */
+/*    Revision History:                                                         */
+/*       27 September 2001      Stephanie Gerthoux        Create                */
+/*                                                                              */
+/* (C) Copyright 2001 by Texas Instruments Incorporated, All Rights Reserved.   */
+/*                                                                              */
+/********************************************************************************/
+
+#include "rv/rv_defined_swe.h"
+#include "dar/dar_const_i.h"
+#include "rvm/rvm_use_id_list.h"
+
+#ifdef RVM_DAR_SWE
+   #ifndef _DAR_MACRO_I_H
+      #define _DAR_MACRO_I_H
+
+      #ifdef __cplusplus
+         extern "C"
+         {
+      #endif
+
+      /* DAR trace macros */
+      #define DAR_SEND_TRACE(string,type) rvf_send_trace (string,(sizeof(string)-1),NULL_PARAM,type,DAR_USE_ID)
+      #define DAR_SEND_TRACE_PARAM(string,param,type) rvf_send_trace (string,(sizeof(string)-1),(UINT32)param,type,DAR_USE_ID)
+      #define DAR_TRACE_WARNING(string) rvf_send_trace (string,(sizeof(string)-1),NULL_PARAM,RV_TRACE_LEVEL_WARNING,DAR_USE_ID)
+
+      /* Macro used to calculate the value of the index of the circular buffer */
+      /* When the end of the buffer is reached, the index = 0 */
+      #define DAR_PLUS_PLUS(dar_current_index) \
+         { \
+            dar_current_index++;\
+            if (dar_current_index == DAR_MAX_BUFFER_SIZE)\
+            {\
+               dar_current_index = 0;\
+            }\
+         } \
+
+
+      #ifdef __cplusplus
+         }
+      #endif
+
+   #endif
+
+#endif /* #ifdef RVM_DAR_SWE */
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gsm-fw/services/dar/dar_messages_i.h	Sun Mar 16 05:48:58 2014 +0000
@@ -0,0 +1,89 @@
+/****************************************************************************/
+/*                                                                          */
+/*  File Name:  dar_messages_i.h                                            */
+/*                                                                          */
+/*  Purpose:  Internal messages used by DAR instance                        */
+/*                                                                          */
+/*                                                                          */
+/*  Version   0.1                                                           */
+/*                                                                          */
+/*  Date              Modification                                          */
+/*  ------------------------------------                                    */
+/*  17 october 2001   Create                                                */
+/*                                                                          */
+/*  Author            Stephanie Gerthoux                                    */
+/*                                                                          */
+/*                                                                          */
+/* (C) Copyright 2001 by Texas Instruments Incorporated, All Rights Reserved*/
+/****************************************************************************/
+
+#include "rv/rv_defined_swe.h"
+#ifdef RVM_DAR_SWE
+   #ifndef __DAR_MESSAGES_I_H_
+      #define __DAR_MESSAGES_I_H_
+
+      #include "dar/dar_structs_i.h"
+
+      #ifdef __cplusplus
+         extern "C"
+         {
+      #endif
+
+      /******************************* Diagnose messages ************************************/
+      /* Diagnose filter and no filter messages */
+      #define DAR_FILTER_REQ                   (0x0001 | DAR_EVENT_INTERN | DAR_EVENTS_MASK)
+
+      /* Diagnose filter structure */
+      typedef struct          
+      {
+         T_RV_HDR              os_hdr;
+         T_DAR_MSG_PARAM       use_msg_parameter;
+         T_RV_RETURN           return_path;
+      } T_DAR_FILTER_START;
+
+      /* Diagnose write messages */
+      #define DAR_WRITE_REQ                    (0x0003 | DAR_EVENT_INTERN | DAR_EVENTS_MASK)
+
+      /* Diagnose write data structure */
+      typedef struct          
+      {
+         T_RV_HDR           os_hdr;
+         T_DAR_WRITE        data_write;
+         T_RV_RETURN        return_path;
+      } T_DAR_WRITE_START;
+  
+      /******************************* FFS interface ************************************/
+      /* FFS RAM to FLASH interface */
+      /* start message */
+      #define DAR_FFS_RAM_2_FLASH_START_REQ                 (0x0004 | DAR_EVENT_INTERN | DAR_EVENTS_MASK)
+      typedef struct
+      {
+         T_RV_HDR  os_hdr;
+         UINT16    initial_size;
+      } T_DAR_FFS_RAM_2_FLASH_START;
+
+      /* start confirmation message */
+      #define DAR_FFS_INIT_DONE                             (0x0005 | DAR_EVENT_INTERN | DAR_EVENTS_MASK)
+
+      typedef struct
+      {
+         T_RV_HDR  os_hdr;
+      } T_DAR_FFS_INIT;
+
+      /* stop message */
+      #define DAR_FFS_STOP_REQ                              (0x0006 | DAR_EVENT_INTERN | DAR_EVENTS_MASK)
+      typedef struct
+      {
+         T_RV_HDR  os_hdr;
+      } T_DAR_FFS_STOP;
+
+      /* stop confirmation message */
+      #define DAR_FFS_STOP_CON                              (0x0007 | DAR_EVENT_INTERN | DAR_EVENTS_MASK)
+  
+    #ifdef __cplusplus  
+    }
+    #endif
+
+  #endif /* __DAR_MESSAGES_I_ */
+
+#endif /* #ifdef RVM_DAR_SWE */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gsm-fw/services/dar/dar_msg_ft.c	Sun Mar 16 05:48:58 2014 +0000
@@ -0,0 +1,367 @@
+/****************************************************************************/
+/*                                                                          */
+/*  File Name:  dar_msg_ft.c                                                */
+/*                                                                          */
+/*  Purpose:   This function is called when the DAR entity receives a new   */
+/*             message in its mailbox and wants to process the message.     */
+/*                                                                          */
+/*                                                                          */
+/*  Version   0.1                                                           */
+/*                                                                          */
+/*  Date                 Modification                                       */
+/*  ------------------------------------                                    */
+/*  17 October 2001    Create                                               */
+/*                                                                          */
+/*  Author     Stephanie Gerthoux                                           */
+/*                                                                          */
+/* (C) Copyright 2001 by Texas Instruments Incorporated, All Rights Reserved*/
+/****************************************************************************/
+
+#include "rv/rv_defined_swe.h"
+#ifdef RVM_DAR_SWE
+   #ifndef _WINDOWS
+      #include "config/swconfig.cfg"
+      #include "config/sys.cfg"
+      #include "config/chipset.cfg"
+   #endif
+
+   #include <string.h>
+   #include "rvm/rvm_gen.h"
+   #include "dar/dar_api.h"
+   #include "dar/dar_macro_i.h"
+   #include "dar/dar_messages_i.h"
+   #include "dar/dar_const_i.h"
+   #include "dar/dar_diagnose_i.h"
+   #include "dar/dar_error_hdlr_i.h"
+   
+   #ifndef _WINDOWS
+      #include "timer/timer.h"
+   #endif
+
+   /**** Global variable ****/
+   /* index used in the circular buffer*/
+   UINT16 dar_current_index = 0;
+   /* Write buffer*/
+   extern char dar_write_buffer[DAR_MAX_BUFFER_SIZE];
+
+   /* Get the dar_current status */
+   extern T_DAR_RECOVERY_STATUS dar_current_status;
+
+   /* Define a pointer to the Global Environment Control block  */
+   extern T_DAR_ENV_CTRL_BLK *dar_gbl_var_p;
+
+   /* Define the recovery buffer */
+   extern UINT8 dar_recovery_buffer[DAR_RECOVERY_DATA_MAX_BUFFER_SIZE];
+
+   /**** Extern functions ****/
+   extern  void * dar_read_mbox (UINT8 mbox);
+
+   extern void exception(void);
+
+   /********************************************************************************/
+   /* Function         dar_filter_request                                          */
+   /*                                                                              */
+   /* Description      This function checks if the use_id group_nb exists:         */
+   /*                      - if the group_nb exists, it adds the warning and debug */
+   /*                        masks in the dar_array_filter                         */
+   /*                      - otherwise, this function add the new group_nb and the */
+   /*                        masks in the dar_array_filter                         */
+   /*                                                                              */
+   /********************************************************************************/
+
+   T_RV_RET dar_filter_request (T_DAR_FILTER_START *msg_p)
+   {
+      /* Declare local variables*/
+      UINT8 index = 0; 
+
+      /* check if the DAR entity is started */
+      if (dar_gbl_var_p == NULL )
+      {
+         dar_error_trace(DAR_ENTITY_NOT_START);
+         return(RV_NOT_READY);
+      }
+
+      /*** check if the group exists ****/
+      /* If the group exists... */
+      if(dar_search_group(msg_p->use_msg_parameter.group_nb,&index)== RV_OK)
+      {
+         /* Check the Dar level  */
+         switch(msg_p->use_msg_parameter.level) 
+         {
+            case DAR_WARNING:
+            {  /* The DAR entity wants to process Warning messages */
+               /* add the mask_warning in the dar_filter array */
+               dar_gbl_var_p ->dar_filter_array[index].mask_warning |= 
+                                                           msg_p->use_msg_parameter.mask;
+               dar_gbl_var_p ->dar_filter_array[index].mask_debug    = 0x00;
+
+            break;
+            }
+
+            case DAR_DEBUG:
+            {
+               /* The DAR entity wants to process Debug messages                   */
+               /* As the Warning messages are more important than debug messages,  */
+               /* it processes warning message too                                 */
+  
+               /* add the mask_debug in the dar_filter array */
+               dar_gbl_var_p ->dar_filter_array[index].mask_debug |= 
+                                                            msg_p->use_msg_parameter.mask;
+
+               /* add the mask_warning in the dar_filter array  */
+               dar_gbl_var_p ->dar_filter_array[index].mask_warning |= 
+                                                            msg_p->use_msg_parameter.mask;
+            break;
+            }
+          
+            case DAR_NO_DIAGNOSE:
+            {
+               /* The DAR entity doesn't want to process Diagnose messages         */
+  
+               /* delete the mask_debug in the dar_filter array */
+               dar_gbl_var_p ->dar_filter_array[index].mask_debug = 0x00;
+
+               /* delete the mask_warning in the dar_filter array  */
+               dar_gbl_var_p ->dar_filter_array[index].mask_warning = 0x00;
+               break;
+            }
+
+            default:
+            {
+               /* Unknow level has been received */
+               DAR_TRACE_WARNING("A DAR unknow level has been received ");
+               break; 
+            }
+         } /* switch(msg_p->use_msg_parameter.level) */
+      } /* if (search_group(msg_p->use_msg_parameter.group_nb,*index_gbl_p)== RV_OK) */
+
+      else
+      {
+         /* if the group doesn't exist and if there is enough space in the dar_filter_array */
+         if ( dar_add_group(&index)== RV_OK)
+         {
+            /* ... add the group in the dar_array_filter */
+            dar_gbl_var_p ->dar_filter_array[index].group_nb |= msg_p->use_msg_parameter.group_nb;
+            /* Check the Dar level  */
+            switch(msg_p->use_msg_parameter.level) 
+            {
+               case DAR_WARNING:
+               {   /* The DAR entity wants to process Warning messages */
+                   /* add the mask_warning in the dar_filter array */
+                  dar_gbl_var_p ->dar_filter_array[index].mask_warning |= 
+                                                           msg_p->use_msg_parameter.mask;
+                  break;
+               }
+
+               case DAR_DEBUG:
+               {
+                  /* The DAR entity wants to process Debug messages                   */
+                  /* As the Warning messages are more important than debug messages,  */
+                  /* it processes warning message too                                 */
+  
+                  /* add the mask_debug in the dar_filter array */
+                  dar_gbl_var_p ->dar_filter_array[index].mask_debug |= 
+                                                            msg_p->use_msg_parameter.mask;
+
+                  /* add the mask_warning in the dar_filter array  */
+                  dar_gbl_var_p ->dar_filter_array[index].mask_warning |= 
+                                                            msg_p->use_msg_parameter.mask;
+               break;
+               }
+
+               default:
+               {
+                  /* Unknow level has been received */
+                  DAR_TRACE_WARNING("A DAR unknow level has been received ");
+                  break; 
+                };
+            } /* switch */
+         }/* if ( add_group(msg_p->use_msg_parameter.group_nb,*index_gbl_p)== RV_OK)) */
+
+         else 
+         {
+            /* There is not enough space in the dar_array_filter */
+            DAR_TRACE_WARNING("Not enough space in the dar_array_filter for adding a new group ");
+         }
+      }
+      return(RV_OK);
+   }/* dar_filter_request   */
+
+
+   /********************************************************************************/
+   /*                                                                              */
+   /*    Function Name:   dar_write_data_in_buffer                                 */
+   /*                                                                              */
+   /*    Purpose:  This function is called to store diagnose data in RAM buffer    */
+   /*                                                                              */
+   /*              note: In order to separate the different string, the data are   */
+   /*              ----  stored  as follows:                                       */
+   /*                                                                              */
+   /*    Input Parameters:                                                         */
+   /*        Pointer to the message to store                                       */
+   /*        Data Format,                                                          */
+   /*        Data level,                                                           */
+   /*        Data Use Id,                                                          */
+   /*                                                                              */
+   /*    Output Parameters:                                                        */
+   /*         Validation of the diagnose execution.                                */
+   /*                                                                              */
+   /*                                                                              */
+   /*                                                                              */
+   /*    Revision History:                                                         */
+   /*        None.                                                                 */
+   /*                                                                              */
+   /********************************************************************************/
+   T_RV_RET dar_write_data_in_buffer( T_DAR_WRITE_START *msg_p)
+   {
+      /* Local variables */
+      UINT8   i = 0;
+      UINT8 length = 0;
+      
+      /* Diagnose string length */
+      length = (UINT16) strlen(msg_p->data_write.char_p);
+   
+      /***   Circular buffer to store data ***/
+      /* Add 0xFF to separate 2 strings */
+      dar_write_buffer[dar_current_index] = 0xF; 
+      DAR_PLUS_PLUS(dar_current_index); /* to detected if it is the end of the buffer */
+      dar_write_buffer[dar_current_index] = 0xF; 
+      DAR_PLUS_PLUS(dar_current_index); /* to detected if it is the end of the buffer */
+
+
+      /* The group_nb is 16 bit length, and the buffer is an UINT8 length */
+      /* So the group_nb must be stocked by dividing it in 2 parts */
+      dar_write_buffer[dar_current_index] = (msg_p->data_write.use_id.group_nb)>>8;
+                                         /*add the 8 first bits of the Use id group*/
+      DAR_PLUS_PLUS(dar_current_index);
+      dar_write_buffer[dar_current_index] = msg_p->data_write.use_id.group_nb;
+                                         /*add the 8 last bits of the Use id group*/
+      DAR_PLUS_PLUS(dar_current_index);
+      /* The mask is 16 bit length, and the buffer is an UINT8 length */
+      /* So the mask must be stocked by dividing it in 2 parts */
+      dar_write_buffer[dar_current_index] = (msg_p->data_write.use_id.mask)>>8;
+                                         /* add the 8 first bits of the Use id mask */
+      DAR_PLUS_PLUS(dar_current_index);
+      dar_write_buffer[dar_current_index] = msg_p->data_write.use_id.mask;
+                                         /* add the 8 last bits of the Use id mask */
+      DAR_PLUS_PLUS(dar_current_index);
+
+      /* Add the dar_level data */
+      dar_write_buffer[dar_current_index] = msg_p->data_write.level;
+      DAR_PLUS_PLUS(dar_current_index);
+
+      /* circular buffer to store diagnose data in RAM buffer */
+      for (i=0; i < length; i++ )
+      {
+         /* copy string in the RAM char by char*/
+         dar_write_buffer[dar_current_index]=msg_p->data_write.char_p[i];
+         
+         /* detection of the end of the buffer */
+         /* When current = DAR_MAX_BUFFER_SIZE , current = 0 */
+         DAR_PLUS_PLUS(dar_current_index);
+      }
+
+      /* DAR information is redirected to standard trace */
+      //DAR_SEND_TRACE("circular buffer : ",RV_TRACE_LEVEL_DEBUG_HIGH);
+      //rvf_send_trace(msg_p->data_write.char_p, length, NULL_PARAM, RV_TRACE_LEVEL_DEBUG_HIGH, DAR_USE_ID); 
+
+      return(RV_OK);
+
+   } /* dar_send_write_data */
+
+   /********************************************************************************/
+   /* Function         dar_empty_mb_and_save_data                                  */
+   /*                                                                              */
+   /* Description      This function is used to empty the mailbox and save data in */
+   /*                  the RAM buffer                                              */
+   /*                                                                              */
+   /*    Input Parameters:                                                         */
+   /*        Pointer to the message to store                                       */
+   /*                                                       											  */                                                      
+   /*    Output Parameters:                                                        */
+   /*        Validation of the function execution.								                  */
+   /*                                                                              */
+   /*    Note:                                                                     */
+   /*        None                                                                  */
+   /*                                                                              */
+   /********************************************************************************/                                                                               
+   T_RV_RET dar_empty_mb_and_save_data(  T_DAR_INFO *buffer_p)
+   {
+      /* Declare local variables */
+      UINT8       i        = 0;
+      UINT16      length   = 0;
+      T_RV_HDR    *msg_p   = ( T_RV_HDR*) dar_read_mbox(DAR_MBOX);
+
+      /**** Empty the mail box ****/
+      while(msg_p != NULL)
+      {
+         /* If it's a Write message, store it in the Ram */
+         /* ( it is not interesting to store filter message ) */
+         if ((msg_p->msg_id) == DAR_WRITE_REQ)
+         {
+            /* store themessage in the RAM*/
+            dar_write_data_in_buffer((T_DAR_WRITE_START *)msg_p);
+         }
+         /* free the Header of the message */
+         rvf_free_buf((T_RVF_BUFFER *) msg_p);
+
+         /* Read the next message */ 
+         msg_p = ( T_RV_HDR*) dar_read_mbox(DAR_MBOX);
+      } /* while (msg_p != NULL) */
+
+      /**** Store data in RAM buffer ****/            
+      /* Diagnose string length */
+      length = (UINT16) strlen(buffer_p);
+      
+      /**   Circular buffer to store data **/
+      /* Add 0xFF to separate 2 strings */
+      dar_write_buffer[dar_current_index] = 0xF; 
+      DAR_PLUS_PLUS(dar_current_index); /* to detected if it is the end of the buffer */
+      dar_write_buffer[dar_current_index] = 0xF; 
+      DAR_PLUS_PLUS(dar_current_index); /* to detected if it is the end of the buffer */
+
+      /* Add the dar_level data */
+      dar_write_buffer[dar_current_index] = DAR_EXCEPTION;
+      DAR_PLUS_PLUS(dar_current_index);
+      /* circular buffer to store diagnose data in RAM buffer */
+      for (i=0; i < length; i++ )
+      {
+         /* copy string in the RAM char by char*/
+         dar_write_buffer[dar_current_index]=buffer_p[i];
+         
+         /* detection of the end of the buffer */
+         /* When current = DAR_MAX_BUFFER_SIZE , current = 0 */
+         DAR_PLUS_PLUS(dar_current_index);
+      }
+
+      return(RV_OK);
+
+   }/* dar_empty_mb_and_save_data*/
+
+
+#endif /* #ifdef RVM_DAR_SWE */
+
+
+
+/********************************************************************************/
+/*                                                                              */
+/*              ------------------------------------------------                */
+/*             |       WARNING       -      IMPORTANT           |               */
+/*              ------------------------------------------------                */
+/*                                                                              */
+/*                                                                              */
+/*    Function Name:   dar_lib                                                  */
+/*                                                                              */
+/*    Purpose:  This function is only used in order to have a function in the   */ 
+/*               dar_lib when the DAR is NOT_COMPILED                           */
+/*                                                                              */
+/*    Input Parameters:                                                         */
+/*         None                                                                 */
+/*                                                                              */
+/*    Output Parameters:                                                        */
+/*         NONE                                                                 */
+/*                                                                              */
+/********************************************************************************/
+void dar_lib(void)
+{
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gsm-fw/services/dar/dar_msg_ft.h	Sun Mar 16 05:48:58 2014 +0000
@@ -0,0 +1,35 @@
+/****************************************************************************/
+/*                                                                          */
+/*  File Name:  dar_msg_ft.h                                                */
+/*                                                                          */
+/*  Purpose:   This function contains the functions prototypes of the DAR   */ 
+/*             entity messages functions.                                   */
+/*                                                                          */
+/*  Version   0.1                                                           */
+/*                                                                          */
+/*  Date                 Modification                                       */
+/*  ------------------------------------                                    */
+/*  17 October 2001    Create                                               */
+/*                                                                          */
+/*  Author     Stephanie Gerthoux                                           */
+/*                                                                          */
+/* (C) Copyright 2001 by Texas Instruments Incorporated, All Rights Reserved*/
+/****************************************************************************/
+
+#include "rv/rv_defined_swe.h"
+#ifdef RVM_DAR_SWE
+
+   #ifndef __DAR_MSG_FT_H_
+   #define __DAR_MSG_FT_H_
+
+   #include "rvm/rvm_gen.h"
+
+   /* Functions prototypes */
+   T_RV_RET dar_filter_request (T_DAR_FILTER_START *msg_p);
+   T_RV_RET dar_empty_mb_and_save_data(  T_DAR_INFO    *buffer_p);
+   T_RV_RET dar_write_data_in_buffer( T_DAR_WRITE_START *msg_p);
+
+
+   #endif /* __DAR_MSG_FT_H_ */
+
+#endif /* #ifdef RVM_DAR_SWE */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gsm-fw/services/dar/dar_pool_size.h	Sun Mar 16 05:48:58 2014 +0000
@@ -0,0 +1,33 @@
+/**
+ * @file	dar_pool_size.h
+ *
+ * Declarations of:
+ * - the memory bank sizes and their watermark
+ * - the SWE stack size
+ * - the pool size needed (generally the sum of memory bank and stack sizes)
+ *
+ * @author	Vincent Oberle
+ * @version 0.1
+ */
+
+/*
+ * History:
+ *
+ *	Date       	Author					Modification
+ *	-------------------------------------------------------------------
+ *	07/08/2003	Vincent Oberle			Extracted from rvf_pool_size.h
+ *
+ * (C) Copyright 2003 by Texas Instruments Incorporated, All Rights Reserved
+ */
+
+#ifndef __DAR_POOL_SIZE_H_
+#define __DAR_POOL_SIZE_H_
+
+
+#define DAR_STACK_SIZE (1024)
+#define DAR_MB1_SIZE   (512)
+
+#define DAR_POOL_SIZE  (DAR_STACK_SIZE + DAR_MB1_SIZE)
+
+
+#endif /*__DAR_POOL_SIZE_H_*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gsm-fw/services/dar/dar_structs_i.h	Sun Mar 16 05:48:58 2014 +0000
@@ -0,0 +1,108 @@
+/********************************************************************************/
+/*                                                                              */
+/*    File Name:   dar_structs_i.h                                              */
+/*                                                                              */
+/*    Purpose:     This file contains constants, data type, and data            */
+/*                 structures that are used by the diagnose's task.             */
+/*                                                                              */
+/*    Note:                                                                     */
+/*        None.                                                                 */
+/*                                                                              */
+/*    Revision History:                                                         */
+/*      26 september 01     Stephanie Gerthoux        Create                    */
+/*                                                                              */
+/* (C) Copyright 2001 by Texas Instruments Incorporated, All Rights Reserved.   */
+/*                                                                              */
+/********************************************************************************/
+#include "rv/rv_defined_swe.h"
+#ifdef RVM_DAR_SWE
+   #ifndef  _DAR_STRUCTS_I_
+      #define  _DAR_STRUCTS_I_
+
+      #include "rvm/rvm_gen.h"
+      #include "dar/dar_gen.h"
+      #include "dar/dar_const_i.h"
+
+      #ifdef __cplusplus
+         extern "C"
+            {
+      #endif
+
+      /* *****************    DAR internal structures ********************************/
+      
+      /* Diagnose Use parameter with masks for warning and debug messages */
+      typedef struct
+      { 
+         UINT16 group_nb;
+         UINT16 mask_warning;
+         UINT16 mask_debug;
+      }T_DAR_FILTER_PARAMETER;
+
+      /* Diagnose Use Messages parameter (used to send messages in DAR mailbox) */
+      typedef struct
+      { 
+         UINT16 group_nb;
+         UINT16 mask;
+         UINT8   level;
+      }T_DAR_MSG_PARAM;
+
+      /* Diagnose write data messages paremeters*/
+      typedef struct
+      {
+         T_DAR_INFO      *char_p;
+         T_DAR_FORMAT   data_format;
+         T_DAR_LEVEL    level;
+         T_DAR_USE_ID   use_id;
+      }T_DAR_WRITE;
+
+
+      /****************************** DAR'S ENVIRONMENT ****************************   */
+      /* Define a structure used to store all information related to the DAR's task    */
+      /* & memory bank identifiers.                                                    */
+
+      typedef struct
+      {
+         /* DAR addr ID.                                                    */
+         T_RVF_ADDR_ID          addrId;
+         /* DAR FFS addr ID                                                 */
+         T_RVF_ADDR_ID          ffs_addrId;
+
+         /* DAR memory bank.                                                */
+         T_RVF_MB_ID            mb_dar; 
+         /* DAR state                                                       */
+         UINT8                  state; 
+         /* data format: ASCII or binary                                    */
+         T_DAR_FORMAT           format;
+         /* data level : Error/Warning/ Debug                               */
+         T_DAR_LEVEL            diagnose_level;  
+         /* DAR use id                                                      */
+         T_DAR_USE_ID           dar_use_id;  
+         /* return path of the function that previously start the diagnose  */
+         T_RV_RETURN            return_path;  
+         /* Pointer to the error function                                  */
+         T_RVM_RETURN           (*callBackFctError)  (T_RVM_NAME        SWEntName,
+                                                      T_RVM_RETURN      errorCause,
+                                                      T_RVM_ERROR_TYPE  errorType,
+                                                      T_RVM_STRING      errorMsg);
+         /* Pointer to the DAR callback function */                                     
+         T_RV_RET               (*entity_dar_callback)(T_DAR_BUFFER      buffer_p,
+                                                       UINT16            length);
+         /* Filter Array that contains the group and the masks ( Warning, debug) */
+         /* in order to filter messages                                          */
+         T_DAR_FILTER_PARAMETER  dar_filter_array[DAR_MAX_GROUP_NB];
+         /* index to indicate the group position in the dar_filter_array    */
+         UINT16                  index;
+         /* free index to indicate the first free group position in the     */
+         /* dar_filter_array ( to add a new group in the array)             */
+         UINT16                  free_index;
+         /* Buffer to store diagnose data*/
+                  
+      } T_DAR_ENV_CTRL_BLK;
+
+      #ifdef __cplusplus
+         }
+      #endif
+
+   #endif
+
+#endif /* #ifdef RVM_DAR_SWE */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gsm-fw/services/dar/dar_task.c	Sun Mar 16 05:48:58 2014 +0000
@@ -0,0 +1,278 @@
+/****************************************************************************/
+/*                                                                          */
+/*  File Name:  dar_task.c                                                  */
+/*                                                                          */
+/*  Purpose:   This function is the main function. It contains the dar_core */
+/*             which waits for messages or function calls.                  */
+/*                                                                          */
+/*                                                                          */
+/*  Version   0.1                                                           */
+/*                                                                          */
+/*  Date                 Modification                                       */
+/*  ------------------------------------                                    */
+/*  16 October 2001    Create                                               */
+/*                                                                          */
+/*  Author     Stephanie Gerthoux                                           */
+/*                                                                          */
+/* (C) Copyright 2001 by Texas Instruments Incorporated, All Rights Reserved*/
+/****************************************************************************/
+
+#include "rv/rv_defined_swe.h"
+#ifdef RVM_DAR_SWE
+   #ifndef _WINDOWS
+      #include "config/swconfig.cfg"
+      #include "config/sys.cfg"
+      #include "config/chipset.cfg"
+   #endif
+
+   #include <string.h>
+   #include "rvm/rvm_gen.h"
+   #include "rvm/rvm_use_id_list.h"
+   #include "dar/dar_api.h"
+   #include "dar/dar_macro_i.h"
+   #include "dar/dar_handle_message.h"
+   #include "dar/dar_structs_i.h"
+   #include "dar/dar_error_hdlr_i.h"
+   #include "dar/dar_const_i.h"  
+
+   #include "ffs/ffs_api.h"
+  
+   /* Variables definitions */
+   T_DAR_RECOVERY_STATUS status=0;
+
+   /**** Global variables ****/
+   /* Define a pointer to the Global Environment Control block  */
+   extern T_DAR_ENV_CTRL_BLK *dar_gbl_var_p;
+
+   /* Write buffer*/
+   extern char dar_write_buffer[DAR_MAX_BUFFER_SIZE];
+
+   /* index used in the circular buffer*/
+   extern UINT16 dar_current_index;
+
+   /* DAR previous status : to get the status of the last exception */
+   extern UINT8  dar_previous_exception;
+
+   /* Ram buffer that contains the Debug Unit register */
+   extern UINT32  debug_RAM[DEBUG_UNIT_WORD_SIZE];
+
+   /* X_dump buffer defined in the command file */
+   /* This buffer contains the general register, the PC, the CPSR....*/
+   #ifndef _WINDOWS
+      extern INT32 xdump_buffer;
+   #endif
+
+
+   /********************************************************************************/
+   /* Function         dar_core                                                    */
+   /*                                                                              */
+   /* Description      Core of the dar task, which scans the dar mailbox and       */
+   /*                  waits for messages. When a message arrives, it sends it to  */
+   /*                  proper functions                                            */
+   /*                                                                              */
+   /*                                                                              */
+   /********************************************************************************/
+
+   T_RV_RET dar_core(void)
+   {
+      /* Declare local variables */
+      /**** Structs ****/
+      /* File descriptor type */
+      T_FFS_FD  ffs_fd;
+    
+      /* Variables */
+      T_RV_RET     error_status = RV_OK;
+      T_RV_HDR     *msg_p = NULL;
+      UINT16       received_event = 0x0000;
+      char         dar_ffs[20];
+      char         dar_dir_ffs[20];
+      char         dar_subdir_ffs[20];
+      BOOL         dar_ffs_error = FALSE;
+
+      #ifndef _WINDOWS
+         /* Define the Link register and the CPSR */
+         INT32 *link_register_p = &(xdump_buffer) + 14;
+         INT32 *dar_spsr_p      = &(xdump_buffer) + 16;
+         UINT16      i;      
+      #endif
+
+      /* Dar_ffs file name */ 
+      strcpy(dar_dir_ffs,"/var");
+      strcpy(dar_subdir_ffs,"/var/dbg");
+
+      #ifndef _WINDOWS
+         strcpy(dar_ffs,"/var/dbg/dar");
+      #else
+         strcpy(dar_ffs,"\var\dbg\dar");
+      #endif
+
+      DAR_SEND_TRACE("DAR_TASK started",RV_TRACE_LEVEL_DEBUG_HIGH);
+
+      /*---------------------------------*/
+      /*               FFS               */
+      /*---------------------------------*/
+
+      /**** create the dar ffs directories ****/
+	  if ((ffs_mkdir(dar_dir_ffs) != EFFS_OK) && (ffs_mkdir(dar_dir_ffs) != EFFS_EXISTS))
+	  {
+         DAR_SEND_TRACE("DAR entity can't create the '/var' folder into the flash",RV_TRACE_LEVEL_ERROR);
+	  }
+
+  	  if ((ffs_mkdir(dar_subdir_ffs) != EFFS_OK) && (ffs_mkdir(dar_subdir_ffs) != EFFS_EXISTS))
+	  {
+         DAR_SEND_TRACE("DAR entity can't create the '/var/dbg' folder into the flash",RV_TRACE_LEVEL_ERROR);
+	  }
+
+
+      /**** create the ffs file ****/
+      ffs_fd = ffs_open(dar_ffs, FFS_O_CREATE | FFS_O_WRONLY | FFS_O_TRUNC | FFS_O_APPEND);
+
+      if (ffs_fd < 0)
+      {
+         DAR_SEND_TRACE("DAR entity has received wrong file name or the flash is not formatted",RV_TRACE_LEVEL_WARNING);
+         dar_ffs_error = TRUE;
+      }
+    
+      #ifndef _WINDOWS
+
+         /**** Save the RAM buffer into the FFS ****/
+         /* save the buffer in 2 parts in order to have the information in chronological order */
+         /* save the oldest information : from dar_current_index to the end of the buffer*/
+         if ((ffs_write (ffs_fd,
+                         (void *)(&dar_write_buffer + dar_current_index),
+                         (DAR_MAX_BUFFER_SIZE - dar_current_index))) < 0 & (dar_ffs_error == FALSE))
+         {
+            DAR_SEND_TRACE("DAR entity can't saved the file in flash",RV_TRACE_LEVEL_WARNING);
+         }
+
+         /* save the rest of information: from the beginning of the buffer to dar_current_index */
+         if ((ffs_write (ffs_fd,
+                         (void *)(&dar_write_buffer),
+                         (dar_current_index))) < 0 & (dar_ffs_error == FALSE))
+         {
+            DAR_SEND_TRACE("DAR entity can't saved the file in flash",RV_TRACE_LEVEL_WARNING);
+         }
+
+         /* Erase the dar_write_buffer */
+         for (i=0;i<DAR_MAX_BUFFER_SIZE; i++)
+         {
+            dar_write_buffer[i] = 0;
+         }
+
+         /**** Save the X_dump_buffer into the Flash. ****/
+         /* This buffer is defined in the command file */
+         /* And the size of this buffer is defined in the gsm_cs_amd4_lj3_test.cmd */
+         /* its size is 38*32 bits = 38*4 bytes = 152 bytes */
+         if ((ffs_write (ffs_fd,
+                         (void *)(&xdump_buffer),
+                         (DAR_X_DUMP_BUFFER_SIZE))) < 0 & (dar_ffs_error == FALSE))
+         {
+            DAR_SEND_TRACE("DAR entity can't saved the X_dump_buffer in flash",RV_TRACE_LEVEL_WARNING);
+         }
+
+         /**** Save the Debug Unit Register into the Flash if necessary (Abort or prefetch)****/
+         /* A Prefetch abort exception or a data abort exception is generated */
+         #if ((CHIPSET == 7) || (CHIPSET == 8) || (CHIPSET == 10) || (CHIPSET == 11))
+            if ((dar_previous_exception == DAR_EXCEPTION_PREFETCH_ABORT) ||
+                (dar_previous_exception == DAR_EXCEPTION_DATA_ABORT))
+            {
+               /* Save the Debug Unit into the Flash */
+               if ((ffs_write (ffs_fd,
+                              (void *) &debug_RAM,
+                              (4*DEBUG_UNIT_WORD_SIZE))) < 0 & (dar_ffs_error == FALSE))
+               {
+                  DAR_SEND_TRACE("DAR entity can't saved the DEBUG UNIT in flash",RV_TRACE_LEVEL_WARNING);
+               }
+            }
+         #endif
+         
+      #else
+         /* save the buffer in 2 parts in order to have the information in chronological order */
+         /* save the oldest information : from dar_current_index to the end of the buffer*/
+         if ((ffs_write (ffs_fd,
+                         (&dar_write_buffer + dar_current_index),
+                         (DAR_MAX_BUFFER_SIZE - dar_current_index))) != EFFS_OK)
+         {
+            DAR_SEND_TRACE("DAR entity can't saved the file in flash",RV_TRACE_LEVEL_WARNING);
+         }
+         /* save the rest of information: from the beginning of the buffer to dar_current_index */
+         if ((ffs_write (ffs_fd,
+                         (&dar_write_buffer),
+                         (dar_current_index))) != EFFS_OK)
+         {
+            DAR_SEND_TRACE("DAR entity can't saved the file in flash",RV_TRACE_LEVEL_WARNING);
+         }
+         /* The X_dump_buffer  and the Debug Unit can't be saved on the PC */
+      #endif
+
+      /* Close the ffs file*/
+      #ifndef _WINDOWS
+         if ( ffs_close(ffs_fd) != EFFS_OK & (dar_ffs_error == FALSE))
+         {
+            DAR_SEND_TRACE("DAR entity has not closed the file",RV_TRACE_LEVEL_WARNING);
+         }
+      #else
+         if ( ffs_close(ffs_fd) != EFFS_OK )
+         {
+            dar_error_trace(DAR_ENTITY_FILE_NO_CLOSE);
+         }
+      #endif
+
+      #ifndef _WINDOWS
+         /**** Save the LR and the SPSR when an exception has occured ****/
+         if ((dar_previous_exception == DAR_EXCEPTION_PREFETCH_ABORT)||
+             (dar_previous_exception == DAR_EXCEPTION_DATA_ABORT)    ||
+             (dar_previous_exception == DAR_EXCEPTION_UNDEFINED)     ||
+             (dar_previous_exception == DAR_EXCEPTION_SWI)           ||
+             (dar_previous_exception == DAR_EXCEPTION_RESERVED))
+         {
+            /* Displays the Link register saved on exception  */
+            DAR_SEND_TRACE_PARAM("Link register = ", *link_register_p,RV_TRACE_LEVEL_DEBUG_HIGH);
+
+            /* Displays the User mode CPSR saved on exception */
+            DAR_SEND_TRACE_PARAM("User mode SPSR before the exception=", *dar_spsr_p,RV_TRACE_LEVEL_DEBUG_HIGH); 
+         }
+
+         /* Displays the status of the last reset of the system */
+         dar_recovery_get_status(&status);
+      #endif
+
+      /* ------------------------------------------- */
+      /* loop to process messages                    */
+      /* ------------------------------------------- */
+      while (error_status == RV_OK)
+      {
+         /* Wait for all events. */
+         received_event = rvf_wait(DAR_ALL_EVENT_FLAGS, DAR_NOT_TIME_OUT);
+  
+         if (received_event & DAR_TASK_MBOX_EVT_MASK)
+         {
+            /* Read the message in the Dar mailbox and handle it. */
+            msg_p = (T_RV_HDR *) rvf_read_mbox(DAR_MBOX);			
+            error_status = dar_handle_msg(msg_p);
+         }
+      }
+  
+      /* If one of the occured events is unexpected (due to an unassigned  */
+      /* mailbox), then report an internal error.                          */
+      if (received_event & ~(DAR_TASK_MBOX_EVT_MASK )) 
+      {
+         DAR_SEND_TRACE(" DAR ERROR (env). One of the occured events is unexpected ",
+                         RV_TRACE_LEVEL_ERROR);
+
+         error_status = RV_NOT_SUPPORTED;
+      }
+
+      /* If a memory error happened .. */
+      if (error_status ==  RV_MEMORY_ERR)
+      {
+         dar_gbl_var_p->callBackFctError("DAR",
+                                         RVM_MEMORY_ERR,
+                                         0,
+                                         " Memory Error : the DAR primitive memory bank is RED ");
+      }
+
+       return RV_OK;
+   } /* dar_core */
+
+#endif /* #ifdef RVM_DAR_SWE */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gsm-fw/services/dar/dar_watchdog.c	Sun Mar 16 05:48:58 2014 +0000
@@ -0,0 +1,71 @@
+/****************************************************************************/
+/*                                                                          */
+/*  File Name:  dar_watchdog.c                                              */
+/*                                                                          */
+/*  Purpose:   This function contains the DAR watchdog functions            */
+/*                                                                          */
+/*                                                                          */
+/*  Version   0.1                                                           */
+/*                                                                          */
+/*  Date                 Modification                                       */
+/*  ------------------------------------                                    */
+/*  8 November 2001    Create                                               */
+/*                                                                          */
+/*  Author     Stephanie Gerthoux                                           */
+/*                                                                          */
+/* (C) Copyright 2001 by Texas Instruments Incorporated, All Rights Reserved*/
+/****************************************************************************/
+
+#include "rv/rv_defined_swe.h"
+#ifdef RVM_DAR_SWE
+   #ifndef _WINDOWS
+      #include "config/swconfig.cfg"
+      #include "config/sys.cfg"
+      #include "config/chipset.cfg"
+   #endif
+
+   #include "rv/rv_general.h"
+   #include "rvm/rvm_gen.h"
+   #include "rvm/rvm_priorities.h"
+   #include "dar/dar_api.h"
+   #include "dar/dar_gen.h"
+   #include "dar/dar_diagnose_i.h"
+
+   /**** Global variable ****/
+
+   /* Get the dar_current status */
+   extern T_DAR_RECOVERY_STATUS dar_current_status;
+
+   /********************************************************************************/
+   /*                                                                              */
+   /*    Function Name:   dar_watchdog_reset                                       */
+   /*                                                                              */
+   /*    Purpose: This function is called to reset the system when the general     */
+   /*             general purpose timer expires                                    */
+   /*                                                                              */
+   /*    Input Parameters:                                                         */
+   /*        Pointer to the message to store                                       */
+   /*        Data Format,                                                          */
+   /*        Data level,                                                           */
+   /*        Data Use Id,                                                          */
+   /*                                                                              */
+   /*    Output Parameters:                                                        */
+   /*        Validation of the function execution.                                 */
+   /*                                                                              */
+   /*    Note:                                                                     */
+   /*        None                                                                  */
+   /*                                                                              */
+   /********************************************************************************/
+
+   void dar_watchdog_reset(void)
+   {
+      /* Update the current status */
+      dar_current_status = DAR_WATCHDOG;
+
+      /* reset the system */
+      dar_reset(); 
+ 
+   } /* dar_watchdog_reset */
+
+
+#endif /* #ifdef RVM_DAR_SWE */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gsm-fw/services/dar/dar_watchdog.h	Sun Mar 16 05:48:58 2014 +0000
@@ -0,0 +1,32 @@
+/****************************************************************************/
+/*                                                                          */
+/*  File Name:  dar_watchdog.h                                              */
+/*                                                                          */
+/*  Purpose:   This function contains the functions prototypes of the       */ 
+/*             watchdog reset functions.                                    */
+/*                                                                          */
+/*  Version   0.1                                                           */
+/*                                                                          */
+/*  Date                 Modification                                       */
+/*  ------------------------------------                                    */
+/*  18 October 2001    Create                                               */
+/*                                                                          */
+/*  Author     Stephanie Gerthoux                                           */
+/*                                                                          */
+/* (C) Copyright 2001 by Texas Instruments Incorporated, All Rights Reserved*/
+/****************************************************************************/
+
+#include "rv/rv_defined_swe.h"
+#ifdef RVM_DAR_SWE
+
+   #ifndef __DAR_WATCHDOG_H_
+   #define __DAR_WATCHDOG_H_
+
+      #include "rvm/rvm_gen.h"
+
+      /* Reset the system when the general purpose timer expires*/
+      void dar_watchdog_reset(void);
+
+   #endif /* _DAR_WATCHDOG_H_ */
+
+#endif /* #ifdef RVM_DAR_SWE */