Skip to content

Commit

Permalink
Added missing default for PUS and corrected the FEE_HK_UPDATE behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
rodmarfran committed Jun 6, 2021
1 parent f2cb26c commit d5d9989
Show file tree
Hide file tree
Showing 10 changed files with 26 additions and 87 deletions.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
/* HW and FW release version */
#define SIMUCAM_RELEASE "L6"
#define SIMUCAM_HW_VERSION "0.7"
#define SIMUCAM_FW_VERSION "0.0"
#define SIMUCAM_FW_VERSION "0.1"

#define N_OF_NFEE 6 /* ONLY for tests */
#define N_OF_FastFEE 1
Expand Down
6 changes: 3 additions & 3 deletions G3U_HW_V02_2GB/Software_Project/Firmware/rtos/fee_taskV3.c
Original file line number Diff line number Diff line change
Expand Up @@ -2796,13 +2796,13 @@ void vInitialConfig_RmapMemArea( TNFee *pxNFeeP ) {
*
* @retval void
**/
void vUpdateFeeHKValue ( TNFee *pxNFeeP, alt_u8 ucRmapHkID, alt_u32 uliRawValue ){
void vUpdateFeeHKValue ( TNFee *pxNFeeP, alt_u16 usiRmapHkID, alt_u32 uliRawValue ){

/* Load current values */
bRmapGetRmapMemHkArea(&pxNFeeP->xChannel.xRmap);

/* Switch case to assign value to register */
switch(ucRmapHkID + 2000){ /* The offset of 2000 is necessary to comply with the Defaults IDs. TODO: change RMAP HK ID to 16-bits */
switch(usiRmapHkID){

/* N-FEE RMAP Area HK Register 0, TOU Sense 1 HK Field */
case eDeftNfeeRmapAreaHkTouSense1Id:
Expand Down Expand Up @@ -3096,7 +3096,7 @@ void vUpdateFeeHKValue ( TNFee *pxNFeeP, alt_u8 ucRmapHkID, alt_u32 uliRawValue
default:
#if DEBUG_ON
if ( xDefaults.ucDebugLevel <= dlMajorMessage )
fprintf(fp, "HK update: HK ID out of bounds: %u;\n", ucRmapHkID );
fprintf(fp, "HK update [FEE %u]: HK ID out of bounds: %u;\n", pxNFeeP->ucId, usiRmapHkID );
#endif
break;
}
Expand Down
2 changes: 1 addition & 1 deletion G3U_HW_V02_2GB/Software_Project/Firmware/rtos/fee_taskV3.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ void vQCmdFeeRMAPBeforeSync( TNFee *pxNFeeP, unsigned int cmd );
void vQCmdFeeRMAPReadoutSync( TNFee *pxNFeeP, unsigned int cmd );
void vQCmdFeeRMAPinReadoutTrans( TNFee *pxNFeeP, unsigned int cmd );
void vQCmdFeeRMAPinPreLoadBuffer( TNFee *pxNFeeP, unsigned int cmd );
void vUpdateFeeHKValue ( TNFee *pxNFeeP, alt_u8 ucRmapHkID, alt_u32 uliRawValue );
void vUpdateFeeHKValue ( TNFee *pxNFeeP, alt_u16 usiRmapHkID, alt_u32 uliRawValue );
void vSync400Update( TNFee *pxNFeeP );
void vApplyRmap( TNFee *pxNFeeP );
void vActivateContentErrInj( TNFee *pxNFeeP );
Expand Down
74 changes: 2 additions & 72 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 @@ -2090,77 +2090,7 @@ void vEnterConfigRoutine( TSimucam_MEB *pxMebCLocal ) {

/* Disable all errors */
for (ucFeeInstL = 0; ucFeeInstL < N_OF_NFEE; ucFeeInstL++) {

bSpwcGetTimecodeConfig(&pxMebCLocal->xFeeControl.xNfee[ucFeeInstL].xChannel.xSpacewire);
pxMebCLocal->xFeeControl.xNfee[ucFeeInstL].xChannel.xSpacewire.xSpwcTimecodeConfig.ucTimeOffset = 0;
pxMebCLocal->xFeeControl.xNfee[ucFeeInstL].xChannel.xSpacewire.xSpwcTimecodeConfig.bTransmissionEnable = TRUE;
pxMebCLocal->xFeeControl.xNfee[ucFeeInstL].xChannel.xSpacewire.xSpwcTimecodeConfig.bSyncTriggerEnable = TRUE;
pxMebCLocal->xFeeControl.xNfee[ucFeeInstL].xChannel.xSpacewire.xSpwcTimecodeConfig.bSyncDelayTriggerEn = FALSE;
bSpwcSetTimecodeConfig(&pxMebCLocal->xFeeControl.xNfee[ucFeeInstL].xChannel.xSpacewire);

bDpktGetSpacewireErrInj(&pxMebCLocal->xFeeControl.xNfee[ucFeeInstL].xChannel.xDataPacket);
pxMebCLocal->xFeeControl.xNfee[ucFeeInstL].xChannel.xDataPacket.xDpktSpacewireErrInj.bEepReceivedEn = FALSE;
pxMebCLocal->xFeeControl.xNfee[ucFeeInstL].xChannel.xDataPacket.xDpktSpacewireErrInj.usiSequenceCnt = 0;
pxMebCLocal->xFeeControl.xNfee[ucFeeInstL].xChannel.xDataPacket.xDpktSpacewireErrInj.usiNRepeat = 0;
bDpktSetSpacewireErrInj(&pxMebCLocal->xFeeControl.xNfee[ucFeeInstL].xChannel.xDataPacket);

bDpktGetRmapErrInj(&pxMebCLocal->xFeeControl.xNfee[ucFeeInstL].xChannel.xDataPacket);
pxMebCLocal->xFeeControl.xNfee[ucFeeInstL].xChannel.xDataPacket.xDpktRmapErrInj.bTriggerErr = FALSE;
pxMebCLocal->xFeeControl.xNfee[ucFeeInstL].xChannel.xDataPacket.xDpktRmapErrInj.ucErrorId = 0;
pxMebCLocal->xFeeControl.xNfee[ucFeeInstL].xChannel.xDataPacket.xDpktRmapErrInj.uliValue = 0;
bDpktSetRmapErrInj(&pxMebCLocal->xFeeControl.xNfee[ucFeeInstL].xChannel.xDataPacket);
bDpktRstRmapErrInj(&pxMebCLocal->xFeeControl.xNfee[ucFeeInstL].xChannel.xDataPacket);

bFeebGetMachineControl(&pxMebCLocal->xFeeControl.xNfee[ucFeeInstL].xChannel.xFeeBuffer);
pxMebCLocal->xFeeControl.xNfee[ucFeeInstL].xChannel.xFeeBuffer.xFeebMachineControl.bWindowListEn = TRUE;
bFeebSetMachineControl(&pxMebCLocal->xFeeControl.xNfee[ucFeeInstL].xChannel.xFeeBuffer);

pxMebCLocal->xFeeControl.xNfee[ucFeeInstL].xErrorInjControl.xErrorSWCtrlFull.bTxDisabled = FALSE;
pxMebCLocal->xFeeControl.xNfee[ucFeeInstL].xErrorInjControl.xErrorSWCtrlFull.bMissingPkts = FALSE;
pxMebCLocal->xFeeControl.xNfee[ucFeeInstL].xErrorInjControl.xErrorSWCtrlFull.bMissingData = FALSE;
pxMebCLocal->xFeeControl.xNfee[ucFeeInstL].xErrorInjControl.xErrorSWCtrlFull.ucFrameNum = 0;
pxMebCLocal->xFeeControl.xNfee[ucFeeInstL].xErrorInjControl.xErrorSWCtrlFull.usiSequenceCnt = 0;
pxMebCLocal->xFeeControl.xNfee[ucFeeInstL].xErrorInjControl.xErrorSWCtrlFull.usiNRepeat = 0;
pxMebCLocal->xFeeControl.xNfee[ucFeeInstL].xErrorInjControl.xErrorSWCtrlFull.usiDataCnt = 0;

pxMebCLocal->xFeeControl.xNfee[ucFeeInstL].xErrorInjControl.xErrorSWCtrlWin.bTxDisabled = FALSE;
pxMebCLocal->xFeeControl.xNfee[ucFeeInstL].xErrorInjControl.xErrorSWCtrlWin.bMissingPkts = FALSE;
pxMebCLocal->xFeeControl.xNfee[ucFeeInstL].xErrorInjControl.xErrorSWCtrlWin.bMissingData = FALSE;
pxMebCLocal->xFeeControl.xNfee[ucFeeInstL].xErrorInjControl.xErrorSWCtrlWin.ucFrameNum = 0;
pxMebCLocal->xFeeControl.xNfee[ucFeeInstL].xErrorInjControl.xErrorSWCtrlWin.usiSequenceCnt = 0;
pxMebCLocal->xFeeControl.xNfee[ucFeeInstL].xErrorInjControl.xErrorSWCtrlWin.usiNRepeat = 0;
pxMebCLocal->xFeeControl.xNfee[ucFeeInstL].xErrorInjControl.xErrorSWCtrlWin.usiDataCnt = 0;

bDpktGetSpacewireErrInj(&pxMebCLocal->xFeeControl.xNfee[ucFeeInstL].xChannel.xDataPacket);
pxMebCLocal->xFeeControl.xNfee[ucFeeInstL].xChannel.xDataPacket.xDpktSpacewireErrInj.bEepReceivedEn = FALSE;
pxMebCLocal->xFeeControl.xNfee[ucFeeInstL].xChannel.xDataPacket.xDpktSpacewireErrInj.usiSequenceCnt = 0;
pxMebCLocal->xFeeControl.xNfee[ucFeeInstL].xChannel.xDataPacket.xDpktSpacewireErrInj.usiNRepeat = 0;
bDpktSetSpacewireErrInj(&pxMebCLocal->xFeeControl.xNfee[ucFeeInstL].xChannel.xDataPacket);

/* Force the stop of any ongoing SpW Codec Errors */
bDpktGetSpwCodecErrInj(&pxMebCLocal->xFeeControl.xNfee[ucFeeInstL].xChannel.xDataPacket);
pxMebCLocal->xFeeControl.xNfee[ucFeeInstL].xChannel.xDataPacket.xDpktSpwCodecErrInj.bStartErrInj = FALSE;
pxMebCLocal->xFeeControl.xNfee[ucFeeInstL].xChannel.xDataPacket.xDpktSpwCodecErrInj.bResetErrInj = TRUE;
pxMebCLocal->xFeeControl.xNfee[ucFeeInstL].xChannel.xDataPacket.xDpktSpwCodecErrInj.ucErrInjErrCode = eDpktSpwCodecErrIdNone;
bDpktSetSpwCodecErrInj(&pxMebCLocal->xFeeControl.xNfee[ucFeeInstL].xChannel.xDataPacket);

/* Stop and correct SpW Destination Address Error */
if (TRUE == pxMebCLocal->xFeeControl.xNfee[ucFeeInstL].xErrorInjControl.xSpacewireErrInj.bDestinationErrorEn){
pxMebCLocal->xFeeControl.xNfee[ucFeeInstL].xErrorInjControl.xSpacewireErrInj.bDestinationErrorEn = FALSE;
bDpktGetPacketConfig(&pxMebCLocal->xFeeControl.xNfee[ucFeeInstL].xChannel.xDataPacket);
pxMebCLocal->xFeeControl.xNfee[ucFeeInstL].xChannel.xDataPacket.xDpktDataPacketConfig.ucLogicalAddr = pxMebCLocal->xFeeControl.xNfee[ucFeeInstL].xErrorInjControl.xSpacewireErrInj.ucOriginalDestAddr;
bDpktSetPacketConfig(&pxMebCLocal->xFeeControl.xNfee[ucFeeInstL].xChannel.xDataPacket);
}

bDpktHeaderErrInjStopInj(&pxMebCLocal->xFeeControl.xNfee[ucFeeInstL].xChannel.xDataPacket);
pxMebCLocal->xFeeControl.xNfee[ucFeeInstL].xErrorInjControl.xDataPktError.ucErrorCnt = 0;
pxMebCLocal->xFeeControl.xNfee[ucFeeInstL].xErrorInjControl.xDataPktError.bStartErrorInj = FALSE;

bDpktContentErrInjStopInj(&pxMebCLocal->xFeeControl.xNfee[ucFeeInstL].xChannel.xDataPacket, eDpktCcdSideE);
bDpktContentErrInjStopInj(&pxMebCLocal->xFeeControl.xNfee[ucFeeInstL].xChannel.xDataPacket, eDpktCcdSideF);
pxMebCLocal->xFeeControl.xNfee[ucFeeInstL].xErrorInjControl.xImgWinContentErr.bStartLeftErrorInj = FALSE;
pxMebCLocal->xFeeControl.xNfee[ucFeeInstL].xErrorInjControl.xImgWinContentErr.bStartRightErrorInj = FALSE;

vErrorInjOff(pxMebCLocal, ucFeeInstL);
}

bDisableIsoDrivers();
Expand Down Expand Up @@ -2217,7 +2147,7 @@ void vSendHKUpdate(TSimucam_MEB *pxMebCLocal, tTMPus *xPusL){
u_HKValue.usiValues[0] = xPus->usiValues[3];
u_HKValue.usiValues[1] = xPus->usiValues[2];

vUpdateFeeHKValue(&pxMebCLocal->xFeeControl.xNfee[xPus->usiValues[0]], (alt_u8)xPus->usiValues[1], u_HKValue.uliValue);
vUpdateFeeHKValue(&pxMebCLocal->xFeeControl.xNfee[xPus->usiValues[0]], xPus->usiValues[1], u_HKValue.uliValue);

}

Expand Down
21 changes: 12 additions & 9 deletions G3U_HW_V02_2GB/Software_Project/Firmware/utils/configs_simucam.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ const TEthInterfaceParams cxDefaultsEthInterfaceParams = {
.ucGTW = {192, 168, 17, 1},
.ucDNS = {1, 1, 1, 1},
.ucPID = 112,
.ucPCAT = 6
.ucPCAT = 6,
.ucEncap = 0
};

const TGenSimulationParams cxDefaultsGenSimulationParams = {
Expand Down Expand Up @@ -792,21 +793,23 @@ bool bLoadHardcodedSpwConf( alt_u8 ucFee ) {

// fprintf(fp, " MAC: %02X:%02X:%02X:%02X:%02X:%02X \n", xConfEth.ucMAC[0], xConfEth.ucMAC[1], xConfEth.ucMAC[2], xConfEth.ucMAC[3], xConfEth.ucMAC[4], xConfEth.ucMAC[5]);

fprintf(fp, " IP: %i.%i.%i.%i \n", xConfEth.ucIP[0], xConfEth.ucIP[1], xConfEth.ucIP[2], xConfEth.ucIP[3]);
fprintf(fp, " PUS TCP address IPv4: %i.%i.%i.%i \n", xConfEth.ucIP[0], xConfEth.ucIP[1], xConfEth.ucIP[2], xConfEth.ucIP[3]);

fprintf(fp, " GTW: %i.%i.%i.%i \n", xConfEth.ucGTW[0], xConfEth.ucGTW[1], xConfEth.ucGTW[2], xConfEth.ucGTW[3]);
fprintf(fp, " PUS TCP gateway IPv4: %i.%i.%i.%i \n", xConfEth.ucGTW[0], xConfEth.ucGTW[1], xConfEth.ucGTW[2], xConfEth.ucGTW[3]);

fprintf(fp, " Sub: %i.%i.%i.%i \n", xConfEth.ucSubNet[0], xConfEth.ucSubNet[1], xConfEth.ucSubNet[2], xConfEth.ucSubNet[3]);
fprintf(fp, " PUS TCP subnet IPv4: %i.%i.%i.%i \n", xConfEth.ucSubNet[0], xConfEth.ucSubNet[1], xConfEth.ucSubNet[2], xConfEth.ucSubNet[3]);

fprintf(fp, " DNS: %i.%i.%i.%i \n", xConfEth.ucDNS[0], xConfEth.ucDNS[1], xConfEth.ucDNS[2], xConfEth.ucDNS[3]);
fprintf(fp, " PUS TCP DNS IPv4: %i.%i.%i.%i \n", xConfEth.ucDNS[0], xConfEth.ucDNS[1], xConfEth.ucDNS[2], xConfEth.ucDNS[3]);

fprintf(fp, " Server Port: %i\n", xConfEth.siPortPUS);
fprintf(fp, " PUS TCP Server Port: %i\n", xConfEth.siPortPUS);

fprintf(fp, " Use DHCP: %i\n", xConfEth.bDHCP);
fprintf(fp, " PUS TCP Enable DHCP (dynamic) IP: %i\n", xConfEth.bDHCP);

fprintf(fp, " PUS PID: %i\n", xConfEth.ucPID);
fprintf(fp, " PUS HP_PID identification: %i\n", xConfEth.ucPID);

fprintf(fp, " PUS PCAT: %i\n", xConfEth.ucPCAT);
fprintf(fp, " PUS HP_PCAT identification: %i\n", xConfEth.ucPCAT);

fprintf(fp, " PUS Default Encapsulation Protocol: %i\n", xConfEth.ucEncap);

fprintf(fp, "\n");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ typedef struct EthInterfaceParams{
alt_u8 ucDNS[4];
alt_u8 ucPID;
alt_u8 ucPCAT;
alt_u8 ucEncap;
}TEthInterfaceParams;

typedef struct Globals{
Expand Down
4 changes: 4 additions & 0 deletions G3U_HW_V02_2GB/Software_Project/Firmware/utils/defaults.c
Original file line number Diff line number Diff line change
Expand Up @@ -854,6 +854,10 @@ bool bDeftSetNucDefaultValues(alt_u16 usiDefaultId, alt_u32 uliDefaultValue) {
case eDeftEthPusHpPcatId:
vxDeftNucDefaults.pxEthInterfaceParams->ucPCAT = (alt_u8) uliDefaultValue;
break;
/* PUS Default Encapsulation Protocol (0 = None, 1 = EDEN) */
case eDeftEthPusEncapId:
vxDeftNucDefaults.pxEthInterfaceParams->ucEncap = (alt_u8) uliDefaultValue;
break;
default:
bStatus = FALSE;
break;
Expand Down
3 changes: 2 additions & 1 deletion G3U_HW_V02_2GB/Software_Project/Firmware/utils/defaults.h
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,8 @@ enum DeftEthInterfaceParamsID {
eDeftEthIpV4GatewayId = 10004, /* PUS TCP gateway IPv4 uint32 representation (Example is 192.168.17.1) */
eDeftEthIpV4DNSId = 10005, /* PUS TCP DNS IPv4 uint32 representation (Example is 1.1.1.1) */
eDeftEthPusHpPidId = 10006, /* PUS HP_PID identification (>127 to disable verification) */
eDeftEthPusHpPcatId = 10007 /* PUS HP_PCAT identification (> 15 to disable verification) */
eDeftEthPusHpPcatId = 10007, /* PUS HP_PCAT identification (> 15 to disable verification) */
eDeftEthPusEncapId = 10008 /* PUS Default Encapsulation Protocol (0 = None, 1 = EDEN) */
} EDeftEthInterfaceParamsID;
//! [constants definition]

Expand Down
Binary file not shown.

0 comments on commit d5d9989

Please sign in to comment.