Skip to content

Commit

Permalink
Corrected STATUS enums
Browse files Browse the repository at this point in the history
  • Loading branch information
rodmarfran committed Jun 6, 2021
1 parent 51a5ada commit 44fcbae
Show file tree
Hide file tree
Showing 9 changed files with 67 additions and 22 deletions.
Binary file not shown.
16 changes: 16 additions & 0 deletions G3U_HW_V02_2GB/Software_Project/Firmware/rtos/fee_taskV3.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;

Expand All @@ -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 ) {
Expand Down Expand Up @@ -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;

Expand All @@ -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 ) {
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
35 changes: 13 additions & 22 deletions G3U_HW_V02_2GB/Software_Project/Firmware/rtos/parser_comm_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand All @@ -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;
Expand All @@ -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 )
Expand Down
2 changes: 2 additions & 0 deletions G3U_HW_V02_2GB/Software_Project/Firmware/rtos/sim_meb_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ void vSimMebTask(void *task_data) {

vEnterConfigRoutine( pxMebC );
pxMebC->eMode = sMebConfig;
pxMebC->eMebRealMode = eMebRealStConfig;
break;

case sMebToRun:
Expand Down Expand Up @@ -136,6 +137,7 @@ void vSimMebTask(void *task_data) {

vEvtChangeMebMode();
pxMebC->eMode = sMebRun;
pxMebC->eMebRealMode = eMebRealStRun;
} else {
/* Send Error to NUC */
#if DEBUG_ON
Expand Down
2 changes: 2 additions & 0 deletions G3U_HW_V02_2GB/Software_Project/Firmware/utils/feeV2.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 ];
Expand Down
31 changes: 31 additions & 0 deletions G3U_HW_V02_2GB/Software_Project/Firmware/utils/feeV2.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -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{
Expand Down Expand Up @@ -106,6 +135,8 @@ typedef struct FeeControl{
tFEEStates eMode;
tFEEStates eNextMode;

TFeeRealStates eFeeRealMode;

TTrapModeControl xTrap;

tDataSource eDataSource;
Expand Down
2 changes: 2 additions & 0 deletions G3U_HW_V02_2GB/Software_Project/Firmware/utils/meb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
1 change: 1 addition & 0 deletions G3U_HW_V02_2GB/Software_Project/Firmware/utils/meb.h
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down
Binary file modified Program_Flash_DE4/L6_0_7_0_1.elf
Binary file not shown.

0 comments on commit 44fcbae

Please sign in to comment.