##// END OF EJS Templates
the function asm_reorganize format the spectral matrix to the ICD format
paul -
r103:b24459a013ed VHDLib206
parent child
Show More
@@ -1,13 +1,13
1 #!/usr/bin/lppmon -e
1 #!/usr/bin/lppmon -e
2
2
3 proxy.loadSysDriver("RMAPPlugin","RMAPplugin0");
3 proxy.loadSysDriver("RMAPPlugin","RMAPPlugin0");
4 proxy.loadSysDriverToParent("dsu3plugin","RMAPplugin0");
4 proxy.loadSysDriverToParent("dsu3plugin","RMAPPlugin0");
5
5
6 #BUTTON_selectStarDundee.click()
6 #BUTTON_selectStarDundee.click()
7 BUTTON_selectGRESB.click()
7 BUTTON_selectGRESB.click()
8 BUTTON_rmapOpenCommunication.click()
8
9
9 BUTTON_rmapOpenCommunication.click()
10 dsu3plugin0.openFile("/opt/DEV_PLE/FSW-qt/bin/fsw")
10 dsu3plugin0.openFile("/opt/DEV_PLE/FSW-qt/bin/fsw")
11 dsu3plugin0.loadFile()
11 dsu3plugin0.loadFile()
12 dsu3plugin0.run()
12 dsu3plugin0.run()
13
13
@@ -1,20 +1,21
1 #!/usr/bin/lppmon -e
1 #!/usr/bin/lppmon -e
2
2
3 address_to_read = 0x80000f08
3 address_to_read = 0x80000f08
4 val = RMAPPlugin0.Read( address_to_read, 1)
4 val = RMAPPlugin0.Read( address_to_read, 1)
5 matrixF0_Address0 = val[0]
5 matrixF0_Address0 = val[0]
6 print hex(matrixF0_Address0)
6 print hex(matrixF0_Address0)
7
7
8 # BUILD THE DATA
8 # BUILD THE DATA
9 dataToWrite = []
9 dataToWrite = []
10 for frequencyBin in range(128):
10 dataToWrite.append( 0x1234abcd )
11 for component in range (25):
11 dataToWrite.append( 0x4321dcba )
12 dataToWrite.append( component )
13
12
14 #for frequencyBin in range(64):
13 for component in range(25):
15 # for component in range (25):
14 for frequencyBin in range (64):
16 # dataToWrite.append( 2 * component )
15 dataToWrite.append( component + frequencyBin )
16 for frequencyBin in range (64):
17 dataToWrite.append( - (component + frequencyBin) )
17
18
18 # WRITE THE DATA
19 # WRITE THE DATA
19 print len(dataToWrite)
20 print len(dataToWrite)
20 RMAPPlugin0.Write( matrixF0_Address0, dataToWrite )
21 RMAPPlugin0.Write( matrixF0_Address0, dataToWrite )
@@ -1,339 +1,339
1 <?xml version="1.0" encoding="UTF-8"?>
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE QtCreatorProject>
2 <!DOCTYPE QtCreatorProject>
3 <!-- Written by QtCreator 3.0.0, 2014-02-21T15:56:03. -->
3 <!-- Written by QtCreator 3.0.0, 2014-03-03T07:03:32. -->
4 <qtcreator>
4 <qtcreator>
5 <data>
5 <data>
6 <variable>ProjectExplorer.Project.ActiveTarget</variable>
6 <variable>ProjectExplorer.Project.ActiveTarget</variable>
7 <value type="int">1</value>
7 <value type="int">1</value>
8 </data>
8 </data>
9 <data>
9 <data>
10 <variable>ProjectExplorer.Project.EditorSettings</variable>
10 <variable>ProjectExplorer.Project.EditorSettings</variable>
11 <valuemap type="QVariantMap">
11 <valuemap type="QVariantMap">
12 <value type="bool" key="EditorConfiguration.AutoIndent">true</value>
12 <value type="bool" key="EditorConfiguration.AutoIndent">true</value>
13 <value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
13 <value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
14 <value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
14 <value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
15 <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
15 <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
16 <value type="QString" key="language">Cpp</value>
16 <value type="QString" key="language">Cpp</value>
17 <valuemap type="QVariantMap" key="value">
17 <valuemap type="QVariantMap" key="value">
18 <value type="QByteArray" key="CurrentPreferences">CppGlobal</value>
18 <value type="QByteArray" key="CurrentPreferences">CppGlobal</value>
19 </valuemap>
19 </valuemap>
20 </valuemap>
20 </valuemap>
21 <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
21 <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
22 <value type="QString" key="language">QmlJS</value>
22 <value type="QString" key="language">QmlJS</value>
23 <valuemap type="QVariantMap" key="value">
23 <valuemap type="QVariantMap" key="value">
24 <value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
24 <value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
25 </valuemap>
25 </valuemap>
26 </valuemap>
26 </valuemap>
27 <value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
27 <value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
28 <value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
28 <value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
29 <value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
29 <value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
30 <value type="int" key="EditorConfiguration.IndentSize">4</value>
30 <value type="int" key="EditorConfiguration.IndentSize">4</value>
31 <value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
31 <value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
32 <value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
32 <value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
33 <value type="int" key="EditorConfiguration.PaddingMode">1</value>
33 <value type="int" key="EditorConfiguration.PaddingMode">1</value>
34 <value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
34 <value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
35 <value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
35 <value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
36 <value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
36 <value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
37 <value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
37 <value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
38 <value type="int" key="EditorConfiguration.TabSize">8</value>
38 <value type="int" key="EditorConfiguration.TabSize">8</value>
39 <value type="bool" key="EditorConfiguration.UseGlobal">true</value>
39 <value type="bool" key="EditorConfiguration.UseGlobal">true</value>
40 <value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
40 <value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
41 <value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
41 <value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
42 <value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
42 <value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
43 <value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
43 <value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
44 <value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
44 <value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
45 </valuemap>
45 </valuemap>
46 </data>
46 </data>
47 <data>
47 <data>
48 <variable>ProjectExplorer.Project.PluginSettings</variable>
48 <variable>ProjectExplorer.Project.PluginSettings</variable>
49 <valuemap type="QVariantMap"/>
49 <valuemap type="QVariantMap"/>
50 </data>
50 </data>
51 <data>
51 <data>
52 <variable>ProjectExplorer.Project.Target.0</variable>
52 <variable>ProjectExplorer.Project.Target.0</variable>
53 <valuemap type="QVariantMap">
53 <valuemap type="QVariantMap">
54 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop</value>
54 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop</value>
55 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop</value>
55 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop</value>
56 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{e04e3924-0bd8-4708-be18-f1474e45608e}</value>
56 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{e04e3924-0bd8-4708-be18-f1474e45608e}</value>
57 <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
57 <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
58 <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
58 <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
59 <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
59 <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
60 <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
60 <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
61 <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory"></value>
61 <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory"></value>
62 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
62 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
63 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
63 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
64 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
64 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
65 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
65 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
66 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
66 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
67 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
67 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
68 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
68 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
69 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">false</value>
69 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">false</value>
70 <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
70 <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
71 <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
71 <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
72 </valuemap>
72 </valuemap>
73 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
73 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
74 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
74 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
75 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
75 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
76 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
76 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
77 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
77 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
78 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
78 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
79 <value type="QString">-w</value>
79 <value type="QString">-w</value>
80 <value type="QString">-r</value>
80 <value type="QString">-r</value>
81 </valuelist>
81 </valuelist>
82 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
82 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
83 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
83 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
84 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
84 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
85 </valuemap>
85 </valuemap>
86 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
86 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
87 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
87 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
88 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
88 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
89 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
89 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
90 </valuemap>
90 </valuemap>
91 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
91 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
92 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
92 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
93 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
93 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
94 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
94 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
95 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
95 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
96 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
96 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
97 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
97 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
98 <value type="QString">-w</value>
98 <value type="QString">-w</value>
99 <value type="QString">-r</value>
99 <value type="QString">-r</value>
100 </valuelist>
100 </valuelist>
101 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
101 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
102 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
102 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
103 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
103 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
104 </valuemap>
104 </valuemap>
105 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
105 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
106 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
106 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
107 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
107 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
108 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
108 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
109 </valuemap>
109 </valuemap>
110 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
110 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
111 <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
111 <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
112 <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
112 <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
113 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value>
113 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value>
114 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
114 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
115 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
115 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
116 <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
116 <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
117 <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
117 <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
118 </valuemap>
118 </valuemap>
119 <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">1</value>
119 <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">1</value>
120 <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
120 <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
121 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
121 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
122 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
122 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
123 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
123 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
124 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
124 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
125 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
125 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
126 </valuemap>
126 </valuemap>
127 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
127 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
128 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy locally</value>
128 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy locally</value>
129 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
129 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
130 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
130 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
131 </valuemap>
131 </valuemap>
132 <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
132 <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
133 <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
133 <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
134 <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
134 <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
135 <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
135 <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
136 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
136 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
137 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
137 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
138 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
138 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
139 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
139 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
140 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
140 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
141 <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
141 <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
142 <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
142 <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
143 <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
143 <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
144 <value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
144 <value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
145 <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
145 <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
146 <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
146 <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
147 <value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
147 <value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
148 <value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
148 <value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
149 <value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
149 <value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
150 <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
150 <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
151 <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
151 <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
152 <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
152 <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
153 <value type="int">0</value>
153 <value type="int">0</value>
154 <value type="int">1</value>
154 <value type="int">1</value>
155 <value type="int">2</value>
155 <value type="int">2</value>
156 <value type="int">3</value>
156 <value type="int">3</value>
157 <value type="int">4</value>
157 <value type="int">4</value>
158 <value type="int">5</value>
158 <value type="int">5</value>
159 <value type="int">6</value>
159 <value type="int">6</value>
160 <value type="int">7</value>
160 <value type="int">7</value>
161 <value type="int">8</value>
161 <value type="int">8</value>
162 <value type="int">9</value>
162 <value type="int">9</value>
163 <value type="int">10</value>
163 <value type="int">10</value>
164 <value type="int">11</value>
164 <value type="int">11</value>
165 <value type="int">12</value>
165 <value type="int">12</value>
166 <value type="int">13</value>
166 <value type="int">13</value>
167 <value type="int">14</value>
167 <value type="int">14</value>
168 </valuelist>
168 </valuelist>
169 <value type="int" key="PE.EnvironmentAspect.Base">2</value>
169 <value type="int" key="PE.EnvironmentAspect.Base">2</value>
170 <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
170 <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
171 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">fsw-qt</value>
171 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">fsw-qt</value>
172 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
172 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
173 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/opt/DEV_PLE/FSW-qt/fsw-qt.pro</value>
173 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/opt/DEV_PLE/FSW-qt/fsw-qt.pro</value>
174 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
174 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
175 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">fsw-qt.pro</value>
175 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">fsw-qt.pro</value>
176 <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
176 <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
177 <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">true</value>
177 <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">true</value>
178 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
178 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
179 <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
179 <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
180 <value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
180 <value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
181 <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
181 <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
182 <value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
182 <value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
183 <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
183 <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
184 <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
184 <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
185 </valuemap>
185 </valuemap>
186 <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
186 <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
187 </valuemap>
187 </valuemap>
188 </data>
188 </data>
189 <data>
189 <data>
190 <variable>ProjectExplorer.Project.Target.1</variable>
190 <variable>ProjectExplorer.Project.Target.1</variable>
191 <valuemap type="QVariantMap">
191 <valuemap type="QVariantMap">
192 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop-Qt 4.8.2 in PATH (System)</value>
192 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop-Qt 4.8.2 in PATH (System)</value>
193 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop-Qt 4.8.2 in PATH (System)</value>
193 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop-Qt 4.8.2 in PATH (System)</value>
194 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{5289e843-9ef2-45ce-88c6-ad27d8e08def}</value>
194 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{5289e843-9ef2-45ce-88c6-ad27d8e08def}</value>
195 <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
195 <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
196 <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
196 <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
197 <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
197 <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
198 <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
198 <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
199 <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory"></value>
199 <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory"></value>
200 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
200 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
201 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
201 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
202 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
202 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
203 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
203 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
204 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
204 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
205 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
205 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
206 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
206 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
207 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">false</value>
207 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">false</value>
208 <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
208 <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
209 <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
209 <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
210 </valuemap>
210 </valuemap>
211 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
211 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
212 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
212 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
213 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
213 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
214 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
214 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
215 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
215 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
216 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
216 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
217 <value type="QString">-w</value>
217 <value type="QString">-w</value>
218 <value type="QString">-r</value>
218 <value type="QString">-r</value>
219 </valuelist>
219 </valuelist>
220 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
220 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
221 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
221 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
222 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
222 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
223 </valuemap>
223 </valuemap>
224 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
224 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
225 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
225 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
226 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
226 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
227 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
227 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
228 </valuemap>
228 </valuemap>
229 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
229 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
230 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
230 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
231 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
231 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
232 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
232 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
233 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
233 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
234 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
234 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
235 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
235 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
236 <value type="QString">-w</value>
236 <value type="QString">-w</value>
237 <value type="QString">-r</value>
237 <value type="QString">-r</value>
238 </valuelist>
238 </valuelist>
239 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
239 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
240 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
240 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
241 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
241 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
242 </valuemap>
242 </valuemap>
243 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
243 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
244 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
244 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
245 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
245 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
246 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
246 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
247 </valuemap>
247 </valuemap>
248 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
248 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
249 <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
249 <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
250 <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
250 <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
251 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value>
251 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value>
252 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
252 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
253 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
253 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
254 <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
254 <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
255 <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
255 <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
256 </valuemap>
256 </valuemap>
257 <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">1</value>
257 <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">1</value>
258 <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
258 <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
259 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
259 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
260 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
260 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
261 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
261 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
262 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
262 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
263 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
263 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
264 </valuemap>
264 </valuemap>
265 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
265 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
266 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy locally</value>
266 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy locally</value>
267 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
267 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
268 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
268 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
269 </valuemap>
269 </valuemap>
270 <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
270 <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
271 <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
271 <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
272 <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
272 <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
273 <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
273 <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
274 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
274 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
275 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
275 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
276 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
276 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
277 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
277 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
278 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
278 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
279 <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
279 <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
280 <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
280 <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
281 <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
281 <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
282 <value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
282 <value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
283 <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
283 <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
284 <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
284 <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
285 <value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
285 <value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
286 <value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
286 <value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
287 <value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
287 <value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
288 <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
288 <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
289 <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
289 <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
290 <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
290 <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
291 <value type="int">0</value>
291 <value type="int">0</value>
292 <value type="int">1</value>
292 <value type="int">1</value>
293 <value type="int">2</value>
293 <value type="int">2</value>
294 <value type="int">3</value>
294 <value type="int">3</value>
295 <value type="int">4</value>
295 <value type="int">4</value>
296 <value type="int">5</value>
296 <value type="int">5</value>
297 <value type="int">6</value>
297 <value type="int">6</value>
298 <value type="int">7</value>
298 <value type="int">7</value>
299 <value type="int">8</value>
299 <value type="int">8</value>
300 <value type="int">9</value>
300 <value type="int">9</value>
301 <value type="int">10</value>
301 <value type="int">10</value>
302 <value type="int">11</value>
302 <value type="int">11</value>
303 <value type="int">12</value>
303 <value type="int">12</value>
304 <value type="int">13</value>
304 <value type="int">13</value>
305 <value type="int">14</value>
305 <value type="int">14</value>
306 </valuelist>
306 </valuelist>
307 <value type="int" key="PE.EnvironmentAspect.Base">2</value>
307 <value type="int" key="PE.EnvironmentAspect.Base">2</value>
308 <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
308 <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
309 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">fsw-qt</value>
309 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">fsw-qt</value>
310 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
310 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
311 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/opt/DEV_PLE/FSW-qt/fsw-qt.pro</value>
311 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/opt/DEV_PLE/FSW-qt/fsw-qt.pro</value>
312 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
312 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
313 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">fsw-qt.pro</value>
313 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">fsw-qt.pro</value>
314 <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
314 <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
315 <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">true</value>
315 <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">true</value>
316 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
316 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
317 <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
317 <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
318 <value type="bool" key="RunConfiguration.UseCppDebugger">true</value>
318 <value type="bool" key="RunConfiguration.UseCppDebugger">true</value>
319 <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value>
319 <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value>
320 <value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
320 <value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
321 <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
321 <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
322 <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
322 <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
323 </valuemap>
323 </valuemap>
324 <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
324 <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
325 </valuemap>
325 </valuemap>
326 </data>
326 </data>
327 <data>
327 <data>
328 <variable>ProjectExplorer.Project.TargetCount</variable>
328 <variable>ProjectExplorer.Project.TargetCount</variable>
329 <value type="int">2</value>
329 <value type="int">2</value>
330 </data>
330 </data>
331 <data>
331 <data>
332 <variable>ProjectExplorer.Project.Updater.EnvironmentId</variable>
332 <variable>ProjectExplorer.Project.Updater.EnvironmentId</variable>
333 <value type="QByteArray">{2e58a81f-9962-4bba-ae6b-760177f0656c}</value>
333 <value type="QByteArray">{2e58a81f-9962-4bba-ae6b-760177f0656c}</value>
334 </data>
334 </data>
335 <data>
335 <data>
336 <variable>ProjectExplorer.Project.Updater.FileVersion</variable>
336 <variable>ProjectExplorer.Project.Updater.FileVersion</variable>
337 <value type="int">15</value>
337 <value type="int">15</value>
338 </data>
338 </data>
339 </qtcreator>
339 </qtcreator>
@@ -1,54 +1,55
1 #ifndef FSW_PROCESSING_H_INCLUDED
1 #ifndef FSW_PROCESSING_H_INCLUDED
2 #define FSW_PROCESSING_H_INCLUDED
2 #define FSW_PROCESSING_H_INCLUDED
3
3
4 #include <rtems.h>
4 #include <rtems.h>
5 #include <grspw.h>
5 #include <grspw.h>
6 #include <math.h>
6 #include <math.h>
7 #include <stdlib.h> // abs() is in the stdlib
7 #include <stdlib.h> // abs() is in the stdlib
8 #include <stdio.h> // printf()
8 #include <stdio.h> // printf()
9 #include <math.h>
9 #include <math.h>
10
10
11 #include "fsw_params.h"
11 #include "fsw_params.h"
12 #include "fsw_spacewire.h"
12 #include "fsw_spacewire.h"
13 #include "basic_parameters.h"
13 #include "basic_parameters.h"
14
14
15 extern volatile int sm_f0[ ][ SM_HEADER + TOTAL_SIZE_SM ];
15 extern volatile int sm_f0[ ][ TIME_OFFSET + TOTAL_SIZE_SM ];
16 extern volatile int sm_f1[ ][ SM_HEADER + TOTAL_SIZE_SM ];
16 extern volatile int sm_f1[ ][ TIME_OFFSET + TOTAL_SIZE_SM ];
17 extern volatile int sm_f2[ ][ SM_HEADER + TOTAL_SIZE_SM ];
17 extern volatile int sm_f2[ ][ TIME_OFFSET + TOTAL_SIZE_SM ];
18
18
19 // parameters
19 // parameters
20 extern struct param_local_str param_local;
20 extern struct param_local_str param_local;
21
21
22 // registers
22 // registers
23 extern time_management_regs_t *time_management_regs;
23 extern time_management_regs_t *time_management_regs;
24 extern spectral_matrix_regs_t *spectral_matrix_regs;
24 extern spectral_matrix_regs_t *spectral_matrix_regs;
25
25
26 extern rtems_name misc_name[5];
26 extern rtems_name misc_name[5];
27 extern rtems_id Task_id[20]; /* array of task ids */
27 extern rtems_id Task_id[20]; /* array of task ids */
28
28
29 void init_sm_rings( void );
29 void init_sm_rings( void );
30 void reset_current_sm_ring_nodes( void );
30 void reset_current_sm_ring_nodes( void );
31
31
32 // ISR
32 // ISR
33 void reset_nb_sm_f0( void );
33 void reset_nb_sm_f0( void );
34 rtems_isr spectral_matrices_isr( rtems_vector_number vector );
34 rtems_isr spectral_matrices_isr( rtems_vector_number vector );
35 rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector );
35 rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector );
36
36
37 // RTEMS TASKS
37 // RTEMS TASKS
38 rtems_task avf0_task(rtems_task_argument argument);
38 rtems_task avf0_task(rtems_task_argument argument);
39 rtems_task smiq_task(rtems_task_argument argument); // added to test the spectral matrix simulator
39 rtems_task smiq_task(rtems_task_argument argument); // added to test the spectral matrix simulator
40 rtems_task matr_task(rtems_task_argument argument);
40 rtems_task matr_task(rtems_task_argument argument);
41
41
42 void matrix_reset(volatile float *averaged_spec_mat);
42 void matrix_reset(volatile float *averaged_spec_mat);
43 void BP1_set_old(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat, unsigned char * LFR_BP1);
43 void BP1_set_old(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat, unsigned char * LFR_BP1);
44 void BP2_set_old(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat);
44 void BP2_set_old(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat);
45 //
45 //
46 void init_header_asm( Header_TM_LFR_SCIENCE_ASM_t *header);
46 void init_header_asm( Header_TM_LFR_SCIENCE_ASM_t *header);
47 void compress_averaged_spectral_matrix( float *averaged_spec_mat, unsigned char fChannel, float *compressed_spec_mat );
47 void ASM_reorganize( float *averaged_spec_mat, float *averaged_spec_mat_reorganized );
48 void convert_averaged_spectral_matrix(volatile float *input_matrix, char *output_matrix);
48 void ASM_compress( float *averaged_spec_mat, unsigned char fChannel, float *compressed_spec_mat );
49 void send_averaged_spectral_matrix(Header_TM_LFR_SCIENCE_ASM_t *header, char *spectral_matrix,
49 void ASM_convert(volatile float *input_matrix, char *output_matrix);
50 void ASM_send(Header_TM_LFR_SCIENCE_ASM_t *header, char *spectral_matrix,
50 unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send, rtems_id queue_id);
51 unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send, rtems_id queue_id);
51 void fill_averaged_spectral_matrix( void );
52 void fill_averaged_spectral_matrix( void );
52 void reset_spectral_matrix_regs();
53 void reset_spectral_matrix_regs();
53
54
54 #endif // FSW_PROCESSING_H_INCLUDED
55 #endif // FSW_PROCESSING_H_INCLUDED
@@ -1,55 +1,58
1 #ifndef TC_HANDLER_H_INCLUDED
1 #ifndef TC_HANDLER_H_INCLUDED
2 #define TC_HANDLER_H_INCLUDED
2 #define TC_HANDLER_H_INCLUDED
3
3
4 #include <rtems.h>
4 #include <rtems.h>
5 #include <leon.h>
5 #include <leon.h>
6
6
7 #include "tc_load_dump_parameters.h"
7 #include "tc_load_dump_parameters.h"
8 #include "tc_acceptance.h"
8 #include "tc_acceptance.h"
9 #include "tm_lfr_tc_exe.h"
9 #include "tm_lfr_tc_exe.h"
10 #include "wf_handler.h"
10 #include "wf_handler.h"
11 #include "fsw_processing.h"
11 #include "fsw_processing.h"
12
12
13 // MODE PARAMETERS
13 // MODE PARAMETERS
14 extern unsigned int maxCount;
14 extern unsigned int maxCount;
15
15
16 //****
16 //****
17 // ISR
17 // ISR
18 rtems_isr commutation_isr1( rtems_vector_number vector );
18 rtems_isr commutation_isr1( rtems_vector_number vector );
19 rtems_isr commutation_isr2( rtems_vector_number vector );
19 rtems_isr commutation_isr2( rtems_vector_number vector );
20
20
21 //***********
21 //***********
22 // RTEMS TASK
22 // RTEMS TASK
23 rtems_task actn_task( rtems_task_argument unused );
23 rtems_task actn_task( rtems_task_argument unused );
24
24
25 //***********
25 //***********
26 // TC ACTIONS
26 // TC ACTIONS
27 int action_reset(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time);
27 int action_reset(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time);
28 int action_enter_mode(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time);
28 int action_enter_mode(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time);
29 int action_update_info(ccsdsTelecommandPacket_t *TC, rtems_id queue_id);
29 int action_update_info(ccsdsTelecommandPacket_t *TC, rtems_id queue_id);
30 int action_enable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time);
30 int action_enable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time);
31 int action_disable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time);
31 int action_disable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time);
32 int action_update_time(ccsdsTelecommandPacket_t *TC);
32 int action_update_time(ccsdsTelecommandPacket_t *TC);
33
33
34 // mode transition
34 // mode transition
35 int transition_validation(unsigned char requestedMode);
35 int transition_validation(unsigned char requestedMode);
36 int stop_current_mode( void );
36 int stop_current_mode( void );
37 int enter_mode(unsigned char mode);
37 int enter_mode(unsigned char mode);
38 int restart_science_tasks();
38 int restart_science_tasks();
39 int suspend_science_tasks();
39 int suspend_science_tasks();
40 void launch_waveform_picker( unsigned char mode );
40 void launch_waveform_picker( unsigned char mode );
41 void launch_spectral_matrix( unsigned char mode );
41 void launch_spectral_matrix( unsigned char mode );
42 void enable_irq_on_new_ready_matrix( void );
43 void disable_irq_on_new_ready_matrix( void );
44 void launch_spectral_matrix_simu( unsigned char mode );
42
45
43 // other functions
46 // other functions
44 void updateLFRCurrentMode();
47 void updateLFRCurrentMode();
45 void update_last_TC_exe(ccsdsTelecommandPacket_t *TC, unsigned char *time);
48 void update_last_TC_exe(ccsdsTelecommandPacket_t *TC, unsigned char *time);
46 void update_last_TC_rej(ccsdsTelecommandPacket_t *TC, unsigned char *time);
49 void update_last_TC_rej(ccsdsTelecommandPacket_t *TC, unsigned char *time);
47 void close_action(ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id, unsigned char *time);
50 void close_action(ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id, unsigned char *time);
48
51
49 extern rtems_status_code get_message_queue_id_send( rtems_id *queue_id );
52 extern rtems_status_code get_message_queue_id_send( rtems_id *queue_id );
50 extern rtems_status_code get_message_queue_id_recv( rtems_id *queue_id );
53 extern rtems_status_code get_message_queue_id_recv( rtems_id *queue_id );
51
54
52 #endif // TC_HANDLER_H_INCLUDED
55 #endif // TC_HANDLER_H_INCLUDED
53
56
54
57
55
58
@@ -1,72 +1,72
1 /** Global variables of the LFR flight software.
1 /** Global variables of the LFR flight software.
2 *
2 *
3 * @file
3 * @file
4 * @author P. LEROY
4 * @author P. LEROY
5 *
5 *
6 * Among global variables, there are:
6 * Among global variables, there are:
7 * - RTEMS names and id.
7 * - RTEMS names and id.
8 * - APB configuration registers.
8 * - APB configuration registers.
9 * - waveforms global buffers, used by the waveform picker hardware module to store data.
9 * - waveforms global buffers, used by the waveform picker hardware module to store data.
10 * - spectral matrices buffesr, used by the hardware module to store data.
10 * - spectral matrices buffesr, used by the hardware module to store data.
11 * - variable related to LFR modes parameters.
11 * - variable related to LFR modes parameters.
12 * - the global HK packet buffer.
12 * - the global HK packet buffer.
13 * - the global dump parameter buffer.
13 * - the global dump parameter buffer.
14 *
14 *
15 */
15 */
16
16
17 #include <rtems.h>
17 #include <rtems.h>
18 #include <grspw.h>
18 #include <grspw.h>
19
19
20 #include "ccsds_types.h"
20 #include "ccsds_types.h"
21 #include "grlib_regs.h"
21 #include "grlib_regs.h"
22 #include "fsw_params.h"
22 #include "fsw_params.h"
23
23
24 // RTEMS GLOBAL VARIABLES
24 // RTEMS GLOBAL VARIABLES
25 rtems_name misc_name[5];
25 rtems_name misc_name[5];
26 rtems_id misc_id[5];
26 rtems_id misc_id[5];
27 rtems_name Task_name[20]; /* array of task names */
27 rtems_name Task_name[20]; /* array of task names */
28 rtems_id Task_id[20]; /* array of task ids */
28 rtems_id Task_id[20]; /* array of task ids */
29 unsigned int maxCount;
29 unsigned int maxCount;
30 int fdSPW = 0;
30 int fdSPW = 0;
31 int fdUART = 0;
31 int fdUART = 0;
32 unsigned char lfrCurrentMode;
32 unsigned char lfrCurrentMode;
33
33
34 // WAVEFORMS GLOBAL VARIABLES // 2048 * 3 * 4 + 2 * 4 = 24576 + 8 bytes = 24584
34 // WAVEFORMS GLOBAL VARIABLES // 2048 * 3 * 4 + 2 * 4 = 24576 + 8 bytes = 24584
35 // 97 * 256 = 24832 => delta = 248 bytes = 62 words
35 // 97 * 256 = 24832 => delta = 248 bytes = 62 words
36 // WAVEFORMS GLOBAL VARIABLES // 2688 * 3 * 4 + 2 * 4 = 32256 + 8 bytes = 32264
36 // WAVEFORMS GLOBAL VARIABLES // 2688 * 3 * 4 + 2 * 4 = 32256 + 8 bytes = 32264
37 // 127 * 256 = 32512 => delta = 248 bytes = 62 words
37 // 127 * 256 = 32512 => delta = 248 bytes = 62 words
38 // F0
38 // F0
39 volatile int wf_snap_f0[ NB_RING_NODES_F0 ][ (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK) + TIME_OFFSET + 62 ] __attribute__((aligned(0x100)));
39 volatile int wf_snap_f0[ NB_RING_NODES_F0 ][ (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK) + TIME_OFFSET + 62 ] __attribute__((aligned(0x100)));
40 // F1 F2
40 // F1 F2
41 volatile int wf_snap_f1[ NB_RING_NODES_F1 ][ (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK) + TIME_OFFSET + 62 ] __attribute__((aligned(0x100)));
41 volatile int wf_snap_f1[ NB_RING_NODES_F1 ][ (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK) + TIME_OFFSET + 62 ] __attribute__((aligned(0x100)));
42 volatile int wf_snap_f2[ NB_RING_NODES_F2 ][ (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK) + TIME_OFFSET + 62 ] __attribute__((aligned(0x100)));
42 volatile int wf_snap_f2[ NB_RING_NODES_F2 ][ (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK) + TIME_OFFSET + 62 ] __attribute__((aligned(0x100)));
43 // F3
43 // F3
44 volatile int wf_cont_f3_a [ (NB_SAMPLES_PER_SNAPSHOT) * NB_WORDS_SWF_BLK + TIME_OFFSET ] __attribute__((aligned(0x100)));
44 volatile int wf_cont_f3_a [ (NB_SAMPLES_PER_SNAPSHOT) * NB_WORDS_SWF_BLK + TIME_OFFSET ] __attribute__((aligned(0x100)));
45 volatile int wf_cont_f3_b [ (NB_SAMPLES_PER_SNAPSHOT) * NB_WORDS_SWF_BLK + TIME_OFFSET ] __attribute__((aligned(0x100)));
45 volatile int wf_cont_f3_b [ (NB_SAMPLES_PER_SNAPSHOT) * NB_WORDS_SWF_BLK + TIME_OFFSET ] __attribute__((aligned(0x100)));
46 char wf_cont_f3_light[ (NB_SAMPLES_PER_SNAPSHOT) * NB_BYTES_CWF3_LIGHT_BLK + TIME_OFFSET_IN_BYTES ] __attribute__((aligned(0x100)));
46 char wf_cont_f3_light[ (NB_SAMPLES_PER_SNAPSHOT) * NB_BYTES_CWF3_LIGHT_BLK + TIME_OFFSET_IN_BYTES ] __attribute__((aligned(0x100)));
47
47
48 // SPECTRAL MATRICES GLOBAL VARIABLES
48 // SPECTRAL MATRICES GLOBAL VARIABLES
49 volatile int sm_f0[ NB_RING_NODES_ASM_F0 ][ SM_HEADER + TOTAL_SIZE_SM ] __attribute__((aligned(0x100)));
49 volatile int sm_f0[ NB_RING_NODES_ASM_F0 ][ TIME_OFFSET + TOTAL_SIZE_SM ] __attribute__((aligned(0x100)));
50 volatile int sm_f1[ NB_RING_NODES_ASM_F1 ][ SM_HEADER + TOTAL_SIZE_SM ] __attribute__((aligned(0x100)));
50 volatile int sm_f1[ NB_RING_NODES_ASM_F1 ][ TIME_OFFSET + TOTAL_SIZE_SM ] __attribute__((aligned(0x100)));
51 volatile int sm_f2[ NB_RING_NODES_ASM_F2 ][ SM_HEADER + TOTAL_SIZE_SM ] __attribute__((aligned(0x100)));
51 volatile int sm_f2[ NB_RING_NODES_ASM_F2 ][ TIME_OFFSET + TOTAL_SIZE_SM ] __attribute__((aligned(0x100)));
52
52
53 // APB CONFIGURATION REGISTERS
53 // APB CONFIGURATION REGISTERS
54 time_management_regs_t *time_management_regs = (time_management_regs_t*) REGS_ADDR_TIME_MANAGEMENT;
54 time_management_regs_t *time_management_regs = (time_management_regs_t*) REGS_ADDR_TIME_MANAGEMENT;
55 gptimer_regs_t *gptimer_regs = (gptimer_regs_t *) REGS_ADDR_GPTIMER;
55 gptimer_regs_t *gptimer_regs = (gptimer_regs_t *) REGS_ADDR_GPTIMER;
56 waveform_picker_regs_new_t *waveform_picker_regs = (waveform_picker_regs_new_t*) REGS_ADDR_WAVEFORM_PICKER;
56 waveform_picker_regs_new_t *waveform_picker_regs = (waveform_picker_regs_new_t*) REGS_ADDR_WAVEFORM_PICKER;
57 spectral_matrix_regs_t *spectral_matrix_regs = (spectral_matrix_regs_t*) REGS_ADDR_SPECTRAL_MATRIX;
57 spectral_matrix_regs_t *spectral_matrix_regs = (spectral_matrix_regs_t*) REGS_ADDR_SPECTRAL_MATRIX;
58
58
59 // MODE PARAMETERS
59 // MODE PARAMETERS
60 Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet;
60 Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet;
61 struct param_local_str param_local;
61 struct param_local_str param_local;
62
62
63 // HK PACKETS
63 // HK PACKETS
64 Packet_TM_LFR_HK_t housekeeping_packet;
64 Packet_TM_LFR_HK_t housekeeping_packet;
65 // sequence counters are incremented by APID (PID + CAT) and destination ID
65 // sequence counters are incremented by APID (PID + CAT) and destination ID
66 unsigned short sequenceCounters_SCIENCE_NORMAL_BURST;
66 unsigned short sequenceCounters_SCIENCE_NORMAL_BURST;
67 unsigned short sequenceCounters_SCIENCE_SBM1_SBM2;
67 unsigned short sequenceCounters_SCIENCE_SBM1_SBM2;
68 unsigned short sequenceCounters_TC_EXE[SEQ_CNT_NB_DEST_ID];
68 unsigned short sequenceCounters_TC_EXE[SEQ_CNT_NB_DEST_ID];
69 spw_stats spacewire_stats;
69 spw_stats spacewire_stats;
70 spw_stats spacewire_stats_backup;
70 spw_stats spacewire_stats_backup;
71
71
72
72
@@ -1,594 +1,598
1 /** This is the RTEMS initialization module.
1 /** This is the RTEMS initialization module.
2 *
2 *
3 * @file
3 * @file
4 * @author P. LEROY
4 * @author P. LEROY
5 *
5 *
6 * This module contains two very different information:
6 * This module contains two very different information:
7 * - specific instructions to configure the compilation of the RTEMS executive
7 * - specific instructions to configure the compilation of the RTEMS executive
8 * - functions related to the fligth softwre initialization, especially the INIT RTEMS task
8 * - functions related to the fligth softwre initialization, especially the INIT RTEMS task
9 *
9 *
10 */
10 */
11
11
12 //*************************
12 //*************************
13 // GPL reminder to be added
13 // GPL reminder to be added
14 //*************************
14 //*************************
15
15
16 #include <rtems.h>
16 #include <rtems.h>
17
17
18 /* configuration information */
18 /* configuration information */
19
19
20 #define CONFIGURE_INIT
20 #define CONFIGURE_INIT
21
21
22 #include <bsp.h> /* for device driver prototypes */
22 #include <bsp.h> /* for device driver prototypes */
23
23
24 /* configuration information */
24 /* configuration information */
25
25
26 #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
26 #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
27 #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
27 #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
28
28
29 #define CONFIGURE_MAXIMUM_TASKS 20
29 #define CONFIGURE_MAXIMUM_TASKS 20
30 #define CONFIGURE_RTEMS_INIT_TASKS_TABLE
30 #define CONFIGURE_RTEMS_INIT_TASKS_TABLE
31 #define CONFIGURE_EXTRA_TASK_STACKS (3 * RTEMS_MINIMUM_STACK_SIZE)
31 #define CONFIGURE_EXTRA_TASK_STACKS (3 * RTEMS_MINIMUM_STACK_SIZE)
32 #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 32
32 #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 32
33 #define CONFIGURE_INIT_TASK_PRIORITY 1 // instead of 100
33 #define CONFIGURE_INIT_TASK_PRIORITY 1 // instead of 100
34 #define CONFIGURE_INIT_TASK_MODE (RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT)
34 #define CONFIGURE_INIT_TASK_MODE (RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT)
35 #define CONFIGURE_MAXIMUM_DRIVERS 16
35 #define CONFIGURE_MAXIMUM_DRIVERS 16
36 #define CONFIGURE_MAXIMUM_PERIODS 5
36 #define CONFIGURE_MAXIMUM_PERIODS 5
37 #define CONFIGURE_MAXIMUM_TIMERS 5 // STAT (1s), send SWF (0.3s), send CWF3 (1s)
37 #define CONFIGURE_MAXIMUM_TIMERS 5 // STAT (1s), send SWF (0.3s), send CWF3 (1s)
38 #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 2
38 #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 2
39 #ifdef PRINT_STACK_REPORT
39 #ifdef PRINT_STACK_REPORT
40 #define CONFIGURE_STACK_CHECKER_ENABLED
40 #define CONFIGURE_STACK_CHECKER_ENABLED
41 #endif
41 #endif
42
42
43 #include <rtems/confdefs.h>
43 #include <rtems/confdefs.h>
44
44
45 /* If --drvmgr was enabled during the configuration of the RTEMS kernel */
45 /* If --drvmgr was enabled during the configuration of the RTEMS kernel */
46 #ifdef RTEMS_DRVMGR_STARTUP
46 #ifdef RTEMS_DRVMGR_STARTUP
47 #ifdef LEON3
47 #ifdef LEON3
48 /* Add Timer and UART Driver */
48 /* Add Timer and UART Driver */
49 #ifdef CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
49 #ifdef CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
50 #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GPTIMER
50 #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GPTIMER
51 #endif
51 #endif
52 #ifdef CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
52 #ifdef CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
53 #define CONFIGURE_DRIVER_AMBAPP_GAISLER_APBUART
53 #define CONFIGURE_DRIVER_AMBAPP_GAISLER_APBUART
54 #endif
54 #endif
55 #endif
55 #endif
56 #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GRSPW /* GRSPW Driver */
56 #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GRSPW /* GRSPW Driver */
57 #include <drvmgr/drvmgr_confdefs.h>
57 #include <drvmgr/drvmgr_confdefs.h>
58 #endif
58 #endif
59
59
60 #include "fsw_init.h"
60 #include "fsw_init.h"
61 #include "fsw_config.c"
61 #include "fsw_config.c"
62
62
63 rtems_task Init( rtems_task_argument ignored )
63 rtems_task Init( rtems_task_argument ignored )
64 {
64 {
65 /** This is the RTEMS INIT taks, it the first task launched by the system.
65 /** This is the RTEMS INIT taks, it the first task launched by the system.
66 *
66 *
67 * @param unused is the starting argument of the RTEMS task
67 * @param unused is the starting argument of the RTEMS task
68 *
68 *
69 * The INIT task create and run all other RTEMS tasks.
69 * The INIT task create and run all other RTEMS tasks.
70 *
70 *
71 */
71 */
72
72
73
73
74 rtems_status_code status;
74 rtems_status_code status;
75 rtems_status_code status_spw;
75 rtems_status_code status_spw;
76 rtems_isr_entry old_isr_handler;
76 rtems_isr_entry old_isr_handler;
77
77
78 // UART settings
78 // UART settings
79 send_console_outputs_on_apbuart_port();
79 send_console_outputs_on_apbuart_port();
80 set_apbuart_scaler_reload_register(REGS_ADDR_APBUART, APBUART_SCALER_RELOAD_VALUE);
80 set_apbuart_scaler_reload_register(REGS_ADDR_APBUART, APBUART_SCALER_RELOAD_VALUE);
81 enable_apbuart_transmitter();
81 enable_apbuart_transmitter();
82 DEBUG_PRINTF("\n\n\n\n\nIn INIT *** Now the console is on port COM1\n")
82 DEBUG_PRINTF("\n\n\n\n\nIn INIT *** Now the console is on port COM1\n")
83
83
84 PRINTF("\n\n\n\n\n")
84 PRINTF("\n\n\n\n\n")
85 PRINTF("*************************\n")
85 PRINTF("*************************\n")
86 PRINTF("** LFR Flight Software **\n")
86 PRINTF("** LFR Flight Software **\n")
87 PRINTF1("** %d.", SW_VERSION_N1)
87 PRINTF1("** %d.", SW_VERSION_N1)
88 PRINTF1("%d.", SW_VERSION_N2)
88 PRINTF1("%d.", SW_VERSION_N2)
89 PRINTF1("%d.", SW_VERSION_N3)
89 PRINTF1("%d.", SW_VERSION_N3)
90 PRINTF1("%d **\n", SW_VERSION_N4)
90 PRINTF1("%d **\n", SW_VERSION_N4)
91 PRINTF("*************************\n")
91 PRINTF("*************************\n")
92 PRINTF("\n\n")
92 PRINTF("\n\n")
93
93
94 reset_wfp_burst_enable(); // stop the waveform picker if it was running
94 reset_wfp_burst_enable(); // stop the waveform picker if it was running
95 init_waveform_rings(); // initialize the waveform rings
95 init_waveform_rings(); // initialize the waveform rings
96 init_sm_rings();
96 init_sm_rings();
97
97
98 init_parameter_dump();
98 init_parameter_dump();
99 init_local_mode_parameters();
99 init_local_mode_parameters();
100 init_housekeeping_parameters();
100 init_housekeeping_parameters();
101
101
102 updateLFRCurrentMode();
102 updateLFRCurrentMode();
103
103
104 BOOT_PRINTF1("in INIT *** lfrCurrentMode is %d\n", lfrCurrentMode)
104 BOOT_PRINTF1("in INIT *** lfrCurrentMode is %d\n", lfrCurrentMode)
105
105
106 create_names(); // create all names
106 create_names(); // create all names
107
107
108 status = create_message_queues(); // create message queues
108 status = create_message_queues(); // create message queues
109 if (status != RTEMS_SUCCESSFUL)
109 if (status != RTEMS_SUCCESSFUL)
110 {
110 {
111 PRINTF1("in INIT *** ERR in create_message_queues, code %d", status)
111 PRINTF1("in INIT *** ERR in create_message_queues, code %d", status)
112 }
112 }
113
113
114 status = create_all_tasks(); // create all tasks
114 status = create_all_tasks(); // create all tasks
115 if (status != RTEMS_SUCCESSFUL)
115 if (status != RTEMS_SUCCESSFUL)
116 {
116 {
117 PRINTF1("in INIT *** ERR in create_all_tasks, code %d", status)
117 PRINTF1("in INIT *** ERR in create_all_tasks, code %d", status)
118 }
118 }
119
119
120 // **************************
120 // **************************
121 // <SPACEWIRE INITIALIZATION>
121 // <SPACEWIRE INITIALIZATION>
122 grspw_timecode_callback = &timecode_irq_handler;
122 grspw_timecode_callback = &timecode_irq_handler;
123
123
124 status_spw = spacewire_open_link(); // (1) open the link
124 status_spw = spacewire_open_link(); // (1) open the link
125 if ( status_spw != RTEMS_SUCCESSFUL )
125 if ( status_spw != RTEMS_SUCCESSFUL )
126 {
126 {
127 PRINTF1("in INIT *** ERR spacewire_open_link code %d\n", status_spw )
127 PRINTF1("in INIT *** ERR spacewire_open_link code %d\n", status_spw )
128 }
128 }
129
129
130 if ( status_spw == RTEMS_SUCCESSFUL ) // (2) configure the link
130 if ( status_spw == RTEMS_SUCCESSFUL ) // (2) configure the link
131 {
131 {
132 status_spw = spacewire_configure_link( fdSPW );
132 status_spw = spacewire_configure_link( fdSPW );
133 if ( status_spw != RTEMS_SUCCESSFUL )
133 if ( status_spw != RTEMS_SUCCESSFUL )
134 {
134 {
135 PRINTF1("in INIT *** ERR spacewire_configure_link code %d\n", status_spw )
135 PRINTF1("in INIT *** ERR spacewire_configure_link code %d\n", status_spw )
136 }
136 }
137 }
137 }
138
138
139 if ( status_spw == RTEMS_SUCCESSFUL) // (3) start the link
139 if ( status_spw == RTEMS_SUCCESSFUL) // (3) start the link
140 {
140 {
141 status_spw = spacewire_start_link( fdSPW );
141 status_spw = spacewire_start_link( fdSPW );
142 if ( status_spw != RTEMS_SUCCESSFUL )
142 if ( status_spw != RTEMS_SUCCESSFUL )
143 {
143 {
144 PRINTF1("in INIT *** ERR spacewire_start_link code %d\n", status_spw )
144 PRINTF1("in INIT *** ERR spacewire_start_link code %d\n", status_spw )
145 }
145 }
146 }
146 }
147 // </SPACEWIRE INITIALIZATION>
147 // </SPACEWIRE INITIALIZATION>
148 // ***************************
148 // ***************************
149
149
150 status = start_all_tasks(); // start all tasks
150 status = start_all_tasks(); // start all tasks
151 if (status != RTEMS_SUCCESSFUL)
151 if (status != RTEMS_SUCCESSFUL)
152 {
152 {
153 PRINTF1("in INIT *** ERR in start_all_tasks, code %d", status)
153 PRINTF1("in INIT *** ERR in start_all_tasks, code %d", status)
154 }
154 }
155
155
156 // start RECV and SEND *AFTER* SpaceWire Initialization, due to the timeout of the start call during the initialization
156 // start RECV and SEND *AFTER* SpaceWire Initialization, due to the timeout of the start call during the initialization
157 status = start_recv_send_tasks();
157 status = start_recv_send_tasks();
158 if ( status != RTEMS_SUCCESSFUL )
158 if ( status != RTEMS_SUCCESSFUL )
159 {
159 {
160 PRINTF1("in INIT *** ERR start_recv_send_tasks code %d\n", status )
160 PRINTF1("in INIT *** ERR start_recv_send_tasks code %d\n", status )
161 }
161 }
162
162
163 // suspend science tasks. they will be restarted later depending on the mode
163 // suspend science tasks. they will be restarted later depending on the mode
164 status = suspend_science_tasks(); // suspend science tasks (not done in stop_current_mode if current mode = STANDBY)
164 status = suspend_science_tasks(); // suspend science tasks (not done in stop_current_mode if current mode = STANDBY)
165 if (status != RTEMS_SUCCESSFUL)
165 if (status != RTEMS_SUCCESSFUL)
166 {
166 {
167 PRINTF1("in INIT *** in suspend_science_tasks *** ERR code: %d\n", status)
167 PRINTF1("in INIT *** in suspend_science_tasks *** ERR code: %d\n", status)
168 }
168 }
169
169
170 //******************************
170 //******************************
171 // <SPECTRAL MATRICES SIMULATOR>
171 // <SPECTRAL MATRICES SIMULATOR>
172 LEON_Mask_interrupt( IRQ_SM_SIMULATOR );
172 LEON_Mask_interrupt( IRQ_SM_SIMULATOR );
173 configure_timer((gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR, CLKDIV_SM_SIMULATOR,
173 configure_timer((gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR, CLKDIV_SM_SIMULATOR,
174 IRQ_SPARC_SM_SIMULATOR, spectral_matrices_isr_simu );
174 IRQ_SPARC_SM_SIMULATOR, spectral_matrices_isr_simu );
175 // </SPECTRAL MATRICES SIMULATOR>
175 // </SPECTRAL MATRICES SIMULATOR>
176 //*******************************
176 //*******************************
177
177
178 // configure IRQ handling for the waveform picker unit
178 // configure IRQ handling for the waveform picker unit
179 status = rtems_interrupt_catch( waveforms_isr,
179 status = rtems_interrupt_catch( waveforms_isr,
180 IRQ_SPARC_WAVEFORM_PICKER,
180 IRQ_SPARC_WAVEFORM_PICKER,
181 &old_isr_handler) ;
181 &old_isr_handler) ;
182 // configure IRQ handling for the spectral matrices unit
183 status = rtems_interrupt_catch( spectral_matrices_isr,
184 IRQ_SPARC_SPECTRAL_MATRIX,
185 &old_isr_handler) ;
182
186
183 // if the spacewire link is not up then send an event to the SPIQ task for link recovery
187 // if the spacewire link is not up then send an event to the SPIQ task for link recovery
184 if ( status_spw != RTEMS_SUCCESSFUL )
188 if ( status_spw != RTEMS_SUCCESSFUL )
185 {
189 {
186 status = rtems_event_send( Task_id[TASKID_SPIQ], SPW_LINKERR_EVENT );
190 status = rtems_event_send( Task_id[TASKID_SPIQ], SPW_LINKERR_EVENT );
187 if ( status != RTEMS_SUCCESSFUL ) {
191 if ( status != RTEMS_SUCCESSFUL ) {
188 PRINTF1("in INIT *** ERR rtems_event_send to SPIQ code %d\n", status )
192 PRINTF1("in INIT *** ERR rtems_event_send to SPIQ code %d\n", status )
189 }
193 }
190 }
194 }
191
195
192 BOOT_PRINTF("delete INIT\n")
196 BOOT_PRINTF("delete INIT\n")
193
197
194 status = rtems_task_delete(RTEMS_SELF);
198 status = rtems_task_delete(RTEMS_SELF);
195
199
196 }
200 }
197
201
198 void init_local_mode_parameters( void )
202 void init_local_mode_parameters( void )
199 {
203 {
200 /** This function initialize the param_local global variable with default values.
204 /** This function initialize the param_local global variable with default values.
201 *
205 *
202 */
206 */
203
207
204 unsigned int i;
208 unsigned int i;
205
209
206 // LOCAL PARAMETERS
210 // LOCAL PARAMETERS
207 set_local_nb_interrupt_f0_MAX();
211 set_local_nb_interrupt_f0_MAX();
208
212
209 BOOT_PRINTF1("local_sbm1_nb_cwf_max %d \n", param_local.local_sbm1_nb_cwf_max)
213 BOOT_PRINTF1("local_sbm1_nb_cwf_max %d \n", param_local.local_sbm1_nb_cwf_max)
210 BOOT_PRINTF1("local_sbm2_nb_cwf_max %d \n", param_local.local_sbm2_nb_cwf_max)
214 BOOT_PRINTF1("local_sbm2_nb_cwf_max %d \n", param_local.local_sbm2_nb_cwf_max)
211 BOOT_PRINTF1("nb_interrupt_f0_MAX = %d\n", param_local.local_nb_interrupt_f0_MAX)
215 BOOT_PRINTF1("nb_interrupt_f0_MAX = %d\n", param_local.local_nb_interrupt_f0_MAX)
212
216
213 // init sequence counters
217 // init sequence counters
214
218
215 for(i = 0; i<SEQ_CNT_NB_DEST_ID; i++)
219 for(i = 0; i<SEQ_CNT_NB_DEST_ID; i++)
216 {
220 {
217 sequenceCounters_TC_EXE[i] = 0x00;
221 sequenceCounters_TC_EXE[i] = 0x00;
218 }
222 }
219 sequenceCounters_SCIENCE_NORMAL_BURST = 0x00;
223 sequenceCounters_SCIENCE_NORMAL_BURST = 0x00;
220 sequenceCounters_SCIENCE_SBM1_SBM2 = 0x00;
224 sequenceCounters_SCIENCE_SBM1_SBM2 = 0x00;
221 }
225 }
222
226
223 void create_names( void ) // create all names for tasks and queues
227 void create_names( void ) // create all names for tasks and queues
224 {
228 {
225 /** This function creates all RTEMS names used in the software for tasks and queues.
229 /** This function creates all RTEMS names used in the software for tasks and queues.
226 *
230 *
227 * @return RTEMS directive status codes:
231 * @return RTEMS directive status codes:
228 * - RTEMS_SUCCESSFUL - successful completion
232 * - RTEMS_SUCCESSFUL - successful completion
229 *
233 *
230 */
234 */
231
235
232 // task names
236 // task names
233 Task_name[TASKID_RECV] = rtems_build_name( 'R', 'E', 'C', 'V' );
237 Task_name[TASKID_RECV] = rtems_build_name( 'R', 'E', 'C', 'V' );
234 Task_name[TASKID_ACTN] = rtems_build_name( 'A', 'C', 'T', 'N' );
238 Task_name[TASKID_ACTN] = rtems_build_name( 'A', 'C', 'T', 'N' );
235 Task_name[TASKID_SPIQ] = rtems_build_name( 'S', 'P', 'I', 'Q' );
239 Task_name[TASKID_SPIQ] = rtems_build_name( 'S', 'P', 'I', 'Q' );
236 Task_name[TASKID_SMIQ] = rtems_build_name( 'S', 'M', 'I', 'Q' );
240 Task_name[TASKID_SMIQ] = rtems_build_name( 'S', 'M', 'I', 'Q' );
237 Task_name[TASKID_STAT] = rtems_build_name( 'S', 'T', 'A', 'T' );
241 Task_name[TASKID_STAT] = rtems_build_name( 'S', 'T', 'A', 'T' );
238 Task_name[TASKID_AVF0] = rtems_build_name( 'A', 'V', 'F', '0' );
242 Task_name[TASKID_AVF0] = rtems_build_name( 'A', 'V', 'F', '0' );
239 // Task_name[TASKID_BPF0] = rtems_build_name( 'B', 'P', 'F', '0' );
243 // Task_name[TASKID_BPF0] = rtems_build_name( 'B', 'P', 'F', '0' );
240 Task_name[TASKID_WFRM] = rtems_build_name( 'W', 'F', 'R', 'M' );
244 Task_name[TASKID_WFRM] = rtems_build_name( 'W', 'F', 'R', 'M' );
241 Task_name[TASKID_DUMB] = rtems_build_name( 'D', 'U', 'M', 'B' );
245 Task_name[TASKID_DUMB] = rtems_build_name( 'D', 'U', 'M', 'B' );
242 Task_name[TASKID_HOUS] = rtems_build_name( 'H', 'O', 'U', 'S' );
246 Task_name[TASKID_HOUS] = rtems_build_name( 'H', 'O', 'U', 'S' );
243 Task_name[TASKID_MATR] = rtems_build_name( 'M', 'A', 'T', 'R' );
247 Task_name[TASKID_MATR] = rtems_build_name( 'M', 'A', 'T', 'R' );
244 Task_name[TASKID_CWF3] = rtems_build_name( 'C', 'W', 'F', '3' );
248 Task_name[TASKID_CWF3] = rtems_build_name( 'C', 'W', 'F', '3' );
245 Task_name[TASKID_CWF2] = rtems_build_name( 'C', 'W', 'F', '2' );
249 Task_name[TASKID_CWF2] = rtems_build_name( 'C', 'W', 'F', '2' );
246 Task_name[TASKID_CWF1] = rtems_build_name( 'C', 'W', 'F', '1' );
250 Task_name[TASKID_CWF1] = rtems_build_name( 'C', 'W', 'F', '1' );
247 Task_name[TASKID_SEND] = rtems_build_name( 'S', 'E', 'N', 'D' );
251 Task_name[TASKID_SEND] = rtems_build_name( 'S', 'E', 'N', 'D' );
248 Task_name[TASKID_WTDG] = rtems_build_name( 'W', 'T', 'D', 'G' );
252 Task_name[TASKID_WTDG] = rtems_build_name( 'W', 'T', 'D', 'G' );
249
253
250 // rate monotonic period names
254 // rate monotonic period names
251 name_hk_rate_monotonic = rtems_build_name( 'H', 'O', 'U', 'S' );
255 name_hk_rate_monotonic = rtems_build_name( 'H', 'O', 'U', 'S' );
252
256
253 misc_name[QUEUE_RECV] = rtems_build_name( 'Q', '_', 'R', 'V' );
257 misc_name[QUEUE_RECV] = rtems_build_name( 'Q', '_', 'R', 'V' );
254 misc_name[QUEUE_SEND] = rtems_build_name( 'Q', '_', 'S', 'D' );
258 misc_name[QUEUE_SEND] = rtems_build_name( 'Q', '_', 'S', 'D' );
255 }
259 }
256
260
257 int create_all_tasks( void ) // create all tasks which run in the software
261 int create_all_tasks( void ) // create all tasks which run in the software
258 {
262 {
259 /** This function creates all RTEMS tasks used in the software.
263 /** This function creates all RTEMS tasks used in the software.
260 *
264 *
261 * @return RTEMS directive status codes:
265 * @return RTEMS directive status codes:
262 * - RTEMS_SUCCESSFUL - task created successfully
266 * - RTEMS_SUCCESSFUL - task created successfully
263 * - RTEMS_INVALID_ADDRESS - id is NULL
267 * - RTEMS_INVALID_ADDRESS - id is NULL
264 * - RTEMS_INVALID_NAME - invalid task name
268 * - RTEMS_INVALID_NAME - invalid task name
265 * - RTEMS_INVALID_PRIORITY - invalid task priority
269 * - RTEMS_INVALID_PRIORITY - invalid task priority
266 * - RTEMS_MP_NOT_CONFIGURED - multiprocessing not configured
270 * - RTEMS_MP_NOT_CONFIGURED - multiprocessing not configured
267 * - RTEMS_TOO_MANY - too many tasks created
271 * - RTEMS_TOO_MANY - too many tasks created
268 * - RTEMS_UNSATISFIED - not enough memory for stack/FP context
272 * - RTEMS_UNSATISFIED - not enough memory for stack/FP context
269 * - RTEMS_TOO_MANY - too many global objects
273 * - RTEMS_TOO_MANY - too many global objects
270 *
274 *
271 */
275 */
272
276
273 rtems_status_code status;
277 rtems_status_code status;
274
278
275 // RECV
279 // RECV
276 status = rtems_task_create(
280 status = rtems_task_create(
277 Task_name[TASKID_RECV], TASK_PRIORITY_RECV, RTEMS_MINIMUM_STACK_SIZE,
281 Task_name[TASKID_RECV], TASK_PRIORITY_RECV, RTEMS_MINIMUM_STACK_SIZE,
278 RTEMS_DEFAULT_MODES,
282 RTEMS_DEFAULT_MODES,
279 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_RECV]
283 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_RECV]
280 );
284 );
281
285
282 if (status == RTEMS_SUCCESSFUL) // ACTN
286 if (status == RTEMS_SUCCESSFUL) // ACTN
283 {
287 {
284 status = rtems_task_create(
288 status = rtems_task_create(
285 Task_name[TASKID_ACTN], TASK_PRIORITY_ACTN, RTEMS_MINIMUM_STACK_SIZE,
289 Task_name[TASKID_ACTN], TASK_PRIORITY_ACTN, RTEMS_MINIMUM_STACK_SIZE,
286 RTEMS_DEFAULT_MODES,
290 RTEMS_DEFAULT_MODES,
287 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_ACTN]
291 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_ACTN]
288 );
292 );
289 }
293 }
290 if (status == RTEMS_SUCCESSFUL) // SPIQ
294 if (status == RTEMS_SUCCESSFUL) // SPIQ
291 {
295 {
292 status = rtems_task_create(
296 status = rtems_task_create(
293 Task_name[TASKID_SPIQ], TASK_PRIORITY_SPIQ, RTEMS_MINIMUM_STACK_SIZE,
297 Task_name[TASKID_SPIQ], TASK_PRIORITY_SPIQ, RTEMS_MINIMUM_STACK_SIZE,
294 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
298 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
295 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SPIQ]
299 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SPIQ]
296 );
300 );
297 }
301 }
298 if (status == RTEMS_SUCCESSFUL) // SMIQ
302 if (status == RTEMS_SUCCESSFUL) // SMIQ
299 {
303 {
300 status = rtems_task_create(
304 status = rtems_task_create(
301 Task_name[TASKID_SMIQ], TASK_PRIORITY_SMIQ, RTEMS_MINIMUM_STACK_SIZE,
305 Task_name[TASKID_SMIQ], TASK_PRIORITY_SMIQ, RTEMS_MINIMUM_STACK_SIZE,
302 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
306 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
303 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SMIQ]
307 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SMIQ]
304 );
308 );
305 }
309 }
306 if (status == RTEMS_SUCCESSFUL) // STAT
310 if (status == RTEMS_SUCCESSFUL) // STAT
307 {
311 {
308 status = rtems_task_create(
312 status = rtems_task_create(
309 Task_name[TASKID_STAT], TASK_PRIORITY_STAT, RTEMS_MINIMUM_STACK_SIZE,
313 Task_name[TASKID_STAT], TASK_PRIORITY_STAT, RTEMS_MINIMUM_STACK_SIZE,
310 RTEMS_DEFAULT_MODES,
314 RTEMS_DEFAULT_MODES,
311 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_STAT]
315 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_STAT]
312 );
316 );
313 }
317 }
314 if (status == RTEMS_SUCCESSFUL) // AVF0
318 if (status == RTEMS_SUCCESSFUL) // AVF0
315 {
319 {
316 status = rtems_task_create(
320 status = rtems_task_create(
317 Task_name[TASKID_AVF0], TASK_PRIORITY_AVF0, RTEMS_MINIMUM_STACK_SIZE,
321 Task_name[TASKID_AVF0], TASK_PRIORITY_AVF0, RTEMS_MINIMUM_STACK_SIZE,
318 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
322 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
319 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF0]
323 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF0]
320 );
324 );
321 }
325 }
322 if (status == RTEMS_SUCCESSFUL) // WFRM
326 if (status == RTEMS_SUCCESSFUL) // WFRM
323 {
327 {
324 status = rtems_task_create(
328 status = rtems_task_create(
325 Task_name[TASKID_WFRM], TASK_PRIORITY_WFRM, RTEMS_MINIMUM_STACK_SIZE,
329 Task_name[TASKID_WFRM], TASK_PRIORITY_WFRM, RTEMS_MINIMUM_STACK_SIZE,
326 RTEMS_DEFAULT_MODES,
330 RTEMS_DEFAULT_MODES,
327 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_WFRM]
331 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_WFRM]
328 );
332 );
329 }
333 }
330 if (status == RTEMS_SUCCESSFUL) // DUMB
334 if (status == RTEMS_SUCCESSFUL) // DUMB
331 {
335 {
332 status = rtems_task_create(
336 status = rtems_task_create(
333 Task_name[TASKID_DUMB], TASK_PRIORITY_DUMB, RTEMS_MINIMUM_STACK_SIZE,
337 Task_name[TASKID_DUMB], TASK_PRIORITY_DUMB, RTEMS_MINIMUM_STACK_SIZE,
334 RTEMS_DEFAULT_MODES,
338 RTEMS_DEFAULT_MODES,
335 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_DUMB]
339 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_DUMB]
336 );
340 );
337 }
341 }
338 if (status == RTEMS_SUCCESSFUL) // HOUS
342 if (status == RTEMS_SUCCESSFUL) // HOUS
339 {
343 {
340 status = rtems_task_create(
344 status = rtems_task_create(
341 Task_name[TASKID_HOUS], TASK_PRIORITY_HOUS, RTEMS_MINIMUM_STACK_SIZE,
345 Task_name[TASKID_HOUS], TASK_PRIORITY_HOUS, RTEMS_MINIMUM_STACK_SIZE,
342 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
346 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
343 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_HOUS]
347 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_HOUS]
344 );
348 );
345 }
349 }
346 if (status == RTEMS_SUCCESSFUL) // MATR
350 if (status == RTEMS_SUCCESSFUL) // MATR
347 {
351 {
348 status = rtems_task_create(
352 status = rtems_task_create(
349 Task_name[TASKID_MATR], TASK_PRIORITY_MATR, RTEMS_MINIMUM_STACK_SIZE,
353 Task_name[TASKID_MATR], TASK_PRIORITY_MATR, RTEMS_MINIMUM_STACK_SIZE,
350 RTEMS_DEFAULT_MODES,
354 RTEMS_DEFAULT_MODES,
351 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_MATR]
355 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_MATR]
352 );
356 );
353 }
357 }
354 if (status == RTEMS_SUCCESSFUL) // CWF3
358 if (status == RTEMS_SUCCESSFUL) // CWF3
355 {
359 {
356 status = rtems_task_create(
360 status = rtems_task_create(
357 Task_name[TASKID_CWF3], TASK_PRIORITY_CWF3, RTEMS_MINIMUM_STACK_SIZE,
361 Task_name[TASKID_CWF3], TASK_PRIORITY_CWF3, RTEMS_MINIMUM_STACK_SIZE,
358 RTEMS_DEFAULT_MODES,
362 RTEMS_DEFAULT_MODES,
359 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF3]
363 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF3]
360 );
364 );
361 }
365 }
362 if (status == RTEMS_SUCCESSFUL) // CWF2
366 if (status == RTEMS_SUCCESSFUL) // CWF2
363 {
367 {
364 status = rtems_task_create(
368 status = rtems_task_create(
365 Task_name[TASKID_CWF2], TASK_PRIORITY_CWF2, RTEMS_MINIMUM_STACK_SIZE,
369 Task_name[TASKID_CWF2], TASK_PRIORITY_CWF2, RTEMS_MINIMUM_STACK_SIZE,
366 RTEMS_DEFAULT_MODES,
370 RTEMS_DEFAULT_MODES,
367 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF2]
371 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF2]
368 );
372 );
369 }
373 }
370 if (status == RTEMS_SUCCESSFUL) // CWF1
374 if (status == RTEMS_SUCCESSFUL) // CWF1
371 {
375 {
372 status = rtems_task_create(
376 status = rtems_task_create(
373 Task_name[TASKID_CWF1], TASK_PRIORITY_CWF1, RTEMS_MINIMUM_STACK_SIZE,
377 Task_name[TASKID_CWF1], TASK_PRIORITY_CWF1, RTEMS_MINIMUM_STACK_SIZE,
374 RTEMS_DEFAULT_MODES,
378 RTEMS_DEFAULT_MODES,
375 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF1]
379 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF1]
376 );
380 );
377 }
381 }
378 if (status == RTEMS_SUCCESSFUL) // SEND
382 if (status == RTEMS_SUCCESSFUL) // SEND
379 {
383 {
380 status = rtems_task_create(
384 status = rtems_task_create(
381 Task_name[TASKID_SEND], TASK_PRIORITY_SEND, RTEMS_MINIMUM_STACK_SIZE,
385 Task_name[TASKID_SEND], TASK_PRIORITY_SEND, RTEMS_MINIMUM_STACK_SIZE,
382 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
386 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
383 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SEND]
387 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SEND]
384 );
388 );
385 }
389 }
386 if (status == RTEMS_SUCCESSFUL) // WTDG
390 if (status == RTEMS_SUCCESSFUL) // WTDG
387 {
391 {
388 status = rtems_task_create(
392 status = rtems_task_create(
389 Task_name[TASKID_WTDG], TASK_PRIORITY_WTDG, RTEMS_MINIMUM_STACK_SIZE,
393 Task_name[TASKID_WTDG], TASK_PRIORITY_WTDG, RTEMS_MINIMUM_STACK_SIZE,
390 RTEMS_DEFAULT_MODES,
394 RTEMS_DEFAULT_MODES,
391 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_WTDG]
395 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_WTDG]
392 );
396 );
393 }
397 }
394
398
395 return status;
399 return status;
396 }
400 }
397
401
398 int start_recv_send_tasks( void )
402 int start_recv_send_tasks( void )
399 {
403 {
400 rtems_status_code status;
404 rtems_status_code status;
401
405
402 status = rtems_task_start( Task_id[TASKID_RECV], recv_task, 1 );
406 status = rtems_task_start( Task_id[TASKID_RECV], recv_task, 1 );
403 if (status!=RTEMS_SUCCESSFUL) {
407 if (status!=RTEMS_SUCCESSFUL) {
404 BOOT_PRINTF("in INIT *** Error starting TASK_RECV\n")
408 BOOT_PRINTF("in INIT *** Error starting TASK_RECV\n")
405 }
409 }
406
410
407 if (status == RTEMS_SUCCESSFUL) // SEND
411 if (status == RTEMS_SUCCESSFUL) // SEND
408 {
412 {
409 status = rtems_task_start( Task_id[TASKID_SEND], send_task, 1 );
413 status = rtems_task_start( Task_id[TASKID_SEND], send_task, 1 );
410 if (status!=RTEMS_SUCCESSFUL) {
414 if (status!=RTEMS_SUCCESSFUL) {
411 BOOT_PRINTF("in INIT *** Error starting TASK_SEND\n")
415 BOOT_PRINTF("in INIT *** Error starting TASK_SEND\n")
412 }
416 }
413 }
417 }
414
418
415 return status;
419 return status;
416 }
420 }
417
421
418 int start_all_tasks( void ) // start all tasks except SEND RECV and HOUS
422 int start_all_tasks( void ) // start all tasks except SEND RECV and HOUS
419 {
423 {
420 /** This function starts all RTEMS tasks used in the software.
424 /** This function starts all RTEMS tasks used in the software.
421 *
425 *
422 * @return RTEMS directive status codes:
426 * @return RTEMS directive status codes:
423 * - RTEMS_SUCCESSFUL - ask started successfully
427 * - RTEMS_SUCCESSFUL - ask started successfully
424 * - RTEMS_INVALID_ADDRESS - invalid task entry point
428 * - RTEMS_INVALID_ADDRESS - invalid task entry point
425 * - RTEMS_INVALID_ID - invalid task id
429 * - RTEMS_INVALID_ID - invalid task id
426 * - RTEMS_INCORRECT_STATE - task not in the dormant state
430 * - RTEMS_INCORRECT_STATE - task not in the dormant state
427 * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot start remote task
431 * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot start remote task
428 *
432 *
429 */
433 */
430 // starts all the tasks fot eh flight software
434 // starts all the tasks fot eh flight software
431
435
432 rtems_status_code status;
436 rtems_status_code status;
433
437
434 status = rtems_task_start( Task_id[TASKID_SPIQ], spiq_task, 1 );
438 status = rtems_task_start( Task_id[TASKID_SPIQ], spiq_task, 1 );
435 if (status!=RTEMS_SUCCESSFUL) {
439 if (status!=RTEMS_SUCCESSFUL) {
436 BOOT_PRINTF("in INIT *** Error starting TASK_SPIQ\n")
440 BOOT_PRINTF("in INIT *** Error starting TASK_SPIQ\n")
437 }
441 }
438
442
439 if (status == RTEMS_SUCCESSFUL) // WTDG
443 if (status == RTEMS_SUCCESSFUL) // WTDG
440 {
444 {
441 status = rtems_task_start( Task_id[TASKID_WTDG], wtdg_task, 1 );
445 status = rtems_task_start( Task_id[TASKID_WTDG], wtdg_task, 1 );
442 if (status!=RTEMS_SUCCESSFUL) {
446 if (status!=RTEMS_SUCCESSFUL) {
443 BOOT_PRINTF("in INIT *** Error starting TASK_WTDG\n")
447 BOOT_PRINTF("in INIT *** Error starting TASK_WTDG\n")
444 }
448 }
445 }
449 }
446
450
447 if (status == RTEMS_SUCCESSFUL) // SMIQ
451 if (status == RTEMS_SUCCESSFUL) // SMIQ
448 {
452 {
449 status = rtems_task_start( Task_id[TASKID_SMIQ], smiq_task, 1 );
453 status = rtems_task_start( Task_id[TASKID_SMIQ], smiq_task, 1 );
450 if (status!=RTEMS_SUCCESSFUL) {
454 if (status!=RTEMS_SUCCESSFUL) {
451 BOOT_PRINTF("in INIT *** Error starting TASK_BPPR\n")
455 BOOT_PRINTF("in INIT *** Error starting TASK_BPPR\n")
452 }
456 }
453 }
457 }
454
458
455 if (status == RTEMS_SUCCESSFUL) // ACTN
459 if (status == RTEMS_SUCCESSFUL) // ACTN
456 {
460 {
457 status = rtems_task_start( Task_id[TASKID_ACTN], actn_task, 1 );
461 status = rtems_task_start( Task_id[TASKID_ACTN], actn_task, 1 );
458 if (status!=RTEMS_SUCCESSFUL) {
462 if (status!=RTEMS_SUCCESSFUL) {
459 BOOT_PRINTF("in INIT *** Error starting TASK_ACTN\n")
463 BOOT_PRINTF("in INIT *** Error starting TASK_ACTN\n")
460 }
464 }
461 }
465 }
462
466
463 if (status == RTEMS_SUCCESSFUL) // STAT
467 if (status == RTEMS_SUCCESSFUL) // STAT
464 {
468 {
465 status = rtems_task_start( Task_id[TASKID_STAT], stat_task, 1 );
469 status = rtems_task_start( Task_id[TASKID_STAT], stat_task, 1 );
466 if (status!=RTEMS_SUCCESSFUL) {
470 if (status!=RTEMS_SUCCESSFUL) {
467 BOOT_PRINTF("in INIT *** Error starting TASK_STAT\n")
471 BOOT_PRINTF("in INIT *** Error starting TASK_STAT\n")
468 }
472 }
469 }
473 }
470
474
471 if (status == RTEMS_SUCCESSFUL) // AVF0
475 if (status == RTEMS_SUCCESSFUL) // AVF0
472 {
476 {
473 status = rtems_task_start( Task_id[TASKID_AVF0], avf0_task, 1 );
477 status = rtems_task_start( Task_id[TASKID_AVF0], avf0_task, 1 );
474 if (status!=RTEMS_SUCCESSFUL) {
478 if (status!=RTEMS_SUCCESSFUL) {
475 BOOT_PRINTF("in INIT *** Error starting TASK_AVF0\n")
479 BOOT_PRINTF("in INIT *** Error starting TASK_AVF0\n")
476 }
480 }
477 }
481 }
478
482
479 if (status == RTEMS_SUCCESSFUL) // WFRM
483 if (status == RTEMS_SUCCESSFUL) // WFRM
480 {
484 {
481 status = rtems_task_start( Task_id[TASKID_WFRM], wfrm_task, 1 );
485 status = rtems_task_start( Task_id[TASKID_WFRM], wfrm_task, 1 );
482 if (status!=RTEMS_SUCCESSFUL) {
486 if (status!=RTEMS_SUCCESSFUL) {
483 BOOT_PRINTF("in INIT *** Error starting TASK_WFRM\n")
487 BOOT_PRINTF("in INIT *** Error starting TASK_WFRM\n")
484 }
488 }
485 }
489 }
486
490
487 if (status == RTEMS_SUCCESSFUL) // DUMB
491 if (status == RTEMS_SUCCESSFUL) // DUMB
488 {
492 {
489 status = rtems_task_start( Task_id[TASKID_DUMB], dumb_task, 1 );
493 status = rtems_task_start( Task_id[TASKID_DUMB], dumb_task, 1 );
490 if (status!=RTEMS_SUCCESSFUL) {
494 if (status!=RTEMS_SUCCESSFUL) {
491 BOOT_PRINTF("in INIT *** Error starting TASK_DUMB\n")
495 BOOT_PRINTF("in INIT *** Error starting TASK_DUMB\n")
492 }
496 }
493 }
497 }
494
498
495 if (status == RTEMS_SUCCESSFUL) // HOUS
499 if (status == RTEMS_SUCCESSFUL) // HOUS
496 {
500 {
497 status = rtems_task_start( Task_id[TASKID_HOUS], hous_task, 1 );
501 status = rtems_task_start( Task_id[TASKID_HOUS], hous_task, 1 );
498 if (status!=RTEMS_SUCCESSFUL) {
502 if (status!=RTEMS_SUCCESSFUL) {
499 BOOT_PRINTF("in INIT *** Error starting TASK_HOUS\n")
503 BOOT_PRINTF("in INIT *** Error starting TASK_HOUS\n")
500 }
504 }
501 }
505 }
502
506
503 if (status == RTEMS_SUCCESSFUL) // MATR
507 if (status == RTEMS_SUCCESSFUL) // MATR
504 {
508 {
505 status = rtems_task_start( Task_id[TASKID_MATR], matr_task, 1 );
509 status = rtems_task_start( Task_id[TASKID_MATR], matr_task, 1 );
506 if (status!=RTEMS_SUCCESSFUL) {
510 if (status!=RTEMS_SUCCESSFUL) {
507 BOOT_PRINTF("in INIT *** Error starting TASK_MATR\n")
511 BOOT_PRINTF("in INIT *** Error starting TASK_MATR\n")
508 }
512 }
509 }
513 }
510
514
511 if (status == RTEMS_SUCCESSFUL) // CWF3
515 if (status == RTEMS_SUCCESSFUL) // CWF3
512 {
516 {
513 status = rtems_task_start( Task_id[TASKID_CWF3], cwf3_task, 1 );
517 status = rtems_task_start( Task_id[TASKID_CWF3], cwf3_task, 1 );
514 if (status!=RTEMS_SUCCESSFUL) {
518 if (status!=RTEMS_SUCCESSFUL) {
515 BOOT_PRINTF("in INIT *** Error starting TASK_CWF3\n")
519 BOOT_PRINTF("in INIT *** Error starting TASK_CWF3\n")
516 }
520 }
517 }
521 }
518
522
519 if (status == RTEMS_SUCCESSFUL) // CWF2
523 if (status == RTEMS_SUCCESSFUL) // CWF2
520 {
524 {
521 status = rtems_task_start( Task_id[TASKID_CWF2], cwf2_task, 1 );
525 status = rtems_task_start( Task_id[TASKID_CWF2], cwf2_task, 1 );
522 if (status!=RTEMS_SUCCESSFUL) {
526 if (status!=RTEMS_SUCCESSFUL) {
523 BOOT_PRINTF("in INIT *** Error starting TASK_CWF2\n")
527 BOOT_PRINTF("in INIT *** Error starting TASK_CWF2\n")
524 }
528 }
525 }
529 }
526
530
527 if (status == RTEMS_SUCCESSFUL) // CWF1
531 if (status == RTEMS_SUCCESSFUL) // CWF1
528 {
532 {
529 status = rtems_task_start( Task_id[TASKID_CWF1], cwf1_task, 1 );
533 status = rtems_task_start( Task_id[TASKID_CWF1], cwf1_task, 1 );
530 if (status!=RTEMS_SUCCESSFUL) {
534 if (status!=RTEMS_SUCCESSFUL) {
531 BOOT_PRINTF("in INIT *** Error starting TASK_CWF1\n")
535 BOOT_PRINTF("in INIT *** Error starting TASK_CWF1\n")
532 }
536 }
533 }
537 }
534 return status;
538 return status;
535 }
539 }
536
540
537 rtems_status_code create_message_queues( void ) // create the two message queues used in the software
541 rtems_status_code create_message_queues( void ) // create the two message queues used in the software
538 {
542 {
539 rtems_status_code status_recv;
543 rtems_status_code status_recv;
540 rtems_status_code status_send;
544 rtems_status_code status_send;
541 rtems_status_code ret;
545 rtems_status_code ret;
542 rtems_id queue_id;
546 rtems_id queue_id;
543
547
544 // create the queue for handling valid TCs
548 // create the queue for handling valid TCs
545 status_recv = rtems_message_queue_create( misc_name[QUEUE_RECV],
549 status_recv = rtems_message_queue_create( misc_name[QUEUE_RECV],
546 ACTION_MSG_QUEUE_COUNT, CCSDS_TC_PKT_MAX_SIZE,
550 ACTION_MSG_QUEUE_COUNT, CCSDS_TC_PKT_MAX_SIZE,
547 RTEMS_FIFO | RTEMS_LOCAL, &queue_id );
551 RTEMS_FIFO | RTEMS_LOCAL, &queue_id );
548 if ( status_recv != RTEMS_SUCCESSFUL ) {
552 if ( status_recv != RTEMS_SUCCESSFUL ) {
549 PRINTF1("in create_message_queues *** ERR creating QUEU queue, %d\n", status_recv)
553 PRINTF1("in create_message_queues *** ERR creating QUEU queue, %d\n", status_recv)
550 }
554 }
551
555
552 // create the queue for handling TM packet sending
556 // create the queue for handling TM packet sending
553 status_send = rtems_message_queue_create( misc_name[QUEUE_SEND],
557 status_send = rtems_message_queue_create( misc_name[QUEUE_SEND],
554 ACTION_MSG_PKTS_COUNT, ACTION_MSG_PKTS_MAX_SIZE,
558 ACTION_MSG_PKTS_COUNT, ACTION_MSG_PKTS_MAX_SIZE,
555 RTEMS_FIFO | RTEMS_LOCAL, &queue_id );
559 RTEMS_FIFO | RTEMS_LOCAL, &queue_id );
556 if ( status_send != RTEMS_SUCCESSFUL ) {
560 if ( status_send != RTEMS_SUCCESSFUL ) {
557 PRINTF1("in create_message_queues *** ERR creating PKTS queue, %d\n", status_send)
561 PRINTF1("in create_message_queues *** ERR creating PKTS queue, %d\n", status_send)
558 }
562 }
559
563
560 if ( status_recv != RTEMS_SUCCESSFUL )
564 if ( status_recv != RTEMS_SUCCESSFUL )
561 {
565 {
562 ret = status_recv;
566 ret = status_recv;
563 }
567 }
564 else
568 else
565 {
569 {
566 ret = status_send;
570 ret = status_send;
567 }
571 }
568
572
569 return ret;
573 return ret;
570 }
574 }
571
575
572 rtems_status_code get_message_queue_id_send( rtems_id *queue_id )
576 rtems_status_code get_message_queue_id_send( rtems_id *queue_id )
573 {
577 {
574 rtems_status_code status;
578 rtems_status_code status;
575 rtems_name queue_name;
579 rtems_name queue_name;
576
580
577 queue_name = rtems_build_name( 'Q', '_', 'S', 'D' );
581 queue_name = rtems_build_name( 'Q', '_', 'S', 'D' );
578
582
579 status = rtems_message_queue_ident( queue_name, 0, queue_id );
583 status = rtems_message_queue_ident( queue_name, 0, queue_id );
580
584
581 return status;
585 return status;
582 }
586 }
583
587
584 rtems_status_code get_message_queue_id_recv( rtems_id *queue_id )
588 rtems_status_code get_message_queue_id_recv( rtems_id *queue_id )
585 {
589 {
586 rtems_status_code status;
590 rtems_status_code status;
587 rtems_name queue_name;
591 rtems_name queue_name;
588
592
589 queue_name = rtems_build_name( 'Q', '_', 'R', 'V' );
593 queue_name = rtems_build_name( 'Q', '_', 'R', 'V' );
590
594
591 status = rtems_message_queue_ident( queue_name, 0, queue_id );
595 status = rtems_message_queue_ident( queue_name, 0, queue_id );
592
596
593 return status;
597 return status;
594 }
598 }
@@ -1,343 +1,344
1 /** General usage functions and RTEMS tasks.
1 /** General usage functions and RTEMS tasks.
2 *
2 *
3 * @file
3 * @file
4 * @author P. LEROY
4 * @author P. LEROY
5 *
5 *
6 */
6 */
7
7
8 #include "fsw_misc.h"
8 #include "fsw_misc.h"
9
9
10 void configure_timer(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider,
10 void configure_timer(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider,
11 unsigned char interrupt_level, rtems_isr (*timer_isr)() )
11 unsigned char interrupt_level, rtems_isr (*timer_isr)() )
12 {
12 {
13 /** This function configures a GPTIMER timer instantiated in the VHDL design.
13 /** This function configures a GPTIMER timer instantiated in the VHDL design.
14 *
14 *
15 * @param gptimer_regs points to the APB registers of the GPTIMER IP core.
15 * @param gptimer_regs points to the APB registers of the GPTIMER IP core.
16 * @param timer is the number of the timer in the IP core (several timers can be instantiated).
16 * @param timer is the number of the timer in the IP core (several timers can be instantiated).
17 * @param clock_divider is the divider of the 1 MHz clock that will be configured.
17 * @param clock_divider is the divider of the 1 MHz clock that will be configured.
18 * @param interrupt_level is the interrupt level that the timer drives.
18 * @param interrupt_level is the interrupt level that the timer drives.
19 * @param timer_isr is the interrupt subroutine that will be attached to the IRQ driven by the timer.
19 * @param timer_isr is the interrupt subroutine that will be attached to the IRQ driven by the timer.
20 *
20 *
21 * Interrupt levels are described in the SPARC documentation sparcv8.pdf p.76
21 * Interrupt levels are described in the SPARC documentation sparcv8.pdf p.76
22 *
22 *
23 */
23 */
24
24
25 rtems_status_code status;
25 rtems_status_code status;
26 rtems_isr_entry old_isr_handler;
26 rtems_isr_entry old_isr_handler;
27
27
28 gptimer_regs->timer[timer].ctrl = 0x00; // reset the control register
28 gptimer_regs->timer[timer].ctrl = 0x00; // reset the control register
29
29
30 status = rtems_interrupt_catch( timer_isr, interrupt_level, &old_isr_handler) ; // see sparcv8.pdf p.76 for interrupt levels
30 status = rtems_interrupt_catch( timer_isr, interrupt_level, &old_isr_handler) ; // see sparcv8.pdf p.76 for interrupt levels
31 if (status!=RTEMS_SUCCESSFUL)
31 if (status!=RTEMS_SUCCESSFUL)
32 {
32 {
33 PRINTF("in configure_timer *** ERR rtems_interrupt_catch\n")
33 PRINTF("in configure_timer *** ERR rtems_interrupt_catch\n")
34 }
34 }
35
35
36 timer_set_clock_divider( gptimer_regs, timer, clock_divider);
36 timer_set_clock_divider( gptimer_regs, timer, clock_divider);
37 }
37 }
38
38
39 void timer_start(gptimer_regs_t *gptimer_regs, unsigned char timer)
39 void timer_start(gptimer_regs_t *gptimer_regs, unsigned char timer)
40 {
40 {
41 /** This function starts a GPTIMER timer.
41 /** This function starts a GPTIMER timer.
42 *
42 *
43 * @param gptimer_regs points to the APB registers of the GPTIMER IP core.
43 * @param gptimer_regs points to the APB registers of the GPTIMER IP core.
44 * @param timer is the number of the timer in the IP core (several timers can be instantiated).
44 * @param timer is the number of the timer in the IP core (several timers can be instantiated).
45 *
45 *
46 */
46 */
47
47
48 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000010; // clear pending IRQ if any
48 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000010; // clear pending IRQ if any
49 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000004; // LD load value from the reload register
49 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000004; // LD load value from the reload register
50 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000001; // EN enable the timer
50 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000001; // EN enable the timer
51 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000002; // RS restart
51 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000002; // RS restart
52 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000008; // IE interrupt enable
52 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000008; // IE interrupt enable
53 }
53 }
54
54
55 void timer_stop(gptimer_regs_t *gptimer_regs, unsigned char timer)
55 void timer_stop(gptimer_regs_t *gptimer_regs, unsigned char timer)
56 {
56 {
57 /** This function stops a GPTIMER timer.
57 /** This function stops a GPTIMER timer.
58 *
58 *
59 * @param gptimer_regs points to the APB registers of the GPTIMER IP core.
59 * @param gptimer_regs points to the APB registers of the GPTIMER IP core.
60 * @param timer is the number of the timer in the IP core (several timers can be instantiated).
60 * @param timer is the number of the timer in the IP core (several timers can be instantiated).
61 *
61 *
62 */
62 */
63
63
64 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl & 0xfffffffe; // EN enable the timer
64 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl & 0xfffffffe; // EN enable the timer
65 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl & 0xffffffef; // IE interrupt enable
65 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl & 0xffffffef; // IE interrupt enable
66 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000010; // clear pending IRQ if any
66 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000010; // clear pending IRQ if any
67 }
67 }
68
68
69 void timer_set_clock_divider(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider)
69 void timer_set_clock_divider(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider)
70 {
70 {
71 /** This function sets the clock divider of a GPTIMER timer.
71 /** This function sets the clock divider of a GPTIMER timer.
72 *
72 *
73 * @param gptimer_regs points to the APB registers of the GPTIMER IP core.
73 * @param gptimer_regs points to the APB registers of the GPTIMER IP core.
74 * @param timer is the number of the timer in the IP core (several timers can be instantiated).
74 * @param timer is the number of the timer in the IP core (several timers can be instantiated).
75 * @param clock_divider is the divider of the 1 MHz clock that will be configured.
75 * @param clock_divider is the divider of the 1 MHz clock that will be configured.
76 *
76 *
77 */
77 */
78
78
79 gptimer_regs->timer[timer].reload = clock_divider; // base clock frequency is 1 MHz
79 gptimer_regs->timer[timer].reload = clock_divider; // base clock frequency is 1 MHz
80 }
80 }
81
81
82 int send_console_outputs_on_apbuart_port( void ) // Send the console outputs on the apbuart port
82 int send_console_outputs_on_apbuart_port( void ) // Send the console outputs on the apbuart port
83 {
83 {
84 struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) REGS_ADDR_APBUART;
84 struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) REGS_ADDR_APBUART;
85
85
86 apbuart_regs->ctrl = APBUART_CTRL_REG_MASK_TE;
86 apbuart_regs->ctrl = APBUART_CTRL_REG_MASK_TE;
87
87
88 return 0;
88 return 0;
89 }
89 }
90
90
91 int enable_apbuart_transmitter( void ) // set the bit 1, TE Transmitter Enable to 1 in the APBUART control register
91 int enable_apbuart_transmitter( void ) // set the bit 1, TE Transmitter Enable to 1 in the APBUART control register
92 {
92 {
93 struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) REGS_ADDR_APBUART;
93 struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) REGS_ADDR_APBUART;
94
94
95 apbuart_regs->ctrl = apbuart_regs->ctrl | APBUART_CTRL_REG_MASK_TE;
95 apbuart_regs->ctrl = apbuart_regs->ctrl | APBUART_CTRL_REG_MASK_TE;
96
96
97 return 0;
97 return 0;
98 }
98 }
99
99
100 void set_apbuart_scaler_reload_register(unsigned int regs, unsigned int value)
100 void set_apbuart_scaler_reload_register(unsigned int regs, unsigned int value)
101 {
101 {
102 /** This function sets the scaler reload register of the apbuart module
102 /** This function sets the scaler reload register of the apbuart module
103 *
103 *
104 * @param regs is the address of the apbuart registers in memory
104 * @param regs is the address of the apbuart registers in memory
105 * @param value is the value that will be stored in the scaler register
105 * @param value is the value that will be stored in the scaler register
106 *
106 *
107 * The value shall be set by the software to get data on the serial interface.
107 * The value shall be set by the software to get data on the serial interface.
108 *
108 *
109 */
109 */
110
110
111 struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) regs;
111 struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) regs;
112
112
113 apbuart_regs->scaler = value;
113 apbuart_regs->scaler = value;
114 BOOT_PRINTF1("OK *** apbuart port scaler reload register set to 0x%x\n", value)
114 BOOT_PRINTF1("OK *** apbuart port scaler reload register set to 0x%x\n", value)
115 }
115 }
116
116
117 //************
117 //************
118 // RTEMS TASKS
118 // RTEMS TASKS
119
119
120 rtems_task stat_task(rtems_task_argument argument)
120 rtems_task stat_task(rtems_task_argument argument)
121 {
121 {
122 int i;
122 int i;
123 int j;
123 int j;
124 i = 0;
124 i = 0;
125 j = 0;
125 j = 0;
126 BOOT_PRINTF("in STAT *** \n")
126 BOOT_PRINTF("in STAT *** \n")
127 while(1){
127 while(1){
128 rtems_task_wake_after(1000);
128 rtems_task_wake_after(1000);
129 PRINTF1("%d\n", j)
129 PRINTF1("%d\n", j)
130 if (i == CPU_USAGE_REPORT_PERIOD) {
130 if (i == CPU_USAGE_REPORT_PERIOD) {
131 // #ifdef PRINT_TASK_STATISTICS
131 // #ifdef PRINT_TASK_STATISTICS
132 // rtems_cpu_usage_report();
132 // rtems_cpu_usage_report();
133 // rtems_cpu_usage_reset();
133 // rtems_cpu_usage_reset();
134 // #endif
134 // #endif
135 i = 0;
135 i = 0;
136 }
136 }
137 else i++;
137 else i++;
138 j++;
138 j++;
139 }
139 }
140 }
140 }
141
141
142 rtems_task hous_task(rtems_task_argument argument)
142 rtems_task hous_task(rtems_task_argument argument)
143 {
143 {
144 rtems_status_code status;
144 rtems_status_code status;
145 rtems_id queue_id;
145 rtems_id queue_id;
146
146
147 status = get_message_queue_id_send( &queue_id );
147 status = get_message_queue_id_send( &queue_id );
148 if (status != RTEMS_SUCCESSFUL)
148 if (status != RTEMS_SUCCESSFUL)
149 {
149 {
150 PRINTF1("in HOUS *** ERR get_message_queue_id_send %d\n", status)
150 PRINTF1("in HOUS *** ERR get_message_queue_id_send %d\n", status)
151 }
151 }
152
152
153 BOOT_PRINTF("in HOUS ***\n")
153 BOOT_PRINTF("in HOUS ***\n")
154
154
155 if (rtems_rate_monotonic_ident( name_hk_rate_monotonic, &HK_id) != RTEMS_SUCCESSFUL) {
155 if (rtems_rate_monotonic_ident( name_hk_rate_monotonic, &HK_id) != RTEMS_SUCCESSFUL) {
156 status = rtems_rate_monotonic_create( name_hk_rate_monotonic, &HK_id );
156 status = rtems_rate_monotonic_create( name_hk_rate_monotonic, &HK_id );
157 if( status != RTEMS_SUCCESSFUL ) {
157 if( status != RTEMS_SUCCESSFUL ) {
158 PRINTF1( "rtems_rate_monotonic_create failed with status of %d\n", status )
158 PRINTF1( "rtems_rate_monotonic_create failed with status of %d\n", status )
159 }
159 }
160 }
160 }
161
161
162 housekeeping_packet.targetLogicalAddress = CCSDS_DESTINATION_ID;
162 housekeeping_packet.targetLogicalAddress = CCSDS_DESTINATION_ID;
163 housekeeping_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID;
163 housekeeping_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID;
164 housekeeping_packet.reserved = DEFAULT_RESERVED;
164 housekeeping_packet.reserved = DEFAULT_RESERVED;
165 housekeeping_packet.userApplication = CCSDS_USER_APP;
165 housekeeping_packet.userApplication = CCSDS_USER_APP;
166 housekeeping_packet.packetID[0] = (unsigned char) (TM_PACKET_ID_HK >> 8);
166 housekeeping_packet.packetID[0] = (unsigned char) (TM_PACKET_ID_HK >> 8);
167 housekeeping_packet.packetID[1] = (unsigned char) (TM_PACKET_ID_HK);
167 housekeeping_packet.packetID[1] = (unsigned char) (TM_PACKET_ID_HK);
168 housekeeping_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
168 housekeeping_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
169 housekeeping_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
169 housekeeping_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
170 housekeeping_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_HK >> 8);
170 housekeeping_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_HK >> 8);
171 housekeeping_packet.packetLength[1] = (unsigned char) (PACKET_LENGTH_HK );
171 housekeeping_packet.packetLength[1] = (unsigned char) (PACKET_LENGTH_HK );
172 housekeeping_packet.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
172 housekeeping_packet.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
173 housekeeping_packet.serviceType = TM_TYPE_HK;
173 housekeeping_packet.serviceType = TM_TYPE_HK;
174 housekeeping_packet.serviceSubType = TM_SUBTYPE_HK;
174 housekeeping_packet.serviceSubType = TM_SUBTYPE_HK;
175 housekeeping_packet.destinationID = TM_DESTINATION_ID_GROUND;
175 housekeeping_packet.destinationID = TM_DESTINATION_ID_GROUND;
176 housekeeping_packet.sid = SID_HK;
176 housekeeping_packet.sid = SID_HK;
177
177
178 status = rtems_rate_monotonic_cancel(HK_id);
178 status = rtems_rate_monotonic_cancel(HK_id);
179 if( status != RTEMS_SUCCESSFUL ) {
179 if( status != RTEMS_SUCCESSFUL ) {
180 PRINTF1( "ERR *** in HOUS *** rtems_rate_monotonic_cancel(HK_id) ***code: %d\n", status )
180 PRINTF1( "ERR *** in HOUS *** rtems_rate_monotonic_cancel(HK_id) ***code: %d\n", status )
181 }
181 }
182 else {
182 else {
183 DEBUG_PRINTF("OK *** in HOUS *** rtems_rate_monotonic_cancel(HK_id)\n")
183 DEBUG_PRINTF("OK *** in HOUS *** rtems_rate_monotonic_cancel(HK_id)\n")
184 }
184 }
185
185
186 while(1){ // launch the rate monotonic task
186 while(1){ // launch the rate monotonic task
187 status = rtems_rate_monotonic_period( HK_id, HK_PERIOD );
187 status = rtems_rate_monotonic_period( HK_id, HK_PERIOD );
188 if ( status != RTEMS_SUCCESSFUL ) {
188 if ( status != RTEMS_SUCCESSFUL ) {
189 PRINTF1( "in HOUS *** ERR period: %d\n", status);
189 PRINTF1( "in HOUS *** ERR period: %d\n", status);
190 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_6 );
190 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_6 );
191 }
191 }
192 else {
192 else {
193 increment_seq_counter( housekeeping_packet.packetSequenceControl );
193 increment_seq_counter( housekeeping_packet.packetSequenceControl );
194 housekeeping_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
194 housekeeping_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
195 housekeeping_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
195 housekeeping_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
196 housekeeping_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
196 housekeeping_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
197 housekeeping_packet.time[3] = (unsigned char) (time_management_regs->coarse_time);
197 housekeeping_packet.time[3] = (unsigned char) (time_management_regs->coarse_time);
198 housekeeping_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
198 housekeeping_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
199 housekeeping_packet.time[5] = (unsigned char) (time_management_regs->fine_time);
199 housekeeping_packet.time[5] = (unsigned char) (time_management_regs->fine_time);
200
200
201 spacewire_update_statistics();
201 spacewire_update_statistics();
202
202
203 // SEND PACKET
203 // SEND PACKET
204 status = rtems_message_queue_send( queue_id, &housekeeping_packet,
204 status = rtems_message_queue_send( queue_id, &housekeeping_packet,
205 PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES);
205 PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES);
206 if (status != RTEMS_SUCCESSFUL) {
206 if (status != RTEMS_SUCCESSFUL) {
207 PRINTF1("in HOUS *** ERR send: %d\n", status)
207 PRINTF1("in HOUS *** ERR send: %d\n", status)
208 }
208 }
209 }
209 }
210 }
210 }
211
211
212 PRINTF("in HOUS *** deleting task\n")
212 PRINTF("in HOUS *** deleting task\n")
213
213
214 status = rtems_task_delete( RTEMS_SELF ); // should not return
214 status = rtems_task_delete( RTEMS_SELF ); // should not return
215 printf( "rtems_task_delete returned with status of %d.\n", status );
215 printf( "rtems_task_delete returned with status of %d.\n", status );
216 return;
216 return;
217 }
217 }
218
218
219 rtems_task dumb_task( rtems_task_argument unused )
219 rtems_task dumb_task( rtems_task_argument unused )
220 {
220 {
221 /** This RTEMS taks is used to print messages without affecting the general behaviour of the software.
221 /** This RTEMS taks is used to print messages without affecting the general behaviour of the software.
222 *
222 *
223 * @param unused is the starting argument of the RTEMS task
223 * @param unused is the starting argument of the RTEMS task
224 *
224 *
225 * The DUMB taks waits for RTEMS events and print messages depending on the incoming events.
225 * The DUMB taks waits for RTEMS events and print messages depending on the incoming events.
226 *
226 *
227 */
227 */
228
228
229 unsigned int i;
229 unsigned int i;
230 unsigned int intEventOut;
230 unsigned int intEventOut;
231 unsigned int coarse_time = 0;
231 unsigned int coarse_time = 0;
232 unsigned int fine_time = 0;
232 unsigned int fine_time = 0;
233 rtems_event_set event_out;
233 rtems_event_set event_out;
234
234
235 char *DumbMessages[8] = {"in DUMB *** default", // RTEMS_EVENT_0
235 char *DumbMessages[9] = {"in DUMB *** default", // RTEMS_EVENT_0
236 "in DUMB *** timecode_irq_handler", // RTEMS_EVENT_1
236 "in DUMB *** timecode_irq_handler", // RTEMS_EVENT_1
237 "in DUMB *** waveforms_isr", // RTEMS_EVENT_2
237 "in DUMB *** waveforms_isr", // RTEMS_EVENT_2
238 "in DUMB *** in SMIQ *** Error sending event to AVF0", // RTEMS_EVENT_3
238 "in DUMB *** in SMIQ *** Error sending event to AVF0", // RTEMS_EVENT_3
239 "in DUMB *** spectral_matrices_isr *** Error sending event to SMIQ", // RTEMS_EVENT_4
239 "in DUMB *** spectral_matrices_isr *** Error sending event to SMIQ", // RTEMS_EVENT_4
240 "in DUMB *** waveforms_simulator_isr", // RTEMS_EVENT_5
240 "in DUMB *** waveforms_simulator_isr", // RTEMS_EVENT_5
241 "ERR HK", // RTEMS_EVENT_6
241 "ERR HK", // RTEMS_EVENT_6
242 "ready for dump" // RTEMS_EVENT_7
242 "ready for dump", // RTEMS_EVENT_7
243 "in DUMB *** spectral_matrices_isr" // RTEMS_EVENT_8
243 };
244 };
244
245
245 BOOT_PRINTF("in DUMB *** \n")
246 BOOT_PRINTF("in DUMB *** \n")
246
247
247 while(1){
248 while(1){
248 rtems_event_receive(RTEMS_EVENT_0 | RTEMS_EVENT_1 | RTEMS_EVENT_2 | RTEMS_EVENT_3
249 rtems_event_receive(RTEMS_EVENT_0 | RTEMS_EVENT_1 | RTEMS_EVENT_2 | RTEMS_EVENT_3
249 | RTEMS_EVENT_4 | RTEMS_EVENT_5 | RTEMS_EVENT_6 | RTEMS_EVENT_7,
250 | RTEMS_EVENT_4 | RTEMS_EVENT_5 | RTEMS_EVENT_6 | RTEMS_EVENT_7
251 | RTEMS_EVENT_8,
250 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT
252 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT
251 intEventOut = (unsigned int) event_out;
253 intEventOut = (unsigned int) event_out;
252 for ( i=0; i<32; i++)
254 for ( i=0; i<32; i++)
253 {
255 {
254 if ( ((intEventOut >> i) & 0x0001) != 0)
256 if ( ((intEventOut >> i) & 0x0001) != 0)
255 {
257 {
256 coarse_time = time_management_regs->coarse_time;
258 coarse_time = time_management_regs->coarse_time;
257 fine_time = time_management_regs->fine_time;
259 fine_time = time_management_regs->fine_time;
258 printf("in DUMB *** coarse: %x, fine: %x, %s\n", coarse_time, fine_time, DumbMessages[i]);
260 printf("in DUMB *** coarse: %x, fine: %x, %s\n", coarse_time, fine_time, DumbMessages[i]);
259 PRINTF1("status = %x\n", waveform_picker_regs->status)
260 }
261 }
261 }
262 }
262 }
263 }
263 }
264 }
264
265
265 //*****************************
266 //*****************************
266 // init housekeeping parameters
267 // init housekeeping parameters
267
268
268 void init_housekeeping_parameters( void )
269 void init_housekeeping_parameters( void )
269 {
270 {
270 /** This function initialize the housekeeping_packet global variable with default values.
271 /** This function initialize the housekeeping_packet global variable with default values.
271 *
272 *
272 */
273 */
273
274
274 unsigned int i = 0;
275 unsigned int i = 0;
275 unsigned char *parameters;
276 unsigned char *parameters;
276
277
277 parameters = (unsigned char*) &housekeeping_packet.lfr_status_word;
278 parameters = (unsigned char*) &housekeeping_packet.lfr_status_word;
278 for(i = 0; i< SIZE_HK_PARAMETERS; i++)
279 for(i = 0; i< SIZE_HK_PARAMETERS; i++)
279 {
280 {
280 parameters[i] = 0x00;
281 parameters[i] = 0x00;
281 }
282 }
282 // init status word
283 // init status word
283 housekeeping_packet.lfr_status_word[0] = DEFAULT_STATUS_WORD_BYTE0;
284 housekeeping_packet.lfr_status_word[0] = DEFAULT_STATUS_WORD_BYTE0;
284 housekeeping_packet.lfr_status_word[1] = DEFAULT_STATUS_WORD_BYTE1;
285 housekeeping_packet.lfr_status_word[1] = DEFAULT_STATUS_WORD_BYTE1;
285 // init software version
286 // init software version
286 housekeeping_packet.lfr_sw_version[0] = SW_VERSION_N1;
287 housekeeping_packet.lfr_sw_version[0] = SW_VERSION_N1;
287 housekeeping_packet.lfr_sw_version[1] = SW_VERSION_N2;
288 housekeeping_packet.lfr_sw_version[1] = SW_VERSION_N2;
288 housekeeping_packet.lfr_sw_version[2] = SW_VERSION_N3;
289 housekeeping_packet.lfr_sw_version[2] = SW_VERSION_N3;
289 housekeeping_packet.lfr_sw_version[3] = SW_VERSION_N4;
290 housekeeping_packet.lfr_sw_version[3] = SW_VERSION_N4;
290 // init fpga version
291 // init fpga version
291 parameters = (unsigned char *) (REGS_ADDR_WAVEFORM_PICKER + 0xd0);
292 parameters = (unsigned char *) (REGS_ADDR_WAVEFORM_PICKER + 0xd0);
292 housekeeping_packet.lfr_fpga_version[0] = parameters[1]; // n1
293 housekeeping_packet.lfr_fpga_version[0] = parameters[1]; // n1
293 housekeeping_packet.lfr_fpga_version[1] = parameters[2]; // n2
294 housekeeping_packet.lfr_fpga_version[1] = parameters[2]; // n2
294 housekeeping_packet.lfr_fpga_version[2] = parameters[3]; // n3
295 housekeeping_packet.lfr_fpga_version[2] = parameters[3]; // n3
295 }
296 }
296
297
297 void increment_seq_counter( unsigned char *packet_sequence_control)
298 void increment_seq_counter( unsigned char *packet_sequence_control)
298 {
299 {
299 /** This function increment the sequence counter psased in argument.
300 /** This function increment the sequence counter psased in argument.
300 *
301 *
301 * The increment does not affect the grouping flag. In case of an overflow, the counter is reset to 0.
302 * The increment does not affect the grouping flag. In case of an overflow, the counter is reset to 0.
302 *
303 *
303 */
304 */
304
305
305 unsigned short sequence_cnt;
306 unsigned short sequence_cnt;
306 unsigned short segmentation_grouping_flag;
307 unsigned short segmentation_grouping_flag;
307 unsigned short new_packet_sequence_control;
308 unsigned short new_packet_sequence_control;
308
309
309 segmentation_grouping_flag = (unsigned short) ( (packet_sequence_control[0] & 0xc0) << 8 ); // keep bits 7 downto 6
310 segmentation_grouping_flag = (unsigned short) ( (packet_sequence_control[0] & 0xc0) << 8 ); // keep bits 7 downto 6
310 sequence_cnt = (unsigned short) (
311 sequence_cnt = (unsigned short) (
311 ( (packet_sequence_control[0] & 0x3f) << 8 ) // keep bits 5 downto 0
312 ( (packet_sequence_control[0] & 0x3f) << 8 ) // keep bits 5 downto 0
312 + packet_sequence_control[1]
313 + packet_sequence_control[1]
313 );
314 );
314
315
315 if ( sequence_cnt < SEQ_CNT_MAX)
316 if ( sequence_cnt < SEQ_CNT_MAX)
316 {
317 {
317 sequence_cnt = sequence_cnt + 1;
318 sequence_cnt = sequence_cnt + 1;
318 }
319 }
319 else
320 else
320 {
321 {
321 sequence_cnt = 0;
322 sequence_cnt = 0;
322 }
323 }
323
324
324 new_packet_sequence_control = segmentation_grouping_flag | sequence_cnt ;
325 new_packet_sequence_control = segmentation_grouping_flag | sequence_cnt ;
325
326
326 packet_sequence_control[0] = (unsigned char) (new_packet_sequence_control >> 8);
327 packet_sequence_control[0] = (unsigned char) (new_packet_sequence_control >> 8);
327 packet_sequence_control[1] = (unsigned char) (new_packet_sequence_control );
328 packet_sequence_control[1] = (unsigned char) (new_packet_sequence_control );
328 }
329 }
329
330
330 void getTime( unsigned char *time)
331 void getTime( unsigned char *time)
331 {
332 {
332 /** This function write the current local time in the time buffer passed in argument.
333 /** This function write the current local time in the time buffer passed in argument.
333 *
334 *
334 */
335 */
335
336
336 time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
337 time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
337 time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
338 time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
338 time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
339 time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
339 time[3] = (unsigned char) (time_management_regs->coarse_time);
340 time[3] = (unsigned char) (time_management_regs->coarse_time);
340 time[4] = (unsigned char) (time_management_regs->fine_time>>8);
341 time[4] = (unsigned char) (time_management_regs->fine_time>>8);
341 time[5] = (unsigned char) (time_management_regs->fine_time);
342 time[5] = (unsigned char) (time_management_regs->fine_time);
342 }
343 }
343
344
@@ -1,679 +1,736
1 /** Functions related to data processing.
1 /** Functions related to data processing.
2 *
2 *
3 * @file
3 * @file
4 * @author P. LEROY
4 * @author P. LEROY
5 *
5 *
6 * These function are related to data processing, i.e. spectral matrices averaging and basic parameters computation.
6 * These function are related to data processing, i.e. spectral matrices averaging and basic parameters computation.
7 *
7 *
8 */
8 */
9
9
10 #include <fsw_processing.h>
10 #include <fsw_processing.h>
11
11
12 #include "fsw_processing_globals.c"
12 #include "fsw_processing_globals.c"
13
13
14 //************************
14 //************************
15 // spectral matrices rings
15 // spectral matrices rings
16 ring_node sm_ring_f0[NB_RING_NODES_ASM_F0];
16 ring_node sm_ring_f0[NB_RING_NODES_ASM_F0];
17 ring_node sm_ring_f1[NB_RING_NODES_ASM_F1];
17 ring_node sm_ring_f1[NB_RING_NODES_ASM_F1];
18 ring_node sm_ring_f2[NB_RING_NODES_ASM_F2];
18 ring_node sm_ring_f2[NB_RING_NODES_ASM_F2];
19 ring_node *current_ring_node_sm_f0;
19 ring_node *current_ring_node_sm_f0;
20 ring_node *ring_node_for_averaging_sm_f0;
20 ring_node *ring_node_for_averaging_sm_f0;
21 ring_node *current_ring_node_sm_f1;
21 ring_node *current_ring_node_sm_f1;
22 ring_node *current_ring_node_sm_f2;
22 ring_node *current_ring_node_sm_f2;
23
23
24 BP1_t data_BP1[ NB_BINS_COMPRESSED_SM_F0 ];
24 BP1_t data_BP1[ NB_BINS_COMPRESSED_SM_F0 ];
25 float averaged_sm_f0[ TOTAL_SIZE_SM ];
25 float averaged_sm_f0 [ TIME_OFFSET + TOTAL_SIZE_SM ];
26 char averaged_sm_f0_char[ TOTAL_SIZE_SM * 2 ];
26 float averaged_sm_f0_reorganized[ TIME_OFFSET + TOTAL_SIZE_SM ];
27 float compressed_sm_f0[ TOTAL_SIZE_COMPRESSED_ASM_F0 ];
27 char averaged_sm_f0_char [ TIME_OFFSET_IN_BYTES + TOTAL_SIZE_SM * 2 ];
28 float compressed_sm_f0 [ TOTAL_SIZE_COMPRESSED_ASM_F0 ];
28
29
29 unsigned int nb_sm_f0;
30 unsigned int nb_sm_f0;
30
31
31 void init_sm_rings( void )
32 void init_sm_rings( void )
32 {
33 {
33 unsigned char i;
34 unsigned char i;
34
35
35 // F0 RING
36 // F0 RING
36 sm_ring_f0[0].next = (ring_node*) &sm_ring_f0[1];
37 sm_ring_f0[0].next = (ring_node*) &sm_ring_f0[1];
37 sm_ring_f0[0].previous = (ring_node*) &sm_ring_f0[NB_RING_NODES_ASM_F0-1];
38 sm_ring_f0[0].previous = (ring_node*) &sm_ring_f0[NB_RING_NODES_ASM_F0-1];
38 sm_ring_f0[0].buffer_address = (int) &sm_f0[0][0];
39 sm_ring_f0[0].buffer_address = (int) &sm_f0[0][0];
39
40
40 sm_ring_f0[NB_RING_NODES_ASM_F0-1].next = (ring_node*) &sm_ring_f0[0];
41 sm_ring_f0[NB_RING_NODES_ASM_F0-1].next = (ring_node*) &sm_ring_f0[0];
41 sm_ring_f0[NB_RING_NODES_ASM_F0-1].previous = (ring_node*) &sm_ring_f0[NB_RING_NODES_ASM_F0-2];
42 sm_ring_f0[NB_RING_NODES_ASM_F0-1].previous = (ring_node*) &sm_ring_f0[NB_RING_NODES_ASM_F0-2];
42 sm_ring_f0[NB_RING_NODES_ASM_F0-1].buffer_address = (int) &sm_f0[NB_RING_NODES_ASM_F0-1][0];
43 sm_ring_f0[NB_RING_NODES_ASM_F0-1].buffer_address = (int) &sm_f0[NB_RING_NODES_ASM_F0-1][0];
43
44
44 for(i=1; i<NB_RING_NODES_ASM_F0-1; i++)
45 for(i=1; i<NB_RING_NODES_ASM_F0-1; i++)
45 {
46 {
46 sm_ring_f0[i].next = (ring_node*) &sm_ring_f0[i+1];
47 sm_ring_f0[i].next = (ring_node*) &sm_ring_f0[i+1];
47 sm_ring_f0[i].previous = (ring_node*) &sm_ring_f0[i-1];
48 sm_ring_f0[i].previous = (ring_node*) &sm_ring_f0[i-1];
48 sm_ring_f0[i].buffer_address = (int) &sm_f0[i][0];
49 sm_ring_f0[i].buffer_address = (int) &sm_f0[i][0];
49 }
50 }
50
51
51 DEBUG_PRINTF1("asm_ring_f0 @%x\n", (unsigned int) sm_ring_f0)
52 DEBUG_PRINTF1("asm_ring_f0 @%x\n", (unsigned int) sm_ring_f0)
52
53
53 spectral_matrix_regs->matrixF0_Address0 = sm_ring_f0[0].buffer_address;
54 spectral_matrix_regs->matrixF0_Address0 = sm_ring_f0[0].buffer_address;
54 DEBUG_PRINTF1("spectral_matrix_regs->matrixF0_Address0 @%x\n", spectral_matrix_regs->matrixF0_Address0)
55 DEBUG_PRINTF1("spectral_matrix_regs->matrixF0_Address0 @%x\n", spectral_matrix_regs->matrixF0_Address0)
55 }
56 }
56
57
57 void reset_current_sm_ring_nodes( void )
58 void reset_current_sm_ring_nodes( void )
58 {
59 {
59 current_ring_node_sm_f0 = sm_ring_f0;
60 current_ring_node_sm_f0 = sm_ring_f0;
60 ring_node_for_averaging_sm_f0 = sm_ring_f0;
61 ring_node_for_averaging_sm_f0 = sm_ring_f0;
61 }
62 }
62
63
63 //***********************************************************
64 //***********************************************************
64 // Interrupt Service Routine for spectral matrices processing
65 // Interrupt Service Routine for spectral matrices processing
65 void reset_nb_sm_f0( void )
66 void reset_nb_sm_f0( void )
66 {
67 {
67 nb_sm_f0 = 0;
68 nb_sm_f0 = 0;
68 }
69 }
69
70
70 rtems_isr spectral_matrices_isr( rtems_vector_number vector )
71 rtems_isr spectral_matrices_isr( rtems_vector_number vector )
71 {
72 {
72 // unsigned char status;
73 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_8 );
73 // unsigned char i;
74
75 if ( (spectral_matrix_regs->status & 0x1) == 0x01)
76 {
77 current_ring_node_sm_f0 = current_ring_node_sm_f0->next;
78 spectral_matrix_regs->matrixF0_Address0 = current_ring_node_sm_f0->buffer_address;
79 spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffe; // 1110
80 nb_sm_f0 = nb_sm_f0 + 1;
81 }
82 else if ( (spectral_matrix_regs->status & 0x2) == 0x02)
83 {
84 current_ring_node_sm_f0 = current_ring_node_sm_f0->next;
85 spectral_matrix_regs->matrixFO_Address1 = current_ring_node_sm_f0->buffer_address;
86 spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffd; // 1101
87 nb_sm_f0 = nb_sm_f0 + 1;
88 }
74
89
75 // status = spectral_matrix_regs->status; //[f2 f1 f0_1 f0_0]
90 if ( (spectral_matrix_regs->status & 0x30) != 0x00)
76 // for (i=0; i<4; i++)
91 {
77 // {
92 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_8 );
78 // if ( ( (status >> i) & 0x01) == 1) // (1) buffer rotation
93 spectral_matrix_regs->status = spectral_matrix_regs->status & 0xffffffcf; // 1100 1111
79 // {
94 }
80 // switch(i)
95
81 // {
96 spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffff3; // 0011
82 // case 0:
83 // current_ring_node_sm_f0 = current_ring_node_sm_f0->next;
84 // spectral_matrix_regs->matrixF0_Address0 = current_ring_node_sm_f0->buffer_address;
85 // spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffe;
86 // nb_interrupt_f0 = nb_interrupt_f0 + 1;
87 // if (nb_interrupt_f0 == NB_SM_TO_RECEIVE_BEFORE_AVF0 ){
88 // ring_node_for_averaging_sm_f0 = current_ring_node_sm_f0;
89 // if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL)
90 // {
91 // rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 );
92 // }
93 // nb_interrupt_f0 = 0;
94 // }
95 // break;
96 // case 1:
97 // break;
98 // case 2:
99 // break;
100 // default:
101 // break;
102 // }
103 // }
104 // }
105
97
106 // // reset error codes to 0
98 if (nb_sm_f0 == (NB_SM_TO_RECEIVE_BEFORE_AVF0-1) )
107 // spectral_matrix_regs->status = spectral_matrix_regs->status & 0xffffffcf; // [1100 1111]
99 {
100 ring_node_for_averaging_sm_f0 = current_ring_node_sm_f0;
101 if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL)
102 {
103 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 );
104 }
105 nb_sm_f0 = 0;
106 }
107 else
108 {
109 nb_sm_f0 = nb_sm_f0 + 1;
110 }
108 }
111 }
109
112
110 rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector )
113 rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector )
111 {
114 {
112 current_ring_node_sm_f0 = current_ring_node_sm_f0->next;
115 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_8 );
113 spectral_matrix_regs->matrixF0_Address0 = current_ring_node_sm_f0->buffer_address;
116
114 spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffe;
117 if ( (spectral_matrix_regs->status & 0x1) == 0x01)
118 {
119 current_ring_node_sm_f0 = current_ring_node_sm_f0->next;
120 spectral_matrix_regs->matrixF0_Address0 = current_ring_node_sm_f0->buffer_address;
121 spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffe; // 1110
122 nb_sm_f0 = nb_sm_f0 + 1;
123 }
124 else if ( (spectral_matrix_regs->status & 0x2) == 0x02)
125 {
126 current_ring_node_sm_f0 = current_ring_node_sm_f0->next;
127 spectral_matrix_regs->matrixFO_Address1 = current_ring_node_sm_f0->buffer_address;
128 spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffd; // 1101
129 nb_sm_f0 = nb_sm_f0 + 1;
130 }
131
132 if ( (spectral_matrix_regs->status & 0x30) != 0x00)
133 {
134 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_8 );
135 spectral_matrix_regs->status = spectral_matrix_regs->status & 0xffffffcf; // 1100 1111
136 }
137
138 spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffff3; // 0011
115
139
116 if (nb_sm_f0 == (NB_SM_TO_RECEIVE_BEFORE_AVF0-1) )
140 if (nb_sm_f0 == (NB_SM_TO_RECEIVE_BEFORE_AVF0-1) )
117 {
141 {
118 // ring_node_for_averaging_sm_f0 = current_ring_node_sm_f0;
142 ring_node_for_averaging_sm_f0 = current_ring_node_sm_f0;
119 ring_node_for_averaging_sm_f0 = &sm_ring_f0[NB_SM_TO_RECEIVE_BEFORE_AVF0-1];
120 if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL)
143 if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL)
121 {
144 {
122 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 );
145 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 );
123 }
146 }
124 nb_sm_f0 = 0;
147 nb_sm_f0 = 0;
125 }
148 }
126 else
149 else
127 {
150 {
128 nb_sm_f0 = nb_sm_f0 + 1;
151 nb_sm_f0 = nb_sm_f0 + 1;
129 }
152 }
130 }
153 }
131
154
132 //************
155 //************
133 // RTEMS TASKS
156 // RTEMS TASKS
134
157
135 rtems_task smiq_task(rtems_task_argument argument) // process the Spectral Matrices IRQ
158 rtems_task smiq_task(rtems_task_argument argument) // process the Spectral Matrices IRQ
136 {
159 {
137 rtems_event_set event_out;
160 rtems_event_set event_out;
138
161
139 BOOT_PRINTF("in SMIQ *** \n")
162 BOOT_PRINTF("in SMIQ *** \n")
140
163
141 while(1){
164 while(1){
142 rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0
165 rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0
143 }
166 }
144 }
167 }
145
168
146 rtems_task avf0_task(rtems_task_argument argument)
169 rtems_task avf0_task(rtems_task_argument argument)
147 {
170 {
148 int i;
171 int i;
149 static int nb_average;
172 static int nb_average;
150 rtems_event_set event_out;
173 rtems_event_set event_out;
151 rtems_status_code status;
174 rtems_status_code status;
152 ring_node *ring_node_tab[8];
175 ring_node *ring_node_tab[8];
153
176
154 nb_average = 0;
177 nb_average = 0;
155
178
156 BOOT_PRINTF("in AVFO *** \n")
179 BOOT_PRINTF("in AVFO *** \n")
157
180
158 while(1){
181 while(1){
159 rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0
182 rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0
160 ring_node_tab[NB_SM_TO_RECEIVE_BEFORE_AVF0-1] = ring_node_for_averaging_sm_f0;
183 ring_node_tab[NB_SM_TO_RECEIVE_BEFORE_AVF0-1] = ring_node_for_averaging_sm_f0;
161 for (i=2; i<NB_SM_TO_RECEIVE_BEFORE_AVF0+1; i++)
184 for (i=2; i<NB_SM_TO_RECEIVE_BEFORE_AVF0+1; i++)
162 {
185 {
163 ring_node_for_averaging_sm_f0 = ring_node_for_averaging_sm_f0->previous;
186 ring_node_for_averaging_sm_f0 = ring_node_for_averaging_sm_f0->previous;
164 ring_node_tab[NB_SM_TO_RECEIVE_BEFORE_AVF0-i] = ring_node_for_averaging_sm_f0;
187 ring_node_tab[NB_SM_TO_RECEIVE_BEFORE_AVF0-i] = ring_node_for_averaging_sm_f0;
165 }
188 }
166 for(i=0; i<TOTAL_SIZE_SM; i++)
189 for(i=0; i<TOTAL_SIZE_SM; i++)
167 {
190 {
168 averaged_sm_f0[i] = ( (int *) (ring_node_tab[0]->buffer_address) ) [i]
191 averaged_sm_f0[i] = ( (int *) (ring_node_tab[0]->buffer_address) ) [i + TIME_OFFSET]
169 + ( (int *) (ring_node_tab[1]->buffer_address) ) [i]
192 + ( (int *) (ring_node_tab[1]->buffer_address) ) [i + TIME_OFFSET]
170 + ( (int *) (ring_node_tab[2]->buffer_address) ) [i]
193 + ( (int *) (ring_node_tab[2]->buffer_address) ) [i + TIME_OFFSET]
171 + ( (int *) (ring_node_tab[3]->buffer_address) ) [i]
194 + ( (int *) (ring_node_tab[3]->buffer_address) ) [i + TIME_OFFSET]
172 + ( (int *) (ring_node_tab[4]->buffer_address) ) [i]
195 + ( (int *) (ring_node_tab[4]->buffer_address) ) [i + TIME_OFFSET]
173 + ( (int *) (ring_node_tab[5]->buffer_address) ) [i]
196 + ( (int *) (ring_node_tab[5]->buffer_address) ) [i + TIME_OFFSET]
174 + ( (int *) (ring_node_tab[6]->buffer_address) ) [i]
197 + ( (int *) (ring_node_tab[6]->buffer_address) ) [i + TIME_OFFSET]
175 + ( (int *) (ring_node_tab[7]->buffer_address) ) [i];
198 + ( (int *) (ring_node_tab[7]->buffer_address) ) [i + TIME_OFFSET];
176 }
199 }
200
177 nb_average = nb_average + NB_SM_TO_RECEIVE_BEFORE_AVF0;
201 nb_average = nb_average + NB_SM_TO_RECEIVE_BEFORE_AVF0;
178 if (nb_average == NB_AVERAGE_NORMAL_f0) {
202 if (nb_average == NB_AVERAGE_NORMAL_f0) {
179 nb_average = 0;
203 nb_average = 0;
180 status = rtems_event_send( Task_id[TASKID_MATR], RTEMS_EVENT_0 ); // sending an event to the task 7, BPF0
204 status = rtems_event_send( Task_id[TASKID_MATR], RTEMS_EVENT_0 ); // sending an event to the task 7, BPF0
181 if (status != RTEMS_SUCCESSFUL) {
205 if (status != RTEMS_SUCCESSFUL) {
182 printf("in AVF0 *** Error sending RTEMS_EVENT_0, code %d\n", status);
206 printf("in AVF0 *** Error sending RTEMS_EVENT_0, code %d\n", status);
183 }
207 }
184 }
208 }
185 }
209 }
186 }
210 }
187
211
188 rtems_task matr_task(rtems_task_argument argument)
212 rtems_task matr_task(rtems_task_argument argument)
189 {
213 {
190 spw_ioctl_pkt_send spw_ioctl_send_ASM;
214 spw_ioctl_pkt_send spw_ioctl_send_ASM;
191 rtems_event_set event_out;
215 rtems_event_set event_out;
192 rtems_status_code status;
216 rtems_status_code status;
193 rtems_id queue_id;
217 rtems_id queue_id;
194 Header_TM_LFR_SCIENCE_ASM_t headerASM;
218 Header_TM_LFR_SCIENCE_ASM_t headerASM;
195
219
196 init_header_asm( &headerASM );
220 init_header_asm( &headerASM );
197
221
198 status = get_message_queue_id_send( &queue_id );
222 status = get_message_queue_id_send( &queue_id );
199 if (status != RTEMS_SUCCESSFUL)
223 if (status != RTEMS_SUCCESSFUL)
200 {
224 {
201 PRINTF1("in MATR *** ERR get_message_queue_id_send %d\n", status)
225 PRINTF1("in MATR *** ERR get_message_queue_id_send %d\n", status)
202 }
226 }
203
227
204 BOOT_PRINTF("in MATR *** \n")
228 BOOT_PRINTF("in MATR *** \n")
205
229
206 fill_averaged_spectral_matrix( );
230 fill_averaged_spectral_matrix( );
207
231
208 while(1){
232 while(1){
209 rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0
233 rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0
210 // 1) compress the matrix for Basic Parameters calculation
234 // 1) compress the matrix for Basic Parameters calculation
211 compress_averaged_spectral_matrix( averaged_sm_f0, 0, compressed_sm_f0 );
235 ASM_compress( averaged_sm_f0, 0, compressed_sm_f0 );
212 // 2)
236 // 2)
213 //BP1_set(compressed_sm_f0, NB_BINS_COMPRESSED_SM_F0, LFR_BP1_F0);
237 //BP1_set(compressed_sm_f0, NB_BINS_COMPRESSED_SM_F0, LFR_BP1_F0);
214 // 3) convert the float array in a char array
238 // 3) convert the float array in a char array
215 convert_averaged_spectral_matrix( averaged_sm_f0, averaged_sm_f0_char);
239 ASM_reorganize( averaged_sm_f0, averaged_sm_f0_reorganized );
240 ASM_convert( averaged_sm_f0_reorganized, averaged_sm_f0_char);
216 // 4) send the spectral matrix packets
241 // 4) send the spectral matrix packets
217 send_averaged_spectral_matrix( &headerASM, averaged_sm_f0_char, SID_NORM_ASM_F0, &spw_ioctl_send_ASM, queue_id);
242 ASM_send( &headerASM, averaged_sm_f0_char, SID_NORM_ASM_F0, &spw_ioctl_send_ASM, queue_id);
218 }
243 }
219 }
244 }
220
245
221 //*****************************
246 //*****************************
222 // Spectral matrices processing
247 // Spectral matrices processing
223
248
224 void matrix_reset(volatile float *averaged_spec_mat)
249 void matrix_reset(volatile float *averaged_spec_mat)
225 {
250 {
226 int i;
251 int i;
227 for(i=0; i<TOTAL_SIZE_SM; i++){
252 for(i=0; i<TOTAL_SIZE_SM; i++){
228 averaged_spec_mat[i] = 0;
253 averaged_spec_mat[i] = 0;
229 }
254 }
230 }
255 }
231
256
232 void compress_averaged_spectral_matrix( float *averaged_spec_mat, unsigned char fChannel, float *compressed_spec_mat )
257 void ASM_reorganize( float *averaged_spec_mat, float *averaged_spec_mat_reorganized )
258 {
259 int frequencyBin;
260 int asmComponent;
261
262 // copy the time information
263 averaged_spec_mat_reorganized[ 0 ] = averaged_spec_mat[ 0 ];
264 averaged_spec_mat_reorganized[ 1 ] = averaged_spec_mat[ 1 ];
265
266 for (asmComponent = 0; asmComponent < NB_VALUES_PER_SM; asmComponent++)
267 {
268 for( frequencyBin = 0; frequencyBin < NB_BINS_PER_SM; frequencyBin++ )
269 {
270 averaged_spec_mat_reorganized[ frequencyBin * NB_VALUES_PER_SM + asmComponent + TIME_OFFSET ] =
271 averaged_spec_mat[ asmComponent * NB_BINS_PER_SM + frequencyBin + TIME_OFFSET];
272 }
273 }
274 }
275
276 void ASM_compress( float *averaged_spec_mat, unsigned char fChannel, float *compressed_spec_mat )
233 {
277 {
234 int frequencyBin;
278 int frequencyBin;
235 int asmComponent;
279 int asmComponent;
236 int offsetASM;
280 int offsetASM;
237 int generalOffsetASM;
238 int offsetCompressed;
281 int offsetCompressed;
239 int k;
282 int k;
240
283
241 switch (fChannel){
284 switch (fChannel){
242 case 0:
285 case 0:
243 generalOffsetASM = ASM_F0_INDICE_START * NB_VALUES_PER_SM;
286 for (asmComponent = 0; asmComponent < NB_VALUES_PER_SM; asmComponent++)
244 for( frequencyBin = 0; frequencyBin < NB_BINS_COMPRESSED_SM_F0; frequencyBin++ )
245 {
287 {
246 offsetCompressed = frequencyBin * NB_VALUES_PER_SM;
288 for( frequencyBin = 0; frequencyBin < NB_BINS_COMPRESSED_SM_F0; frequencyBin++ )
247 offsetASM = generalOffsetASM + frequencyBin * NB_BINS_TO_AVERAGE_ASM_F0 * NB_VALUES_PER_SM;
248 for (asmComponent = 0; asmComponent < NB_VALUES_PER_SM; asmComponent++)
249 {
289 {
250 compressed_spec_mat[ offsetCompressed + asmComponent ] = 0;
290 offsetASM = asmComponent * NB_BINS_PER_SM
291 + ASM_F0_INDICE_START
292 + frequencyBin * NB_BINS_TO_AVERAGE_ASM_F0;
293 offsetCompressed = frequencyBin * NB_VALUES_PER_SM
294 + asmComponent;
295 compressed_spec_mat[ offsetCompressed ] = 0;
251 for ( k = 0; k < NB_BINS_TO_AVERAGE_ASM_F0; k++ )
296 for ( k = 0; k < NB_BINS_TO_AVERAGE_ASM_F0; k++ )
252 {
297 {
253 compressed_spec_mat[ offsetCompressed + asmComponent ] =
298 compressed_spec_mat[offsetCompressed ] =
254 compressed_spec_mat[ offsetCompressed + asmComponent ]
299 compressed_spec_mat[ offsetCompressed ]
255 + averaged_spec_mat[ offsetASM + (k*NB_VALUES_PER_SM) + asmComponent ];
300 + averaged_spec_mat[ offsetASM + k ];
256 }
301 }
257 compressed_spec_mat[ offsetCompressed + asmComponent ] =
258 compressed_spec_mat[ offsetCompressed + asmComponent ] / NB_BINS_TO_AVERAGE_ASM_F0;
259 }
302 }
260 }
303 }
261 break;
304 break;
262
305
263 case 1:
306 case 1:
264 // case fChannel = f1 to be completed later
307 // case fChannel = f1 to be completed later
265 break;
308 break;
266
309
267 case 2:
310 case 2:
268 // case fChannel = f1 to be completed later
311 // case fChannel = f1 to be completed later
269 break;
312 break;
270
313
271 default:
314 default:
272 break;
315 break;
273 }
316 }
274 }
317 }
275
318
276 void convert_averaged_spectral_matrix( volatile float *input_matrix, char *output_matrix)
319 void ASM_convert( volatile float *input_matrix, char *output_matrix)
277 {
320 {
278 unsigned int i;
321 unsigned int i;
279 unsigned int j;
322 unsigned int frequencyBin;
323 unsigned int asmComponent;
280 char * pt_char_input;
324 char * pt_char_input;
281 char * pt_char_output;
325 char * pt_char_output;
282
326
283 pt_char_input = NULL;
327 pt_char_input = (char*) &input_matrix;
284 pt_char_output = NULL;
328 pt_char_output = (char*) &output_matrix;
285
329
286 for( i=0; i<NB_BINS_PER_SM; i++)
330 // copy the time information
331 for (i=0; i<TIME_OFFSET_IN_BYTES; i++)
287 {
332 {
288 for ( j=0; j<NB_VALUES_PER_SM; j++)
333 pt_char_output[ i ] = pt_char_output[ i ];
334 }
335
336 // convert all other data
337 for( frequencyBin=0; frequencyBin<NB_BINS_PER_SM; frequencyBin++)
338 {
339 for ( asmComponent=0; asmComponent<NB_VALUES_PER_SM; asmComponent++)
289 {
340 {
290 pt_char_input = (char*) &input_matrix [ (i*NB_VALUES_PER_SM) + j ];
341 pt_char_input = (char*) &input_matrix [ (frequencyBin*NB_VALUES_PER_SM) + asmComponent + TIME_OFFSET ];
291 pt_char_output = (char*) &output_matrix[ 2 * ( (i*NB_VALUES_PER_SM) + j ) ];
342 pt_char_output = (char*) &output_matrix[ 2 * ( (frequencyBin*NB_VALUES_PER_SM) + asmComponent ) + TIME_OFFSET_IN_BYTES ];
292 pt_char_output[0] = pt_char_input[0]; // bits 31 downto 24 of the float
343 pt_char_output[0] = pt_char_input[0]; // bits 31 downto 24 of the float
293 pt_char_output[1] = pt_char_input[1]; // bits 23 downto 16 of the float
344 pt_char_output[1] = pt_char_input[1]; // bits 23 downto 16 of the float
294 }
345 }
295 }
346 }
296 }
347 }
297
348
298 void send_averaged_spectral_matrix(Header_TM_LFR_SCIENCE_ASM_t *header, char *spectral_matrix,
349 void ASM_send(Header_TM_LFR_SCIENCE_ASM_t *header, char *spectral_matrix,
299 unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send, rtems_id queue_id)
350 unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send, rtems_id queue_id)
300 {
351 {
301 unsigned int i;
352 unsigned int i;
302 unsigned int length = 0;
353 unsigned int length = 0;
303 rtems_status_code status;
354 rtems_status_code status;
304
355
305 for (i=0; i<2; i++)
356 for (i=0; i<2; i++)
306 {
357 {
307 // (1) BUILD THE DATA
358 // (1) BUILD THE DATA
308 switch(sid)
359 switch(sid)
309 {
360 {
310 case SID_NORM_ASM_F0:
361 case SID_NORM_ASM_F0:
311 spw_ioctl_send->dlen = TOTAL_SIZE_ASM_F0_IN_BYTES / 2;
362 spw_ioctl_send->dlen = TOTAL_SIZE_ASM_F0_IN_BYTES / 2;
312 spw_ioctl_send->data = &spectral_matrix[ ( (ASM_F0_INDICE_START+ (i*NB_BINS_PER_PKT_ASM_F0)) * NB_VALUES_PER_SM) * 2 ];
363 spw_ioctl_send->data = &spectral_matrix[
364 ( (ASM_F0_INDICE_START + (i*NB_BINS_PER_PKT_ASM_F0) ) * NB_VALUES_PER_SM ) * 2
365 + TIME_OFFSET_IN_BYTES
366 ];
313 length = PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F0;
367 length = PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F0;
314 header->pa_lfr_asm_blk_nr[0] = (unsigned char) ( (NB_BINS_PER_PKT_ASM_F0) >> 8 ); // BLK_NR MSB
368 header->pa_lfr_asm_blk_nr[0] = (unsigned char) ( (NB_BINS_PER_PKT_ASM_F0) >> 8 ); // BLK_NR MSB
315 header->pa_lfr_asm_blk_nr[1] = (unsigned char) (NB_BINS_PER_PKT_ASM_F0); // BLK_NR LSB
369 header->pa_lfr_asm_blk_nr[1] = (unsigned char) (NB_BINS_PER_PKT_ASM_F0); // BLK_NR LSB
316 break;
370 break;
317 case SID_NORM_ASM_F1:
371 case SID_NORM_ASM_F1:
318 break;
372 break;
319 case SID_NORM_ASM_F2:
373 case SID_NORM_ASM_F2:
320 break;
374 break;
321 default:
375 default:
322 PRINTF1("ERR *** in send_averaged_spectral_matrix *** unexpected sid %d\n", sid)
376 PRINTF1("ERR *** in ASM_send *** unexpected sid %d\n", sid)
323 break;
377 break;
324 }
378 }
325 spw_ioctl_send->hlen = HEADER_LENGTH_TM_LFR_SCIENCE_ASM + CCSDS_PROTOCOLE_EXTRA_BYTES;
379 spw_ioctl_send->hlen = HEADER_LENGTH_TM_LFR_SCIENCE_ASM + CCSDS_PROTOCOLE_EXTRA_BYTES;
326 spw_ioctl_send->hdr = (char *) header;
380 spw_ioctl_send->hdr = (char *) header;
327 spw_ioctl_send->options = 0;
381 spw_ioctl_send->options = 0;
328
382
329 // (2) BUILD THE HEADER
383 // (2) BUILD THE HEADER
330 header->packetLength[0] = (unsigned char) (length>>8);
384 header->packetLength[0] = (unsigned char) (length>>8);
331 header->packetLength[1] = (unsigned char) (length);
385 header->packetLength[1] = (unsigned char) (length);
332 header->sid = (unsigned char) sid; // SID
386 header->sid = (unsigned char) sid; // SID
333 header->pa_lfr_pkt_cnt_asm = 2;
387 header->pa_lfr_pkt_cnt_asm = 2;
334 header->pa_lfr_pkt_nr_asm = (unsigned char) (i+1);
388 header->pa_lfr_pkt_nr_asm = (unsigned char) (i+1);
335
389
336 // (3) SET PACKET TIME
390 // (3) SET PACKET TIME
337 header->time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
391 header->time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
338 header->time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
392 header->time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
339 header->time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
393 header->time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
340 header->time[3] = (unsigned char) (time_management_regs->coarse_time);
394 header->time[3] = (unsigned char) (time_management_regs->coarse_time);
341 header->time[4] = (unsigned char) (time_management_regs->fine_time>>8);
395 header->time[4] = (unsigned char) (time_management_regs->fine_time>>8);
342 header->time[5] = (unsigned char) (time_management_regs->fine_time);
396 header->time[5] = (unsigned char) (time_management_regs->fine_time);
343 //
397 //
344 header->acquisitionTime[0] = (unsigned char) (time_management_regs->coarse_time>>24);
398 header->acquisitionTime[0] = (unsigned char) (time_management_regs->coarse_time>>24);
345 header->acquisitionTime[1] = (unsigned char) (time_management_regs->coarse_time>>16);
399 header->acquisitionTime[1] = (unsigned char) (time_management_regs->coarse_time>>16);
346 header->acquisitionTime[2] = (unsigned char) (time_management_regs->coarse_time>>8);
400 header->acquisitionTime[2] = (unsigned char) (time_management_regs->coarse_time>>8);
347 header->acquisitionTime[3] = (unsigned char) (time_management_regs->coarse_time);
401 header->acquisitionTime[3] = (unsigned char) (time_management_regs->coarse_time);
348 header->acquisitionTime[4] = (unsigned char) (time_management_regs->fine_time>>8);
402 header->acquisitionTime[4] = (unsigned char) (time_management_regs->fine_time>>8);
349 header->acquisitionTime[5] = (unsigned char) (time_management_regs->fine_time);
403 header->acquisitionTime[5] = (unsigned char) (time_management_regs->fine_time);
350
404
351 // (4) SEND PACKET
405 // (4) SEND PACKET
352 status = rtems_message_queue_send( queue_id, spw_ioctl_send, ACTION_MSG_SPW_IOCTL_SEND_SIZE);
406 status = rtems_message_queue_send( queue_id, spw_ioctl_send, ACTION_MSG_SPW_IOCTL_SEND_SIZE);
353 if (status != RTEMS_SUCCESSFUL) {
407 if (status != RTEMS_SUCCESSFUL) {
354 printf("in send_averaged_spectral_matrix *** ERR %d\n", (int) status);
408 printf("in ASM_send *** ERR %d\n", (int) status);
355 }
409 }
356 }
410 }
357 }
411 }
358
412
359 void BP1_set_old(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat, unsigned char * LFR_BP1){
413 void BP1_set_old(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat, unsigned char * LFR_BP1){
360 int i;
414 int i;
361 int j;
415 int j;
362 unsigned char tmp_u_char;
416 unsigned char tmp_u_char;
363 unsigned char * pt_char = NULL;
417 unsigned char * pt_char = NULL;
364 float PSDB, PSDE;
418 float PSDB, PSDE;
365 float NVEC_V0;
419 float NVEC_V0;
366 float NVEC_V1;
420 float NVEC_V1;
367 float NVEC_V2;
421 float NVEC_V2;
368 //float significand;
422 //float significand;
369 //int exponent;
423 //int exponent;
370 float aux;
424 float aux;
371 float tr_SB_SB;
425 float tr_SB_SB;
372 float tmp;
426 float tmp;
373 float sx_re;
427 float sx_re;
374 float sx_im;
428 float sx_im;
375 float nebx_re = 0;
429 float nebx_re = 0;
376 float nebx_im = 0;
430 float nebx_im = 0;
377 float ny = 0;
431 float ny = 0;
378 float nz = 0;
432 float nz = 0;
379 float bx_bx_star = 0;
433 float bx_bx_star = 0;
380 for(i=0; i<nb_bins_compressed_spec_mat; i++){
434 for(i=0; i<nb_bins_compressed_spec_mat; i++){
381 //==============================================
435 //==============================================
382 // BP1 PSD == B PAR_LFR_SC_BP1_PE_FL0 == 16 bits
436 // BP1 PSD == B PAR_LFR_SC_BP1_PE_FL0 == 16 bits
383 PSDB = compressed_spec_mat[i*30] // S11
437 PSDB = compressed_spec_mat[i*30] // S11
384 + compressed_spec_mat[(i*30) + 10] // S22
438 + compressed_spec_mat[(i*30) + 10] // S22
385 + compressed_spec_mat[(i*30) + 18]; // S33
439 + compressed_spec_mat[(i*30) + 18]; // S33
386 //significand = frexp(PSDB, &exponent);
440 //significand = frexp(PSDB, &exponent);
387 pt_char = (unsigned char*) &PSDB;
441 pt_char = (unsigned char*) &PSDB;
388 LFR_BP1[(i*9) + 2] = pt_char[0]; // bits 31 downto 24 of the float
442 LFR_BP1[(i*9) + 2] = pt_char[0]; // bits 31 downto 24 of the float
389 LFR_BP1[(i*9) + 3] = pt_char[1]; // bits 23 downto 16 of the float
443 LFR_BP1[(i*9) + 3] = pt_char[1]; // bits 23 downto 16 of the float
390 //==============================================
444 //==============================================
391 // BP1 PSD == E PAR_LFR_SC_BP1_PB_FL0 == 16 bits
445 // BP1 PSD == E PAR_LFR_SC_BP1_PB_FL0 == 16 bits
392 PSDE = compressed_spec_mat[(i*30) + 24] * K44_pe // S44
446 PSDE = compressed_spec_mat[(i*30) + 24] * K44_pe // S44
393 + compressed_spec_mat[(i*30) + 28] * K55_pe // S55
447 + compressed_spec_mat[(i*30) + 28] * K55_pe // S55
394 + compressed_spec_mat[(i*30) + 26] * K45_pe_re // S45
448 + compressed_spec_mat[(i*30) + 26] * K45_pe_re // S45
395 - compressed_spec_mat[(i*30) + 27] * K45_pe_im; // S45
449 - compressed_spec_mat[(i*30) + 27] * K45_pe_im; // S45
396 pt_char = (unsigned char*) &PSDE;
450 pt_char = (unsigned char*) &PSDE;
397 LFR_BP1[(i*9) + 0] = pt_char[0]; // bits 31 downto 24 of the float
451 LFR_BP1[(i*9) + 0] = pt_char[0]; // bits 31 downto 24 of the float
398 LFR_BP1[(i*9) + 1] = pt_char[1]; // bits 23 downto 16 of the float
452 LFR_BP1[(i*9) + 1] = pt_char[1]; // bits 23 downto 16 of the float
399 //==============================================================================
453 //==============================================================================
400 // BP1 normal wave vector == PAR_LFR_SC_BP1_NVEC_V0_F0 == 8 bits
454 // BP1 normal wave vector == PAR_LFR_SC_BP1_NVEC_V0_F0 == 8 bits
401 // == PAR_LFR_SC_BP1_NVEC_V1_F0 == 8 bits
455 // == PAR_LFR_SC_BP1_NVEC_V1_F0 == 8 bits
402 // == PAR_LFR_SC_BP1_NVEC_V2_F0 == 1 bits
456 // == PAR_LFR_SC_BP1_NVEC_V2_F0 == 1 bits
403 tmp = sqrt(
457 tmp = sqrt(
404 compressed_spec_mat[(i*30) + 3]*compressed_spec_mat[(i*30) + 3] //Im S12
458 compressed_spec_mat[(i*30) + 3]*compressed_spec_mat[(i*30) + 3] //Im S12
405 +compressed_spec_mat[(i*30) + 5]*compressed_spec_mat[(i*30) + 5] //Im S13
459 +compressed_spec_mat[(i*30) + 5]*compressed_spec_mat[(i*30) + 5] //Im S13
406 +compressed_spec_mat[(i*30) + 13]*compressed_spec_mat[(i*30) + 13] //Im S23
460 +compressed_spec_mat[(i*30) + 13]*compressed_spec_mat[(i*30) + 13] //Im S23
407 );
461 );
408 NVEC_V0 = compressed_spec_mat[(i*30) + 13] / tmp; // Im S23
462 NVEC_V0 = compressed_spec_mat[(i*30) + 13] / tmp; // Im S23
409 NVEC_V1 = -compressed_spec_mat[(i*30) + 5] / tmp; // Im S13
463 NVEC_V1 = -compressed_spec_mat[(i*30) + 5] / tmp; // Im S13
410 NVEC_V2 = compressed_spec_mat[(i*30) + 3] / tmp; // Im S12
464 NVEC_V2 = compressed_spec_mat[(i*30) + 3] / tmp; // Im S12
411 LFR_BP1[(i*9) + 4] = (char) (NVEC_V0*127);
465 LFR_BP1[(i*9) + 4] = (char) (NVEC_V0*127);
412 LFR_BP1[(i*9) + 5] = (char) (NVEC_V1*127);
466 LFR_BP1[(i*9) + 5] = (char) (NVEC_V1*127);
413 pt_char = (unsigned char*) &NVEC_V2;
467 pt_char = (unsigned char*) &NVEC_V2;
414 LFR_BP1[(i*9) + 6] = pt_char[0] & 0x80; // extract the sign of NVEC_V2
468 LFR_BP1[(i*9) + 6] = pt_char[0] & 0x80; // extract the sign of NVEC_V2
415 //=======================================================
469 //=======================================================
416 // BP1 ellipticity == PAR_LFR_SC_BP1_ELLIP_F0 == 4 bits
470 // BP1 ellipticity == PAR_LFR_SC_BP1_ELLIP_F0 == 4 bits
417 aux = 2*tmp / PSDB; // compute the ellipticity
471 aux = 2*tmp / PSDB; // compute the ellipticity
418 tmp_u_char = (unsigned char) (aux*(16-1)); // convert the ellipticity
472 tmp_u_char = (unsigned char) (aux*(16-1)); // convert the ellipticity
419 LFR_BP1[i*9+6] = LFR_BP1[i*9+6] | ((tmp_u_char&0x0f)<<3); // keeps 4 bits of the resulting unsigned char
473 LFR_BP1[i*9+6] = LFR_BP1[i*9+6] | ((tmp_u_char&0x0f)<<3); // keeps 4 bits of the resulting unsigned char
420 //==============================================================
474 //==============================================================
421 // BP1 degree of polarization == PAR_LFR_SC_BP1_DOP_F0 == 3 bits
475 // BP1 degree of polarization == PAR_LFR_SC_BP1_DOP_F0 == 3 bits
422 for(j = 0; j<NB_VALUES_PER_SM;j++){
476 for(j = 0; j<NB_VALUES_PER_SM;j++){
423 tr_SB_SB = compressed_spec_mat[i*30] * compressed_spec_mat[i*30]
477 tr_SB_SB = compressed_spec_mat[i*30] * compressed_spec_mat[i*30]
424 + compressed_spec_mat[(i*30) + 10] * compressed_spec_mat[(i*30) + 10]
478 + compressed_spec_mat[(i*30) + 10] * compressed_spec_mat[(i*30) + 10]
425 + compressed_spec_mat[(i*30) + 18] * compressed_spec_mat[(i*30) + 18]
479 + compressed_spec_mat[(i*30) + 18] * compressed_spec_mat[(i*30) + 18]
426 + 2 * compressed_spec_mat[(i*30) + 2] * compressed_spec_mat[(i*30) + 2]
480 + 2 * compressed_spec_mat[(i*30) + 2] * compressed_spec_mat[(i*30) + 2]
427 + 2 * compressed_spec_mat[(i*30) + 3] * compressed_spec_mat[(i*30) + 3]
481 + 2 * compressed_spec_mat[(i*30) + 3] * compressed_spec_mat[(i*30) + 3]
428 + 2 * compressed_spec_mat[(i*30) + 4] * compressed_spec_mat[(i*30) + 4]
482 + 2 * compressed_spec_mat[(i*30) + 4] * compressed_spec_mat[(i*30) + 4]
429 + 2 * compressed_spec_mat[(i*30) + 5] * compressed_spec_mat[(i*30) + 5]
483 + 2 * compressed_spec_mat[(i*30) + 5] * compressed_spec_mat[(i*30) + 5]
430 + 2 * compressed_spec_mat[(i*30) + 12] * compressed_spec_mat[(i*30) + 12]
484 + 2 * compressed_spec_mat[(i*30) + 12] * compressed_spec_mat[(i*30) + 12]
431 + 2 * compressed_spec_mat[(i*30) + 13] * compressed_spec_mat[(i*30) + 13];
485 + 2 * compressed_spec_mat[(i*30) + 13] * compressed_spec_mat[(i*30) + 13];
432 }
486 }
433 aux = PSDB*PSDB;
487 aux = PSDB*PSDB;
434 tmp = sqrt( abs( ( 3*tr_SB_SB - aux ) / ( 2 * aux ) ) );
488 tmp = sqrt( abs( ( 3*tr_SB_SB - aux ) / ( 2 * aux ) ) );
435 tmp_u_char = (unsigned char) (NVEC_V0*(8-1));
489 tmp_u_char = (unsigned char) (NVEC_V0*(8-1));
436 LFR_BP1[(i*9) + 6] = LFR_BP1[(i*9) + 6] | (tmp_u_char & 0x07); // keeps 3 bits of the resulting unsigned char
490 LFR_BP1[(i*9) + 6] = LFR_BP1[(i*9) + 6] | (tmp_u_char & 0x07); // keeps 3 bits of the resulting unsigned char
437 //=======================================================================================
491 //=======================================================================================
438 // BP1 x-component of the normalized Poynting flux == PAR_LFR_SC_BP1_SZ_F0 == 8 bits (7+1)
492 // BP1 x-component of the normalized Poynting flux == PAR_LFR_SC_BP1_SZ_F0 == 8 bits (7+1)
439 sx_re = compressed_spec_mat[(i*30) + 20] * K34_sx_re
493 sx_re = compressed_spec_mat[(i*30) + 20] * K34_sx_re
440 + compressed_spec_mat[(i*30) + 6] * K14_sx_re
494 + compressed_spec_mat[(i*30) + 6] * K14_sx_re
441 + compressed_spec_mat[(i*30) + 8] * K15_sx_re
495 + compressed_spec_mat[(i*30) + 8] * K15_sx_re
442 + compressed_spec_mat[(i*30) + 14] * K24_sx_re
496 + compressed_spec_mat[(i*30) + 14] * K24_sx_re
443 + compressed_spec_mat[(i*30) + 16] * K25_sx_re
497 + compressed_spec_mat[(i*30) + 16] * K25_sx_re
444 + compressed_spec_mat[(i*30) + 22] * K35_sx_re;
498 + compressed_spec_mat[(i*30) + 22] * K35_sx_re;
445 sx_im = compressed_spec_mat[(i*30) + 21] * K34_sx_im
499 sx_im = compressed_spec_mat[(i*30) + 21] * K34_sx_im
446 + compressed_spec_mat[(i*30) + 7] * K14_sx_im
500 + compressed_spec_mat[(i*30) + 7] * K14_sx_im
447 + compressed_spec_mat[(i*30) + 9] * K15_sx_im
501 + compressed_spec_mat[(i*30) + 9] * K15_sx_im
448 + compressed_spec_mat[(i*30) + 15] * K24_sx_im
502 + compressed_spec_mat[(i*30) + 15] * K24_sx_im
449 + compressed_spec_mat[(i*30) + 17] * K25_sx_im
503 + compressed_spec_mat[(i*30) + 17] * K25_sx_im
450 + compressed_spec_mat[(i*30) + 23] * K35_sx_im;
504 + compressed_spec_mat[(i*30) + 23] * K35_sx_im;
451 LFR_BP1[(i*9) + 7] = ((unsigned char) (sx_re * 128)) & 0x7f; // cf DOC for the compression
505 LFR_BP1[(i*9) + 7] = ((unsigned char) (sx_re * 128)) & 0x7f; // cf DOC for the compression
452 if ( abs(sx_re) > abs(sx_im) ) {
506 if ( abs(sx_re) > abs(sx_im) ) {
453 LFR_BP1[(i*9) + 7] = LFR_BP1[(i*9) + 1] | (0x80); // extract the sector of sx
507 LFR_BP1[(i*9) + 7] = LFR_BP1[(i*9) + 1] | (0x80); // extract the sector of sx
454 }
508 }
455 else {
509 else {
456 LFR_BP1[(i*9) + 7] = LFR_BP1[(i*9) + 1] & (0x7f); // extract the sector of sx
510 LFR_BP1[(i*9) + 7] = LFR_BP1[(i*9) + 1] & (0x7f); // extract the sector of sx
457 }
511 }
458 //======================================================================
512 //======================================================================
459 // BP1 phase velocity estimator == PAR_LFR_SC_BP1_VPHI_F0 == 8 bits (7+1)
513 // BP1 phase velocity estimator == PAR_LFR_SC_BP1_VPHI_F0 == 8 bits (7+1)
460 ny = sin(Alpha_M)*NVEC_V1 + cos(Alpha_M)*NVEC_V2;
514 ny = sin(Alpha_M)*NVEC_V1 + cos(Alpha_M)*NVEC_V2;
461 nz = NVEC_V0;
515 nz = NVEC_V0;
462 bx_bx_star = cos(Alpha_M) * cos(Alpha_M) * compressed_spec_mat[i*30+10] // re S22
516 bx_bx_star = cos(Alpha_M) * cos(Alpha_M) * compressed_spec_mat[i*30+10] // re S22
463 + sin(Alpha_M) * sin(Alpha_M) * compressed_spec_mat[i*30+18] // re S33
517 + sin(Alpha_M) * sin(Alpha_M) * compressed_spec_mat[i*30+18] // re S33
464 - 2 * sin(Alpha_M) * cos(Alpha_M) * compressed_spec_mat[i*30+12]; // re S23
518 - 2 * sin(Alpha_M) * cos(Alpha_M) * compressed_spec_mat[i*30+12]; // re S23
465 nebx_re = ny * (compressed_spec_mat[(i*30) + 14] * K24_ny_re
519 nebx_re = ny * (compressed_spec_mat[(i*30) + 14] * K24_ny_re
466 +compressed_spec_mat[(i*30) + 16] * K25_ny_re
520 +compressed_spec_mat[(i*30) + 16] * K25_ny_re
467 +compressed_spec_mat[(i*30) + 20] * K34_ny_re
521 +compressed_spec_mat[(i*30) + 20] * K34_ny_re
468 +compressed_spec_mat[(i*30) + 22] * K35_ny_re)
522 +compressed_spec_mat[(i*30) + 22] * K35_ny_re)
469 + nz * (compressed_spec_mat[(i*30) + 14] * K24_nz_re
523 + nz * (compressed_spec_mat[(i*30) + 14] * K24_nz_re
470 +compressed_spec_mat[(i*30) + 16] * K25_nz_re
524 +compressed_spec_mat[(i*30) + 16] * K25_nz_re
471 +compressed_spec_mat[(i*30) + 20] * K34_nz_re
525 +compressed_spec_mat[(i*30) + 20] * K34_nz_re
472 +compressed_spec_mat[(i*30) + 22] * K35_nz_re);
526 +compressed_spec_mat[(i*30) + 22] * K35_nz_re);
473 nebx_im = ny * (compressed_spec_mat[(i*30) + 15]*K24_ny_re
527 nebx_im = ny * (compressed_spec_mat[(i*30) + 15]*K24_ny_re
474 +compressed_spec_mat[(i*30) + 17] * K25_ny_re
528 +compressed_spec_mat[(i*30) + 17] * K25_ny_re
475 +compressed_spec_mat[(i*30) + 21] * K34_ny_re
529 +compressed_spec_mat[(i*30) + 21] * K34_ny_re
476 +compressed_spec_mat[(i*30) + 23] * K35_ny_re)
530 +compressed_spec_mat[(i*30) + 23] * K35_ny_re)
477 + nz * (compressed_spec_mat[(i*30) + 15] * K24_nz_im
531 + nz * (compressed_spec_mat[(i*30) + 15] * K24_nz_im
478 +compressed_spec_mat[(i*30) + 17] * K25_nz_im
532 +compressed_spec_mat[(i*30) + 17] * K25_nz_im
479 +compressed_spec_mat[(i*30) + 21] * K34_nz_im
533 +compressed_spec_mat[(i*30) + 21] * K34_nz_im
480 +compressed_spec_mat[(i*30) + 23] * K35_nz_im);
534 +compressed_spec_mat[(i*30) + 23] * K35_nz_im);
481 tmp = nebx_re / bx_bx_star;
535 tmp = nebx_re / bx_bx_star;
482 LFR_BP1[(i*9) + 8] = ((unsigned char) (tmp * 128)) & 0x7f; // cf DOC for the compression
536 LFR_BP1[(i*9) + 8] = ((unsigned char) (tmp * 128)) & 0x7f; // cf DOC for the compression
483 if ( abs(nebx_re) > abs(nebx_im) ) {
537 if ( abs(nebx_re) > abs(nebx_im) ) {
484 LFR_BP1[(i*9) + 8] = LFR_BP1[(i*9) + 8] | (0x80); // extract the sector of nebx
538 LFR_BP1[(i*9) + 8] = LFR_BP1[(i*9) + 8] | (0x80); // extract the sector of nebx
485 }
539 }
486 else {
540 else {
487 LFR_BP1[(i*9) + 8] = LFR_BP1[(i*9) + 8] & (0x7f); // extract the sector of nebx
541 LFR_BP1[(i*9) + 8] = LFR_BP1[(i*9) + 8] & (0x7f); // extract the sector of nebx
488 }
542 }
489 }
543 }
490
544
491 }
545 }
492
546
493 void BP2_set_old(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat){
547 void BP2_set_old(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat){
494 // BP2 autocorrelation
548 // BP2 autocorrelation
495 int i;
549 int i;
496 int aux = 0;
550 int aux = 0;
497
551
498 for(i = 0; i<nb_bins_compressed_spec_mat; i++){
552 for(i = 0; i<nb_bins_compressed_spec_mat; i++){
499 // S12
553 // S12
500 aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) + 10]);
554 aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) + 10]);
501 compressed_spec_mat[(i*30) + 2] = compressed_spec_mat[(i*30) + 2] / aux;
555 compressed_spec_mat[(i*30) + 2] = compressed_spec_mat[(i*30) + 2] / aux;
502 compressed_spec_mat[(i*30) + 3] = compressed_spec_mat[(i*30) + 3] / aux;
556 compressed_spec_mat[(i*30) + 3] = compressed_spec_mat[(i*30) + 3] / aux;
503 // S13
557 // S13
504 aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) + 18]);
558 aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) + 18]);
505 compressed_spec_mat[(i*30) + 4] = compressed_spec_mat[(i*30) + 4] / aux;
559 compressed_spec_mat[(i*30) + 4] = compressed_spec_mat[(i*30) + 4] / aux;
506 compressed_spec_mat[(i*30) + 5] = compressed_spec_mat[(i*30) + 5] / aux;
560 compressed_spec_mat[(i*30) + 5] = compressed_spec_mat[(i*30) + 5] / aux;
507 // S23
561 // S23
508 aux = sqrt(compressed_spec_mat[i*30+12]*compressed_spec_mat[(i*30) + 18]);
562 aux = sqrt(compressed_spec_mat[i*30+12]*compressed_spec_mat[(i*30) + 18]);
509 compressed_spec_mat[(i*30) + 12] = compressed_spec_mat[(i*30) + 12] / aux;
563 compressed_spec_mat[(i*30) + 12] = compressed_spec_mat[(i*30) + 12] / aux;
510 compressed_spec_mat[(i*30) + 13] = compressed_spec_mat[(i*30) + 13] / aux;
564 compressed_spec_mat[(i*30) + 13] = compressed_spec_mat[(i*30) + 13] / aux;
511 // S45
565 // S45
512 aux = sqrt(compressed_spec_mat[i*30+24]*compressed_spec_mat[(i*30) + 28]);
566 aux = sqrt(compressed_spec_mat[i*30+24]*compressed_spec_mat[(i*30) + 28]);
513 compressed_spec_mat[(i*30) + 26] = compressed_spec_mat[(i*30) + 26] / aux;
567 compressed_spec_mat[(i*30) + 26] = compressed_spec_mat[(i*30) + 26] / aux;
514 compressed_spec_mat[(i*30) + 27] = compressed_spec_mat[(i*30) + 27] / aux;
568 compressed_spec_mat[(i*30) + 27] = compressed_spec_mat[(i*30) + 27] / aux;
515 // S14
569 // S14
516 aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) +24]);
570 aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) +24]);
517 compressed_spec_mat[(i*30) + 6] = compressed_spec_mat[(i*30) + 6] / aux;
571 compressed_spec_mat[(i*30) + 6] = compressed_spec_mat[(i*30) + 6] / aux;
518 compressed_spec_mat[(i*30) + 7] = compressed_spec_mat[(i*30) + 7] / aux;
572 compressed_spec_mat[(i*30) + 7] = compressed_spec_mat[(i*30) + 7] / aux;
519 // S15
573 // S15
520 aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) + 28]);
574 aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) + 28]);
521 compressed_spec_mat[(i*30) + 8] = compressed_spec_mat[(i*30) + 8] / aux;
575 compressed_spec_mat[(i*30) + 8] = compressed_spec_mat[(i*30) + 8] / aux;
522 compressed_spec_mat[(i*30) + 9] = compressed_spec_mat[(i*30) + 9] / aux;
576 compressed_spec_mat[(i*30) + 9] = compressed_spec_mat[(i*30) + 9] / aux;
523 // S24
577 // S24
524 aux = sqrt(compressed_spec_mat[i*10]*compressed_spec_mat[(i*30) + 24]);
578 aux = sqrt(compressed_spec_mat[i*10]*compressed_spec_mat[(i*30) + 24]);
525 compressed_spec_mat[(i*30) + 14] = compressed_spec_mat[(i*30) + 14] / aux;
579 compressed_spec_mat[(i*30) + 14] = compressed_spec_mat[(i*30) + 14] / aux;
526 compressed_spec_mat[(i*30) + 15] = compressed_spec_mat[(i*30) + 15] / aux;
580 compressed_spec_mat[(i*30) + 15] = compressed_spec_mat[(i*30) + 15] / aux;
527 // S25
581 // S25
528 aux = sqrt(compressed_spec_mat[i*10]*compressed_spec_mat[(i*30) + 28]);
582 aux = sqrt(compressed_spec_mat[i*10]*compressed_spec_mat[(i*30) + 28]);
529 compressed_spec_mat[(i*30) + 16] = compressed_spec_mat[(i*30) + 16] / aux;
583 compressed_spec_mat[(i*30) + 16] = compressed_spec_mat[(i*30) + 16] / aux;
530 compressed_spec_mat[(i*30) + 17] = compressed_spec_mat[(i*30) + 17] / aux;
584 compressed_spec_mat[(i*30) + 17] = compressed_spec_mat[(i*30) + 17] / aux;
531 // S34
585 // S34
532 aux = sqrt(compressed_spec_mat[i*18]*compressed_spec_mat[(i*30) + 24]);
586 aux = sqrt(compressed_spec_mat[i*18]*compressed_spec_mat[(i*30) + 24]);
533 compressed_spec_mat[(i*30) + 20] = compressed_spec_mat[(i*30) + 20] / aux;
587 compressed_spec_mat[(i*30) + 20] = compressed_spec_mat[(i*30) + 20] / aux;
534 compressed_spec_mat[(i*30) + 21] = compressed_spec_mat[(i*30) + 21] / aux;
588 compressed_spec_mat[(i*30) + 21] = compressed_spec_mat[(i*30) + 21] / aux;
535 // S35
589 // S35
536 aux = sqrt(compressed_spec_mat[i*18]*compressed_spec_mat[(i*30) + 28]);
590 aux = sqrt(compressed_spec_mat[i*18]*compressed_spec_mat[(i*30) + 28]);
537 compressed_spec_mat[(i*30) + 22] = compressed_spec_mat[(i*30) + 22] / aux;
591 compressed_spec_mat[(i*30) + 22] = compressed_spec_mat[(i*30) + 22] / aux;
538 compressed_spec_mat[(i*30) + 23] = compressed_spec_mat[(i*30) + 23] / aux;
592 compressed_spec_mat[(i*30) + 23] = compressed_spec_mat[(i*30) + 23] / aux;
539 }
593 }
540 }
594 }
541
595
542 void init_header_asm( Header_TM_LFR_SCIENCE_ASM_t *header)
596 void init_header_asm( Header_TM_LFR_SCIENCE_ASM_t *header)
543 {
597 {
544 header->targetLogicalAddress = CCSDS_DESTINATION_ID;
598 header->targetLogicalAddress = CCSDS_DESTINATION_ID;
545 header->protocolIdentifier = CCSDS_PROTOCOLE_ID;
599 header->protocolIdentifier = CCSDS_PROTOCOLE_ID;
546 header->reserved = 0x00;
600 header->reserved = 0x00;
547 header->userApplication = CCSDS_USER_APP;
601 header->userApplication = CCSDS_USER_APP;
548 header->packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8);
602 header->packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8);
549 header->packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST);
603 header->packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST);
550 header->packetSequenceControl[0] = 0xc0;
604 header->packetSequenceControl[0] = 0xc0;
551 header->packetSequenceControl[1] = 0x00;
605 header->packetSequenceControl[1] = 0x00;
552 header->packetLength[0] = 0x00;
606 header->packetLength[0] = 0x00;
553 header->packetLength[1] = 0x00;
607 header->packetLength[1] = 0x00;
554 // DATA FIELD HEADER
608 // DATA FIELD HEADER
555 header->spare1_pusVersion_spare2 = 0x10;
609 header->spare1_pusVersion_spare2 = 0x10;
556 header->serviceType = TM_TYPE_LFR_SCIENCE; // service type
610 header->serviceType = TM_TYPE_LFR_SCIENCE; // service type
557 header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
611 header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
558 header->destinationID = TM_DESTINATION_ID_GROUND;
612 header->destinationID = TM_DESTINATION_ID_GROUND;
559 // AUXILIARY DATA HEADER
613 // AUXILIARY DATA HEADER
560 header->sid = 0x00;
614 header->sid = 0x00;
561 header->biaStatusInfo = 0x00;
615 header->biaStatusInfo = 0x00;
562 header->pa_lfr_pkt_cnt_asm = 0x00;
616 header->pa_lfr_pkt_cnt_asm = 0x00;
563 header->pa_lfr_pkt_nr_asm = 0x00;
617 header->pa_lfr_pkt_nr_asm = 0x00;
564 header->time[0] = 0x00;
618 header->time[0] = 0x00;
565 header->time[0] = 0x00;
619 header->time[0] = 0x00;
566 header->time[0] = 0x00;
620 header->time[0] = 0x00;
567 header->time[0] = 0x00;
621 header->time[0] = 0x00;
568 header->time[0] = 0x00;
622 header->time[0] = 0x00;
569 header->time[0] = 0x00;
623 header->time[0] = 0x00;
570 header->pa_lfr_asm_blk_nr[0] = 0x00; // BLK_NR MSB
624 header->pa_lfr_asm_blk_nr[0] = 0x00; // BLK_NR MSB
571 header->pa_lfr_asm_blk_nr[1] = 0x00; // BLK_NR LSB
625 header->pa_lfr_asm_blk_nr[1] = 0x00; // BLK_NR LSB
572 }
626 }
573
627
574 void fill_averaged_spectral_matrix(void)
628 void fill_averaged_spectral_matrix(void)
575 {
629 {
576 /** This function fills spectral matrices related buffers with arbitrary data.
630 /** This function fills spectral matrices related buffers with arbitrary data.
577 *
631 *
578 * This function is for testing purpose only.
632 * This function is for testing purpose only.
579 *
633 *
580 */
634 */
581
635
582 float offset;
636 float offset;
583 float coeff;
637 float coeff;
584
638
585 offset = 10.;
639 offset = 10.;
586 coeff = 100000.;
640 coeff = 100000.;
587 averaged_sm_f0[ 0 + 25 * 0 ] = 0. + offset;
641 averaged_sm_f0[ 0 + 25 * 0 ] = 0. + offset;
588 averaged_sm_f0[ 0 + 25 * 1 ] = 1. + offset;
642 averaged_sm_f0[ 0 + 25 * 1 ] = 1. + offset;
589 averaged_sm_f0[ 0 + 25 * 2 ] = 2. + offset;
643 averaged_sm_f0[ 0 + 25 * 2 ] = 2. + offset;
590 averaged_sm_f0[ 0 + 25 * 3 ] = 3. + offset;
644 averaged_sm_f0[ 0 + 25 * 3 ] = 3. + offset;
591 averaged_sm_f0[ 0 + 25 * 4 ] = 4. + offset;
645 averaged_sm_f0[ 0 + 25 * 4 ] = 4. + offset;
592 averaged_sm_f0[ 0 + 25 * 5 ] = 5. + offset;
646 averaged_sm_f0[ 0 + 25 * 5 ] = 5. + offset;
593 averaged_sm_f0[ 0 + 25 * 6 ] = 6. + offset;
647 averaged_sm_f0[ 0 + 25 * 6 ] = 6. + offset;
594 averaged_sm_f0[ 0 + 25 * 7 ] = 7. + offset;
648 averaged_sm_f0[ 0 + 25 * 7 ] = 7. + offset;
595 averaged_sm_f0[ 0 + 25 * 8 ] = 8. + offset;
649 averaged_sm_f0[ 0 + 25 * 8 ] = 8. + offset;
596 averaged_sm_f0[ 0 + 25 * 9 ] = 9. + offset;
650 averaged_sm_f0[ 0 + 25 * 9 ] = 9. + offset;
597 averaged_sm_f0[ 0 + 25 * 10 ] = 10. + offset;
651 averaged_sm_f0[ 0 + 25 * 10 ] = 10. + offset;
598 averaged_sm_f0[ 0 + 25 * 11 ] = 11. + offset;
652 averaged_sm_f0[ 0 + 25 * 11 ] = 11. + offset;
599 averaged_sm_f0[ 0 + 25 * 12 ] = 12. + offset;
653 averaged_sm_f0[ 0 + 25 * 12 ] = 12. + offset;
600 averaged_sm_f0[ 0 + 25 * 13 ] = 13. + offset;
654 averaged_sm_f0[ 0 + 25 * 13 ] = 13. + offset;
601 averaged_sm_f0[ 0 + 25 * 14 ] = 14. + offset;
655 averaged_sm_f0[ 0 + 25 * 14 ] = 14. + offset;
602 averaged_sm_f0[ 9 + 25 * 0 ] = -(0. + offset)* coeff;
656 averaged_sm_f0[ 9 + 25 * 0 ] = -(0. + offset)* coeff;
603 averaged_sm_f0[ 9 + 25 * 1 ] = -(1. + offset)* coeff;
657 averaged_sm_f0[ 9 + 25 * 1 ] = -(1. + offset)* coeff;
604 averaged_sm_f0[ 9 + 25 * 2 ] = -(2. + offset)* coeff;
658 averaged_sm_f0[ 9 + 25 * 2 ] = -(2. + offset)* coeff;
605 averaged_sm_f0[ 9 + 25 * 3 ] = -(3. + offset)* coeff;
659 averaged_sm_f0[ 9 + 25 * 3 ] = -(3. + offset)* coeff;
606 averaged_sm_f0[ 9 + 25 * 4 ] = -(4. + offset)* coeff;
660 averaged_sm_f0[ 9 + 25 * 4 ] = -(4. + offset)* coeff;
607 averaged_sm_f0[ 9 + 25 * 5 ] = -(5. + offset)* coeff;
661 averaged_sm_f0[ 9 + 25 * 5 ] = -(5. + offset)* coeff;
608 averaged_sm_f0[ 9 + 25 * 6 ] = -(6. + offset)* coeff;
662 averaged_sm_f0[ 9 + 25 * 6 ] = -(6. + offset)* coeff;
609 averaged_sm_f0[ 9 + 25 * 7 ] = -(7. + offset)* coeff;
663 averaged_sm_f0[ 9 + 25 * 7 ] = -(7. + offset)* coeff;
610 averaged_sm_f0[ 9 + 25 * 8 ] = -(8. + offset)* coeff;
664 averaged_sm_f0[ 9 + 25 * 8 ] = -(8. + offset)* coeff;
611 averaged_sm_f0[ 9 + 25 * 9 ] = -(9. + offset)* coeff;
665 averaged_sm_f0[ 9 + 25 * 9 ] = -(9. + offset)* coeff;
612 averaged_sm_f0[ 9 + 25 * 10 ] = -(10. + offset)* coeff;
666 averaged_sm_f0[ 9 + 25 * 10 ] = -(10. + offset)* coeff;
613 averaged_sm_f0[ 9 + 25 * 11 ] = -(11. + offset)* coeff;
667 averaged_sm_f0[ 9 + 25 * 11 ] = -(11. + offset)* coeff;
614 averaged_sm_f0[ 9 + 25 * 12 ] = -(12. + offset)* coeff;
668 averaged_sm_f0[ 9 + 25 * 12 ] = -(12. + offset)* coeff;
615 averaged_sm_f0[ 9 + 25 * 13 ] = -(13. + offset)* coeff;
669 averaged_sm_f0[ 9 + 25 * 13 ] = -(13. + offset)* coeff;
616 averaged_sm_f0[ 9 + 25 * 14 ] = -(14. + offset)* coeff;
670 averaged_sm_f0[ 9 + 25 * 14 ] = -(14. + offset)* coeff;
617
671
618 offset = 10000000;
672 offset = 10000000;
619 averaged_sm_f0[ 16 + 25 * 0 ] = (0. + offset)* coeff;
673 averaged_sm_f0[ 16 + 25 * 0 ] = (0. + offset)* coeff;
620 averaged_sm_f0[ 16 + 25 * 1 ] = (1. + offset)* coeff;
674 averaged_sm_f0[ 16 + 25 * 1 ] = (1. + offset)* coeff;
621 averaged_sm_f0[ 16 + 25 * 2 ] = (2. + offset)* coeff;
675 averaged_sm_f0[ 16 + 25 * 2 ] = (2. + offset)* coeff;
622 averaged_sm_f0[ 16 + 25 * 3 ] = (3. + offset)* coeff;
676 averaged_sm_f0[ 16 + 25 * 3 ] = (3. + offset)* coeff;
623 averaged_sm_f0[ 16 + 25 * 4 ] = (4. + offset)* coeff;
677 averaged_sm_f0[ 16 + 25 * 4 ] = (4. + offset)* coeff;
624 averaged_sm_f0[ 16 + 25 * 5 ] = (5. + offset)* coeff;
678 averaged_sm_f0[ 16 + 25 * 5 ] = (5. + offset)* coeff;
625 averaged_sm_f0[ 16 + 25 * 6 ] = (6. + offset)* coeff;
679 averaged_sm_f0[ 16 + 25 * 6 ] = (6. + offset)* coeff;
626 averaged_sm_f0[ 16 + 25 * 7 ] = (7. + offset)* coeff;
680 averaged_sm_f0[ 16 + 25 * 7 ] = (7. + offset)* coeff;
627 averaged_sm_f0[ 16 + 25 * 8 ] = (8. + offset)* coeff;
681 averaged_sm_f0[ 16 + 25 * 8 ] = (8. + offset)* coeff;
628 averaged_sm_f0[ 16 + 25 * 9 ] = (9. + offset)* coeff;
682 averaged_sm_f0[ 16 + 25 * 9 ] = (9. + offset)* coeff;
629 averaged_sm_f0[ 16 + 25 * 10 ] = (10. + offset)* coeff;
683 averaged_sm_f0[ 16 + 25 * 10 ] = (10. + offset)* coeff;
630 averaged_sm_f0[ 16 + 25 * 11 ] = (11. + offset)* coeff;
684 averaged_sm_f0[ 16 + 25 * 11 ] = (11. + offset)* coeff;
631 averaged_sm_f0[ 16 + 25 * 12 ] = (12. + offset)* coeff;
685 averaged_sm_f0[ 16 + 25 * 12 ] = (12. + offset)* coeff;
632 averaged_sm_f0[ 16 + 25 * 13 ] = (13. + offset)* coeff;
686 averaged_sm_f0[ 16 + 25 * 13 ] = (13. + offset)* coeff;
633 averaged_sm_f0[ 16 + 25 * 14 ] = (14. + offset)* coeff;
687 averaged_sm_f0[ 16 + 25 * 14 ] = (14. + offset)* coeff;
634
688
635 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 0 ] = averaged_sm_f0[ 0 ];
689 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 0 ] = averaged_sm_f0[ 0 ];
636 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 1 ] = averaged_sm_f0[ 1 ];
690 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 1 ] = averaged_sm_f0[ 1 ];
637 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 2 ] = averaged_sm_f0[ 2 ];
691 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 2 ] = averaged_sm_f0[ 2 ];
638 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 3 ] = averaged_sm_f0[ 3 ];
692 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 3 ] = averaged_sm_f0[ 3 ];
639 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 4 ] = averaged_sm_f0[ 4 ];
693 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 4 ] = averaged_sm_f0[ 4 ];
640 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 5 ] = averaged_sm_f0[ 5 ];
694 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 5 ] = averaged_sm_f0[ 5 ];
641 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 6 ] = averaged_sm_f0[ 6 ];
695 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 6 ] = averaged_sm_f0[ 6 ];
642 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 7 ] = averaged_sm_f0[ 7 ];
696 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 7 ] = averaged_sm_f0[ 7 ];
643 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 8 ] = averaged_sm_f0[ 8 ];
697 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 8 ] = averaged_sm_f0[ 8 ];
644 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 9 ] = averaged_sm_f0[ 9 ];
698 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 9 ] = averaged_sm_f0[ 9 ];
645 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 10 ] = averaged_sm_f0[ 10 ];
699 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 10 ] = averaged_sm_f0[ 10 ];
646 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 11 ] = averaged_sm_f0[ 11 ];
700 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 11 ] = averaged_sm_f0[ 11 ];
647 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 12 ] = averaged_sm_f0[ 12 ];
701 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 12 ] = averaged_sm_f0[ 12 ];
648 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 13 ] = averaged_sm_f0[ 13 ];
702 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 13 ] = averaged_sm_f0[ 13 ];
649 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 14 ] = averaged_sm_f0[ 14 ];
703 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 14 ] = averaged_sm_f0[ 14 ];
650 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 15 ] = averaged_sm_f0[ 15 ];
704 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 15 ] = averaged_sm_f0[ 15 ];
651 }
705 }
652
706
653 void reset_spectral_matrix_regs()
707 void reset_spectral_matrix_regs()
654 {
708 {
655 /** This function resets the spectral matrices module registers.
709 /** This function resets the spectral matrices module registers.
656 *
710 *
657 * The registers affected by this function are located at the following offset addresses:
711 * The registers affected by this function are located at the following offset addresses:
658 *
712 *
659 * - 0x00 config
713 * - 0x00 config
660 * - 0x04 status
714 * - 0x04 status
661 * - 0x08 matrixF0_Address0
715 * - 0x08 matrixF0_Address0
662 * - 0x10 matrixFO_Address1
716 * - 0x10 matrixFO_Address1
663 * - 0x14 matrixF1_Address
717 * - 0x14 matrixF1_Address
664 * - 0x18 matrixF2_Address
718 * - 0x18 matrixF2_Address
665 *
719 *
666 */
720 */
667
721
722 spectral_matrix_regs->config = 0x00;
723 spectral_matrix_regs->status = 0x00;
724
668 spectral_matrix_regs->matrixF0_Address0 = current_ring_node_sm_f0->buffer_address;
725 spectral_matrix_regs->matrixF0_Address0 = current_ring_node_sm_f0->buffer_address;
669 spectral_matrix_regs->matrixFO_Address1 = current_ring_node_sm_f0->buffer_address;
726 spectral_matrix_regs->matrixFO_Address1 = current_ring_node_sm_f0->buffer_address;
670 spectral_matrix_regs->matrixF1_Address = current_ring_node_sm_f1->buffer_address;
727 spectral_matrix_regs->matrixF1_Address = current_ring_node_sm_f1->buffer_address;
671 spectral_matrix_regs->matrixF2_Address = current_ring_node_sm_f2->buffer_address;
728 spectral_matrix_regs->matrixF2_Address = current_ring_node_sm_f2->buffer_address;
672 }
729 }
673
730
674 //******************
731 //******************
675 // general functions
732 // general functions
676
733
677
734
678
735
679
736
@@ -1,733 +1,757
1 /** Functions and tasks related to TeleCommand handling.
1 /** Functions and tasks related to TeleCommand handling.
2 *
2 *
3 * @file
3 * @file
4 * @author P. LEROY
4 * @author P. LEROY
5 *
5 *
6 * A group of functions to handle TeleCommands:\n
6 * A group of functions to handle TeleCommands:\n
7 * action launching\n
7 * action launching\n
8 * TC parsing\n
8 * TC parsing\n
9 * ...
9 * ...
10 *
10 *
11 */
11 */
12
12
13 #include "tc_handler.h"
13 #include "tc_handler.h"
14
14
15 //***********
15 //***********
16 // RTEMS TASK
16 // RTEMS TASK
17
17
18 rtems_task actn_task( rtems_task_argument unused )
18 rtems_task actn_task( rtems_task_argument unused )
19 {
19 {
20 /** This RTEMS task is responsible for launching actions upton the reception of valid TeleCommands.
20 /** This RTEMS task is responsible for launching actions upton the reception of valid TeleCommands.
21 *
21 *
22 * @param unused is the starting argument of the RTEMS task
22 * @param unused is the starting argument of the RTEMS task
23 *
23 *
24 * The ACTN task waits for data coming from an RTEMS msesage queue. When data arrives, it launches specific actions depending
24 * The ACTN task waits for data coming from an RTEMS msesage queue. When data arrives, it launches specific actions depending
25 * on the incoming TeleCommand.
25 * on the incoming TeleCommand.
26 *
26 *
27 */
27 */
28
28
29 int result;
29 int result;
30 rtems_status_code status; // RTEMS status code
30 rtems_status_code status; // RTEMS status code
31 ccsdsTelecommandPacket_t TC; // TC sent to the ACTN task
31 ccsdsTelecommandPacket_t TC; // TC sent to the ACTN task
32 size_t size; // size of the incoming TC packet
32 size_t size; // size of the incoming TC packet
33 unsigned char subtype; // subtype of the current TC packet
33 unsigned char subtype; // subtype of the current TC packet
34 unsigned char time[6];
34 unsigned char time[6];
35 rtems_id queue_rcv_id;
35 rtems_id queue_rcv_id;
36 rtems_id queue_snd_id;
36 rtems_id queue_snd_id;
37
37
38 status = get_message_queue_id_recv( &queue_rcv_id );
38 status = get_message_queue_id_recv( &queue_rcv_id );
39 if (status != RTEMS_SUCCESSFUL)
39 if (status != RTEMS_SUCCESSFUL)
40 {
40 {
41 PRINTF1("in ACTN *** ERR get_message_queue_id_recv %d\n", status)
41 PRINTF1("in ACTN *** ERR get_message_queue_id_recv %d\n", status)
42 }
42 }
43
43
44 status = get_message_queue_id_send( &queue_snd_id );
44 status = get_message_queue_id_send( &queue_snd_id );
45 if (status != RTEMS_SUCCESSFUL)
45 if (status != RTEMS_SUCCESSFUL)
46 {
46 {
47 PRINTF1("in ACTN *** ERR get_message_queue_id_send %d\n", status)
47 PRINTF1("in ACTN *** ERR get_message_queue_id_send %d\n", status)
48 }
48 }
49
49
50 result = LFR_SUCCESSFUL;
50 result = LFR_SUCCESSFUL;
51 subtype = 0; // subtype of the current TC packet
51 subtype = 0; // subtype of the current TC packet
52
52
53 BOOT_PRINTF("in ACTN *** \n")
53 BOOT_PRINTF("in ACTN *** \n")
54
54
55 while(1)
55 while(1)
56 {
56 {
57 status = rtems_message_queue_receive( queue_rcv_id, (char*) &TC, &size,
57 status = rtems_message_queue_receive( queue_rcv_id, (char*) &TC, &size,
58 RTEMS_WAIT, RTEMS_NO_TIMEOUT);
58 RTEMS_WAIT, RTEMS_NO_TIMEOUT);
59 getTime( time ); // set time to the current time
59 getTime( time ); // set time to the current time
60 if (status!=RTEMS_SUCCESSFUL)
60 if (status!=RTEMS_SUCCESSFUL)
61 {
61 {
62 PRINTF1("ERR *** in task ACTN *** error receiving a message, code %d \n", status)
62 PRINTF1("ERR *** in task ACTN *** error receiving a message, code %d \n", status)
63 }
63 }
64 else
64 else
65 {
65 {
66 subtype = TC.serviceSubType;
66 subtype = TC.serviceSubType;
67 switch(subtype)
67 switch(subtype)
68 {
68 {
69 case TC_SUBTYPE_RESET:
69 case TC_SUBTYPE_RESET:
70 result = action_reset( &TC, queue_snd_id, time );
70 result = action_reset( &TC, queue_snd_id, time );
71 close_action( &TC, result, queue_snd_id, time );
71 close_action( &TC, result, queue_snd_id, time );
72 break;
72 break;
73 //
73 //
74 case TC_SUBTYPE_LOAD_COMM:
74 case TC_SUBTYPE_LOAD_COMM:
75 result = action_load_common_par( &TC );
75 result = action_load_common_par( &TC );
76 close_action( &TC, result, queue_snd_id, time );
76 close_action( &TC, result, queue_snd_id, time );
77 break;
77 break;
78 //
78 //
79 case TC_SUBTYPE_LOAD_NORM:
79 case TC_SUBTYPE_LOAD_NORM:
80 result = action_load_normal_par( &TC, queue_snd_id, time );
80 result = action_load_normal_par( &TC, queue_snd_id, time );
81 close_action( &TC, result, queue_snd_id, time );
81 close_action( &TC, result, queue_snd_id, time );
82 break;
82 break;
83 //
83 //
84 case TC_SUBTYPE_LOAD_BURST:
84 case TC_SUBTYPE_LOAD_BURST:
85 result = action_load_burst_par( &TC, queue_snd_id, time );
85 result = action_load_burst_par( &TC, queue_snd_id, time );
86 close_action( &TC, result, queue_snd_id, time );
86 close_action( &TC, result, queue_snd_id, time );
87 break;
87 break;
88 //
88 //
89 case TC_SUBTYPE_LOAD_SBM1:
89 case TC_SUBTYPE_LOAD_SBM1:
90 result = action_load_sbm1_par( &TC, queue_snd_id, time );
90 result = action_load_sbm1_par( &TC, queue_snd_id, time );
91 close_action( &TC, result, queue_snd_id, time );
91 close_action( &TC, result, queue_snd_id, time );
92 break;
92 break;
93 //
93 //
94 case TC_SUBTYPE_LOAD_SBM2:
94 case TC_SUBTYPE_LOAD_SBM2:
95 result = action_load_sbm2_par( &TC, queue_snd_id, time );
95 result = action_load_sbm2_par( &TC, queue_snd_id, time );
96 close_action( &TC, result, queue_snd_id, time );
96 close_action( &TC, result, queue_snd_id, time );
97 break;
97 break;
98 //
98 //
99 case TC_SUBTYPE_DUMP:
99 case TC_SUBTYPE_DUMP:
100 result = action_dump_par( queue_snd_id );
100 result = action_dump_par( queue_snd_id );
101 close_action( &TC, result, queue_snd_id, time );
101 close_action( &TC, result, queue_snd_id, time );
102 break;
102 break;
103 //
103 //
104 case TC_SUBTYPE_ENTER:
104 case TC_SUBTYPE_ENTER:
105 result = action_enter_mode( &TC, queue_snd_id, time );
105 result = action_enter_mode( &TC, queue_snd_id, time );
106 close_action( &TC, result, queue_snd_id, time );
106 close_action( &TC, result, queue_snd_id, time );
107 break;
107 break;
108 //
108 //
109 case TC_SUBTYPE_UPDT_INFO:
109 case TC_SUBTYPE_UPDT_INFO:
110 result = action_update_info( &TC, queue_snd_id );
110 result = action_update_info( &TC, queue_snd_id );
111 close_action( &TC, result, queue_snd_id, time );
111 close_action( &TC, result, queue_snd_id, time );
112 break;
112 break;
113 //
113 //
114 case TC_SUBTYPE_EN_CAL:
114 case TC_SUBTYPE_EN_CAL:
115 result = action_enable_calibration( &TC, queue_snd_id, time );
115 result = action_enable_calibration( &TC, queue_snd_id, time );
116 close_action( &TC, result, queue_snd_id, time );
116 close_action( &TC, result, queue_snd_id, time );
117 break;
117 break;
118 //
118 //
119 case TC_SUBTYPE_DIS_CAL:
119 case TC_SUBTYPE_DIS_CAL:
120 result = action_disable_calibration( &TC, queue_snd_id, time );
120 result = action_disable_calibration( &TC, queue_snd_id, time );
121 close_action( &TC, result, queue_snd_id, time );
121 close_action( &TC, result, queue_snd_id, time );
122 break;
122 break;
123 //
123 //
124 case TC_SUBTYPE_UPDT_TIME:
124 case TC_SUBTYPE_UPDT_TIME:
125 result = action_update_time( &TC );
125 result = action_update_time( &TC );
126 close_action( &TC, result, queue_snd_id, time );
126 close_action( &TC, result, queue_snd_id, time );
127 break;
127 break;
128 //
128 //
129 default:
129 default:
130 break;
130 break;
131 }
131 }
132 }
132 }
133 }
133 }
134 }
134 }
135
135
136 //***********
136 //***********
137 // TC ACTIONS
137 // TC ACTIONS
138
138
139 int action_reset(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
139 int action_reset(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
140 {
140 {
141 /** This function executes specific actions when a TC_LFR_RESET TeleCommand has been received.
141 /** This function executes specific actions when a TC_LFR_RESET TeleCommand has been received.
142 *
142 *
143 * @param TC points to the TeleCommand packet that is being processed
143 * @param TC points to the TeleCommand packet that is being processed
144 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
144 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
145 *
145 *
146 */
146 */
147
147
148 send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time );
148 send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time );
149 return LFR_DEFAULT;
149 return LFR_DEFAULT;
150 }
150 }
151
151
152 int action_enter_mode(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
152 int action_enter_mode(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
153 {
153 {
154 /** This function executes specific actions when a TC_LFR_ENTER_MODE TeleCommand has been received.
154 /** This function executes specific actions when a TC_LFR_ENTER_MODE TeleCommand has been received.
155 *
155 *
156 * @param TC points to the TeleCommand packet that is being processed
156 * @param TC points to the TeleCommand packet that is being processed
157 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
157 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
158 *
158 *
159 */
159 */
160
160
161 rtems_status_code status;
161 rtems_status_code status;
162 unsigned char requestedMode;
162 unsigned char requestedMode;
163
163
164 requestedMode = TC->dataAndCRC[1];
164 requestedMode = TC->dataAndCRC[1];
165
165
166 if ( (requestedMode != LFR_MODE_STANDBY)
166 if ( (requestedMode != LFR_MODE_STANDBY)
167 && (requestedMode != LFR_MODE_NORMAL) && (requestedMode != LFR_MODE_BURST)
167 && (requestedMode != LFR_MODE_NORMAL) && (requestedMode != LFR_MODE_BURST)
168 && (requestedMode != LFR_MODE_SBM1) && (requestedMode != LFR_MODE_SBM2) )
168 && (requestedMode != LFR_MODE_SBM1) && (requestedMode != LFR_MODE_SBM2) )
169 {
169 {
170 status = RTEMS_UNSATISFIED;
170 status = RTEMS_UNSATISFIED;
171 send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_CP_LFR_MODE, requestedMode, time );
171 send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_CP_LFR_MODE, requestedMode, time );
172 }
172 }
173 else
173 else
174 {
174 {
175 printf("in action_enter_mode *** enter mode %d\n", requestedMode);
175 printf("in action_enter_mode *** enter mode %d\n", requestedMode);
176
176
177 status = transition_validation(requestedMode);
177 status = transition_validation(requestedMode);
178
178
179 if ( status == LFR_SUCCESSFUL ) {
179 if ( status == LFR_SUCCESSFUL ) {
180 if ( lfrCurrentMode != LFR_MODE_STANDBY)
180 if ( lfrCurrentMode != LFR_MODE_STANDBY)
181 {
181 {
182 status = stop_current_mode();
182 status = stop_current_mode();
183 }
183 }
184 if (status != RTEMS_SUCCESSFUL)
184 if (status != RTEMS_SUCCESSFUL)
185 {
185 {
186 PRINTF("ERR *** in action_enter *** stop_current_mode\n")
186 PRINTF("ERR *** in action_enter *** stop_current_mode\n")
187 }
187 }
188 status = enter_mode( requestedMode );
188 status = enter_mode( requestedMode );
189 }
189 }
190 else
190 else
191 {
191 {
192 PRINTF("ERR *** in action_enter *** transition rejected\n")
192 PRINTF("ERR *** in action_enter *** transition rejected\n")
193 send_tm_lfr_tc_exe_not_executable( TC, queue_id, time );
193 send_tm_lfr_tc_exe_not_executable( TC, queue_id, time );
194 }
194 }
195 }
195 }
196
196
197 return status;
197 return status;
198 }
198 }
199
199
200 int action_update_info(ccsdsTelecommandPacket_t *TC, rtems_id queue_id)
200 int action_update_info(ccsdsTelecommandPacket_t *TC, rtems_id queue_id)
201 {
201 {
202 /** This function executes specific actions when a TC_LFR_UPDATE_INFO TeleCommand has been received.
202 /** This function executes specific actions when a TC_LFR_UPDATE_INFO TeleCommand has been received.
203 *
203 *
204 * @param TC points to the TeleCommand packet that is being processed
204 * @param TC points to the TeleCommand packet that is being processed
205 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
205 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
206 *
206 *
207 * @return LFR directive status code:
207 * @return LFR directive status code:
208 * - LFR_DEFAULT
208 * - LFR_DEFAULT
209 * - LFR_SUCCESSFUL
209 * - LFR_SUCCESSFUL
210 *
210 *
211 */
211 */
212
212
213 unsigned int val;
213 unsigned int val;
214 int result;
214 int result;
215
215
216 result = LFR_SUCCESSFUL;
216 result = LFR_SUCCESSFUL;
217
217
218 val = housekeeping_packet.hk_lfr_update_info_tc_cnt[0] * 256
218 val = housekeeping_packet.hk_lfr_update_info_tc_cnt[0] * 256
219 + housekeeping_packet.hk_lfr_update_info_tc_cnt[1];
219 + housekeeping_packet.hk_lfr_update_info_tc_cnt[1];
220 val++;
220 val++;
221 housekeeping_packet.hk_lfr_update_info_tc_cnt[0] = (unsigned char) (val >> 8);
221 housekeeping_packet.hk_lfr_update_info_tc_cnt[0] = (unsigned char) (val >> 8);
222 housekeeping_packet.hk_lfr_update_info_tc_cnt[1] = (unsigned char) (val);
222 housekeeping_packet.hk_lfr_update_info_tc_cnt[1] = (unsigned char) (val);
223
223
224 return result;
224 return result;
225 }
225 }
226
226
227 int action_enable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
227 int action_enable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
228 {
228 {
229 /** This function executes specific actions when a TC_LFR_ENABLE_CALIBRATION TeleCommand has been received.
229 /** This function executes specific actions when a TC_LFR_ENABLE_CALIBRATION TeleCommand has been received.
230 *
230 *
231 * @param TC points to the TeleCommand packet that is being processed
231 * @param TC points to the TeleCommand packet that is being processed
232 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
232 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
233 *
233 *
234 */
234 */
235
235
236 int result;
236 int result;
237 unsigned char lfrMode;
237 unsigned char lfrMode;
238
238
239 result = LFR_DEFAULT;
239 result = LFR_DEFAULT;
240 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
240 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
241
241
242 if ( (lfrMode == LFR_MODE_STANDBY) || (lfrMode == LFR_MODE_BURST) || (lfrMode == LFR_MODE_SBM2) ) {
242 if ( (lfrMode == LFR_MODE_STANDBY) || (lfrMode == LFR_MODE_BURST) || (lfrMode == LFR_MODE_SBM2) ) {
243 send_tm_lfr_tc_exe_not_executable( TC, queue_id, time );
243 send_tm_lfr_tc_exe_not_executable( TC, queue_id, time );
244 result = LFR_DEFAULT;
244 result = LFR_DEFAULT;
245 }
245 }
246 else {
246 else {
247 send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time );
247 send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time );
248 result = LFR_DEFAULT;
248 result = LFR_DEFAULT;
249 }
249 }
250 return result;
250 return result;
251 }
251 }
252
252
253 int action_disable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
253 int action_disable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
254 {
254 {
255 /** This function executes specific actions when a TC_LFR_DISABLE_CALIBRATION TeleCommand has been received.
255 /** This function executes specific actions when a TC_LFR_DISABLE_CALIBRATION TeleCommand has been received.
256 *
256 *
257 * @param TC points to the TeleCommand packet that is being processed
257 * @param TC points to the TeleCommand packet that is being processed
258 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
258 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
259 *
259 *
260 */
260 */
261
261
262 int result;
262 int result;
263 unsigned char lfrMode;
263 unsigned char lfrMode;
264
264
265 result = LFR_DEFAULT;
265 result = LFR_DEFAULT;
266 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
266 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
267
267
268 if ( (lfrMode == LFR_MODE_STANDBY) || (lfrMode == LFR_MODE_BURST) || (lfrMode == LFR_MODE_SBM2) ) {
268 if ( (lfrMode == LFR_MODE_STANDBY) || (lfrMode == LFR_MODE_BURST) || (lfrMode == LFR_MODE_SBM2) ) {
269 send_tm_lfr_tc_exe_not_executable( TC, queue_id, time );
269 send_tm_lfr_tc_exe_not_executable( TC, queue_id, time );
270 result = LFR_DEFAULT;
270 result = LFR_DEFAULT;
271 }
271 }
272 else {
272 else {
273 send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time );
273 send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time );
274 result = LFR_DEFAULT;
274 result = LFR_DEFAULT;
275 }
275 }
276 return result;
276 return result;
277 }
277 }
278
278
279 int action_update_time(ccsdsTelecommandPacket_t *TC)
279 int action_update_time(ccsdsTelecommandPacket_t *TC)
280 {
280 {
281 /** This function executes specific actions when a TC_LFR_UPDATE_TIME TeleCommand has been received.
281 /** This function executes specific actions when a TC_LFR_UPDATE_TIME TeleCommand has been received.
282 *
282 *
283 * @param TC points to the TeleCommand packet that is being processed
283 * @param TC points to the TeleCommand packet that is being processed
284 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
284 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
285 *
285 *
286 * @return LFR_SUCCESSFUL
286 * @return LFR_SUCCESSFUL
287 *
287 *
288 */
288 */
289
289
290 unsigned int val;
290 unsigned int val;
291
291
292 time_management_regs->coarse_time_load = (TC->dataAndCRC[0] << 24)
292 time_management_regs->coarse_time_load = (TC->dataAndCRC[0] << 24)
293 + (TC->dataAndCRC[1] << 16)
293 + (TC->dataAndCRC[1] << 16)
294 + (TC->dataAndCRC[2] << 8)
294 + (TC->dataAndCRC[2] << 8)
295 + TC->dataAndCRC[3];
295 + TC->dataAndCRC[3];
296 val = housekeeping_packet.hk_lfr_update_time_tc_cnt[0] * 256
296 val = housekeeping_packet.hk_lfr_update_time_tc_cnt[0] * 256
297 + housekeeping_packet.hk_lfr_update_time_tc_cnt[1];
297 + housekeeping_packet.hk_lfr_update_time_tc_cnt[1];
298 val++;
298 val++;
299 housekeeping_packet.hk_lfr_update_time_tc_cnt[0] = (unsigned char) (val >> 8);
299 housekeeping_packet.hk_lfr_update_time_tc_cnt[0] = (unsigned char) (val >> 8);
300 housekeeping_packet.hk_lfr_update_time_tc_cnt[1] = (unsigned char) (val);
300 housekeeping_packet.hk_lfr_update_time_tc_cnt[1] = (unsigned char) (val);
301 time_management_regs->ctrl = time_management_regs->ctrl | 1;
301 time_management_regs->ctrl = time_management_regs->ctrl | 1;
302
302
303 return LFR_SUCCESSFUL;
303 return LFR_SUCCESSFUL;
304 }
304 }
305
305
306 //*******************
306 //*******************
307 // ENTERING THE MODES
307 // ENTERING THE MODES
308
308
309 int transition_validation(unsigned char requestedMode)
309 int transition_validation(unsigned char requestedMode)
310 {
310 {
311 /** This function checks the validity of the transition requested by the TC_LFR_ENTER_MODE.
311 /** This function checks the validity of the transition requested by the TC_LFR_ENTER_MODE.
312 *
312 *
313 * @param requestedMode is the mode requested by the TC_LFR_ENTER_MODE
313 * @param requestedMode is the mode requested by the TC_LFR_ENTER_MODE
314 *
314 *
315 * @return LFR directive status codes:
315 * @return LFR directive status codes:
316 * - LFR_SUCCESSFUL - the transition is authorized
316 * - LFR_SUCCESSFUL - the transition is authorized
317 * - LFR_DEFAULT - the transition is not authorized
317 * - LFR_DEFAULT - the transition is not authorized
318 *
318 *
319 */
319 */
320
320
321 int status;
321 int status;
322
322
323 switch (requestedMode)
323 switch (requestedMode)
324 {
324 {
325 case LFR_MODE_STANDBY:
325 case LFR_MODE_STANDBY:
326 if ( lfrCurrentMode == LFR_MODE_STANDBY ) {
326 if ( lfrCurrentMode == LFR_MODE_STANDBY ) {
327 status = LFR_DEFAULT;
327 status = LFR_DEFAULT;
328 }
328 }
329 else
329 else
330 {
330 {
331 status = LFR_SUCCESSFUL;
331 status = LFR_SUCCESSFUL;
332 }
332 }
333 break;
333 break;
334 case LFR_MODE_NORMAL:
334 case LFR_MODE_NORMAL:
335 if ( lfrCurrentMode == LFR_MODE_NORMAL ) {
335 if ( lfrCurrentMode == LFR_MODE_NORMAL ) {
336 status = LFR_DEFAULT;
336 status = LFR_DEFAULT;
337 }
337 }
338 else {
338 else {
339 status = LFR_SUCCESSFUL;
339 status = LFR_SUCCESSFUL;
340 }
340 }
341 break;
341 break;
342 case LFR_MODE_BURST:
342 case LFR_MODE_BURST:
343 if ( lfrCurrentMode == LFR_MODE_BURST ) {
343 if ( lfrCurrentMode == LFR_MODE_BURST ) {
344 status = LFR_DEFAULT;
344 status = LFR_DEFAULT;
345 }
345 }
346 else {
346 else {
347 status = LFR_SUCCESSFUL;
347 status = LFR_SUCCESSFUL;
348 }
348 }
349 break;
349 break;
350 case LFR_MODE_SBM1:
350 case LFR_MODE_SBM1:
351 if ( lfrCurrentMode == LFR_MODE_SBM1 ) {
351 if ( lfrCurrentMode == LFR_MODE_SBM1 ) {
352 status = LFR_DEFAULT;
352 status = LFR_DEFAULT;
353 }
353 }
354 else {
354 else {
355 status = LFR_SUCCESSFUL;
355 status = LFR_SUCCESSFUL;
356 }
356 }
357 break;
357 break;
358 case LFR_MODE_SBM2:
358 case LFR_MODE_SBM2:
359 if ( lfrCurrentMode == LFR_MODE_SBM2 ) {
359 if ( lfrCurrentMode == LFR_MODE_SBM2 ) {
360 status = LFR_DEFAULT;
360 status = LFR_DEFAULT;
361 }
361 }
362 else {
362 else {
363 status = LFR_SUCCESSFUL;
363 status = LFR_SUCCESSFUL;
364 }
364 }
365 break;
365 break;
366 default:
366 default:
367 status = LFR_DEFAULT;
367 status = LFR_DEFAULT;
368 break;
368 break;
369 }
369 }
370
370
371 return status;
371 return status;
372 }
372 }
373
373
374 int stop_current_mode(void)
374 int stop_current_mode(void)
375 {
375 {
376 /** This function stops the current mode by masking interrupt lines and suspending science tasks.
376 /** This function stops the current mode by masking interrupt lines and suspending science tasks.
377 *
377 *
378 * @return RTEMS directive status codes:
378 * @return RTEMS directive status codes:
379 * - RTEMS_SUCCESSFUL - task restarted successfully
379 * - RTEMS_SUCCESSFUL - task restarted successfully
380 * - RTEMS_INVALID_ID - task id invalid
380 * - RTEMS_INVALID_ID - task id invalid
381 * - RTEMS_ALREADY_SUSPENDED - task already suspended
381 * - RTEMS_ALREADY_SUSPENDED - task already suspended
382 *
382 *
383 */
383 */
384
384
385 rtems_status_code status;
385 rtems_status_code status;
386
386
387 status = RTEMS_SUCCESSFUL;
387 status = RTEMS_SUCCESSFUL;
388
388
389 // (1) mask interruptions
389 // (1) mask interruptions
390 LEON_Mask_interrupt( IRQ_WAVEFORM_PICKER ); // mask waveform picker interrupt
390 LEON_Mask_interrupt( IRQ_WAVEFORM_PICKER ); // mask waveform picker interrupt
391 //LEON_Mask_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt
391 LEON_Mask_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt
392
392
393 // (2) clear interruptions
393 // (2) clear interruptions
394 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); // clear waveform picker interrupt
394 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); // clear waveform picker interrupt
395 //LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt
395 LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt
396
396
397 // (3) reset registers
397 // (3) reset registers
398 reset_wfp_burst_enable(); // reset burst and enable bits
398 reset_wfp_burst_enable(); // reset burst and enable bits
399 reset_wfp_status(); // reset all the status bits
399 reset_wfp_status(); // reset all the status bits
400 disable_irq_on_new_ready_matrix(); // stop the spectral matrices
400
401
401 // <Spectral Matrices simulator>
402 // <Spectral Matrices simulator>
402 LEON_Mask_interrupt( IRQ_SM_SIMULATOR ); // mask spectral matrix interrupt simulator
403 LEON_Mask_interrupt( IRQ_SM_SIMULATOR ); // mask spectral matrix interrupt simulator
403 timer_stop( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR );
404 timer_stop( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR );
404 LEON_Clear_interrupt( IRQ_SM_SIMULATOR ); // clear spectral matrix interrupt simulator
405 LEON_Clear_interrupt( IRQ_SM_SIMULATOR ); // clear spectral matrix interrupt simulator
405 // </Spectral Matrices simulator>
406 // </Spectral Matrices simulator>
406
407
407 // suspend several tasks
408 // suspend several tasks
408 if (lfrCurrentMode != LFR_MODE_STANDBY) {
409 if (lfrCurrentMode != LFR_MODE_STANDBY) {
409 status = suspend_science_tasks();
410 status = suspend_science_tasks();
410 }
411 }
411
412
412 if (status != RTEMS_SUCCESSFUL)
413 if (status != RTEMS_SUCCESSFUL)
413 {
414 {
414 PRINTF1("in stop_current_mode *** in suspend_science_tasks *** ERR code: %d\n", status)
415 PRINTF1("in stop_current_mode *** in suspend_science_tasks *** ERR code: %d\n", status)
415 }
416 }
416
417
417 return status;
418 return status;
418 }
419 }
419
420
420 int enter_mode(unsigned char mode )
421 int enter_mode(unsigned char mode )
421 {
422 {
422 /** This function is launched after a mode transition validation.
423 /** This function is launched after a mode transition validation.
423 *
424 *
424 * @param mode is the mode in which LFR will be put.
425 * @param mode is the mode in which LFR will be put.
425 *
426 *
426 * @return RTEMS directive status codes:
427 * @return RTEMS directive status codes:
427 * - RTEMS_SUCCESSFUL - the mode has been entered successfully
428 * - RTEMS_SUCCESSFUL - the mode has been entered successfully
428 * - RTEMS_NOT_SATISFIED - the mode has not been entered successfully
429 * - RTEMS_NOT_SATISFIED - the mode has not been entered successfully
429 *
430 *
430 */
431 */
431
432
432 rtems_status_code status;
433 rtems_status_code status;
433
434
434 status = RTEMS_UNSATISFIED;
435 status = RTEMS_UNSATISFIED;
435
436
436 housekeeping_packet.lfr_status_word[0] = (unsigned char) ((mode << 4) + 0x0d);
437 housekeeping_packet.lfr_status_word[0] = (unsigned char) ((mode << 4) + 0x0d);
437 updateLFRCurrentMode();
438 updateLFRCurrentMode();
438
439
439 if ( (mode == LFR_MODE_NORMAL) || (mode == LFR_MODE_BURST)
440 if ( (mode == LFR_MODE_NORMAL) || (mode == LFR_MODE_BURST)
440 || (mode == LFR_MODE_SBM1) || (mode == LFR_MODE_SBM2) )
441 || (mode == LFR_MODE_SBM1) || (mode == LFR_MODE_SBM2) )
441 {
442 {
442 #ifdef PRINT_TASK_STATISTICS
443 #ifdef PRINT_TASK_STATISTICS
443 rtems_cpu_usage_reset();
444 rtems_cpu_usage_reset();
444 maxCount = 0;
445 maxCount = 0;
445 #endif
446 #endif
446 status = restart_science_tasks();
447 status = restart_science_tasks();
447 launch_waveform_picker( mode );
448 launch_waveform_picker( mode );
448 //launch_spectral_matrix( mode );
449 launch_spectral_matrix( mode );
449 }
450 }
450 else if ( mode == LFR_MODE_STANDBY )
451 else if ( mode == LFR_MODE_STANDBY )
451 {
452 {
452 #ifdef PRINT_TASK_STATISTICS
453 #ifdef PRINT_TASK_STATISTICS
453 rtems_cpu_usage_report();
454 rtems_cpu_usage_report();
454 #endif
455 #endif
455
456
456 #ifdef PRINT_STACK_REPORT
457 #ifdef PRINT_STACK_REPORT
457 rtems_stack_checker_report_usage();
458 rtems_stack_checker_report_usage();
458 #endif
459 #endif
459 status = stop_current_mode();
460 status = stop_current_mode();
460 PRINTF1("maxCount = %d\n", maxCount)
461 PRINTF1("maxCount = %d\n", maxCount)
461 }
462 }
462 else
463 else
463 {
464 {
464 status = RTEMS_UNSATISFIED;
465 status = RTEMS_UNSATISFIED;
465 }
466 }
466
467
467 if (status != RTEMS_SUCCESSFUL)
468 if (status != RTEMS_SUCCESSFUL)
468 {
469 {
469 PRINTF1("in enter_mode *** ERR = %d\n", status)
470 PRINTF1("in enter_mode *** ERR = %d\n", status)
470 status = RTEMS_UNSATISFIED;
471 status = RTEMS_UNSATISFIED;
471 }
472 }
472
473
473 return status;
474 return status;
474 }
475 }
475
476
476 int restart_science_tasks()
477 int restart_science_tasks()
477 {
478 {
478 /** This function is used to restart all science tasks.
479 /** This function is used to restart all science tasks.
479 *
480 *
480 * @return RTEMS directive status codes:
481 * @return RTEMS directive status codes:
481 * - RTEMS_SUCCESSFUL - task restarted successfully
482 * - RTEMS_SUCCESSFUL - task restarted successfully
482 * - RTEMS_INVALID_ID - task id invalid
483 * - RTEMS_INVALID_ID - task id invalid
483 * - RTEMS_INCORRECT_STATE - task never started
484 * - RTEMS_INCORRECT_STATE - task never started
484 * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task
485 * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task
485 *
486 *
486 * Science tasks are AVF0, BPF0, WFRM, CWF3, CW2, CWF1
487 * Science tasks are AVF0, BPF0, WFRM, CWF3, CW2, CWF1
487 *
488 *
488 */
489 */
489
490
490 rtems_status_code status[6];
491 rtems_status_code status[6];
491 rtems_status_code ret;
492 rtems_status_code ret;
492
493
493 ret = RTEMS_SUCCESSFUL;
494 ret = RTEMS_SUCCESSFUL;
494
495
495 status[0] = rtems_task_restart( Task_id[TASKID_AVF0], 1 );
496 status[0] = rtems_task_restart( Task_id[TASKID_AVF0], 1 );
496 if (status[0] != RTEMS_SUCCESSFUL)
497 if (status[0] != RTEMS_SUCCESSFUL)
497 {
498 {
498 PRINTF1("in restart_science_task *** 0 ERR %d\n", status[0])
499 PRINTF1("in restart_science_task *** 0 ERR %d\n", status[0])
499 }
500 }
500
501
501 status[2] = rtems_task_restart( Task_id[TASKID_WFRM],1 );
502 status[2] = rtems_task_restart( Task_id[TASKID_WFRM],1 );
502 if (status[2] != RTEMS_SUCCESSFUL)
503 if (status[2] != RTEMS_SUCCESSFUL)
503 {
504 {
504 PRINTF1("in restart_science_task *** 2 ERR %d\n", status[2])
505 PRINTF1("in restart_science_task *** 2 ERR %d\n", status[2])
505 }
506 }
506
507
507 status[3] = rtems_task_restart( Task_id[TASKID_CWF3],1 );
508 status[3] = rtems_task_restart( Task_id[TASKID_CWF3],1 );
508 if (status[3] != RTEMS_SUCCESSFUL)
509 if (status[3] != RTEMS_SUCCESSFUL)
509 {
510 {
510 PRINTF1("in restart_science_task *** 3 ERR %d\n", status[3])
511 PRINTF1("in restart_science_task *** 3 ERR %d\n", status[3])
511 }
512 }
512
513
513 status[4] = rtems_task_restart( Task_id[TASKID_CWF2],1 );
514 status[4] = rtems_task_restart( Task_id[TASKID_CWF2],1 );
514 if (status[4] != RTEMS_SUCCESSFUL)
515 if (status[4] != RTEMS_SUCCESSFUL)
515 {
516 {
516 PRINTF1("in restart_science_task *** 4 ERR %d\n", status[4])
517 PRINTF1("in restart_science_task *** 4 ERR %d\n", status[4])
517 }
518 }
518
519
519 status[5] = rtems_task_restart( Task_id[TASKID_CWF1],1 );
520 status[5] = rtems_task_restart( Task_id[TASKID_CWF1],1 );
520 if (status[5] != RTEMS_SUCCESSFUL)
521 if (status[5] != RTEMS_SUCCESSFUL)
521 {
522 {
522 PRINTF1("in restart_science_task *** 5 ERR %d\n", status[5])
523 PRINTF1("in restart_science_task *** 5 ERR %d\n", status[5])
523 }
524 }
524
525
525 if ( (status[0] != RTEMS_SUCCESSFUL) || (status[2] != RTEMS_SUCCESSFUL) ||
526 if ( (status[0] != RTEMS_SUCCESSFUL) || (status[2] != RTEMS_SUCCESSFUL) ||
526 (status[3] != RTEMS_SUCCESSFUL) || (status[4] != RTEMS_SUCCESSFUL) || (status[5] != RTEMS_SUCCESSFUL) )
527 (status[3] != RTEMS_SUCCESSFUL) || (status[4] != RTEMS_SUCCESSFUL) || (status[5] != RTEMS_SUCCESSFUL) )
527 {
528 {
528 ret = RTEMS_UNSATISFIED;
529 ret = RTEMS_UNSATISFIED;
529 }
530 }
530
531
531 return ret;
532 return ret;
532 }
533 }
533
534
534 int suspend_science_tasks()
535 int suspend_science_tasks()
535 {
536 {
536 /** This function suspends the science tasks.
537 /** This function suspends the science tasks.
537 *
538 *
538 * @return RTEMS directive status codes:
539 * @return RTEMS directive status codes:
539 * - RTEMS_SUCCESSFUL - task restarted successfully
540 * - RTEMS_SUCCESSFUL - task restarted successfully
540 * - RTEMS_INVALID_ID - task id invalid
541 * - RTEMS_INVALID_ID - task id invalid
541 * - RTEMS_ALREADY_SUSPENDED - task already suspended
542 * - RTEMS_ALREADY_SUSPENDED - task already suspended
542 *
543 *
543 */
544 */
544
545
545 rtems_status_code status;
546 rtems_status_code status;
546
547
547 status = rtems_task_suspend( Task_id[TASKID_AVF0] );
548 status = rtems_task_suspend( Task_id[TASKID_AVF0] );
548 if (status != RTEMS_SUCCESSFUL)
549 if (status != RTEMS_SUCCESSFUL)
549 {
550 {
550 PRINTF1("in suspend_science_task *** AVF0 ERR %d\n", status)
551 PRINTF1("in suspend_science_task *** AVF0 ERR %d\n", status)
551 }
552 }
552
553
553 if (status == RTEMS_SUCCESSFUL) // suspend WFRM
554 if (status == RTEMS_SUCCESSFUL) // suspend WFRM
554 {
555 {
555 status = rtems_task_suspend( Task_id[TASKID_WFRM] );
556 status = rtems_task_suspend( Task_id[TASKID_WFRM] );
556 if (status != RTEMS_SUCCESSFUL)
557 if (status != RTEMS_SUCCESSFUL)
557 {
558 {
558 PRINTF1("in suspend_science_task *** WFRM ERR %d\n", status)
559 PRINTF1("in suspend_science_task *** WFRM ERR %d\n", status)
559 }
560 }
560 }
561 }
561
562
562 if (status == RTEMS_SUCCESSFUL) // suspend CWF3
563 if (status == RTEMS_SUCCESSFUL) // suspend CWF3
563 {
564 {
564 status = rtems_task_suspend( Task_id[TASKID_CWF3] );
565 status = rtems_task_suspend( Task_id[TASKID_CWF3] );
565 if (status != RTEMS_SUCCESSFUL)
566 if (status != RTEMS_SUCCESSFUL)
566 {
567 {
567 PRINTF1("in suspend_science_task *** CWF3 ERR %d\n", status)
568 PRINTF1("in suspend_science_task *** CWF3 ERR %d\n", status)
568 }
569 }
569 }
570 }
570
571
571 if (status == RTEMS_SUCCESSFUL) // suspend CWF2
572 if (status == RTEMS_SUCCESSFUL) // suspend CWF2
572 {
573 {
573 status = rtems_task_suspend( Task_id[TASKID_CWF2] );
574 status = rtems_task_suspend( Task_id[TASKID_CWF2] );
574 if (status != RTEMS_SUCCESSFUL)
575 if (status != RTEMS_SUCCESSFUL)
575 {
576 {
576 PRINTF1("in suspend_science_task *** CWF2 ERR %d\n", status)
577 PRINTF1("in suspend_science_task *** CWF2 ERR %d\n", status)
577 }
578 }
578 }
579 }
579
580
580 if (status == RTEMS_SUCCESSFUL) // suspend CWF1
581 if (status == RTEMS_SUCCESSFUL) // suspend CWF1
581 {
582 {
582 status = rtems_task_suspend( Task_id[TASKID_CWF1] );
583 status = rtems_task_suspend( Task_id[TASKID_CWF1] );
583 if (status != RTEMS_SUCCESSFUL)
584 if (status != RTEMS_SUCCESSFUL)
584 {
585 {
585 PRINTF1("in suspend_science_task *** CWF1 ERR %d\n", status)
586 PRINTF1("in suspend_science_task *** CWF1 ERR %d\n", status)
586 }
587 }
587 }
588 }
588
589
589 return status;
590 return status;
590 }
591 }
591
592
592 void launch_waveform_picker( unsigned char mode )
593 void launch_waveform_picker( unsigned char mode )
593 {
594 {
594 int startDate;
595 int startDate;
595
596
596 reset_current_ring_nodes();
597 reset_current_ring_nodes();
597 reset_waveform_picker_regs();
598 reset_waveform_picker_regs();
598 set_wfp_burst_enable_register( mode );
599 set_wfp_burst_enable_register( mode );
599 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER );
600 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER );
600 LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER );
601 LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER );
601 startDate = time_management_regs->coarse_time + 2;
602 startDate = time_management_regs->coarse_time + 2;
602 waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x80; // [1000 0000]
603 waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x80; // [1000 0000]
603 waveform_picker_regs->start_date = startDate;
604 waveform_picker_regs->start_date = startDate;
604 }
605 }
605
606
606 void launch_spectral_matrix( unsigned char mode )
607 void launch_spectral_matrix( unsigned char mode )
607 {
608 {
608 reset_nb_sm_f0();
609 reset_nb_sm_f0();
609 reset_current_sm_ring_nodes();
610 reset_current_sm_ring_nodes();
610 reset_spectral_matrix_regs();
611 reset_spectral_matrix_regs();
611
612
613 enable_irq_on_new_ready_matrix();
614
615 LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX );
616 LEON_Unmask_interrupt( IRQ_SPECTRAL_MATRIX );
617 }
618
619 void enable_irq_on_new_ready_matrix( void )
620 {
621 spectral_matrix_regs->config = spectral_matrix_regs->config | 0x01;
622 }
623
624 void disable_irq_on_new_ready_matrix( void )
625 {
626 spectral_matrix_regs->config = spectral_matrix_regs->config & 0xfffffffe; // 1110
627 }
628
629
630 void launch_spectral_matrix_simu( unsigned char mode )
631 {
632 reset_nb_sm_f0();
633 reset_current_sm_ring_nodes();
634 reset_spectral_matrix_regs();
635
612 // Spectral Matrices simulator
636 // Spectral Matrices simulator
613 timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR );
637 timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR );
614 LEON_Clear_interrupt( IRQ_SM_SIMULATOR );
638 LEON_Clear_interrupt( IRQ_SM_SIMULATOR );
615 LEON_Unmask_interrupt( IRQ_SM_SIMULATOR );
639 LEON_Unmask_interrupt( IRQ_SM_SIMULATOR );
616 set_local_nb_interrupt_f0_MAX();
640 set_local_nb_interrupt_f0_MAX();
617 }
641 }
618
642
619 //****************
643 //****************
620 // CLOSING ACTIONS
644 // CLOSING ACTIONS
621 void update_last_TC_exe(ccsdsTelecommandPacket_t *TC, unsigned char *time)
645 void update_last_TC_exe(ccsdsTelecommandPacket_t *TC, unsigned char *time)
622 {
646 {
623 /** This function is used to update the HK packets statistics after a successful TC execution.
647 /** This function is used to update the HK packets statistics after a successful TC execution.
624 *
648 *
625 * @param TC points to the TC being processed
649 * @param TC points to the TC being processed
626 * @param time is the time used to date the TC execution
650 * @param time is the time used to date the TC execution
627 *
651 *
628 */
652 */
629
653
630 housekeeping_packet.hk_lfr_last_exe_tc_id[0] = TC->packetID[0];
654 housekeeping_packet.hk_lfr_last_exe_tc_id[0] = TC->packetID[0];
631 housekeeping_packet.hk_lfr_last_exe_tc_id[1] = TC->packetID[1];
655 housekeeping_packet.hk_lfr_last_exe_tc_id[1] = TC->packetID[1];
632 housekeeping_packet.hk_lfr_last_exe_tc_type[0] = 0x00;
656 housekeeping_packet.hk_lfr_last_exe_tc_type[0] = 0x00;
633 housekeeping_packet.hk_lfr_last_exe_tc_type[1] = TC->serviceType;
657 housekeeping_packet.hk_lfr_last_exe_tc_type[1] = TC->serviceType;
634 housekeeping_packet.hk_lfr_last_exe_tc_subtype[0] = 0x00;
658 housekeeping_packet.hk_lfr_last_exe_tc_subtype[0] = 0x00;
635 housekeeping_packet.hk_lfr_last_exe_tc_subtype[1] = TC->serviceSubType;
659 housekeeping_packet.hk_lfr_last_exe_tc_subtype[1] = TC->serviceSubType;
636 housekeeping_packet.hk_lfr_last_exe_tc_time[0] = time[0];
660 housekeeping_packet.hk_lfr_last_exe_tc_time[0] = time[0];
637 housekeeping_packet.hk_lfr_last_exe_tc_time[1] = time[1];
661 housekeeping_packet.hk_lfr_last_exe_tc_time[1] = time[1];
638 housekeeping_packet.hk_lfr_last_exe_tc_time[2] = time[2];
662 housekeeping_packet.hk_lfr_last_exe_tc_time[2] = time[2];
639 housekeeping_packet.hk_lfr_last_exe_tc_time[3] = time[3];
663 housekeeping_packet.hk_lfr_last_exe_tc_time[3] = time[3];
640 housekeeping_packet.hk_lfr_last_exe_tc_time[4] = time[4];
664 housekeeping_packet.hk_lfr_last_exe_tc_time[4] = time[4];
641 housekeeping_packet.hk_lfr_last_exe_tc_time[5] = time[5];
665 housekeeping_packet.hk_lfr_last_exe_tc_time[5] = time[5];
642 }
666 }
643
667
644 void update_last_TC_rej(ccsdsTelecommandPacket_t *TC, unsigned char *time)
668 void update_last_TC_rej(ccsdsTelecommandPacket_t *TC, unsigned char *time)
645 {
669 {
646 /** This function is used to update the HK packets statistics after a TC rejection.
670 /** This function is used to update the HK packets statistics after a TC rejection.
647 *
671 *
648 * @param TC points to the TC being processed
672 * @param TC points to the TC being processed
649 * @param time is the time used to date the TC rejection
673 * @param time is the time used to date the TC rejection
650 *
674 *
651 */
675 */
652
676
653 housekeeping_packet.hk_lfr_last_rej_tc_id[0] = TC->packetID[0];
677 housekeeping_packet.hk_lfr_last_rej_tc_id[0] = TC->packetID[0];
654 housekeeping_packet.hk_lfr_last_rej_tc_id[1] = TC->packetID[1];
678 housekeeping_packet.hk_lfr_last_rej_tc_id[1] = TC->packetID[1];
655 housekeeping_packet.hk_lfr_last_rej_tc_type[0] = 0x00;
679 housekeeping_packet.hk_lfr_last_rej_tc_type[0] = 0x00;
656 housekeeping_packet.hk_lfr_last_rej_tc_type[1] = TC->serviceType;
680 housekeeping_packet.hk_lfr_last_rej_tc_type[1] = TC->serviceType;
657 housekeeping_packet.hk_lfr_last_rej_tc_subtype[0] = 0x00;
681 housekeeping_packet.hk_lfr_last_rej_tc_subtype[0] = 0x00;
658 housekeeping_packet.hk_lfr_last_rej_tc_subtype[1] = TC->serviceSubType;
682 housekeeping_packet.hk_lfr_last_rej_tc_subtype[1] = TC->serviceSubType;
659 housekeeping_packet.hk_lfr_last_rej_tc_time[0] = time[0];
683 housekeeping_packet.hk_lfr_last_rej_tc_time[0] = time[0];
660 housekeeping_packet.hk_lfr_last_rej_tc_time[1] = time[1];
684 housekeeping_packet.hk_lfr_last_rej_tc_time[1] = time[1];
661 housekeeping_packet.hk_lfr_last_rej_tc_time[2] = time[2];
685 housekeeping_packet.hk_lfr_last_rej_tc_time[2] = time[2];
662 housekeeping_packet.hk_lfr_last_rej_tc_time[3] = time[3];
686 housekeeping_packet.hk_lfr_last_rej_tc_time[3] = time[3];
663 housekeeping_packet.hk_lfr_last_rej_tc_time[4] = time[4];
687 housekeeping_packet.hk_lfr_last_rej_tc_time[4] = time[4];
664 housekeeping_packet.hk_lfr_last_rej_tc_time[5] = time[5];
688 housekeeping_packet.hk_lfr_last_rej_tc_time[5] = time[5];
665 }
689 }
666
690
667 void close_action(ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id, unsigned char *time)
691 void close_action(ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id, unsigned char *time)
668 {
692 {
669 /** This function is the last step of the TC execution workflow.
693 /** This function is the last step of the TC execution workflow.
670 *
694 *
671 * @param TC points to the TC being processed
695 * @param TC points to the TC being processed
672 * @param result is the result of the TC execution (LFR_SUCCESSFUL / LFR_DEFAULT)
696 * @param result is the result of the TC execution (LFR_SUCCESSFUL / LFR_DEFAULT)
673 * @param queue_id is the id of the RTEMS message queue used to send TM packets
697 * @param queue_id is the id of the RTEMS message queue used to send TM packets
674 * @param time is the time used to date the TC execution
698 * @param time is the time used to date the TC execution
675 *
699 *
676 */
700 */
677
701
678 unsigned int val = 0;
702 unsigned int val = 0;
679
703
680 if (result == LFR_SUCCESSFUL)
704 if (result == LFR_SUCCESSFUL)
681 {
705 {
682 if ( !( (TC->serviceType==TC_TYPE_TIME) && (TC->serviceSubType==TC_SUBTYPE_UPDT_TIME) )
706 if ( !( (TC->serviceType==TC_TYPE_TIME) && (TC->serviceSubType==TC_SUBTYPE_UPDT_TIME) )
683 &&
707 &&
684 !( (TC->serviceType==TC_TYPE_GEN) && (TC->serviceSubType==TC_SUBTYPE_UPDT_INFO))
708 !( (TC->serviceType==TC_TYPE_GEN) && (TC->serviceSubType==TC_SUBTYPE_UPDT_INFO))
685 )
709 )
686 {
710 {
687 send_tm_lfr_tc_exe_success( TC, queue_id, time );
711 send_tm_lfr_tc_exe_success( TC, queue_id, time );
688 }
712 }
689 update_last_TC_exe( TC, time );
713 update_last_TC_exe( TC, time );
690 val = housekeeping_packet.hk_lfr_exe_tc_cnt[0] * 256 + housekeeping_packet.hk_lfr_exe_tc_cnt[1];
714 val = housekeeping_packet.hk_lfr_exe_tc_cnt[0] * 256 + housekeeping_packet.hk_lfr_exe_tc_cnt[1];
691 val++;
715 val++;
692 housekeeping_packet.hk_lfr_exe_tc_cnt[0] = (unsigned char) (val >> 8);
716 housekeeping_packet.hk_lfr_exe_tc_cnt[0] = (unsigned char) (val >> 8);
693 housekeeping_packet.hk_lfr_exe_tc_cnt[1] = (unsigned char) (val);
717 housekeeping_packet.hk_lfr_exe_tc_cnt[1] = (unsigned char) (val);
694 }
718 }
695 else
719 else
696 {
720 {
697 update_last_TC_rej( TC, time );
721 update_last_TC_rej( TC, time );
698 val = housekeeping_packet.hk_lfr_rej_tc_cnt[0] * 256 + housekeeping_packet.hk_lfr_rej_tc_cnt[1];
722 val = housekeeping_packet.hk_lfr_rej_tc_cnt[0] * 256 + housekeeping_packet.hk_lfr_rej_tc_cnt[1];
699 val++;
723 val++;
700 housekeeping_packet.hk_lfr_rej_tc_cnt[0] = (unsigned char) (val >> 8);
724 housekeeping_packet.hk_lfr_rej_tc_cnt[0] = (unsigned char) (val >> 8);
701 housekeeping_packet.hk_lfr_rej_tc_cnt[1] = (unsigned char) (val);
725 housekeeping_packet.hk_lfr_rej_tc_cnt[1] = (unsigned char) (val);
702 }
726 }
703 }
727 }
704
728
705 //***************************
729 //***************************
706 // Interrupt Service Routines
730 // Interrupt Service Routines
707 rtems_isr commutation_isr1( rtems_vector_number vector )
731 rtems_isr commutation_isr1( rtems_vector_number vector )
708 {
732 {
709 if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
733 if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
710 printf("In commutation_isr1 *** Error sending event to DUMB\n");
734 printf("In commutation_isr1 *** Error sending event to DUMB\n");
711 }
735 }
712 }
736 }
713
737
714 rtems_isr commutation_isr2( rtems_vector_number vector )
738 rtems_isr commutation_isr2( rtems_vector_number vector )
715 {
739 {
716 if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
740 if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
717 printf("In commutation_isr2 *** Error sending event to DUMB\n");
741 printf("In commutation_isr2 *** Error sending event to DUMB\n");
718 }
742 }
719 }
743 }
720
744
721 //****************
745 //****************
722 // OTHER FUNCTIONS
746 // OTHER FUNCTIONS
723 void updateLFRCurrentMode()
747 void updateLFRCurrentMode()
724 {
748 {
725 /** This function updates the value of the global variable lfrCurrentMode.
749 /** This function updates the value of the global variable lfrCurrentMode.
726 *
750 *
727 * lfrCurrentMode is a parameter used by several functions to know in which mode LFR is running.
751 * lfrCurrentMode is a parameter used by several functions to know in which mode LFR is running.
728 *
752 *
729 */
753 */
730 // update the local value of lfrCurrentMode with the value contained in the housekeeping_packet structure
754 // update the local value of lfrCurrentMode with the value contained in the housekeeping_packet structure
731 lfrCurrentMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
755 lfrCurrentMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
732 }
756 }
733
757
General Comments 0
You need to be logged in to leave comments. Login now