How to enable SysQual in ADKs which is currently not enabled in all TLS based ADKs?

 TLS Low power application is not enabled with SYS QUAL to reset whenever it hangs for specified amount of time.

Follow the steps below to enable the SYS QUAL on TLS application. SYS QUAL is disabled in TLS application.  Wherever the possible suspect of a hang, start the task monitor start and stop once it completes.

Example:

App_main_thread.c:

 

#if 1

PRIVATE VOID

App_SysQualInit();

#endif

 

/* Define the test threads.  */

PRIVATE VOID   

AppMainCtx_ThreadEntry(UINT32 ctx)

{

….

                /*Initialise SysQual*/

                                App_SysQualInit();

 

                /**< Handle events forever */

                while( TRUE )

                {

                                /**< wait on message queue */

                                GsnOsal_QueueGet( &appMainThreadMsgQueue, ( UINT8* )&msg,

                                                                                                                GSN_OSAL_WAIT_FOREVER );

                                /**< Process the message */

                                GsnSq_TaskMonitorStart(APP_CFG_SQ_MAIN_TASK_ID, msg.msgId);

                                AppSm_MsgProcess(pAppCtx, msg);

                                GsnSq_TaskMonitorStop(APP_CFG_SQ_MAIN_TASK_ID);

                }

}

 

#if 1

PRIVATE VOID

App_SysQualInit(APP_MAIN_CTX_T * pAppCtx)

{             

             GsnSq_Init();

                GsnSq_TaskMonitorRegister(APP_CFG_SQ_SOFT_TMR_TASK_ID,NULL, APP_CFG_SQ_TICKS_FOR_SOFT_TMR_TASK); 

                GsnSq_TaskMonitorRegister(APP_CFG_SQ_HI_RECV_TASK_ID, NULL,  APP_CFG_SQ_TICKS_FOR_HI_RECV_TASK);

                GsnSq_TaskMonitorRegister(APP_CFG_SQ_WDD_MSG_HDLR_TASK_ID, NULL, APP_CFG_SQ_TICKS_FOR_WDD_MSG_HDLR_TASK);

                GsnSq_TaskMonitorRegister(APP_CFG_SQ_IP_TASK_ID, NULL, APP_CFG_SQ_TICKS_FOR_IP_TASK);

                GsnSq_TaskMonitorRegister(APP_CFG_SQ_DHCPV4_TASK_ID, NULL,   APP_CFG_SQ_TICKS_FOR_DHCPV4_TASK);

                GsnSq_TaskMonitorRegister(APP_CFG_SQ_HTTPD_TASK_ID, NULL,      APP_CFG_SQ_TICKS_FOR_HTTPD_TASK);     

          

                GsnSq_TaskMonitorRegister(APP_CFG_SQ_MAIN_TASK_ID, NULL,        APP_CFG_SQ_TICKS_FOR_MAIN_TASK);

}

#endif

 

App_http_api.c;

 

GSN_HTTPD_STATUS_T

AppTls_HttpApiCb(ttHttpdUserEvent event, const char* uri, ttHttpdUserConHandle conHandle)

{

    INT32 respLen;

    int errorCode = TM_ENOERROR;

    UINT32 bufferLen;

                APP_MAIN_CTX_T *pAppCtx = globalAppCtxPtr;

    INT8  *buffer = GsnHttpd_GetBuffer();

                INT8 *pPostBody;

    HTTPD_DEBUG_PRINT(("[TLSApp:HTTPApi] Got callback\r\n"));

 

    if (GsnHttpd_GetHttpMethod(conHandle) == TM_HTTP_METHOD_POST)

    {

        //sprintf(buffer, "<error>POST not allowed</error>");

        //GsnHttpd_SendBufferAndLastChunk(conHandle, buffer, strlen(buffer), TM_BLOCKING_ON, &errorCode);

        //return GSN_HTTPD_SUCCESS;

    }

 

    switch (event)

    {

        case TM_HTTPD_EVENT_METHOD_LINE_RECV:

                …

                …

        case TM_HTTPD_EVENT_SEND_READY:

            respLen = AppTls_CreateXmlResp(pAppCtx, buffer, conHandle);

            GsnSq_TaskMonitorStart(APP_CFG_SQ_HTTPD_TASK_ID,0);

 

while (1);                                                            ß Just to demo the SYS QUAL reset , EVERY 30 seconds system resets.

            GsnHttpd_SendBufferAndLastChunk(conHandle, buffer, respLen, TM_BLOCKING_ON,       &errorCode);

                GsnSq_TaskMonitorStop(APP_CFG_SQ_HTTPD_TASK_ID);

            break;

}

}

App_resource_config.h:

#define APP_CFG_SQ_TICKS_FOR_SOFT_TMR_TASK                    30

#define APP_CFG_SQ_TICKS_FOR_HI_RECV_TASK                        30

#define APP_CFG_SQ_TICKS_FOR_WDD_MSG_HDLR_TASK         30

#define APP_CFG_SQ_TICKS_FOR_IP_TASK                                  30

 

#define APP_CFG_SQ_TICKS_FOR_DHCPV4_TASK                        30

#define APP_CFG_SQ_TICKS_FOR_HTTPD_TASK                           30

#define APP_CFG_SQ_TICKS_FOR_MAIN_TASK                             30

#define APP_CFG_SQ_TICKS_FOR_MAIN_TASK_WPS                    184

 

 

 

Powered by Zendesk