This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

RDK 4.1 long run issue.

Hello All,

 

We have a customize board based on DM814x and we are using RDK 4.1 on it.
We are giving
    1] 8ch capture + encode + dump (mp4 + JPEG)&
    2] 8ch capture + display support.


Both of these functionality is working fine.

But some times, after long run we are getting following assertion

 

May 13 18:29:02 PUT11-36 user.info health_monitor: [Tue May 13 18:29:02 2014] : COMMON_APIS : "Starting process storage.out"

May 13 18:29:02 PUT11-36 user.info storage.out: [Tue May 13 18:29:02 2014] : RSC_APP : "STORAGE VERSION_NUMBER: 0.4.7.05062014"

May 13 18:29:02 PUT11-36 user.warn storage.out: [Tue May 13 18:29:02 2014] : RSC_APP : "Channel Idx[0], VideoEnable: 1 AudioEnable: 1"

May 13 18:29:02 PUT11-36 user.warn storage.out: [Tue May 13 18:29:02 2014] : RSC_APP : "Channel Idx[1], VideoEnable: 1 AudioEnable: 0"

May 13 18:29:02 PUT11-36 user.warn storage.out: [Tue May 13 18:29:02 2014] : RSC_APP : "Channel Idx[2], VideoEnable: 1 AudioEnable: 1"

May 13 18:29:02 PUT11-36 user.warn storage.out: [Tue May 13 18:29:02 2014] : RSC_APP : "Channel Idx[3], VideoEnable: 1 AudioEnable: 1"

May 13 18:29:02 PUT11-36 user.warn storage.out: [Tue May 13 18:29:02 2014] : RSC_APP : "Channel Idx[4], VideoEnable: 1 AudioEnable: 1"

May 13 18:29:02 PUT11-36 user.warn storage.out: [Tue May 13 18:29:02 2014] : RSC_APP : "Channel Idx[5], VideoEnable: 1 AudioEnable: 1"

May 13 18:29:02 PUT11-36 user.warn storage.out: [Tue May 13 18:29:02 2014] : RSC_APP : "Channel Idx[6], VideoEnable: 1 AudioEnable: 1"

May 13 18:29:02 PUT11-36 user.warn storage.out: [Tue May 13 18:29:02 2014] : RSC_APP : "Channel Idx[7], VideoEnable: 1 AudioEnable: 1"

May 13 18:29:02 PUT11-36 user.info storage.out: [Tue May 13 18:29:02 2014] : RSC_APP : "DS3_SDCARD_ON Detected. Application starts storing data into SD card."

May 13 18:29:02 PUT11-36 user.info storage.out: [Tue May 13 18:29:02 2014] : RSC_APP : "Camera Sensor's initialized properly for pll settings."

May 13 18:29:02 PUT11-36 user.alert kernel: *** NameServer_add: duplicate entry found!

May 13 18:29:02 PUT11-36 user.alert kernel:     Error [0xfffffffe] at Line no: 1055 in file /home/SoftwareRelease/DVRRDK_04.01.00.02/ti_tools/syslink/syslink_2_20_02_20/packages/ti/syslink/utils/hlos/knl/Linux/../../../../../../ti/syslink/utils/hlos/knl/NameServer.c

 

 

This is now crucial for us to solve. It is not coming always, but it there and recording stops on this.

Please help on this.

  • Looks like your application is restarting without proper shutdown.Attach your dmesg logs

  • Thanks Badri,

    Is there any way to start application again, If it was not properly shutdown last time?

  • Hi Vaibhav,

     

    Application restart works without any errors only if previous run was terminated properly. Proper termination of app includes deleting all the created links and syslink deinit, which has to be taken care by the app.

     

    In case of SIGSEGV or SIGINT kind of unexpected app shutdown, patch

    diff --git a/component.mk b/component.mk
    index b885fff..b71f975 100755
    --- a/component.mk
    +++ b/component.mk
    @@ -101,7 +101,7 @@ endif
     #
     
     ifeq ($(DVR_RDK_BOARD_TYPE), DM816X_UD_DVR)
    -DVR_RDK_CFLAGS += -DTI816X_DVR -DENABLE_FB -D_GNU_SOURCE
    +DVR_RDK_CFLAGS += -DTI816X_DVR -DENABLE_FB -D_GNU_SOURCE -DSYSLINK_BUILDOS_LINUX
     ifeq ($(DDR_MEM),DDR_MEM_2048M)
     DVR_RDK_CFLAGS += -DTI816X_2G_DDR
     endif
    diff --git a/demos/mcfw_api_demos/mcfw_demo/MAKEFILE.MK b/demos/mcfw_api_demos/mcfw_demo/MAKEFILE.MK
    index 47e963d..fa8f6c1 100755
    --- a/demos/mcfw_api_demos/mcfw_demo/MAKEFILE.MK
    +++ b/demos/mcfw_api_demos/mcfw_demo/MAKEFILE.MK
    @@ -1,7 +1,7 @@
     
     include $(dvr_rdk_PATH)/makerules/common_header_a8.mk
     
    -INCLUDE+= $(MCFW_INC) $(OSA_INC) $(DEVICES_INC) $(RPE_INC) $(LINUXDEVKIT_INC) 
    +INCLUDE+= $(MCFW_INC) $(OSA_INC) $(DEVICES_INC) $(RPE_INC) $(LINUXDEVKIT_INC) $(SYSLINK_INC)
     INCLUDE+= -I$(KERNELDIR)/usr/include -I$(KERNELDIR)/arch/arm/include/
     
     ifeq ($(DISABLE_AUDIO),yes)
    diff --git a/demos/mcfw_api_demos/mcfw_demo/demo.c b/demos/mcfw_api_demos/mcfw_demo/demo.c
    index 000a4fb..a47491e 100755
    --- a/demos/mcfw_api_demos/mcfw_demo/demo.c
    +++ b/demos/mcfw_api_demos/mcfw_demo/demo.c
    @@ -131,10 +131,28 @@ void SIGSEGV_handler( int signum, siginfo_t* sig_info, void* context)
         for (i = 0; i < size; i++)
         {
          printf ("[bt] %s\n", str[i]);
    +    } 
    +    {
    +        Vsys_shutdownSlaveCores();
    +        Vsys_deConfigureDisplay(); 
    +        Vsys_enableDeleteSyslinkOnExit(FALSE);
    +        Vdis_setAvsyncDeleteRTOSLinkFlag(FALSE);
    +        Vsys_exit();
    +        exit(0);
         }
    -    exit(0);
     }
     
    +void SIGINT_handler( int signum, siginfo_t* sig_info, void* context)
    +{
    +    printf("In Handler\n");
    +    Vsys_shutdownSlaveCores();
    +    Vsys_stopDeleteAllLinks();
    +    Vsys_deConfigureDisplay(); 
    +    Vsys_enableDeleteSyslinkOnExit(FALSE);
    +    Vdis_setAvsyncDeleteRTOSLinkFlag(FALSE);
    +    Vsys_exit();
    +    exit(0);
    +}
     
     int main()
     {
    @@ -148,6 +166,11 @@ int main()
     
         sigaction(SIGSEGV, &sa, NULL);
     
    +    sa.sa_sigaction = (void *)SIGINT_handler;
    +    sigemptyset (&sa.sa_mask);
    +    sa.sa_flags = 0;
    +
    +    sigaction(SIGINT, &sa, NULL);
     
         gDemo_info.audioType = DEMO_AUDIO_TYPE_NONE;
         gDemo_info.audioInitialized = FALSE;
    diff --git a/mcfw/interfaces/common_def/ti_vsys_common_def.h b/mcfw/interfaces/common_def/ti_vsys_common_def.h
    index 4313870..3863288 100755
    --- a/mcfw/interfaces/common_def/ti_vsys_common_def.h
    +++ b/mcfw/interfaces/common_def/ti_vsys_common_def.h
    @@ -42,7 +42,7 @@ extern "C" {
         On receiving this event user call Vcap APIs to get details about the
         channel on which this event has happended
     */
    -#define VSYS_EVENT_VIDEO_DETECT     (0x0000)
    +#define VSYS_EVENT_VIDEO_DETECT     (0xB000)
     
     
     /**
    @@ -52,7 +52,7 @@ extern "C" {
         On receiving this event user call Scd APIs to get details about the
         channel on which this event has happended
     */
    -#define VSYS_EVENT_TAMPER_DETECT     (0x0001)
    +#define VSYS_EVENT_TAMPER_DETECT     (0xB001)
     
     /**
         \brief 
    @@ -61,7 +61,7 @@ extern "C" {
         On receiving this event user call Scd APIs to get details about the
         channel on which this event has happended
     */
    -#define VSYS_EVENT_MOTION_DETECT     (0x0002)
    +#define VSYS_EVENT_MOTION_DETECT     (0xB002)
     
     /**
         \brief 
    @@ -72,7 +72,7 @@ extern "C" {
         this event is decoder error message and can be extracted by VDEC_CH_ERROR_MSG 
         structre defined in <mcfw/interfaces/common_def/ti_vdec_common_def.h>.
     */
    -#define VSYS_EVENT_DECODER_ERROR     (0x0003)
    +#define VSYS_EVENT_DECODER_ERROR     (0xB003)
     
     /**
         \brief 
    @@ -81,7 +81,7 @@ extern "C" {
     
         This error indicates catastrophic failure of one of the slave cores.
     */
    -#define VSYS_EVENT_SLAVE_CORE_EXCEPTION  (0x0004)
    +#define VSYS_EVENT_SLAVE_CORE_EXCEPTION  (0xB004)
     
     /**
         This event is received by McFW when the TV / Monitor connected to HDMI 0
    @@ -91,7 +91,7 @@ extern "C" {
         
         Application could take appropriate actions.
     */
    -#define VSYS_EVENT_HDMI_TV_DISCONNECTED  (0x0005)
    +#define VSYS_EVENT_HDMI_TV_DISCONNECTED  (0xB005)
     
     /**
         This event is received by McFW when the TV / Monitor is connected to HDMI 0.
    @@ -100,7 +100,7 @@ extern "C" {
         
         Application could take appropriate actions.
     */
    -#define VSYS_EVENT_HDMI_TV_CONNECTED    (0x0006)
    +#define VSYS_EVENT_HDMI_TV_CONNECTED    (0xB006)
     
     /**
         This event is received by McFW when the retrieved decrypted key from decoder
    @@ -109,7 +109,7 @@ extern "C" {
         
         Application could take appropriate actions.
     */
    -#define VSYS_EVENT_DECRYPTEDKEY_MISMATCH    (0x0007)
    +#define VSYS_EVENT_DECRYPTEDKEY_MISMATCH    (0xB007)
     
     
     /**
    @@ -377,7 +377,7 @@ typedef struct CHANNEL_TIME_INFO_S
         On receiving this event user call Vcap APIs to get details about the
         channel on which this event has happended
     */
    -#define VSYS_EVENT_VIDEO_DETECT     (0x0000)
    +#define VSYS_EVENT_VIDEO_DETECT     (0xB000)
     
     
     /**
    @@ -386,7 +386,7 @@ typedef struct CHANNEL_TIME_INFO_S
         On receiving this event user call Scd APIs to get details about the
         channel on which this event has happended
     */
    -#define VSYS_EVENT_TAMPER_DETECT     (0x0001)
    +#define VSYS_EVENT_TAMPER_DETECT     (0xB001)
     
     /**
         This event is received by McFW when motion is detected by SCD link
    @@ -394,7 +394,7 @@ typedef struct CHANNEL_TIME_INFO_S
         On receiving this event user call Scd APIs to get details about the
         channel on which this event has happended
     */
    -#define VSYS_EVENT_MOTION_DETECT     (0x0002)
    +#define VSYS_EVENT_MOTION_DETECT     (0xB002)
     
     /**
         This event is received by McFW when decoder sees an error in decoding
    @@ -404,7 +404,7 @@ typedef struct CHANNEL_TIME_INFO_S
         this event is decoder error message and can be extracted by VDEC_CH_ERROR_MSG 
         structre defined in <mcfw/interfaces/common_def/ti_vdec_common_def.h>.
     */
    -#define VSYS_EVENT_DECODER_ERROR     (0x0003)
    +#define VSYS_EVENT_DECODER_ERROR     (0xB003)
     
     /**
         This event is received by McFW when one of the slave cores (VIDEO_M3/VPSS_M3/DSP)
    @@ -412,7 +412,7 @@ typedef struct CHANNEL_TIME_INFO_S
     
         This error indicates catastrophic failure of one of the slave cores.
     */
    -#define VSYS_EVENT_SLAVE_CORE_EXCEPTION  (0x0004)
    +#define VSYS_EVENT_SLAVE_CORE_EXCEPTION  (0xB004)
     
     
     /**
    diff --git a/mcfw/interfaces/link_api/avsync_hlos.h b/mcfw/interfaces/link_api/avsync_hlos.h
    index 5e6583d..c6a28f9 100755
    --- a/mcfw/interfaces/link_api/avsync_hlos.h
    +++ b/mcfw/interfaces/link_api/avsync_hlos.h
    @@ -243,6 +243,17 @@ Avsync_PlayerTimeState Avsync_audQueGetPlayerState(AvsyncLink_AudQueObj *queObj)
     */
     Void AvsyncLink_logIpcBitsOutTS(UInt32 chNum, UInt64 ts);
     
    +/**
    +    \brief:
    +          This function sets flag to enable/disable AVSYNC_LINK_CMD_DEINIT call during AvsyncLink_deInit
    +    \param:
    +          enable : TRUE  : AVSYNC_LINK_CMD_DEINIT called
    +                   FALSE : AVSYNC_LINK_CMD_DEINIT not called
    +
    +    \return None
    +*/
    +Void Avsync_setDeleteRTOSLinkFlag(Bool enable);
    +
     #endif /* AVSYNC_HLOS_H_ */
     
     /* @} */
    diff --git a/mcfw/interfaces/link_api/systemLink_common.h b/mcfw/interfaces/link_api/systemLink_common.h
    index 01d4548..c9ef241 100755
    --- a/mcfw/interfaces/link_api/systemLink_common.h
    +++ b/mcfw/interfaces/link_api/systemLink_common.h
    @@ -194,11 +194,18 @@ extern "C" {
     #define SYSTEM_COMMON_CMD_TILER_SET_BUCKET_GEOMETRY   (0x9015)
     
     /**
    -    \brief System CMD: To get system blank frame from vpss core
    +    \brief System CMD: To stop all the links 
     
    -    \param SystemCommon_BlankFrame * [OUT] Blank frame 
    +    \param [IN]  None   *
     */
    -#define SYSTEM_COMMON_CMD_GET_BLANK_FRAME            (0x9018)
    +#define SYSTEM_COMMON_CMD_STOP_ALL_LINKS              (0x9016)
    +
    +/**
    +    \brief System CMD: To delete all the links 
    +
    +    \param [IN]  None   *
    +*/
    +#define SYSTEM_COMMON_CMD_DELETE_ALL_LINKS            (0x9017)
     
     /* @} */
     
    @@ -338,15 +345,7 @@ typedef struct SystemCommon_TilerGetFreeSize {
     
     } SystemCommon_TilerGetFreeSize;
     
    -/**
    -    \brief Get system blank buffer
    -*/
    -typedef struct SystemCommon_BlankFrame {
    -
    -    Ptr frame;
    -    /**< Blank frame pointer.*/
     
    -} SystemCommon_BlankFrame;
     
     #ifdef __cplusplus
     }
    diff --git a/mcfw/interfaces/ti_vdis.h b/mcfw/interfaces/ti_vdis.h
    index 28b6a06..1dfa678 100755
    --- a/mcfw/interfaces/ti_vdis.h
    +++ b/mcfw/interfaces/ti_vdis.h
    @@ -1265,6 +1265,19 @@ Int32 Vdis_setEdeStrength(int edeStrength);
      */
     Int32 Vdis_setCprocConfig(int cprocConfig);
     
    +/**
    + * \brief:
    + *      This function sets flag to enable/disable AVSYNC_LINK_CMD_DEINIT call during AvsyncLink_deInit
    + * \input:
    + *      Bool enable : TRUE  : AVSYNC_LINK_CMD_DEINIT called
    + *                    FALSE : AVSYNC_LINK_CMD_DEINIT not called
    + * \output:
    + *      NA
    + * \return
    + *      NA
    +*/
    +Void Vdis_setAvsyncDeleteRTOSLinkFlag(Bool enable);
    +
     #ifdef __cplusplus
     }
     #endif /* __cplusplus */
    diff --git a/mcfw/interfaces/ti_vsys.h b/mcfw/interfaces/ti_vsys.h
    index ca92d87..2ca6464 100755
    --- a/mcfw/interfaces/ti_vsys.h
    +++ b/mcfw/interfaces/ti_vsys.h
    @@ -538,6 +538,60 @@ Int32 Vsys_initGPIOForIvaVoltageScaling(VSYS_GPIO_FOR_IVA_VOLTAGE_SCALING_S *ini
     */
     Int32 Vsys_setIVAFreqVoltage(VSYS_IVA_FREQ_VOLTAGE_S *ivaFreqVoltageCmd);
     
    +/**
    + * \brief:
    + *      This function sets flag to enable/disable Syslink_destroy call during Vsys_exit()
    + * \input:
    + *      Bool enable : TRUE  : Syslink_destroy called
    + *                    FALSE : Syslink_destroy not called
    + * \output:
    + *      NA
    + * \return
    +*       ERROR_NOERROR       --  while success
    +*       ERROR_CODE          --  refer for err definition
    +*/
    +Int32 Vsys_enableDeleteSyslinkOnExit(Bool enable);
    +
    +/**
    + * \brief:
    + *      This function registers terminate notify events with syslink module. 
    + *      Terminate notify events are called if the demo termination is abrupt (SIGSEGV, SIGINT)
    + * \input:
    + *      NA
    + * \output:
    + *      NA
    + * \return
    +*       ERROR_NOERROR       --  while success
    +*       ERROR_CODE          --  refer for err definition
    +*/
    +Int32 Vsys_registerTerminateHandler(Void);
    +
    +/**
    + * \brief:
    + *      This function sends control commands to slave cores to stop all the running links.
    + * \input:
    + *      NA
    + * \output:
    + *      NA
    + * \return
    +*       ERROR_NOERROR       --  while success
    +*       ERROR_CODE          --  refer for err definition
    +*/
    +Int32 Vsys_shutdownSlaveCores(Void);
    +
    +/**
    + * \brief:
    + *      This function stops and deletes all the links running on host
    + * \input:
    + *      NA
    + * \output:
    + *      NA
    + * \return
    +*       ERROR_NOERROR       --  while success
    +*       ERROR_CODE          --  refer for err definition
    +*/
    +Int32 Vsys_stopDeleteAllLinks(Void);
    +
     #ifdef __cplusplus
     }
     #endif /* __cplusplus */
    diff --git a/mcfw/src_bios6/links_c6xdsp/system/systemLink_tsk_c6xdsp.c b/mcfw/src_bios6/links_c6xdsp/system/systemLink_tsk_c6xdsp.c
    index 4f6ae29..644a06c 100755
    --- a/mcfw/src_bios6/links_c6xdsp/system/systemLink_tsk_c6xdsp.c
    +++ b/mcfw/src_bios6/links_c6xdsp/system/systemLink_tsk_c6xdsp.c
    @@ -19,6 +19,14 @@ Int32 SystemLink_cmdHandler(SystemLink_Obj * pObj, UInt32 cmd, Void * pPrm)
     
         switch (cmd)
         {
    +        case SYSTEM_COMMON_CMD_STOP_ALL_LINKS:
    +            System_stop();    
    +            break;
    +
    +        case SYSTEM_COMMON_CMD_DELETE_ALL_LINKS:
    +            System_setShutdownFlag();
    +            break;
    +
             case SYSTEM_COMMON_CMD_CPU_LOAD_CALC_START:
                 Utils_prfLoadCalcStart();
                 break;
    diff --git a/mcfw/src_bios6/links_common/system/system_common.c b/mcfw/src_bios6/links_common/system/system_common.c
    index 12d1390..73c45a4 100755
    --- a/mcfw/src_bios6/links_common/system/system_common.c
    +++ b/mcfw/src_bios6/links_common/system/system_common.c
    @@ -8,6 +8,7 @@
     #include "system_priv_common.h"
     #include "system_priv_ipc.h"
     #include <ti/psp/platforms/vps_platform.h>
    +#include <mcfw/interfaces/link_api/avsync.h>
     
     #pragma DATA_ALIGN(gSystem_tskStack, 32)
     #pragma DATA_SECTION(gSystem_tskStack, ".bss:taskStackSection")
    @@ -439,3 +440,70 @@ int System_enumAssertCheck()
     
         return 0;
     }
    +
    +Void System_stop()
    +{
    +    UInt32 linkId, selfProcId, systemLinkId;
    +    Utils_TskHndl *pTsk;
    +      
    +    selfProcId = System_getSelfProcId();
    +    
    +    /*SYSTEM_LINK_ID_MAX-1 is system link . This function is being called from 
    +      system link. Sending stop to system link will cause a deadlock  */
    +    for(linkId = 0 ; linkId < (SYSTEM_LINK_ID_MAX-1) ; linkId++)
    +    {
    +        pTsk = System_getLinkTskHndl(linkId);
    +        
    +        /*Check if the task is registered*/
    +        if(pTsk != NULL)
    +        {
    +            systemLinkId = SYSTEM_MAKE_LINK_ID(selfProcId, linkId);
    +
    +            System_linkStop(systemLinkId);
    +        }
    +    }
    +}
    +
    +Void System_delete()
    +{
    +    UInt32 linkId, selfProcId, systemLinkId;
    +    Utils_TskHndl *pTsk;
    +      
    +    selfProcId = System_getSelfProcId();
    +    
    +    for(linkId = 0 ; linkId < SYSTEM_LINK_ID_MAX ; linkId++)
    +    {
    +        pTsk = System_getLinkTskHndl(linkId);
    +        
    +        /*Check if the task is registered*/
    +        if(pTsk != NULL)
    +        { 
    +            systemLinkId = SYSTEM_MAKE_LINK_ID(selfProcId, linkId);
    +
    +            System_linkDelete(systemLinkId);
    +        }
    +    }
    +    if(selfProcId == SYSTEM_PROC_M3VPSS)
    +    {
    +         System_linkControl(SYSTEM_LINK_ID_AVSYNC,
    +                              AVSYNC_LINK_CMD_DEINIT,
    +                              NULL,
    +                              0,
    +                              TRUE);
    +    }
    +}
    +
    +Void System_setShutdownFlag()
    +{
    +    gSystem_objCommon.shutdown = TRUE;
    +}
    +
    +Void System_clearShutdownFlag()
    +{
    +    gSystem_objCommon.shutdown = FALSE;
    +}
    +
    +Bool System_getShutdownFlag()
    +{
    +    return gSystem_objCommon.shutdown;
    +}
    diff --git a/mcfw/src_bios6/links_common/system/system_ipc_notify.c b/mcfw/src_bios6/links_common/system/system_ipc_notify.c
    index 3d3d832..62f4405 100755
    --- a/mcfw/src_bios6/links_common/system/system_ipc_notify.c
    +++ b/mcfw/src_bios6/links_common/system/system_ipc_notify.c
    @@ -7,6 +7,15 @@
     
     #include "system_priv_common.h"
     #include "system_priv_ipc.h"
    +#include "ti/syslink/ipc/rtos/Syslink.h"
    +
    +Void System_ipcSwResetNotifyHandler(UInt16 procId, UInt16 lineId,
    +                             UInt32 eventId, UArg arg, UInt32 payload)
    +{
    +    System_setShutdownFlag();
    +    
    +    return;
    +}
     
     Int32 System_ipcRegisterNotifyCb(UInt32 linkId, System_ipcNotifyCb notifyCb)
     {
    @@ -114,6 +123,19 @@ Int32 System_ipcNotifyInit()
             i++;
         }
     
    +    Vps_printf(" %d: SYSTEM: Terminate event : Notify register to [%s] line %d, event %d ... \n",
    +               Utils_getCurTimeInMsec(), System_getProcName(SYSTEM_PROC_HOSTA8),
    +               Syslink_terminateEventLineId, Syslink_terminateEventId);
    +
    +    syslinkProcId = System_getSyslinkProcId(SYSTEM_PROC_HOSTA8);
    +
    +    status = Notify_registerEvent(syslinkProcId,
    +                                  Syslink_terminateEventLineId,
    +                                  Syslink_terminateEventId,
    +                                  System_ipcSwResetNotifyHandler, NULL);
    +    
    +    UTILS_assert(status == Notify_S_SUCCESS);
    +
         return status;
     }
     
    @@ -144,6 +166,15 @@ Int32 System_ipcNotifyDeInit()
             i++;
         }
     
    +    syslinkProcId = System_getSyslinkProcId(SYSTEM_PROC_HOSTA8);
    +
    +    status = Notify_unregisterEvent(syslinkProcId,
    +                                    Syslink_terminateEventLineId,
    +                                    Syslink_terminateEventId,
    +                                    System_ipcSwResetNotifyHandler, NULL);
    +
    +    UTILS_assert(status == Notify_S_SUCCESS);
    +
         Vps_printf(" %d: SYSTEM: IPC Notify de-init DONE !!!\n", Utils_getCurTimeInMsec());
     
         return status;
    diff --git a/mcfw/src_bios6/links_common/system/system_priv_common.h b/mcfw/src_bios6/links_common/system/system_priv_common.h
    index 64c0503..1490906 100755
    --- a/mcfw/src_bios6/links_common/system/system_priv_common.h
    +++ b/mcfw/src_bios6/links_common/system/system_priv_common.h
    @@ -115,13 +115,6 @@
     #define SELECT_LINK_TSK_STACK_SIZE       (SYSTEM_TSK_STACK_SIZE_SMALL)
     #define MP_SCLR_LINK_TSK_STACK_SIZE      (SYSTEM_DEFAULT_TSK_STACK_SIZE)
     
    -#define SYSTEM_BLANK_FRAME_WIDTH            (1920+32)
    -#define SYSTEM_BLANK_FRAME_HEIGHT           (1080+24)
    -
    -#define SYSTEM_BLANK_FRAME_BYTES_PER_PIXEL  (2)
    -
    -#define SYSTEM_BLANK_FRAME_SIZE (SYSTEM_BLANK_FRAME_WIDTH*SYSTEM_BLANK_FRAME_HEIGHT*SYSTEM_BLANK_FRAME_BYTES_PER_PIXEL)
    -
     typedef struct {
         Vps_CaptRtParams captureRtParams;
         UInt32 captureChannelNum;
    @@ -225,7 +218,7 @@ typedef struct {
         System_LinkObj linkObj[SYSTEM_LINK_ID_MAX];
     
         volatile Bool haltExecution;
    -
    +    Bool shutdown;
     } System_CommonObj;
     
     
    @@ -311,6 +304,11 @@ Int32 System_start(Task_FuncPtr chainsMainFunc);
     Int32 System_initIss();
     Int32 System_deInitIss();
     Int32 System_setVcopBoostMode(Bool enable);
    +Void System_delete();
    +Void System_stop();
    +Void System_setShutdownFlag();
    +Void System_clearShutdownFlag();
    +Bool System_getShutdownFlag();
     
     
     #endif
    diff --git a/mcfw/src_bios6/links_m3video/system/systemLink_tsk_m3video.c b/mcfw/src_bios6/links_m3video/system/systemLink_tsk_m3video.c
    index 8a247b9..5748509 100755
    --- a/mcfw/src_bios6/links_m3video/system/systemLink_tsk_m3video.c
    +++ b/mcfw/src_bios6/links_m3video/system/systemLink_tsk_m3video.c
    @@ -14,13 +14,20 @@
     UInt8 gSystemLink_tskStack[SYSTEM_TSK_STACK_SIZE];
     
     SystemLink_Obj                gSystemLink_obj;
    -
     Int32 SystemLink_cmdHandler(SystemLink_Obj * pObj, UInt32 cmd, Void * pPrm)
     {
         Int32 status = FVID2_SOK;
     
         switch (cmd)
         {
    +        case SYSTEM_COMMON_CMD_STOP_ALL_LINKS:
    +            System_stop();    
    +            break;
    +
    +        case SYSTEM_COMMON_CMD_DELETE_ALL_LINKS:
    +            System_setShutdownFlag();
    +            break;
    +
             case SYSTEM_COMMON_CMD_CPU_LOAD_CALC_START:
                 Utils_prfLoadCalcStart();
                 break;
    diff --git a/mcfw/src_bios6/links_m3vpss/system/systemLink_tsk_m3vpss.c b/mcfw/src_bios6/links_m3vpss/system/systemLink_tsk_m3vpss.c
    index 9ed0ba5..50a6477 100755
    --- a/mcfw/src_bios6/links_m3vpss/system/systemLink_tsk_m3vpss.c
    +++ b/mcfw/src_bios6/links_m3vpss/system/systemLink_tsk_m3vpss.c
    @@ -25,7 +25,18 @@ Int32 SystemLink_cmdHandler(SystemLink_Obj * pObj, UInt32 cmd, Void * pPrm)
     
         switch (cmd)
         {
    - 
    +        case SYSTEM_COMMON_CMD_STOP_ALL_LINKS:
    +        {
    +            System_stop();    
    +        }
    +            break;
    +
    +        case SYSTEM_COMMON_CMD_DELETE_ALL_LINKS:
    +        {
    +            System_setShutdownFlag();
    +        }
    +            break;
    +
             case SYSTEM_M3VPSS_CMD_GET_PLATFORM_INFO:
             {
                 SystemVpss_PlatformInfo *prm = (SystemVpss_PlatformInfo *) pPrm;
    @@ -247,13 +258,6 @@ Int32 SystemLink_cmdHandler(SystemLink_Obj * pObj, UInt32 cmd, Void * pPrm)
             case SYSTEM_COMMON_CMD_CORE_STATUS:
                 Vps_printf(" %d: Core is active\n",Utils_getCurTimeInMsec());
                 break;
    -
    -        case SYSTEM_COMMON_CMD_GET_BLANK_FRAME:
    -        {
    -            SystemCommon_BlankFrame *blankFrame = (SystemCommon_BlankFrame *)pPrm;
    -            status = System_getBlankFrame((FVID2_Frame *)blankFrame->frame);
    -        }
    -            break;
             default:
                 break;
         }
    diff --git a/mcfw/src_bios6/main_app/src/main_c6xdsp.c b/mcfw/src_bios6/main_app/src/main_c6xdsp.c
    index 1628cc5..636cfb8 100755
    --- a/mcfw/src_bios6/main_app/src/main_c6xdsp.c
    +++ b/mcfw/src_bios6/main_app/src/main_c6xdsp.c
    @@ -22,6 +22,11 @@ Void C6XDSP_main(UArg arg0, UArg arg1)
             Utils_getChar(&ch, BIOS_NO_WAIT);
             if (ch == 'x')
                 break;
    +        if(System_getShutdownFlag() == TRUE)
    +        {
    +           System_delete();
    +           System_clearShutdownFlag();
    +        }
         }
     }
     int main(void)
    diff --git a/mcfw/src_bios6/main_app/src/main_m3video.c b/mcfw/src_bios6/main_app/src/main_m3video.c
    index 8bf1646..4623dfa 100755
    --- a/mcfw/src_bios6/main_app/src/main_m3video.c
    +++ b/mcfw/src_bios6/main_app/src/main_m3video.c
    @@ -23,6 +23,11 @@ Void M3VIDEO_main(UArg arg0, UArg arg1)
             Utils_getChar(&ch, BIOS_NO_WAIT);
             if (ch == 'x')
                 break;
    +        if(System_getShutdownFlag() == TRUE)
    +        {
    +           System_delete();
    +           System_clearShutdownFlag();
    +        }
         }
     }
     int main(void)
    diff --git a/mcfw/src_bios6/main_app/src/main_m3vpss.c b/mcfw/src_bios6/main_app/src/main_m3vpss.c
    index cad1d40..f812111 100755
    --- a/mcfw/src_bios6/main_app/src/main_m3vpss.c
    +++ b/mcfw/src_bios6/main_app/src/main_m3vpss.c
    @@ -84,6 +84,11 @@ Void M3VPSS_main(UArg arg0, UArg arg1)
             Utils_getChar(&ch, BIOS_NO_WAIT);
             if (ch == 'x')
                 break;
    +        if(System_getShutdownFlag() == TRUE)
    +        {
    +           System_delete();
    +           System_clearShutdownFlag();
    +        }
         }
     }
     
    diff --git a/mcfw/src_linux/links/avsync/avsync.c b/mcfw/src_linux/links/avsync/avsync.c
    index b284368..e97c7a4 100755
    --- a/mcfw/src_linux/links/avsync/avsync.c
    +++ b/mcfw/src_linux/links/avsync/avsync.c
    @@ -34,6 +34,7 @@ AvsyncLinkHLOS_Obj gAvsyncLink_obj =
          .nsHandleCreate = NULL,
          .nsHandleGetHandle = NULL,
          .wallTimeBase  = 0,
    +     .deleteRtosLink = TRUE,
         };
     
     #define AVSYNC_GET_LOG_TBL_HANDLE()             (&(gAvsyncLink_obj.srObj->vidSyncLog[0]))
    @@ -929,16 +930,19 @@ Int32 AvsyncLink_init()
     
     Int32 AvsyncLink_deInit()
     {
    -    Int32 status;
    +    Int32 status = 0;
     
         avsync_deinit_hlos(&gAvsyncLink_obj);
    -    status =
    -    System_linkControl(SYSTEM_LINK_ID_AVSYNC,
    -                       AVSYNC_LINK_CMD_DEINIT,
    -                       NULL,
    -                       0,
    -                       TRUE);
    -    OSA_assert(status == 0);
    +    if(gAvsyncLink_obj.deleteRtosLink == TRUE)
    +    {
    +        status =
    +        System_linkControl(SYSTEM_LINK_ID_AVSYNC,
    +                           AVSYNC_LINK_CMD_DEINIT,
    +                           NULL,
    +                           0,
    +                           TRUE);
    +        OSA_assert(status == 0);
    +    }
     
         return status;
     }
    @@ -1837,3 +1841,8 @@ Void AvsyncLink_logIpcBitsOutTS(UInt32 chNum, UInt64 ts)
         (Void)ts;
     }
     #endif
    +
    +Void Avsync_setDeleteRTOSLinkFlag(Bool enable)
    +{
    +    gAvsyncLink_obj.deleteRtosLink = enable;
    +}
    diff --git a/mcfw/src_linux/links/avsync/avsync_priv.h b/mcfw/src_linux/links/avsync/avsync_priv.h
    index 55068b5..eba4523 100755
    --- a/mcfw/src_linux/links/avsync/avsync_priv.h
    +++ b/mcfw/src_linux/links/avsync/avsync_priv.h
    @@ -65,6 +65,7 @@ typedef struct AvsyncLinkHLOS_Obj
         UInt32            gateMPSrMemSize;
         SharedRegion_SRPtr srObjSrPtr;
         Avsync_SharedObj  *srObj;
    +    Bool              deleteRtosLink;
     } AvsyncLinkHLOS_Obj;
     
     #define AVSYNC_LOG_MAX_SLAVE_CHANNELS                        (32)
    diff --git a/mcfw/src_linux/links/system/system_common.c b/mcfw/src_linux/links/system/system_common.c
    index 39a1f0b..49c422d 100755
    --- a/mcfw/src_linux/links/system/system_common.c
    +++ b/mcfw/src_linux/links/system/system_common.c
    @@ -120,3 +120,44 @@ Int32 System_deInit()
         return OSA_SOK;
     }
     
    +Void System_stop()
    +{
    +    UInt32 linkId, selfProcId, systemLinkId;
    +    OSA_TskHndl *pTsk;
    +      
    +    selfProcId = System_getSelfProcId();
    +    
    +    for(linkId = 0 ; linkId < (SYSTEM_LINK_ID_MAX - 1) ; linkId++)
    +    {
    +        pTsk = System_getLinkTskHndl(linkId);
    +        /*Check if the task is registered*/
    +        if(pTsk != NULL)
    +        {
    +            systemLinkId = SYSTEM_MAKE_LINK_ID(selfProcId, linkId);
    +
    +            System_linkStop(systemLinkId);
    +        }
    +    }
    +}
    +
    +Void System_delete()
    +{
    +    UInt32 linkId, selfProcId, systemLinkId;
    +    OSA_TskHndl *pTsk;
    +      
    +    selfProcId = System_getSelfProcId();
    +    
    +    for(linkId = 0 ; linkId < (SYSTEM_LINK_ID_MAX - 1) ; linkId++)
    +    {
    +        pTsk = System_getLinkTskHndl(linkId);
    +        
    +        /*Check if the task is registered*/
    +        if(pTsk != NULL)
    +        { 
    +            systemLinkId = SYSTEM_MAKE_LINK_ID(selfProcId, linkId);
    +
    +            System_linkDelete(systemLinkId);
    +        }
    +    }
    +}
    +
    diff --git a/mcfw/src_linux/links/system/system_ipc.c b/mcfw/src_linux/links/system/system_ipc.c
    index 12a395f..aaf78b0 100755
    --- a/mcfw/src_linux/links/system/system_ipc.c
    +++ b/mcfw/src_linux/links/system/system_ipc.c
    @@ -10,9 +10,23 @@
     #include "system_priv_ipc.h"
     #include <mcfw/interfaces/link_api/ipcLink.h>
     #include <ti/syslink/SysLink.h>
    -#include <ti/syslink/ProcMgr.h>
    -
    -System_IpcObj gSystem_ipcObj;
    +#include <sys/types.h>
    +#include <stdio.h>
    +#include <ti/syslink/inc/IpcDrvDefs.h>
    +#include <stdlib.h>
    +#include <stdio.h>
    +#include <unistd.h>
    +#include <errno.h>
    +#include <sys/ioctl.h>
    +#include <sys/stat.h>
    +#include <sys/mman.h>
    +#include <fcntl.h>
    +#include <string.h>
    +
    +System_IpcObj gSystem_ipcObj = 
    +{
    +  .deleteSyslinkOnExit = TRUE
    +};
     
     
     Int32 System_printProcId(UInt32 procId)
    @@ -65,6 +79,14 @@ Int32 System_ipcInit()
         printf(" %u: SYSTEM: IPC init in progress !!!\n", OSA_getCurTimeInMsec());
     
         SysLink_setup ();
    +    
    +    /*Open Ipc Handle*/
    +    gSystem_ipcObj.ipcHandle =  open("/dev/syslinkipc_Ipc",O_SYNC | O_RDWR);
    +    if(gSystem_ipcObj.ipcHandle < 0)
    +    {
    +        printf(" %u: SYSTEM: Ipc handle open failed\n",OSA_getCurTimeInMsec());
    +    }
    +    
         system_ipc_reset_srheaps();
     
         {
    @@ -95,7 +117,11 @@ Int32 System_ipcDeInit()
     
         system_ipc_reset_srheaps();
     
    -    SysLink_destroy ();
    +    if(gSystem_ipcObj.deleteSyslinkOnExit == TRUE)
    +    {
    +        close(gSystem_ipcObj.ipcHandle);
    +        SysLink_destroy ();
    +    }
     
         printf(" %u: SYSTEM: IPC de-init DONE !!!\n", OSA_getCurTimeInMsec());
     
    @@ -156,3 +182,44 @@ Int32 System_ipcCopySlaveCoreSymbolContents(char *symbolName,
     
         return status;
     }
    +
    +
    +Int32 System_ipcSetDeleteSyslinkOnExitFlag(Bool enable)
    +{
    +    gSystem_ipcObj.deleteSyslinkOnExit = enable;
    +    
    +    return OSA_SOK;
    +}
    +
    +Int32 System_ipcRegisterTerminateHandler()
    +{
    +    Int32 status = OSA_SOK;
    +    IpcDrv_CmdArgs cmdArgs;
    +
    +    cmdArgs.args.addTermEvent.pid = getpid();
    +    cmdArgs.args.addTermEvent.payload = 0xff;
    +    cmdArgs.args.addTermEvent.policy = Ipc_TERMINATEPOLICY_NOTIFY;
    +    
    +    cmdArgs.args.addTermEvent.procId = SYSTEM_PROC_DSP;
    +    status =  ioctl(gSystem_ipcObj.ipcHandle,CMD_IPC_ADDTERMINATEEVENT, &cmdArgs);
    +    if(status < 0)
    +    {
    +        printf(" %u: SYSTEM: Add termination event failed on %s !!!\n", OSA_getCurTimeInMsec(),SYSTEM_IPC_PROC_NAME_DSP);
    +    }
    +    
    +    cmdArgs.args.addTermEvent.procId = SYSTEM_PROC_M3VIDEO;
    +    status =  ioctl(gSystem_ipcObj.ipcHandle,CMD_IPC_ADDTERMINATEEVENT, &cmdArgs);
    +    if(status < 0)
    +    {
    +        printf(" %u: SYSTEM: Add termination event failed on %s !!!\n", OSA_getCurTimeInMsec(),SYSTEM_IPC_PROC_NAME_M3VIDEO);
    +    }
    +
    +    cmdArgs.args.addTermEvent.procId = SYSTEM_PROC_M3VPSS;
    +    status =  ioctl(gSystem_ipcObj.ipcHandle,CMD_IPC_ADDTERMINATEEVENT, &cmdArgs);
    +    if(status < 0)
    +    {
    +        printf(" %u: SYSTEM: Add termination event failed on %s !!!\n", OSA_getCurTimeInMsec(),SYSTEM_IPC_PROC_NAME_M3VPSS);
    +    }
    +
    +    return status;
    +}
    diff --git a/mcfw/src_linux/links/system/system_priv_common.h b/mcfw/src_linux/links/system/system_priv_common.h
    index a0c7435..9d340fe 100755
    --- a/mcfw/src_linux/links/system/system_priv_common.h
    +++ b/mcfw/src_linux/links/system/system_priv_common.h
    @@ -77,5 +77,7 @@ Int32 System_linkControl_remote(UInt32 linkId, UInt32 cmd, Void *pPrm, UInt32 pr
     
     Int32 SystemLink_init();
     Int32 SystemLink_deInit();
    +Void System_delete();
    +Void System_stop();
     
     #endif
    diff --git a/mcfw/src_linux/links/system/system_priv_ipc.h b/mcfw/src_linux/links/system/system_priv_ipc.h
    index 326bdad..e3abf7a 100755
    --- a/mcfw/src_linux/links/system/system_priv_ipc.h
    +++ b/mcfw/src_linux/links/system/system_priv_ipc.h
    @@ -39,7 +39,8 @@ typedef struct {
     
         Bool             msgQTaskExit;
         Bool             msgQTaskExitDone;
    -
    +    Bool             deleteSyslinkOnExit;
    +    Int32            ipcHandle;
     } System_IpcObj;
     
     extern System_IpcObj gSystem_ipcObj;
    @@ -61,17 +62,11 @@ Int32 System_ipcSendNotify(UInt32 linkId);
     
     Int32 System_ipcListMPReset(ListMP_Handle pOutHndl, ListMP_Handle pInHndl);
     Int32 System_ipcListMPCreate(UInt32 regionId, UInt32 linkId, ListMP_Handle *pOutHndl, ListMP_Handle *pInHndl,
    -                             GateMP_Handle * pOutHndleGate, GateMP_Handle * pInHndleGate,
    -                             void **outHandleListMPMem,UInt32 *outListMPAllocSize,
    -                             void **inHandleListMPMem,UInt32 *inListMPAllocSize);
    +                             GateMP_Handle * pOutHndleGate, GateMP_Handle * pInHndleGate);
     Int32 System_ipcListMPOpen(UInt32 linkId, ListMP_Handle *pOutHndl, ListMP_Handle *pInHndl);
     Int32 System_ipcListMPClose(ListMP_Handle *pOutHndl, ListMP_Handle *pInHndl);
     Int32 System_ipcListMPDelete(ListMP_Handle *pOutHndl, ListMP_Handle *pInHndl,
    -                            GateMP_Handle * pOutHndleGate, GateMP_Handle * pInHndleGate,
    -                            void *outHandleListMPMem,
    -                            UInt32 outListMPAllocSize,
    -                            void *inHandleListMPMem,
    -                            UInt32 inListMPAllocSize);
    +                             GateMP_Handle * pOutHndleGate, GateMP_Handle * pInHndleGate);
     
     UInt32 System_ipcListMPAllocListElemMem(UInt32 regionId, UInt32 size);
     Int32 System_ipcListMPFreeListElemMem(UInt32 regionId, UInt32 shAddr, UInt32 size);
    @@ -84,5 +79,8 @@ Int32 System_ipcCopySlaveCoreSymbolContents(char *symbolName,
                                           Ptr  dstPtr,
                                           UInt32 copySize);
     IHeap_Handle System_ipcGetSRHeap(UInt32 srIndex);
    +Int32 System_ipcSetDeleteSyslinkOnExitFlag(Bool enable);
    +Int32 System_ipcRegisterTerminateHandler(Void);
    +
     
     #endif
    diff --git a/mcfw/src_linux/mcfw_api/ti_vdis.c b/mcfw/src_linux/mcfw_api/ti_vdis.c
    index c4e5514..3eaa5b7 100755
    --- a/mcfw/src_linux/mcfw_api/ti_vdis.c
    +++ b/mcfw/src_linux/mcfw_api/ti_vdis.c
    @@ -3824,3 +3824,7 @@ Int32 Vdis_setCprocConfig(int config)
         return status;
     }
     
    +Void Vdis_setAvsyncDeleteRTOSLinkFlag(Bool enable)
    +{
    +    Avsync_setDeleteRTOSLinkFlag(enable); 
    +}
    diff --git a/mcfw/src_linux/mcfw_api/ti_vsys.c b/mcfw/src_linux/mcfw_api/ti_vsys.c
    index 815706e..6bb19a6 100755
    --- a/mcfw/src_linux/mcfw_api/ti_vsys.c
    +++ b/mcfw/src_linux/mcfw_api/ti_vsys.c
    @@ -119,6 +119,7 @@ Int32 Vsys_init(VSYS_PARAMS_S * pContext)
             {
                 gVsysModuleContext.initDone = TRUE;
                 System_init();
    +            System_ipcRegisterTerminateHandler();
             }
         }
     
    @@ -805,3 +806,64 @@ Int32 Vsys_setIVAFreqVoltage(VSYS_IVA_FREQ_VOLTAGE_S *ivaFreqVoltageCmd)
         return ERROR_NONE;
     }
     
    +Int32 Vsys_enableDeleteSyslinkOnExit(Bool enable)
    +{
    +    Int32 status;
    +
    +    status = System_ipcSetDeleteSyslinkOnExitFlag(enable);
    +
    +    return ERROR_NONE;
    +}
    +
    +Int32 Vsys_registerTerminateHandler(Void)
    +{
    +    Int32 status;
    +
    +    status = System_ipcRegisterTerminateHandler();
    +
    +    return ERROR_NONE;
    +}
    +
    +Int32 Vsys_shutdownSlaveCores(Void)
    +{ 
    +    Int32 status;
    +
    +    if(gVsysModuleContext.initDone == TRUE)
    +    {
    +        status = System_linkControl(
    +                      SYSTEM_LINK_ID_M3VPSS,
    +                      SYSTEM_COMMON_CMD_STOP_ALL_LINKS,
    +                      NULL, 
    +                      0,
    +                      TRUE
    +                      );
    +
    +        status = System_linkControl(
    +                      SYSTEM_LINK_ID_M3VIDEO,
    +                      SYSTEM_COMMON_CMD_STOP_ALL_LINKS,
    +                      NULL,
    +                      0,
    +                      TRUE
    +                      );
    +
    +        status = System_linkControl(
    +                      SYSTEM_LINK_ID_DSP,
    +                      SYSTEM_COMMON_CMD_STOP_ALL_LINKS,
    +                      NULL,
    +                      0,
    +                      TRUE
    +                      );
    +    }
    +    return ERROR_NONE;
    +}
    +
    +Int32 Vsys_stopDeleteAllLinks(Void)
    +{
    +    if(gVsysModuleContext.initDone == TRUE)
    +    {
    +      System_stop();
    +      System_delete();
    +    }
    +  
    +    return ERROR_NONE;
    +}
    
     that can be used as reference to implement the same. Here changes are integrated into the default rdk demo app.

     

    Regards,

    Reshma