/****************************************************************************** * * Title : primFunc_startSlaveList.c * Version 0.0, * * Description: Start slave list primitive function. * Related files: * * Author: Lukas Tomasek, tomasekl@fzu.cz * ******************************************************************************/ /****************************************************************************** * Header files * ******************************************************************************/ #include #include "primFunc_startSlaveList.h" #include "globalDefinitions.h" #include "uirUtility.h" #include "primParamsUir.h" #include "mainUir.h" #include #include "primFunctionInit.h" /****************************************************************************** * Global functions * ******************************************************************************/ /*============================================================================= * primFunction_startSlaveList() *============================================================================= * * * */ ERROR_ID primFunction_startSlaveList(PRIM_FUNC_OPTION funcOption, struct PRIM_TABLE *primTable, void *primitive, UINT32 inputParameter, UINT8 slotNumber){ FILE *file; struct MSG_HEAD* primHeader=(struct MSG_HEAD*) primitive; UINT32 *primDataPtr=(UINT32*)((UINT32)primHeader+sizeof(struct MSG_HEAD)); ERROR_ID errorId=SUCCESS; char errorMessage[200]; int status; UINT32 primBodyLength; UINT32 primitiveId; struct START_SLAVE_LIST_IN *startSlaveList=&primTable->params.startSlaveList; const int panel=global.panel.primEdit[getPrimArrayId(START_SLAVE_LIST)]; UINT32 i; UINT32 dataLength; struct START_SLAVE_LIST_IN *startSlaveListIn; struct START_SLAVE_LIST_OUT *startSlaveListOut; char textMessage[200]; char errorText[100]; UINT32 listIndex; int ringIndex; if(R_START_SLAVE_LIST!=R_START_SLAVE_LIST_HOST){ ERROR_CHECK(PROGRAM_ERROR, primitive START_SLAVE_LIST - wrong revision number); return(PROGRAM_ERROR); } switch(funcOption){ case PRIM_PANEL_TO_TABLE: GetCtrlVal(panel, START_SLIS_SLV_ID, &startSlaveList->slaveNumber); GetCtrlVal(panel, START_SLIS_PAUSE_MASTER_LIST, &startSlaveList->pauseMasterList); GetCtrlVal(panel, START_SLIS_GET_SLAVE_REPLY, &startSlaveList->getSlaveReply); /* NO BREAK HERE!!!*/ case PRIM_PARAMS_TO_TABLE: /* add table headers - don't set indexes!!! */ primTable->inPrimHeader.length=SIZEOF(struct START_SLAVE_LIST_IN)+SIZEOF(struct MSG_HEAD); primTable->inPrimHeader.id=START_SLAVE_LIST; primTable->inPrimHeader.primRevision=R_START_SLAVE_LIST; primTable->replyLength=0; break; case PRIM_TABLE_TO_PANEL: if(primTable->inPrimHeader.primRevision!=R_START_SLAVE_LIST){ ERROR_CHECK(PROGRAM_ERROR, primitive START_SLAVE_LIST - wrong revision number); return(PROGRAM_ERROR); } SetCtrlVal(panel, START_SLIS_SLV_ID, startSlaveList->slaveNumber); SetCtrlVal(panel, START_SLIS_PAUSE_MASTER_LIST, startSlaveList->pauseMasterList); SetCtrlVal(panel, START_SLIS_GET_SLAVE_REPLY, startSlaveList->getSlaveReply); break; case PRIM_BUILD: /* copy params */ *(struct START_SLAVE_LIST_IN*)(primDataPtr)=*startSlaveList; break; case REP_DATA_PROCESS: /* no reply */ break; case WRITE_TO_FILE: file=(FILE*)inputParameter; fprintf(file, "slaveNumber= %d, pauseMasterList= %d, getSlaveReply= %d\n", startSlaveList->slaveNumber, startSlaveList->pauseMasterList, startSlaveList->getSlaveReply); break; case READ_FROM_FILE: file=(FILE*)inputParameter; status=fscanf(file, "slaveNumber= %d, pauseMasterList= %d, getSlaveReply= %d\n", &startSlaveList->slaveNumber, &startSlaveList->pauseMasterList, &startSlaveList->getSlaveReply); if(status==-1) {ERROR_CHECK(FATAL_ERROR, Read from prim file error!); return(FATAL_ERROR);} break; default: ;//error } return(SUCCESS); } /******************************************************************************/