Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • shivaraj.kandhasamy/advligorts
  • gerritkuehn/advligorts
  • ezekiel.dohmen/advligorts
  • michael.thomas/advligorts
  • christopher.wipf/advligorts
  • erik.vonreis/advligorts
  • keith-thorne/advligorts
  • jonathan-hanks/advligorts
  • jameson.rollins/advligorts
  • rolf.bork/advligorts
  • cds/software/advligorts
11 results
Show changes
Commits on Source (22)
...@@ -929,11 +929,6 @@ net_writer_c::consumer( ) ...@@ -929,11 +929,6 @@ net_writer_c::consumer( )
char* data = buffptr->block_ptr( nb ); char* data = buffptr->block_ptr( nb );
for ( int i = 0; i < num_channels; i++ ) for ( int i = 0; i < num_channels; i++ )
{ {
printf( "Byteswap %s rate=%d type=%d\n",
channels[ i ].name,
channels[ i ].sample_rate,
channels[ i ].data_type );
if ( channels[ i ].bps == 4 ) if ( channels[ i ].bps == 4 )
{ {
for ( int j = 0; j < channels[ i ].sample_rate; j++ ) for ( int j = 0; j < channels[ i ].sample_rate; j++ )
......
...@@ -2,10 +2,10 @@ Library { ...@@ -2,10 +2,10 @@ Library {
Name "CDS_PARTS" Name "CDS_PARTS"
Version 9.3 Version 9.3
SavedCharacterEncoding "UTF-8" SavedCharacterEncoding "UTF-8"
LogicAnalyzerPlugin "on"
WebScopes_FoundationPlugin "on"
DiagnosticSuppressor "on" DiagnosticSuppressor "on"
SLCCPlugin "on" SLCCPlugin "on"
WebScopes_FoundationPlugin "on"
LogicAnalyzerPlugin "on"
NotesPlugin "on" NotesPlugin "on"
LibraryType "BlockLibrary" LibraryType "BlockLibrary"
EnableAccessToBaseWorkspace on EnableAccessToBaseWorkspace on
...@@ -24,7 +24,7 @@ Library { ...@@ -24,7 +24,7 @@ Library {
$ObjectID 2 $ObjectID 2
$ClassName "Simulink.WindowInfo" $ClassName "Simulink.WindowInfo"
IsActive [1] IsActive [1]
Location [729.0, 64.0, 1036.0, 877.0] Location [2110.0, 146.0, 1036.0, 877.0]
Object { Object {
$PropName "ModelBrowserInfo" $PropName "ModelBrowserInfo"
$ObjectID 3 $ObjectID 3
...@@ -48,10 +48,10 @@ Library { ...@@ -48,10 +48,10 @@ Library {
$ClassName "Simulink.EditorInfo" $ClassName "Simulink.EditorInfo"
IsActive [1] IsActive [1]
ViewObjType "SimulinkSubsys" ViewObjType "SimulinkSubsys"
LoadSaveID "150" LoadSaveID "322"
Extents [735.0, 687.0] Extents [747.0, 703.0]
ZoomFactor [1.5] ZoomFactor [1.25]
Offset [-17.569047619048717, 227.907229427522] Offset [-149.32091882185546, 229.24999999999994]
} }
Object { Object {
$PropName "DockComponentsInfo" $PropName "DockComponentsInfo"
...@@ -68,15 +68,15 @@ Library { ...@@ -68,15 +68,15 @@ Library {
Height [480] Height [480]
Minimized "Unset" Minimized "Unset"
} }
WindowState "AAAA/wAAAAD9AAAAAgAAAAAAAAD1AAAC8PwCAAAAA/sAAAAWAEQAbwBjAGsAVwBpAGQAZwBlAHQAMwEAAAAxAAAB+AAAA" WindowState "AAAA/wAAAAD9AAAAAgAAAAAAAAD1AAAC+fwCAAAAA/sAAAAWAEQAbwBjAGsAVwBpAGQAZwBlAHQAMwEAAAAxAAAB+AAAA"
"AAAAAAA+wAAABYARABvAGMAawBXAGkAZABnAGUAdAA0AAAAAAD/////AAAAAAAAAAD7AAAAUgBHAEwAVQBFADIAIAB0AHIAZQBlACAAYwBvAG0Ac" "AAAAAAA+wAAABYARABvAGMAawBXAGkAZABnAGUAdAA0AAAAAAD/////AAAAAAAAAAD7AAAAUgBHAEwAVQBFADIAIAB0AHIAZQBlACAAYwBvAG0Ac"
"ABvAG4AZQBuAHQALwBHAEwAVQBFADIAIAB0AHIAZQBlACAAYwBvAG0AcABvAG4AZQBuAHQBAAAAQAAAAvAAAACAAP///wAAAAEAAAAAAAAAAPwCA" "ABvAG4AZQBuAHQALwBHAEwAVQBFADIAIAB0AHIAZQBlACAAYwBvAG0AcABvAG4AZQBuAHQBAAAAOQAAAvkAAABiAP///wAAAAEAAAAAAAAAAPwCA"
"AAAAfsAAABUAEcATABVAEUAMgA6AFAAcgBvAHAAZQByAHQAeQBJAG4AcwBwAGUAYwB0AG8AcgAvAFAAcgBvAHAAZQByAHQAeQAgAEkAbgBzAHAAZ" "AAAAfsAAABUAEcATABVAEUAMgA6AFAAcgBvAHAAZQByAHQAeQBJAG4AcwBwAGUAYwB0AG8AcgAvAFAAcgBvAHAAZQByAHQAeQAgAEkAbgBzAHAAZ"
"QBjAHQAbwByAAAAAAD/////AAABrAD///8AAAMFAAAC8AAAAAEAAAACAAAAAQAAAAL8AAAAAQAAAAIAAAAP/////wAAAAAA/////wAAAAAAAAAA/" "QBjAHQAbwByAAAAAAD/////AAABrAD///8AAAMRAAAC+QAAAAEAAAACAAAAAQAAAAL8AAAAAQAAAAIAAAAP/////wAAAAAA/////wAAAAAAAAAA/"
"////wEAAAAA/////wAAAAAAAAAA/////wAAAAAA/////wAAAAAAAAAA/////wAAAAAA/////wAAAAAAAAAA/////wAAAAAA/////wAAAAAAAAAA/" "////wEAAAAA/////wAAAAAAAAAA/////wAAAAAA/////wAAAAAAAAAA/////wAAAAAA/////wAAAAAAAAAA/////wAAAAAA/////wAAAAAAAAAA/"
"////wEAAACK/////wAAAAAAAAAA/////wEAAADy/////wAAAAAAAAAA/////wAAAAAA/////wAAAAAAAAAA/////wAAAAAA/////wAAAAAAAAAA/" "////wEAAACA/////wAAAAAAAAAA/////wEAAADo/////wAAAAAAAAAA/////wAAAAAA/////wAAAAAAAAAA/////wAAAAAA/////wAAAAAAAAAA/"
"////wAAAAAA/////wAAAAAAAAAA/////wAAAAAA/////wAAAAAAAAAA/////wAAAAAA/////wAAAAAAAAAA/////wEAAAFK/////wAAAAAAAAAA/" "////wAAAAAA/////wAAAAAAAAAA/////wAAAAAA/////wAAAAAAAAAA/////wAAAAAA/////wAAAAAAAAAA/////wEAAAE7/////wAAAAAAAAAA/"
"////wEAAAGB/////wAAAAAAAAAA/////wAAAAAA/////wAAAAAAAAAA" "////wAAAAAA/////wAAAAAAAAAA/////wAAAAAA/////wAAAAAAAAAA"
} }
} }
HideAutomaticNames on HideAutomaticNames on
...@@ -86,9 +86,9 @@ Library { ...@@ -86,9 +86,9 @@ Library {
ModifiedByFormat "%<Auto>" ModifiedByFormat "%<Auto>"
LastModifiedBy "ezekiel.dohmen" LastModifiedBy "ezekiel.dohmen"
ModifiedDateFormat "%<Auto>" ModifiedDateFormat "%<Auto>"
LastModifiedDate "Tue Apr 12 10:14:15 2022" LastModifiedDate "Tue May 31 15:00:36 2022"
RTWModifiedTimeStamp 571659248 RTWModifiedTimeStamp 575910028
ModelVersionFormat "1.%<AutoIncrement:404>" ModelVersionFormat "1.%<AutoIncrement:405>"
SampleTimeColors off SampleTimeColors off
SampleTimeAnnotations off SampleTimeAnnotations off
LibraryLinkDisplay "all" LibraryLinkDisplay "all"
...@@ -1035,6 +1035,25 @@ Library { ...@@ -1035,6 +1035,25 @@ Library {
Block { Block {
BlockType Ground BlockType Ground
} }
Block {
BlockType Inport
Port "1"
OutputFunctionCall off
OutMin "[]"
OutMax "[]"
OutDataTypeStr "Inherit: auto"
LockScale off
BusOutputAsStruct off
Unit "inherit"
PortDimensions "-1"
VarSizeSig "Inherit"
SampleTime "-1"
SignalType "auto"
SamplingMode "auto"
LatchByDelayingOutsideSignal off
LatchInputForFeedbackSignals off
Interpolate on
}
Block { Block {
BlockType Logic BlockType Logic
Operator "AND" Operator "AND"
...@@ -1067,6 +1086,29 @@ Library { ...@@ -1067,6 +1086,29 @@ Library {
BusObject "BusObject" BusObject "BusObject"
NonVirtualBus off NonVirtualBus off
} }
Block {
BlockType Outport
Port "1"
OutMin "[]"
OutMax "[]"
OutDataTypeStr "Inherit: auto"
LockScale off
BusOutputAsStruct off
Unit "inherit"
PortDimensions "-1"
VarSizeSig "Inherit"
SampleTime "-1"
SignalType "auto"
SamplingMode "auto"
EnsureOutportIsVirtual off
SourceOfInitialOutputValue "Dialog"
OutputWhenDisabled "held"
InitialOutput "[]"
MustResolveToSignalObject off
OutputWhenUnConnected off
OutputWhenUnconnectedValue "0"
VectorParamsAs1DForOutWhenUnconnected off
}
Block { Block {
BlockType Product BlockType Product
Inputs "2" Inputs "2"
...@@ -1192,7 +1234,7 @@ Library { ...@@ -1192,7 +1234,7 @@ Library {
} }
System { System {
Name "CDS_PARTS" Name "CDS_PARTS"
Location [729, 64, 1765, 941] Location [2110, 146, 3146, 1023]
Open off Open off
PortBlocksUseCompactNotation off PortBlocksUseCompactNotation off
SetExecutionDomain off SetExecutionDomain off
...@@ -1207,9 +1249,9 @@ Library { ...@@ -1207,9 +1249,9 @@ Library {
TiledPaperMargins [0.500000, 0.500000, 0.500000, 0.500000] TiledPaperMargins [0.500000, 0.500000, 0.500000, 0.500000]
TiledPageScale 1 TiledPageScale 1
ShowPageBoundaries off ShowPageBoundaries off
ZoomFactor "100" ZoomFactor "125"
ReportName "simulink-default.rpt" ReportName "simulink-default.rpt"
SIDHighWatermark "389" SIDHighWatermark "392"
SimulinkSubDomain "Simulink" SimulinkSubDomain "Simulink"
Block { Block {
BlockType SubSystem BlockType SubSystem
...@@ -5047,8 +5089,8 @@ Library { ...@@ -5047,8 +5089,8 @@ Library {
RequestExecContextInheritance off RequestExecContextInheritance off
System { System {
Name "Osc/Phase" Name "Osc/Phase"
Location [729, 64, 1765, 941] Location [2078, 203, 3114, 1080]
Open on Open off
PortBlocksUseCompactNotation off PortBlocksUseCompactNotation off
SetExecutionDomain off SetExecutionDomain off
ExecutionDomainType "Deduce" ExecutionDomainType "Deduce"
...@@ -5979,8 +6021,8 @@ Library { ...@@ -5979,8 +6021,8 @@ Library {
RequestExecContextInheritance off RequestExecContextInheritance off
System { System {
Name "simLinkParts" Name "simLinkParts"
Location [694, 249, 1730, 1296] Location [2110, 146, 3146, 1023]
Open off Open on
PortBlocksUseCompactNotation off PortBlocksUseCompactNotation off
SetExecutionDomain off SetExecutionDomain off
ExecutionDomainType "Deduce" ExecutionDomainType "Deduce"
...@@ -5994,7 +6036,7 @@ Library { ...@@ -5994,7 +6036,7 @@ Library {
TiledPaperMargins [0.500000, 0.500000, 0.500000, 0.500000] TiledPaperMargins [0.500000, 0.500000, 0.500000, 0.500000]
TiledPageScale 1 TiledPageScale 1
ShowPageBoundaries off ShowPageBoundaries off
ZoomFactor "100" ZoomFactor "125"
SimulinkSubDomain "Simulink" SimulinkSubDomain "Simulink"
Block { Block {
BlockType Abs BlockType Abs
...@@ -6086,13 +6128,14 @@ Library { ...@@ -6086,13 +6128,14 @@ Library {
BackgroundColor "yellow" BackgroundColor "yellow"
ShowName off ShowName off
AttributesFormatString "%<Description>" AttributesFormatString "%<Description>"
LibraryVersion "1.281" LibraryVersion "1.453"
UserDataPersistent on UserDataPersistent on
UserData "DataTag58" UserData "DataTag58"
SourceBlock "simulink/Model-Wide\nUtilities/DocBlock" SourceBlock "simulink/Model-Wide\nUtilities/DocBlock"
SourceType "DocBlock" SourceType "DocBlock"
SourceProductName "Simulink" SourceProductName "Simulink"
SourceProductBaseCode "SL" SourceProductBaseCode "SL"
ContentPreviewEnabled off
DocumentType "Text" DocumentType "Text"
} }
Block { Block {
...@@ -6106,13 +6149,14 @@ Library { ...@@ -6106,13 +6149,14 @@ Library {
BackgroundColor "yellow" BackgroundColor "yellow"
ShowName off ShowName off
AttributesFormatString "%<Description>" AttributesFormatString "%<Description>"
LibraryVersion "1.281" LibraryVersion "1.453"
UserDataPersistent on UserDataPersistent on
UserData "DataTag59" UserData "DataTag59"
SourceBlock "simulink/Model-Wide\nUtilities/DocBlock" SourceBlock "simulink/Model-Wide\nUtilities/DocBlock"
SourceType "DocBlock" SourceType "DocBlock"
SourceProductName "Simulink" SourceProductName "Simulink"
SourceProductBaseCode "SL" SourceProductBaseCode "SL"
ContentPreviewEnabled off
DocumentType "Text" DocumentType "Text"
} }
Block { Block {
...@@ -6126,15 +6170,62 @@ Library { ...@@ -6126,15 +6170,62 @@ Library {
BackgroundColor "yellow" BackgroundColor "yellow"
ShowName off ShowName off
AttributesFormatString "%<Description>" AttributesFormatString "%<Description>"
LibraryVersion "1.281" LibraryVersion "1.453"
UserDataPersistent on UserDataPersistent on
UserData "DataTag60" UserData "DataTag60"
SourceBlock "simulink/Model-Wide\nUtilities/DocBlock" SourceBlock "simulink/Model-Wide\nUtilities/DocBlock"
SourceType "DocBlock" SourceType "DocBlock"
SourceProductName "Simulink" SourceProductName "Simulink"
SourceProductBaseCode "SL" SourceProductBaseCode "SL"
ContentPreviewEnabled off
DocumentType "Text" DocumentType "Text"
} }
Block {
BlockType SubSystem
Name "ExampleSubsystem"
SID "390"
Ports [1, 1]
Position [10, 674, 110, 716]
ZOrder 1
RequestExecContextInheritance off
ContentPreviewEnabled on
System {
Name "ExampleSubsystem"
Location [2110, 146, 3146, 1023]
Open off
PortBlocksUseCompactNotation off
SetExecutionDomain off
ExecutionDomainType "Deduce"
ModelBrowserVisibility on
ModelBrowserWidth 200
ScreenColor "white"
PaperOrientation "landscape"
PaperPositionMode "auto"
PaperType "usletter"
PaperUnits "inches"
TiledPaperMargins [0.500000, 0.500000, 0.500000, 0.500000]
TiledPageScale 1
ShowPageBoundaries off
ZoomFactor "100"
SimulinkSubDomain "Simulink"
Block {
BlockType Inport
Name "input1"
SID "391"
Position [110, 103, 140, 117]
ZOrder -1
IconDisplay "Port number"
}
Block {
BlockType Outport
Name "output1"
SID "392"
Position [360, 103, 390, 117]
ZOrder -2
IconDisplay "Port number"
}
}
}
Block { Block {
BlockType Fcn BlockType Fcn
Name "Fcn" Name "Fcn"
...@@ -6238,6 +6329,12 @@ Library { ...@@ -6238,6 +6329,12 @@ Library {
LibraryVersion "1.2" LibraryVersion "1.2"
SourceBlock "cdsSqrt/Subsystem" SourceBlock "cdsSqrt/Subsystem"
SourceType "SubSystem" SourceType "SubSystem"
ShowPortLabels "FromPortIcon"
SystemSampleTime "-1"
GeneratePreprocessorConditionals off
AllowZeroVariantControls off
PropagateVariantConditions off
ContentPreviewEnabled off
} }
Block { Block {
BlockType Saturate BlockType Saturate
...@@ -6289,6 +6386,12 @@ Library { ...@@ -6289,6 +6386,12 @@ Library {
LibraryVersion "1.4" LibraryVersion "1.4"
SourceBlock "cdsBitwise/Subsystem" SourceBlock "cdsBitwise/Subsystem"
SourceType "SubSystem" SourceType "SubSystem"
ShowPortLabels "FromPortIcon"
SystemSampleTime "-1"
GeneratePreprocessorConditionals off
AllowZeroVariantControls off
PropagateVariantConditions off
ContentPreviewEnabled off
} }
Annotation { Annotation {
SID "343" SID "343"
......
...@@ -17,6 +17,12 @@ $(shell cp -rp $(RCG_SRC)/src/fe/ $(mkfile_dir)/src/) ...@@ -17,6 +17,12 @@ $(shell cp -rp $(RCG_SRC)/src/fe/ $(mkfile_dir)/src/)
$(shell cp -rp $(RCG_SRC)/src/drv/ $(mkfile_dir)/src/) $(shell cp -rp $(RCG_SRC)/src/drv/ $(mkfile_dir)/src/)
$(shell cp -rp $(RCG_SRC)/src/shmem/ $(mkfile_dir)/src/) $(shell cp -rp $(RCG_SRC)/src/shmem/ $(mkfile_dir)/src/)
# We always want to take these values from the below
# KernelVars.mk script and not the ENV
undefine IOP_MODEL
undefine BUILD_WITH_DOLPHIN
# Include the generated make variables, written by # Include the generated make variables, written by
# the feCodeGen.pl script. # the feCodeGen.pl script.
include $(mkfile_dir)/KernelVars.mk include $(mkfile_dir)/KernelVars.mk
......
...@@ -643,7 +643,7 @@ sub node_processing { ...@@ -643,7 +643,7 @@ sub node_processing {
return 1; # Do not call this function on leaves, we already did that return 1; # Do not call this function on leaves, we already did that
} elsif ($block_type eq "Reference") { } elsif ($block_type eq "Reference") {
if ($source_block =~ /cdsIPCx/) { if ($source_block =~ /cdsIPCx/) {
if ($block_name !~ /[CGHKLMSX]\d\:/) { if ($block_name !~ /[A-Z]\d\:/) {
die "***ERROR: Signal name of IPCx module must include IFO: $block_name\n"; die "***ERROR: Signal name of IPCx module must include IFO: $block_name\n";
} }
} }
......
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
#include "modelRateInfo.h" #include "modelRateInfo.h"
#include "fm10Gen.h" #include "fm10Gen.h"
#include "util/printl.h" #include "util/printl.h"
#include "util/kernel/exit_signaling.h"
#include "../fe/timing_common.h" //captureEocTiming #include "../fe/timing_common.h" //captureEocTiming
#include "../fe/timing_kernel.h" #include "../fe/timing_kernel.h"
...@@ -204,6 +204,8 @@ fe_start_controller( void ) ...@@ -204,6 +204,8 @@ fe_start_controller( void )
if ( initVars( pDsp[ 0 ], pDsp[ 0 ], dspCoeff, MAX_MODULES, pCoeff[ 0 ] ) ) if ( initVars( pDsp[ 0 ], pDsp[ 0 ], dspCoeff, MAX_MODULES, pCoeff[ 0 ] ) )
{ {
pLocalEpics->epicsOutput.fe_status = FILT_INIT_ERROR; pLocalEpics->epicsOutput.fe_status = FILT_INIT_ERROR;
wait_for_exit_signal();
atomic_set(&g_atom_has_exited, 1);
return; return;
} }
...@@ -243,6 +245,8 @@ fe_start_controller( void ) ...@@ -243,6 +245,8 @@ fe_start_controller( void )
{ {
pLocalEpics->epicsOutput.fe_status = DAQ_INIT_ERROR; pLocalEpics->epicsOutput.fe_status = DAQ_INIT_ERROR;
vmeDone = 1; vmeDone = 1;
wait_for_exit_signal();
atomic_set(&g_atom_has_exited, 1);
return; return;
} }
#endif #endif
...@@ -287,6 +291,8 @@ fe_start_controller( void ) ...@@ -287,6 +291,8 @@ fe_start_controller( void )
if ( status ) if ( status )
{ {
pLocalEpics->epicsOutput.fe_status = DAC_INIT_ERROR; pLocalEpics->epicsOutput.fe_status = DAC_INIT_ERROR;
wait_for_exit_signal();
atomic_set(&g_atom_has_exited, 1);
return; return;
} }
...@@ -385,6 +391,8 @@ fe_start_controller( void ) ...@@ -385,6 +391,8 @@ fe_start_controller( void )
pLocalEpics->epicsOutput.diagWord |= ADC_TIMEOUT_ERR; pLocalEpics->epicsOutput.diagWord |= ADC_TIMEOUT_ERR;
pLocalEpics->epicsOutput.fe_status = ADC_TO_ERROR; pLocalEpics->epicsOutput.fe_status = ADC_TO_ERROR;
deallocate_dac_channels( ); deallocate_dac_channels( );
wait_for_exit_signal();
atomic_set(&g_atom_has_exited, 1);
return; return;
} }
...@@ -497,7 +505,7 @@ fe_start_controller( void ) ...@@ -497,7 +505,7 @@ fe_start_controller( void )
// ***************************************************************** // *****************************************************************
/// \> Check if code exit is requested /// \> Check if code exit is requested
if ( cycleNum == MAX_MODULES ) if ( cycleNum == MAX_MODULES )
vmeDone = stop_working_threads | vmeDone = atomic_read(&g_atom_should_exit) |
checkEpicsReset( cycleNum, (struct CDS_EPICS*)pLocalEpics ); checkEpicsReset( cycleNum, (struct CDS_EPICS*)pLocalEpics );
// ***************************************************************** // *****************************************************************
...@@ -673,5 +681,6 @@ fe_start_controller( void ) ...@@ -673,5 +681,6 @@ fe_start_controller( void )
deallocate_dac_channels( ); deallocate_dac_channels( );
/* System reset command received */ /* System reset command received */
atomic_set(&g_atom_has_exited, 1);
return; return;
} }
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
#include "fm10Gen_types.h" #include "fm10Gen_types.h"
#include "controller.h" #include "controller.h"
#include "modelRateInfo.h" #include "modelRateInfo.h"
#include "util/kernel/exit_signaling.h"
#include "drv/daqLib.h" #include "drv/daqLib.h"
#include "../fe/timing_kernel.h" #include "../fe/timing_kernel.h"
#include "../fe/sync21pps.h" #include "../fe/sync21pps.h"
...@@ -256,6 +257,8 @@ fe_start_controller( void ) ...@@ -256,6 +257,8 @@ fe_start_controller( void )
{ {
pLocalEpics->epicsOutput.fe_status = FILT_INIT_ERROR; pLocalEpics->epicsOutput.fe_status = FILT_INIT_ERROR;
fe_status_return = FILT_INIT_ERROR; fe_status_return = FILT_INIT_ERROR;
wait_for_exit_signal();
atomic_set(&g_atom_has_exited, 1);
return; return;
} }
...@@ -291,6 +294,8 @@ fe_start_controller( void ) ...@@ -291,6 +294,8 @@ fe_start_controller( void )
pLocalEpics->epicsOutput.fe_status = DAQ_INIT_ERROR; pLocalEpics->epicsOutput.fe_status = DAQ_INIT_ERROR;
fe_status_return = DAQ_INIT_ERROR; fe_status_return = DAQ_INIT_ERROR;
vmeDone = 1; vmeDone = 1;
wait_for_exit_signal();
atomic_set(&g_atom_has_exited, 1);
return; return;
} }
...@@ -619,7 +624,7 @@ fe_start_controller( void ) ...@@ -619,7 +624,7 @@ fe_start_controller( void )
pLocalEpics->epicsOutput.diagWord |= ADC_TIMEOUT_ERR; pLocalEpics->epicsOutput.diagWord |= ADC_TIMEOUT_ERR;
pLocalEpics->epicsOutput.fe_status = ADC_TO_ERROR; pLocalEpics->epicsOutput.fe_status = ADC_TO_ERROR;
pLocalEpics->epicsOutput.epicsSync++; pLocalEpics->epicsOutput.epicsSync++;
stop_working_threads = 1; atomic_set(&g_atom_should_exit, 1);
vmeDone = 1; vmeDone = 1;
continue; continue;
} }
...@@ -631,7 +636,7 @@ fe_start_controller( void ) ...@@ -631,7 +636,7 @@ fe_start_controller( void )
feStatus |= adc_status_update( &adcinfo ); feStatus |= adc_status_update( &adcinfo );
pLocalEpics->epicsOutput.stateWord = FE_ERROR_ADC; pLocalEpics->epicsOutput.stateWord = FE_ERROR_ADC;
pLocalEpics->epicsOutput.fe_status = CHAN_HOP_ERROR; pLocalEpics->epicsOutput.fe_status = CHAN_HOP_ERROR;
stop_working_threads = 1; atomic_set(&g_atom_should_exit, 1);
vmeDone = 1; vmeDone = 1;
pLocalEpics->epicsOutput.epicsSync++; pLocalEpics->epicsOutput.epicsSync++;
continue; continue;
...@@ -884,7 +889,7 @@ fe_start_controller( void ) ...@@ -884,7 +889,7 @@ fe_start_controller( void )
// ***************************************************************** // *****************************************************************
/// \> Check if code exit is requested /// \> Check if code exit is requested
if ( cycleNum == MAX_MODULES ) if ( cycleNum == MAX_MODULES )
vmeDone = stop_working_threads | vmeDone = atomic_read(&g_atom_should_exit) |
checkEpicsReset( cycleNum, (struct CDS_EPICS*)pLocalEpics ); checkEpicsReset( cycleNum, (struct CDS_EPICS*)pLocalEpics );
// ***************************************************************** // *****************************************************************
...@@ -1249,5 +1254,6 @@ fe_start_controller( void ) ...@@ -1249,5 +1254,6 @@ fe_start_controller( void )
pLocalEpics->epicsOutput.cpuMeter = 0; pLocalEpics->epicsOutput.cpuMeter = 0;
/* System reset command received */ /* System reset command received */
atomic_set(&g_atom_has_exited, 1);
return; return;
} }
...@@ -8,6 +8,8 @@ ...@@ -8,6 +8,8 @@
#include "verify_card_count.h" #include "verify_card_count.h"
#include "print_io_info.h" #include "print_io_info.h"
#include "util/printl.h" #include "util/printl.h"
#include "util/timing.h"
#include "util/kernel/exit_signaling.h"
#include "drv/map.h" //mapPciModules() #include "drv/map.h" //mapPciModules()
#include "drv/ligoPcieTiming.h" #include "drv/ligoPcieTiming.h"
#include "../fe/verify_slots.h" #include "../fe/verify_slots.h"
...@@ -29,10 +31,18 @@ extern void fe_start_controller( void ); ...@@ -29,10 +31,18 @@ extern void fe_start_controller( void );
// //
// File function prototypes // File function prototypes
// //
void rt_fe_cleanup( void ); static void rt_fe_cleanup( void );
int rt_fe_init( void ); static int rt_fe_init( void );
//
// Signaling variables for proper module shutdown logic
atomic_t g_atom_should_exit = ATOMIC_INIT(0);
atomic_t g_atom_has_exited = ATOMIC_INIT(0);
//
// This symbol is used to enforce the IOP model
// is first loaded, before any app models
#ifdef IOP_MODEL #ifdef IOP_MODEL
int need_to_load_IOP_first; int need_to_load_IOP_first;
EXPORT_SYMBOL( need_to_load_IOP_first ); EXPORT_SYMBOL( need_to_load_IOP_first );
...@@ -55,14 +65,13 @@ static int fe_start_controller_kthread( void * arg ) ...@@ -55,14 +65,13 @@ static int fe_start_controller_kthread( void * arg )
fe_start_controller(); fe_start_controller();
return 0; return 0;
} }
#endif //NO_CPU_SHUTDOWN #endif //NO_CPU_SHUTDOWN
// MAIN routine: Code starting point
// Linux Module init: Code starting point
// **************************************************************** // ****************************************************************
/// Startup function for initialization of kernel module. /// Startup function for initialization of kernel module.
int static int __init rt_fe_init( void )
rt_fe_init( void )
{ {
int jj, kk; /// @param ii,jj,kk default loop counters int jj, kk; /// @param ii,jj,kk default loop counters
int cards; /// @param cards Number of PCIe cards found on bus int cards; /// @param cards Number of PCIe cards found on bus
...@@ -85,7 +94,7 @@ rt_fe_init( void ) ...@@ -85,7 +94,7 @@ rt_fe_init( void )
#ifndef NO_CPU_SHUTDOWN #ifndef NO_CPU_SHUTDOWN
/// Verify requested core is free. /// Verify requested core is free.
if ( is_cpu_taken_by_rcg_model( CPUID ) ) if ( is_cpu_occupied( CPUID ) )
{ {
printl( KERN_ALERT "Error: CPU %d already taken\n", CPUID ); printl( KERN_ALERT "Error: CPU %d already taken\n", CPUID );
return -1; return -1;
...@@ -141,7 +150,6 @@ rt_fe_init( void ) ...@@ -141,7 +150,6 @@ rt_fe_init( void )
{ {
pLocalEpics->epicsOutput.fe_status = IO_CARD_MAP_ERROR; pLocalEpics->epicsOutput.fe_status = IO_CARD_MAP_ERROR;
rt_fe_cleanup( ); rt_fe_cleanup( );
detach_shared_memory();
return -5; return -5;
} }
...@@ -151,7 +159,6 @@ rt_fe_init( void ) ...@@ -151,7 +159,6 @@ rt_fe_init( void )
printl( "" SYSTEM_NAME_STRING_LOWER printl( "" SYSTEM_NAME_STRING_LOWER
": ERROR: No ADC cards found - exiting\n" ); ": ERROR: No ADC cards found - exiting\n" );
rt_fe_cleanup( ); rt_fe_cleanup( );
detach_shared_memory();
return -5; return -5;
} }
...@@ -231,7 +238,6 @@ rt_fe_init( void ) ...@@ -231,7 +238,6 @@ rt_fe_init( void )
printl( "" SYSTEM_NAME_STRING_LOWER printl( "" SYSTEM_NAME_STRING_LOWER
": ERROR: Exit on incorrect card count \n" ); ": ERROR: Exit on incorrect card count \n" );
rt_fe_cleanup( ); rt_fe_cleanup( );
detach_shared_memory();
return -5; return -5;
} }
#endif #endif
...@@ -262,7 +268,7 @@ rt_fe_init( void ) ...@@ -262,7 +268,7 @@ rt_fe_init( void )
printl( "" SYSTEM_NAME_STRING_LOWER ": Locking CPU core %d\n", CPUID ); printl( "" SYSTEM_NAME_STRING_LOWER ": Locking CPU core %d\n", CPUID );
// The code runs on the disabled CPU // The code runs on the disabled CPU
set_fe_code_idle( fe_start_controller, CPUID ); set_rt_callback( fe_start_controller, CPUID );
msleep( 100 ); msleep( 100 );
rts_isolator_exec( CPUID ); rts_isolator_exec( CPUID );
...@@ -270,40 +276,49 @@ rt_fe_init( void ) ...@@ -270,40 +276,49 @@ rt_fe_init( void )
return 0; return 0;
} }
void wait_for_module_exit(void)
{
uint64_t stop_sig_time_ns = getMonotonic_ns_utin64();
if( is_cpu_occupied(CPUID) )
{
set_rt_callback( 0, CPUID );
// Wait for the module to signal that it has exited
while (atomic_read(&g_atom_has_exited) == 0)
{
msleep( 1 );
}
printl("It took %lld ms for the RT code to exit.\n",
(getMonotonic_ns_utin64() - stop_sig_time_ns)/1000000);
set_rt_callback( 0, CPUID );
msleep( 1000 );
// Bring the CPU back up
rts_isolator_cleanup( CPUID );
}
}
/// Kernel module cleanup function /// Kernel module cleanup function
void static void __exit rt_fe_cleanup( void )
rt_fe_cleanup( void )
{ {
#ifndef NO_CPU_SHUTDOWN
/// Unset the code callback
set_fe_code_idle( 0, CPUID );
#endif
// printl("Setting stop_working_threads to 1\n"); // Signal the model to stop
// Stop the code and wait atomic_set(&g_atom_should_exit, 1);
#ifdef NO_CPU_SHUTDOWN #ifdef NO_CPU_SHUTDOWN
kthread_stop( sthread ); kthread_stop( sthread );
#endif
stop_working_threads = 1;
msleep( 1000 ); msleep( 1000 );
#else
wait_for_module_exit();
#endif
#ifdef DOLPHIN_TEST #ifdef DOLPHIN_TEST
/// Cleanup Dolphin card connections /// Cleanup Dolphin card connections
finish_dolphin( ); finish_dolphin( );
#endif #endif
#ifndef NO_CPU_SHUTDOWN
/// Bring the CPU core back on line
// Unset the code callback
set_fe_code_idle( 0, CPUID );
// printll("Will bring back CPU %d\n", CPUID);
msleep( 1000 );
// Bring the CPU back up
rts_isolator_cleanup( CPUID );
msleep( 1000 );
#endif
// Print out any error messages from FE code on exit // Print out any error messages from FE code on exit
print_exit_messages( fe_status_return, fe_status_return_subcode, SYSTEM_NAME_STRING_LOWER ); print_exit_messages( fe_status_return, fe_status_return_subcode, SYSTEM_NAME_STRING_LOWER );
detach_shared_memory( ); detach_shared_memory( );
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "dtt/gdserrmsg.h" #include "dtt/gdserrmsg.h"
#include "tconv.h" #include "tconv.h"
#include "testpoint_interface_v3.h" #include "testpoint_interface_v3.h"
#include "testpoint.h"
#if defined (_CONFIG_DYNAMIC) #if defined (_CONFIG_DYNAMIC)
#include "confinfo.h" #include "confinfo.h"
...@@ -1078,7 +1079,6 @@ int testAwgTpInterfaceVersion(int node) ...@@ -1078,7 +1079,6 @@ int testAwgTpInterfaceVersion(int node)
return node_version[ node ]; return node_version[ node ];
} }
testpoint_t tp[ 128 ];
resultQueryTP_r result; resultQueryTP_r result;
memset (&result, 0, sizeof (resultQueryTP_r)); memset (&result, 0, sizeof (resultQueryTP_r));
...@@ -1095,6 +1095,8 @@ int testAwgTpInterfaceVersion(int node) ...@@ -1095,6 +1095,8 @@ int testAwgTpInterfaceVersion(int node)
return 0; return 0;
} }
// Test if TP_ASC_TP_INTERFACE is accessible
// if so, we must be older version 3, otherwise, something newer.
if ((querytp_1 (tpNode[node].id, node, TP_ASC_TP_INTERFACE, 128, 0, if ((querytp_1 (tpNode[node].id, node, TP_ASC_TP_INTERFACE, 128, 0,
0, &result, clnt) == RPC_SUCCESS) && (result.status >= 0)) { 0, &result, clnt) == RPC_SUCCESS) && (result.status >= 0)) {
printf("found version 3 or older test point interface\n"); printf("found version 3 or older test point interface\n");
...@@ -1106,6 +1108,7 @@ int testAwgTpInterfaceVersion(int node) ...@@ -1106,6 +1108,7 @@ int testAwgTpInterfaceVersion(int node)
node_version[node] = 4; node_version[node] = 4;
} }
xdr_free ((xdrproc_t)xdr_resultQueryTP_r, (char*) &result);
clnt_destroy (clnt); clnt_destroy (clnt);
return node_version[node]; return node_version[node];
} }
\ No newline at end of file
...@@ -5,8 +5,11 @@ ...@@ -5,8 +5,11 @@
#include "controllerko.h" //CDIO* Globals and tdsControl/tdsCount #include "controllerko.h" //CDIO* Globals and tdsControl/tdsCount
#include "modelRateInfo.h" ////CYCLE_PER_SECOND, FE_RATE #include "modelRateInfo.h" ////CYCLE_PER_SECOND, FE_RATE
#include "qnorm.h"
#include "util/inlineMath.h" #include "util/inlineMath.h"
#include "util/timing.h" #include "util/timing.h"
#include "util/random_bytes.h"
#include "util/prng_xoroshiroPP.h"
#include "fm10Gen.h" #include "fm10Gen.h"
#include "tRamp.h" #include "tRamp.h"
#include "isnan.h" #include "isnan.h"
......
...@@ -106,7 +106,7 @@ ...@@ -106,7 +106,7 @@
#ifndef LIGO_QNORM_H #ifndef LIGO_QNORM_H
#define LIGO_QNORM_H #define LIGO_QNORM_H
#include "inlineMath.h" #include "util/inlineMath.h"
#define ML_POSINF (1.0 / 0.0) #define ML_POSINF (1.0 / 0.0)
......
#ifndef LIGO_EXIT_SIGNALING_H
#define LIGO_EXIT_SIGNALING_H
#include <linux/types.h>
#include <linux/delay.h>
#include <linux/atomic.h>
// Used to signal the model to exit, defined in fe/moduleLoad.c
extern atomic_t g_atom_should_exit;
// Used by fe_start_controller() (The model) to signal it has exited,
// defined in fe/moduleLoad.c
extern atomic_t g_atom_has_exited;
// When a model experiences a nonrecoverable error and needs to exit
// we block execution with this function until the model is rmmod-ed
static void wait_for_exit_signal(void)
{
while(atomic_read(&g_atom_should_exit) == 0)
{
}
}
#endif //LIGO_EXIT_SIGNALING_H