diff --git a/G3U_HW_V02_2GB/Qsys_Project/software/Simucam_R0_UART/Simucam_R0_UART.elf b/G3U_HW_V02_2GB/Qsys_Project/software/Simucam_R0_UART/Simucam_R0_UART.elf index 035b3a23..ccf4e925 100644 Binary files a/G3U_HW_V02_2GB/Qsys_Project/software/Simucam_R0_UART/Simucam_R0_UART.elf and b/G3U_HW_V02_2GB/Qsys_Project/software/Simucam_R0_UART/Simucam_R0_UART.elf differ diff --git a/G3U_HW_V02_2GB/Software_Project/Firmware/rtos/fee_taskV3.c b/G3U_HW_V02_2GB/Software_Project/Firmware/rtos/fee_taskV3.c index 74844e3c..04ddd486 100644 --- a/G3U_HW_V02_2GB/Software_Project/Firmware/rtos/fee_taskV3.c +++ b/G3U_HW_V02_2GB/Software_Project/Firmware/rtos/fee_taskV3.c @@ -170,6 +170,8 @@ void vFeeTaskV3(void *task_data) { pxNFee->xControl.eMode = sConfig; pxNFee->xControl.eNextMode = sConfig; + pxNFee->xControl.eFeeRealMode = eFeeRealStConfig; + pxNFee->xControl.xTrap.bEnabledSerial = FALSE; pxNFee->xControl.xTrap.bEnabled = FALSE; @@ -264,6 +266,8 @@ void vFeeTaskV3(void *task_data) { pxNFee->xControl.eMode = sOn; pxNFee->xControl.eNextMode = sOn; + pxNFee->xControl.eFeeRealMode = eFeeRealStOn; + pxNFee->xControl.xTrap.bEnabledSerial = FALSE; pxNFee->xControl.xTrap.bEnabled = FALSE; @@ -281,6 +285,7 @@ void vFeeTaskV3(void *task_data) { break; case sOn: + /*Wait for commands in the Queue*/ uiCmdFEE.ulWord = (unsigned int)OSQPend(xFeeQ[ pxNFee->ucId ] , 0, &error_code); /* Blocking operation */ if ( error_code == OS_ERR_NONE ) { @@ -342,6 +347,8 @@ void vFeeTaskV3(void *task_data) { pxNFee->xControl.eMode = sStandBy; pxNFee->xControl.eNextMode = sStandBy; + pxNFee->xControl.eFeeRealMode = eFeeRealStStandBy; + pxNFee->xControl.xTrap.bEnabledSerial = FALSE; pxNFee->xControl.xTrap.bEnabled = FALSE; @@ -359,6 +366,7 @@ void vFeeTaskV3(void *task_data) { case sStandBy: + /*Wait for commands in the Queue*/ uiCmdFEE.ulWord = (unsigned int)OSQPend(xFeeQ[ pxNFee->ucId ] , 0, &error_code); /* Blocking operation */ if ( error_code == OS_ERR_NONE ) { @@ -411,6 +419,7 @@ void vFeeTaskV3(void *task_data) { pxNFee->xControl.eMode = sFullPattern; pxNFee->xControl.eNextMode = sFullPattern; /* Real State */ + pxNFee->xControl.eFeeRealMode = eFeeRealStFullPattern; pxNFee->xControl.xTrap.bEnabledSerial = FALSE; pxNFee->xControl.xTrap.bEnabled = FALSE; @@ -441,6 +450,7 @@ void vFeeTaskV3(void *task_data) { pxNFee->xControl.eMode = sWinPattern; pxNFee->xControl.eNextMode = sWinPattern; /* Real State */ + pxNFee->xControl.eFeeRealMode = eFeeRealStWinPattern; pxNFee->xControl.xTrap.bEnabledSerial = FALSE; pxNFee->xControl.xTrap.bEnabled = FALSE; @@ -465,6 +475,7 @@ void vFeeTaskV3(void *task_data) { pxNFee->xControl.eMode = sFullImage; pxNFee->xControl.eNextMode = sFullImage; /* Real State */ + pxNFee->xControl.eFeeRealMode = eFeeRealStFullImage; pxNFee->xControl.xTrap.bEnabledSerial = FALSE; pxNFee->xControl.xTrap.bEnabled = FALSE; @@ -492,6 +503,7 @@ void vFeeTaskV3(void *task_data) { pxNFee->xControl.eMode = sWindowing; pxNFee->xControl.eNextMode = sWindowing; /* Real State */ + pxNFee->xControl.eFeeRealMode = eFeeRealStWindowing; pxNFee->xControl.xTrap.bEnabledSerial = FALSE; pxNFee->xControl.xTrap.bEnabled = FALSE; @@ -517,6 +529,7 @@ void vFeeTaskV3(void *task_data) { pxNFee->xControl.eMode = sParTrap1; pxNFee->xControl.eNextMode = sParTrap1; /* Real State */ + pxNFee->xControl.eFeeRealMode = eFeeRealStParTrap1; pxNFee->xControl.xTrap.bEnabledSerial = FALSE; pxNFee->xControl.xTrap.bEnabled = TRUE; @@ -543,6 +556,7 @@ void vFeeTaskV3(void *task_data) { pxNFee->xControl.eMode = sParTrap2; pxNFee->xControl.eNextMode = sParTrap2; /* Real State */ + pxNFee->xControl.eFeeRealMode = eFeeRealStParTrap2; pxNFee->xControl.xTrap.bEnabledSerial = FALSE; pxNFee->xControl.xTrap.bEnabled = TRUE; @@ -568,6 +582,7 @@ void vFeeTaskV3(void *task_data) { pxNFee->xControl.eMode = sSerialTrap1; pxNFee->xControl.eNextMode = sSerialTrap1; /* Real State */ + pxNFee->xControl.eFeeRealMode = eFeeRealStSerialTrap1; pxNFee->xControl.xTrap.bEnabledSerial = TRUE; pxNFee->xControl.xTrap.bEnabled = FALSE; @@ -600,6 +615,7 @@ void vFeeTaskV3(void *task_data) { pxNFee->xControl.eMode = sSerialTrap2; pxNFee->xControl.eNextMode = sSerialTrap2; /* Real State */ + pxNFee->xControl.eFeeRealMode = eFeeRealStSerialTrap2; pxNFee->xControl.xTrap.bEnabledSerial = TRUE; pxNFee->xControl.xTrap.bEnabled = FALSE; diff --git a/G3U_HW_V02_2GB/Software_Project/Firmware/rtos/parser_comm_task.c b/G3U_HW_V02_2GB/Software_Project/Firmware/rtos/parser_comm_task.c index 53f9c1bf..8cc2139b 100644 --- a/G3U_HW_V02_2GB/Software_Project/Firmware/rtos/parser_comm_task.c +++ b/G3U_HW_V02_2GB/Software_Project/Firmware/rtos/parser_comm_task.c @@ -1204,7 +1204,7 @@ void vParserCommTask(void *task_data) { xTmPusL.usiType = 254; xTmPusL.usiSubType = 4; xTmPusL.ucNofValues = 0; - xTmPusL.usiValues[xTmPusL.ucNofValues] = xSimMeb.eMode; /* MEB operation MODE */ + xTmPusL.usiValues[xTmPusL.ucNofValues] = xSimMeb.eMebRealMode; /* MEB operation MODE */ xTmPusL.ucNofValues++; uiEPinMilliSeconds = xSimMeb.usiEP; xTmPusL.usiValues[xTmPusL.ucNofValues] = uiEPinMilliSeconds >> 16; /* EP in Milliseconds 1� Word */ @@ -1218,10 +1218,7 @@ void vParserCommTask(void *task_data) { case 8: usiFeeInstL = PreParsedLocal.usiValues[6]; if ( usiFeeInstL <= N_OF_NFEE ) { - unsigned short int usiSPWStatusTotal; - unsigned short int usiSPWRunning; - unsigned short int usiSPWConnecting; - unsigned short int usiSPWStarted; + unsigned short int usiSPWStatus; tTMPus xTmPusL; xTmPusL.usiPusId = xTcPusL.usiPusId; @@ -1232,28 +1229,22 @@ void vParserCommTask(void *task_data) { xTmPusL.ucNofValues = 0; xTmPusL.usiValues[xTmPusL.ucNofValues] = usiFeeInstL; xTmPusL.ucNofValues++; - xTmPusL.usiValues[xTmPusL.ucNofValues]=xSimMeb.xFeeControl.xNfee[usiFeeInstL].xControl.eMode; + xTmPusL.usiValues[xTmPusL.ucNofValues]=xSimMeb.xFeeControl.xNfee[usiFeeInstL].xControl.eFeeRealMode; xTmPusL.ucNofValues++; bSpwcGetLinkStatus(&xSimMeb.xFeeControl.xNfee[usiFeeInstL].xChannel.xSpacewire); - if (xSimMeb.xFeeControl.xNfee[usiFeeInstL].xChannel.xSpacewire.xSpwcLinkStatus.bRunning == TRUE) { - usiSPWRunning = 0b001; + if (TRUE == xSimMeb.xFeeControl.xNfee[usiFeeInstL].xChannel.xSpacewire.xSpwcLinkStatus.bStarted){ + usiSPWStatus = eFeeSpwStarted; + } else if (TRUE == xSimMeb.xFeeControl.xNfee[usiFeeInstL].xChannel.xSpacewire.xSpwcLinkStatus.bConnecting) { + usiSPWStatus = eFeeSpwConnecting; + } else if (TRUE == xSimMeb.xFeeControl.xNfee[usiFeeInstL].xChannel.xSpacewire.xSpwcLinkStatus.bRunning) { + usiSPWStatus = eFeeSpwRunning; + } else if (TRUE == xSimMeb.xFeeControl.xNfee[usiFeeInstL].xChannel.xSpacewire.xSpwcLinkConfig.bAutostart) { + usiSPWStatus = eFeeSpwDisconnectedAutoStart; } else { - usiSPWRunning = 0; + usiSPWStatus = eFeeSpwDisconnected; } - if (xSimMeb.xFeeControl.xNfee[usiFeeInstL].xChannel.xSpacewire.xSpwcLinkStatus.bConnecting == TRUE) { - usiSPWConnecting = 0b010; - } else { - usiSPWConnecting = 0; - } - if (xSimMeb.xFeeControl.xNfee[usiFeeInstL].xChannel.xSpacewire.xSpwcLinkStatus.bStarted == TRUE) { - usiSPWStarted = 0b100; - } else { - usiSPWStarted = 0; - } - usiSPWStatusTotal = usiSPWRunning^usiSPWConnecting^usiSPWStarted; - xTmPusL.usiValues[xTmPusL.ucNofValues]=usiSPWStatusTotal; + xTmPusL.usiValues[xTmPusL.ucNofValues] = usiSPWStatus; xTmPusL.ucNofValues++; - bDpktGetPixelDelay(&xSimMeb.xFeeControl.xNfee[usiFeeInstL].xChannel.xDataPacket); bDpktGetPacketConfig(&xSimMeb.xFeeControl.xNfee[usiFeeInstL].xChannel.xDataPacket); if (xSimMeb.xFeeControl.xNfee[usiFeeInstL].xChannel.xDataPacket.xDpktDataPacketConfig.usiCcdVStart > xSimMeb.xFeeControl.xNfee[usiFeeInstL].xChannel.xDataPacket.xDpktDataPacketConfig.usiCcdVEnd ) diff --git a/G3U_HW_V02_2GB/Software_Project/Firmware/rtos/sim_meb_task.c b/G3U_HW_V02_2GB/Software_Project/Firmware/rtos/sim_meb_task.c index 2f541ad4..a3b4fca6 100644 --- a/G3U_HW_V02_2GB/Software_Project/Firmware/rtos/sim_meb_task.c +++ b/G3U_HW_V02_2GB/Software_Project/Firmware/rtos/sim_meb_task.c @@ -52,6 +52,7 @@ void vSimMebTask(void *task_data) { vEnterConfigRoutine( pxMebC ); pxMebC->eMode = sMebConfig; + pxMebC->eMebRealMode = eMebRealStConfig; break; case sMebToRun: @@ -136,6 +137,7 @@ void vSimMebTask(void *task_data) { vEvtChangeMebMode(); pxMebC->eMode = sMebRun; + pxMebC->eMebRealMode = eMebRealStRun; } else { /* Send Error to NUC */ #if DEBUG_ON diff --git a/G3U_HW_V02_2GB/Software_Project/Firmware/utils/feeV2.c b/G3U_HW_V02_2GB/Software_Project/Firmware/utils/feeV2.c index 899ed5fe..217d08f9 100644 --- a/G3U_HW_V02_2GB/Software_Project/Firmware/utils/feeV2.c +++ b/G3U_HW_V02_2GB/Software_Project/Firmware/utils/feeV2.c @@ -39,6 +39,8 @@ void vNFeeStructureInit( TNFee *pxNfeeL, unsigned char ucIdNFEE ) { pxNfeeL->xControl.eMode = sInit; pxNfeeL->xControl.eNextMode = sInit; + pxNfeeL->xControl.eFeeRealMode = eFeeRealStConfig; + pxNfeeL->xControl.eDataSource = dsPattern; pxNfeeL->ucSPWId = (unsigned char)xDefaultsCH.ucFEEtoChanell[ ucIdNFEE ]; diff --git a/G3U_HW_V02_2GB/Software_Project/Firmware/utils/feeV2.h b/G3U_HW_V02_2GB/Software_Project/Firmware/utils/feeV2.h index 3f76c9ea..a467a8fa 100644 --- a/G3U_HW_V02_2GB/Software_Project/Firmware/utils/feeV2.h +++ b/G3U_HW_V02_2GB/Software_Project/Firmware/utils/feeV2.h @@ -17,6 +17,11 @@ /* Meb state is here to Data controller and NFEE controller use the same enum */ typedef enum { sMebInit = 0, sMebConfig, sMebRun, sMebToConfig, sMebToRun } tSimucamStates; +/* Meb "real" operating mode, for status purposes */ +typedef enum MebRealStates{ + eMebRealStConfig = 0, + eMebRealStRun +} TMebRealStates; /* Definition of offset for each FEE in the DDR Memory */ /* Worksheet: ccd_logic_math.xlsx */ @@ -57,6 +62,30 @@ typedef enum { sInit = 0, sConfig, sOn, sStandBy, sFullPattern, sWinPattern, sFu redoutCycle_Enter, redoutCycle_Out, redoutWaitBeforeSyncSignal, redoutCheckDTCUpdate, redoutCheckRestr, redoutConfigureTrans, redoutPreLoadBuffer, redoutTransmission, redoutEndSch, readoutWaitingFinishTransmission} tFEEStates; +/* FEE "real" operating modes, for status purposes */ +typedef enum FeeRealStates { + eFeeRealStConfig = 0, + eFeeRealStOn, + eFeeRealStStandBy, + eFeeRealStFullPattern, + eFeeRealStWinPattern, + eFeeRealStFullImage, + eFeeRealStWindowing, + eFeeRealStParTrap1, + eFeeRealStParTrap2, + eFeeRealStSerialTrap1, + eFeeRealStSerialTrap2 +} TFeeRealStates; + +/* FEE SpaceWire Status*/ +typedef enum FeeSpwStatus { + eFeeSpwDisconnected = 0, + eFeeSpwDisconnectedAutoStart, + eFeeSpwConnecting, + eFeeSpwStarted, + eFeeSpwRunning +} TFeeSpwStatus; + typedef enum { dsPattern = 0, dsSSD, dsWindowStack } tDataSource; typedef struct FEEMemoryMap{ @@ -106,6 +135,8 @@ typedef struct FeeControl{ tFEEStates eMode; tFEEStates eNextMode; + TFeeRealStates eFeeRealMode; + TTrapModeControl xTrap; tDataSource eDataSource; diff --git a/G3U_HW_V02_2GB/Software_Project/Firmware/utils/meb.c b/G3U_HW_V02_2GB/Software_Project/Firmware/utils/meb.c index cae0c470..69859083 100644 --- a/G3U_HW_V02_2GB/Software_Project/Firmware/utils/meb.c +++ b/G3U_HW_V02_2GB/Software_Project/Firmware/utils/meb.c @@ -16,6 +16,8 @@ void vSimucamStructureInit( TSimucam_MEB *xMeb ) { /* Simucam start in the Meb Config Mode */ xMeb->eMode = sMebInit; + xMeb->eMebRealMode = eMebRealStConfig; + /* Load EP */ vLoadDefaultEPValue( xMeb ); /* Load RT */ diff --git a/G3U_HW_V02_2GB/Software_Project/Firmware/utils/meb.h b/G3U_HW_V02_2GB/Software_Project/Firmware/utils/meb.h index 81364cb4..58ee33ba 100644 --- a/G3U_HW_V02_2GB/Software_Project/Firmware/utils/meb.h +++ b/G3U_HW_V02_2GB/Software_Project/Firmware/utils/meb.h @@ -38,6 +38,7 @@ typedef struct SwapControl { typedef struct Simucam_MEB { tFeeType eType; /* Normal or Fast FEE */ tSimucamStates eMode; /* Mode of operation for the Simucam */ + TMebRealStates eMebRealMode; /* Meb "real" operating mode, for status purposes */ unsigned char ucActualDDR; /* Control the swap mechanism of DDRs ( 0: DDR0 or 1: DDR1 ) */ unsigned char ucNextDDR; /* Control the swap mechanism of DDRs ( 0: DDR0 or 1: DDR1 ) */ /* Note 3: The EP and RT parameters are common to all the N-FEE simulation entities. */ diff --git a/Program_Flash_DE4/L6_0_7_0_1.elf b/Program_Flash_DE4/L6_0_7_0_1.elf index 035b3a23..ccf4e925 100644 Binary files a/Program_Flash_DE4/L6_0_7_0_1.elf and b/Program_Flash_DE4/L6_0_7_0_1.elf differ