/*
 * SHMIODataSync.c
 *
 *  Created on: Nov 16, 2025
 *      Author: tummalanr
 */


#include "FreeRTOS.h"
#include "event_groups.h"
#include "queue.h"

#include <kernel/dpl/DebugP.h>
#include "AppGlobal.h"
#include "ShmDataSyncExterns.h"


/*!
 *  <!-- Description: -->
 *
 *  \brief
 *          This Function is used for Updating the DI Modules Acyclic Parameter Data in Shared Memory.
 *
 *  <!-- Parameters and return values: -->
 *  \param[in]      posno        -    Position No of DI Module.
 *                  paramid      -    Specifies the  ParameterId as in IO_FeatureParamId
 *                  paramwrdata  -    Parameter Data as in usdorwdata
 *  \return     AppRET_T    -
 *                              AppRET_OK       : Success.
 *                              AppSHMUpdateErr : Failure.
 */
AppRET_T    DI_Acyclic_ParamShmUpdate(uint8_t posno, IO_FeatureParamId paramid, usdorwdata  paramwrdata)
{
    AppRET_T sts = AppSHMUpdateErr;

    sts = io_sharemem_acycliclock();
    if(sts != AppRET_OK) {
        return AppSHMUpdateErr;
    }

        switch(paramid)
        {
            case    IOBckpln_Iden_DeviceType:
                                    IOAcyclic_Inst_x[posno].diserviceobj.identinfo.DeviceType = paramwrdata.fourbyte;
                                    break;
            case    IOBckpln_Iden_VendorName:
                                    strncpy((char *)&IOAcyclic_Inst_x[posno].diserviceobj.identinfo.VendorName[0], (char *)&paramwrdata.str[0],STR_MAX_LEN);
                                    break;
            case    IOIOBckpln_Iden_VendorId:
                                    IOAcyclic_Inst_x[posno].diserviceobj.identinfo.VendorID = paramwrdata.fourbyte;
                                    break;
            case    IOBckpln_Iden_DeviceName:
                                    strncpy((char *)&IOAcyclic_Inst_x[posno].diserviceobj.identinfo.DeviceName[0], (char *)&paramwrdata.str[0],STR_MAX_LEN);
                                    break;
            case    IOBckpln_Iden_DeviceId:
                                    IOAcyclic_Inst_x[posno].diserviceobj.identinfo.DeviceID = paramwrdata.fourbyte;
                                    break;
            case    IOBckpln_Iden_VariantId:
                                    strncpy((char *)&IOAcyclic_Inst_x[posno].diserviceobj.identinfo.VariantID[0], (char *)&paramwrdata.str[0],STR_MAX_LEN);
                                    break;
            case    IOBckpln_Iden_HWRev:
                                    strncpy((char *)&IOAcyclic_Inst_x[posno].diserviceobj.identinfo.HWRev[0], (char *)&paramwrdata.str[0],STR_MAX_LEN);
                                    break;
            case    IOBckpln_Iden_SerialNo:
                                    strncpy((char *)&IOAcyclic_Inst_x[posno].diserviceobj.identinfo.SlNo[0], (char *)&paramwrdata.str[0],STR_MAX_LEN);
                                    break;
            case    IOBckpln_Iden_SWPartNo:
                                    strncpy((char *)&IOAcyclic_Inst_x[posno].diserviceobj.identinfo.SWPartNo[0], (char *)&paramwrdata.str[0],STR_MAX_LEN);
                                    break;
            case    IOBckpln_Iden_SWRev:
                                    strncpy((char *)&IOAcyclic_Inst_x[posno].diserviceobj.identinfo.SWRev[0], (char *)&paramwrdata.str[0],STR_MAX_LEN);
                                    break;
            case    IO_PostErrStatus:
                                    IOAcyclic_Inst_x[posno].diserviceobj.posterrsts = paramwrdata.fourbyte;
                                    break;
            case    IO_VA_Voltage:
                                    IOAcyclic_Inst_x[posno].diserviceobj.VAVBVoltage[0u] = paramwrdata.fourbyte;
                                    break;
            case    IO_VB_Voltage:
                                    IOAcyclic_Inst_x[posno].diserviceobj.VAVBVoltage[1u] = paramwrdata.fourbyte;
                                    break;
            case    IO_OperatingMins:
                                    IOAcyclic_Inst_x[posno].diserviceobj.opertiontimemin = paramwrdata.twobyte;
                                    break;
            case    IO_OperatingHours:
                                    IOAcyclic_Inst_x[posno].diserviceobj.opertiontimehr = paramwrdata.fourbyte;
                                    break;
            case    IO_ModuleMinTemperature:
                                    IOAcyclic_Inst_x[posno].diserviceobj.mintemperature = (int16_t)paramwrdata.twobyte;
                                    break;
            case    IO_ModuleMaxTemperature:
                                    IOAcyclic_Inst_x[posno].diserviceobj.maxtemperature = (int16_t)paramwrdata.twobyte;
                                    break;
            case    IO_ModuleMesrdTemperature:
                                    IOAcyclic_Inst_x[posno].diserviceobj.measuredtemperature = (int16_t)paramwrdata.twobyte;
                                    break;
            case    IO_AUXSUPLOVRVOLRECYEN:
                                    IOAcyclic_Inst_x[posno].diserviceobj.auxsuplOVRVoltageRecyEn = paramwrdata.onebyte;
                                    break;
            case    IO_AUXSUPLUNDVOLRECYEN:
                                    IOAcyclic_Inst_x[posno].diserviceobj.auxsuplUNDVoltageRecyEn = paramwrdata.onebyte;
                                    break;
            case    IO_MEMLIFECYCLE:
                                    IOAcyclic_Inst_x[posno].diserviceobj.memorylifecycle = paramwrdata.fourbyte;
                                    break;
            case    IO_EDS_VERSION:
                                    strncpy((char *)&IOAcyclic_Inst_x[posno].diserviceobj.edsverno[0], (char *)&paramwrdata.str[0],STR_MAX_LEN);
                                    break;
            case    IO_EDS_DATE:
                                    strncpy((char *)&IOAcyclic_Inst_x[posno].diserviceobj.edsverdate[0], (char *)&paramwrdata.str[0],STR_MAX_LEN);
                                    break;
            case    DI_DEBOUNCEDUR1:
            case    DI_DEBOUNCEDUR2:
            case    DI_DEBOUNCEDUR3:
            case    DI_DEBOUNCEDUR4:
            case    DI_DEBOUNCEDUR5:
            case    DI_DEBOUNCEDUR6:
            case    DI_DEBOUNCEDUR7:
            case    DI_DEBOUNCEDUR8:
                                    IOAcyclic_Inst_x[posno].diserviceobj.didebouncedur[paramid - DI_DEBOUNCEDUR1] = paramwrdata.onebyte;
                                    break;
            case    DI_HOLDDUR1:
            case    DI_HOLDDUR2:
            case    DI_HOLDDUR3:
            case    DI_HOLDDUR4:
            case    DI_HOLDDUR5:
            case    DI_HOLDDUR6:
            case    DI_HOLDDUR7:
            case    DI_HOLDDUR8:
                                    IOAcyclic_Inst_x[posno].diserviceobj.diholddur[paramid - DI_HOLDDUR1] = paramwrdata.onebyte;
                                    break;
            case    DI_LOGICINVERT:
                                    IOAcyclic_Inst_x[posno].diserviceobj.dilogicinvert = paramwrdata.onebyte;
                                    break;
            case    DI_FORCEENABLE:
                                    IOAcyclic_Inst_x[posno].diserviceobj.diforcemodeenable = paramwrdata.onebyte;
                                    break;
            case    DI_FORCESTATE:
                                    IOAcyclic_Inst_x[posno].diserviceobj.diforcemodestate = paramwrdata.onebyte;
                                    break;
            case    DI_INPUTTYPE1:
            //case    DI_INPUTTYPE2:
                                    IOAcyclic_Inst_x[posno].diserviceobj.diinputtype[paramid - DI_INPUTTYPE1]  = paramwrdata.onebyte;
                                    break;
            case    DI_SENSSUPLYEN:
                                    IOAcyclic_Inst_x[posno].diserviceobj.disensorsupplyenable = paramwrdata.onebyte;
                                    break;
            case    DI_SENSSUPLYSHRTCKTDIAGEN:
                                    IOAcyclic_Inst_x[posno].diserviceobj.disenssuplshrtcktdiagen = paramwrdata.onebyte;
                                    //DebugP_log("[CAN CORE] %s  paramid [%d] value[%#x]\r\n",__func__,paramid,paramwrdata.onebyte);
                                    break;
            case    DI_SENSSUPLYSHRTCKTRECYEN:
                                    IOAcyclic_Inst_x[posno].diserviceobj.disenssupshrtcktRecvydiagen = paramwrdata.onebyte;
                                    //DebugP_log("[CAN CORE] %s  paramid [%d] value[%#x]\r\n",__func__,paramid,paramwrdata.onebyte);
                                    break;
            case    DI_MODULEENABLE:
                                    IOAcyclic_Inst_x[posno].diserviceobj.moduleenable = paramwrdata.onebyte;
                                    break;
            case    DI_CHANNELSENABLE:
                                    IOAcyclic_Inst_x[posno].diserviceobj.channelsenable = paramwrdata.onebyte;
                                    break;
            case    DI_ERRSTATUSCHNL1:
            case    DI_ERRSTATUSCHNL2:
            case    DI_ERRSTATUSCHNL3:
            case    DI_ERRSTATUSCHNL4:
            case    DI_ERRSTATUSCHNL5:
            case    DI_ERRSTATUSCHNL6:
            case    DI_ERRSTATUSCHNL7:
            case    DI_ERRSTATUSCHNL8:
                                    IOAcyclic_Inst_x[posno].diserviceobj.dierrsts[paramid - DI_ERRSTATUSCHNL1] = paramwrdata.twobyte;
                                    break;
            default:
                                    sts = AppSHMUpdateErr;
                                    break;
        }

        io_sharemem_acyclicunlock();

        //DebugP_log("[CAN] %s-  paramid [%d] posno[%d] sts[%d]\r\n",__func__,paramid,posno,sts);

    return AppRET_OK;
}

/*!
 *  <!-- Description: -->
 *
 *  \brief
 *          This Function is used for Updating the DO Modules Acyclic Parameter Data in Shared Memory.
 *
 *  <!-- Parameters and return values: -->
 *  \param[in]      posno        -    Position No of DO Module.
 *                  paramid      -    Specifies the  ParameterId as in IO_FeatureParamId
 *                  paramwrdata  -    Parameter Data as in usdorwdata
 *  \return     AppRET_T    -
 *                              AppRET_OK       : Success.
 *                              AppSHMUpdateErr : Failure.
 */
AppRET_T    DO_Acyclic_ParamShmUpdate(uint8_t posno, IO_FeatureParamId paramid, usdorwdata  paramwrdata)
{
    AppRET_T sts = AppSHMUpdateErr;

    sts = io_sharemem_acycliclock();
    if(sts != AppRET_OK) {
        return sts;
    }
        switch(paramid)
        {
            case    IOBckpln_Iden_DeviceType:
                                    IOAcyclic_Inst_x[posno].doserviceobj.identinfo.DeviceType = paramwrdata.fourbyte;
                                    break;
            case    IOBckpln_Iden_VendorName:
                                    strncpy((char *)&IOAcyclic_Inst_x[posno].doserviceobj.identinfo.VendorName[0], (char *)&paramwrdata.str[0],STR_MAX_LEN);
                                    break;
            case    IOIOBckpln_Iden_VendorId:
                                    IOAcyclic_Inst_x[posno].doserviceobj.identinfo.VendorID = paramwrdata.fourbyte;
                                    break;
            case    IOBckpln_Iden_DeviceName:
                                    //DebugP_log("[CAN] %s DeviceName[%-16.16s] [%-16.16s]\r\n",__func__, &IOAcyclic_Inst_x[posno].doserviceobj.identinfo.DeviceName[0],&paramwrdata.str[0]);
                                    strncpy((char *)&IOAcyclic_Inst_x[posno].doserviceobj.identinfo.DeviceName[0], (char *)&paramwrdata.str[0],STR_MAX_LEN);
                                    break;
            case    IOBckpln_Iden_DeviceId:
                                    IOAcyclic_Inst_x[posno].doserviceobj.identinfo.DeviceID = paramwrdata.fourbyte;
                                    break;
            case    IOBckpln_Iden_VariantId:
                                    //DebugP_log("[CAN] %s DeviceName[%-16.16s] [%-16.16s]\r\n",__func__, &IOAcyclic_Inst_x[posno].doserviceobj.identinfo.VariantID[0],&paramwrdata.str[0]);
                                    strncpy((char *)&IOAcyclic_Inst_x[posno].doserviceobj.identinfo.VariantID[0], (char *)&paramwrdata.str[0],STR_MAX_LEN);
                                    break;
            case    IOBckpln_Iden_HWRev:
                                    strncpy((char *)&IOAcyclic_Inst_x[posno].doserviceobj.identinfo.HWRev[0], (char *)&paramwrdata.str[0],STR_MAX_LEN);
                                    break;
            case    IOBckpln_Iden_SerialNo:
                                    strncpy((char *)&IOAcyclic_Inst_x[posno].doserviceobj.identinfo.SlNo[0], (char *)&paramwrdata.str[0],STR_MAX_LEN);
                                    break;
            case    IOBckpln_Iden_SWPartNo:
                                    strncpy((char *)&IOAcyclic_Inst_x[posno].doserviceobj.identinfo.SWPartNo[0], (char *)&paramwrdata.str[0],STR_MAX_LEN);
                                    break;
            case    IOBckpln_Iden_SWRev:
                                    strncpy((char *)&IOAcyclic_Inst_x[posno].doserviceobj.identinfo.SWRev[0], (char *)&paramwrdata.str[0],STR_MAX_LEN);
                                    break;
            case    IO_PostErrStatus:
                                    IOAcyclic_Inst_x[posno].doserviceobj.posterrsts = paramwrdata.fourbyte;
                                    break;
            case    IO_VA_Voltage:
                                    IOAcyclic_Inst_x[posno].doserviceobj.VAVBVoltage[0u] = paramwrdata.fourbyte;
                                    break;
            case    IO_VB_Voltage:
                                    IOAcyclic_Inst_x[posno].doserviceobj.VAVBVoltage[1u] = paramwrdata.fourbyte;
                                    break;
            case    IO_OperatingHours:
                                    IOAcyclic_Inst_x[posno].doserviceobj.opertiontimehr = paramwrdata.fourbyte;
                                    break;
            case    IO_OperatingMins:
                                    IOAcyclic_Inst_x[posno].doserviceobj.opertiontimemin = paramwrdata.twobyte;
                                    break;
            case    IO_ModuleMinTemperature:
                                    IOAcyclic_Inst_x[posno].doserviceobj.mintemperature = (int16_t)paramwrdata.twobyte;
                                    break;
            case    IO_ModuleMaxTemperature:
                                    IOAcyclic_Inst_x[posno].doserviceobj.maxtemperature = (int16_t)paramwrdata.twobyte;
                                    break;
            case    IO_ModuleMesrdTemperature:
                                    IOAcyclic_Inst_x[posno].doserviceobj.measuredtemperature = (int16_t)paramwrdata.twobyte;
                                    break;
            case    IO_AUXSUPLOVRVOLRECYEN:
                                    IOAcyclic_Inst_x[posno].doserviceobj.auxsuplOVRVoltageRecyEn = paramwrdata.onebyte;
                                    break;
            case    IO_AUXSUPLUNDVOLRECYEN:
                                    IOAcyclic_Inst_x[posno].doserviceobj.auxsuplUNDVoltageRecyEn = paramwrdata.onebyte;
                                    break;
            case    IO_MEMLIFECYCLE:
                                    IOAcyclic_Inst_x[posno].doserviceobj.memorylifecycle = paramwrdata.fourbyte;
                                    break;
            case    IO_EDS_VERSION:
                                    strncpy((char *)&IOAcyclic_Inst_x[posno].doserviceobj.edsverno[0], (char *)&paramwrdata.str[0],STR_MAX_LEN);
                                    break;
            case    IO_EDS_DATE:
                                    strncpy((char *)&IOAcyclic_Inst_x[posno].doserviceobj.edsverdate[0], (char *)&paramwrdata.str[0],STR_MAX_LEN);
                                    break;


            //case    IO_CHNLINPUTERRORSTATUS:
                                   // IOAcyclic_Inst_x[posno].diserviceobj. = paramwrdata.fourbyte;
                                    //break;
            //case    IO_AUXSUPLOVRVOLRECYEN:
                                    //IOAcyclic_Inst_x[posno].diserviceobj. = paramwrdata.onebyte;
                                    //break;
//DO parameters
            case    DO_BUSFAULTEN:
                                    IOAcyclic_Inst_x[posno].doserviceobj.dobusfaultenable = paramwrdata.onebyte;
                                    break;
            case    DO_BUSFAULTSTATE:
                                    IOAcyclic_Inst_x[posno].doserviceobj.dobusfaultstate = paramwrdata.onebyte;
                                    break;
            case    DO_FORCEENABLE:
                                    IOAcyclic_Inst_x[posno].doserviceobj.doforcemodeenable = paramwrdata.onebyte;
                                    break;
            case    DO_FORCESTATE:
                                    IOAcyclic_Inst_x[posno].doserviceobj.doforcemodestate = paramwrdata.onebyte;
                                    break;
            case    DO_CHNLIDLEENABLE:
                                    IOAcyclic_Inst_x[posno].doserviceobj.doidlemodeenable = paramwrdata.onebyte;
                                    break;
            case    DO_IDLESTATE:
                                    IOAcyclic_Inst_x[posno].doserviceobj.doidlemodestate = paramwrdata.onebyte;
                                    break;
            //case    DO_IDLEENABLE:
                                    //IOAcyclic_Inst_x[posno].doserviceobj.domoduleidlemodeenable = paramwrdata.onebyte;
                                    //break;
            case    DO_OUTPUTSHRTCKTRECYEN:
                                    IOAcyclic_Inst_x[posno].doserviceobj.dooutputshrtcktrecvyen = paramwrdata.onebyte;
                                    break;
            case    DO_MODULEENABLE:
                                    IOAcyclic_Inst_x[posno].doserviceobj.moduleenable = paramwrdata.onebyte;
                                    //DebugP_log("[CAN] %s  instno[%d]MODENBL[%d][%d]\r\n",__func__,posno,IOAcyclic_Inst_x[posno].doserviceobj.moduleenable, paramwrdata.onebyte);
                                    break;
            case    DO_CHANNELSENABLE:
                                    IOAcyclic_Inst_x[posno].doserviceobj.channelsenable = paramwrdata.onebyte;
                                    break;
            case    DO_ERRSTATUSCHNL1:
            case    DO_ERRSTATUSCHNL2:
            case    DO_ERRSTATUSCHNL3:
            case    DO_ERRSTATUSCHNL4:
            case    DO_ERRSTATUSCHNL5:
            case    DO_ERRSTATUSCHNL6:
            case    DO_ERRSTATUSCHNL7:
            case    DO_ERRSTATUSCHNL8:
                                    IOAcyclic_Inst_x[posno].doserviceobj.doerrsts[paramid - DO_ERRSTATUSCHNL1] = paramwrdata.twobyte;
                                    break;
            default:
                                    sts = AppSHMUpdateErr;
                                    break;
        }

        io_sharemem_acyclicunlock();

    return AppRET_OK;
}

/*!
 *  <!-- Description: -->
 *
 *  \brief
 *          This Function is used for Updating the DIO Modules Acyclic Parameter Data in Shared Memory.
 *
 *  <!-- Parameters and return values: -->
 *  \param[in]      posno        -    Position No of DIO Module.
 *                  paramid      -    Specifies the  ParameterId as in IO_FeatureParamId
 *                  paramwrdata  -    Parameter Data as in usdorwdata
 *  \return     AppRET_T    -
 *                              AppRET_OK       : Success.
 *                              AppSHMUpdateErr : Failure.
 */
AppRET_T    DIO_Acyclic_ParamShmUpdate(uint8_t posno, IO_FeatureParamId paramid, usdorwdata  paramwrdata)
{
    AppRET_T sts = AppSHMUpdateErr;

    sts = io_sharemem_acycliclock();
    if(sts != AppRET_OK) {
        return sts;
    }
        switch(paramid)
        {
            case    IOBckpln_Iden_DeviceType:
                                    IOAcyclic_Inst_x[posno].dioserviceobj.identinfo.DeviceType = paramwrdata.fourbyte;
                                    //DebugP_log("%s posno[%d] DeviceType[%#x]\r\n",__func__,posno,IOAcyclic_Inst_x[posno].dioserviceobj.identinfo.DeviceType);
                                    break;
            case    IOBckpln_Iden_VendorName:
                                    strncpy((char *)&IOAcyclic_Inst_x[posno].dioserviceobj.identinfo.VendorName[0], (char *)&paramwrdata.str[0],STR_MAX_LEN);
                                   // DebugP_log("%s posno[%d] VendorName[%-16.16s]\r\n",__func__,posno,IOAcyclic_Inst_x[posno].dioserviceobj.identinfo.VendorName);
                                    break;
            case    IOIOBckpln_Iden_VendorId:
                                    IOAcyclic_Inst_x[posno].dioserviceobj.identinfo.VendorID = paramwrdata.fourbyte;
                                    //DebugP_log("%s posno[%d] VendorID[%#x]\r\n",__func__,posno,IOAcyclic_Inst_x[posno].dioserviceobj.identinfo.VendorID);
                                    break;
            case    IOBckpln_Iden_DeviceName:
                                    strncpy((char *)&IOAcyclic_Inst_x[posno].dioserviceobj.identinfo.DeviceName[0], (char *)&paramwrdata.str[0],STR_MAX_LEN);
                                    //DebugP_log("%s posno[%d] DeviceName[%-16.16s]\r\n",__func__,posno,IOAcyclic_Inst_x[posno].dioserviceobj.identinfo.DeviceName);
                                    break;
            case    IOBckpln_Iden_DeviceId:
                                    IOAcyclic_Inst_x[posno].dioserviceobj.identinfo.DeviceID = paramwrdata.fourbyte;
                                    //DebugP_log("%s posno[%d] DeviceID[%#x]\r\n",__func__,posno,IOAcyclic_Inst_x[posno].dioserviceobj.identinfo.DeviceID);
                                    break;
            case    IOBckpln_Iden_VariantId:
                                    strncpy((char *)&IOAcyclic_Inst_x[posno].dioserviceobj.identinfo.VariantID[0], (char *)&paramwrdata.str[0],STR_MAX_LEN);
                                    //DebugP_log("%s posno[%d] VariantID[%-16.16s]\r\n",__func__,posno,IOAcyclic_Inst_x[posno].dioserviceobj.identinfo.VariantID);
                                    break;
            case    IOBckpln_Iden_HWRev:
                                    strncpy((char *)&IOAcyclic_Inst_x[posno].dioserviceobj.identinfo.HWRev[0], (char *)&paramwrdata.str[0],STR_MAX_LEN);
                                    //DebugP_log("%s posno[%d] HWRev[%-16.16s]\r\n",__func__,posno,IOAcyclic_Inst_x[posno].dioserviceobj.identinfo.HWRev);
                                    break;
            case    IOBckpln_Iden_SerialNo:
                                    strncpy((char *)&IOAcyclic_Inst_x[posno].dioserviceobj.identinfo.SlNo[0], (char *)&paramwrdata.str[0],STR_MAX_LEN);
                                    //DebugP_log("%s posno[%d] SlNo[%-16.16s]\r\n",__func__,posno,IOAcyclic_Inst_x[posno].dioserviceobj.identinfo.SlNo);
                                    break;
            case    IOBckpln_Iden_SWPartNo:
                                    strncpy((char *)&IOAcyclic_Inst_x[posno].dioserviceobj.identinfo.SWPartNo[0], (char *)&paramwrdata.str[0],STR_MAX_LEN);
                                    //DebugP_log("%s posno[%d] SWPartNo[%-16.16s]\r\n",__func__,posno,IOAcyclic_Inst_x[posno].dioserviceobj.identinfo.SWPartNo);
                                    break;
            case    IOBckpln_Iden_SWRev:
                                    strncpy((char *)&IOAcyclic_Inst_x[posno].dioserviceobj.identinfo.SWRev[0], (char *)&paramwrdata.str[0],STR_MAX_LEN);
                                    //DebugP_log("%s posno[%d] SWRev[%-16.16s]\r\n",__func__,posno,IOAcyclic_Inst_x[posno].dioserviceobj.identinfo.SWRev);
                                    break;
            case    IO_PostErrStatus:
                                    IOAcyclic_Inst_x[posno].dioserviceobj.posterrsts = paramwrdata.fourbyte;
                                    break;
            case    IO_VA_Voltage:
                                    IOAcyclic_Inst_x[posno].dioserviceobj.VAVBVoltage[0u] = paramwrdata.fourbyte;
                                    //DebugP_log("%s posno[%d] VAVoltage[%#x]\r\n",__func__,posno,IOAcyclic_Inst_x[posno].dioserviceobj.VAVBVoltage[0]);
                                    break;
            case    IO_VB_Voltage:
                                    IOAcyclic_Inst_x[posno].dioserviceobj.VAVBVoltage[1u] = paramwrdata.fourbyte;
                                    break;
            case    IO_OperatingHours:
                                    IOAcyclic_Inst_x[posno].dioserviceobj.opertiontimehr = paramwrdata.fourbyte;
                                    break;
            case    IO_OperatingMins:
                                    IOAcyclic_Inst_x[posno].dioserviceobj.opertiontimemin = paramwrdata.twobyte;
                                    break;
            case    IO_ModuleMinTemperature:
                                    IOAcyclic_Inst_x[posno].dioserviceobj.mintemperature = (int16_t)paramwrdata.twobyte;
                                    break;
            case    IO_ModuleMaxTemperature:
                                    IOAcyclic_Inst_x[posno].dioserviceobj.maxtemperature = (int16_t)paramwrdata.twobyte;
                                    break;
            case    IO_ModuleMesrdTemperature:
                                    IOAcyclic_Inst_x[posno].dioserviceobj.measuredtemperature = (int16_t)paramwrdata.twobyte;
                                    break;
            case    IO_AUXSUPLOVRVOLRECYEN:
                                    IOAcyclic_Inst_x[posno].dioserviceobj.auxsuplOVRVoltageRecyEn = paramwrdata.onebyte;
                                    break;
            case    IO_AUXSUPLUNDVOLRECYEN:
                                    IOAcyclic_Inst_x[posno].dioserviceobj.auxsuplUNDVoltageRecyEn = paramwrdata.onebyte;
                                    break;
            case    IO_MEMLIFECYCLE:
                                    IOAcyclic_Inst_x[posno].dioserviceobj.memorylifecycle = paramwrdata.fourbyte;
                                    break;
            case    IO_EDS_VERSION:
                                    strncpy((char *)&IOAcyclic_Inst_x[posno].dioserviceobj.edsverno[0], (char *)&paramwrdata.str[0],STR_MAX_LEN);
                                    break;
            case    IO_EDS_DATE:
                                    strncpy((char *)&IOAcyclic_Inst_x[posno].dioserviceobj.edsverdate[0], (char *)&paramwrdata.str[0],STR_MAX_LEN);
                                    break;
//DI parameters
            case    DI_DEBOUNCEDUR1:
            case    DI_DEBOUNCEDUR2:
            case    DI_DEBOUNCEDUR3:
            case    DI_DEBOUNCEDUR4:
            //case    DI_DEBOUNCEDUR5:
            //case    DI_DEBOUNCEDUR6:
            //case    DI_DEBOUNCEDUR7:
            //case    DI_DEBOUNCEDUR8:
                                    IOAcyclic_Inst_x[posno].dioserviceobj.didebouncedur[paramid - DI_DEBOUNCEDUR1] = paramwrdata.onebyte;
                                    break;
            case    DI_HOLDDUR1:
            case    DI_HOLDDUR2:
            case    DI_HOLDDUR3:
            case    DI_HOLDDUR4:
            //case    DI_HOLDDUR5:
            //case    DI_HOLDDUR6:
            //case    DI_HOLDDUR7:
            //case    DI_HOLDDUR8:
                                    IOAcyclic_Inst_x[posno].dioserviceobj.diholddur[paramid - DI_HOLDDUR1] = paramwrdata.onebyte;
                                    break;
            case    DI_LOGICINVERT:
                                    IOAcyclic_Inst_x[posno].dioserviceobj.dilogicinvert = paramwrdata.onebyte;
                                    break;
            case    DI_FORCEENABLE:
                                    IOAcyclic_Inst_x[posno].dioserviceobj.diforcemodeenable = paramwrdata.onebyte;
                                    break;
            case    DI_FORCESTATE:
                                    IOAcyclic_Inst_x[posno].dioserviceobj.diforcemodestate = paramwrdata.onebyte;
                                    break;
            case    DI_INPUTTYPE1:
            //case    DI_INPUTTYPE2:
                                    IOAcyclic_Inst_x[posno].dioserviceobj.diinputtype[paramid - DI_INPUTTYPE1]  = paramwrdata.onebyte;
                                    break;
            case    DI_SENSSUPLYEN:
                                    IOAcyclic_Inst_x[posno].dioserviceobj.disensorsupplyenable = paramwrdata.onebyte;
                                    break;
            case    DI_SENSSUPLYSHRTCKTDIAGEN:
                                    IOAcyclic_Inst_x[posno].dioserviceobj.disenssuplshrtcktdiagen = paramwrdata.onebyte;
                                    break;
            case    DI_SENSSUPLYSHRTCKTRECYEN:
                                    IOAcyclic_Inst_x[posno].dioserviceobj.disenssupshrtcktRecvydiagen = paramwrdata.onebyte;
                                    break;
            case    DI_MODULEENABLE:
                                    IOAcyclic_Inst_x[posno].dioserviceobj.moduleenable = paramwrdata.onebyte;
                                    break;
            case    DI_CHANNELSENABLE:
                                    IOAcyclic_Inst_x[posno].dioserviceobj.dichannelsenable = paramwrdata.onebyte;
                                    break;
            case    DI_ERRSTATUSCHNL1:
            case    DI_ERRSTATUSCHNL2:
            case    DI_ERRSTATUSCHNL3:
            case    DI_ERRSTATUSCHNL4:
            //case    DI_ERRSTATUSCHNL5:
            //case    DI_ERRSTATUSCHNL6:
            //case    DI_ERRSTATUSCHNL7:
            //case    DI_ERRSTATUSCHNL8:
                                    IOAcyclic_Inst_x[posno].dioserviceobj.dierrsts[paramid - DI_ERRSTATUSCHNL1] = paramwrdata.twobyte;
                                    break;
//DO parameters
            case    DO_BUSFAULTEN:
                                    IOAcyclic_Inst_x[posno].dioserviceobj.dobusfaultenable = paramwrdata.onebyte;
                                    break;
            case    DO_BUSFAULTSTATE:
                                    IOAcyclic_Inst_x[posno].dioserviceobj.dobusfaultstate = paramwrdata.onebyte;
                                    break;
            case    DO_FORCEENABLE:
                                    IOAcyclic_Inst_x[posno].dioserviceobj.doforcemodeenable = paramwrdata.onebyte;
                                    break;
            case    DO_FORCESTATE:
                                    IOAcyclic_Inst_x[posno].dioserviceobj.doforcemodestate = paramwrdata.onebyte;
                                    break;
            case    DO_CHNLIDLEENABLE:
                                    IOAcyclic_Inst_x[posno].dioserviceobj.doidlemodeenable = paramwrdata.onebyte;
                                    break;
            case    DO_IDLESTATE:
                                    IOAcyclic_Inst_x[posno].dioserviceobj.doidlemodestate = paramwrdata.onebyte;
                                    break;
            //case    DO_IDLEENABLE:
                                    //IOAcyclic_Inst_x[posno].dioserviceobj.domoduleidlemodeenable = paramwrdata.onebyte;
                                    //break;
            case    DO_OUTPUTSHRTCKTRECYEN:
                                    IOAcyclic_Inst_x[posno].dioserviceobj.dooutputshrtcktrecvyen = paramwrdata.onebyte;
                                    break;
            //case    DO_MODULEENABLE:
                                    //IOAcyclic_Inst_x[posno].dioserviceobj.moduleenable = paramwrdata.onebyte;
                                    //break;
            case    DO_CHANNELSENABLE:
                                    IOAcyclic_Inst_x[posno].dioserviceobj.dochannelsenable = paramwrdata.onebyte;
                                    break;
            case    DO_ERRSTATUSCHNL1:
            case    DO_ERRSTATUSCHNL2:
            case    DO_ERRSTATUSCHNL3:
            case    DO_ERRSTATUSCHNL4:
            //case    DO_ERRSTATUSCHNL5:
            //case    DO_ERRSTATUSCHNL6:
            //case    DO_ERRSTATUSCHNL7:
            //case    DO_ERRSTATUSCHNL8:
                                    IOAcyclic_Inst_x[posno].dioserviceobj.doerrsts[paramid - DO_ERRSTATUSCHNL1] = paramwrdata.twobyte;
                                    break;
            default:
                                    sts = AppSHMUpdateErr;
                                    break;
        }

        io_sharemem_acyclicunlock();

    return AppRET_OK;
}

/*!
 *  <!-- Description: -->
 *
 *  \brief
 *          This Function is used for Updating the AI Modules Acyclic Parameter Data in Shared Memory.
 *
 *  <!-- Parameters and return values: -->
 *  \param[in]      posno        -    Position No of AI Module.
 *                  paramid      -    Specifies the  ParameterId as in IO_FeatureParamId
 *                  paramwrdata  -    Parameter Data as in usdorwdata
 *  \return     AppRET_T    -
 *                              AppRET_OK       : Success.
 *                              AppSHMUpdateErr : Failure.
 */
AppRET_T    AI_Acyclic_ParamShmUpdate(uint8_t posno, IO_FeatureParamId paramid, usdorwdata  paramwrdata)
{
    AppRET_T sts = AppSHMUpdateErr;

    sts = io_sharemem_acycliclock();
    if(sts != AppRET_OK) {
        return sts;
    }
        switch(paramid)
        {
            case    IOBckpln_Iden_DeviceType:
                                    IOAcyclic_Inst_x[posno].aiserviceobj.identinfo.DeviceType = paramwrdata.fourbyte;
                                    break;
            case    IOBckpln_Iden_VendorName:
                                    strncpy((char *)&IOAcyclic_Inst_x[posno].aiserviceobj.identinfo.VendorName[0], (char *)&paramwrdata.str[0],STR_MAX_LEN);
                                    //DebugP_log("[[R5F1_0]%s VendorName[%-16.16s]\r\n",__func__,IOAcyclic_Inst_x[posno].aiserviceobj.identinfo.VendorName);
                                    break;
            case    IOIOBckpln_Iden_VendorId:
                                    IOAcyclic_Inst_x[posno].aiserviceobj.identinfo.VendorID = paramwrdata.fourbyte;
                                    //DebugP_log("[[R5F1_0]%s VendorID[%d]\r\n",__func__,IOAcyclic_Inst_x[posno].aiserviceobj.identinfo.VendorID);
                                    break;
            case    IOBckpln_Iden_DeviceName:
                                    strncpy((char *)&IOAcyclic_Inst_x[posno].aiserviceobj.identinfo.DeviceName[0], (char *)&paramwrdata.str[0],STR_MAX_LEN);
                                    //DebugP_log("[[R5F1_0]%s DeviceName[%-16.16s]\r\n",__func__,IOAcyclic_Inst_x[posno].aiserviceobj.identinfo.DeviceName);
                                    break;
            case    IOBckpln_Iden_DeviceId:
                                    IOAcyclic_Inst_x[posno].aiserviceobj.identinfo.DeviceID = paramwrdata.fourbyte;
                                    break;
            case    IOBckpln_Iden_VariantId:
                                    strncpy((char *)&IOAcyclic_Inst_x[posno].aiserviceobj.identinfo.VariantID[0], (char *)&paramwrdata.str[0],STR_MAX_LEN);
                                    break;
            case    IOBckpln_Iden_HWRev:
                                    strncpy((char *)&IOAcyclic_Inst_x[posno].aiserviceobj.identinfo.HWRev[0], (char *)&paramwrdata.str[0],STR_MAX_LEN);
                                    break;
            case    IOBckpln_Iden_SerialNo:
                                    strncpy((char *)&IOAcyclic_Inst_x[posno].aiserviceobj.identinfo.SlNo[0], (char *)&paramwrdata.str[0],STR_MAX_LEN);
                                    break;
            case    IOBckpln_Iden_SWPartNo:
                                    strncpy((char *)&IOAcyclic_Inst_x[posno].aiserviceobj.identinfo.SWPartNo[0], (char *)&paramwrdata.str[0],STR_MAX_LEN);
                                    break;
            case    IOBckpln_Iden_SWRev:
                                    strncpy((char *)&IOAcyclic_Inst_x[posno].aiserviceobj.identinfo.SWRev[0], (char *)&paramwrdata.str[0],STR_MAX_LEN);
                                    break;
            case    IO_PostErrStatus:
                                    IOAcyclic_Inst_x[posno].aiserviceobj.posterrsts = paramwrdata.fourbyte;
                                    break;
            case    IO_VA_Voltage:
                                    IOAcyclic_Inst_x[posno].aiserviceobj.VAVBVoltage[0u] = paramwrdata.fourbyte;
                                    break;
            case    IO_VB_Voltage:
                                    IOAcyclic_Inst_x[posno].aiserviceobj.VAVBVoltage[1u] = paramwrdata.fourbyte;
                                    break;
            case    IO_OperatingHours:
                                    IOAcyclic_Inst_x[posno].aiserviceobj.opertiontimehr = paramwrdata.fourbyte;
                                    break;
            case    IO_OperatingMins:
                                    IOAcyclic_Inst_x[posno].aiserviceobj.opertiontimemin = paramwrdata.twobyte;
                                    break;
            case    IO_ModuleMinTemperature:
                                    IOAcyclic_Inst_x[posno].aiserviceobj.mintemperature = (int16_t)paramwrdata.twobyte;
                                    break;
            case    IO_ModuleMaxTemperature:
                                    IOAcyclic_Inst_x[posno].aiserviceobj.maxtemperature = (int16_t)paramwrdata.twobyte;
                                    break;
            case    IO_ModuleMesrdTemperature:
                                    IOAcyclic_Inst_x[posno].aiserviceobj.measuredtemperature = (int16_t)paramwrdata.twobyte;
                                    break;
            case    IO_AUXSUPLOVRVOLRECYEN:
                                    IOAcyclic_Inst_x[posno].aiserviceobj.auxsuplOVRVoltageRecyEn = paramwrdata.onebyte;
                                    break;
            case    IO_AUXSUPLUNDVOLRECYEN:
                                    IOAcyclic_Inst_x[posno].aiserviceobj.auxsuplUNDVoltageRecyEn = paramwrdata.onebyte;
                                    break;
            case    IO_MEMLIFECYCLE:
                                    IOAcyclic_Inst_x[posno].aiserviceobj.memorylifecycle = paramwrdata.fourbyte;
                                    break;
            case    IO_EDS_VERSION:
                                    strncpy((char *)&IOAcyclic_Inst_x[posno].aiserviceobj.edsverno[0], (char *)&paramwrdata.str[0],STR_MAX_LEN);
                                    break;
            case    IO_EDS_DATE:
                                    strncpy((char *)&IOAcyclic_Inst_x[posno].aiserviceobj.edsverdate[0], (char *)&paramwrdata.str[0],STR_MAX_LEN);
                                    break;
//AI parameters
            case    AI_SENSSUPLYEN:
                                    IOAcyclic_Inst_x[posno].aiserviceobj.aisensorsupplyenable = paramwrdata.onebyte;
                                    break;
            case    AI_SENSSUPLYSHRTCKTDIAGEN:
                                    IOAcyclic_Inst_x[posno].aiserviceobj.aisenssuplshrtcktdiagen = paramwrdata.onebyte;
                                    break;
            case    AI_AVG_LENGTH_CHNL1:
            case    AI_AVG_LENGTH_CHNL2:
            case    AI_AVG_LENGTH_CHNL3:
            case    AI_AVG_LENGTH_CHNL4:
                                    IOAcyclic_Inst_x[posno].aiserviceobj.aiaveragecnt[paramid - AI_AVG_LENGTH_CHNL1] = paramwrdata.onebyte;
                                    break;
            case    AI_FORCEENABLE:
                                    IOAcyclic_Inst_x[posno].aiserviceobj.aiforcemodeenable = paramwrdata.onebyte;
                                    break;
            case    AI_FORCEVALUE_CHNL1:
            case    AI_FORCEVALUE_CHNL2:
            case    AI_FORCEVALUE_CHNL3:
            case    AI_FORCEVALUE_CHNL4:
                                    IOAcyclic_Inst_x[posno].aiserviceobj.aiforcemodevalue[paramid - AI_FORCEVALUE_CHNL1] = paramwrdata.twobyte;
                                    break;
            case    AI_VOLCURINPUTRANGE_CHNL1:
            case    AI_VOLCURINPUTRANGE_CHNL2:
            case    AI_VOLCURINPUTRANGE_CHNL3:
            case    AI_VOLCURINPUTRANGE_CHNL4:
                                    IOAcyclic_Inst_x[posno].aiserviceobj.aiadcvolcuriprange[paramid - AI_VOLCURINPUTRANGE_CHNL1] = paramwrdata.onebyte;
                                    break;
            /*case    AI_CURRENTINPUTRANGE_CHNL1:
            case    AI_CURRENTINPUTRANGE_CHNL2:
            case    AI_CURRENTINPUTRANGE_CHNL3:
            case    AI_CURRENTINPUTRANGE_CHNL4:
                                    IOAcyclic_Inst_x[posno].aiserviceobj.aiadccurrentiprange[paramid - AI_CURRENTINPUTRANGE_CHNL1] = paramwrdata.onebyte;
                                    break;*/
            case    AI_INPRNGOVERRUNDIAGEN:
                                    IOAcyclic_Inst_x[posno].aiserviceobj.airangeOVRundiagen = paramwrdata.onebyte;
                                    break;
            case    AI_INPRNGUNDERRUNDIAGEN:
                                    IOAcyclic_Inst_x[posno].aiserviceobj.airangeUDRundiagen = paramwrdata.onebyte;
                                    break;
            case    AI_WIREBREAKDIAGEN:
                                    IOAcyclic_Inst_x[posno].aiserviceobj.aiWireBreakdiagen = paramwrdata.onebyte;
                                    break;
            case    AI_SENSSUPLYSHRTCKTRECYEN:
                                    IOAcyclic_Inst_x[posno].aiserviceobj.aisenssupshrtcktRecvydiagen = paramwrdata.onebyte;
                                    break;
            case    AI_RANGEMODE_CHNL1_4:
            //case    AI_RANGEMODE_CHNL2:
            //case    AI_RANGEMODE_CHNL3:
            //case    AI_RANGEMODE_CHNL4:
                                    //IOAcyclic_Inst_x[posno].aiserviceobj.aichannelrangemode[paramid - AI_RANGEMODE_CHNL1] = paramwrdata.onebyte;
                                    IOAcyclic_Inst_x[posno].aiserviceobj.aichannelrangemode = paramwrdata.onebyte;
                                    break;
            case    AI_APPUPLOVERUNDIAGEN:
                                    IOAcyclic_Inst_x[posno].aiserviceobj.aiappUpperLimitdiagen = paramwrdata.onebyte;
                                    break;
            case    AI_APPUPLOVERUN_CHNL1:
            case    AI_APPUPLOVERUN_CHNL2:
            case    AI_APPUPLOVERUN_CHNL3:
            case    AI_APPUPLOVERUN_CHNL4:
                                    IOAcyclic_Inst_x[posno].aiserviceobj.aiappUpperLimitval[paramid - AI_APPUPLOVERUN_CHNL1] = paramwrdata.twobyte;
                                    break;
            case    AI_APPLOLUNDERRUNDIAGEN:
                                    IOAcyclic_Inst_x[posno].aiserviceobj.aiappLowerLimitdiagen = paramwrdata.onebyte;
                                    break;
            case    AI_APPLOLUNDERRUN_CHNL1:
            case    AI_APPLOLUNDERRUN_CHNL2:
            case    AI_APPLOLUNDERRUN_CHNL3:
            case    AI_APPLOLUNDERRUN_CHNL4:
                                    IOAcyclic_Inst_x[posno].aiserviceobj.aiappLowerLimitval[paramid - AI_APPLOLUNDERRUN_CHNL1] = paramwrdata.twobyte;
                                    break;
            case    AI_APPLIMITMONHYST_CHNL1:
            case    AI_APPLIMITMONHYST_CHNL2:
            case    AI_APPLIMITMONHYST_CHNL3:
            case    AI_APPLIMITMONHYST_CHNL4:
                                    IOAcyclic_Inst_x[posno].aiserviceobj.aiappLimitHysteresisval[paramid - AI_APPLIMITMONHYST_CHNL1] = paramwrdata.twobyte;
                                    break;
            case    AI_DataSend_Interval:
                                    IOAcyclic_Inst_x[posno].aiserviceobj.datasendinterval = paramwrdata.onebyte;
                                    break;
            case    AI_DataPointCount:
                                    IOAcyclic_Inst_x[posno].aiserviceobj.datapointcount = paramwrdata.onebyte;
                                    break;
            case    AI_DataPointInterval:
                                    IOAcyclic_Inst_x[posno].aiserviceobj.datapointinterval = paramwrdata.onebyte;
                                    break;
            case    AI_ScanInterval:
                                    IOAcyclic_Inst_x[posno].aiserviceobj.scaninterval = paramwrdata.onebyte;
                                    break;
            case    AI_MODULEENABLE:
                                    IOAcyclic_Inst_x[posno].aiserviceobj.moduleenable = paramwrdata.onebyte;
                                    break;
            case    AI_CHANNELSENABLE:
                                    IOAcyclic_Inst_x[posno].aiserviceobj.channelsenable = paramwrdata.onebyte;
                                    break;
            case    AI_ERRSTATUSCHNL1:
            case    AI_ERRSTATUSCHNL2:
            case    AI_ERRSTATUSCHNL3:
            case    AI_ERRSTATUSCHNL4:
                                    IOAcyclic_Inst_x[posno].aiserviceobj.aierrsts[paramid - AI_ERRSTATUSCHNL1] = paramwrdata.twobyte;
                                    break;
            default:
                                sts = AppSHMUpdateErr;
                                break;
        }
        io_sharemem_acyclicunlock();

    return AppRET_OK;

}

/*!
 *  <!-- Description: -->
 *
 *  \brief
 *          This Function is used for Updating the AO Modules Acyclic Parameter Data in Shared Memory.
 *
 *  <!-- Parameters and return values: -->
 *  \param[in]      posno        -    Position No of AO Module.
 *                  paramid      -    Specifies the  ParameterId as in IO_FeatureParamId
 *                  paramwrdata  -    Parameter Data as in usdorwdata
 *  \return     AppRET_T    -
 *                              AppRET_OK       : Success.
 *                              AppSHMUpdateErr : Failure.
 */
AppRET_T    AO_Acyclic_ParamShmUpdate(uint8_t posno, IO_FeatureParamId paramid, usdorwdata  paramwrdata)
{
    AppRET_T sts = AppSHMUpdateErr;

    //DebugP_log("[CAN CORE] %s- posno[%d] paramid[%d]\r\n",__func__,posno,paramid);

    sts = io_sharemem_acycliclock();
    if(sts != AppRET_OK) {
        return sts;
    }
        switch(paramid)
        {
            case    IOBckpln_Iden_DeviceType:
                                    IOAcyclic_Inst_x[posno].aoserviceobj.identinfo.DeviceType = paramwrdata.fourbyte;
                                    //DebugP_log("[CAN CORE] %s- posno[%d] DeviceType[%#x]\r\n",__func__,posno,IOAcyclic_Inst_x[posno].aoserviceobj.identinfo.DeviceType);
                                    break;
            case    IOBckpln_Iden_VendorName:
                                    strncpy((char *)&IOAcyclic_Inst_x[posno].aoserviceobj.identinfo.VendorName[0], (char *)&paramwrdata.str[0],STR_MAX_LEN);
                                    //DebugP_log("[CAN CORE] %s- posno[%d] VendorName[%-16.16s]\r\n",__func__,posno,IOAcyclic_Inst_x[posno].aoserviceobj.identinfo.VendorName);
                                    break;
            case    IOIOBckpln_Iden_VendorId:
                                    IOAcyclic_Inst_x[posno].aoserviceobj.identinfo.VendorID = paramwrdata.fourbyte;
                                    //DebugP_log("[CAN CORE] %s- posno[%d] VendorID[%#x]\r\n",__func__,posno,IOAcyclic_Inst_x[posno].aoserviceobj.identinfo.VendorID);
                                    break;
            case    IOBckpln_Iden_DeviceName:
                                    strncpy((char *)&IOAcyclic_Inst_x[posno].aoserviceobj.identinfo.DeviceName[0], (char *)&paramwrdata.str[0],STR_MAX_LEN);
                                    //DebugP_log("[CAN CORE] %s- posno[%d] DeviceName[%-16.16s]\r\n",__func__,posno,IOAcyclic_Inst_x[posno].aoserviceobj.identinfo.DeviceName);
                                    break;
            case    IOBckpln_Iden_DeviceId:
                                    IOAcyclic_Inst_x[posno].aoserviceobj.identinfo.DeviceID = paramwrdata.fourbyte;
                                    //DebugP_log("[CAN CORE] %s- posno[%d] DeviceID[%#x]\r\n",__func__,posno,IOAcyclic_Inst_x[posno].aoserviceobj.identinfo.DeviceID);
                                    break;
            case    IOBckpln_Iden_VariantId:
                                    strncpy((char *)&IOAcyclic_Inst_x[posno].aoserviceobj.identinfo.VariantID[0], (char *)&paramwrdata.str[0],STR_MAX_LEN);
                                    //DebugP_log("[CAN CORE] %s- posno[%d] VariantID[%-16.16s]\r\n",__func__,posno,IOAcyclic_Inst_x[posno].aoserviceobj.identinfo.VariantID);
                                    break;
            case    IOBckpln_Iden_HWRev:
                                    strncpy((char *)&IOAcyclic_Inst_x[posno].aoserviceobj.identinfo.HWRev[0], (char *)&paramwrdata.str[0],STR_MAX_LEN);
                                    //DebugP_log("[CAN CORE] %s- posno[%d] HWRev[%-16.16s]\r\n",__func__,posno,IOAcyclic_Inst_x[posno].aoserviceobj.identinfo.HWRev);
                                    break;
            case    IOBckpln_Iden_SerialNo:
                                    strncpy((char *)&IOAcyclic_Inst_x[posno].aoserviceobj.identinfo.SlNo[0], (char *)&paramwrdata.str[0],STR_MAX_LEN);
                                    //DebugP_log("[CAN CORE] %s- posno[%d] SlNo[%-16.16s]\r\n",__func__,posno,IOAcyclic_Inst_x[posno].aoserviceobj.identinfo.SlNo);
                                    break;
            case    IOBckpln_Iden_SWPartNo:
                                    strncpy((char *)&IOAcyclic_Inst_x[posno].aoserviceobj.identinfo.SWPartNo[0], (char *)&paramwrdata.str[0],STR_MAX_LEN);
                                    //DebugP_log("[CAN CORE] %s- posno[%d] SWPartNo[%-16.16s]\r\n",__func__,posno,IOAcyclic_Inst_x[posno].aoserviceobj.identinfo.SWPartNo);
                                    break;
            case    IOBckpln_Iden_SWRev:
                                    strncpy((char *)&IOAcyclic_Inst_x[posno].aoserviceobj.identinfo.SWRev[0], (char *)&paramwrdata.str[0],STR_MAX_LEN);
                                    //DebugP_log("[CAN CORE] %s- posno[%d] SWRev[%-16.16s]\r\n",__func__,posno,IOAcyclic_Inst_x[posno].aoserviceobj.identinfo.SWRev);
                                    break;
            case    IO_PostErrStatus:
                                    IOAcyclic_Inst_x[posno].aoserviceobj.posterrsts = paramwrdata.fourbyte;
                                    break;
            case    IO_VA_Voltage:
                                    IOAcyclic_Inst_x[posno].aoserviceobj.VAVBVoltage[0u] = paramwrdata.fourbyte;
                                    break;
            case    IO_VB_Voltage:
                                    IOAcyclic_Inst_x[posno].aoserviceobj.VAVBVoltage[1u] = paramwrdata.fourbyte;
                                    break;
            case    IO_OperatingHours:
                                    IOAcyclic_Inst_x[posno].aoserviceobj.opertiontimehr = paramwrdata.fourbyte;
                                    break;
            case    IO_OperatingMins:
                                    IOAcyclic_Inst_x[posno].aoserviceobj.opertiontimemin = paramwrdata.twobyte;
                                    break;
            case    IO_ModuleMinTemperature:
                                    IOAcyclic_Inst_x[posno].aoserviceobj.mintemperature = (int16_t)paramwrdata.twobyte;
                                    break;
            case    IO_ModuleMaxTemperature:
                                    IOAcyclic_Inst_x[posno].aoserviceobj.maxtemperature = (int16_t)paramwrdata.twobyte;
                                    break;
            case    IO_ModuleMesrdTemperature:
                                    IOAcyclic_Inst_x[posno].aoserviceobj.measuredtemperature = (int16_t)paramwrdata.twobyte;
                                    break;
            case    IO_AUXSUPLOVRVOLRECYEN:
                                    IOAcyclic_Inst_x[posno].aoserviceobj.auxsuplOVRVoltageRecyEn = paramwrdata.onebyte;
                                    break;
            case    IO_AUXSUPLUNDVOLRECYEN:
                                    IOAcyclic_Inst_x[posno].aoserviceobj.auxsuplUNDVoltageRecyEn = paramwrdata.onebyte;
                                    break;
            case    IO_MEMLIFECYCLE:
                                    IOAcyclic_Inst_x[posno].aoserviceobj.memorylifecycle = paramwrdata.fourbyte;
                                    break;
            case    IO_EDS_VERSION:
                                    strncpy((char *)&IOAcyclic_Inst_x[posno].aoserviceobj.edsverno[0], (char *)&paramwrdata.str[0],STR_MAX_LEN);
                                    break;
            case    IO_EDS_DATE:
                                    strncpy((char *)&IOAcyclic_Inst_x[posno].aoserviceobj.edsverdate[0], (char *)&paramwrdata.str[0],STR_MAX_LEN);
                                    break;

//AO parameters
            case    AO_ACTUATORSUPLYEN:
                                    IOAcyclic_Inst_x[posno].aoserviceobj.aoActrsupplyenable = paramwrdata.onebyte;
                                    break;
            case    AO_ACTUATORSUPLYSHRTCKTDIAGEN:
                                    IOAcyclic_Inst_x[posno].aoserviceobj.aoactrsuplshrtcktdiagen = paramwrdata.onebyte;
                                    break;
            case    AO_SHORTCKTDIAGEN:
                                    IOAcyclic_Inst_x[posno].aoserviceobj.aoshrtcktdiagen = paramwrdata.onebyte;
                                    break;
            case    AO_OPENCKTDIAGEN:
                                    IOAcyclic_Inst_x[posno].aoserviceobj.aoopencktdiagen = paramwrdata.onebyte;
                                    break;
            case    AO_APPUPLOVERUNDIAGEN:
                                    IOAcyclic_Inst_x[posno].aoserviceobj.aoappUpperLimitovrundiagen = paramwrdata.twobyte;
                                    break;
            case    AO_APPLOLUNDERRUNDIAGEN:
                                    IOAcyclic_Inst_x[posno].aoserviceobj.aoappLowerLimituvrundiagen = paramwrdata.twobyte;
                                    break;
            case    AO_VOLCUROUTPUTRANGE_CHNL1:
            case    AO_VOLCUROUTPUTRANGE_CHNL2:
            case    AO_VOLCUROUTPUTRANGE_CHNL3:
            case    AO_VOLCUROUTPUTRANGE_CHNL4:
                                    IOAcyclic_Inst_x[posno].aoserviceobj.aodacvolcuroprange[paramid - AO_VOLCUROUTPUTRANGE_CHNL1] = paramwrdata.onebyte;
                                    break;
            //case    AO_CURRENTOUTPUTRANGE_CHNL1:
            //case    AO_CURRENTOUTPUTRANGE_CHNL2:
            //case    AO_CURRENTOUTPUTRANGE_CHNL3:
            //case    AO_CURRENTOUTPUTRANGE_CHNL4:
                                    //IOAcyclic_Inst_x[posno].aoserviceobj.aodaccurrnetoprange[paramid - AO_CURRENTOUTPUTRANGE_CHNL1] = paramwrdata.onebyte;
                                    //break;
            case    AO_RANGEMODE_CHNL1_4:
                                    IOAcyclic_Inst_x[posno].aoserviceobj.aochannelrangemode = paramwrdata.onebyte;
                                    break;
            case    AO_FORCEENABLE:
                                    IOAcyclic_Inst_x[posno].aoserviceobj.aoforcemodeenable = paramwrdata.onebyte;
                                    break;
            case    AO_FORCEVALUE_CHNL1:
            case    AO_FORCEVALUE_CHNL2:
            case    AO_FORCEVALUE_CHNL3:
            case    AO_FORCEVALUE_CHNL4:
                                    IOAcyclic_Inst_x[posno].aoserviceobj.aoforcemodevalue[paramid - AO_FORCEVALUE_CHNL1] = paramwrdata.twobyte;
                                    break;
            case    AO_CHNLIDLEENABLE:
                                    IOAcyclic_Inst_x[posno].aoserviceobj.aoidlemodeenable = paramwrdata.onebyte;
                                    break;
            case    AO_IDLEVALUE_CHNL1:
            case    AO_IDLEVALUE_CHNL2:
            case    AO_IDLEVALUE_CHNL3:
            case    AO_IDLEVALUE_CHNL4:
                                    IOAcyclic_Inst_x[posno].aoserviceobj.aoidlemodevalue[paramid - AO_IDLEVALUE_CHNL1] = paramwrdata.twobyte;
                                    break;
            //case    AO_IDLEENABLE:
                                    //IOAcyclic_Inst_x[posno].aoserviceobj.aomoduleidlemodeenable = paramwrdata.onebyte;
                                    //break;
            case    AO_BUSFAULTEN:
                                    IOAcyclic_Inst_x[posno].aoserviceobj.aobusfaultenable = paramwrdata.onebyte;
                                    break;
            case    AO_BUSFAULTVALUE_CHNL1:
            case    AO_BUSFAULTVALUE_CHNL2:
            case    AO_BUSFAULTVALUE_CHNL3:
            case    AO_BUSFAULTVALUE_CHNL4:
                                    IOAcyclic_Inst_x[posno].aoserviceobj.aobusfaultvalue[paramid - AO_BUSFAULTVALUE_CHNL1] = paramwrdata.twobyte;
                                    break;
            case    AO_SIGNALSHRTCKTRECYEN:
                                    IOAcyclic_Inst_x[posno].aoserviceobj.aoshrtcktRecvryen = paramwrdata.onebyte;
                                    break;
            case    AO_ACTUATORSUPLSHRTCKTRECYEN:
                                    IOAcyclic_Inst_x[posno].aoserviceobj.aoactrsuplshrtcktRecvryen = paramwrdata.onebyte;
                                    break;
            case    AO_APPUPLOVERUN_CHNL1:
            case    AO_APPUPLOVERUN_CHNL2:
            case    AO_APPUPLOVERUN_CHNL3:
            case    AO_APPUPLOVERUN_CHNL4:
                                    IOAcyclic_Inst_x[posno].aoserviceobj.aoUpperLimitorval[paramid - AO_APPUPLOVERUN_CHNL1] = paramwrdata.twobyte;
                                    break;
            case    AO_APPLOLUNDERRUN_CHNL1:
            case    AO_APPLOLUNDERRUN_CHNL2:
            case    AO_APPLOLUNDERRUN_CHNL3:
            case    AO_APPLOLUNDERRUN_CHNL4:
                                    IOAcyclic_Inst_x[posno].aoserviceobj.aoLowerLimiturval[paramid - AO_APPLOLUNDERRUN_CHNL1] = paramwrdata.twobyte;
                                    break;
            case    AO_DataPointCount:
                                    IOAcyclic_Inst_x[posno].aoserviceobj.datapointcount = paramwrdata.onebyte;
                                    break;
            case    AO_DataPointInterval:
                                    IOAcyclic_Inst_x[posno].aoserviceobj.datapointinterval = paramwrdata.onebyte;
                                    break;
            case    AO_ScanInterval:
                                    IOAcyclic_Inst_x[posno].aoserviceobj.scaninterval = paramwrdata.onebyte;
                                    break;
            case    AO_MODULEENABLE:
                                    IOAcyclic_Inst_x[posno].aoserviceobj.moduleenable = paramwrdata.onebyte;
                                    break;
            case    AO_CHANNELSENABLE:
                                    IOAcyclic_Inst_x[posno].aoserviceobj.channelsenable = paramwrdata.onebyte;
                                    break;
            case    AO_ERRSTATUSCHNL1:
            case    AO_ERRSTATUSCHNL2:
            case    AO_ERRSTATUSCHNL3:
            case    AO_ERRSTATUSCHNL4:
                                    IOAcyclic_Inst_x[posno].aoserviceobj.aoerrsts[paramid - AO_ERRSTATUSCHNL1] = paramwrdata.twobyte;
                                    break;
            default:
                                sts = AppSHMUpdateErr;
                                break;
        }
        io_sharemem_acyclicunlock();

    return AppRET_OK;

}

/*!
 *  <!-- Description: -->
 *
 *  \brief
 *          This Function is used for Updating the AIO Modules Acyclic Parameter Data in Shared Memory.
 *
 *  <!-- Parameters and return values: -->
 *  \param[in]      posno        -    Position No of AIO Module.
 *                  paramid      -    Specifies the  ParameterId as in IO_FeatureParamId
 *                  paramwrdata  -    Parameter Data as in usdorwdata
 *  \return     AppRET_T    -
 *                              AppRET_OK       : Success.
 *                              AppSHMUpdateErr : Failure.
 */
AppRET_T    AIO_Acyclic_ParamShmUpdate(uint8_t posno, IO_FeatureParamId paramid, usdorwdata  paramwrdata)
{
    AppRET_T sts = AppSHMUpdateErr;

//    if( (paramid == 159) || (paramid ==160)) {
//        DebugP_log("%s   paramid[%d] data[%#x] posno[%d]\r\n",__func__,paramid,paramwrdata.twobyte,posno);
//    }

    sts = io_sharemem_acycliclock();
    if(sts != AppRET_OK) {
        return sts;
    }
        switch(paramid)
        {
            case    IOBckpln_Iden_DeviceType:
                                    IOAcyclic_Inst_x[posno].aioserviceobj.identinfo.DeviceType = paramwrdata.fourbyte;
                                    break;
            case    IOBckpln_Iden_VendorName:
                                    strncpy((char *)&IOAcyclic_Inst_x[posno].aioserviceobj.identinfo.VendorName[0], (char *)&paramwrdata.str[0],STR_MAX_LEN);
                                    break;
            case    IOIOBckpln_Iden_VendorId:
                                    IOAcyclic_Inst_x[posno].aioserviceobj.identinfo.VendorID = paramwrdata.fourbyte;
                                    break;
            case    IOBckpln_Iden_DeviceName:
                                    strncpy((char *)&IOAcyclic_Inst_x[posno].aioserviceobj.identinfo.DeviceName[0], (char *)&paramwrdata.str[0],STR_MAX_LEN);
                                    break;
            case    IOBckpln_Iden_DeviceId:
                                    IOAcyclic_Inst_x[posno].aioserviceobj.identinfo.DeviceID = paramwrdata.fourbyte;
                                    break;
            case    IOBckpln_Iden_VariantId:
                                    strncpy((char *)&IOAcyclic_Inst_x[posno].aioserviceobj.identinfo.VariantID[0], (char *)&paramwrdata.str[0],STR_MAX_LEN);
                                    break;
            case    IOBckpln_Iden_HWRev:
                                    strncpy((char *)&IOAcyclic_Inst_x[posno].aioserviceobj.identinfo.HWRev[0], (char *)&paramwrdata.str[0],STR_MAX_LEN);
                                    break;
            case    IOBckpln_Iden_SerialNo:
                                    strncpy((char *)&IOAcyclic_Inst_x[posno].aioserviceobj.identinfo.SlNo[0], (char *)&paramwrdata.str[0],STR_MAX_LEN);
                                    break;
            case    IOBckpln_Iden_SWPartNo:
                                    strncpy((char *)&IOAcyclic_Inst_x[posno].aioserviceobj.identinfo.SWPartNo[0], (char *)&paramwrdata.str[0],STR_MAX_LEN);
                                    break;
            case    IOBckpln_Iden_SWRev:
                                    strncpy((char *)&IOAcyclic_Inst_x[posno].aioserviceobj.identinfo.SWRev[0], (char *)&paramwrdata.str[0],STR_MAX_LEN);
                                    break;
            case    IO_PostErrStatus:
                                    IOAcyclic_Inst_x[posno].aioserviceobj.posterrsts = paramwrdata.fourbyte;
                                    break;
            case    IO_VA_Voltage:
                                    IOAcyclic_Inst_x[posno].aioserviceobj.VAVBVoltage[0u] = paramwrdata.fourbyte;
                                    break;
            case    IO_VB_Voltage:
                                    IOAcyclic_Inst_x[posno].aioserviceobj.VAVBVoltage[1u] = paramwrdata.fourbyte;
                                    break;
            case    IO_OperatingHours:
                                    IOAcyclic_Inst_x[posno].aioserviceobj.opertiontimehr = paramwrdata.fourbyte;
                                    break;
            case    IO_OperatingMins:
                                    IOAcyclic_Inst_x[posno].aioserviceobj.opertiontimemin = paramwrdata.twobyte;
                                    break;
            case    IO_ModuleMinTemperature:
                                    IOAcyclic_Inst_x[posno].aioserviceobj.mintemperature = (int16_t)paramwrdata.twobyte;
                                    break;
            case    IO_ModuleMaxTemperature:
                                    IOAcyclic_Inst_x[posno].aioserviceobj.maxtemperature = (int16_t)paramwrdata.twobyte;
                                    break;
            case    IO_ModuleMesrdTemperature:
                                    IOAcyclic_Inst_x[posno].aioserviceobj.measuredtemperature = (int16_t)paramwrdata.twobyte;
                                    break;
            case    IO_AUXSUPLOVRVOLRECYEN:
                                    IOAcyclic_Inst_x[posno].aioserviceobj.auxsuplOVRVoltageRecyEn = paramwrdata.onebyte;
                                    break;
            case    IO_AUXSUPLUNDVOLRECYEN:
                                    IOAcyclic_Inst_x[posno].aioserviceobj.auxsuplUNDVoltageRecyEn = paramwrdata.onebyte;
                                    break;
            case    IO_MEMLIFECYCLE:
                                    IOAcyclic_Inst_x[posno].aioserviceobj.memorylifecycle = paramwrdata.fourbyte;
                                    break;
            case    IO_EDS_VERSION:
                                    strncpy((char *)&IOAcyclic_Inst_x[posno].aioserviceobj.edsverno[0], (char *)&paramwrdata.str[0],STR_MAX_LEN);
                                    break;
            case    IO_EDS_DATE:
                                    strncpy((char *)&IOAcyclic_Inst_x[posno].aioserviceobj.edsverdate[0], (char *)&paramwrdata.str[0],STR_MAX_LEN);
                                    break;

//AI parameters
            case    AI_SENSSUPLYEN:
                                    IOAcyclic_Inst_x[posno].aioserviceobj.aisensorsupplyenable = paramwrdata.onebyte;
                                    break;
            case    AI_SENSSUPLYSHRTCKTDIAGEN:
                                    IOAcyclic_Inst_x[posno].aioserviceobj.aisenssuplshrtcktdiagen = paramwrdata.onebyte;
                                    break;
            case    AI_AVG_LENGTH_CHNL1:
            case    AI_AVG_LENGTH_CHNL2:
            //case    AI_AVG_LENGTH_CHNL3:
            //case    AI_AVG_LENGTH_CHNL4:
                                    IOAcyclic_Inst_x[posno].aioserviceobj.aiaveragecnt[paramid - AI_AVG_LENGTH_CHNL1] = paramwrdata.onebyte;
                                    break;
            case    AI_FORCEENABLE:

                                    IOAcyclic_Inst_x[posno].aioserviceobj.aiforcemodeenable = paramwrdata.onebyte;
                                    break;
            case    AI_FORCEVALUE_CHNL1:
            case    AI_FORCEVALUE_CHNL2:
            //case    AI_FORCEVALUE_CHNL3:
            //case    AI_FORCEVALUE_CHNL4:
                                    IOAcyclic_Inst_x[posno].aioserviceobj.aiforcemodevalue[paramid - AI_FORCEVALUE_CHNL1] = paramwrdata.twobyte;
                                    break;
            case    AI_VOLCURINPUTRANGE_CHNL1:
            case    AI_VOLCURINPUTRANGE_CHNL2:
            //case    AI_VOLCURINPUTRANGE_CHNL3:
            //case    AI_VOLCURINPUTRANGE_CHNL4:
                                    IOAcyclic_Inst_x[posno].aioserviceobj.aiadcvolcuriprange[paramid - AI_VOLCURINPUTRANGE_CHNL1] = paramwrdata.onebyte;
                                    break;
            /*case    AI_CURRENTINPUTRANGE_CHNL1:
            case    AI_CURRENTINPUTRANGE_CHNL2:
            case    AI_CURRENTINPUTRANGE_CHNL3:
            case    AI_CURRENTINPUTRANGE_CHNL4:
                                    IOAcyclic_Inst_x[posno].aioserviceobj.aiadccurrentiprange[paramid - AI_CURRENTINPUTRANGE_CHNL1] = paramwrdata.onebyte;
                                    break;*/
            case    AI_INPRNGOVERRUNDIAGEN:
                                    IOAcyclic_Inst_x[posno].aioserviceobj.airangeOVRundiagen = paramwrdata.onebyte;
                                    break;
            case    AI_INPRNGUNDERRUNDIAGEN:
                                    IOAcyclic_Inst_x[posno].aioserviceobj.airangeUDRundiagen = paramwrdata.onebyte;
                                    break;
            case    AI_WIREBREAKDIAGEN:
                                    IOAcyclic_Inst_x[posno].aioserviceobj.aiWireBreakdiagen = paramwrdata.onebyte;
                                    break;
            case    AI_SENSSUPLYSHRTCKTRECYEN:
                                    IOAcyclic_Inst_x[posno].aioserviceobj.aisenssupshrtcktRecvydiagen = paramwrdata.onebyte;
                                    break;
            case    AI_RANGEMODE_CHNL1_4:
            //case    AI_RANGEMODE_CHNL2:
            //case    AI_RANGEMODE_CHNL3:
            //case    AI_RANGEMODE_CHNL4:
                                    IOAcyclic_Inst_x[posno].aioserviceobj.aichannelrangemode = paramwrdata.onebyte;
                                    break;
            case    AI_APPUPLOVERUNDIAGEN:
                                    IOAcyclic_Inst_x[posno].aioserviceobj.aiappUpperLimitdiagen = paramwrdata.onebyte;
                                    break;
            case    AI_APPUPLOVERUN_CHNL1:
            case    AI_APPUPLOVERUN_CHNL2:
            //case    AI_APPUPLOVERUN_CHNL3:
            //case    AI_APPUPLOVERUN_CHNL4:
                                    IOAcyclic_Inst_x[posno].aioserviceobj.aiappUpperLimitval[paramid - AI_APPUPLOVERUN_CHNL1] = paramwrdata.twobyte;
                                    break;
            case    AI_APPLOLUNDERRUNDIAGEN:
                                    IOAcyclic_Inst_x[posno].aioserviceobj.aiappLowerLimitdiagen = paramwrdata.onebyte;
                                    break;
            case    AI_APPLOLUNDERRUN_CHNL1:
            case    AI_APPLOLUNDERRUN_CHNL2:
            //case    AI_APPLOLUNDERRUN_CHNL3:
            //case    AI_APPLOLUNDERRUN_CHNL4:
                                    IOAcyclic_Inst_x[posno].aioserviceobj.aiappLowerLimitval[paramid - AI_APPLOLUNDERRUN_CHNL1] = paramwrdata.twobyte;
                                    break;
            case    AI_APPLIMITMONHYST_CHNL1:
            case    AI_APPLIMITMONHYST_CHNL2:
            //case    AI_APPLIMITMONHYST_CHNL3:
            //case    AI_APPLIMITMONHYST_CHNL4:
                                    IOAcyclic_Inst_x[posno].aioserviceobj.aiappLimitHysteresisval[paramid - AI_APPLIMITMONHYST_CHNL1] = paramwrdata.twobyte;
                                    break;
            case    AI_DataSend_Interval:
                                    IOAcyclic_Inst_x[posno].aioserviceobj.aidatasendinterval = paramwrdata.onebyte;
                                    break;
            case    AI_DataPointCount:
                                    IOAcyclic_Inst_x[posno].aioserviceobj.aidatapointcount = paramwrdata.onebyte;
                                    break;
            case    AI_DataPointInterval:
                                    IOAcyclic_Inst_x[posno].aioserviceobj.aidatapointinterval = paramwrdata.onebyte;
                                    break;
            case    AI_ScanInterval:
                                    IOAcyclic_Inst_x[posno].aioserviceobj.aiscaninterval = paramwrdata.onebyte;
                                    break;
            case    AI_MODULEENABLE:
                                    IOAcyclic_Inst_x[posno].aioserviceobj.moduleenable = paramwrdata.onebyte;
                                    break;
            case    AI_CHANNELSENABLE:
                                    IOAcyclic_Inst_x[posno].aioserviceobj.aichannelsenable = paramwrdata.onebyte;
                                    break;
            case    AI_ERRSTATUSCHNL1:
            case    AI_ERRSTATUSCHNL2:
            //case    AI_ERRSTATUSCHNL3:
            //case    AI_ERRSTATUSCHNL4:
                                    IOAcyclic_Inst_x[posno].aioserviceobj.aierrsts[paramid - AI_ERRSTATUSCHNL1] = paramwrdata.twobyte;
                                    break;

//AO parameters
            case    AO_ACTUATORSUPLYEN:
                                    IOAcyclic_Inst_x[posno].aioserviceobj.aoActrsupplyenable = paramwrdata.onebyte;
                                    break;
            case    AO_ACTUATORSUPLYSHRTCKTDIAGEN:
                                    IOAcyclic_Inst_x[posno].aioserviceobj.aoactrsuplshrtcktdiagen = paramwrdata.onebyte;
                                    break;
            case    AO_SHORTCKTDIAGEN:
                                    IOAcyclic_Inst_x[posno].aioserviceobj.aoshrtcktdiagen = paramwrdata.onebyte;
                                    break;
            case    AO_OPENCKTDIAGEN:
                                    IOAcyclic_Inst_x[posno].aioserviceobj.aoopencktdiagen = paramwrdata.onebyte;
                                    break;
            case    AO_APPUPLOVERUNDIAGEN:
                                    IOAcyclic_Inst_x[posno].aioserviceobj.aoappUpperLimitovrundiagen = paramwrdata.twobyte;
                                    break;
            case    AO_APPLOLUNDERRUNDIAGEN:
                                    IOAcyclic_Inst_x[posno].aioserviceobj.aoappLowerLimituvrundiagen = paramwrdata.twobyte;
                                    break;
            case    AO_VOLCUROUTPUTRANGE_CHNL1:
            case    AO_VOLCUROUTPUTRANGE_CHNL2:
            //case    AO_VOLCUROUTPUTRANGE_CHNL3:
            //case    AO_VOLCUROUTPUTRANGE_CHNL4:
                                    IOAcyclic_Inst_x[posno].aioserviceobj.aodacvolcuroprange[paramid - AO_VOLCUROUTPUTRANGE_CHNL1] = paramwrdata.onebyte;
                                    break;
            //case    AO_CURRENTOUTPUTRANGE_CHNL1:
            //case    AO_CURRENTOUTPUTRANGE_CHNL2:
            //case    AO_CURRENTOUTPUTRANGE_CHNL3:
            //case    AO_CURRENTOUTPUTRANGE_CHNL4:
                                    //IOAcyclic_Inst_x[posno].aioserviceobj.aodaccurrnetoprange[paramid - AO_CURRENTOUTPUTRANGE_CHNL1] = paramwrdata.onebyte;
                                    //break;
            case    AO_RANGEMODE_CHNL1_4:
                                    IOAcyclic_Inst_x[posno].aioserviceobj.aochannelrangemode = paramwrdata.onebyte;
                                    break;
            case    AO_FORCEENABLE:
                                    IOAcyclic_Inst_x[posno].aioserviceobj.aoforcemodeenable = paramwrdata.onebyte;
                                    break;
            case    AO_FORCEVALUE_CHNL1:
            case    AO_FORCEVALUE_CHNL2:
            //case    AO_FORCEVALUE_CHNL3:
            //case    AO_FORCEVALUE_CHNL4:
                                    IOAcyclic_Inst_x[posno].aioserviceobj.aoforcemodevalue[paramid - AO_FORCEVALUE_CHNL1] = paramwrdata.twobyte;
                                    break;
            case    AO_CHNLIDLEENABLE:
                                    IOAcyclic_Inst_x[posno].aioserviceobj.aoidlemodeenable = paramwrdata.onebyte;
                                    break;
            case    AO_IDLEVALUE_CHNL1:
            case    AO_IDLEVALUE_CHNL2:
            //case    AO_IDLEVALUE_CHNL3:
            //case    AO_IDLEVALUE_CHNL4:
                                    IOAcyclic_Inst_x[posno].aioserviceobj.aoidlemodevalue[paramid - AO_IDLEVALUE_CHNL1] = paramwrdata.twobyte;
                                    break;
            //case    AO_IDLEENABLE:
                                    //IOAcyclic_Inst_x[posno].aioserviceobj.aomoduleidlemodeenable = paramwrdata.onebyte;
                                    //break;
            case    AO_BUSFAULTEN:
                                    IOAcyclic_Inst_x[posno].aioserviceobj.aobusfaultenable = paramwrdata.onebyte;
                                    break;
            case    AO_BUSFAULTVALUE_CHNL1:
            case    AO_BUSFAULTVALUE_CHNL2:
            //case    AO_BUSFAULTVALUE_CHNL3:
            //case    AO_BUSFAULTVALUE_CHNL4:
                                    IOAcyclic_Inst_x[posno].aioserviceobj.aobusfaultvalue[paramid - AO_BUSFAULTVALUE_CHNL1] = paramwrdata.twobyte;
                                    break;
            case    AO_SIGNALSHRTCKTRECYEN:
                                    IOAcyclic_Inst_x[posno].aioserviceobj.aoshrtcktRecvryen = paramwrdata.onebyte;
                                    break;
            case    AO_ACTUATORSUPLSHRTCKTRECYEN:
                                    IOAcyclic_Inst_x[posno].aioserviceobj.aoactrsuplshrtcktRecvryen = paramwrdata.onebyte;
                                    break;
            case    AO_APPUPLOVERUN_CHNL1:
            case    AO_APPUPLOVERUN_CHNL2:
            //case    AO_APPUPLOVERUN_CHNL3:
            //case    AO_APPUPLOVERUN_CHNL4:
                                    IOAcyclic_Inst_x[posno].aioserviceobj.aoUpperLimitorval[paramid - AO_APPUPLOVERUN_CHNL1] = paramwrdata.twobyte;
                                    break;
            case    AO_APPLOLUNDERRUN_CHNL1:
            case    AO_APPLOLUNDERRUN_CHNL2:
            //case    AO_APPLOLUNDERRUN_CHNL3:
            //case    AO_APPLOLUNDERRUN_CHNL4:
                                    IOAcyclic_Inst_x[posno].aioserviceobj.aoLowerLimiturval[paramid - AO_APPLOLUNDERRUN_CHNL1] = paramwrdata.twobyte;
                                    break;
            case    AO_DataPointCount:
                                    IOAcyclic_Inst_x[posno].aioserviceobj.aodatapointcount = paramwrdata.onebyte;
                                    break;
            case    AO_DataPointInterval:
                                    IOAcyclic_Inst_x[posno].aioserviceobj.aodatapointinterval = paramwrdata.onebyte;
                                    break;
            case    AO_ScanInterval:
                                    IOAcyclic_Inst_x[posno].aioserviceobj.aoscaninterval = paramwrdata.onebyte;
                                    break;
            case    AO_MODULEENABLE:
                                    IOAcyclic_Inst_x[posno].aioserviceobj.moduleenable = paramwrdata.onebyte;
                                    break;
            case    AO_CHANNELSENABLE:
                                    IOAcyclic_Inst_x[posno].aioserviceobj.aochannelsenable = paramwrdata.onebyte;
                                    break;
            case    AO_ERRSTATUSCHNL1:
            case    AO_ERRSTATUSCHNL2:
            //case    AO_ERRSTATUSCHNL3:
            //case    AO_ERRSTATUSCHNL4:
                                    IOAcyclic_Inst_x[posno].aioserviceobj.aoerrsts[paramid - AO_ERRSTATUSCHNL1] = paramwrdata.twobyte;
                                    //DebugP_log("%s : paramid[%d] aoerrsts[%#x]\r\n",__func__,paramid,IOAcyclic_Inst_x[posno].aioserviceobj.aoerrsts[paramid - AO_ERRSTATUSCHNL1]);
                                    break;

            default:
                                    sts = AppSHMUpdateErr;
                                    break;
        }

        io_sharemem_acyclicunlock();

    return AppRET_OK;
}
