##// END OF EJS Templates
Sync...
paul -
r117:7ccc2641c507 VHDLib206
parent child
Show More
@@ -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.1, 2014-04-07T06:54:09. -->
3 <!-- Written by QtCreator 3.0.1, 2014-04-11T12:08:35. -->
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,660 +1,660
1 #ifndef CCSDS_TYPES_H_INCLUDED
1 #ifndef CCSDS_TYPES_H_INCLUDED
2 #define CCSDS_TYPES_H_INCLUDED
2 #define CCSDS_TYPES_H_INCLUDED
3
3
4 #include "fsw_params_processing.h"
4 #include "fsw_params_processing.h"
5
5
6 #define CCSDS_PROTOCOLE_EXTRA_BYTES 4
6 #define CCSDS_PROTOCOLE_EXTRA_BYTES 4
7 #define CCSDS_TC_TM_PACKET_OFFSET 7
7 #define CCSDS_TC_TM_PACKET_OFFSET 7
8 #define CCSDS_TELEMETRY_HEADER_LENGTH 16+4
8 #define CCSDS_TELEMETRY_HEADER_LENGTH 16+4
9 #define CCSDS_TM_PKT_MAX_SIZE 4412
9 #define CCSDS_TM_PKT_MAX_SIZE 4412
10 #define CCSDS_TELECOMMAND_HEADER_LENGTH 10+4
10 #define CCSDS_TELECOMMAND_HEADER_LENGTH 10+4
11 #define CCSDS_TC_PKT_MAX_SIZE 256
11 #define CCSDS_TC_PKT_MAX_SIZE 256
12 #define CCSDS_TC_PKT_MIN_SIZE 16
12 #define CCSDS_TC_PKT_MIN_SIZE 16
13 #define CCSDS_PROCESS_ID 76
13 #define CCSDS_PROCESS_ID 76
14 #define CCSDS_PACKET_CATEGORY 12
14 #define CCSDS_PACKET_CATEGORY 12
15 #define CCSDS_NODE_ADDRESS 0xfe
15 #define CCSDS_NODE_ADDRESS 0xfe
16 #define CCSDS_USER_APP 0x00
16 #define CCSDS_USER_APP 0x00
17
17
18 #define DEFAULT_SPARE1_PUSVERSION_SPARE2 0x10
18 #define DEFAULT_SPARE1_PUSVERSION_SPARE2 0x10
19 #define DEFAULT_RESERVED 0x00
19 #define DEFAULT_RESERVED 0x00
20 #define DEFAULT_HKBIA 0x1e // 0001 1110
20 #define DEFAULT_HKBIA 0x1e // 0001 1110
21
21
22 // PACKET ID
22 // PACKET ID
23 #define APID_TM_TC_EXE 0x0cc1 // PID 76 CAT 1
23 #define APID_TM_TC_EXE 0x0cc1 // PID 76 CAT 1
24 #define APID_TM_HK 0x0cc4 // PID 76 CAT 4
24 #define APID_TM_HK 0x0cc4 // PID 76 CAT 4
25 #define APID_TM_PARAMETER_DUMP 0x0cc9 // PID 76 CAT 9
25 #define APID_TM_PARAMETER_DUMP 0x0cc9 // PID 76 CAT 9
26 #define APID_TM_SCIENCE_NORMAL_BURST 0x0ccc // PID 76 CAT 12
26 #define APID_TM_SCIENCE_NORMAL_BURST 0x0ccc // PID 76 CAT 12
27 #define APID_TM_SCIENCE_SBM1_SBM2 0x0cfc // PID 79 CAT 12
27 #define APID_TM_SCIENCE_SBM1_SBM2 0x0cfc // PID 79 CAT 12
28 #define TM_PACKET_PID_DEFAULT 76
28 #define TM_PACKET_PID_DEFAULT 76
29 #define TM_PACKET_PID_BURST_SBM1_SBM2 79
29 #define TM_PACKET_PID_BURST_SBM1_SBM2 79
30 #define TM_PACKET_CAT_TC_EXE 1
30 #define TM_PACKET_CAT_TC_EXE 1
31 #define TM_PACKET_CAT_HK 4
31 #define TM_PACKET_CAT_HK 4
32 #define TM_PACKET_CAT_PARAMETER_DUMP 9
32 #define TM_PACKET_CAT_PARAMETER_DUMP 9
33 #define TM_PACKET_CAT_SCIENCE 12
33 #define TM_PACKET_CAT_SCIENCE 12
34 #define TC_PACKET_CAT 12
34 #define TC_PACKET_CAT 12
35
35
36 // PACKET SEQUENCE CONTROL
36 // PACKET SEQUENCE CONTROL
37 #define TM_PACKET_SEQ_CTRL_CONTINUATION 0x00 // [0000 0000]
37 #define TM_PACKET_SEQ_CTRL_CONTINUATION 0x00 // [0000 0000]
38 #define TM_PACKET_SEQ_CTRL_FIRST 0x40 // [0100 0000]
38 #define TM_PACKET_SEQ_CTRL_FIRST 0x40 // [0100 0000]
39 #define TM_PACKET_SEQ_CTRL_LAST 0x80 // [1000 0000]
39 #define TM_PACKET_SEQ_CTRL_LAST 0x80 // [1000 0000]
40 #define TM_PACKET_SEQ_CTRL_STANDALONE 0xc0 // [1100 0000]
40 #define TM_PACKET_SEQ_CTRL_STANDALONE 0xc0 // [1100 0000]
41 #define TM_PACKET_SEQ_CNT_DEFAULT 0x00 // [0000 0000]
41 #define TM_PACKET_SEQ_CNT_DEFAULT 0x00 // [0000 0000]
42
42
43 // DESTINATION ID
43 // DESTINATION ID
44 #define TM_DESTINATION_ID_GROUND 0
44 #define TM_DESTINATION_ID_GROUND 0
45 #define TM_DESTINATION_ID_MISSION_TIMELINE 110
45 #define TM_DESTINATION_ID_MISSION_TIMELINE 110
46 #define TM_DESTINATION_ID_TC_SEQUENCES 111
46 #define TM_DESTINATION_ID_TC_SEQUENCES 111
47 #define TM_DESTINATION_ID_RECOVERY_ACTION_COMMAND 112
47 #define TM_DESTINATION_ID_RECOVERY_ACTION_COMMAND 112
48 #define TM_DESTINATION_ID_BACKUP_MISSION_TIMELINE 113
48 #define TM_DESTINATION_ID_BACKUP_MISSION_TIMELINE 113
49 #define TM_DESTINATION_ID_DIRECT_CMD 120
49 #define TM_DESTINATION_ID_DIRECT_CMD 120
50 #define TM_DESTINATION_ID_SPARE_GRD_SRC1 121
50 #define TM_DESTINATION_ID_SPARE_GRD_SRC1 121
51 #define TM_DESTINATION_ID_SPARE_GRD_SRC2 122
51 #define TM_DESTINATION_ID_SPARE_GRD_SRC2 122
52 #define TM_DESTINATION_ID_OBCP 15
52 #define TM_DESTINATION_ID_OBCP 15
53 #define TM_DESTINATION_ID_SYSTEM_CONTROL 14
53 #define TM_DESTINATION_ID_SYSTEM_CONTROL 14
54 #define TM_DESTINATION_ID_AOCS 11
54 #define TM_DESTINATION_ID_AOCS 11
55
55
56 #define CCSDS_DESTINATION_ID 0x01
56 #define CCSDS_DESTINATION_ID 0x01
57 #define CCSDS_PROTOCOLE_ID 0x02
57 #define CCSDS_PROTOCOLE_ID 0x02
58 #define CCSDS_RESERVED 0x00
58 #define CCSDS_RESERVED 0x00
59 #define CCSDS_USER_APP 0x00
59 #define CCSDS_USER_APP 0x00
60
60
61 #define SIZE_TM_LFR_TC_EXE_NOT_IMPLEMENTED 24
61 #define SIZE_TM_LFR_TC_EXE_NOT_IMPLEMENTED 24
62 #define SIZE_TM_LFR_TC_EXE_CORRUPTED 32
62 #define SIZE_TM_LFR_TC_EXE_CORRUPTED 32
63 #define SIZE_HK_PARAMETERS 112
63 #define SIZE_HK_PARAMETERS 112
64
64
65 // TC TYPES
65 // TC TYPES
66 #define TC_TYPE_GEN 181
66 #define TC_TYPE_GEN 181
67 #define TC_TYPE_TIME 9
67 #define TC_TYPE_TIME 9
68
68
69 // TC SUBTYPES
69 // TC SUBTYPES
70 #define TC_SUBTYPE_RESET 1
70 #define TC_SUBTYPE_RESET 1
71 #define TC_SUBTYPE_LOAD_COMM 11
71 #define TC_SUBTYPE_LOAD_COMM 11
72 #define TC_SUBTYPE_LOAD_NORM 13
72 #define TC_SUBTYPE_LOAD_NORM 13
73 #define TC_SUBTYPE_LOAD_BURST 19
73 #define TC_SUBTYPE_LOAD_BURST 19
74 #define TC_SUBTYPE_LOAD_SBM1 25
74 #define TC_SUBTYPE_LOAD_SBM1 25
75 #define TC_SUBTYPE_LOAD_SBM2 27
75 #define TC_SUBTYPE_LOAD_SBM2 27
76 #define TC_SUBTYPE_DUMP 31
76 #define TC_SUBTYPE_DUMP 31
77 #define TC_SUBTYPE_ENTER 41
77 #define TC_SUBTYPE_ENTER 41
78 #define TC_SUBTYPE_UPDT_INFO 51
78 #define TC_SUBTYPE_UPDT_INFO 51
79 #define TC_SUBTYPE_EN_CAL 61
79 #define TC_SUBTYPE_EN_CAL 61
80 #define TC_SUBTYPE_DIS_CAL 63
80 #define TC_SUBTYPE_DIS_CAL 63
81 #define TC_SUBTYPE_UPDT_TIME 129
81 #define TC_SUBTYPE_UPDT_TIME 129
82
82
83 // TC LEN
83 // TC LEN
84 #define TC_LEN_RESET 12
84 #define TC_LEN_RESET 12
85 #define TC_LEN_LOAD_COMM 14
85 #define TC_LEN_LOAD_COMM 14
86 #define TC_LEN_LOAD_NORM 22
86 #define TC_LEN_LOAD_NORM 22
87 #define TC_LEN_LOAD_BURST 14
87 #define TC_LEN_LOAD_BURST 14
88 #define TC_LEN_LOAD_SBM1 14
88 #define TC_LEN_LOAD_SBM1 14
89 #define TC_LEN_LOAD_SBM2 14
89 #define TC_LEN_LOAD_SBM2 14
90 #define TC_LEN_DUMP 12
90 #define TC_LEN_DUMP 12
91 #define TC_LEN_ENTER 20
91 #define TC_LEN_ENTER 20
92 #define TC_LEN_UPDT_INFO 46
92 #define TC_LEN_UPDT_INFO 46
93 #define TC_LEN_EN_CAL 12
93 #define TC_LEN_EN_CAL 12
94 #define TC_LEN_DIS_CAL 12
94 #define TC_LEN_DIS_CAL 12
95 #define TC_LEN_UPDT_TIME 18
95 #define TC_LEN_UPDT_TIME 18
96
96
97 // TM TYPES
97 // TM TYPES
98 #define TM_TYPE_TC_EXE 1
98 #define TM_TYPE_TC_EXE 1
99 #define TM_TYPE_HK 3
99 #define TM_TYPE_HK 3
100 #define TM_TYPE_PARAMETER_DUMP 3
100 #define TM_TYPE_PARAMETER_DUMP 3
101 #define TM_TYPE_LFR_SCIENCE 21
101 #define TM_TYPE_LFR_SCIENCE 21
102
102
103 // TM SUBTYPES
103 // TM SUBTYPES
104 #define TM_SUBTYPE_EXE_OK 7
104 #define TM_SUBTYPE_EXE_OK 7
105 #define TM_SUBTYPE_EXE_NOK 8
105 #define TM_SUBTYPE_EXE_NOK 8
106 #define TM_SUBTYPE_HK 25
106 #define TM_SUBTYPE_HK 25
107 #define TM_SUBTYPE_PARAMETER_DUMP 25
107 #define TM_SUBTYPE_PARAMETER_DUMP 25
108 #define TM_SUBTYPE_SCIENCE 3
108 #define TM_SUBTYPE_SCIENCE 3
109 #define TM_SUBTYPE_LFR_SCIENCE 3
109 #define TM_SUBTYPE_LFR_SCIENCE 3
110
110
111 // FAILURE CODES
111 // FAILURE CODES
112 #define ILLEGAL_APID 0
112 #define ILLEGAL_APID 0
113 #define WRONG_LEN_PKT 1
113 #define WRONG_LEN_PKT 1
114 #define INCOR_CHECKSUM 2
114 #define INCOR_CHECKSUM 2
115 #define ILL_TYPE 3
115 #define ILL_TYPE 3
116 #define ILL_SUBTYPE 4
116 #define ILL_SUBTYPE 4
117 #define WRONG_APP_DATA 5 // 0x00 0x05
117 #define WRONG_APP_DATA 5 // 0x00 0x05
118 #define TC_NOT_EXE 42000 // 0xa4 0x10
118 #define TC_NOT_EXE 42000 // 0xa4 0x10
119 #define WRONG_SRC_ID 42001 // 0xa4 0x11
119 #define WRONG_SRC_ID 42001 // 0xa4 0x11
120 #define FUNCT_NOT_IMPL 42002 // 0xa4 0x12
120 #define FUNCT_NOT_IMPL 42002 // 0xa4 0x12
121 #define FAIL_DETECTED 42003 // 0xa4 0x13
121 #define FAIL_DETECTED 42003 // 0xa4 0x13
122 #define NOT_ALLOWED 42004 // 0xa4 0x14
122 #define NOT_ALLOWED 42004 // 0xa4 0x14
123 #define CORRUPTED 42005 // 0xa4 0x15
123 #define CORRUPTED 42005 // 0xa4 0x15
124 #define CCSDS_TM_VALID 7
124 #define CCSDS_TM_VALID 7
125
125
126 // TC SID
126 // TC SID
127 #define SID_TC_GROUND 0
127 #define SID_TC_GROUND 0
128 #define SID_TC_MISSION_TIMELINE 110
128 #define SID_TC_MISSION_TIMELINE 110
129 #define SID_TC_TC_SEQUENCES 111
129 #define SID_TC_TC_SEQUENCES 111
130 #define SID_TC_RECOVERY_ACTION_CMD 112
130 #define SID_TC_RECOVERY_ACTION_CMD 112
131 #define SID_TC_BACKUP_MISSION_TIMELINE 113
131 #define SID_TC_BACKUP_MISSION_TIMELINE 113
132 #define SID_TC_DIRECT_CMD 120
132 #define SID_TC_DIRECT_CMD 120
133 #define SID_TC_SPARE_GRD_SRC1 121
133 #define SID_TC_SPARE_GRD_SRC1 121
134 #define SID_TC_SPARE_GRD_SRC2 122
134 #define SID_TC_SPARE_GRD_SRC2 122
135 #define SID_TC_OBCP 15
135 #define SID_TC_OBCP 15
136 #define SID_TC_SYSTEM_CONTROL 14
136 #define SID_TC_SYSTEM_CONTROL 14
137 #define SID_TC_AOCS 11
137 #define SID_TC_AOCS 11
138 #define SID_TC_RPW_INTERNAL 254
138 #define SID_TC_RPW_INTERNAL 254
139
139
140 enum apid_destid{
140 enum apid_destid{
141 GROUND,
141 GROUND,
142 MISSION_TIMELINE,
142 MISSION_TIMELINE,
143 TC_SEQUENCES,
143 TC_SEQUENCES,
144 RECOVERY_ACTION_CMD,
144 RECOVERY_ACTION_CMD,
145 BACKUP_MISSION_TIMELINE,
145 BACKUP_MISSION_TIMELINE,
146 DIRECT_CMD,
146 DIRECT_CMD,
147 SPARE_GRD_SRC1,
147 SPARE_GRD_SRC1,
148 SPARE_GRD_SRC2,
148 SPARE_GRD_SRC2,
149 OBCP,
149 OBCP,
150 SYSTEM_CONTROL,
150 SYSTEM_CONTROL,
151 AOCS,
151 AOCS,
152 RPW_INTERNAL
152 RPW_INTERNAL
153 };
153 };
154 // SEQUENCE COUNTERS
154 // SEQUENCE COUNTERS
155 #define SEQ_CNT_MAX 16383
155 #define SEQ_CNT_MAX 16383
156 #define SEQ_CNT_NB_DEST_ID 12
156 #define SEQ_CNT_NB_DEST_ID 12
157
157
158 // TM SID
158 // TM SID
159 #define SID_HK 1
159 #define SID_HK 1
160 #define SID_PARAMETER_DUMP 10
160 #define SID_PARAMETER_DUMP 10
161
161
162 #define SID_NORM_SWF_F0 3
162 #define SID_NORM_SWF_F0 3
163 #define SID_NORM_SWF_F1 4
163 #define SID_NORM_SWF_F1 4
164 #define SID_NORM_SWF_F2 5
164 #define SID_NORM_SWF_F2 5
165 #define SID_NORM_CWF_F3 1
165 #define SID_NORM_CWF_F3 1
166 #define SID_BURST_CWF_F2 2
166 #define SID_BURST_CWF_F2 2
167 #define SID_SBM1_CWF_F1 24
167 #define SID_SBM1_CWF_F1 24
168 #define SID_SBM2_CWF_F2 25
168 #define SID_SBM2_CWF_F2 25
169 #define SID_NORM_ASM_F0 11
169 #define SID_NORM_ASM_F0 11
170 #define SID_NORM_ASM_F1 12
170 #define SID_NORM_ASM_F1 12
171 #define SID_NORM_ASM_F2 13
171 #define SID_NORM_ASM_F2 13
172 #define SID_NORM_BP1_F0 14
172 #define SID_NORM_BP1_F0 14
173 #define SID_NORM_BP1_F1 15
173 #define SID_NORM_BP1_F1 15
174 #define SID_NORM_BP1_F2 16
174 #define SID_NORM_BP1_F2 16
175 #define SID_NORM_BP2_F0 19
175 #define SID_NORM_BP2_F0 19
176 #define SID_NORM_BP2_F1 20
176 #define SID_NORM_BP2_F1 20
177 #define SID_NORM_BP2_F2 21
177 #define SID_NORM_BP2_F2 21
178 #define SID_BURST_BP1_F0 17
178 #define SID_BURST_BP1_F0 17
179 #define SID_BURST_BP2_F0 22
179 #define SID_BURST_BP2_F0 22
180 #define SID_BURST_BP1_F1 18
180 #define SID_BURST_BP1_F1 18
181 #define SID_BURST_BP2_F1 23
181 #define SID_BURST_BP2_F1 23
182 #define SID_SBM1_BP1_F0 28
182 #define SID_SBM1_BP1_F0 28
183 #define SID_SBM1_BP2_F0 31
183 #define SID_SBM1_BP2_F0 31
184 #define SID_SBM2_BP1_F0 29
184 #define SID_SBM2_BP1_F0 29
185 #define SID_SBM2_BP2_F0 32
185 #define SID_SBM2_BP2_F0 32
186 #define SID_SBM2_BP1_F1 30
186 #define SID_SBM2_BP1_F1 30
187 #define SID_SBM2_BP2_F1 33
187 #define SID_SBM2_BP2_F1 33
188 #define SID_NORM_CWF_LONG_F3 34
188 #define SID_NORM_CWF_LONG_F3 34
189
189
190 // LENGTH (BYTES)
190 // LENGTH (BYTES)
191 #define LENGTH_TM_LFR_TC_EXE_MAX 32
191 #define LENGTH_TM_LFR_TC_EXE_MAX 32
192 #define LENGTH_TM_LFR_HK 126
192 #define LENGTH_TM_LFR_HK 126
193
193
194 // HEADER_LENGTH
194 // HEADER_LENGTH
195 #define TM_HEADER_LEN 16
195 #define TM_HEADER_LEN 16
196 #define HEADER_LENGTH_TM_LFR_SCIENCE_ASM 28
196 #define HEADER_LENGTH_TM_LFR_SCIENCE_ASM 28
197 // PACKET_LENGTH
197 // PACKET_LENGTH
198 #define PACKET_LENGTH_TC_EXE_SUCCESS (20 - CCSDS_TC_TM_PACKET_OFFSET)
198 #define PACKET_LENGTH_TC_EXE_SUCCESS (20 - CCSDS_TC_TM_PACKET_OFFSET)
199 #define PACKET_LENGTH_TC_EXE_INCONSISTENT (26 - CCSDS_TC_TM_PACKET_OFFSET)
199 #define PACKET_LENGTH_TC_EXE_INCONSISTENT (26 - CCSDS_TC_TM_PACKET_OFFSET)
200 #define PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE (26 - CCSDS_TC_TM_PACKET_OFFSET)
200 #define PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE (26 - CCSDS_TC_TM_PACKET_OFFSET)
201 #define PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED (24 - CCSDS_TC_TM_PACKET_OFFSET)
201 #define PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED (24 - CCSDS_TC_TM_PACKET_OFFSET)
202 #define PACKET_LENGTH_TC_EXE_ERROR (24 - CCSDS_TC_TM_PACKET_OFFSET)
202 #define PACKET_LENGTH_TC_EXE_ERROR (24 - CCSDS_TC_TM_PACKET_OFFSET)
203 #define PACKET_LENGTH_TC_EXE_CORRUPTED (32 - CCSDS_TC_TM_PACKET_OFFSET)
203 #define PACKET_LENGTH_TC_EXE_CORRUPTED (32 - CCSDS_TC_TM_PACKET_OFFSET)
204 #define PACKET_LENGTH_HK (124 - CCSDS_TC_TM_PACKET_OFFSET)
204 #define PACKET_LENGTH_HK (124 - CCSDS_TC_TM_PACKET_OFFSET)
205 #define PACKET_LENGTH_PARAMETER_DUMP (36 - CCSDS_TC_TM_PACKET_OFFSET)
205 #define PACKET_LENGTH_PARAMETER_DUMP (36 - CCSDS_TC_TM_PACKET_OFFSET)
206 #define PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F0 (2228 - CCSDS_TC_TM_PACKET_OFFSET) // 44 * 25 * 2 + 28 - 7
206 #define PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F0 (2228 - CCSDS_TC_TM_PACKET_OFFSET) // 44 * 25 * 2 + 28 - 7
207 #define PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F1 (2628 - CCSDS_TC_TM_PACKET_OFFSET) // 52 * 25 * 2 + 28 - 7
207 #define PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F1 (2628 - CCSDS_TC_TM_PACKET_OFFSET) // 52 * 25 * 2 + 28 - 7
208 #define PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F2 (2428 - CCSDS_TC_TM_PACKET_OFFSET) // 48 * 25 * 2 + 28 - 7
208 #define PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F2 (2428 - CCSDS_TC_TM_PACKET_OFFSET) // 48 * 25 * 2 + 28 - 7
209 #define PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F0 (126 - CCSDS_TC_TM_PACKET_OFFSET) // 11 * 9 + 27 - 7
209 #define PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F0 (126 - CCSDS_TC_TM_PACKET_OFFSET) // 11 * 9 + 27 - 7
210 #define PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F0 (356 - CCSDS_TC_TM_PACKET_OFFSET) // 11 * 30 + 25 - 7
210 #define PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F0 (356 - CCSDS_TC_TM_PACKET_OFFSET) // 11 * 30 + 25 - 7
211 #define PACKET_LENGTH_TM_LFR_SCIENCE_BURST_BP2_F1 (806 - CCSDS_TC_TM_PACKET_OFFSET) // 26 * 30 + 26 - 7
211 #define PACKET_LENGTH_TM_LFR_SCIENCE_BURST_BP2_F1 (806 - CCSDS_TC_TM_PACKET_OFFSET) // 26 * 30 + 26 - 7
212 #define PACKET_LENGTH_TM_LFR_SCIENCE_SBM1_BP1_F0 (224 - CCSDS_TC_TM_PACKET_OFFSET) // 22 * 9 + 26 - 7
212 #define PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0 (224 - CCSDS_TC_TM_PACKET_OFFSET) // 22 * 9 + 26 - 7
213 #define PACKET_LENGTH_TM_LFR_SCIENCE_SBM1_BP2_F0 (686 - CCSDS_TC_TM_PACKET_OFFSET) // 22 * 30 + 26 - 7
213 #define PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0 (686 - CCSDS_TC_TM_PACKET_OFFSET) // 22 * 30 + 26 - 7
214
214
215 #define PACKET_LENGTH_DELTA 11 // 7 + 4
215 #define PACKET_LENGTH_DELTA 11 // 7 + 4
216
216
217 #define SPARE1_PUSVERSION_SPARE2 0x10
217 #define SPARE1_PUSVERSION_SPARE2 0x10
218
218
219 // R1
219 // R1
220 #define TM_LEN_SCI_SWF_340 4101 // 340 * 12 + 10 + 12 - 1
220 #define TM_LEN_SCI_SWF_340 4101 // 340 * 12 + 10 + 12 - 1
221 #define TM_LEN_SCI_SWF_8 117 // 8 * 12 + 10 + 12 - 1
221 #define TM_LEN_SCI_SWF_8 117 // 8 * 12 + 10 + 12 - 1
222 #define TM_LEN_SCI_CWF_340 4099 // 340 * 12 + 10 + 10 - 1
222 #define TM_LEN_SCI_CWF_340 4099 // 340 * 12 + 10 + 10 - 1
223 #define TM_LEN_SCI_CWF_8 115 // 8 * 12 + 10 + 10 - 1
223 #define TM_LEN_SCI_CWF_8 115 // 8 * 12 + 10 + 10 - 1
224 #define TM_LEN_SCI_CWF3_LIGHT_340 2059 // 340 * 6 + 10 + 10 - 1
224 #define TM_LEN_SCI_CWF3_LIGHT_340 2059 // 340 * 6 + 10 + 10 - 1
225 #define TM_LEN_SCI_CWF3_LIGHT_8 67 // 8 * 6 + 10 + 10 - 1
225 #define TM_LEN_SCI_CWF3_LIGHT_8 67 // 8 * 6 + 10 + 10 - 1
226 // R2
226 // R2
227 #define TM_LEN_SCI_SWF_304 3669 // 304 * 12 + 10 + 12 - 1
227 #define TM_LEN_SCI_SWF_304 3669 // 304 * 12 + 10 + 12 - 1
228 #define TM_LEN_SCI_SWF_224 2709 // 224 * 12 + 10 + 12 - 1
228 #define TM_LEN_SCI_SWF_224 2709 // 224 * 12 + 10 + 12 - 1
229 #define TM_LEN_SCI_CWF_336 4051 // 336 * 12 + 10 + 10 - 1
229 #define TM_LEN_SCI_CWF_336 4051 // 336 * 12 + 10 + 10 - 1
230 #define TM_LEN_SCI_CWF_672 4051 // 672 * 6 + 10 + 10 - 1
230 #define TM_LEN_SCI_CWF_672 4051 // 672 * 6 + 10 + 10 - 1
231 //
231 //
232 #define DEFAULT_PKTCNT 0x07
232 #define DEFAULT_PKTCNT 0x07
233 #define BLK_NR_304 0x0130
233 #define BLK_NR_304 0x0130
234 #define BLK_NR_224 0x00e0
234 #define BLK_NR_224 0x00e0
235 #define BLK_NR_CWF 0x0150 // 336
235 #define BLK_NR_CWF 0x0150 // 336
236 #define BLK_NR_CWF_SHORT_F3 0x02a0 // 672
236 #define BLK_NR_CWF_SHORT_F3 0x02a0 // 672
237
237
238 enum TM_TYPE{
238 enum TM_TYPE{
239 TM_LFR_TC_EXE_OK,
239 TM_LFR_TC_EXE_OK,
240 TM_LFR_TC_EXE_ERR,
240 TM_LFR_TC_EXE_ERR,
241 TM_LFR_HK,
241 TM_LFR_HK,
242 TM_LFR_SCI,
242 TM_LFR_SCI,
243 TM_LFR_SCI_SBM,
243 TM_LFR_SCI_SBM,
244 TM_LFR_PAR_DUMP
244 TM_LFR_PAR_DUMP
245 };
245 };
246
246
247 typedef struct {
247 typedef struct {
248 unsigned char targetLogicalAddress;
248 unsigned char targetLogicalAddress;
249 unsigned char protocolIdentifier;
249 unsigned char protocolIdentifier;
250 unsigned char reserved;
250 unsigned char reserved;
251 unsigned char userApplication;
251 unsigned char userApplication;
252 // PACKET HEADER
252 // PACKET HEADER
253 unsigned char packetID[2];
253 unsigned char packetID[2];
254 unsigned char packetSequenceControl[2];
254 unsigned char packetSequenceControl[2];
255 unsigned char packetLength[2];
255 unsigned char packetLength[2];
256 // DATA FIELD HEADER
256 // DATA FIELD HEADER
257 unsigned char spare1_pusVersion_spare2;
257 unsigned char spare1_pusVersion_spare2;
258 unsigned char serviceType;
258 unsigned char serviceType;
259 unsigned char serviceSubType;
259 unsigned char serviceSubType;
260 unsigned char destinationID;
260 unsigned char destinationID;
261 unsigned char time[6];
261 unsigned char time[6];
262 //
262 //
263 unsigned char telecommand_pkt_id[2];
263 unsigned char telecommand_pkt_id[2];
264 unsigned char pkt_seq_control[2];
264 unsigned char pkt_seq_control[2];
265 } Packet_TM_LFR_TC_EXE_SUCCESS_t;
265 } Packet_TM_LFR_TC_EXE_SUCCESS_t;
266
266
267 typedef struct {
267 typedef struct {
268 unsigned char targetLogicalAddress;
268 unsigned char targetLogicalAddress;
269 unsigned char protocolIdentifier;
269 unsigned char protocolIdentifier;
270 unsigned char reserved;
270 unsigned char reserved;
271 unsigned char userApplication;
271 unsigned char userApplication;
272 // PACKET HEADER
272 // PACKET HEADER
273 unsigned char packetID[2];
273 unsigned char packetID[2];
274 unsigned char packetSequenceControl[2];
274 unsigned char packetSequenceControl[2];
275 unsigned char packetLength[2];
275 unsigned char packetLength[2];
276 // DATA FIELD HEADER
276 // DATA FIELD HEADER
277 unsigned char spare1_pusVersion_spare2;
277 unsigned char spare1_pusVersion_spare2;
278 unsigned char serviceType;
278 unsigned char serviceType;
279 unsigned char serviceSubType;
279 unsigned char serviceSubType;
280 unsigned char destinationID;
280 unsigned char destinationID;
281 unsigned char time[6];
281 unsigned char time[6];
282 //
282 //
283 unsigned char tc_failure_code[2];
283 unsigned char tc_failure_code[2];
284 unsigned char telecommand_pkt_id[2];
284 unsigned char telecommand_pkt_id[2];
285 unsigned char pkt_seq_control[2];
285 unsigned char pkt_seq_control[2];
286 unsigned char tc_service;
286 unsigned char tc_service;
287 unsigned char tc_subtype;
287 unsigned char tc_subtype;
288 unsigned char byte_position;
288 unsigned char byte_position;
289 unsigned char rcv_value;
289 unsigned char rcv_value;
290 } Packet_TM_LFR_TC_EXE_INCONSISTENT_t;
290 } Packet_TM_LFR_TC_EXE_INCONSISTENT_t;
291
291
292 typedef struct {
292 typedef struct {
293 unsigned char targetLogicalAddress;
293 unsigned char targetLogicalAddress;
294 unsigned char protocolIdentifier;
294 unsigned char protocolIdentifier;
295 unsigned char reserved;
295 unsigned char reserved;
296 unsigned char userApplication;
296 unsigned char userApplication;
297 // PACKET HEADER
297 // PACKET HEADER
298 unsigned char packetID[2];
298 unsigned char packetID[2];
299 unsigned char packetSequenceControl[2];
299 unsigned char packetSequenceControl[2];
300 unsigned char packetLength[2];
300 unsigned char packetLength[2];
301 // DATA FIELD HEADER
301 // DATA FIELD HEADER
302 unsigned char spare1_pusVersion_spare2;
302 unsigned char spare1_pusVersion_spare2;
303 unsigned char serviceType;
303 unsigned char serviceType;
304 unsigned char serviceSubType;
304 unsigned char serviceSubType;
305 unsigned char destinationID;
305 unsigned char destinationID;
306 unsigned char time[6];
306 unsigned char time[6];
307 //
307 //
308 unsigned char tc_failure_code[2];
308 unsigned char tc_failure_code[2];
309 unsigned char telecommand_pkt_id[2];
309 unsigned char telecommand_pkt_id[2];
310 unsigned char pkt_seq_control[2];
310 unsigned char pkt_seq_control[2];
311 unsigned char tc_service;
311 unsigned char tc_service;
312 unsigned char tc_subtype;
312 unsigned char tc_subtype;
313 unsigned char lfr_status_word[2];
313 unsigned char lfr_status_word[2];
314 } Packet_TM_LFR_TC_EXE_NOT_EXECUTABLE_t;
314 } Packet_TM_LFR_TC_EXE_NOT_EXECUTABLE_t;
315
315
316 typedef struct {
316 typedef struct {
317 unsigned char targetLogicalAddress;
317 unsigned char targetLogicalAddress;
318 unsigned char protocolIdentifier;
318 unsigned char protocolIdentifier;
319 unsigned char reserved;
319 unsigned char reserved;
320 unsigned char userApplication;
320 unsigned char userApplication;
321 // PACKET HEADER
321 // PACKET HEADER
322 unsigned char packetID[2];
322 unsigned char packetID[2];
323 unsigned char packetSequenceControl[2];
323 unsigned char packetSequenceControl[2];
324 unsigned char packetLength[2];
324 unsigned char packetLength[2];
325 // DATA FIELD HEADER
325 // DATA FIELD HEADER
326 unsigned char spare1_pusVersion_spare2;
326 unsigned char spare1_pusVersion_spare2;
327 unsigned char serviceType;
327 unsigned char serviceType;
328 unsigned char serviceSubType;
328 unsigned char serviceSubType;
329 unsigned char destinationID;
329 unsigned char destinationID;
330 unsigned char time[6];
330 unsigned char time[6];
331 //
331 //
332 unsigned char tc_failure_code[2];
332 unsigned char tc_failure_code[2];
333 unsigned char telecommand_pkt_id[2];
333 unsigned char telecommand_pkt_id[2];
334 unsigned char pkt_seq_control[2];
334 unsigned char pkt_seq_control[2];
335 unsigned char tc_service;
335 unsigned char tc_service;
336 unsigned char tc_subtype;
336 unsigned char tc_subtype;
337 } Packet_TM_LFR_TC_EXE_NOT_IMPLEMENTED_t;
337 } Packet_TM_LFR_TC_EXE_NOT_IMPLEMENTED_t;
338
338
339 typedef struct {
339 typedef struct {
340 unsigned char targetLogicalAddress;
340 unsigned char targetLogicalAddress;
341 unsigned char protocolIdentifier;
341 unsigned char protocolIdentifier;
342 unsigned char reserved;
342 unsigned char reserved;
343 unsigned char userApplication;
343 unsigned char userApplication;
344 // PACKET HEADER
344 // PACKET HEADER
345 unsigned char packetID[2];
345 unsigned char packetID[2];
346 unsigned char packetSequenceControl[2];
346 unsigned char packetSequenceControl[2];
347 unsigned char packetLength[2];
347 unsigned char packetLength[2];
348 // DATA FIELD HEADER
348 // DATA FIELD HEADER
349 unsigned char spare1_pusVersion_spare2;
349 unsigned char spare1_pusVersion_spare2;
350 unsigned char serviceType;
350 unsigned char serviceType;
351 unsigned char serviceSubType;
351 unsigned char serviceSubType;
352 unsigned char destinationID;
352 unsigned char destinationID;
353 unsigned char time[6];
353 unsigned char time[6];
354 //
354 //
355 unsigned char tc_failure_code[2];
355 unsigned char tc_failure_code[2];
356 unsigned char telecommand_pkt_id[2];
356 unsigned char telecommand_pkt_id[2];
357 unsigned char pkt_seq_control[2];
357 unsigned char pkt_seq_control[2];
358 unsigned char tc_service;
358 unsigned char tc_service;
359 unsigned char tc_subtype;
359 unsigned char tc_subtype;
360 } Packet_TM_LFR_TC_EXE_ERROR_t;
360 } Packet_TM_LFR_TC_EXE_ERROR_t;
361
361
362 typedef struct {
362 typedef struct {
363 unsigned char targetLogicalAddress;
363 unsigned char targetLogicalAddress;
364 unsigned char protocolIdentifier;
364 unsigned char protocolIdentifier;
365 unsigned char reserved;
365 unsigned char reserved;
366 unsigned char userApplication;
366 unsigned char userApplication;
367 // PACKET HEADER
367 // PACKET HEADER
368 unsigned char packetID[2];
368 unsigned char packetID[2];
369 unsigned char packetSequenceControl[2];
369 unsigned char packetSequenceControl[2];
370 unsigned char packetLength[2];
370 unsigned char packetLength[2];
371 // DATA FIELD HEADER
371 // DATA FIELD HEADER
372 unsigned char spare1_pusVersion_spare2;
372 unsigned char spare1_pusVersion_spare2;
373 unsigned char serviceType;
373 unsigned char serviceType;
374 unsigned char serviceSubType;
374 unsigned char serviceSubType;
375 unsigned char destinationID;
375 unsigned char destinationID;
376 unsigned char time[6];
376 unsigned char time[6];
377 //
377 //
378 unsigned char tc_failure_code[2];
378 unsigned char tc_failure_code[2];
379 unsigned char telecommand_pkt_id[2];
379 unsigned char telecommand_pkt_id[2];
380 unsigned char pkt_seq_control[2];
380 unsigned char pkt_seq_control[2];
381 unsigned char tc_service;
381 unsigned char tc_service;
382 unsigned char tc_subtype;
382 unsigned char tc_subtype;
383 unsigned char pkt_len_rcv_value[2];
383 unsigned char pkt_len_rcv_value[2];
384 unsigned char pkt_datafieldsize_cnt[2];
384 unsigned char pkt_datafieldsize_cnt[2];
385 unsigned char rcv_crc[2];
385 unsigned char rcv_crc[2];
386 unsigned char computed_crc[2];
386 unsigned char computed_crc[2];
387 } Packet_TM_LFR_TC_EXE_CORRUPTED_t;
387 } Packet_TM_LFR_TC_EXE_CORRUPTED_t;
388
388
389 typedef struct {
389 typedef struct {
390 unsigned char targetLogicalAddress;
390 unsigned char targetLogicalAddress;
391 unsigned char protocolIdentifier;
391 unsigned char protocolIdentifier;
392 unsigned char reserved;
392 unsigned char reserved;
393 unsigned char userApplication;
393 unsigned char userApplication;
394 unsigned char packetID[2];
394 unsigned char packetID[2];
395 unsigned char packetSequenceControl[2];
395 unsigned char packetSequenceControl[2];
396 unsigned char packetLength[2];
396 unsigned char packetLength[2];
397 // DATA FIELD HEADER
397 // DATA FIELD HEADER
398 unsigned char spare1_pusVersion_spare2;
398 unsigned char spare1_pusVersion_spare2;
399 unsigned char serviceType;
399 unsigned char serviceType;
400 unsigned char serviceSubType;
400 unsigned char serviceSubType;
401 unsigned char destinationID;
401 unsigned char destinationID;
402 unsigned char time[6];
402 unsigned char time[6];
403 // AUXILIARY HEADER
403 // AUXILIARY HEADER
404 unsigned char sid;
404 unsigned char sid;
405 unsigned char hkBIA;
405 unsigned char hkBIA;
406 unsigned char pktCnt;
406 unsigned char pktCnt;
407 unsigned char pktNr;
407 unsigned char pktNr;
408 unsigned char acquisitionTime[6];
408 unsigned char acquisitionTime[6];
409 unsigned char blkNr[2];
409 unsigned char blkNr[2];
410 } Header_TM_LFR_SCIENCE_SWF_t;
410 } Header_TM_LFR_SCIENCE_SWF_t;
411
411
412 typedef struct {
412 typedef struct {
413 unsigned char targetLogicalAddress;
413 unsigned char targetLogicalAddress;
414 unsigned char protocolIdentifier;
414 unsigned char protocolIdentifier;
415 unsigned char reserved;
415 unsigned char reserved;
416 unsigned char userApplication;
416 unsigned char userApplication;
417 unsigned char packetID[2];
417 unsigned char packetID[2];
418 unsigned char packetSequenceControl[2];
418 unsigned char packetSequenceControl[2];
419 unsigned char packetLength[2];
419 unsigned char packetLength[2];
420 // DATA FIELD HEADER
420 // DATA FIELD HEADER
421 unsigned char spare1_pusVersion_spare2;
421 unsigned char spare1_pusVersion_spare2;
422 unsigned char serviceType;
422 unsigned char serviceType;
423 unsigned char serviceSubType;
423 unsigned char serviceSubType;
424 unsigned char destinationID;
424 unsigned char destinationID;
425 unsigned char time[6];
425 unsigned char time[6];
426 // AUXILIARY DATA HEADER
426 // AUXILIARY DATA HEADER
427 unsigned char sid;
427 unsigned char sid;
428 unsigned char hkBIA;
428 unsigned char hkBIA;
429 unsigned char acquisitionTime[6];
429 unsigned char acquisitionTime[6];
430 unsigned char blkNr[2];
430 unsigned char blkNr[2];
431 } Header_TM_LFR_SCIENCE_CWF_t;
431 } Header_TM_LFR_SCIENCE_CWF_t;
432
432
433 typedef struct {
433 typedef struct {
434 unsigned char targetLogicalAddress;
434 unsigned char targetLogicalAddress;
435 unsigned char protocolIdentifier;
435 unsigned char protocolIdentifier;
436 unsigned char reserved;
436 unsigned char reserved;
437 unsigned char userApplication;
437 unsigned char userApplication;
438 unsigned char packetID[2];
438 unsigned char packetID[2];
439 unsigned char packetSequenceControl[2];
439 unsigned char packetSequenceControl[2];
440 unsigned char packetLength[2];
440 unsigned char packetLength[2];
441 // DATA FIELD HEADER
441 // DATA FIELD HEADER
442 unsigned char spare1_pusVersion_spare2;
442 unsigned char spare1_pusVersion_spare2;
443 unsigned char serviceType;
443 unsigned char serviceType;
444 unsigned char serviceSubType;
444 unsigned char serviceSubType;
445 unsigned char destinationID;
445 unsigned char destinationID;
446 unsigned char time[6];
446 unsigned char time[6];
447 // AUXILIARY HEADER
447 // AUXILIARY HEADER
448 unsigned char sid;
448 unsigned char sid;
449 unsigned char biaStatusInfo;
449 unsigned char biaStatusInfo;
450 unsigned char pa_lfr_pkt_cnt_asm;
450 unsigned char pa_lfr_pkt_cnt_asm;
451 unsigned char pa_lfr_pkt_nr_asm;
451 unsigned char pa_lfr_pkt_nr_asm;
452 unsigned char acquisitionTime[6];
452 unsigned char acquisitionTime[6];
453 unsigned char pa_lfr_asm_blk_nr[2];
453 unsigned char pa_lfr_asm_blk_nr[2];
454 } Header_TM_LFR_SCIENCE_ASM_t;
454 } Header_TM_LFR_SCIENCE_ASM_t;
455
455
456 typedef struct {
456 typedef struct {
457 unsigned char targetLogicalAddress;
457 unsigned char targetLogicalAddress;
458 unsigned char protocolIdentifier;
458 unsigned char protocolIdentifier;
459 unsigned char reserved;
459 unsigned char reserved;
460 unsigned char userApplication;
460 unsigned char userApplication;
461 unsigned char packetID[2];
461 unsigned char packetID[2];
462 unsigned char packetSequenceControl[2];
462 unsigned char packetSequenceControl[2];
463 unsigned char packetLength[2];
463 unsigned char packetLength[2];
464 // DATA FIELD HEADER
464 // DATA FIELD HEADER
465 unsigned char spare1_pusVersion_spare2;
465 unsigned char spare1_pusVersion_spare2;
466 unsigned char serviceType;
466 unsigned char serviceType;
467 unsigned char serviceSubType;
467 unsigned char serviceSubType;
468 unsigned char destinationID;
468 unsigned char destinationID;
469 unsigned char time[6];
469 unsigned char time[6];
470 // AUXILIARY HEADER
470 // AUXILIARY HEADER
471 unsigned char sid;
471 unsigned char sid;
472 unsigned char biaStatusInfo;
472 unsigned char biaStatusInfo;
473 unsigned char acquisitionTime[6];
473 unsigned char acquisitionTime[6];
474 unsigned char source_data_spare[2];
474 unsigned char source_data_spare[2];
475 unsigned char pa_lfr_bp_blk_nr[2];
475 unsigned char pa_lfr_bp_blk_nr[2];
476 } Header_TM_LFR_SCIENCE_BP_with_spare_t;
476 } Header_TM_LFR_SCIENCE_BP_with_spare_t;
477
477
478 typedef struct {
478 typedef struct {
479 unsigned char targetLogicalAddress;
479 unsigned char targetLogicalAddress;
480 unsigned char protocolIdentifier;
480 unsigned char protocolIdentifier;
481 unsigned char reserved;
481 unsigned char reserved;
482 unsigned char userApplication;
482 unsigned char userApplication;
483 unsigned char packetID[2];
483 unsigned char packetID[2];
484 unsigned char packetSequenceControl[2];
484 unsigned char packetSequenceControl[2];
485 unsigned char packetLength[2];
485 unsigned char packetLength[2];
486 // DATA FIELD HEADER
486 // DATA FIELD HEADER
487 unsigned char spare1_pusVersion_spare2;
487 unsigned char spare1_pusVersion_spare2;
488 unsigned char serviceType;
488 unsigned char serviceType;
489 unsigned char serviceSubType;
489 unsigned char serviceSubType;
490 unsigned char destinationID;
490 unsigned char destinationID;
491 unsigned char time[6];
491 unsigned char time[6];
492 // AUXILIARY HEADER
492 // AUXILIARY HEADER
493 unsigned char sid;
493 unsigned char sid;
494 unsigned char biaStatusInfo;
494 unsigned char biaStatusInfo;
495 unsigned char acquisitionTime[6];
495 unsigned char acquisitionTime[6];
496 unsigned char pa_lfr_bp_blk_nr[2];
496 unsigned char pa_lfr_bp_blk_nr[2];
497 } Header_TM_LFR_SCIENCE_BP_t;
497 } Header_TM_LFR_SCIENCE_BP_t;
498
498
499 typedef struct {
499 typedef struct {
500 //targetLogicalAddress is removed by the grspw module
500 //targetLogicalAddress is removed by the grspw module
501 unsigned char protocolIdentifier;
501 unsigned char protocolIdentifier;
502 unsigned char reserved;
502 unsigned char reserved;
503 unsigned char userApplication;
503 unsigned char userApplication;
504 unsigned char packetID[2];
504 unsigned char packetID[2];
505 unsigned char packetSequenceControl[2];
505 unsigned char packetSequenceControl[2];
506 unsigned char packetLength[2];
506 unsigned char packetLength[2];
507 // DATA FIELD HEADER
507 // DATA FIELD HEADER
508 unsigned char headerFlag_pusVersion_Ack;
508 unsigned char headerFlag_pusVersion_Ack;
509 unsigned char serviceType;
509 unsigned char serviceType;
510 unsigned char serviceSubType;
510 unsigned char serviceSubType;
511 unsigned char sourceID;
511 unsigned char sourceID;
512 unsigned char dataAndCRC[CCSDS_TC_PKT_MAX_SIZE-10];
512 unsigned char dataAndCRC[CCSDS_TC_PKT_MAX_SIZE-10];
513 } ccsdsTelecommandPacket_t;
513 } ccsdsTelecommandPacket_t;
514
514
515 typedef struct {
515 typedef struct {
516 unsigned char targetLogicalAddress;
516 unsigned char targetLogicalAddress;
517 unsigned char protocolIdentifier;
517 unsigned char protocolIdentifier;
518 unsigned char reserved;
518 unsigned char reserved;
519 unsigned char userApplication;
519 unsigned char userApplication;
520 unsigned char packetID[2];
520 unsigned char packetID[2];
521 unsigned char packetSequenceControl[2];
521 unsigned char packetSequenceControl[2];
522 unsigned char packetLength[2];
522 unsigned char packetLength[2];
523 unsigned char spare1_pusVersion_spare2;
523 unsigned char spare1_pusVersion_spare2;
524 unsigned char serviceType;
524 unsigned char serviceType;
525 unsigned char serviceSubType;
525 unsigned char serviceSubType;
526 unsigned char destinationID;
526 unsigned char destinationID;
527 unsigned char time[6];
527 unsigned char time[6];
528 unsigned char sid;
528 unsigned char sid;
529
529
530 //**************
530 //**************
531 // HK PARAMETERS
531 // HK PARAMETERS
532 unsigned char lfr_status_word[2];
532 unsigned char lfr_status_word[2];
533 unsigned char lfr_sw_version[4];
533 unsigned char lfr_sw_version[4];
534 unsigned char lfr_fpga_version[3];
534 unsigned char lfr_fpga_version[3];
535 // ressource statistics
535 // ressource statistics
536 unsigned char hk_lfr_cpu_load;
536 unsigned char hk_lfr_cpu_load;
537 unsigned char hk_lfr_load_max;
537 unsigned char hk_lfr_load_max;
538 unsigned char hk_lfr_load_aver;
538 unsigned char hk_lfr_load_aver;
539 // tc statistics
539 // tc statistics
540 unsigned char hk_lfr_update_info_tc_cnt[2];
540 unsigned char hk_lfr_update_info_tc_cnt[2];
541 unsigned char hk_lfr_update_time_tc_cnt[2];
541 unsigned char hk_lfr_update_time_tc_cnt[2];
542 unsigned char hk_lfr_exe_tc_cnt[2];
542 unsigned char hk_lfr_exe_tc_cnt[2];
543 unsigned char hk_lfr_rej_tc_cnt[2];
543 unsigned char hk_lfr_rej_tc_cnt[2];
544 unsigned char hk_lfr_last_exe_tc_id[2];
544 unsigned char hk_lfr_last_exe_tc_id[2];
545 unsigned char hk_lfr_last_exe_tc_type[2];
545 unsigned char hk_lfr_last_exe_tc_type[2];
546 unsigned char hk_lfr_last_exe_tc_subtype[2];
546 unsigned char hk_lfr_last_exe_tc_subtype[2];
547 unsigned char hk_lfr_last_exe_tc_time[6];
547 unsigned char hk_lfr_last_exe_tc_time[6];
548 unsigned char hk_lfr_last_rej_tc_id[2];
548 unsigned char hk_lfr_last_rej_tc_id[2];
549 unsigned char hk_lfr_last_rej_tc_type[2];
549 unsigned char hk_lfr_last_rej_tc_type[2];
550 unsigned char hk_lfr_last_rej_tc_subtype[2];
550 unsigned char hk_lfr_last_rej_tc_subtype[2];
551 unsigned char hk_lfr_last_rej_tc_time[6];
551 unsigned char hk_lfr_last_rej_tc_time[6];
552 // anomaly statistics
552 // anomaly statistics
553 unsigned char hk_lfr_le_cnt[2];
553 unsigned char hk_lfr_le_cnt[2];
554 unsigned char hk_lfr_me_cnt[2];
554 unsigned char hk_lfr_me_cnt[2];
555 unsigned char hk_lfr_he_cnt[2];
555 unsigned char hk_lfr_he_cnt[2];
556 unsigned char hk_lfr_last_er_rid[2];
556 unsigned char hk_lfr_last_er_rid[2];
557 unsigned char hk_lfr_last_er_code;
557 unsigned char hk_lfr_last_er_code;
558 unsigned char hk_lfr_last_er_time[6];
558 unsigned char hk_lfr_last_er_time[6];
559 // vhdl_blk_status
559 // vhdl_blk_status
560 unsigned char hk_lfr_vhdl_aa_sm;
560 unsigned char hk_lfr_vhdl_aa_sm;
561 unsigned char hk_lfr_vhdl_fft_sr;
561 unsigned char hk_lfr_vhdl_fft_sr;
562 unsigned char hk_lfr_vhdl_cic_hk;
562 unsigned char hk_lfr_vhdl_cic_hk;
563 unsigned char hk_lfr_vhdl_iir_cal;
563 unsigned char hk_lfr_vhdl_iir_cal;
564 // spacewire_if_statistics
564 // spacewire_if_statistics
565 unsigned char hk_lfr_dpu_spw_pkt_rcv_cnt[2];
565 unsigned char hk_lfr_dpu_spw_pkt_rcv_cnt[2];
566 unsigned char hk_lfr_dpu_spw_pkt_sent_cnt[2];
566 unsigned char hk_lfr_dpu_spw_pkt_sent_cnt[2];
567 unsigned char hk_lfr_dpu_spw_tick_out_cnt;
567 unsigned char hk_lfr_dpu_spw_tick_out_cnt;
568 unsigned char hk_lfr_dpu_spw_last_timc;
568 unsigned char hk_lfr_dpu_spw_last_timc;
569 // ahb error statistics
569 // ahb error statistics
570 unsigned int hk_lfr_last_fail_addr;
570 unsigned int hk_lfr_last_fail_addr;
571 // temperatures
571 // temperatures
572 unsigned char hk_lfr_temp_scm[2];
572 unsigned char hk_lfr_temp_scm[2];
573 unsigned char hk_lfr_temp_pcb[2];
573 unsigned char hk_lfr_temp_pcb[2];
574 unsigned char hk_lfr_temp_fpga[2];
574 unsigned char hk_lfr_temp_fpga[2];
575 // spacecraft potential
575 // spacecraft potential
576 unsigned char hk_lfr_sc_v_f3[2];
576 unsigned char hk_lfr_sc_v_f3[2];
577 unsigned char hk_lfr_sc_e1_f3[2];
577 unsigned char hk_lfr_sc_e1_f3[2];
578 unsigned char hk_lfr_sc_e2_f3[2];
578 unsigned char hk_lfr_sc_e2_f3[2];
579 // error counters
579 // error counters
580 unsigned char hk_lfr_dpu_spw_parity;
580 unsigned char hk_lfr_dpu_spw_parity;
581 unsigned char hk_lfr_dpu_spw_disconnect;
581 unsigned char hk_lfr_dpu_spw_disconnect;
582 unsigned char hk_lfr_dpu_spw_escape;
582 unsigned char hk_lfr_dpu_spw_escape;
583 unsigned char hk_lfr_dpu_spw_credit;
583 unsigned char hk_lfr_dpu_spw_credit;
584 unsigned char hk_lfr_dpu_spw_write_sync;
584 unsigned char hk_lfr_dpu_spw_write_sync;
585 unsigned char hk_lfr_dpu_spw_rx_ahb;
585 unsigned char hk_lfr_dpu_spw_rx_ahb;
586 unsigned char hk_lfr_dpu_spw_tx_ahb;
586 unsigned char hk_lfr_dpu_spw_tx_ahb;
587 unsigned char hk_lfr_dpu_spw_early_eop;
587 unsigned char hk_lfr_dpu_spw_early_eop;
588 unsigned char hk_lfr_dpu_spw_invalid_addr;
588 unsigned char hk_lfr_dpu_spw_invalid_addr;
589 unsigned char hk_lfr_dpu_spw_eep;
589 unsigned char hk_lfr_dpu_spw_eep;
590 unsigned char hk_lfr_dpu_spw_rx_too_big;
590 unsigned char hk_lfr_dpu_spw_rx_too_big;
591 // timecode
591 // timecode
592 unsigned char hk_lfr_timecode_erroneous;
592 unsigned char hk_lfr_timecode_erroneous;
593 unsigned char hk_lfr_timecode_missing;
593 unsigned char hk_lfr_timecode_missing;
594 unsigned char hk_lfr_timecode_invalid;
594 unsigned char hk_lfr_timecode_invalid;
595 // time
595 // time
596 unsigned char hk_lfr_time_timecode_it;
596 unsigned char hk_lfr_time_timecode_it;
597 unsigned char hk_lfr_time_not_synchro;
597 unsigned char hk_lfr_time_not_synchro;
598 unsigned char hk_lfr_time_timecode_ctr;
598 unsigned char hk_lfr_time_timecode_ctr;
599 // hk_lfr_buffer_dpu_
599 // hk_lfr_buffer_dpu_
600 unsigned char hk_lfr_buffer_dpu_tc_fifo;
600 unsigned char hk_lfr_buffer_dpu_tc_fifo;
601 unsigned char hk_lfr_buffer_dpu_tm_fifo;
601 unsigned char hk_lfr_buffer_dpu_tm_fifo;
602 // hk_lfr_ahb_
602 // hk_lfr_ahb_
603 unsigned char hk_lfr_ahb_correctable;
603 unsigned char hk_lfr_ahb_correctable;
604 unsigned char hk_lfr_ahb_uncorrectable;
604 unsigned char hk_lfr_ahb_uncorrectable;
605 // spare
605 // spare
606 unsigned char parameters_spare;
606 unsigned char parameters_spare;
607 } Packet_TM_LFR_HK_t;
607 } Packet_TM_LFR_HK_t;
608
608
609 typedef struct {
609 typedef struct {
610 unsigned char targetLogicalAddress;
610 unsigned char targetLogicalAddress;
611 unsigned char protocolIdentifier;
611 unsigned char protocolIdentifier;
612 unsigned char reserved;
612 unsigned char reserved;
613 unsigned char userApplication;
613 unsigned char userApplication;
614 unsigned char packetID[2];
614 unsigned char packetID[2];
615 unsigned char packetSequenceControl[2];
615 unsigned char packetSequenceControl[2];
616 unsigned char packetLength[2];
616 unsigned char packetLength[2];
617 // DATA FIELD HEADER
617 // DATA FIELD HEADER
618 unsigned char spare1_pusVersion_spare2;
618 unsigned char spare1_pusVersion_spare2;
619 unsigned char serviceType;
619 unsigned char serviceType;
620 unsigned char serviceSubType;
620 unsigned char serviceSubType;
621 unsigned char destinationID;
621 unsigned char destinationID;
622 unsigned char time[6];
622 unsigned char time[6];
623 unsigned char sid;
623 unsigned char sid;
624
624
625 //******************
625 //******************
626 // COMMON PARAMETERS
626 // COMMON PARAMETERS
627 unsigned char unused0;
627 unsigned char unused0;
628 unsigned char bw_sp0_sp1_r0_r1;
628 unsigned char bw_sp0_sp1_r0_r1;
629
629
630 //******************
630 //******************
631 // NORMAL PARAMETERS
631 // NORMAL PARAMETERS
632 unsigned char sy_lfr_n_swf_l[2];
632 unsigned char sy_lfr_n_swf_l[2];
633 unsigned char sy_lfr_n_swf_p[2];
633 unsigned char sy_lfr_n_swf_p[2];
634 unsigned char sy_lfr_n_asm_p[2];
634 unsigned char sy_lfr_n_asm_p[2];
635 unsigned char sy_lfr_n_bp_p0;
635 unsigned char sy_lfr_n_bp_p0;
636 unsigned char sy_lfr_n_bp_p1;
636 unsigned char sy_lfr_n_bp_p1;
637 unsigned char sy_lfr_n_cwf_long_f3;
637 unsigned char sy_lfr_n_cwf_long_f3;
638 unsigned char lfr_normal_parameters_spare;
638 unsigned char lfr_normal_parameters_spare;
639
639
640 //*****************
640 //*****************
641 // BURST PARAMETERS
641 // BURST PARAMETERS
642 unsigned char sy_lfr_b_bp_p0;
642 unsigned char sy_lfr_b_bp_p0;
643 unsigned char sy_lfr_b_bp_p1;
643 unsigned char sy_lfr_b_bp_p1;
644
644
645 //****************
645 //****************
646 // SBM1 PARAMETERS
646 // SBM1 PARAMETERS
647 unsigned char sy_lfr_s1_bp_p0;
647 unsigned char sy_lfr_s1_bp_p0;
648 unsigned char sy_lfr_s1_bp_p1;
648 unsigned char sy_lfr_s1_bp_p1;
649
649
650 //****************
650 //****************
651 // SBM2 PARAMETERS
651 // SBM2 PARAMETERS
652 unsigned char sy_lfr_s2_bp_p0;
652 unsigned char sy_lfr_s2_bp_p0;
653 unsigned char sy_lfr_s2_bp_p1;
653 unsigned char sy_lfr_s2_bp_p1;
654
654
655 // SPARE
655 // SPARE
656 unsigned char source_data_spare;
656 unsigned char source_data_spare;
657 } Packet_TM_LFR_PARAMETER_DUMP_t;
657 } Packet_TM_LFR_PARAMETER_DUMP_t;
658
658
659
659
660 #endif // CCSDS_TYPES_H_INCLUDED
660 #endif // CCSDS_TYPES_H_INCLUDED
@@ -1,39 +1,40
1 #ifndef FSW_MISC_H_INCLUDED
1 #ifndef FSW_MISC_H_INCLUDED
2 #define FSW_MISC_H_INCLUDED
2 #define FSW_MISC_H_INCLUDED
3
3
4 #include <rtems.h>
4 #include <rtems.h>
5 #include <stdio.h>
5 #include <stdio.h>
6 #include <grspw.h>
6 #include <grspw.h>
7
7
8 #include "fsw_params.h"
8 #include "fsw_params.h"
9 #include "fsw_spacewire.h"
9 #include "fsw_spacewire.h"
10
10
11 rtems_name name_hk_rate_monotonic; // name of the HK rate monotonic
11 rtems_name name_hk_rate_monotonic; // name of the HK rate monotonic
12 rtems_id HK_id; // id of the HK rate monotonic period
12 rtems_id HK_id; // id of the HK rate monotonic period
13
13
14 //extern rtems_name misc_name[5];
14 //extern rtems_name misc_name[5];
15 //time_management_regs_t *time_management_regs;
15 //time_management_regs_t *time_management_regs;
16 //extern Packet_TM_LFR_HK_t housekeeping_packet;
16 //extern Packet_TM_LFR_HK_t housekeeping_packet;
17
17
18 void configure_timer(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider,
18 void configure_timer(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider,
19 unsigned char interrupt_level, rtems_isr (*timer_isr)() );
19 unsigned char interrupt_level, rtems_isr (*timer_isr)() );
20 void timer_start( gptimer_regs_t *gptimer_regs, unsigned char timer );
20 void timer_start( gptimer_regs_t *gptimer_regs, unsigned char timer );
21 void timer_stop( gptimer_regs_t *gptimer_regs, unsigned char timer );
21 void timer_stop( gptimer_regs_t *gptimer_regs, unsigned char timer );
22 void timer_set_clock_divider(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider);
22 void timer_set_clock_divider(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider);
23
23
24 // SERIAL LINK
24 // SERIAL LINK
25 int send_console_outputs_on_apbuart_port( void );
25 int send_console_outputs_on_apbuart_port( void );
26 int enable_apbuart_transmitter( void );
26 int enable_apbuart_transmitter( void );
27 void set_apbuart_scaler_reload_register(unsigned int regs, unsigned int value);
27 void set_apbuart_scaler_reload_register(unsigned int regs, unsigned int value);
28
28
29 // RTEMS TASKS
29 // RTEMS TASKS
30 rtems_task stat_task( rtems_task_argument argument );
30 rtems_task stat_task( rtems_task_argument argument );
31 rtems_task hous_task( rtems_task_argument argument );
31 rtems_task hous_task( rtems_task_argument argument );
32 rtems_task dumb_task( rtems_task_argument unused );
32 rtems_task dumb_task( rtems_task_argument unused );
33
33
34 void init_housekeeping_parameters( void );
34 void init_housekeeping_parameters( void );
35 void increment_seq_counter( unsigned char *packet_sequence_control);
35 void increment_seq_counter( unsigned char *packet_sequence_control);
36 void getTime( unsigned char *time);
36 void getTime( unsigned char *time);
37 unsigned long long int getTimeAsUnsignedLongLongInt( );
37 void send_dumb_hk( void );
38 void send_dumb_hk( void );
38
39
39 #endif // FSW_MISC_H_INCLUDED
40 #endif // FSW_MISC_H_INCLUDED
@@ -1,229 +1,252
1 #ifndef FSW_PARAMS_H_INCLUDED
1 #ifndef FSW_PARAMS_H_INCLUDED
2 #define FSW_PARAMS_H_INCLUDED
2 #define FSW_PARAMS_H_INCLUDED
3
3
4 #include "grlib_regs.h"
4 #include "grlib_regs.h"
5 #include "fsw_params_processing.h"
5 #include "fsw_params_processing.h"
6 #include "fsw_params_nb_bytes.h"
6 #include "fsw_params_nb_bytes.h"
7 #include "tm_byte_positions.h"
7 #include "tm_byte_positions.h"
8 #include "ccsds_types.h"
8 #include "ccsds_types.h"
9
9
10 #define GRSPW_DEVICE_NAME "/dev/grspw0"
10 #define GRSPW_DEVICE_NAME "/dev/grspw0"
11 #define UART_DEVICE_NAME "/dev/console"
11 #define UART_DEVICE_NAME "/dev/console"
12
12
13 typedef struct ring_node
13 typedef struct ring_node
14 {
14 {
15 struct ring_node *previous;
15 struct ring_node *previous;
16 int buffer_address;
16 int buffer_address;
17 struct ring_node *next;
17 struct ring_node *next;
18 unsigned int status;
18 unsigned int status;
19 } ring_node;
19 } ring_node;
20
20
21 typedef struct {
22 unsigned int f0;
23 unsigned int norm_bp1_f0;
24 unsigned int norm_bp2_f0;
25 unsigned int norm_asm_f0;
26 unsigned int sbm_bp1_f0;
27 unsigned int sbm_bp2_f0;
28 } nb_sm_t;
29
30 typedef struct {
31 unsigned int norm_bp1_f0;
32 unsigned int norm_bp2_f0;
33 unsigned int norm_asm_f0;
34 unsigned int burst_sbm_bp1_f0;
35 unsigned int burst_sbm_bp2_f0;
36 unsigned int burst_bp1_f0;
37 unsigned int burst_bp2_f0;
38 unsigned int sbm1_bp1_f0;
39 unsigned int sbm1_bp2_f0;
40 unsigned int sbm2_bp1_f0;
41 unsigned int sbm2_bp2_f0;
42 } nb_sm_before_bp_t;
43
21 //************************
44 //************************
22 // flight software version
45 // flight software version
23 // this parameters is handled by the Qt project options
46 // this parameters is handled by the Qt project options
24
47
25 #define NB_PACKETS_PER_GROUP_OF_CWF 8 // 8 packets containing 336 blk
48 #define NB_PACKETS_PER_GROUP_OF_CWF 8 // 8 packets containing 336 blk
26 #define NB_PACKETS_PER_GROUP_OF_CWF_LIGHT 4 // 4 packets containing 672 blk
49 #define NB_PACKETS_PER_GROUP_OF_CWF_LIGHT 4 // 4 packets containing 672 blk
27 #define NB_SAMPLES_PER_SNAPSHOT 2688 // 336 * 8 = 672 * 4 = 2688
50 #define NB_SAMPLES_PER_SNAPSHOT 2688 // 336 * 8 = 672 * 4 = 2688
28 #define TIME_OFFSET 2
51 #define TIME_OFFSET 2
29 #define TIME_OFFSET_IN_BYTES 8
52 #define TIME_OFFSET_IN_BYTES 8
30 #define WAVEFORM_EXTENDED_HEADER_OFFSET 22
53 #define WAVEFORM_EXTENDED_HEADER_OFFSET 22
31 #define NB_BYTES_SWF_BLK (2 * 6)
54 #define NB_BYTES_SWF_BLK (2 * 6)
32 #define NB_WORDS_SWF_BLK 3
55 #define NB_WORDS_SWF_BLK 3
33 #define NB_BYTES_CWF3_LIGHT_BLK 6
56 #define NB_BYTES_CWF3_LIGHT_BLK 6
34 #define WFRM_INDEX_OF_LAST_PACKET 6 // waveforms are transmitted in groups of 2048 blocks, 6 packets of 340 and 1 of 8
57 #define WFRM_INDEX_OF_LAST_PACKET 6 // waveforms are transmitted in groups of 2048 blocks, 6 packets of 340 and 1 of 8
35 #define NB_RING_NODES_F0 3 // AT LEAST 3
58 #define NB_RING_NODES_F0 3 // AT LEAST 3
36 #define NB_RING_NODES_F1 5 // AT LEAST 3
59 #define NB_RING_NODES_F1 5 // AT LEAST 3
37 #define NB_RING_NODES_F2 5 // AT LEAST 3
60 #define NB_RING_NODES_F2 5 // AT LEAST 3
38
61
39 //**********
62 //**********
40 // LFR MODES
63 // LFR MODES
41 #define LFR_MODE_STANDBY 0
64 #define LFR_MODE_STANDBY 0
42 #define LFR_MODE_NORMAL 1
65 #define LFR_MODE_NORMAL 1
43 #define LFR_MODE_BURST 2
66 #define LFR_MODE_BURST 2
44 #define LFR_MODE_SBM1 3
67 #define LFR_MODE_SBM1 3
45 #define LFR_MODE_SBM2 4
68 #define LFR_MODE_SBM2 4
46
69
47 #define TDS_MODE_LFM 5
70 #define TDS_MODE_LFM 5
48 #define TDS_MODE_STANDBY 0
71 #define TDS_MODE_STANDBY 0
49 #define TDS_MODE_NORMAL 1
72 #define TDS_MODE_NORMAL 1
50 #define TDS_MODE_BURST 2
73 #define TDS_MODE_BURST 2
51 #define TDS_MODE_SBM1 3
74 #define TDS_MODE_SBM1 3
52 #define TDS_MODE_SBM2 4
75 #define TDS_MODE_SBM2 4
53
76
54 #define THR_MODE_STANDBY 0
77 #define THR_MODE_STANDBY 0
55 #define THR_MODE_NORMAL 1
78 #define THR_MODE_NORMAL 1
56 #define THR_MODE_BURST 2
79 #define THR_MODE_BURST 2
57
80
58 #define RTEMS_EVENT_MODE_STANDBY RTEMS_EVENT_0
81 #define RTEMS_EVENT_MODE_STANDBY RTEMS_EVENT_0
59 #define RTEMS_EVENT_MODE_NORMAL RTEMS_EVENT_1
82 #define RTEMS_EVENT_MODE_NORMAL RTEMS_EVENT_1
60 #define RTEMS_EVENT_MODE_BURST RTEMS_EVENT_2
83 #define RTEMS_EVENT_MODE_BURST RTEMS_EVENT_2
61 #define RTEMS_EVENT_MODE_SBM1 RTEMS_EVENT_3
84 #define RTEMS_EVENT_MODE_SBM1 RTEMS_EVENT_3
62 #define RTEMS_EVENT_MODE_SBM2 RTEMS_EVENT_4
85 #define RTEMS_EVENT_MODE_SBM2 RTEMS_EVENT_4
63 #define RTEMS_EVENT_MODE_SBM2_WFRM RTEMS_EVENT_5
86 #define RTEMS_EVENT_MODE_SBM2_WFRM RTEMS_EVENT_5
64 #define RTEMS_EVENT_NORM_BP1_F0 RTEMS_EVENT_6
87 #define RTEMS_EVENT_NORM_BP1_F0 RTEMS_EVENT_6
65 #define RTEMS_EVENT_NORM_BP2_F0 RTEMS_EVENT_7
88 #define RTEMS_EVENT_NORM_BP2_F0 RTEMS_EVENT_7
66 #define RTEMS_EVENT_NORM_ASM_F0 RTEMS_EVENT_8
89 #define RTEMS_EVENT_NORM_ASM_F0 RTEMS_EVENT_8
67 #define RTEMS_EVENT_SBM1_BP1_F0 RTEMS_EVENT_9
90 #define RTEMS_EVENT_BURST_SBM_BP1_F0 RTEMS_EVENT_9
68 #define RTEMS_EVENT_SBM1_BP2_F0 RTEMS_EVENT_10
91 #define RTEMS_EVENT_BURST_SBM_BP2_F0 RTEMS_EVENT_10
69
92
70 //****************************
93 //****************************
71 // LFR DEFAULT MODE PARAMETERS
94 // LFR DEFAULT MODE PARAMETERS
72 // COMMON
95 // COMMON
73 #define DEFAULT_SY_LFR_COMMON0 0x00
96 #define DEFAULT_SY_LFR_COMMON0 0x00
74 #define DEFAULT_SY_LFR_COMMON1 0x10 // default value 0 0 0 1 0 0 0 0
97 #define DEFAULT_SY_LFR_COMMON1 0x10 // default value 0 0 0 1 0 0 0 0
75 // NORM
98 // NORM
76 #define SY_LFR_N_SWF_L 2048 // nb sample
99 #define SY_LFR_N_SWF_L 2048 // nb sample
77 #define SY_LFR_N_SWF_P 300 // sec
100 #define SY_LFR_N_SWF_P 300 // sec
78 #define SY_LFR_N_ASM_P 3600 // sec
101 #define SY_LFR_N_ASM_P 3600 // sec
79 #define SY_LFR_N_BP_P0 4 // sec
102 #define SY_LFR_N_BP_P0 4 // sec
80 #define SY_LFR_N_BP_P1 20 // sec
103 #define SY_LFR_N_BP_P1 20 // sec
81 #define SY_LFR_N_CWF_LONG_F3 0 // 0 => production of light continuous waveforms at f3
104 #define SY_LFR_N_CWF_LONG_F3 0 // 0 => production of light continuous waveforms at f3
82 #define MIN_DELTA_SNAPSHOT 16 // sec
105 #define MIN_DELTA_SNAPSHOT 16 // sec
83 // BURST
106 // BURST
84 #define DEFAULT_SY_LFR_B_BP_P0 1 // sec
107 #define DEFAULT_SY_LFR_B_BP_P0 1 // sec
85 #define DEFAULT_SY_LFR_B_BP_P1 5 // sec
108 #define DEFAULT_SY_LFR_B_BP_P1 5 // sec
86 // SBM1
109 // SBM1
87 #define DEFAULT_SY_LFR_S1_BP_P0 1 // sec
110 #define DEFAULT_SY_LFR_S1_BP_P0 1 // sec
88 #define DEFAULT_SY_LFR_S1_BP_P1 1 // sec
111 #define DEFAULT_SY_LFR_S1_BP_P1 1 // sec
89 // SBM2
112 // SBM2
90 #define DEFAULT_SY_LFR_S2_BP_P0 1 // sec
113 #define DEFAULT_SY_LFR_S2_BP_P0 1 // sec
91 #define DEFAULT_SY_LFR_S2_BP_P1 5 // sec
114 #define DEFAULT_SY_LFR_S2_BP_P1 5 // sec
92 // ADDITIONAL PARAMETERS
115 // ADDITIONAL PARAMETERS
93 #define TIME_BETWEEN_TWO_SWF_PACKETS 30 // nb x 10 ms => 300 ms
116 #define TIME_BETWEEN_TWO_SWF_PACKETS 30 // nb x 10 ms => 300 ms
94 #define TIME_BETWEEN_TWO_CWF3_PACKETS 1000 // nb x 10 ms => 10 s
117 #define TIME_BETWEEN_TWO_CWF3_PACKETS 1000 // nb x 10 ms => 10 s
95 // STATUS WORD
118 // STATUS WORD
96 #define DEFAULT_STATUS_WORD_BYTE0 0x0d // [0000] [1] [101] mode 4 bits / SPW enabled 1 bit / state is run 3 bits
119 #define DEFAULT_STATUS_WORD_BYTE0 0x0d // [0000] [1] [101] mode 4 bits / SPW enabled 1 bit / state is run 3 bits
97 #define DEFAULT_STATUS_WORD_BYTE1 0x00
120 #define DEFAULT_STATUS_WORD_BYTE1 0x00
98 //
121 //
99 #define SY_LFR_DPU_CONNECT_TIMEOUT 100 // 100 * 10 ms = 1 s
122 #define SY_LFR_DPU_CONNECT_TIMEOUT 100 // 100 * 10 ms = 1 s
100 #define SY_LFR_DPU_CONNECT_ATTEMPT 3
123 #define SY_LFR_DPU_CONNECT_ATTEMPT 3
101 //****************************
124 //****************************
102
125
103 //*****************************
126 //*****************************
104 // APB REGISTERS BASE ADDRESSES
127 // APB REGISTERS BASE ADDRESSES
105 #define REGS_ADDR_APBUART 0x80000100
128 #define REGS_ADDR_APBUART 0x80000100
106 #define REGS_ADDR_GPTIMER 0x80000300
129 #define REGS_ADDR_GPTIMER 0x80000300
107 #define REGS_ADDR_GRSPW 0x80000500
130 #define REGS_ADDR_GRSPW 0x80000500
108 #define REGS_ADDR_TIME_MANAGEMENT 0x80000600
131 #define REGS_ADDR_TIME_MANAGEMENT 0x80000600
109 #define REGS_ADDR_GRGPIO 0x80000b00
132 #define REGS_ADDR_GRGPIO 0x80000b00
110
133
111 #define REGS_ADDR_SPECTRAL_MATRIX 0x80000f00
134 #define REGS_ADDR_SPECTRAL_MATRIX 0x80000f00
112 #define REGS_ADDR_WAVEFORM_PICKER 0x80000f40
135 #define REGS_ADDR_WAVEFORM_PICKER 0x80000f40
113
136
114 #define APBUART_CTRL_REG_MASK_DB 0xfffff7ff
137 #define APBUART_CTRL_REG_MASK_DB 0xfffff7ff
115 #define APBUART_CTRL_REG_MASK_TE 0x00000002
138 #define APBUART_CTRL_REG_MASK_TE 0x00000002
116 #define APBUART_SCALER_RELOAD_VALUE 0x00000050 // 25 MHz => about 38400 (0x50)
139 #define APBUART_SCALER_RELOAD_VALUE 0x00000050 // 25 MHz => about 38400 (0x50)
117
140
118 //**********
141 //**********
119 // IRQ LINES
142 // IRQ LINES
120 #define IRQ_SM_SIMULATOR 9
143 #define IRQ_SM_SIMULATOR 9
121 #define IRQ_SPARC_SM_SIMULATOR 0x19 // see sparcv8.pdf p.76 for interrupt levels
144 #define IRQ_SPARC_SM_SIMULATOR 0x19 // see sparcv8.pdf p.76 for interrupt levels
122 #define IRQ_WAVEFORM_PICKER 14
145 #define IRQ_WAVEFORM_PICKER 14
123 #define IRQ_SPARC_WAVEFORM_PICKER 0x1e // see sparcv8.pdf p.76 for interrupt levels
146 #define IRQ_SPARC_WAVEFORM_PICKER 0x1e // see sparcv8.pdf p.76 for interrupt levels
124 #define IRQ_SPECTRAL_MATRIX 6
147 #define IRQ_SPECTRAL_MATRIX 6
125 #define IRQ_SPARC_SPECTRAL_MATRIX 0x16 // see sparcv8.pdf p.76 for interrupt levels
148 #define IRQ_SPARC_SPECTRAL_MATRIX 0x16 // see sparcv8.pdf p.76 for interrupt levels
126
149
127 //*****
150 //*****
128 // TIME
151 // TIME
129 #define CLKDIV_SM_SIMULATOR (10000 - 1) // 10 ms
152 #define CLKDIV_SM_SIMULATOR (10416 - 1) // 10 ms => nominal is 1/96 = 0.010416667, 10417 - 1 = 10416
130 #define TIMER_SM_SIMULATOR 1
153 #define TIMER_SM_SIMULATOR 1
131 #define HK_PERIOD 100 // 100 * 10ms => 1s
154 #define HK_PERIOD 100 // 100 * 10ms => 1s
132 #define SY_LFR_TIME_SYN_TIMEOUT_in_ms 2000
155 #define SY_LFR_TIME_SYN_TIMEOUT_in_ms 2000
133 #define SY_LFR_TIME_SYN_TIMEOUT_in_ticks 200 // 200 * 10 ms = 2 s
156 #define SY_LFR_TIME_SYN_TIMEOUT_in_ticks 200 // 200 * 10 ms = 2 s
134
157
135 //**********
158 //**********
136 // LPP CODES
159 // LPP CODES
137 #define LFR_SUCCESSFUL 0
160 #define LFR_SUCCESSFUL 0
138 #define LFR_DEFAULT 1
161 #define LFR_DEFAULT 1
139 #define LFR_EXE_ERROR 2
162 #define LFR_EXE_ERROR 2
140
163
141 //******
164 //******
142 // RTEMS
165 // RTEMS
143 #define TASKID_RECV 1
166 #define TASKID_RECV 1
144 #define TASKID_ACTN 2
167 #define TASKID_ACTN 2
145 #define TASKID_SPIQ 3
168 #define TASKID_SPIQ 3
146 #define TASKID_SMIQ 4
169 #define TASKID_SMIQ 4
147 #define TASKID_STAT 5
170 #define TASKID_STAT 5
148 #define TASKID_AVF0 6
171 #define TASKID_AVF0 6
149 #define TASKID_SWBD 7
172 #define TASKID_SWBD 7
150 #define TASKID_WFRM 8
173 #define TASKID_WFRM 8
151 #define TASKID_DUMB 9
174 #define TASKID_DUMB 9
152 #define TASKID_HOUS 10
175 #define TASKID_HOUS 10
153 #define TASKID_MATR 11
176 #define TASKID_MATR 11
154 #define TASKID_CWF3 12
177 #define TASKID_CWF3 12
155 #define TASKID_CWF2 13
178 #define TASKID_CWF2 13
156 #define TASKID_CWF1 14
179 #define TASKID_CWF1 14
157 #define TASKID_SEND 15
180 #define TASKID_SEND 15
158 #define TASKID_WTDG 16
181 #define TASKID_WTDG 16
159
182
160 #define TASK_PRIORITY_SPIQ 5
183 #define TASK_PRIORITY_SPIQ 5
161 #define TASK_PRIORITY_SMIQ 10
184 #define TASK_PRIORITY_SMIQ 10
162 #define TASK_PRIORITY_WTDG 20
185 #define TASK_PRIORITY_WTDG 20
163 #define TASK_PRIORITY_HOUS 30
186 #define TASK_PRIORITY_HOUS 30
164 #define TASK_PRIORITY_CWF1 35 // CWF1 and CWF2 are never running together
187 #define TASK_PRIORITY_CWF1 35 // CWF1 and CWF2 are never running together
165 #define TASK_PRIORITY_CWF2 35 //
188 #define TASK_PRIORITY_CWF2 35 //
166 #define TASK_PRIORITY_SWBD 37 // SWBD has a lower priority than WFRM, this is to extract the snapshot before sending it
189 #define TASK_PRIORITY_SWBD 37 // SWBD has a lower priority than WFRM, this is to extract the snapshot before sending it
167 #define TASK_PRIORITY_WFRM 40
190 #define TASK_PRIORITY_WFRM 40
168 #define TASK_PRIORITY_CWF3 40 // there is a printf in this function, be careful with its priority wrt CWF1
191 #define TASK_PRIORITY_CWF3 40 // there is a printf in this function, be careful with its priority wrt CWF1
169 #define TASK_PRIORITY_SEND 45
192 #define TASK_PRIORITY_SEND 45
170 #define TASK_PRIORITY_RECV 50
193 #define TASK_PRIORITY_RECV 50
171 #define TASK_PRIORITY_ACTN 50
194 #define TASK_PRIORITY_ACTN 50
172 #define TASK_PRIORITY_AVF0 60
195 #define TASK_PRIORITY_AVF0 60
173 #define TASK_PRIORITY_BPF0 60
196 #define TASK_PRIORITY_BPF0 60
174 #define TASK_PRIORITY_MATR 100
197 #define TASK_PRIORITY_MATR 100
175 #define TASK_PRIORITY_STAT 200
198 #define TASK_PRIORITY_STAT 200
176 #define TASK_PRIORITY_DUMB 200
199 #define TASK_PRIORITY_DUMB 200
177
200
178 #define ACTION_MSG_QUEUE_COUNT 10
201 #define ACTION_MSG_QUEUE_COUNT 10
179 #define ACTION_MSG_PKTS_COUNT 50
202 #define ACTION_MSG_PKTS_COUNT 50
180 //#define ACTION_MSG_PKTS_MAX_SIZE (PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES)
203 //#define ACTION_MSG_PKTS_MAX_SIZE (PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES)
181 #define ACTION_MSG_PKTS_MAX_SIZE 810 // 806 + 4 => TM_LFR_SCIENCE_BURST_BP2_F1
204 #define ACTION_MSG_PKTS_MAX_SIZE 810 // 806 + 4 => TM_LFR_SCIENCE_BURST_BP2_F1
182 #define ACTION_MSG_SPW_IOCTL_SEND_SIZE 24 // hlen *hdr dlen *data sent options
205 #define ACTION_MSG_SPW_IOCTL_SEND_SIZE 24 // hlen *hdr dlen *data sent options
183
206
184 #define QUEUE_RECV 0
207 #define QUEUE_RECV 0
185 #define QUEUE_SEND 1
208 #define QUEUE_SEND 1
186
209
187 //*******
210 //*******
188 // MACROS
211 // MACROS
189 #ifdef PRINT_MESSAGES_ON_CONSOLE
212 #ifdef PRINT_MESSAGES_ON_CONSOLE
190 #define PRINTF(x) printf(x);
213 #define PRINTF(x) printf(x);
191 #define PRINTF1(x,y) printf(x,y);
214 #define PRINTF1(x,y) printf(x,y);
192 #define PRINTF2(x,y,z) printf(x,y,z);
215 #define PRINTF2(x,y,z) printf(x,y,z);
193 #else
216 #else
194 #define PRINTF(x) ;
217 #define PRINTF(x) ;
195 #define PRINTF1(x,y) ;
218 #define PRINTF1(x,y) ;
196 #define PRINTF2(x,y,z) ;
219 #define PRINTF2(x,y,z) ;
197 #endif
220 #endif
198
221
199 #ifdef BOOT_MESSAGES
222 #ifdef BOOT_MESSAGES
200 #define BOOT_PRINTF(x) printf(x);
223 #define BOOT_PRINTF(x) printf(x);
201 #define BOOT_PRINTF1(x,y) printf(x,y);
224 #define BOOT_PRINTF1(x,y) printf(x,y);
202 #define BOOT_PRINTF2(x,y,z) printf(x,y,z);
225 #define BOOT_PRINTF2(x,y,z) printf(x,y,z);
203 #else
226 #else
204 #define BOOT_PRINTF(x) ;
227 #define BOOT_PRINTF(x) ;
205 #define BOOT_PRINTF1(x,y) ;
228 #define BOOT_PRINTF1(x,y) ;
206 #define BOOT_PRINTF2(x,y,z) ;
229 #define BOOT_PRINTF2(x,y,z) ;
207 #endif
230 #endif
208
231
209 #ifdef DEBUG_MESSAGES
232 #ifdef DEBUG_MESSAGES
210 #define DEBUG_PRINTF(x) printf(x);
233 #define DEBUG_PRINTF(x) printf(x);
211 #define DEBUG_PRINTF1(x,y) printf(x,y);
234 #define DEBUG_PRINTF1(x,y) printf(x,y);
212 #define DEBUG_PRINTF2(x,y,z) printf(x,y,z);
235 #define DEBUG_PRINTF2(x,y,z) printf(x,y,z);
213 #else
236 #else
214 #define DEBUG_PRINTF(x) ;
237 #define DEBUG_PRINTF(x) ;
215 #define DEBUG_PRINTF1(x,y) ;
238 #define DEBUG_PRINTF1(x,y) ;
216 #define DEBUG_PRINTF2(x,y,z) ;
239 #define DEBUG_PRINTF2(x,y,z) ;
217 #endif
240 #endif
218
241
219 #define CPU_USAGE_REPORT_PERIOD 6 // * 10 s = period
242 #define CPU_USAGE_REPORT_PERIOD 6 // * 10 s = period
220
243
221 struct param_local_str{
244 struct param_local_str{
222 unsigned int local_sbm1_nb_cwf_sent;
245 unsigned int local_sbm1_nb_cwf_sent;
223 unsigned int local_sbm1_nb_cwf_max;
246 unsigned int local_sbm1_nb_cwf_max;
224 unsigned int local_sbm2_nb_cwf_sent;
247 unsigned int local_sbm2_nb_cwf_sent;
225 unsigned int local_sbm2_nb_cwf_max;
248 unsigned int local_sbm2_nb_cwf_max;
226 unsigned int local_nb_interrupt_f0_MAX;
249 unsigned int local_nb_interrupt_f0_MAX;
227 };
250 };
228
251
229 #endif // FSW_PARAMS_H_INCLUDED
252 #endif // FSW_PARAMS_H_INCLUDED
@@ -1,28 +1,34
1 #ifndef TM_BYTE_POSITIONS_H
1 #ifndef TM_BYTE_POSITIONS_H
2 #define TM_BYTE_POSITIONS_H
2 #define TM_BYTE_POSITIONS_H
3
3
4 // TC_LFR_LOAD_COMMON_PAR
4 // TC_LFR_LOAD_COMMON_PAR
5
5
6 // TC_LFR_LOAD_NORMAL_PAR
6 // TC_LFR_LOAD_NORMAL_PAR
7 #define DATAFIELD_POS_SY_LFR_N_SWF_L 0
7 #define DATAFIELD_POS_SY_LFR_N_SWF_L 0
8 #define DATAFIELD_POS_SY_LFR_N_SWF_P 2
8 #define DATAFIELD_POS_SY_LFR_N_SWF_P 2
9 #define DATAFIELD_POS_SY_LFR_N_ASM_P 4
9 #define DATAFIELD_POS_SY_LFR_N_ASM_P 4
10 #define DATAFIELD_POS_SY_LFR_N_BP_P0 6
10 #define DATAFIELD_POS_SY_LFR_N_BP_P0 6
11 #define DATAFIELD_POS_SY_LFR_N_BP_P1 7
11 #define DATAFIELD_POS_SY_LFR_N_BP_P1 7
12 #define DATAFIELD_POS_SY_LFR_N_CWF_LONG_F3 8
12 #define DATAFIELD_POS_SY_LFR_N_CWF_LONG_F3 8
13
13
14 // TC_LFR_LOAD_BURST_PAR
14 // TC_LFR_LOAD_BURST_PAR
15 #define DATAFIELD_POS_SY_LFR_B_BP_P0 0
16 #define DATAFIELD_POS_SY_LFR_B_BP_P1 1
15
17
16 // TC_LFR_LOAD_SBM1_PAR
18 // TC_LFR_LOAD_SBM1_PAR
19 #define DATAFIELD_POS_SY_LFR_S1_BP_P0 0
20 #define DATAFIELD_POS_SY_LFR_S1_BP_P1 1
17
21
18 // TC_LFR_LOAD_SBM2_PAR
22 // TC_LFR_LOAD_SBM2_PAR
23 #define DATAFIELD_POS_SY_LFR_S2_BP_P0 0
24 #define DATAFIELD_POS_SY_LFR_S2_BP_P1 1
19
25
20 // TC_LFR_UPDATE_INFO
26 // TC_LFR_UPDATE_INFO
21 #define BYTE_POS_UPDATE_INFO_PARAMETERS_SET5 34
27 #define BYTE_POS_UPDATE_INFO_PARAMETERS_SET5 34
22 #define BYTE_POS_UPDATE_INFO_PARAMETERS_SET6 35
28 #define BYTE_POS_UPDATE_INFO_PARAMETERS_SET6 35
23
29
24 // TC_LFR_ENTER_MODE
30 // TC_LFR_ENTER_MODE
25 #define BYTE_POS_CP_MODE_LFR_SET 11
31 #define BYTE_POS_CP_MODE_LFR_SET 11
26 #define BYTE_POS_CP_LFR_ENTER_MODE_TIME 12
32 #define BYTE_POS_CP_LFR_ENTER_MODE_TIME 12
27
33
28 #endif // TM_BYTE_POSITIONS_H
34 #endif // TM_BYTE_POSITIONS_H
@@ -1,57 +1,66
1 #ifndef FSW_PARAMS_PROCESSING_H
1 #ifndef FSW_PARAMS_PROCESSING_H
2 #define FSW_PARAMS_PROCESSING_H
2 #define FSW_PARAMS_PROCESSING_H
3
3
4 #define NB_BINS_PER_SM 128
4 #define NB_BINS_PER_SM 128
5 #define NB_VALUES_PER_SM 25
5 #define NB_VALUES_PER_SM 25
6 #define TOTAL_SIZE_SM 3200 // 25 * 128
6 #define TOTAL_SIZE_SM 3200 // 25 * 128
7 #define TOTAL_SIZE_NORM_BP1_F0 99 // 11 * 9 = 99
7 #define TOTAL_SIZE_NORM_BP1_F0 99 // 11 * 9 = 99
8 #define TOTAL_SIZE_NORM_BP1_F1 117 // 13 * 9 = 117
8 #define TOTAL_SIZE_NORM_BP1_F1 117 // 13 * 9 = 117
9 #define TOTAL_SIZE_NORM_BP1_F2 108 // 12 * 9 = 108
9 #define TOTAL_SIZE_NORM_BP1_F2 108 // 12 * 9 = 108
10 #define TOTAL_SIZE_SBM1_BP1_F0 198 // 22 * 9 = 198
10 #define TOTAL_SIZE_SBM1_BP1_F0 198 // 22 * 9 = 198
11 //
11 //
12 #define NB_RING_NODES_ASM_F0 12 // AT LEAST 3
12 #define NB_RING_NODES_SM_F0 12 // AT LEAST 3
13 #define NB_RING_NODES_ASM_F1 2 // AT LEAST 3
13 #define NB_RING_NODES_SM_F1 3 // AT LEAST 3
14 #define NB_RING_NODES_ASM_F2 2 // AT LEAST 3
14 #define NB_RING_NODES_SM_F2 3 // AT LEAST 3
15 #define NB_RING_NODES_SBM1_BP1 10 // AT LEAST 3
15 #define NB_RING_NODES_ASM_BURST_SBM_F0 10 // AT LEAST 3
16 #define NB_RING_NODES_SBM1_BP2 5 // AT LEAST 3
17 //
16 //
18 #define NB_BINS_PER_ASM_F0 88
17 #define NB_BINS_PER_ASM_F0 88
19 #define NB_BINS_PER_PKT_ASM_F0 44
18 #define NB_BINS_PER_PKT_ASM_F0 44
20 #define TOTAL_SIZE_ASM_F0_IN_BYTES 4400 // 25 * 88 * 2
19 #define TOTAL_SIZE_ASM_F0_IN_BYTES 4400 // 25 * 88 * 2
21 #define ASM_F0_INDICE_START 17 // 88 bins
20 #define ASM_F0_INDICE_START 17 // 88 bins
22 #define ASM_F0_INDICE_STOP 104 // 2 packets of 44 bins
21 #define ASM_F0_INDICE_STOP 104 // 2 packets of 44 bins
23 //
22 //
24 #define NB_BINS_PER_ASM_F1 104
23 #define NB_BINS_PER_ASM_F1 104
25 #define NB_BINS_PER_PKT_ASM_F1 52
24 #define NB_BINS_PER_PKT_ASM_F1 52
26 #define TOTAL_SIZE_ASM_F1 2600 // 25 * 104
25 #define TOTAL_SIZE_ASM_F1 2600 // 25 * 104
27 #define ASM_F1_INDICE_START 6 // 104 bins
26 #define ASM_F1_INDICE_START 6 // 104 bins
28 #define ASM_F1_INDICE_STOP 109 // 2 packets of 52 bins
27 #define ASM_F1_INDICE_STOP 109 // 2 packets of 52 bins
29 //
28 //
30 #define NB_BINS_PER_ASM_F2 96
29 #define NB_BINS_PER_ASM_F2 96
31 #define NB_BINS_PER_PKT_ASM_F2 48
30 #define NB_BINS_PER_PKT_ASM_F2 48
32 #define TOTAL_SIZE_ASM_F2 2400 // 25 * 96
31 #define TOTAL_SIZE_ASM_F2 2400 // 25 * 96
33 #define ASM_F2_INDICE_START 7 // 96 bins
32 #define ASM_F2_INDICE_START 7 // 96 bins
34 #define ASM_F2_INDICE_STOP 102 // 2 packets of 48 bins
33 #define ASM_F2_INDICE_STOP 102 // 2 packets of 48 bins
35 //
34 //
36 #define NB_BINS_COMPRESSED_SM_F0 11
35 #define NB_BINS_COMPRESSED_SM_F0 11
37 #define NB_BINS_COMPRESSED_SM_F1 13
36 #define NB_BINS_COMPRESSED_SM_F1 13
38 #define NB_BINS_COMPRESSED_SM_F2 12
37 #define NB_BINS_COMPRESSED_SM_F2 12
39 #define NB_BINS_COMPRESSED_SM_SBM1_F0 22
38 #define NB_BINS_COMPRESSED_SM_SBM_F0 22
39
40 //
40 //
41 #define NB_BINS_TO_AVERAGE_ASM_F0 8
41 #define NB_BINS_TO_AVERAGE_ASM_F0 8
42 #define NB_BINS_TO_AVERAGE_ASM_F1 8
42 #define NB_BINS_TO_AVERAGE_ASM_F1 8
43 #define NB_BINS_TO_AVERAGE_ASM_F2 8
43 #define NB_BINS_TO_AVERAGE_ASM_F2 8
44 #define NB_BINS_TO_AVERAGE_ASM_SBM1_F0 4
44 #define NB_BINS_TO_AVERAGE_ASM_SBM_F0 4
45 //
45 //
46 #define TOTAL_SIZE_COMPRESSED_ASM_F0 275 // 11 * 25 WORDS
46 #define TOTAL_SIZE_COMPRESSED_ASM_F0 275 // 11 * 25 WORDS
47 #define TOTAL_SIZE_COMPRESSED_ASM_F1 325 // 13 * 25 WORDS
47 #define TOTAL_SIZE_COMPRESSED_ASM_F1 325 // 13 * 25 WORDS
48 #define TOTAL_SIZE_COMPRESSED_ASM_F2 300 // 12 * 25 WORDS
48 #define TOTAL_SIZE_COMPRESSED_ASM_F2 300 // 12 * 25 WORDS
49 #define TOTAL_SIZE_COMPRESSED_ASM_SBM1 550 // 22 * 25 WORDS
49 #define TOTAL_SIZE_COMPRESSED_ASM_SBM1 550 // 22 * 25 WORDS
50 // NORM
50 #define NB_SM_BEFORE_NORM_BP1_F0 384 // 96 * 4
51 #define NB_SM_BEFORE_NORM_BP1_F0 384 // 96 * 4
51 #define NB_SM_BEFORE_NORM_BP2_F0 1920 // 96 * 20
52 #define NB_SM_BEFORE_NORM_BP2_F0 1920 // 96 * 20
52 #define NB_SM_BEFORE_NORM_ASM_F0 384 // 384 matrices at f0 = 4.00 second
53 #define NB_SM_BEFORE_NORM_ASM_F0 384 // 384 matrices at f0 = 4.00 second
53 #define NB_SM_BEFORE_SBM1_BP1_F0 24 // 24 matrices at f0 = 0.25 second
54 // BURST
54 #define NB_SM_BEFORE_SBM1_BP2_F0 96 // 96 matrices at f0 = 1.00 second
55 #define NB_SM_BEFORE_BURST_BP1_F0 96 // 96 matrices at f0 = 1.00 second
56 #define NB_SM_BEFORE_BURST_BP2_F0 480 // 480 matrices at f0 = 5.00 second
57 // SBM1
58 #define NB_SM_BEFORE_SBM1_BP1_F0 24 // 24 matrices at f0 = 0.25 second
59 #define NB_SM_BEFORE_SBM1_BP2_F0 96 // 96 matrices at f0 = 1.00 second
60 // SBM2
61 #define NB_SM_BEFORE_SBM2_BP1_F0 96 // 96 matrices at f0 = 1.00 second
62 #define NB_SM_BEFORE_SBM2_BP2_F0 480 // 480 matrices at f0 = 5.00 second
63 // GENERAL
55 #define NB_SM_BEFORE_AVF0 8
64 #define NB_SM_BEFORE_AVF0 8
56
65
57 #endif // FSW_PARAMS_PROCESSING_H
66 #endif // FSW_PARAMS_PROCESSING_H
@@ -1,108 +1,109
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
13
14 typedef struct ring_node_sm
14 typedef struct ring_node_sm
15 {
15 {
16 struct ring_node_sm *previous;
16 struct ring_node_sm *previous;
17 struct ring_node_sm *next;
17 int buffer_address;
18 int buffer_address;
18 struct ring_node_sm *next;
19 unsigned int status;
19 unsigned int status;
20 unsigned int coarseTime;
20 unsigned int coarseTime;
21 unsigned int fineTime;
21 unsigned int fineTime;
22 } ring_node_sm;
22 } ring_node_sm;
23
23
24 typedef struct ring_node_bp
24 typedef struct ring_node_asm
25 {
25 {
26 struct ring_node_bp *previous;
26 struct ring_node_asm *previous;
27 struct ring_node_bp *next;
27 struct ring_node_asm *next;
28 float asm_burst_sbm_f0[ TIME_OFFSET + TOTAL_SIZE_SM ];
28 unsigned int status;
29 unsigned int status;
29 unsigned int coarseTime;
30 } ring_node_asm;
30 unsigned int fineTime;
31 Header_TM_LFR_SCIENCE_BP_t header;
32 unsigned char data[ 30 * 22 ]; // MAX size is 22 * 30 TM_LFR_SCIENCE_BURST_BP2_F1
33 } ring_node_bp;
34
31
35 typedef struct ring_node_bp_with_spare
32 typedef struct bp_packet
36 {
33 {
37 struct ring_node_bp_with_spare *previous;
34 Header_TM_LFR_SCIENCE_BP_t header;
38 struct ring_node_bp_with_spare *next;
35 unsigned char data[ 30 * 22 ]; // MAX size is 22 * 30 [TM_LFR_SCIENCE_BURST_BP2_F1]
39 unsigned int status;
36 } bp_packet;
40 unsigned int coarseTime;
37
41 unsigned int fineTime;
38 typedef struct bp_packet_with_spare
39 {
42 Header_TM_LFR_SCIENCE_BP_with_spare_t header;
40 Header_TM_LFR_SCIENCE_BP_with_spare_t header;
43 unsigned char data[ 9 * 22 ];
41 unsigned char data[ 9 * 13 ]; // only for TM_LFR_SCIENCE_NORMAL_BP1_F0 and F1
44 } ring_node_bp_with_spare;
42 } bp_packet_with_spare;
43
44 extern nb_sm_t nb_sm;
45 extern nb_sm_before_bp_t nb_sm_before_bp;
45
46
46 extern volatile int sm_f0[ ];
47 extern volatile int sm_f0[ ];
47 extern volatile int sm_f1[ ];
48 extern volatile int sm_f1[ ];
48 extern volatile int sm_f2[ ];
49 extern volatile int sm_f2[ ];
49
50
50 // parameters
51 // parameters
51 extern struct param_local_str param_local;
52 extern struct param_local_str param_local;
52
53
53 // registers
54 // registers
54 extern time_management_regs_t *time_management_regs;
55 extern time_management_regs_t *time_management_regs;
55 extern spectral_matrix_regs_t *spectral_matrix_regs;
56 extern spectral_matrix_regs_t *spectral_matrix_regs;
56
57
57 extern rtems_name misc_name[5];
58 extern rtems_name misc_name[5];
58 extern rtems_id Task_id[20]; /* array of task ids */
59 extern rtems_id Task_id[20]; /* array of task ids */
59
60
60 void init_sm_rings( void );
61 void reset_current_sm_ring_nodes( void );
62 void reset_current_bp_ring_nodes( void );
63
64 // ISR
61 // ISR
65 void reset_nb_sm_f0( void );
62 void reset_nb_sm_f0( unsigned char lfrMode );
66 rtems_isr spectral_matrices_isr( rtems_vector_number vector );
63 rtems_isr spectral_matrices_isr( rtems_vector_number vector );
67 rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector );
64 rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector );
68
65
69 // RTEMS TASKS
66 // RTEMS TASKS
70 rtems_task avf0_task(rtems_task_argument argument);
67 rtems_task smiq_task( rtems_task_argument argument ); // added to test the spectral matrix simulator
71 rtems_task smiq_task(rtems_task_argument argument); // added to test the spectral matrix simulator
68 rtems_task avf0_task( rtems_task_argument lfrRequestedMode );
72 rtems_task matr_task(rtems_task_argument argument);
69 rtems_task matr_task( rtems_task_argument lfrRequestedMode );
73
70
74 //*****************************
71 //******************
75 // Spectral matrices processing
72 // Spectral Matrices
76
73 void SM_init_rings( void );
74 void ASM_init_ring( void );
75 void SM_reset_current_ring_nodes( void );
76 void ASM_reset_current_ring_node( void );
77 void ASM_init_header( Header_TM_LFR_SCIENCE_ASM_t *header);
77 void SM_average(float *averaged_spec_mat_f0, float *averaged_spec_mat_f1,
78 void SM_average(float *averaged_spec_mat_f0, float *averaged_spec_mat_f1,
78 ring_node_sm *ring_node_tab[],
79 ring_node_sm *ring_node_tab[],
79 unsigned int firstTimeF0, unsigned int firstTimeF1 );
80 unsigned int firstTimeF0, unsigned int firstTimeF1 );
80 void ASM_reorganize_and_divide(float *averaged_spec_mat, float *averaged_spec_mat_reorganized,
81 void ASM_reorganize_and_divide(float *averaged_spec_mat, float *averaged_spec_mat_reorganized,
81 float divider );
82 float divider );
82 void ASM_compress_reorganize_and_divide(float *averaged_spec_mat, float *compressed_spec_mat,
83 void ASM_compress_reorganize_and_divide(float *averaged_spec_mat, float *compressed_spec_mat,
83 float divider,
84 float divider,
84 unsigned char nbBinsCompressedMatrix, unsigned char nbBinsToAverage , unsigned char ASMIndexStart);
85 unsigned char nbBinsCompressedMatrix, unsigned char nbBinsToAverage , unsigned char ASMIndexStart);
85 void ASM_convert(volatile float *input_matrix, char *output_matrix);
86 void ASM_convert(volatile float *input_matrix, char *output_matrix);
86 void ASM_send(Header_TM_LFR_SCIENCE_ASM_t *header, char *spectral_matrix,
87 void ASM_send(Header_TM_LFR_SCIENCE_ASM_t *header, char *spectral_matrix,
87 unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send, rtems_id queue_id);
88 unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send, rtems_id queue_id);
88
89
90 //*****************
91 // Basic Parameters
92
93 void BP_reset_current_ring_nodes( void );
94 void BP_init_header(Header_TM_LFR_SCIENCE_BP_t *header,
95 unsigned int apid, unsigned char sid,
96 unsigned int packetLength , unsigned char blkNr);
97 void BP_init_header_with_spare(Header_TM_LFR_SCIENCE_BP_with_spare_t *header,
98 unsigned int apid, unsigned char sid,
99 unsigned int packetLength, unsigned char blkNr );
89 void BP_send(char *data,
100 void BP_send(char *data,
90 rtems_id queue_id ,
101 rtems_id queue_id ,
91 unsigned int nbBytesToSend );
102 unsigned int nbBytesToSend );
92
103
93 void init_header_asm( Header_TM_LFR_SCIENCE_ASM_t *header);
104 //******************
94 void init_bp_ring_sbm1_bp1( void );
105 // general functions
95 void init_bp_ring_sbm1_bp2( void );
96 void init_headers_bp_ring_sbm1_bp1();
97 void init_header_bp(Header_TM_LFR_SCIENCE_BP_t *header,
98 unsigned int apid, unsigned char sid,
99 unsigned int packetLength , unsigned char blkNr);
100 void init_header_bp_with_spare(Header_TM_LFR_SCIENCE_BP_with_spare_t *header,
101 unsigned int apid, unsigned char sid,
102 unsigned int packetLength, unsigned char blkNr );
103
104 void reset_spectral_matrix_regs( void );
106 void reset_spectral_matrix_regs( void );
105
107 void set_time(unsigned char *time, unsigned char *timeInBuffer );
106 void set_time( unsigned char *time, unsigned int coarseTime, unsigned int fineTime );
107
108
108 #endif // FSW_PROCESSING_H_INCLUDED
109 #endif // FSW_PROCESSING_H_INCLUDED
@@ -1,60 +1,60
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);
28 int action_enter_mode(ccsdsTelecommandPacket_t *TC, rtems_id queue_id);
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 check_mode_value( unsigned char requestedMode );
35 int check_mode_value( unsigned char requestedMode );
36 int check_mode_transition( unsigned char requestedMode );
36 int check_mode_transition( unsigned char requestedMode );
37 int check_transition_date( unsigned int transitionCoarseTime );
37 int check_transition_date( unsigned int transitionCoarseTime );
38 int stop_current_mode( void );
38 int stop_current_mode( void );
39 int enter_mode( unsigned char mode , unsigned int transitionCoarseTime );
39 int enter_mode( unsigned char mode , unsigned int transitionCoarseTime );
40 int restart_science_tasks();
40 int restart_science_tasks(unsigned char lfrRequestedMode );
41 int suspend_science_tasks();
41 int suspend_science_tasks();
42 void launch_waveform_picker(unsigned char mode , unsigned int transitionCoarseTime);
42 void launch_waveform_picker(unsigned char mode , unsigned int transitionCoarseTime);
43 void launch_spectral_matrix( unsigned char mode );
43 void launch_spectral_matrix( unsigned char mode );
44 void set_irq_on_new_ready_matrix(unsigned char value );
44 void set_irq_on_new_ready_matrix(unsigned char value );
45 void set_run_matrix_spectral( unsigned char value );
45 void set_run_matrix_spectral( unsigned char value );
46 void launch_spectral_matrix_simu( unsigned char mode );
46 void launch_spectral_matrix_simu( unsigned char mode );
47
47
48 // other functions
48 // other functions
49 void updateLFRCurrentMode();
49 void updateLFRCurrentMode();
50 void update_last_TC_exe( ccsdsTelecommandPacket_t *TC , unsigned char *time );
50 void update_last_TC_exe( ccsdsTelecommandPacket_t *TC , unsigned char *time );
51 void update_last_TC_rej(ccsdsTelecommandPacket_t *TC , unsigned char *time );
51 void update_last_TC_rej(ccsdsTelecommandPacket_t *TC , unsigned char *time );
52 void close_action( ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id );
52 void close_action( ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id );
53
53
54 extern rtems_status_code get_message_queue_id_send( rtems_id *queue_id );
54 extern rtems_status_code get_message_queue_id_send( rtems_id *queue_id );
55 extern rtems_status_code get_message_queue_id_recv( rtems_id *queue_id );
55 extern rtems_status_code get_message_queue_id_recv( rtems_id *queue_id );
56
56
57 #endif // TC_HANDLER_H_INCLUDED
57 #endif // TC_HANDLER_H_INCLUDED
58
58
59
59
60
60
@@ -1,33 +1,49
1 #ifndef TC_LOAD_DUMP_PARAMETERS_H
1 #ifndef TC_LOAD_DUMP_PARAMETERS_H
2 #define TC_LOAD_DUMP_PARAMETERS_H
2 #define TC_LOAD_DUMP_PARAMETERS_H
3
3
4 #include <rtems.h>
4 #include <rtems.h>
5 #include <stdio.h>
5 #include <stdio.h>
6
6
7 #include "fsw_params.h"
7 #include "fsw_params.h"
8 #include "wf_handler.h"
8 #include "wf_handler.h"
9 #include "tm_lfr_tc_exe.h"
9 #include "tm_lfr_tc_exe.h"
10 #include "fsw_misc.h"
10 #include "fsw_misc.h"
11
11
12 extern nb_sm_t nb_sm;
13 extern nb_sm_before_bp_t nb_sm_before_bp;
14
12 int action_load_common_par( ccsdsTelecommandPacket_t *TC );
15 int action_load_common_par( ccsdsTelecommandPacket_t *TC );
13 int action_load_normal_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time);
16 int action_load_normal_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time);
14 int action_load_burst_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time);
17 int action_load_burst_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time);
15 int action_load_sbm1_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time);
18 int action_load_sbm1_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time);
16 int action_load_sbm2_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time);
19 int action_load_sbm2_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time);
17 int action_dump_par(rtems_id queue_id );
20 int action_dump_par(rtems_id queue_id );
18
21
22 // NORMAL
19 int set_sy_lfr_n_swf_l(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time);
23 int set_sy_lfr_n_swf_l(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time);
20 int set_sy_lfr_n_swf_p( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time );
24 int set_sy_lfr_n_swf_p( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time );
21 int set_sy_lfr_n_asm_p( ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
25 int set_sy_lfr_n_asm_p( ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
22 int set_sy_lfr_n_bp_p0( ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
26 int set_sy_lfr_n_bp_p0( ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
23 int set_sy_lfr_n_bp_p1( ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
27 int set_sy_lfr_n_bp_p1( ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
24 int set_sy_lfr_n_cwf_long_f3(ccsdsTelecommandPacket_t *TC, rtems_id queue_id);
28 int set_sy_lfr_n_cwf_long_f3(ccsdsTelecommandPacket_t *TC, rtems_id queue_id);
25
29
30 // BURST
31 int set_sy_lfr_b_bp_p0( ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
32 int set_sy_lfr_b_bp_p1( ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
33
34 // SBM1
35 int set_sy_lfr_s1_bp_p0( ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
36 int set_sy_lfr_s1_bp_p1( ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
37
38 // SBM2
39 int set_sy_lfr_s2_bp_p0( ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
40 int set_sy_lfr_s2_bp_p1( ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
41
26 // TC_LFR_UPDATE_INFO
42 // TC_LFR_UPDATE_INFO
27 unsigned int check_update_info_hk_lfr_mode( unsigned char mode );
43 unsigned int check_update_info_hk_lfr_mode( unsigned char mode );
28 unsigned int check_update_info_hk_tds_mode( unsigned char mode );
44 unsigned int check_update_info_hk_tds_mode( unsigned char mode );
29 unsigned int check_update_info_hk_thr_mode( unsigned char mode );
45 unsigned int check_update_info_hk_thr_mode( unsigned char mode );
30
46
31 void init_parameter_dump( void );
47 void init_parameter_dump( void );
32
48
33 #endif // TC_LOAD_DUMP_PARAMETERS_H
49 #endif // TC_LOAD_DUMP_PARAMETERS_H
@@ -1,73 +1,78
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 //***********************************
48 // SPECTRAL MATRICES GLOBAL VARIABLES
49 // SPECTRAL MATRICES GLOBAL VARIABLES
50
51 nb_sm_t nb_sm;
52 nb_sm_before_bp_t nb_sm_before_bp;
53
49 // alignment constraints for the spectral matrices buffers => the first data after the time (8 bytes) shall be aligned on 0x00
54 // alignment constraints for the spectral matrices buffers => the first data after the time (8 bytes) shall be aligned on 0x00
50 volatile int sm_f0[ NB_RING_NODES_ASM_F0 * TOTAL_SIZE_SM ] __attribute__((aligned(0x100)));
55 volatile int sm_f0[ NB_RING_NODES_SM_F0 * TOTAL_SIZE_SM ] __attribute__((aligned(0x100)));
51 volatile int sm_f1[ NB_RING_NODES_ASM_F1 * TOTAL_SIZE_SM ] __attribute__((aligned(0x100)));
56 volatile int sm_f1[ NB_RING_NODES_SM_F1 * TOTAL_SIZE_SM ] __attribute__((aligned(0x100)));
52 volatile int sm_f2[ NB_RING_NODES_ASM_F2 * TOTAL_SIZE_SM ] __attribute__((aligned(0x100)));
57 volatile int sm_f2[ NB_RING_NODES_SM_F2 * TOTAL_SIZE_SM ] __attribute__((aligned(0x100)));
53
58
54 // APB CONFIGURATION REGISTERS
59 // APB CONFIGURATION REGISTERS
55 time_management_regs_t *time_management_regs = (time_management_regs_t*) REGS_ADDR_TIME_MANAGEMENT;
60 time_management_regs_t *time_management_regs = (time_management_regs_t*) REGS_ADDR_TIME_MANAGEMENT;
56 gptimer_regs_t *gptimer_regs = (gptimer_regs_t *) REGS_ADDR_GPTIMER;
61 gptimer_regs_t *gptimer_regs = (gptimer_regs_t *) REGS_ADDR_GPTIMER;
57 waveform_picker_regs_new_t *waveform_picker_regs = (waveform_picker_regs_new_t*) REGS_ADDR_WAVEFORM_PICKER;
62 waveform_picker_regs_new_t *waveform_picker_regs = (waveform_picker_regs_new_t*) REGS_ADDR_WAVEFORM_PICKER;
58 spectral_matrix_regs_t *spectral_matrix_regs = (spectral_matrix_regs_t*) REGS_ADDR_SPECTRAL_MATRIX;
63 spectral_matrix_regs_t *spectral_matrix_regs = (spectral_matrix_regs_t*) REGS_ADDR_SPECTRAL_MATRIX;
59
64
60 // MODE PARAMETERS
65 // MODE PARAMETERS
61 Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet;
66 Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet;
62 struct param_local_str param_local;
67 struct param_local_str param_local;
63
68
64 // HK PACKETS
69 // HK PACKETS
65 Packet_TM_LFR_HK_t housekeeping_packet;
70 Packet_TM_LFR_HK_t housekeeping_packet;
66 // sequence counters are incremented by APID (PID + CAT) and destination ID
71 // sequence counters are incremented by APID (PID + CAT) and destination ID
67 unsigned short sequenceCounters_SCIENCE_NORMAL_BURST;
72 unsigned short sequenceCounters_SCIENCE_NORMAL_BURST;
68 unsigned short sequenceCounters_SCIENCE_SBM1_SBM2;
73 unsigned short sequenceCounters_SCIENCE_SBM1_SBM2;
69 unsigned short sequenceCounters_TC_EXE[SEQ_CNT_NB_DEST_ID];
74 unsigned short sequenceCounters_TC_EXE[SEQ_CNT_NB_DEST_ID];
70 spw_stats spacewire_stats;
75 spw_stats spacewire_stats;
71 spw_stats spacewire_stats_backup;
76 spw_stats spacewire_stats_backup;
72
77
73
78
@@ -1,646 +1,645
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 reset_local_time();
73 reset_local_time();
74
74
75 rtems_status_code status;
75 rtems_status_code status;
76 rtems_status_code status_spw;
76 rtems_status_code status_spw;
77 rtems_isr_entry old_isr_handler;
77 rtems_isr_entry old_isr_handler;
78
78
79 // UART settings
79 // UART settings
80 send_console_outputs_on_apbuart_port();
80 send_console_outputs_on_apbuart_port();
81 set_apbuart_scaler_reload_register(REGS_ADDR_APBUART, APBUART_SCALER_RELOAD_VALUE);
81 set_apbuart_scaler_reload_register(REGS_ADDR_APBUART, APBUART_SCALER_RELOAD_VALUE);
82 enable_apbuart_transmitter();
82 enable_apbuart_transmitter();
83 DEBUG_PRINTF("\n\n\n\n\nIn INIT *** Now the console is on port COM1\n")
83 DEBUG_PRINTF("\n\n\n\n\nIn INIT *** Now the console is on port COM1\n")
84
84
85 PRINTF("\n\n\n\n\n")
85 PRINTF("\n\n\n\n\n")
86 PRINTF("*************************\n")
86 PRINTF("*************************\n")
87 PRINTF("** LFR Flight Software **\n")
87 PRINTF("** LFR Flight Software **\n")
88 PRINTF1("** %d.", SW_VERSION_N1)
88 PRINTF1("** %d.", SW_VERSION_N1)
89 PRINTF1("%d.", SW_VERSION_N2)
89 PRINTF1("%d.", SW_VERSION_N2)
90 PRINTF1("%d.", SW_VERSION_N3)
90 PRINTF1("%d.", SW_VERSION_N3)
91 PRINTF1("%d **\n", SW_VERSION_N4)
91 PRINTF1("%d **\n", SW_VERSION_N4)
92 PRINTF("*************************\n")
92 PRINTF("*************************\n")
93 PRINTF("\n\n")
93 PRINTF("\n\n")
94
94
95 init_parameter_dump();
95 init_parameter_dump();
96 init_local_mode_parameters();
96 init_local_mode_parameters();
97 init_housekeeping_parameters();
97 init_housekeeping_parameters();
98
98
99 init_waveform_rings(); // initialize the waveform rings
99 init_waveform_rings(); // initialize the waveform rings
100 init_sm_rings(); // initialize spectral matrices rings
100 SM_init_rings(); // initialize spectral matrices rings
101 init_bp_ring_sbm1_bp1(); // initialize basic parameter ring for SBM1 BP1 set
101 ASM_init_ring(); // initialize the average spectral matrix ring (just for burst, sbm1 and sbm2 asm @ f0 storage)
102 init_bp_ring_sbm1_bp2(); // initialize basic parameter ring for SBM1 BP2 set
103
102
104 reset_wfp_burst_enable();
103 reset_wfp_burst_enable();
105 reset_wfp_status();
104 reset_wfp_status();
106 set_wfp_data_shaping();
105 set_wfp_data_shaping();
107
106
108 updateLFRCurrentMode();
107 updateLFRCurrentMode();
109
108
110 BOOT_PRINTF1("in INIT *** lfrCurrentMode is %d\n", lfrCurrentMode)
109 BOOT_PRINTF1("in INIT *** lfrCurrentMode is %d\n", lfrCurrentMode)
111
110
112 create_names(); // create all names
111 create_names(); // create all names
113
112
114 status = create_message_queues(); // create message queues
113 status = create_message_queues(); // create message queues
115 if (status != RTEMS_SUCCESSFUL)
114 if (status != RTEMS_SUCCESSFUL)
116 {
115 {
117 PRINTF1("in INIT *** ERR in create_message_queues, code %d", status)
116 PRINTF1("in INIT *** ERR in create_message_queues, code %d", status)
118 }
117 }
119
118
120 status = create_all_tasks(); // create all tasks
119 status = create_all_tasks(); // create all tasks
121 if (status != RTEMS_SUCCESSFUL)
120 if (status != RTEMS_SUCCESSFUL)
122 {
121 {
123 PRINTF1("in INIT *** ERR in create_all_tasks, code %d", status)
122 PRINTF1("in INIT *** ERR in create_all_tasks, code %d", status)
124 }
123 }
125
124
126 // **************************
125 // **************************
127 // <SPACEWIRE INITIALIZATION>
126 // <SPACEWIRE INITIALIZATION>
128 grspw_timecode_callback = &timecode_irq_handler;
127 grspw_timecode_callback = &timecode_irq_handler;
129
128
130 status_spw = spacewire_open_link(); // (1) open the link
129 status_spw = spacewire_open_link(); // (1) open the link
131 if ( status_spw != RTEMS_SUCCESSFUL )
130 if ( status_spw != RTEMS_SUCCESSFUL )
132 {
131 {
133 PRINTF1("in INIT *** ERR spacewire_open_link code %d\n", status_spw )
132 PRINTF1("in INIT *** ERR spacewire_open_link code %d\n", status_spw )
134 }
133 }
135
134
136 if ( status_spw == RTEMS_SUCCESSFUL ) // (2) configure the link
135 if ( status_spw == RTEMS_SUCCESSFUL ) // (2) configure the link
137 {
136 {
138 status_spw = spacewire_configure_link( fdSPW );
137 status_spw = spacewire_configure_link( fdSPW );
139 if ( status_spw != RTEMS_SUCCESSFUL )
138 if ( status_spw != RTEMS_SUCCESSFUL )
140 {
139 {
141 PRINTF1("in INIT *** ERR spacewire_configure_link code %d\n", status_spw )
140 PRINTF1("in INIT *** ERR spacewire_configure_link code %d\n", status_spw )
142 }
141 }
143 }
142 }
144
143
145 if ( status_spw == RTEMS_SUCCESSFUL) // (3) start the link
144 if ( status_spw == RTEMS_SUCCESSFUL) // (3) start the link
146 {
145 {
147 status_spw = spacewire_start_link( fdSPW );
146 status_spw = spacewire_start_link( fdSPW );
148 if ( status_spw != RTEMS_SUCCESSFUL )
147 if ( status_spw != RTEMS_SUCCESSFUL )
149 {
148 {
150 PRINTF1("in INIT *** ERR spacewire_start_link code %d\n", status_spw )
149 PRINTF1("in INIT *** ERR spacewire_start_link code %d\n", status_spw )
151 }
150 }
152 }
151 }
153 // </SPACEWIRE INITIALIZATION>
152 // </SPACEWIRE INITIALIZATION>
154 // ***************************
153 // ***************************
155
154
156 status = start_all_tasks(); // start all tasks
155 status = start_all_tasks(); // start all tasks
157 if (status != RTEMS_SUCCESSFUL)
156 if (status != RTEMS_SUCCESSFUL)
158 {
157 {
159 PRINTF1("in INIT *** ERR in start_all_tasks, code %d", status)
158 PRINTF1("in INIT *** ERR in start_all_tasks, code %d", status)
160 }
159 }
161
160
162 // start RECV and SEND *AFTER* SpaceWire Initialization, due to the timeout of the start call during the initialization
161 // start RECV and SEND *AFTER* SpaceWire Initialization, due to the timeout of the start call during the initialization
163 status = start_recv_send_tasks();
162 status = start_recv_send_tasks();
164 if ( status != RTEMS_SUCCESSFUL )
163 if ( status != RTEMS_SUCCESSFUL )
165 {
164 {
166 PRINTF1("in INIT *** ERR start_recv_send_tasks code %d\n", status )
165 PRINTF1("in INIT *** ERR start_recv_send_tasks code %d\n", status )
167 }
166 }
168
167
169 // suspend science tasks, they will be restarted later depending on the mode
168 // suspend science tasks, they will be restarted later depending on the mode
170 status = suspend_science_tasks(); // suspend science tasks (not done in stop_current_mode if current mode = STANDBY)
169 status = suspend_science_tasks(); // suspend science tasks (not done in stop_current_mode if current mode = STANDBY)
171 if (status != RTEMS_SUCCESSFUL)
170 if (status != RTEMS_SUCCESSFUL)
172 {
171 {
173 PRINTF1("in INIT *** in suspend_science_tasks *** ERR code: %d\n", status)
172 PRINTF1("in INIT *** in suspend_science_tasks *** ERR code: %d\n", status)
174 }
173 }
175
174
176 //******************************
175 //******************************
177 // <SPECTRAL MATRICES SIMULATOR>
176 // <SPECTRAL MATRICES SIMULATOR>
178 LEON_Mask_interrupt( IRQ_SM_SIMULATOR );
177 LEON_Mask_interrupt( IRQ_SM_SIMULATOR );
179 configure_timer((gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR, CLKDIV_SM_SIMULATOR,
178 configure_timer((gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR, CLKDIV_SM_SIMULATOR,
180 IRQ_SPARC_SM_SIMULATOR, spectral_matrices_isr_simu );
179 IRQ_SPARC_SM_SIMULATOR, spectral_matrices_isr_simu );
181 // </SPECTRAL MATRICES SIMULATOR>
180 // </SPECTRAL MATRICES SIMULATOR>
182 //*******************************
181 //*******************************
183
182
184 // configure IRQ handling for the waveform picker unit
183 // configure IRQ handling for the waveform picker unit
185 status = rtems_interrupt_catch( waveforms_isr,
184 status = rtems_interrupt_catch( waveforms_isr,
186 IRQ_SPARC_WAVEFORM_PICKER,
185 IRQ_SPARC_WAVEFORM_PICKER,
187 &old_isr_handler) ;
186 &old_isr_handler) ;
188 // configure IRQ handling for the spectral matrices unit
187 // configure IRQ handling for the spectral matrices unit
189 status = rtems_interrupt_catch( spectral_matrices_isr,
188 status = rtems_interrupt_catch( spectral_matrices_isr,
190 IRQ_SPARC_SPECTRAL_MATRIX,
189 IRQ_SPARC_SPECTRAL_MATRIX,
191 &old_isr_handler) ;
190 &old_isr_handler) ;
192
191
193 // if the spacewire link is not up then send an event to the SPIQ task for link recovery
192 // if the spacewire link is not up then send an event to the SPIQ task for link recovery
194 if ( status_spw != RTEMS_SUCCESSFUL )
193 if ( status_spw != RTEMS_SUCCESSFUL )
195 {
194 {
196 status = rtems_event_send( Task_id[TASKID_SPIQ], SPW_LINKERR_EVENT );
195 status = rtems_event_send( Task_id[TASKID_SPIQ], SPW_LINKERR_EVENT );
197 if ( status != RTEMS_SUCCESSFUL ) {
196 if ( status != RTEMS_SUCCESSFUL ) {
198 PRINTF1("in INIT *** ERR rtems_event_send to SPIQ code %d\n", status )
197 PRINTF1("in INIT *** ERR rtems_event_send to SPIQ code %d\n", status )
199 }
198 }
200 }
199 }
201
200
202 BOOT_PRINTF("delete INIT\n")
201 BOOT_PRINTF("delete INIT\n")
203
202
204 send_dumb_hk();
203 send_dumb_hk();
205
204
206 status = rtems_task_delete(RTEMS_SELF);
205 status = rtems_task_delete(RTEMS_SELF);
207
206
208 }
207 }
209
208
210 void init_local_mode_parameters( void )
209 void init_local_mode_parameters( void )
211 {
210 {
212 /** This function initialize the param_local global variable with default values.
211 /** This function initialize the param_local global variable with default values.
213 *
212 *
214 */
213 */
215
214
216 unsigned int i;
215 unsigned int i;
217
216
218 // LOCAL PARAMETERS
217 // LOCAL PARAMETERS
219 set_local_nb_interrupt_f0_MAX();
218 set_local_nb_interrupt_f0_MAX();
220
219
221 BOOT_PRINTF1("local_sbm1_nb_cwf_max %d \n", param_local.local_sbm1_nb_cwf_max)
220 BOOT_PRINTF1("local_sbm1_nb_cwf_max %d \n", param_local.local_sbm1_nb_cwf_max)
222 BOOT_PRINTF1("local_sbm2_nb_cwf_max %d \n", param_local.local_sbm2_nb_cwf_max)
221 BOOT_PRINTF1("local_sbm2_nb_cwf_max %d \n", param_local.local_sbm2_nb_cwf_max)
223 BOOT_PRINTF1("nb_interrupt_f0_MAX = %d\n", param_local.local_nb_interrupt_f0_MAX)
222 BOOT_PRINTF1("nb_interrupt_f0_MAX = %d\n", param_local.local_nb_interrupt_f0_MAX)
224
223
225 // init sequence counters
224 // init sequence counters
226
225
227 for(i = 0; i<SEQ_CNT_NB_DEST_ID; i++)
226 for(i = 0; i<SEQ_CNT_NB_DEST_ID; i++)
228 {
227 {
229 sequenceCounters_TC_EXE[i] = 0x00;
228 sequenceCounters_TC_EXE[i] = 0x00;
230 }
229 }
231 sequenceCounters_SCIENCE_NORMAL_BURST = 0x00;
230 sequenceCounters_SCIENCE_NORMAL_BURST = 0x00;
232 sequenceCounters_SCIENCE_SBM1_SBM2 = 0x00;
231 sequenceCounters_SCIENCE_SBM1_SBM2 = 0x00;
233 }
232 }
234
233
235 void reset_local_time( void )
234 void reset_local_time( void )
236 {
235 {
237 time_management_regs->ctrl = 0x02; // software reset, coarse time = 0x80000000
236 time_management_regs->ctrl = 0x02; // software reset, coarse time = 0x80000000
238 }
237 }
239
238
240 void create_names( void ) // create all names for tasks and queues
239 void create_names( void ) // create all names for tasks and queues
241 {
240 {
242 /** This function creates all RTEMS names used in the software for tasks and queues.
241 /** This function creates all RTEMS names used in the software for tasks and queues.
243 *
242 *
244 * @return RTEMS directive status codes:
243 * @return RTEMS directive status codes:
245 * - RTEMS_SUCCESSFUL - successful completion
244 * - RTEMS_SUCCESSFUL - successful completion
246 *
245 *
247 */
246 */
248
247
249 // task names
248 // task names
250 Task_name[TASKID_RECV] = rtems_build_name( 'R', 'E', 'C', 'V' );
249 Task_name[TASKID_RECV] = rtems_build_name( 'R', 'E', 'C', 'V' );
251 Task_name[TASKID_ACTN] = rtems_build_name( 'A', 'C', 'T', 'N' );
250 Task_name[TASKID_ACTN] = rtems_build_name( 'A', 'C', 'T', 'N' );
252 Task_name[TASKID_SPIQ] = rtems_build_name( 'S', 'P', 'I', 'Q' );
251 Task_name[TASKID_SPIQ] = rtems_build_name( 'S', 'P', 'I', 'Q' );
253 Task_name[TASKID_SMIQ] = rtems_build_name( 'S', 'M', 'I', 'Q' );
252 Task_name[TASKID_SMIQ] = rtems_build_name( 'S', 'M', 'I', 'Q' );
254 Task_name[TASKID_STAT] = rtems_build_name( 'S', 'T', 'A', 'T' );
253 Task_name[TASKID_STAT] = rtems_build_name( 'S', 'T', 'A', 'T' );
255 Task_name[TASKID_AVF0] = rtems_build_name( 'A', 'V', 'F', '0' );
254 Task_name[TASKID_AVF0] = rtems_build_name( 'A', 'V', 'F', '0' );
256 Task_name[TASKID_SWBD] = rtems_build_name( 'S', 'W', 'B', 'D' );
255 Task_name[TASKID_SWBD] = rtems_build_name( 'S', 'W', 'B', 'D' );
257 Task_name[TASKID_WFRM] = rtems_build_name( 'W', 'F', 'R', 'M' );
256 Task_name[TASKID_WFRM] = rtems_build_name( 'W', 'F', 'R', 'M' );
258 Task_name[TASKID_DUMB] = rtems_build_name( 'D', 'U', 'M', 'B' );
257 Task_name[TASKID_DUMB] = rtems_build_name( 'D', 'U', 'M', 'B' );
259 Task_name[TASKID_HOUS] = rtems_build_name( 'H', 'O', 'U', 'S' );
258 Task_name[TASKID_HOUS] = rtems_build_name( 'H', 'O', 'U', 'S' );
260 Task_name[TASKID_MATR] = rtems_build_name( 'M', 'A', 'T', 'R' );
259 Task_name[TASKID_MATR] = rtems_build_name( 'M', 'A', 'T', 'R' );
261 Task_name[TASKID_CWF3] = rtems_build_name( 'C', 'W', 'F', '3' );
260 Task_name[TASKID_CWF3] = rtems_build_name( 'C', 'W', 'F', '3' );
262 Task_name[TASKID_CWF2] = rtems_build_name( 'C', 'W', 'F', '2' );
261 Task_name[TASKID_CWF2] = rtems_build_name( 'C', 'W', 'F', '2' );
263 Task_name[TASKID_CWF1] = rtems_build_name( 'C', 'W', 'F', '1' );
262 Task_name[TASKID_CWF1] = rtems_build_name( 'C', 'W', 'F', '1' );
264 Task_name[TASKID_SEND] = rtems_build_name( 'S', 'E', 'N', 'D' );
263 Task_name[TASKID_SEND] = rtems_build_name( 'S', 'E', 'N', 'D' );
265 Task_name[TASKID_WTDG] = rtems_build_name( 'W', 'T', 'D', 'G' );
264 Task_name[TASKID_WTDG] = rtems_build_name( 'W', 'T', 'D', 'G' );
266
265
267 // rate monotonic period names
266 // rate monotonic period names
268 name_hk_rate_monotonic = rtems_build_name( 'H', 'O', 'U', 'S' );
267 name_hk_rate_monotonic = rtems_build_name( 'H', 'O', 'U', 'S' );
269
268
270 misc_name[QUEUE_RECV] = rtems_build_name( 'Q', '_', 'R', 'V' );
269 misc_name[QUEUE_RECV] = rtems_build_name( 'Q', '_', 'R', 'V' );
271 misc_name[QUEUE_SEND] = rtems_build_name( 'Q', '_', 'S', 'D' );
270 misc_name[QUEUE_SEND] = rtems_build_name( 'Q', '_', 'S', 'D' );
272 }
271 }
273
272
274 int create_all_tasks( void ) // create all tasks which run in the software
273 int create_all_tasks( void ) // create all tasks which run in the software
275 {
274 {
276 /** This function creates all RTEMS tasks used in the software.
275 /** This function creates all RTEMS tasks used in the software.
277 *
276 *
278 * @return RTEMS directive status codes:
277 * @return RTEMS directive status codes:
279 * - RTEMS_SUCCESSFUL - task created successfully
278 * - RTEMS_SUCCESSFUL - task created successfully
280 * - RTEMS_INVALID_ADDRESS - id is NULL
279 * - RTEMS_INVALID_ADDRESS - id is NULL
281 * - RTEMS_INVALID_NAME - invalid task name
280 * - RTEMS_INVALID_NAME - invalid task name
282 * - RTEMS_INVALID_PRIORITY - invalid task priority
281 * - RTEMS_INVALID_PRIORITY - invalid task priority
283 * - RTEMS_MP_NOT_CONFIGURED - multiprocessing not configured
282 * - RTEMS_MP_NOT_CONFIGURED - multiprocessing not configured
284 * - RTEMS_TOO_MANY - too many tasks created
283 * - RTEMS_TOO_MANY - too many tasks created
285 * - RTEMS_UNSATISFIED - not enough memory for stack/FP context
284 * - RTEMS_UNSATISFIED - not enough memory for stack/FP context
286 * - RTEMS_TOO_MANY - too many global objects
285 * - RTEMS_TOO_MANY - too many global objects
287 *
286 *
288 */
287 */
289
288
290 rtems_status_code status;
289 rtems_status_code status;
291
290
292 //**********
291 //**********
293 // SPACEWIRE
292 // SPACEWIRE
294 // RECV
293 // RECV
295 status = rtems_task_create(
294 status = rtems_task_create(
296 Task_name[TASKID_RECV], TASK_PRIORITY_RECV, RTEMS_MINIMUM_STACK_SIZE,
295 Task_name[TASKID_RECV], TASK_PRIORITY_RECV, RTEMS_MINIMUM_STACK_SIZE,
297 RTEMS_DEFAULT_MODES,
296 RTEMS_DEFAULT_MODES,
298 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_RECV]
297 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_RECV]
299 );
298 );
300 if (status == RTEMS_SUCCESSFUL) // SEND
299 if (status == RTEMS_SUCCESSFUL) // SEND
301 {
300 {
302 status = rtems_task_create(
301 status = rtems_task_create(
303 Task_name[TASKID_SEND], TASK_PRIORITY_SEND, RTEMS_MINIMUM_STACK_SIZE,
302 Task_name[TASKID_SEND], TASK_PRIORITY_SEND, RTEMS_MINIMUM_STACK_SIZE,
304 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
303 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
305 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SEND]
304 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SEND]
306 );
305 );
307 }
306 }
308 if (status == RTEMS_SUCCESSFUL) // WTDG
307 if (status == RTEMS_SUCCESSFUL) // WTDG
309 {
308 {
310 status = rtems_task_create(
309 status = rtems_task_create(
311 Task_name[TASKID_WTDG], TASK_PRIORITY_WTDG, RTEMS_MINIMUM_STACK_SIZE,
310 Task_name[TASKID_WTDG], TASK_PRIORITY_WTDG, RTEMS_MINIMUM_STACK_SIZE,
312 RTEMS_DEFAULT_MODES,
311 RTEMS_DEFAULT_MODES,
313 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_WTDG]
312 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_WTDG]
314 );
313 );
315 }
314 }
316 if (status == RTEMS_SUCCESSFUL) // ACTN
315 if (status == RTEMS_SUCCESSFUL) // ACTN
317 {
316 {
318 status = rtems_task_create(
317 status = rtems_task_create(
319 Task_name[TASKID_ACTN], TASK_PRIORITY_ACTN, RTEMS_MINIMUM_STACK_SIZE,
318 Task_name[TASKID_ACTN], TASK_PRIORITY_ACTN, RTEMS_MINIMUM_STACK_SIZE,
320 RTEMS_DEFAULT_MODES,
319 RTEMS_DEFAULT_MODES,
321 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_ACTN]
320 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_ACTN]
322 );
321 );
323 }
322 }
324 if (status == RTEMS_SUCCESSFUL) // SPIQ
323 if (status == RTEMS_SUCCESSFUL) // SPIQ
325 {
324 {
326 status = rtems_task_create(
325 status = rtems_task_create(
327 Task_name[TASKID_SPIQ], TASK_PRIORITY_SPIQ, RTEMS_MINIMUM_STACK_SIZE,
326 Task_name[TASKID_SPIQ], TASK_PRIORITY_SPIQ, RTEMS_MINIMUM_STACK_SIZE,
328 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
327 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
329 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SPIQ]
328 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SPIQ]
330 );
329 );
331 }
330 }
332
331
333 //******************
332 //******************
334 // SPECTRAL MATRICES
333 // SPECTRAL MATRICES
335 if (status == RTEMS_SUCCESSFUL) // SMIQ
334 if (status == RTEMS_SUCCESSFUL) // SMIQ
336 {
335 {
337 status = rtems_task_create(
336 status = rtems_task_create(
338 Task_name[TASKID_SMIQ], TASK_PRIORITY_SMIQ, RTEMS_MINIMUM_STACK_SIZE,
337 Task_name[TASKID_SMIQ], TASK_PRIORITY_SMIQ, RTEMS_MINIMUM_STACK_SIZE,
339 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
338 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
340 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SMIQ]
339 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SMIQ]
341 );
340 );
342 }
341 }
343 if (status == RTEMS_SUCCESSFUL) // AVF0
342 if (status == RTEMS_SUCCESSFUL) // AVF0
344 {
343 {
345 status = rtems_task_create(
344 status = rtems_task_create(
346 Task_name[TASKID_AVF0], TASK_PRIORITY_AVF0, RTEMS_MINIMUM_STACK_SIZE,
345 Task_name[TASKID_AVF0], TASK_PRIORITY_AVF0, RTEMS_MINIMUM_STACK_SIZE,
347 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
346 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
348 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF0]
347 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF0]
349 );
348 );
350 }
349 }
351 if (status == RTEMS_SUCCESSFUL) // MATR
350 if (status == RTEMS_SUCCESSFUL) // MATR
352 {
351 {
353 status = rtems_task_create(
352 status = rtems_task_create(
354 Task_name[TASKID_MATR], TASK_PRIORITY_MATR, RTEMS_MINIMUM_STACK_SIZE,
353 Task_name[TASKID_MATR], TASK_PRIORITY_MATR, RTEMS_MINIMUM_STACK_SIZE,
355 RTEMS_DEFAULT_MODES,
354 RTEMS_DEFAULT_MODES,
356 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_MATR]
355 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_MATR]
357 );
356 );
358 }
357 }
359
358
360 //****************
359 //****************
361 // WAVEFORM PICKER
360 // WAVEFORM PICKER
362 if (status == RTEMS_SUCCESSFUL) // WFRM
361 if (status == RTEMS_SUCCESSFUL) // WFRM
363 {
362 {
364 status = rtems_task_create(
363 status = rtems_task_create(
365 Task_name[TASKID_WFRM], TASK_PRIORITY_WFRM, RTEMS_MINIMUM_STACK_SIZE,
364 Task_name[TASKID_WFRM], TASK_PRIORITY_WFRM, RTEMS_MINIMUM_STACK_SIZE,
366 RTEMS_DEFAULT_MODES,
365 RTEMS_DEFAULT_MODES,
367 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_WFRM]
366 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_WFRM]
368 );
367 );
369 }
368 }
370 if (status == RTEMS_SUCCESSFUL) // CWF3
369 if (status == RTEMS_SUCCESSFUL) // CWF3
371 {
370 {
372 status = rtems_task_create(
371 status = rtems_task_create(
373 Task_name[TASKID_CWF3], TASK_PRIORITY_CWF3, RTEMS_MINIMUM_STACK_SIZE,
372 Task_name[TASKID_CWF3], TASK_PRIORITY_CWF3, RTEMS_MINIMUM_STACK_SIZE,
374 RTEMS_DEFAULT_MODES,
373 RTEMS_DEFAULT_MODES,
375 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF3]
374 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF3]
376 );
375 );
377 }
376 }
378 if (status == RTEMS_SUCCESSFUL) // CWF2
377 if (status == RTEMS_SUCCESSFUL) // CWF2
379 {
378 {
380 status = rtems_task_create(
379 status = rtems_task_create(
381 Task_name[TASKID_CWF2], TASK_PRIORITY_CWF2, RTEMS_MINIMUM_STACK_SIZE,
380 Task_name[TASKID_CWF2], TASK_PRIORITY_CWF2, RTEMS_MINIMUM_STACK_SIZE,
382 RTEMS_DEFAULT_MODES,
381 RTEMS_DEFAULT_MODES,
383 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF2]
382 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF2]
384 );
383 );
385 }
384 }
386 if (status == RTEMS_SUCCESSFUL) // CWF1
385 if (status == RTEMS_SUCCESSFUL) // CWF1
387 {
386 {
388 status = rtems_task_create(
387 status = rtems_task_create(
389 Task_name[TASKID_CWF1], TASK_PRIORITY_CWF1, RTEMS_MINIMUM_STACK_SIZE,
388 Task_name[TASKID_CWF1], TASK_PRIORITY_CWF1, RTEMS_MINIMUM_STACK_SIZE,
390 RTEMS_DEFAULT_MODES,
389 RTEMS_DEFAULT_MODES,
391 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF1]
390 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF1]
392 );
391 );
393 }
392 }
394 if (status == RTEMS_SUCCESSFUL) // SWBD
393 if (status == RTEMS_SUCCESSFUL) // SWBD
395 {
394 {
396 status = rtems_task_create(
395 status = rtems_task_create(
397 Task_name[TASKID_SWBD], TASK_PRIORITY_SWBD, RTEMS_MINIMUM_STACK_SIZE,
396 Task_name[TASKID_SWBD], TASK_PRIORITY_SWBD, RTEMS_MINIMUM_STACK_SIZE,
398 RTEMS_DEFAULT_MODES,
397 RTEMS_DEFAULT_MODES,
399 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_SWBD]
398 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_SWBD]
400 );
399 );
401 }
400 }
402
401
403 //*****
402 //*****
404 // MISC
403 // MISC
405 if (status == RTEMS_SUCCESSFUL) // STAT
404 if (status == RTEMS_SUCCESSFUL) // STAT
406 {
405 {
407 status = rtems_task_create(
406 status = rtems_task_create(
408 Task_name[TASKID_STAT], TASK_PRIORITY_STAT, RTEMS_MINIMUM_STACK_SIZE,
407 Task_name[TASKID_STAT], TASK_PRIORITY_STAT, RTEMS_MINIMUM_STACK_SIZE,
409 RTEMS_DEFAULT_MODES,
408 RTEMS_DEFAULT_MODES,
410 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_STAT]
409 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_STAT]
411 );
410 );
412 }
411 }
413 if (status == RTEMS_SUCCESSFUL) // DUMB
412 if (status == RTEMS_SUCCESSFUL) // DUMB
414 {
413 {
415 status = rtems_task_create(
414 status = rtems_task_create(
416 Task_name[TASKID_DUMB], TASK_PRIORITY_DUMB, RTEMS_MINIMUM_STACK_SIZE,
415 Task_name[TASKID_DUMB], TASK_PRIORITY_DUMB, RTEMS_MINIMUM_STACK_SIZE,
417 RTEMS_DEFAULT_MODES,
416 RTEMS_DEFAULT_MODES,
418 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_DUMB]
417 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_DUMB]
419 );
418 );
420 }
419 }
421 if (status == RTEMS_SUCCESSFUL) // HOUS
420 if (status == RTEMS_SUCCESSFUL) // HOUS
422 {
421 {
423 status = rtems_task_create(
422 status = rtems_task_create(
424 Task_name[TASKID_HOUS], TASK_PRIORITY_HOUS, RTEMS_MINIMUM_STACK_SIZE,
423 Task_name[TASKID_HOUS], TASK_PRIORITY_HOUS, RTEMS_MINIMUM_STACK_SIZE,
425 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
424 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
426 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_HOUS]
425 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_HOUS]
427 );
426 );
428 }
427 }
429
428
430 return status;
429 return status;
431 }
430 }
432
431
433 int start_recv_send_tasks( void )
432 int start_recv_send_tasks( void )
434 {
433 {
435 rtems_status_code status;
434 rtems_status_code status;
436
435
437 status = rtems_task_start( Task_id[TASKID_RECV], recv_task, 1 );
436 status = rtems_task_start( Task_id[TASKID_RECV], recv_task, 1 );
438 if (status!=RTEMS_SUCCESSFUL) {
437 if (status!=RTEMS_SUCCESSFUL) {
439 BOOT_PRINTF("in INIT *** Error starting TASK_RECV\n")
438 BOOT_PRINTF("in INIT *** Error starting TASK_RECV\n")
440 }
439 }
441
440
442 if (status == RTEMS_SUCCESSFUL) // SEND
441 if (status == RTEMS_SUCCESSFUL) // SEND
443 {
442 {
444 status = rtems_task_start( Task_id[TASKID_SEND], send_task, 1 );
443 status = rtems_task_start( Task_id[TASKID_SEND], send_task, 1 );
445 if (status!=RTEMS_SUCCESSFUL) {
444 if (status!=RTEMS_SUCCESSFUL) {
446 BOOT_PRINTF("in INIT *** Error starting TASK_SEND\n")
445 BOOT_PRINTF("in INIT *** Error starting TASK_SEND\n")
447 }
446 }
448 }
447 }
449
448
450 return status;
449 return status;
451 }
450 }
452
451
453 int start_all_tasks( void ) // start all tasks except SEND RECV and HOUS
452 int start_all_tasks( void ) // start all tasks except SEND RECV and HOUS
454 {
453 {
455 /** This function starts all RTEMS tasks used in the software.
454 /** This function starts all RTEMS tasks used in the software.
456 *
455 *
457 * @return RTEMS directive status codes:
456 * @return RTEMS directive status codes:
458 * - RTEMS_SUCCESSFUL - ask started successfully
457 * - RTEMS_SUCCESSFUL - ask started successfully
459 * - RTEMS_INVALID_ADDRESS - invalid task entry point
458 * - RTEMS_INVALID_ADDRESS - invalid task entry point
460 * - RTEMS_INVALID_ID - invalid task id
459 * - RTEMS_INVALID_ID - invalid task id
461 * - RTEMS_INCORRECT_STATE - task not in the dormant state
460 * - RTEMS_INCORRECT_STATE - task not in the dormant state
462 * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot start remote task
461 * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot start remote task
463 *
462 *
464 */
463 */
465 // starts all the tasks fot eh flight software
464 // starts all the tasks fot eh flight software
466
465
467 rtems_status_code status;
466 rtems_status_code status;
468
467
469 //**********
468 //**********
470 // SPACEWIRE
469 // SPACEWIRE
471 status = rtems_task_start( Task_id[TASKID_SPIQ], spiq_task, 1 );
470 status = rtems_task_start( Task_id[TASKID_SPIQ], spiq_task, 1 );
472 if (status!=RTEMS_SUCCESSFUL) {
471 if (status!=RTEMS_SUCCESSFUL) {
473 BOOT_PRINTF("in INIT *** Error starting TASK_SPIQ\n")
472 BOOT_PRINTF("in INIT *** Error starting TASK_SPIQ\n")
474 }
473 }
475
474
476 if (status == RTEMS_SUCCESSFUL) // WTDG
475 if (status == RTEMS_SUCCESSFUL) // WTDG
477 {
476 {
478 status = rtems_task_start( Task_id[TASKID_WTDG], wtdg_task, 1 );
477 status = rtems_task_start( Task_id[TASKID_WTDG], wtdg_task, 1 );
479 if (status!=RTEMS_SUCCESSFUL) {
478 if (status!=RTEMS_SUCCESSFUL) {
480 BOOT_PRINTF("in INIT *** Error starting TASK_WTDG\n")
479 BOOT_PRINTF("in INIT *** Error starting TASK_WTDG\n")
481 }
480 }
482 }
481 }
483
482
484 if (status == RTEMS_SUCCESSFUL) // ACTN
483 if (status == RTEMS_SUCCESSFUL) // ACTN
485 {
484 {
486 status = rtems_task_start( Task_id[TASKID_ACTN], actn_task, 1 );
485 status = rtems_task_start( Task_id[TASKID_ACTN], actn_task, 1 );
487 if (status!=RTEMS_SUCCESSFUL) {
486 if (status!=RTEMS_SUCCESSFUL) {
488 BOOT_PRINTF("in INIT *** Error starting TASK_ACTN\n")
487 BOOT_PRINTF("in INIT *** Error starting TASK_ACTN\n")
489 }
488 }
490 }
489 }
491
490
492 //******************
491 //******************
493 // SPECTRAL MATRICES
492 // SPECTRAL MATRICES
494 if (status == RTEMS_SUCCESSFUL) // SMIQ
493 if (status == RTEMS_SUCCESSFUL) // SMIQ
495 {
494 {
496 status = rtems_task_start( Task_id[TASKID_SMIQ], smiq_task, 1 );
495 status = rtems_task_start( Task_id[TASKID_SMIQ], smiq_task, 1 );
497 if (status!=RTEMS_SUCCESSFUL) {
496 if (status!=RTEMS_SUCCESSFUL) {
498 BOOT_PRINTF("in INIT *** Error starting TASK_BPPR\n")
497 BOOT_PRINTF("in INIT *** Error starting TASK_BPPR\n")
499 }
498 }
500 }
499 }
501
500
502 if (status == RTEMS_SUCCESSFUL) // AVF0
501 if (status == RTEMS_SUCCESSFUL) // AVF0
503 {
502 {
504 status = rtems_task_start( Task_id[TASKID_AVF0], avf0_task, 1 );
503 status = rtems_task_start( Task_id[TASKID_AVF0], avf0_task, 1 );
505 if (status!=RTEMS_SUCCESSFUL) {
504 if (status!=RTEMS_SUCCESSFUL) {
506 BOOT_PRINTF("in INIT *** Error starting TASK_AVF0\n")
505 BOOT_PRINTF("in INIT *** Error starting TASK_AVF0\n")
507 }
506 }
508 }
507 }
509
508
510 if (status == RTEMS_SUCCESSFUL) // MATR
509 if (status == RTEMS_SUCCESSFUL) // MATR
511 {
510 {
512 status = rtems_task_start( Task_id[TASKID_MATR], matr_task, 1 );
511 status = rtems_task_start( Task_id[TASKID_MATR], matr_task, 1 );
513 if (status!=RTEMS_SUCCESSFUL) {
512 if (status!=RTEMS_SUCCESSFUL) {
514 BOOT_PRINTF("in INIT *** Error starting TASK_MATR\n")
513 BOOT_PRINTF("in INIT *** Error starting TASK_MATR\n")
515 }
514 }
516 }
515 }
517
516
518 //****************
517 //****************
519 // WAVEFORM PICKER
518 // WAVEFORM PICKER
520 if (status == RTEMS_SUCCESSFUL) // WFRM
519 if (status == RTEMS_SUCCESSFUL) // WFRM
521 {
520 {
522 status = rtems_task_start( Task_id[TASKID_WFRM], wfrm_task, 1 );
521 status = rtems_task_start( Task_id[TASKID_WFRM], wfrm_task, 1 );
523 if (status!=RTEMS_SUCCESSFUL) {
522 if (status!=RTEMS_SUCCESSFUL) {
524 BOOT_PRINTF("in INIT *** Error starting TASK_WFRM\n")
523 BOOT_PRINTF("in INIT *** Error starting TASK_WFRM\n")
525 }
524 }
526 }
525 }
527
526
528 if (status == RTEMS_SUCCESSFUL) // CWF3
527 if (status == RTEMS_SUCCESSFUL) // CWF3
529 {
528 {
530 status = rtems_task_start( Task_id[TASKID_CWF3], cwf3_task, 1 );
529 status = rtems_task_start( Task_id[TASKID_CWF3], cwf3_task, 1 );
531 if (status!=RTEMS_SUCCESSFUL) {
530 if (status!=RTEMS_SUCCESSFUL) {
532 BOOT_PRINTF("in INIT *** Error starting TASK_CWF3\n")
531 BOOT_PRINTF("in INIT *** Error starting TASK_CWF3\n")
533 }
532 }
534 }
533 }
535
534
536 if (status == RTEMS_SUCCESSFUL) // CWF2
535 if (status == RTEMS_SUCCESSFUL) // CWF2
537 {
536 {
538 status = rtems_task_start( Task_id[TASKID_CWF2], cwf2_task, 1 );
537 status = rtems_task_start( Task_id[TASKID_CWF2], cwf2_task, 1 );
539 if (status!=RTEMS_SUCCESSFUL) {
538 if (status!=RTEMS_SUCCESSFUL) {
540 BOOT_PRINTF("in INIT *** Error starting TASK_CWF2\n")
539 BOOT_PRINTF("in INIT *** Error starting TASK_CWF2\n")
541 }
540 }
542 }
541 }
543
542
544 if (status == RTEMS_SUCCESSFUL) // CWF1
543 if (status == RTEMS_SUCCESSFUL) // CWF1
545 {
544 {
546 status = rtems_task_start( Task_id[TASKID_CWF1], cwf1_task, 1 );
545 status = rtems_task_start( Task_id[TASKID_CWF1], cwf1_task, 1 );
547 if (status!=RTEMS_SUCCESSFUL) {
546 if (status!=RTEMS_SUCCESSFUL) {
548 BOOT_PRINTF("in INIT *** Error starting TASK_CWF1\n")
547 BOOT_PRINTF("in INIT *** Error starting TASK_CWF1\n")
549 }
548 }
550 }
549 }
551
550
552 if (status == RTEMS_SUCCESSFUL) // SWBD
551 if (status == RTEMS_SUCCESSFUL) // SWBD
553 {
552 {
554 status = rtems_task_start( Task_id[TASKID_SWBD], swbd_task, 1 );
553 status = rtems_task_start( Task_id[TASKID_SWBD], swbd_task, 1 );
555 if (status!=RTEMS_SUCCESSFUL) {
554 if (status!=RTEMS_SUCCESSFUL) {
556 BOOT_PRINTF("in INIT *** Error starting TASK_SWBD\n")
555 BOOT_PRINTF("in INIT *** Error starting TASK_SWBD\n")
557 }
556 }
558 }
557 }
559
558
560 //*****
559 //*****
561 // MISC
560 // MISC
562 if (status == RTEMS_SUCCESSFUL) // HOUS
561 if (status == RTEMS_SUCCESSFUL) // HOUS
563 {
562 {
564 status = rtems_task_start( Task_id[TASKID_HOUS], hous_task, 1 );
563 status = rtems_task_start( Task_id[TASKID_HOUS], hous_task, 1 );
565 if (status!=RTEMS_SUCCESSFUL) {
564 if (status!=RTEMS_SUCCESSFUL) {
566 BOOT_PRINTF("in INIT *** Error starting TASK_HOUS\n")
565 BOOT_PRINTF("in INIT *** Error starting TASK_HOUS\n")
567 }
566 }
568 }
567 }
569
568
570 if (status == RTEMS_SUCCESSFUL) // DUMB
569 if (status == RTEMS_SUCCESSFUL) // DUMB
571 {
570 {
572 status = rtems_task_start( Task_id[TASKID_DUMB], dumb_task, 1 );
571 status = rtems_task_start( Task_id[TASKID_DUMB], dumb_task, 1 );
573 if (status!=RTEMS_SUCCESSFUL) {
572 if (status!=RTEMS_SUCCESSFUL) {
574 BOOT_PRINTF("in INIT *** Error starting TASK_DUMB\n")
573 BOOT_PRINTF("in INIT *** Error starting TASK_DUMB\n")
575 }
574 }
576 }
575 }
577
576
578 if (status == RTEMS_SUCCESSFUL) // STAT
577 if (status == RTEMS_SUCCESSFUL) // STAT
579 {
578 {
580 status = rtems_task_start( Task_id[TASKID_STAT], stat_task, 1 );
579 status = rtems_task_start( Task_id[TASKID_STAT], stat_task, 1 );
581 if (status!=RTEMS_SUCCESSFUL) {
580 if (status!=RTEMS_SUCCESSFUL) {
582 BOOT_PRINTF("in INIT *** Error starting TASK_STAT\n")
581 BOOT_PRINTF("in INIT *** Error starting TASK_STAT\n")
583 }
582 }
584 }
583 }
585
584
586 return status;
585 return status;
587 }
586 }
588
587
589 rtems_status_code create_message_queues( void ) // create the two message queues used in the software
588 rtems_status_code create_message_queues( void ) // create the two message queues used in the software
590 {
589 {
591 rtems_status_code status_recv;
590 rtems_status_code status_recv;
592 rtems_status_code status_send;
591 rtems_status_code status_send;
593 rtems_status_code ret;
592 rtems_status_code ret;
594 rtems_id queue_id;
593 rtems_id queue_id;
595
594
596 // create the queue for handling valid TCs
595 // create the queue for handling valid TCs
597 status_recv = rtems_message_queue_create( misc_name[QUEUE_RECV],
596 status_recv = rtems_message_queue_create( misc_name[QUEUE_RECV],
598 ACTION_MSG_QUEUE_COUNT, CCSDS_TC_PKT_MAX_SIZE,
597 ACTION_MSG_QUEUE_COUNT, CCSDS_TC_PKT_MAX_SIZE,
599 RTEMS_FIFO | RTEMS_LOCAL, &queue_id );
598 RTEMS_FIFO | RTEMS_LOCAL, &queue_id );
600 if ( status_recv != RTEMS_SUCCESSFUL ) {
599 if ( status_recv != RTEMS_SUCCESSFUL ) {
601 PRINTF1("in create_message_queues *** ERR creating QUEU queue, %d\n", status_recv)
600 PRINTF1("in create_message_queues *** ERR creating QUEU queue, %d\n", status_recv)
602 }
601 }
603
602
604 // create the queue for handling TM packet sending
603 // create the queue for handling TM packet sending
605 status_send = rtems_message_queue_create( misc_name[QUEUE_SEND],
604 status_send = rtems_message_queue_create( misc_name[QUEUE_SEND],
606 ACTION_MSG_PKTS_COUNT, ACTION_MSG_PKTS_MAX_SIZE,
605 ACTION_MSG_PKTS_COUNT, ACTION_MSG_PKTS_MAX_SIZE,
607 RTEMS_FIFO | RTEMS_LOCAL, &queue_id );
606 RTEMS_FIFO | RTEMS_LOCAL, &queue_id );
608 if ( status_send != RTEMS_SUCCESSFUL ) {
607 if ( status_send != RTEMS_SUCCESSFUL ) {
609 PRINTF1("in create_message_queues *** ERR creating PKTS queue, %d\n", status_send)
608 PRINTF1("in create_message_queues *** ERR creating PKTS queue, %d\n", status_send)
610 }
609 }
611
610
612 if ( status_recv != RTEMS_SUCCESSFUL )
611 if ( status_recv != RTEMS_SUCCESSFUL )
613 {
612 {
614 ret = status_recv;
613 ret = status_recv;
615 }
614 }
616 else
615 else
617 {
616 {
618 ret = status_send;
617 ret = status_send;
619 }
618 }
620
619
621 return ret;
620 return ret;
622 }
621 }
623
622
624 rtems_status_code get_message_queue_id_send( rtems_id *queue_id )
623 rtems_status_code get_message_queue_id_send( rtems_id *queue_id )
625 {
624 {
626 rtems_status_code status;
625 rtems_status_code status;
627 rtems_name queue_name;
626 rtems_name queue_name;
628
627
629 queue_name = rtems_build_name( 'Q', '_', 'S', 'D' );
628 queue_name = rtems_build_name( 'Q', '_', 'S', 'D' );
630
629
631 status = rtems_message_queue_ident( queue_name, 0, queue_id );
630 status = rtems_message_queue_ident( queue_name, 0, queue_id );
632
631
633 return status;
632 return status;
634 }
633 }
635
634
636 rtems_status_code get_message_queue_id_recv( rtems_id *queue_id )
635 rtems_status_code get_message_queue_id_recv( rtems_id *queue_id )
637 {
636 {
638 rtems_status_code status;
637 rtems_status_code status;
639 rtems_name queue_name;
638 rtems_name queue_name;
640
639
641 queue_name = rtems_build_name( 'Q', '_', 'R', 'V' );
640 queue_name = rtems_build_name( 'Q', '_', 'R', 'V' );
642
641
643 status = rtems_message_queue_ident( queue_name, 0, queue_id );
642 status = rtems_message_queue_ident( queue_name, 0, queue_id );
644
643
645 return status;
644 return status;
646 }
645 }
@@ -1,420 +1,433
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 rtems_rate_monotonic_period_status period_status;
146 rtems_rate_monotonic_period_status period_status;
147
147
148 status = get_message_queue_id_send( &queue_id );
148 status = get_message_queue_id_send( &queue_id );
149 if (status != RTEMS_SUCCESSFUL)
149 if (status != RTEMS_SUCCESSFUL)
150 {
150 {
151 PRINTF1("in HOUS *** ERR get_message_queue_id_send %d\n", status)
151 PRINTF1("in HOUS *** ERR get_message_queue_id_send %d\n", status)
152 }
152 }
153
153
154 BOOT_PRINTF("in HOUS ***\n")
154 BOOT_PRINTF("in HOUS ***\n")
155
155
156 if (rtems_rate_monotonic_ident( name_hk_rate_monotonic, &HK_id) != RTEMS_SUCCESSFUL) {
156 if (rtems_rate_monotonic_ident( name_hk_rate_monotonic, &HK_id) != RTEMS_SUCCESSFUL) {
157 status = rtems_rate_monotonic_create( name_hk_rate_monotonic, &HK_id );
157 status = rtems_rate_monotonic_create( name_hk_rate_monotonic, &HK_id );
158 if( status != RTEMS_SUCCESSFUL ) {
158 if( status != RTEMS_SUCCESSFUL ) {
159 PRINTF1( "rtems_rate_monotonic_create failed with status of %d\n", status )
159 PRINTF1( "rtems_rate_monotonic_create failed with status of %d\n", status )
160 }
160 }
161 }
161 }
162
162
163 housekeeping_packet.targetLogicalAddress = CCSDS_DESTINATION_ID;
163 housekeeping_packet.targetLogicalAddress = CCSDS_DESTINATION_ID;
164 housekeeping_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID;
164 housekeeping_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID;
165 housekeeping_packet.reserved = DEFAULT_RESERVED;
165 housekeeping_packet.reserved = DEFAULT_RESERVED;
166 housekeeping_packet.userApplication = CCSDS_USER_APP;
166 housekeeping_packet.userApplication = CCSDS_USER_APP;
167 housekeeping_packet.packetID[0] = (unsigned char) (APID_TM_HK >> 8);
167 housekeeping_packet.packetID[0] = (unsigned char) (APID_TM_HK >> 8);
168 housekeeping_packet.packetID[1] = (unsigned char) (APID_TM_HK);
168 housekeeping_packet.packetID[1] = (unsigned char) (APID_TM_HK);
169 housekeeping_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
169 housekeeping_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
170 housekeeping_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
170 housekeeping_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
171 housekeeping_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_HK >> 8);
171 housekeeping_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_HK >> 8);
172 housekeeping_packet.packetLength[1] = (unsigned char) (PACKET_LENGTH_HK );
172 housekeeping_packet.packetLength[1] = (unsigned char) (PACKET_LENGTH_HK );
173 housekeeping_packet.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
173 housekeeping_packet.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
174 housekeeping_packet.serviceType = TM_TYPE_HK;
174 housekeeping_packet.serviceType = TM_TYPE_HK;
175 housekeeping_packet.serviceSubType = TM_SUBTYPE_HK;
175 housekeeping_packet.serviceSubType = TM_SUBTYPE_HK;
176 housekeeping_packet.destinationID = TM_DESTINATION_ID_GROUND;
176 housekeeping_packet.destinationID = TM_DESTINATION_ID_GROUND;
177 housekeeping_packet.sid = SID_HK;
177 housekeeping_packet.sid = SID_HK;
178
178
179 status = rtems_rate_monotonic_cancel(HK_id);
179 status = rtems_rate_monotonic_cancel(HK_id);
180 if( status != RTEMS_SUCCESSFUL ) {
180 if( status != RTEMS_SUCCESSFUL ) {
181 PRINTF1( "ERR *** in HOUS *** rtems_rate_monotonic_cancel(HK_id) ***code: %d\n", status )
181 PRINTF1( "ERR *** in HOUS *** rtems_rate_monotonic_cancel(HK_id) ***code: %d\n", status )
182 }
182 }
183 else {
183 else {
184 DEBUG_PRINTF("OK *** in HOUS *** rtems_rate_monotonic_cancel(HK_id)\n")
184 DEBUG_PRINTF("OK *** in HOUS *** rtems_rate_monotonic_cancel(HK_id)\n")
185 }
185 }
186
186
187 // startup phase
187 // startup phase
188 status = rtems_rate_monotonic_period( HK_id, SY_LFR_TIME_SYN_TIMEOUT_in_ticks );
188 status = rtems_rate_monotonic_period( HK_id, SY_LFR_TIME_SYN_TIMEOUT_in_ticks );
189 status = rtems_rate_monotonic_get_status( HK_id, &period_status );
189 status = rtems_rate_monotonic_get_status( HK_id, &period_status );
190 DEBUG_PRINTF1("startup HK, HK_id status = %d\n", period_status.state)
190 DEBUG_PRINTF1("startup HK, HK_id status = %d\n", period_status.state)
191 while(period_status.state != RATE_MONOTONIC_EXPIRED ) // after SY_LFR_TIME_SYN_TIMEOUT ms, starts HK anyway
191 while(period_status.state != RATE_MONOTONIC_EXPIRED ) // after SY_LFR_TIME_SYN_TIMEOUT ms, starts HK anyway
192 {
192 {
193 if ((time_management_regs->coarse_time & 0x80000000) == 0x00000000) // check time synchronization
193 if ((time_management_regs->coarse_time & 0x80000000) == 0x00000000) // check time synchronization
194 {
194 {
195 break; // break if LFR is synchronized
195 break; // break if LFR is synchronized
196 }
196 }
197 else
197 else
198 {
198 {
199 status = rtems_rate_monotonic_get_status( HK_id, &period_status );
199 status = rtems_rate_monotonic_get_status( HK_id, &period_status );
200 sched_yield();
200 sched_yield();
201 }
201 }
202 }
202 }
203 status = rtems_rate_monotonic_cancel(HK_id);
203 status = rtems_rate_monotonic_cancel(HK_id);
204 DEBUG_PRINTF1("startup HK, HK_id status = %d\n", period_status.state)
204 DEBUG_PRINTF1("startup HK, HK_id status = %d\n", period_status.state)
205
205
206 while(1){ // launch the rate monotonic task
206 while(1){ // launch the rate monotonic task
207 status = rtems_rate_monotonic_period( HK_id, HK_PERIOD );
207 status = rtems_rate_monotonic_period( HK_id, HK_PERIOD );
208 if ( status != RTEMS_SUCCESSFUL ) {
208 if ( status != RTEMS_SUCCESSFUL ) {
209 PRINTF1( "in HOUS *** ERR period: %d\n", status);
209 PRINTF1( "in HOUS *** ERR period: %d\n", status);
210 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_6 );
210 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_6 );
211 }
211 }
212 else {
212 else {
213 increment_seq_counter( housekeeping_packet.packetSequenceControl );
213 increment_seq_counter( housekeeping_packet.packetSequenceControl );
214 housekeeping_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
214 housekeeping_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
215 housekeeping_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
215 housekeeping_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
216 housekeeping_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
216 housekeeping_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
217 housekeeping_packet.time[3] = (unsigned char) (time_management_regs->coarse_time);
217 housekeeping_packet.time[3] = (unsigned char) (time_management_regs->coarse_time);
218 housekeeping_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
218 housekeeping_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
219 housekeeping_packet.time[5] = (unsigned char) (time_management_regs->fine_time);
219 housekeeping_packet.time[5] = (unsigned char) (time_management_regs->fine_time);
220
220
221 spacewire_update_statistics();
221 spacewire_update_statistics();
222
222
223 // SEND PACKET
223 // SEND PACKET
224 status = rtems_message_queue_urgent( queue_id, &housekeeping_packet,
224 status = rtems_message_queue_urgent( queue_id, &housekeeping_packet,
225 PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES);
225 PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES);
226 if (status != RTEMS_SUCCESSFUL) {
226 if (status != RTEMS_SUCCESSFUL) {
227 PRINTF1("in HOUS *** ERR send: %d\n", status)
227 PRINTF1("in HOUS *** ERR send: %d\n", status)
228 }
228 }
229 }
229 }
230 }
230 }
231
231
232 PRINTF("in HOUS *** deleting task\n")
232 PRINTF("in HOUS *** deleting task\n")
233
233
234 status = rtems_task_delete( RTEMS_SELF ); // should not return
234 status = rtems_task_delete( RTEMS_SELF ); // should not return
235 printf( "rtems_task_delete returned with status of %d.\n", status );
235 printf( "rtems_task_delete returned with status of %d.\n", status );
236 return;
236 return;
237 }
237 }
238
238
239 rtems_task dumb_task( rtems_task_argument unused )
239 rtems_task dumb_task( rtems_task_argument unused )
240 {
240 {
241 /** This RTEMS taks is used to print messages without affecting the general behaviour of the software.
241 /** This RTEMS taks is used to print messages without affecting the general behaviour of the software.
242 *
242 *
243 * @param unused is the starting argument of the RTEMS task
243 * @param unused is the starting argument of the RTEMS task
244 *
244 *
245 * The DUMB taks waits for RTEMS events and print messages depending on the incoming events.
245 * The DUMB taks waits for RTEMS events and print messages depending on the incoming events.
246 *
246 *
247 */
247 */
248
248
249 unsigned int i;
249 unsigned int i;
250 unsigned int intEventOut;
250 unsigned int intEventOut;
251 unsigned int coarse_time = 0;
251 unsigned int coarse_time = 0;
252 unsigned int fine_time = 0;
252 unsigned int fine_time = 0;
253 rtems_event_set event_out;
253 rtems_event_set event_out;
254
254
255 char *DumbMessages[10] = {"in DUMB *** default", // RTEMS_EVENT_0
255 char *DumbMessages[10] = {"in DUMB *** default", // RTEMS_EVENT_0
256 "in DUMB *** timecode_irq_handler", // RTEMS_EVENT_1
256 "in DUMB *** timecode_irq_handler", // RTEMS_EVENT_1
257 "in DUMB *** waveforms_isr", // RTEMS_EVENT_2
257 "in DUMB *** waveforms_isr", // RTEMS_EVENT_2
258 "in DUMB *** in SMIQ *** Error sending event to AVF0", // RTEMS_EVENT_3
258 "in DUMB *** in SMIQ *** Error sending event to AVF0", // RTEMS_EVENT_3
259 "in DUMB *** spectral_matrices_isr *** Error sending event to SMIQ", // RTEMS_EVENT_4
259 "in DUMB *** spectral_matrices_isr *** Error sending event to SMIQ", // RTEMS_EVENT_4
260 "in DUMB *** waveforms_simulator_isr", // RTEMS_EVENT_5
260 "in DUMB *** waveforms_simulator_isr", // RTEMS_EVENT_5
261 "ERR HK", // RTEMS_EVENT_6
261 "ERR HK", // RTEMS_EVENT_6
262 "ready for dump", // RTEMS_EVENT_7
262 "ready for dump", // RTEMS_EVENT_7
263 "in DUMB *** spectral_matrices_isr", // RTEMS_EVENT_8
263 "in DUMB *** spectral_matrices_isr", // RTEMS_EVENT_8
264 "tick" // RTEMS_EVENT_9
264 "tick" // RTEMS_EVENT_9
265 };
265 };
266
266
267 BOOT_PRINTF("in DUMB *** \n")
267 BOOT_PRINTF("in DUMB *** \n")
268
268
269 while(1){
269 while(1){
270 rtems_event_receive(RTEMS_EVENT_0 | RTEMS_EVENT_1 | RTEMS_EVENT_2 | RTEMS_EVENT_3
270 rtems_event_receive(RTEMS_EVENT_0 | RTEMS_EVENT_1 | RTEMS_EVENT_2 | RTEMS_EVENT_3
271 | RTEMS_EVENT_4 | RTEMS_EVENT_5 | RTEMS_EVENT_6 | RTEMS_EVENT_7
271 | RTEMS_EVENT_4 | RTEMS_EVENT_5 | RTEMS_EVENT_6 | RTEMS_EVENT_7
272 | RTEMS_EVENT_8 | RTEMS_EVENT_9,
272 | RTEMS_EVENT_8 | RTEMS_EVENT_9,
273 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT
273 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT
274 intEventOut = (unsigned int) event_out;
274 intEventOut = (unsigned int) event_out;
275 for ( i=0; i<32; i++)
275 for ( i=0; i<32; i++)
276 {
276 {
277 if ( ((intEventOut >> i) & 0x0001) != 0)
277 if ( ((intEventOut >> i) & 0x0001) != 0)
278 {
278 {
279 coarse_time = time_management_regs->coarse_time;
279 coarse_time = time_management_regs->coarse_time;
280 fine_time = time_management_regs->fine_time;
280 fine_time = time_management_regs->fine_time;
281 printf("in DUMB *** coarse: %x, fine: %x, %s\n", coarse_time, fine_time, DumbMessages[i]);
281 printf("in DUMB *** coarse: %x, fine: %x, %s\n", coarse_time, fine_time, DumbMessages[i]);
282 }
282 }
283 }
283 }
284 }
284 }
285 }
285 }
286
286
287 //*****************************
287 //*****************************
288 // init housekeeping parameters
288 // init housekeeping parameters
289
289
290 void init_housekeeping_parameters( void )
290 void init_housekeeping_parameters( void )
291 {
291 {
292 /** This function initialize the housekeeping_packet global variable with default values.
292 /** This function initialize the housekeeping_packet global variable with default values.
293 *
293 *
294 */
294 */
295
295
296 unsigned int i = 0;
296 unsigned int i = 0;
297 unsigned char *parameters;
297 unsigned char *parameters;
298
298
299 parameters = (unsigned char*) &housekeeping_packet.lfr_status_word;
299 parameters = (unsigned char*) &housekeeping_packet.lfr_status_word;
300 for(i = 0; i< SIZE_HK_PARAMETERS; i++)
300 for(i = 0; i< SIZE_HK_PARAMETERS; i++)
301 {
301 {
302 parameters[i] = 0x00;
302 parameters[i] = 0x00;
303 }
303 }
304 // init status word
304 // init status word
305 housekeeping_packet.lfr_status_word[0] = DEFAULT_STATUS_WORD_BYTE0;
305 housekeeping_packet.lfr_status_word[0] = DEFAULT_STATUS_WORD_BYTE0;
306 housekeeping_packet.lfr_status_word[1] = DEFAULT_STATUS_WORD_BYTE1;
306 housekeeping_packet.lfr_status_word[1] = DEFAULT_STATUS_WORD_BYTE1;
307 // init software version
307 // init software version
308 housekeeping_packet.lfr_sw_version[0] = SW_VERSION_N1;
308 housekeeping_packet.lfr_sw_version[0] = SW_VERSION_N1;
309 housekeeping_packet.lfr_sw_version[1] = SW_VERSION_N2;
309 housekeeping_packet.lfr_sw_version[1] = SW_VERSION_N2;
310 housekeeping_packet.lfr_sw_version[2] = SW_VERSION_N3;
310 housekeeping_packet.lfr_sw_version[2] = SW_VERSION_N3;
311 housekeeping_packet.lfr_sw_version[3] = SW_VERSION_N4;
311 housekeeping_packet.lfr_sw_version[3] = SW_VERSION_N4;
312 // init fpga version
312 // init fpga version
313 parameters = (unsigned char *) (REGS_ADDR_WAVEFORM_PICKER + 0xb0);
313 parameters = (unsigned char *) (REGS_ADDR_WAVEFORM_PICKER + 0xb0);
314 housekeeping_packet.lfr_fpga_version[0] = parameters[1]; // n1
314 housekeeping_packet.lfr_fpga_version[0] = parameters[1]; // n1
315 housekeeping_packet.lfr_fpga_version[1] = parameters[2]; // n2
315 housekeeping_packet.lfr_fpga_version[1] = parameters[2]; // n2
316 housekeeping_packet.lfr_fpga_version[2] = parameters[3]; // n3
316 housekeeping_packet.lfr_fpga_version[2] = parameters[3]; // n3
317 }
317 }
318
318
319 void increment_seq_counter( unsigned char *packet_sequence_control)
319 void increment_seq_counter( unsigned char *packet_sequence_control)
320 {
320 {
321 /** This function increment the sequence counter psased in argument.
321 /** This function increment the sequence counter psased in argument.
322 *
322 *
323 * The increment does not affect the grouping flag. In case of an overflow, the counter is reset to 0.
323 * The increment does not affect the grouping flag. In case of an overflow, the counter is reset to 0.
324 *
324 *
325 */
325 */
326
326
327 unsigned short sequence_cnt;
327 unsigned short sequence_cnt;
328 unsigned short segmentation_grouping_flag;
328 unsigned short segmentation_grouping_flag;
329 unsigned short new_packet_sequence_control;
329 unsigned short new_packet_sequence_control;
330
330
331 segmentation_grouping_flag = (unsigned short) ( (packet_sequence_control[0] & 0xc0) << 8 ); // keep bits 7 downto 6
331 segmentation_grouping_flag = (unsigned short) ( (packet_sequence_control[0] & 0xc0) << 8 ); // keep bits 7 downto 6
332 sequence_cnt = (unsigned short) (
332 sequence_cnt = (unsigned short) (
333 ( (packet_sequence_control[0] & 0x3f) << 8 ) // keep bits 5 downto 0
333 ( (packet_sequence_control[0] & 0x3f) << 8 ) // keep bits 5 downto 0
334 + packet_sequence_control[1]
334 + packet_sequence_control[1]
335 );
335 );
336
336
337 if ( sequence_cnt < SEQ_CNT_MAX)
337 if ( sequence_cnt < SEQ_CNT_MAX)
338 {
338 {
339 sequence_cnt = sequence_cnt + 1;
339 sequence_cnt = sequence_cnt + 1;
340 }
340 }
341 else
341 else
342 {
342 {
343 sequence_cnt = 0;
343 sequence_cnt = 0;
344 }
344 }
345
345
346 new_packet_sequence_control = segmentation_grouping_flag | sequence_cnt ;
346 new_packet_sequence_control = segmentation_grouping_flag | sequence_cnt ;
347
347
348 packet_sequence_control[0] = (unsigned char) (new_packet_sequence_control >> 8);
348 packet_sequence_control[0] = (unsigned char) (new_packet_sequence_control >> 8);
349 packet_sequence_control[1] = (unsigned char) (new_packet_sequence_control );
349 packet_sequence_control[1] = (unsigned char) (new_packet_sequence_control );
350 }
350 }
351
351
352 void getTime( unsigned char *time)
352 void getTime( unsigned char *time)
353 {
353 {
354 /** This function write the current local time in the time buffer passed in argument.
354 /** This function write the current local time in the time buffer passed in argument.
355 *
355 *
356 */
356 */
357
357
358 time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
358 time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
359 time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
359 time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
360 time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
360 time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
361 time[3] = (unsigned char) (time_management_regs->coarse_time);
361 time[3] = (unsigned char) (time_management_regs->coarse_time);
362 time[4] = (unsigned char) (time_management_regs->fine_time>>8);
362 time[4] = (unsigned char) (time_management_regs->fine_time>>8);
363 time[5] = (unsigned char) (time_management_regs->fine_time);
363 time[5] = (unsigned char) (time_management_regs->fine_time);
364 }
364 }
365
365
366 unsigned long long int getTimeAsUnsignedLongLongInt( )
367 {
368 /** This function write the current local time in the time buffer passed in argument.
369 *
370 */
371 unsigned long long int time;
372
373 time = ( (unsigned long long int) (time_management_regs->coarse_time & 0x7fffffff) << 16 )
374 + time_management_regs->fine_time;
375
376 return time;
377 }
378
366 void send_dumb_hk( void )
379 void send_dumb_hk( void )
367 {
380 {
368 Packet_TM_LFR_HK_t dummy_hk_packet;
381 Packet_TM_LFR_HK_t dummy_hk_packet;
369 unsigned char *parameters;
382 unsigned char *parameters;
370 unsigned int i;
383 unsigned int i;
371 rtems_id queue_id;
384 rtems_id queue_id;
372
385
373 dummy_hk_packet.targetLogicalAddress = CCSDS_DESTINATION_ID;
386 dummy_hk_packet.targetLogicalAddress = CCSDS_DESTINATION_ID;
374 dummy_hk_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID;
387 dummy_hk_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID;
375 dummy_hk_packet.reserved = DEFAULT_RESERVED;
388 dummy_hk_packet.reserved = DEFAULT_RESERVED;
376 dummy_hk_packet.userApplication = CCSDS_USER_APP;
389 dummy_hk_packet.userApplication = CCSDS_USER_APP;
377 dummy_hk_packet.packetID[0] = (unsigned char) (APID_TM_HK >> 8);
390 dummy_hk_packet.packetID[0] = (unsigned char) (APID_TM_HK >> 8);
378 dummy_hk_packet.packetID[1] = (unsigned char) (APID_TM_HK);
391 dummy_hk_packet.packetID[1] = (unsigned char) (APID_TM_HK);
379 dummy_hk_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
392 dummy_hk_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
380 dummy_hk_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
393 dummy_hk_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
381 dummy_hk_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_HK >> 8);
394 dummy_hk_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_HK >> 8);
382 dummy_hk_packet.packetLength[1] = (unsigned char) (PACKET_LENGTH_HK );
395 dummy_hk_packet.packetLength[1] = (unsigned char) (PACKET_LENGTH_HK );
383 dummy_hk_packet.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
396 dummy_hk_packet.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
384 dummy_hk_packet.serviceType = TM_TYPE_HK;
397 dummy_hk_packet.serviceType = TM_TYPE_HK;
385 dummy_hk_packet.serviceSubType = TM_SUBTYPE_HK;
398 dummy_hk_packet.serviceSubType = TM_SUBTYPE_HK;
386 dummy_hk_packet.destinationID = TM_DESTINATION_ID_GROUND;
399 dummy_hk_packet.destinationID = TM_DESTINATION_ID_GROUND;
387 dummy_hk_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
400 dummy_hk_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
388 dummy_hk_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
401 dummy_hk_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
389 dummy_hk_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
402 dummy_hk_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
390 dummy_hk_packet.time[3] = (unsigned char) (time_management_regs->coarse_time);
403 dummy_hk_packet.time[3] = (unsigned char) (time_management_regs->coarse_time);
391 dummy_hk_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
404 dummy_hk_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
392 dummy_hk_packet.time[5] = (unsigned char) (time_management_regs->fine_time);
405 dummy_hk_packet.time[5] = (unsigned char) (time_management_regs->fine_time);
393 dummy_hk_packet.sid = SID_HK;
406 dummy_hk_packet.sid = SID_HK;
394
407
395 // init status word
408 // init status word
396 dummy_hk_packet.lfr_status_word[0] = 0xff;
409 dummy_hk_packet.lfr_status_word[0] = 0xff;
397 dummy_hk_packet.lfr_status_word[1] = 0xff;
410 dummy_hk_packet.lfr_status_word[1] = 0xff;
398 // init software version
411 // init software version
399 dummy_hk_packet.lfr_sw_version[0] = SW_VERSION_N1;
412 dummy_hk_packet.lfr_sw_version[0] = SW_VERSION_N1;
400 dummy_hk_packet.lfr_sw_version[1] = SW_VERSION_N2;
413 dummy_hk_packet.lfr_sw_version[1] = SW_VERSION_N2;
401 dummy_hk_packet.lfr_sw_version[2] = SW_VERSION_N3;
414 dummy_hk_packet.lfr_sw_version[2] = SW_VERSION_N3;
402 dummy_hk_packet.lfr_sw_version[3] = SW_VERSION_N4;
415 dummy_hk_packet.lfr_sw_version[3] = SW_VERSION_N4;
403 // init fpga version
416 // init fpga version
404 parameters = (unsigned char *) (REGS_ADDR_WAVEFORM_PICKER + 0xb0);
417 parameters = (unsigned char *) (REGS_ADDR_WAVEFORM_PICKER + 0xb0);
405 dummy_hk_packet.lfr_fpga_version[0] = parameters[1]; // n1
418 dummy_hk_packet.lfr_fpga_version[0] = parameters[1]; // n1
406 dummy_hk_packet.lfr_fpga_version[1] = parameters[2]; // n2
419 dummy_hk_packet.lfr_fpga_version[1] = parameters[2]; // n2
407 dummy_hk_packet.lfr_fpga_version[2] = parameters[3]; // n3
420 dummy_hk_packet.lfr_fpga_version[2] = parameters[3]; // n3
408
421
409 parameters = (unsigned char *) &dummy_hk_packet.hk_lfr_cpu_load;
422 parameters = (unsigned char *) &dummy_hk_packet.hk_lfr_cpu_load;
410
423
411 for (i=0; i<100; i++)
424 for (i=0; i<100; i++)
412 {
425 {
413 parameters[i] = 0xff;
426 parameters[i] = 0xff;
414 }
427 }
415
428
416 get_message_queue_id_send( &queue_id );
429 get_message_queue_id_send( &queue_id );
417
430
418 rtems_message_queue_urgent( queue_id, &dummy_hk_packet,
431 rtems_message_queue_urgent( queue_id, &dummy_hk_packet,
419 PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES);
432 PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES);
420 }
433 }
This diff has been collapsed as it changes many lines, (963 lines changed) Show them Hide them
@@ -1,824 +1,889
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 sm_ring_f0[ NB_RING_NODES_ASM_F0 ];
16 ring_node_sm sm_ring_f0[ NB_RING_NODES_SM_F0 ];
17 ring_node_sm sm_ring_f1[ NB_RING_NODES_ASM_F1 ];
17 ring_node_sm sm_ring_f1[ NB_RING_NODES_SM_F1 ];
18 ring_node_sm sm_ring_f2[ NB_RING_NODES_ASM_F2 ];
18 ring_node_sm sm_ring_f2[ NB_RING_NODES_SM_F2 ];
19 ring_node_sm *current_ring_node_sm_f0;
19 ring_node_sm *current_ring_node_sm_f0;
20 ring_node_sm *ring_node_for_averaging_sm_f0;
20 ring_node_sm *ring_node_for_averaging_sm_f0;
21 ring_node_sm *current_ring_node_sm_f1;
21 ring_node_sm *current_ring_node_sm_f1;
22 ring_node_sm *current_ring_node_sm_f2;
22 ring_node_sm *current_ring_node_sm_f2;
23
23
24 //**********************
24 ring_node_asm asm_ring_burst_sbm_f0[ NB_RING_NODES_ASM_BURST_SBM_F0 ];
25 // basic parameter rings
25 ring_node_asm *current_ring_node_asm_burst_sbm_f0;
26 ring_node_bp *current_node_sbm1_bp1_f0;
26 ring_node_asm *ring_node_for_processing_asm_burst_sbm_f0;
27 ring_node_bp *current_node_sbm1_bp2_f0;
28 ring_node_bp bp_ring_sbm1_bp1[ NB_RING_NODES_SBM1_BP1 ];
29 ring_node_bp bp_ring_sbm1_bp2[ NB_RING_NODES_SBM1_BP2 ];
30
27
31 //*****
28 //*****
32 // NORM
29 // NORM
33 // F0
30 // F0
34 float asm_norm_f0 [ TIME_OFFSET + TOTAL_SIZE_SM ];
31 float asm_norm_f0 [ TIME_OFFSET + TOTAL_SIZE_SM ];
35 float asm_f0_reorganized [ TIME_OFFSET + TOTAL_SIZE_SM ];
32 float asm_f0_reorganized [ TIME_OFFSET + TOTAL_SIZE_SM ];
36 char asm_f0_char [ TIME_OFFSET_IN_BYTES + (TOTAL_SIZE_SM * 2) ];
33 char asm_f0_char [ TIME_OFFSET_IN_BYTES + (TOTAL_SIZE_SM * 2) ];
37 float compressed_sm_norm_f0[ TIME_OFFSET + TOTAL_SIZE_COMPRESSED_ASM_F0 ];
34 float compressed_sm_norm_f0[ TIME_OFFSET + TOTAL_SIZE_COMPRESSED_ASM_F0 ];
38
35
39 //*****
36 //*****
40 // SBM1
37 // SBM1
41 float asm_sbm1_f0 [ TIME_OFFSET + TOTAL_SIZE_SM ];
38 float asm_sbm_f0 [ TIME_OFFSET + TOTAL_SIZE_SM ];
42 float compressed_sm_sbm1[ TIME_OFFSET + TOTAL_SIZE_COMPRESSED_ASM_SBM1 ];
39 float compressed_sm_sbm[ TIME_OFFSET + TOTAL_SIZE_COMPRESSED_ASM_SBM1 ];
43
40
44 unsigned char LFR_BP1_F0[ TIME_OFFSET_IN_BYTES + TOTAL_SIZE_NORM_BP1_F0 * 2 ];
41 unsigned char LFR_BP1_F0[ TIME_OFFSET_IN_BYTES + TOTAL_SIZE_NORM_BP1_F0 * 2 ];
45 unsigned char LFR_BP1_F1[ TIME_OFFSET_IN_BYTES + TOTAL_SIZE_NORM_BP1_F1 ];
42 unsigned char LFR_BP1_F1[ TIME_OFFSET_IN_BYTES + TOTAL_SIZE_NORM_BP1_F1 ];
46 unsigned char LFR_BP1_F2[ TIME_OFFSET_IN_BYTES + TOTAL_SIZE_NORM_BP1_F2 ];
43 unsigned char LFR_BP1_F2[ TIME_OFFSET_IN_BYTES + TOTAL_SIZE_NORM_BP1_F2 ];
47
44
48 unsigned int nb_sm_f0;
45 //***********************************************************
46 // Interrupt Service Routine for spectral matrices processing
47 void reset_nb_sm_f0( unsigned char lfrMode )
48 {
49 nb_sm.f0 = 0;
50 nb_sm.norm_bp1_f0 = 0;
51 nb_sm.norm_bp2_f0 = 0;
52 nb_sm.norm_asm_f0 = 0;
53 nb_sm.sbm_bp1_f0 = 0;
54 nb_sm.sbm_bp2_f0 = 0;
55
56 nb_sm_before_bp.norm_bp1_f0 = parameter_dump_packet.sy_lfr_n_bp_p0 * 96;
57 nb_sm_before_bp.norm_bp2_f0 = parameter_dump_packet.sy_lfr_n_bp_p1 * 96;
58 nb_sm_before_bp.norm_asm_f0 = (parameter_dump_packet.sy_lfr_n_asm_p[0] * 256 + parameter_dump_packet.sy_lfr_n_asm_p[1]) * 96;
59 nb_sm_before_bp.sbm1_bp1_f0 = parameter_dump_packet.sy_lfr_s1_bp_p0 * 24;
60 nb_sm_before_bp.sbm1_bp2_f0 = parameter_dump_packet.sy_lfr_s1_bp_p1 * 96;
61 nb_sm_before_bp.sbm2_bp1_f0 = parameter_dump_packet.sy_lfr_s2_bp_p0 * 96;
62 nb_sm_before_bp.sbm2_bp2_f0 = parameter_dump_packet.sy_lfr_s2_bp_p1 * 96;
63 nb_sm_before_bp.burst_bp1_f0 = parameter_dump_packet.sy_lfr_b_bp_p0 * 96;
64 nb_sm_before_bp.burst_bp2_f0 = parameter_dump_packet.sy_lfr_b_bp_p1 * 96;
65
66 if (lfrMode == LFR_MODE_SBM1)
67 {
68 nb_sm_before_bp.burst_sbm_bp1_f0 = nb_sm_before_bp.sbm1_bp1_f0;
69 nb_sm_before_bp.burst_sbm_bp2_f0 = nb_sm_before_bp.sbm1_bp2_f0;
70 }
71 else if (lfrMode == LFR_MODE_SBM2)
72 {
73 nb_sm_before_bp.burst_sbm_bp1_f0 = nb_sm_before_bp.sbm2_bp1_f0;
74 nb_sm_before_bp.burst_sbm_bp2_f0 = nb_sm_before_bp.sbm2_bp2_f0;
75 }
76 else if (lfrMode == LFR_MODE_BURST)
77 {
78 nb_sm_before_bp.burst_sbm_bp1_f0 = nb_sm_before_bp.burst_bp1_f0;
79 nb_sm_before_bp.burst_sbm_bp2_f0 = nb_sm_before_bp.burst_bp2_f0;
80 }
81 else
82 {
83 nb_sm_before_bp.burst_sbm_bp1_f0 = nb_sm_before_bp.burst_bp1_f0;
84 nb_sm_before_bp.burst_sbm_bp2_f0 = nb_sm_before_bp.burst_bp2_f0;
85 }
86 }
87
88 rtems_isr spectral_matrices_isr( rtems_vector_number vector )
89 {
90 // rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_8 );
91
92 // if ( (spectral_matrix_regs->status & 0x1) == 0x01)
93 // {
94 // current_ring_node_sm_f0 = current_ring_node_sm_f0->next;
95 // spectral_matrix_regs->matrixF0_Address0 = current_ring_node_sm_f0->buffer_address;
96 // spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffe; // 1110
97 // nb_sm_f0 = nb_sm_f0 + 1;
98 // }
99 // else if ( (spectral_matrix_regs->status & 0x2) == 0x02)
100 // {
101 // current_ring_node_sm_f0 = current_ring_node_sm_f0->next;
102 // spectral_matrix_regs->matrixFO_Address1 = current_ring_node_sm_f0->buffer_address;
103 // spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffd; // 1101
104 // nb_sm_f0 = nb_sm_f0 + 1;
105 // }
106
107 // if ( (spectral_matrix_regs->status & 0x30) != 0x00)
108 // {
109 // rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_8 );
110 // spectral_matrix_regs->status = spectral_matrix_regs->status & 0xffffffcf; // 1100 1111
111 // }
112
113 // spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffff3; // 0011
114
115 // if (nb_sm_f0 == (NB_SM_BEFORE_AVF0-1) )
116 // {
117 // ring_node_for_averaging_sm_f0 = current_ring_node_sm_f0;
118 // if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL)
119 // {
120 // rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 );
121 // }
122 // nb_sm_f0 = 0;
123 // }
124 // else
125 // {
126 // nb_sm.nb_sm_f0 = nb_sm.nb_sm_f0 + 1;
127 // }
128 }
129
130 rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector )
131 {
132 if (nb_sm.f0 == (NB_SM_BEFORE_AVF0-1) )
133 {
134 ring_node_for_averaging_sm_f0 = current_ring_node_sm_f0;
135 if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL)
136 {
137 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 );
138 }
139 nb_sm.f0 = 0;
140 }
141 else
142 {
143 nb_sm.f0 = nb_sm.f0 + 1;
144 }
145 }
146
147 //************
148 // RTEMS TASKS
149
150 rtems_task smiq_task( rtems_task_argument argument ) // process the Spectral Matrices IRQ
151 {
152 rtems_event_set event_out;
153
154 BOOT_PRINTF("in SMIQ *** \n")
155
156 while(1){
157 rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0
158 }
159 }
160
161 rtems_task avf0_task( rtems_task_argument lfrRequestedMode )
162 {
163 int i;
164
165 rtems_event_set event_out;
166 rtems_event_set event_for_matr;
167 rtems_status_code status;
168 ring_node_sm *ring_node_tab[8];
169 unsigned long long int localTime;
170
171 reset_nb_sm_f0( lfrRequestedMode ); // reset the sm counters that drive the BP and ASM computations / transmissions
172
173 BOOT_PRINTF1("in AVFO *** lfrRequestedMode = %d\n", lfrRequestedMode)
174
175 while(1){
176 rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0
177 ring_node_tab[NB_SM_BEFORE_AVF0-1] = ring_node_for_averaging_sm_f0;
178 for ( i = 2; i < (NB_SM_BEFORE_AVF0+1); i++ )
179 {
180 ring_node_for_averaging_sm_f0 = ring_node_for_averaging_sm_f0->previous;
181 ring_node_tab[NB_SM_BEFORE_AVF0-i] = ring_node_for_averaging_sm_f0;
182 }
183
184 localTime = getTimeAsUnsignedLongLongInt( );
185
186 // compute the average and store it in the averaged_sm_f1 buffer
187 SM_average( asm_norm_f0, current_ring_node_asm_burst_sbm_f0->asm_burst_sbm_f0,
188 ring_node_tab,
189 nb_sm.norm_bp1_f0, nb_sm.sbm_bp1_f0 );
190
191 localTime = getTimeAsUnsignedLongLongInt( ) - localTime;
192
193 // update nb_average
194 nb_sm.norm_bp1_f0 = nb_sm.norm_bp1_f0 + NB_SM_BEFORE_AVF0;
195 nb_sm.norm_bp2_f0 = nb_sm.norm_bp2_f0 + NB_SM_BEFORE_AVF0;
196 nb_sm.norm_asm_f0 = nb_sm.norm_asm_f0 + NB_SM_BEFORE_AVF0;
197 nb_sm.sbm_bp1_f0 = nb_sm.sbm_bp1_f0 + NB_SM_BEFORE_AVF0;
198 nb_sm.sbm_bp2_f0 = nb_sm.sbm_bp2_f0 + NB_SM_BEFORE_AVF0;
199
200 //***********************************************************
201 // build a composite event that will be sent to the MATR task
202 event_for_matr = 0x00;
203
204 if (nb_sm.sbm_bp1_f0 == nb_sm_before_bp.burst_sbm_bp1_f0)
205 {
206 nb_sm.sbm_bp1_f0 = 0;
207 // the ring node is ready for BP calculations
208 ring_node_for_processing_asm_burst_sbm_f0 = current_ring_node_asm_burst_sbm_f0;
209 // set another ring for the ASM storage
210 current_ring_node_asm_burst_sbm_f0 = current_ring_node_asm_burst_sbm_f0->next;
211 if ( (lfrCurrentMode == LFR_MODE_BURST)
212 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
213 {
214 event_for_matr = event_for_matr | RTEMS_EVENT_BURST_SBM_BP1_F0;
215 }
216 }
217
218 if (nb_sm.sbm_bp2_f0 == nb_sm_before_bp.burst_sbm_bp2_f0)
219 {
220 nb_sm.sbm_bp2_f0 = 0;
221 if ( (lfrCurrentMode == LFR_MODE_BURST)
222 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
223 {
224 event_for_matr = event_for_matr | RTEMS_EVENT_BURST_SBM_BP2_F0;
225 }
226 }
49
227
50 void init_sm_rings( void )
228 if (nb_sm.norm_bp1_f0 == nb_sm_before_bp.norm_bp1_f0)
229 {
230 nb_sm.norm_bp1_f0 = 0;
231 if (lfrCurrentMode == LFR_MODE_NORMAL)
232 {
233 event_for_matr = event_for_matr | RTEMS_EVENT_NORM_BP1_F0;
234 }
235 }
236
237 if (nb_sm.norm_bp2_f0 == nb_sm_before_bp.norm_bp2_f0)
238 {
239 nb_sm.norm_bp2_f0 = 0;
240 if ( (lfrCurrentMode == LFR_MODE_NORMAL)
241 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
242 {
243 event_for_matr = event_for_matr | RTEMS_EVENT_NORM_BP2_F0;
244 }
245 }
246
247 if (nb_sm.norm_asm_f0 == nb_sm_before_bp.norm_asm_f0)
248 {
249 nb_sm.norm_asm_f0 = 0;
250 if ( (lfrCurrentMode == LFR_MODE_NORMAL)
251 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
252 {
253 // PRINTF1("%lld\n", localTime)
254 event_for_matr = event_for_matr | RTEMS_EVENT_NORM_ASM_F0;
255 }
256 }
257
258 //*********************************
259 // send the composite event to MATR
260 status = rtems_event_send( Task_id[TASKID_MATR], event_for_matr );
261 if (status != RTEMS_SUCCESSFUL) {
262 printf("in AVF0 *** Error sending RTEMS_EVENT_0, code %d\n", status);
263 }
264 }
265 }
266
267 rtems_task matr_task( rtems_task_argument lfrRequestedMode )
268 {
269 spw_ioctl_pkt_send spw_ioctl_send_ASM;
270 rtems_event_set event_out;
271 rtems_status_code status;
272 rtems_id queue_id;
273 Header_TM_LFR_SCIENCE_ASM_t headerASM;
274 bp_packet_with_spare current_node_norm_bp1_f0;
275 bp_packet current_node_norm_bp2_f0;
276 bp_packet current_node_sbm_bp1_f0;
277 bp_packet current_node_sbm_bp2_f0;
278 unsigned long long int localTime;
279
280 ASM_init_header( &headerASM );
281
282 //*************
283 // NORM headers
284 BP_init_header_with_spare( &current_node_norm_bp1_f0.header,
285 APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP1_F0,
286 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F0, NB_BINS_COMPRESSED_SM_F0 );
287 BP_init_header( &current_node_norm_bp2_f0.header,
288 APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP2_F0,
289 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F0, NB_BINS_COMPRESSED_SM_F0);
290
291 //****************************
292 // BURST SBM1 and SBM2 headers
293 if ( (lfrRequestedMode == LFR_MODE_BURST)
294 || (lfrRequestedMode == LFR_MODE_NORMAL) || (lfrRequestedMode == LFR_MODE_STANDBY) )
295 {
296 BP_init_header( &current_node_sbm_bp1_f0.header,
297 APID_TM_SCIENCE_NORMAL_BURST, SID_BURST_BP1_F0,
298 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0, NB_BINS_COMPRESSED_SM_SBM_F0);
299 BP_init_header( &current_node_sbm_bp2_f0.header,
300 APID_TM_SCIENCE_NORMAL_BURST, SID_BURST_BP2_F0,
301 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0, NB_BINS_COMPRESSED_SM_SBM_F0);
302 }
303 else if ( lfrRequestedMode == LFR_MODE_SBM1 )
304 {
305 BP_init_header( &current_node_sbm_bp1_f0.header,
306 APID_TM_SCIENCE_SBM1_SBM2, SID_SBM1_BP1_F0,
307 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0, NB_BINS_COMPRESSED_SM_SBM_F0);
308 BP_init_header( &current_node_sbm_bp2_f0.header,
309 APID_TM_SCIENCE_SBM1_SBM2, SID_SBM1_BP2_F0,
310 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0, NB_BINS_COMPRESSED_SM_SBM_F0);
311 }
312 else if ( lfrRequestedMode == LFR_MODE_SBM2 )
313 {
314 BP_init_header( &current_node_sbm_bp1_f0.header,
315 APID_TM_SCIENCE_SBM1_SBM2, SID_SBM2_BP1_F0,
316 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0, NB_BINS_COMPRESSED_SM_SBM_F0);
317 BP_init_header( &current_node_sbm_bp2_f0.header,
318 APID_TM_SCIENCE_SBM1_SBM2, SID_SBM2_BP2_F0,
319 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0, NB_BINS_COMPRESSED_SM_SBM_F0);
320 }
321 else
322 {
323 PRINTF1("ERR *** in MATR *** unexpected lfrRequestedMode passed as argument = %d\n", (unsigned int) lfrRequestedMode)
324 }
325
326 status = get_message_queue_id_send( &queue_id );
327 if (status != RTEMS_SUCCESSFUL)
328 {
329 PRINTF1("in MATR *** ERR get_message_queue_id_send %d\n", status)
330 }
331
332 BOOT_PRINTF1("in MATR *** lfrRequestedMode = %d\n", lfrRequestedMode)
333
334 while(1){
335 rtems_event_receive( RTEMS_EVENT_NORM_BP1_F0 | RTEMS_EVENT_NORM_BP2_F0 | RTEMS_EVENT_NORM_ASM_F0
336 | RTEMS_EVENT_BURST_SBM_BP1_F0 | RTEMS_EVENT_BURST_SBM_BP2_F0,
337 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
338 localTime = getTimeAsUnsignedLongLongInt( );
339 //****************
340 //****************
341 // BURST SBM1 SBM2
342 //****************
343 //****************
344 if ( event_out & RTEMS_EVENT_BURST_SBM_BP1_F0 )
345 {
346 // 1) compress the matrix for Basic Parameters calculation
347 ASM_compress_reorganize_and_divide( current_ring_node_asm_burst_sbm_f0->asm_burst_sbm_f0, compressed_sm_sbm,
348 nb_sm_before_bp.burst_sbm_bp1_f0,
349 NB_BINS_COMPRESSED_SM_SBM_F0, NB_BINS_TO_AVERAGE_ASM_SBM_F0,
350 ASM_F0_INDICE_START);
351 // 2) compute the BP1 set
352
353 // 3) send the BP1 set
354 set_time( current_node_sbm_bp1_f0.header.time, (unsigned char *) &compressed_sm_sbm );
355 set_time( current_node_sbm_bp1_f0.header.acquisitionTime, (unsigned char *) &compressed_sm_sbm );
356 BP_send( (char *) &current_node_sbm_bp1_f0.header, queue_id,
357 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0 + PACKET_LENGTH_DELTA);
358 // 4) compute the BP2 set if needed
359 if ( event_out & RTEMS_EVENT_BURST_SBM_BP2_F0 )
360 {
361 // 1) compute the BP2 set
362
363 // 2) send the BP2 set
364 set_time( current_node_sbm_bp2_f0.header.time, (unsigned char *) &compressed_sm_sbm );
365 set_time( current_node_sbm_bp2_f0.header.acquisitionTime, (unsigned char *) &compressed_sm_sbm );
366 BP_send( (char *) &current_node_sbm_bp2_f0.header, queue_id,
367 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0 + PACKET_LENGTH_DELTA);
368 }
369 }
370
371 //*****
372 //*****
373 // NORM
374 //*****
375 //*****
376 if (event_out & RTEMS_EVENT_NORM_BP1_F0)
377 {
378 // 1) compress the matrix for Basic Parameters calculation
379 ASM_compress_reorganize_and_divide( asm_norm_f0, compressed_sm_norm_f0,
380 nb_sm_before_bp.norm_bp1_f0,
381 NB_BINS_COMPRESSED_SM_F0, NB_BINS_TO_AVERAGE_ASM_F0,
382 ASM_F0_INDICE_START );
383 // 2) compute the BP1 set
384
385 // 3) send the BP1 set
386 set_time( current_node_norm_bp1_f0.header.time, (unsigned char *) &compressed_sm_norm_f0 );
387 set_time( current_node_norm_bp1_f0.header.acquisitionTime, (unsigned char *) &compressed_sm_norm_f0 );
388 BP_send( (char *) &current_node_norm_bp1_f0.header, queue_id,
389 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F0 + PACKET_LENGTH_DELTA);
390 if (event_out & RTEMS_EVENT_NORM_BP2_F0)
391 {
392 // 1) compute the BP2 set
393
394 // 2) send the BP2 set
395 set_time( current_node_norm_bp2_f0.header.time, (unsigned char *) &compressed_sm_norm_f0 );
396 set_time( current_node_norm_bp2_f0.header.acquisitionTime, (unsigned char *) &compressed_sm_norm_f0 );
397 BP_send( (char *) &current_node_norm_bp2_f0.header, queue_id,
398 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F0 + PACKET_LENGTH_DELTA);
399 }
400 }
401
402 if (event_out & RTEMS_EVENT_NORM_ASM_F0)
403 {
404 // 1) reorganize the ASM and divide
405 ASM_reorganize_and_divide( asm_norm_f0, asm_f0_reorganized, NB_SM_BEFORE_NORM_BP1_F0 );
406 // 2) convert the float array in a char array
407 ASM_convert( asm_f0_reorganized, asm_f0_char);
408 // 3) send the spectral matrix packets
409 ASM_send( &headerASM, asm_f0_char, SID_NORM_ASM_F0, &spw_ioctl_send_ASM, queue_id);
410 // localTime = getTimeAsUnsignedLongLongInt( ) - localTime;
411 // PRINTF1("in MATR *** %lld\n", localTime)
412 }
413
414 }
415 }
416
417 //******************
418 // Spectral Matrices
419
420 void SM_init_rings( void )
51 {
421 {
52 unsigned char i;
422 unsigned char i;
53
423
54 // F0 RING
424 // F0 RING
55 sm_ring_f0[0].next = (ring_node_sm*) &sm_ring_f0[1];
425 sm_ring_f0[0].next = (ring_node_sm*) &sm_ring_f0[1];
56 sm_ring_f0[0].previous = (ring_node_sm*) &sm_ring_f0[NB_RING_NODES_ASM_F0-1];
426 sm_ring_f0[0].previous = (ring_node_sm*) &sm_ring_f0[NB_RING_NODES_SM_F0-1];
57 sm_ring_f0[0].buffer_address =
427 sm_ring_f0[0].buffer_address =
58 (int) &sm_f0[ 0 ];
428 (int) &sm_f0[ 0 ];
59
429
60 sm_ring_f0[NB_RING_NODES_ASM_F0-1].next = (ring_node_sm*) &sm_ring_f0[0];
430 sm_ring_f0[NB_RING_NODES_SM_F0-1].next = (ring_node_sm*) &sm_ring_f0[0];
61 sm_ring_f0[NB_RING_NODES_ASM_F0-1].previous = (ring_node_sm*) &sm_ring_f0[NB_RING_NODES_ASM_F0-2];
431 sm_ring_f0[NB_RING_NODES_SM_F0-1].previous = (ring_node_sm*) &sm_ring_f0[NB_RING_NODES_SM_F0-2];
62 sm_ring_f0[NB_RING_NODES_ASM_F0-1].buffer_address =
432 sm_ring_f0[NB_RING_NODES_SM_F0-1].buffer_address =
63 (int) &sm_f0[ (NB_RING_NODES_ASM_F0-1) * TOTAL_SIZE_SM ];
433 (int) &sm_f0[ (NB_RING_NODES_SM_F0-1) * TOTAL_SIZE_SM ];
64
434
65 for(i=1; i<NB_RING_NODES_ASM_F0-1; i++)
435 for(i=1; i<NB_RING_NODES_SM_F0-1; i++)
66 {
436 {
67 sm_ring_f0[i].next = (ring_node_sm*) &sm_ring_f0[i+1];
437 sm_ring_f0[i].next = (ring_node_sm*) &sm_ring_f0[i+1];
68 sm_ring_f0[i].previous = (ring_node_sm*) &sm_ring_f0[i-1];
438 sm_ring_f0[i].previous = (ring_node_sm*) &sm_ring_f0[i-1];
69 sm_ring_f0[i].buffer_address =
439 sm_ring_f0[i].buffer_address =
70 (int) &sm_f0[ i * TOTAL_SIZE_SM ];
440 (int) &sm_f0[ i * TOTAL_SIZE_SM ];
71 }
441 }
72
442
73 // F1 RING
443 // F1 RING
74 sm_ring_f1[0].next = (ring_node_sm*) &sm_ring_f1[1];
444 sm_ring_f1[0].next = (ring_node_sm*) &sm_ring_f1[1];
75 sm_ring_f1[0].previous = (ring_node_sm*) &sm_ring_f1[NB_RING_NODES_ASM_F1-1];
445 sm_ring_f1[0].previous = (ring_node_sm*) &sm_ring_f1[NB_RING_NODES_SM_F1-1];
76 sm_ring_f1[0].buffer_address =
446 sm_ring_f1[0].buffer_address =
77 (int) &sm_f1[ 0 ];
447 (int) &sm_f1[ 0 ];
78
448
79 sm_ring_f1[NB_RING_NODES_ASM_F1-1].next = (ring_node_sm*) &sm_ring_f1[0];
449 sm_ring_f1[NB_RING_NODES_SM_F1-1].next = (ring_node_sm*) &sm_ring_f1[0];
80 sm_ring_f1[NB_RING_NODES_ASM_F1-1].previous = (ring_node_sm*) &sm_ring_f1[NB_RING_NODES_ASM_F1-2];
450 sm_ring_f1[NB_RING_NODES_SM_F1-1].previous = (ring_node_sm*) &sm_ring_f1[NB_RING_NODES_SM_F1-2];
81 sm_ring_f1[NB_RING_NODES_ASM_F1-1].buffer_address =
451 sm_ring_f1[NB_RING_NODES_SM_F1-1].buffer_address =
82 (int) &sm_f1[ (NB_RING_NODES_ASM_F1-1) * TOTAL_SIZE_SM ];
452 (int) &sm_f1[ (NB_RING_NODES_SM_F1-1) * TOTAL_SIZE_SM ];
83
453
84 for(i=1; i<NB_RING_NODES_ASM_F1-1; i++)
454 for(i=1; i<NB_RING_NODES_SM_F1-1; i++)
85 {
455 {
86 sm_ring_f1[i].next = (ring_node_sm*) &sm_ring_f1[i+1];
456 sm_ring_f1[i].next = (ring_node_sm*) &sm_ring_f1[i+1];
87 sm_ring_f1[i].previous = (ring_node_sm*) &sm_ring_f1[i-1];
457 sm_ring_f1[i].previous = (ring_node_sm*) &sm_ring_f1[i-1];
88 sm_ring_f1[i].buffer_address =
458 sm_ring_f1[i].buffer_address =
89 (int) &sm_f1[ i * TOTAL_SIZE_SM ];
459 (int) &sm_f1[ i * TOTAL_SIZE_SM ];
90 }
460 }
91
461
92 // F2 RING
462 // F2 RING
93 sm_ring_f2[0].next = (ring_node_sm*) &sm_ring_f2[1];
463 sm_ring_f2[0].next = (ring_node_sm*) &sm_ring_f2[1];
94 sm_ring_f2[0].previous = (ring_node_sm*) &sm_ring_f2[NB_RING_NODES_ASM_F2-1];
464 sm_ring_f2[0].previous = (ring_node_sm*) &sm_ring_f2[NB_RING_NODES_SM_F2-1];
95 sm_ring_f2[0].buffer_address =
465 sm_ring_f2[0].buffer_address =
96 (int) &sm_f2[ 0 ];
466 (int) &sm_f2[ 0 ];
97
467
98 sm_ring_f2[NB_RING_NODES_ASM_F2-1].next = (ring_node_sm*) &sm_ring_f2[0];
468 sm_ring_f2[NB_RING_NODES_SM_F2-1].next = (ring_node_sm*) &sm_ring_f2[0];
99 sm_ring_f2[NB_RING_NODES_ASM_F2-1].previous = (ring_node_sm*) &sm_ring_f2[NB_RING_NODES_ASM_F2-2];
469 sm_ring_f2[NB_RING_NODES_SM_F2-1].previous = (ring_node_sm*) &sm_ring_f2[NB_RING_NODES_SM_F2-2];
100 sm_ring_f2[NB_RING_NODES_ASM_F2-1].buffer_address =
470 sm_ring_f2[NB_RING_NODES_SM_F2-1].buffer_address =
101 (int) &sm_f2[ (NB_RING_NODES_ASM_F2-1) * TOTAL_SIZE_SM ];
471 (int) &sm_f2[ (NB_RING_NODES_SM_F2-1) * TOTAL_SIZE_SM ];
102
472
103 for(i=1; i<NB_RING_NODES_ASM_F2-1; i++)
473 for(i=1; i<NB_RING_NODES_SM_F2-1; i++)
104 {
474 {
105 sm_ring_f2[i].next = (ring_node_sm*) &sm_ring_f2[i+1];
475 sm_ring_f2[i].next = (ring_node_sm*) &sm_ring_f2[i+1];
106 sm_ring_f2[i].previous = (ring_node_sm*) &sm_ring_f2[i-1];
476 sm_ring_f2[i].previous = (ring_node_sm*) &sm_ring_f2[i-1];
107 sm_ring_f2[i].buffer_address =
477 sm_ring_f2[i].buffer_address =
108 (int) &sm_f2[ i * TOTAL_SIZE_SM ];
478 (int) &sm_f2[ i * TOTAL_SIZE_SM ];
109 }
479 }
110
480
111 DEBUG_PRINTF1("asm_ring_f0 @%x\n", (unsigned int) sm_ring_f0)
481 DEBUG_PRINTF1("asm_ring_f0 @%x\n", (unsigned int) sm_ring_f0)
112 DEBUG_PRINTF1("asm_ring_f1 @%x\n", (unsigned int) sm_ring_f1)
482 DEBUG_PRINTF1("asm_ring_f1 @%x\n", (unsigned int) sm_ring_f1)
113 DEBUG_PRINTF1("asm_ring_f2 @%x\n", (unsigned int) sm_ring_f2)
483 DEBUG_PRINTF1("asm_ring_f2 @%x\n", (unsigned int) sm_ring_f2)
114
484
115 spectral_matrix_regs->matrixF0_Address0 = sm_ring_f0[0].buffer_address;
485 spectral_matrix_regs->matrixF0_Address0 = sm_ring_f0[0].buffer_address;
116 DEBUG_PRINTF1("spectral_matrix_regs->matrixF0_Address0 @%x\n", spectral_matrix_regs->matrixF0_Address0)
486 DEBUG_PRINTF1("spectral_matrix_regs->matrixF0_Address0 @%x\n", spectral_matrix_regs->matrixF0_Address0)
117 }
487 }
118
488
119 void reset_current_sm_ring_nodes( void )
489 void ASM_init_ring( void )
490 {
491 unsigned char i;
492
493 asm_ring_burst_sbm_f0[0].next = (ring_node_asm*) &asm_ring_burst_sbm_f0[1];
494 asm_ring_burst_sbm_f0[0].previous = (ring_node_asm*) &asm_ring_burst_sbm_f0[NB_RING_NODES_ASM_BURST_SBM_F0-1];
495
496 asm_ring_burst_sbm_f0[NB_RING_NODES_ASM_BURST_SBM_F0-1].next
497 = (ring_node_asm*) &asm_ring_burst_sbm_f0[0];
498 asm_ring_burst_sbm_f0[NB_RING_NODES_ASM_BURST_SBM_F0-1].previous
499 = (ring_node_asm*) &asm_ring_burst_sbm_f0[NB_RING_NODES_ASM_BURST_SBM_F0-2];
500
501 for(i=1; i<NB_RING_NODES_ASM_BURST_SBM_F0-1; i++)
502 {
503 asm_ring_burst_sbm_f0[i].next = (ring_node_asm*) &asm_ring_burst_sbm_f0[i+1];
504 asm_ring_burst_sbm_f0[i].previous = (ring_node_asm*) &asm_ring_burst_sbm_f0[i-1];
505 }
506 }
507
508 void SM_reset_current_ring_nodes( void )
120 {
509 {
121 current_ring_node_sm_f0 = sm_ring_f0;
510 current_ring_node_sm_f0 = sm_ring_f0;
122 current_ring_node_sm_f1 = sm_ring_f1;
511 current_ring_node_sm_f1 = sm_ring_f1;
123 current_ring_node_sm_f2 = sm_ring_f2;
512 current_ring_node_sm_f2 = sm_ring_f2;
124
513
125 ring_node_for_averaging_sm_f0 = sm_ring_f0;
514 ring_node_for_averaging_sm_f0 = sm_ring_f0;
126 }
515 }
127
516
128 void reset_current_bp_ring_nodes( void )
517 void ASM_reset_current_ring_node( void )
129 {
130 current_node_sbm1_bp1_f0 = bp_ring_sbm1_bp1;
131 current_node_sbm1_bp2_f0 = bp_ring_sbm1_bp2;
132 }
133
134 //***********************************************************
135 // Interrupt Service Routine for spectral matrices processing
136 void reset_nb_sm_f0( void )
137 {
138 nb_sm_f0 = 0;
139 }
140
141 rtems_isr spectral_matrices_isr( rtems_vector_number vector )
142 {
518 {
143 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_8 );
519 current_ring_node_asm_burst_sbm_f0 = asm_ring_burst_sbm_f0;
144
520 ring_node_for_processing_asm_burst_sbm_f0 = asm_ring_burst_sbm_f0;
145 if ( (spectral_matrix_regs->status & 0x1) == 0x01)
146 {
147 current_ring_node_sm_f0 = current_ring_node_sm_f0->next;
148 spectral_matrix_regs->matrixF0_Address0 = current_ring_node_sm_f0->buffer_address;
149 spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffe; // 1110
150 nb_sm_f0 = nb_sm_f0 + 1;
151 }
152 else if ( (spectral_matrix_regs->status & 0x2) == 0x02)
153 {
154 current_ring_node_sm_f0 = current_ring_node_sm_f0->next;
155 spectral_matrix_regs->matrixFO_Address1 = current_ring_node_sm_f0->buffer_address;
156 spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffd; // 1101
157 nb_sm_f0 = nb_sm_f0 + 1;
158 }
159
160 if ( (spectral_matrix_regs->status & 0x30) != 0x00)
161 {
162 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_8 );
163 spectral_matrix_regs->status = spectral_matrix_regs->status & 0xffffffcf; // 1100 1111
164 }
165
166 spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffff3; // 0011
167
168 if (nb_sm_f0 == (NB_SM_BEFORE_AVF0-1) )
169 {
170 ring_node_for_averaging_sm_f0 = current_ring_node_sm_f0;
171 if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL)
172 {
173 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 );
174 }
175 nb_sm_f0 = 0;
176 }
177 else
178 {
179 nb_sm_f0 = nb_sm_f0 + 1;
180 }
181 }
182
183 rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector )
184 {
185 if (nb_sm_f0 == (NB_SM_BEFORE_AVF0-1) )
186 {
187 ring_node_for_averaging_sm_f0 = current_ring_node_sm_f0;
188 if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL)
189 {
190 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 );
191 }
192 nb_sm_f0 = 0;
193 }
194 else
195 {
196 nb_sm_f0 = nb_sm_f0 + 1;
197 }
198 }
199
200 //************
201 // RTEMS TASKS
202
203 rtems_task smiq_task(rtems_task_argument argument) // process the Spectral Matrices IRQ
204 {
205 rtems_event_set event_out;
206
207 BOOT_PRINTF("in SMIQ *** \n")
208
209 while(1){
210 rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0
211 }
212 }
521 }
213
522
214 rtems_task avf0_task(rtems_task_argument argument)
523 void ASM_init_header( Header_TM_LFR_SCIENCE_ASM_t *header)
215 {
216 int i;
217 static unsigned int nb_sm_norm_bp1_f0;
218 static unsigned int nb_sm_norm_bp2_f0;
219 static unsigned int nb_sm_norm_asm_f0;
220 static unsigned int nb_sm_sbm1_bp1_f0;
221 static unsigned int nb_sm_sbm1_bp2_f0;
222 rtems_event_set event_out;
223 rtems_event_set event_for_matr;
224 rtems_status_code status;
225 ring_node_sm *ring_node_tab[8];
226
227 nb_sm_norm_bp1_f0 = 0;
228 nb_sm_norm_bp2_f0 = 0;
229 nb_sm_norm_asm_f0 = 0;
230 nb_sm_sbm1_bp1_f0 = 0;
231 nb_sm_sbm1_bp2_f0 = 0;
232
233 BOOT_PRINTF("in AVFO *** \n")
234
235 while(1){
236 rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0
237 ring_node_tab[NB_SM_BEFORE_AVF0-1] = ring_node_for_averaging_sm_f0;
238 for ( i = 2; i < (NB_SM_BEFORE_AVF0+1); i++ )
239 {
240 ring_node_for_averaging_sm_f0 = ring_node_for_averaging_sm_f0->previous;
241 ring_node_tab[NB_SM_BEFORE_AVF0-i] = ring_node_for_averaging_sm_f0;
242 }
243
244 // copy time information in the asm_f0 buffer
245 asm_norm_f0[0] = ring_node_tab[7]->coarseTime;
246 asm_norm_f0[1] = ring_node_tab[7]->fineTime;
247 asm_sbm1_f0[0] = ring_node_tab[7]->coarseTime;
248 asm_sbm1_f0[1] = ring_node_tab[7]->fineTime;
249
250 // compute the average and store it in the averaged_sm_f1 buffer
251 SM_average( asm_norm_f0, asm_sbm1_f0,
252 ring_node_tab,
253 nb_sm_norm_bp1_f0, nb_sm_sbm1_bp1_f0 );
254
255 // update nb_average
256 nb_sm_norm_bp1_f0 = nb_sm_norm_bp1_f0 + NB_SM_BEFORE_AVF0;
257 nb_sm_norm_bp2_f0 = nb_sm_norm_bp2_f0 + NB_SM_BEFORE_AVF0;
258 nb_sm_norm_asm_f0 = nb_sm_norm_asm_f0 + NB_SM_BEFORE_AVF0;
259 nb_sm_sbm1_bp1_f0 = nb_sm_sbm1_bp1_f0 + NB_SM_BEFORE_AVF0;
260 nb_sm_sbm1_bp2_f0 = nb_sm_sbm1_bp2_f0 + NB_SM_BEFORE_AVF0;
261
262 //***********************************************************
263 // build a composite event that will be sent to the MATR task
264 event_for_matr = 0x00;
265
266 if (nb_sm_sbm1_bp1_f0 == NB_SM_BEFORE_SBM1_BP1_F0)
267 {
268 nb_sm_sbm1_bp1_f0 = 0;
269 if (lfrCurrentMode == LFR_MODE_SBM1)
270 {
271 event_for_matr = event_for_matr | RTEMS_EVENT_SBM1_BP1_F0;
272 }
273 }
274
275 if (nb_sm_sbm1_bp2_f0 == NB_SM_BEFORE_SBM1_BP2_F0)
276 {
277 nb_sm_sbm1_bp2_f0 = 0;
278 if (lfrCurrentMode == LFR_MODE_SBM1)
279 {
280 event_for_matr = event_for_matr | RTEMS_EVENT_SBM1_BP2_F0;
281 }
282 }
283
284 if (nb_sm_norm_bp1_f0 == NB_SM_BEFORE_NORM_BP1_F0) {
285 nb_sm_norm_bp1_f0 = 0;
286 if (lfrCurrentMode == LFR_MODE_NORMAL)
287 {
288 event_for_matr = event_for_matr | RTEMS_EVENT_NORM_BP1_F0;
289 }
290 }
291
292 if (nb_sm_norm_bp2_f0 == NB_SM_BEFORE_NORM_BP2_F0) {
293 nb_sm_norm_bp2_f0 = 0;
294 if (lfrCurrentMode == LFR_MODE_NORMAL)
295 {
296 event_for_matr = event_for_matr | RTEMS_EVENT_NORM_BP2_F0;
297 }
298 }
299
300 if (nb_sm_norm_asm_f0 == NB_SM_BEFORE_NORM_ASM_F0) {
301 nb_sm_norm_asm_f0 = 0;
302 if (lfrCurrentMode == LFR_MODE_NORMAL)
303 {
304 event_for_matr = event_for_matr | RTEMS_EVENT_NORM_ASM_F0;
305 }
306 }
307
308 //*********************************
309 // send the composite event to MATR
310 status = rtems_event_send( Task_id[TASKID_MATR], event_for_matr );
311 if (status != RTEMS_SUCCESSFUL) {
312 printf("in AVF0 *** Error sending RTEMS_EVENT_0, code %d\n", status);
313 }
314 }
315 }
316
317 rtems_task matr_task(rtems_task_argument argument)
318 {
524 {
319 spw_ioctl_pkt_send spw_ioctl_send_ASM;
525 header->targetLogicalAddress = CCSDS_DESTINATION_ID;
320 rtems_event_set event_out;
526 header->protocolIdentifier = CCSDS_PROTOCOLE_ID;
321 rtems_status_code status;
527 header->reserved = 0x00;
322 rtems_id queue_id;
528 header->userApplication = CCSDS_USER_APP;
323 Header_TM_LFR_SCIENCE_ASM_t headerASM;
529 header->packetID[0] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST >> 8);
324 ring_node_bp_with_spare current_node_norm_bp1_f0;
530 header->packetID[1] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST);
325 ring_node_bp current_node_norm_bp2_f0;
531 header->packetSequenceControl[0] = 0xc0;
326
532 header->packetSequenceControl[1] = 0x00;
327 init_header_asm( &headerASM );
533 header->packetLength[0] = 0x00;
328 init_header_bp_with_spare( &current_node_norm_bp1_f0.header,
534 header->packetLength[1] = 0x00;
329 APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP1_F0,
535 // DATA FIELD HEADER
330 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F0, NB_BINS_COMPRESSED_SM_F0 );
536 header->spare1_pusVersion_spare2 = 0x10;
331 init_header_bp( &current_node_norm_bp2_f0.header,
537 header->serviceType = TM_TYPE_LFR_SCIENCE; // service type
332 APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP2_F0,
538 header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
333 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F0, NB_BINS_COMPRESSED_SM_F0);
539 header->destinationID = TM_DESTINATION_ID_GROUND;
334
540 // AUXILIARY DATA HEADER
335 status = get_message_queue_id_send( &queue_id );
541 header->sid = 0x00;
336 if (status != RTEMS_SUCCESSFUL)
542 header->biaStatusInfo = 0x00;
337 {
543 header->pa_lfr_pkt_cnt_asm = 0x00;
338 PRINTF1("in MATR *** ERR get_message_queue_id_send %d\n", status)
544 header->pa_lfr_pkt_nr_asm = 0x00;
339 }
545 header->time[0] = 0x00;
340
546 header->time[0] = 0x00;
341 BOOT_PRINTF("in MATR *** \n")
547 header->time[0] = 0x00;
342
548 header->time[0] = 0x00;
343 while(1){
549 header->time[0] = 0x00;
344 rtems_event_receive( RTEMS_EVENT_NORM_BP1_F0 | RTEMS_EVENT_NORM_BP2_F0 | RTEMS_EVENT_NORM_ASM_F0
550 header->time[0] = 0x00;
345 | RTEMS_EVENT_SBM1_BP1_F0 | RTEMS_EVENT_SBM1_BP2_F0,
551 header->pa_lfr_asm_blk_nr[0] = 0x00; // BLK_NR MSB
346 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
552 header->pa_lfr_asm_blk_nr[1] = 0x00; // BLK_NR LSB
347 //*****
348 //*****
349 // SBM1
350 //*****
351 //*****
352 if (event_out & RTEMS_EVENT_SBM1_BP1_F0)
353 {
354 // 1) compress the matrix for Basic Parameters calculation
355 ASM_compress_reorganize_and_divide( asm_sbm1_f0, compressed_sm_sbm1,
356 NB_SM_BEFORE_SBM1_BP1_F0,
357 NB_BINS_COMPRESSED_SM_SBM1_F0, NB_BINS_TO_AVERAGE_ASM_SBM1_F0,
358 ASM_F0_INDICE_START);
359 // 2) compute the BP1 set
360
361 // 3) send the BP1 set
362 set_time( current_node_sbm1_bp1_f0->header.time,
363 current_node_sbm1_bp1_f0->coarseTime, current_node_sbm1_bp1_f0->fineTime);
364 set_time( current_node_sbm1_bp1_f0->header.acquisitionTime,
365 current_node_sbm1_bp1_f0->coarseTime, current_node_sbm1_bp1_f0->fineTime);
366 BP_send( (char *) &current_node_sbm1_bp1_f0->header, queue_id,
367 PACKET_LENGTH_TM_LFR_SCIENCE_SBM1_BP1_F0 + PACKET_LENGTH_DELTA);
368 // 4) update current_node_sbm1_bp1_f0
369 current_node_sbm1_bp1_f0 = current_node_sbm1_bp1_f0->next;
370 if (event_out & RTEMS_EVENT_SBM1_BP2_F0)
371 {
372 // 1) compute the BP2 set
373
374 // 2) send the BP2 set
375 set_time( current_node_sbm1_bp2_f0->header.time,
376 current_node_sbm1_bp2_f0->coarseTime, current_node_sbm1_bp2_f0->fineTime);
377 set_time( current_node_sbm1_bp2_f0->header.acquisitionTime,
378 current_node_sbm1_bp2_f0->coarseTime, current_node_sbm1_bp2_f0->fineTime);
379 BP_send( (char *) &current_node_sbm1_bp2_f0->header, queue_id,
380 PACKET_LENGTH_TM_LFR_SCIENCE_SBM1_BP1_F0 + PACKET_LENGTH_DELTA);
381 }
382 }
383
384 //*****
385 //*****
386 // NORM
387 //*****
388 //*****
389 if (event_out & RTEMS_EVENT_NORM_BP1_F0)
390 {
391 // 1) compress the matrix for Basic Parameters calculation
392 ASM_compress_reorganize_and_divide( asm_norm_f0, compressed_sm_norm_f0,
393 NB_SM_BEFORE_NORM_BP1_F0,
394 NB_BINS_COMPRESSED_SM_F0, NB_BINS_TO_AVERAGE_ASM_F0,
395 ASM_F0_INDICE_START );
396 // 2) compute the BP1 set
397
398 // 3) send the BP1 set
399 set_time( current_node_norm_bp1_f0.header.time,
400 current_node_norm_bp1_f0.coarseTime, current_node_norm_bp1_f0.fineTime);
401 set_time( current_node_norm_bp1_f0.header.acquisitionTime,
402 current_node_norm_bp1_f0.coarseTime, current_node_norm_bp1_f0.fineTime);
403 BP_send( (char *) &current_node_norm_bp1_f0.header, queue_id,
404 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F0 + PACKET_LENGTH_DELTA);
405 if (event_out & RTEMS_EVENT_NORM_BP2_F0)
406 {
407 // 1) compute the BP2 set
408
409 // 2) send the BP2 set
410 set_time( current_node_norm_bp2_f0.header.time,
411 current_node_norm_bp2_f0.coarseTime, current_node_norm_bp2_f0.fineTime);
412 set_time( current_node_norm_bp2_f0.header.acquisitionTime,
413 current_node_norm_bp2_f0.coarseTime, current_node_norm_bp2_f0.fineTime);
414 BP_send( (char *) &current_node_norm_bp2_f0.header, queue_id,
415 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F0 + PACKET_LENGTH_DELTA);
416 }
417 }
418
419 if (event_out & RTEMS_EVENT_NORM_ASM_F0)
420 {
421 // 1) reorganize the ASM and divide
422 ASM_reorganize_and_divide( asm_norm_f0, asm_f0_reorganized, NB_SM_BEFORE_NORM_BP1_F0 );
423 // 2) convert the float array in a char array
424 ASM_convert( asm_f0_reorganized, asm_f0_char);
425 // 3) send the spectral matrix packets
426 ASM_send( &headerASM, asm_f0_char, SID_NORM_ASM_F0, &spw_ioctl_send_ASM, queue_id);
427 }
428
429 }
430 }
553 }
431
554
432 //*****************************
433 // Spectral matrices processing
434
435 void SM_average( float *averaged_spec_mat_f0, float *averaged_spec_mat_f1,
555 void SM_average( float *averaged_spec_mat_f0, float *averaged_spec_mat_f1,
436 ring_node_sm *ring_node_tab[],
556 ring_node_sm *ring_node_tab[],
437 unsigned int nbAverageNormF0, unsigned int nbAverageSBM1F0 )
557 unsigned int nbAverageNormF0, unsigned int nbAverageSBM1F0 )
438 {
558 {
439 float sum;
559 float sum;
440 unsigned int i;
560 unsigned int i;
561 unsigned char *ptr;
441
562
442 for(i=0; i<TOTAL_SIZE_SM; i++)
563 for(i=0; i<TOTAL_SIZE_SM; i++)
443 {
564 {
444 sum = ( (int *) (ring_node_tab[0]->buffer_address) ) [ i ]
565 sum = ( (int *) (ring_node_tab[0]->buffer_address) ) [ i ]
445 + ( (int *) (ring_node_tab[1]->buffer_address) ) [ i ]
566 + ( (int *) (ring_node_tab[1]->buffer_address) ) [ i ]
446 + ( (int *) (ring_node_tab[2]->buffer_address) ) [ i ]
567 + ( (int *) (ring_node_tab[2]->buffer_address) ) [ i ]
447 + ( (int *) (ring_node_tab[3]->buffer_address) ) [ i ]
568 + ( (int *) (ring_node_tab[3]->buffer_address) ) [ i ]
448 + ( (int *) (ring_node_tab[4]->buffer_address) ) [ i ]
569 + ( (int *) (ring_node_tab[4]->buffer_address) ) [ i ]
449 + ( (int *) (ring_node_tab[5]->buffer_address) ) [ i ]
570 + ( (int *) (ring_node_tab[5]->buffer_address) ) [ i ]
450 + ( (int *) (ring_node_tab[6]->buffer_address) ) [ i ]
571 + ( (int *) (ring_node_tab[6]->buffer_address) ) [ i ]
451 + ( (int *) (ring_node_tab[7]->buffer_address) ) [ i ];
572 + ( (int *) (ring_node_tab[7]->buffer_address) ) [ i ];
452
573
453 if ( (nbAverageNormF0 == 0) && (nbAverageSBM1F0 == 0) )
574 if ( (nbAverageNormF0 == 0) && (nbAverageSBM1F0 == 0) )
454 {
575 {
455 averaged_spec_mat_f0[ TIME_OFFSET + i ] = sum;
576 averaged_spec_mat_f0[ TIME_OFFSET + i ] = sum;
456 averaged_spec_mat_f1[ TIME_OFFSET + i ] = sum;
577 averaged_spec_mat_f1[ TIME_OFFSET + i ] = sum;
457 }
578 }
458 else if ( (nbAverageNormF0 != 0) && (nbAverageSBM1F0 != 0) )
579 else if ( (nbAverageNormF0 != 0) && (nbAverageSBM1F0 != 0) )
459 {
580 {
460 averaged_spec_mat_f0[ TIME_OFFSET + i ] = ( averaged_spec_mat_f0[ TIME_OFFSET + i ] + sum );
581 averaged_spec_mat_f0[ TIME_OFFSET + i ] = ( averaged_spec_mat_f0[ TIME_OFFSET + i ] + sum );
461 averaged_spec_mat_f1[ TIME_OFFSET + i ] = ( averaged_spec_mat_f1[ TIME_OFFSET + i ] + sum );
582 averaged_spec_mat_f1[ TIME_OFFSET + i ] = ( averaged_spec_mat_f1[ TIME_OFFSET + i ] + sum );
462 }
583 }
463 else if ( (nbAverageNormF0 != 0) && (nbAverageSBM1F0 == 0) )
584 else if ( (nbAverageNormF0 != 0) && (nbAverageSBM1F0 == 0) )
464 {
585 {
465 averaged_spec_mat_f0[ TIME_OFFSET + i ] = ( averaged_spec_mat_f0[ TIME_OFFSET + i ] + sum );
586 averaged_spec_mat_f0[ TIME_OFFSET + i ] = ( averaged_spec_mat_f0[ TIME_OFFSET + i ] + sum );
466 averaged_spec_mat_f1[ TIME_OFFSET + i ] = sum;
587 averaged_spec_mat_f1[ TIME_OFFSET + i ] = sum;
467 }
588 }
468 else
589 else
469 {
590 {
470 PRINTF2("ERR *** in SM_average *** unexpected parameters %d %d\n", nbAverageNormF0, nbAverageSBM1F0)
591 PRINTF2("ERR *** in SM_average *** unexpected parameters %d %d\n", nbAverageNormF0, nbAverageSBM1F0)
471 }
592 }
472 }
593 }
594 if ( (nbAverageNormF0 == 0) && (nbAverageSBM1F0 == 0) )
595 {
596 ptr = (unsigned char *) averaged_spec_mat_f0;
597 ptr[0] = (unsigned char) (time_management_regs->coarse_time >> 24);
598 ptr[1] = (unsigned char) (time_management_regs->coarse_time >> 16);
599 ptr[2] = (unsigned char) (time_management_regs->coarse_time >> 8 );
600 ptr[3] = (unsigned char) (time_management_regs->coarse_time );
601 ptr[4] = (unsigned char) (time_management_regs->fine_time >> 24);
602 ptr[5] = (unsigned char) (time_management_regs->fine_time >> 16);
603 ptr[6] = (unsigned char) (time_management_regs->fine_time >> 8 );
604 ptr[7] = (unsigned char) (time_management_regs->fine_time );
605 ptr = (unsigned char *) averaged_spec_mat_f1;
606 ptr[0] = (unsigned char) (time_management_regs->coarse_time >> 24);
607 ptr[1] = (unsigned char) (time_management_regs->coarse_time >> 16);
608 ptr[2] = (unsigned char) (time_management_regs->coarse_time >> 8 );
609 ptr[3] = (unsigned char) (time_management_regs->coarse_time );
610 ptr[4] = (unsigned char) (time_management_regs->fine_time >> 24);
611 ptr[5] = (unsigned char) (time_management_regs->fine_time >> 16);
612 ptr[6] = (unsigned char) (time_management_regs->fine_time >> 8 );
613 ptr[7] = (unsigned char) (time_management_regs->fine_time );
614 }
473 }
615 }
474
616
475 void ASM_reorganize_and_divide( float *averaged_spec_mat, float *averaged_spec_mat_reorganized, float divider )
617 void ASM_reorganize_and_divide( float *averaged_spec_mat, float *averaged_spec_mat_reorganized, float divider )
476 {
618 {
477 int frequencyBin;
619 int frequencyBin;
478 int asmComponent;
620 int asmComponent;
479
621
480 // copy the time information
622 // copy the time information
481 averaged_spec_mat_reorganized[ 0 ] = averaged_spec_mat[ 0 ];
623 averaged_spec_mat_reorganized[ 0 ] = averaged_spec_mat[ 0 ];
482 averaged_spec_mat_reorganized[ 1 ] = averaged_spec_mat[ 1 ];
624 averaged_spec_mat_reorganized[ 1 ] = averaged_spec_mat[ 1 ];
483
625
484 for (asmComponent = 0; asmComponent < NB_VALUES_PER_SM; asmComponent++)
626 for (asmComponent = 0; asmComponent < NB_VALUES_PER_SM; asmComponent++)
485 {
627 {
486 for( frequencyBin = 0; frequencyBin < NB_BINS_PER_SM; frequencyBin++ )
628 for( frequencyBin = 0; frequencyBin < NB_BINS_PER_SM; frequencyBin++ )
487 {
629 {
488 averaged_spec_mat_reorganized[ TIME_OFFSET + frequencyBin * NB_VALUES_PER_SM + asmComponent ] =
630 averaged_spec_mat_reorganized[ TIME_OFFSET + frequencyBin * NB_VALUES_PER_SM + asmComponent ] =
489 averaged_spec_mat[ TIME_OFFSET + asmComponent * NB_BINS_PER_SM + frequencyBin ] / divider;
631 averaged_spec_mat[ TIME_OFFSET + asmComponent * NB_BINS_PER_SM + frequencyBin ] / divider;
490 }
632 }
491 }
633 }
492 }
634 }
493
635
494 void ASM_compress_reorganize_and_divide(float *averaged_spec_mat, float *compressed_spec_mat , float divider,
636 void ASM_compress_reorganize_and_divide(float *averaged_spec_mat, float *compressed_spec_mat , float divider,
495 unsigned char nbBinsCompressedMatrix, unsigned char nbBinsToAverage, unsigned char ASMIndexStart )
637 unsigned char nbBinsCompressedMatrix, unsigned char nbBinsToAverage, unsigned char ASMIndexStart )
496 {
638 {
497 int frequencyBin;
639 int frequencyBin;
498 int asmComponent;
640 int asmComponent;
499 int offsetASM;
641 int offsetASM;
500 int offsetCompressed;
642 int offsetCompressed;
501 int k;
643 int k;
502
644
645 // copy the time information
646 compressed_spec_mat[ 0 ] = averaged_spec_mat[ 0 ];
647 compressed_spec_mat[ 1 ] = averaged_spec_mat[ 1 ];
648
649 // build data
503 for (asmComponent = 0; asmComponent < NB_VALUES_PER_SM; asmComponent++)
650 for (asmComponent = 0; asmComponent < NB_VALUES_PER_SM; asmComponent++)
504 {
651 {
505 for( frequencyBin = 0; frequencyBin < nbBinsCompressedMatrix; frequencyBin++ )
652 for( frequencyBin = 0; frequencyBin < nbBinsCompressedMatrix; frequencyBin++ )
506 {
653 {
507 offsetCompressed = TIME_OFFSET
654 offsetCompressed = TIME_OFFSET
508 + frequencyBin * NB_VALUES_PER_SM
655 + frequencyBin * NB_VALUES_PER_SM
509 + asmComponent;
656 + asmComponent;
510 offsetASM = TIME_OFFSET
657 offsetASM = TIME_OFFSET
511 + asmComponent * NB_BINS_PER_SM
658 + asmComponent * NB_BINS_PER_SM
512 + ASMIndexStart
659 + ASMIndexStart
513 + frequencyBin * nbBinsToAverage;
660 + frequencyBin * nbBinsToAverage;
514 compressed_spec_mat[ offsetCompressed ] = 0;
661 compressed_spec_mat[ offsetCompressed ] = 0;
515 for ( k = 0; k < nbBinsToAverage; k++ )
662 for ( k = 0; k < nbBinsToAverage; k++ )
516 {
663 {
517 compressed_spec_mat[offsetCompressed ] =
664 compressed_spec_mat[offsetCompressed ] =
518 ( compressed_spec_mat[ offsetCompressed ]
665 ( compressed_spec_mat[ offsetCompressed ]
519 + averaged_spec_mat[ offsetASM + k ] ) / (divider * nbBinsToAverage);
666 + averaged_spec_mat[ offsetASM + k ] ) / (divider * nbBinsToAverage);
520 }
667 }
521 }
668 }
522 }
669 }
523 }
670 }
524
671
525 void ASM_convert( volatile float *input_matrix, char *output_matrix)
672 void ASM_convert( volatile float *input_matrix, char *output_matrix)
526 {
673 {
527 unsigned int i;
674 unsigned int i;
528 unsigned int frequencyBin;
675 unsigned int frequencyBin;
529 unsigned int asmComponent;
676 unsigned int asmComponent;
530 char * pt_char_input;
677 char * pt_char_input;
531 char * pt_char_output;
678 char * pt_char_output;
532
679
533 pt_char_input = (char*) &input_matrix;
680 pt_char_input = (char*) &input_matrix;
534 pt_char_output = (char*) &output_matrix;
681 pt_char_output = (char*) &output_matrix;
535
682
536 // copy the time information
683 // copy the time information
537 for (i=0; i<TIME_OFFSET_IN_BYTES; i++)
684 for (i=0; i<TIME_OFFSET_IN_BYTES; i++)
538 {
685 {
539 pt_char_output[ i ] = pt_char_output[ i ];
686 pt_char_output[ i ] = pt_char_output[ i ];
540 }
687 }
541
688
542 // convert all other data
689 // convert all other data
543 for( frequencyBin=0; frequencyBin<NB_BINS_PER_SM; frequencyBin++)
690 for( frequencyBin=0; frequencyBin<NB_BINS_PER_SM; frequencyBin++)
544 {
691 {
545 for ( asmComponent=0; asmComponent<NB_VALUES_PER_SM; asmComponent++)
692 for ( asmComponent=0; asmComponent<NB_VALUES_PER_SM; asmComponent++)
546 {
693 {
547 pt_char_input = (char*) &input_matrix [ (frequencyBin*NB_VALUES_PER_SM) + asmComponent + TIME_OFFSET ];
694 pt_char_input = (char*) &input_matrix [ (frequencyBin*NB_VALUES_PER_SM) + asmComponent + TIME_OFFSET ];
548 pt_char_output = (char*) &output_matrix[ 2 * ( (frequencyBin*NB_VALUES_PER_SM) + asmComponent ) + TIME_OFFSET_IN_BYTES ];
695 pt_char_output = (char*) &output_matrix[ 2 * ( (frequencyBin*NB_VALUES_PER_SM) + asmComponent ) + TIME_OFFSET_IN_BYTES ];
549 pt_char_output[0] = pt_char_input[0]; // bits 31 downto 24 of the float
696 pt_char_output[0] = pt_char_input[0]; // bits 31 downto 24 of the float
550 pt_char_output[1] = pt_char_input[1]; // bits 23 downto 16 of the float
697 pt_char_output[1] = pt_char_input[1]; // bits 23 downto 16 of the float
551 }
698 }
552 }
699 }
553 }
700 }
554
701
555 void ASM_send(Header_TM_LFR_SCIENCE_ASM_t *header, char *spectral_matrix,
702 void ASM_send(Header_TM_LFR_SCIENCE_ASM_t *header, char *spectral_matrix,
556 unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send, rtems_id queue_id)
703 unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send, rtems_id queue_id)
557 {
704 {
558 unsigned int i;
705 unsigned int i;
559 unsigned int length = 0;
706 unsigned int length = 0;
560 rtems_status_code status;
707 rtems_status_code status;
561
708
562 for (i=0; i<2; i++)
709 for (i=0; i<2; i++)
563 {
710 {
564 // (1) BUILD THE DATA
711 // (1) BUILD THE DATA
565 switch(sid)
712 switch(sid)
566 {
713 {
567 case SID_NORM_ASM_F0:
714 case SID_NORM_ASM_F0:
568 spw_ioctl_send->dlen = TOTAL_SIZE_ASM_F0_IN_BYTES / 2;
715 spw_ioctl_send->dlen = TOTAL_SIZE_ASM_F0_IN_BYTES / 2;
569 spw_ioctl_send->data = &spectral_matrix[
716 spw_ioctl_send->data = &spectral_matrix[
570 ( (ASM_F0_INDICE_START + (i*NB_BINS_PER_PKT_ASM_F0) ) * NB_VALUES_PER_SM ) * 2
717 ( (ASM_F0_INDICE_START + (i*NB_BINS_PER_PKT_ASM_F0) ) * NB_VALUES_PER_SM ) * 2
571 + TIME_OFFSET_IN_BYTES
718 + TIME_OFFSET_IN_BYTES
572 ];
719 ];
573 length = PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F0;
720 length = PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F0;
574 header->pa_lfr_asm_blk_nr[0] = (unsigned char) ( (NB_BINS_PER_PKT_ASM_F0) >> 8 ); // BLK_NR MSB
721 header->pa_lfr_asm_blk_nr[0] = (unsigned char) ( (NB_BINS_PER_PKT_ASM_F0) >> 8 ); // BLK_NR MSB
575 header->pa_lfr_asm_blk_nr[1] = (unsigned char) (NB_BINS_PER_PKT_ASM_F0); // BLK_NR LSB
722 header->pa_lfr_asm_blk_nr[1] = (unsigned char) (NB_BINS_PER_PKT_ASM_F0); // BLK_NR LSB
576 break;
723 break;
577 case SID_NORM_ASM_F1:
724 case SID_NORM_ASM_F1:
578 break;
725 break;
579 case SID_NORM_ASM_F2:
726 case SID_NORM_ASM_F2:
580 break;
727 break;
581 default:
728 default:
582 PRINTF1("ERR *** in ASM_send *** unexpected sid %d\n", sid)
729 PRINTF1("ERR *** in ASM_send *** unexpected sid %d\n", sid)
583 break;
730 break;
584 }
731 }
585 spw_ioctl_send->hlen = HEADER_LENGTH_TM_LFR_SCIENCE_ASM + CCSDS_PROTOCOLE_EXTRA_BYTES;
732 spw_ioctl_send->hlen = HEADER_LENGTH_TM_LFR_SCIENCE_ASM + CCSDS_PROTOCOLE_EXTRA_BYTES;
586 spw_ioctl_send->hdr = (char *) header;
733 spw_ioctl_send->hdr = (char *) header;
587 spw_ioctl_send->options = 0;
734 spw_ioctl_send->options = 0;
588
735
589 // (2) BUILD THE HEADER
736 // (2) BUILD THE HEADER
590 header->packetLength[0] = (unsigned char) (length>>8);
737 header->packetLength[0] = (unsigned char) (length>>8);
591 header->packetLength[1] = (unsigned char) (length);
738 header->packetLength[1] = (unsigned char) (length);
592 header->sid = (unsigned char) sid; // SID
739 header->sid = (unsigned char) sid; // SID
593 header->pa_lfr_pkt_cnt_asm = 2;
740 header->pa_lfr_pkt_cnt_asm = 2;
594 header->pa_lfr_pkt_nr_asm = (unsigned char) (i+1);
741 header->pa_lfr_pkt_nr_asm = (unsigned char) (i+1);
595
742
596 // (3) SET PACKET TIME
743 // (3) SET PACKET TIME
597 header->time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
744 header->time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
598 header->time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
745 header->time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
599 header->time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
746 header->time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
600 header->time[3] = (unsigned char) (time_management_regs->coarse_time);
747 header->time[3] = (unsigned char) (time_management_regs->coarse_time);
601 header->time[4] = (unsigned char) (time_management_regs->fine_time>>8);
748 header->time[4] = (unsigned char) (time_management_regs->fine_time>>8);
602 header->time[5] = (unsigned char) (time_management_regs->fine_time);
749 header->time[5] = (unsigned char) (time_management_regs->fine_time);
603 //
750 //
604 header->acquisitionTime[0] = (unsigned char) (time_management_regs->coarse_time>>24);
751 header->acquisitionTime[0] = (unsigned char) (time_management_regs->coarse_time>>24);
605 header->acquisitionTime[1] = (unsigned char) (time_management_regs->coarse_time>>16);
752 header->acquisitionTime[1] = (unsigned char) (time_management_regs->coarse_time>>16);
606 header->acquisitionTime[2] = (unsigned char) (time_management_regs->coarse_time>>8);
753 header->acquisitionTime[2] = (unsigned char) (time_management_regs->coarse_time>>8);
607 header->acquisitionTime[3] = (unsigned char) (time_management_regs->coarse_time);
754 header->acquisitionTime[3] = (unsigned char) (time_management_regs->coarse_time);
608 header->acquisitionTime[4] = (unsigned char) (time_management_regs->fine_time>>8);
755 header->acquisitionTime[4] = (unsigned char) (time_management_regs->fine_time>>8);
609 header->acquisitionTime[5] = (unsigned char) (time_management_regs->fine_time);
756 header->acquisitionTime[5] = (unsigned char) (time_management_regs->fine_time);
610
757
611 // (4) SEND PACKET
758 // (4) SEND PACKET
612 status = rtems_message_queue_send( queue_id, spw_ioctl_send, ACTION_MSG_SPW_IOCTL_SEND_SIZE);
759 status = rtems_message_queue_send( queue_id, spw_ioctl_send, ACTION_MSG_SPW_IOCTL_SEND_SIZE);
613 if (status != RTEMS_SUCCESSFUL) {
760 if (status != RTEMS_SUCCESSFUL) {
614 printf("in ASM_send *** ERR %d\n", (int) status);
761 printf("in ASM_send *** ERR %d\n", (int) status);
615 }
762 }
616 }
763 }
617 }
764 }
618
765
619 void BP_send(char *data, rtems_id queue_id, unsigned int nbBytesToSend )
766 //*****************
620 {
767 // Basic Parameters
621 rtems_status_code status;
622
623 // SEND PACKET
624 status = rtems_message_queue_send( queue_id, data, nbBytesToSend);
625 if (status != RTEMS_SUCCESSFUL)
626 {
627 printf("ERR *** in BP_send *** ERR %d\n", (int) status);
628 }
629 }
630
631 void init_header_asm( Header_TM_LFR_SCIENCE_ASM_t *header)
632 {
633 header->targetLogicalAddress = CCSDS_DESTINATION_ID;
634 header->protocolIdentifier = CCSDS_PROTOCOLE_ID;
635 header->reserved = 0x00;
636 header->userApplication = CCSDS_USER_APP;
637 header->packetID[0] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST >> 8);
638 header->packetID[1] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST);
639 header->packetSequenceControl[0] = 0xc0;
640 header->packetSequenceControl[1] = 0x00;
641 header->packetLength[0] = 0x00;
642 header->packetLength[1] = 0x00;
643 // DATA FIELD HEADER
644 header->spare1_pusVersion_spare2 = 0x10;
645 header->serviceType = TM_TYPE_LFR_SCIENCE; // service type
646 header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
647 header->destinationID = TM_DESTINATION_ID_GROUND;
648 // AUXILIARY DATA HEADER
649 header->sid = 0x00;
650 header->biaStatusInfo = 0x00;
651 header->pa_lfr_pkt_cnt_asm = 0x00;
652 header->pa_lfr_pkt_nr_asm = 0x00;
653 header->time[0] = 0x00;
654 header->time[0] = 0x00;
655 header->time[0] = 0x00;
656 header->time[0] = 0x00;
657 header->time[0] = 0x00;
658 header->time[0] = 0x00;
659 header->pa_lfr_asm_blk_nr[0] = 0x00; // BLK_NR MSB
660 header->pa_lfr_asm_blk_nr[1] = 0x00; // BLK_NR LSB
661 }
662
663 void init_bp_ring_sbm1_bp1( void )
664 {
665 unsigned int i;
666
667 //********
668 // F0 RING
669 bp_ring_sbm1_bp1[0].next = (ring_node_bp*) &bp_ring_sbm1_bp1[1];
670 bp_ring_sbm1_bp1[0].previous = (ring_node_bp*) &bp_ring_sbm1_bp1[NB_RING_NODES_SBM1_BP1-1];
671
768
672 bp_ring_sbm1_bp1[NB_RING_NODES_SBM1_BP1-1].next = (ring_node_bp*) &bp_ring_sbm1_bp1[0];
769 void BP_init_header( Header_TM_LFR_SCIENCE_BP_t *header,
673 bp_ring_sbm1_bp1[NB_RING_NODES_SBM1_BP1-1].previous = (ring_node_bp*) &bp_ring_sbm1_bp1[NB_RING_NODES_SBM1_BP1-2];
674
675 for(i=1; i<NB_RING_NODES_SBM1_BP1-1; i++)
676 {
677 bp_ring_sbm1_bp1[i].next = (ring_node_bp*) &bp_ring_sbm1_bp1[i+1];
678 bp_ring_sbm1_bp1[i].previous = (ring_node_bp*) &bp_ring_sbm1_bp1[i-1];
679 }
680 //
681 //********
682
683 for (i=0; i<NB_RING_NODES_SBM1_BP1; i++)
684 {
685 init_header_bp( &bp_ring_sbm1_bp1[ i ].header,
686 APID_TM_SCIENCE_SBM1_SBM2, SID_SBM1_BP1_F0,
687 PACKET_LENGTH_TM_LFR_SCIENCE_SBM1_BP1_F0, NB_BINS_COMPRESSED_SM_SBM1_F0
688 );
689 bp_ring_sbm1_bp1[ i ].status = 0;
690 }
691 }
692
693 void init_bp_ring_sbm1_bp2( void )
694 {
695 unsigned int i;
696
697 //********
698 // F0 RING
699 bp_ring_sbm1_bp2[0].next = (ring_node_bp*) &bp_ring_sbm1_bp2[1];
700 bp_ring_sbm1_bp2[0].previous = (ring_node_bp*) &bp_ring_sbm1_bp2[NB_RING_NODES_SBM1_BP2-1];
701
702 bp_ring_sbm1_bp2[NB_RING_NODES_SBM1_BP2-1].next = (ring_node_bp*) &bp_ring_sbm1_bp2[0];
703 bp_ring_sbm1_bp2[NB_RING_NODES_SBM1_BP2-1].previous = (ring_node_bp*) &bp_ring_sbm1_bp2[NB_RING_NODES_SBM1_BP2-2];
704
705 for(i=1; i<NB_RING_NODES_SBM1_BP2-1; i++)
706 {
707 bp_ring_sbm1_bp2[i].next = (ring_node_bp*) &bp_ring_sbm1_bp2[i+1];
708 bp_ring_sbm1_bp2[i].previous = (ring_node_bp*) &bp_ring_sbm1_bp2[i-1];
709 }
710 //
711 //********
712
713 for (i=0; i<NB_RING_NODES_SBM1_BP2; i++)
714 {
715 init_header_bp( &bp_ring_sbm1_bp2[ i ].header,
716 APID_TM_SCIENCE_SBM1_SBM2, SID_SBM1_BP2_F0,
717 PACKET_LENGTH_TM_LFR_SCIENCE_SBM1_BP2_F0, NB_BINS_COMPRESSED_SM_SBM1_F0
718 );
719 bp_ring_sbm1_bp2[ i ].status = 0;
720 }
721 }
722
723 void init_header_bp( Header_TM_LFR_SCIENCE_BP_t *header,
724 unsigned int apid, unsigned char sid,
770 unsigned int apid, unsigned char sid,
725 unsigned int packetLength, unsigned char blkNr )
771 unsigned int packetLength, unsigned char blkNr )
726 {
772 {
727 header->targetLogicalAddress = CCSDS_DESTINATION_ID;
773 header->targetLogicalAddress = CCSDS_DESTINATION_ID;
728 header->protocolIdentifier = CCSDS_PROTOCOLE_ID;
774 header->protocolIdentifier = CCSDS_PROTOCOLE_ID;
729 header->reserved = 0x00;
775 header->reserved = 0x00;
730 header->userApplication = CCSDS_USER_APP;
776 header->userApplication = CCSDS_USER_APP;
731 header->packetID[0] = (unsigned char) (apid >> 8);
777 header->packetID[0] = (unsigned char) (apid >> 8);
732 header->packetID[1] = (unsigned char) (apid);
778 header->packetID[1] = (unsigned char) (apid);
733 header->packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
779 header->packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
734 header->packetSequenceControl[1] = 0x00;
780 header->packetSequenceControl[1] = 0x00;
735 header->packetLength[0] = (unsigned char) (packetLength >> 8);
781 header->packetLength[0] = (unsigned char) (packetLength >> 8);
736 header->packetLength[1] = (unsigned char) (packetLength);
782 header->packetLength[1] = (unsigned char) (packetLength);
737 // DATA FIELD HEADER
783 // DATA FIELD HEADER
738 header->spare1_pusVersion_spare2 = 0x10;
784 header->spare1_pusVersion_spare2 = 0x10;
739 header->serviceType = TM_TYPE_LFR_SCIENCE; // service type
785 header->serviceType = TM_TYPE_LFR_SCIENCE; // service type
740 header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
786 header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
741 header->destinationID = TM_DESTINATION_ID_GROUND;
787 header->destinationID = TM_DESTINATION_ID_GROUND;
742 // AUXILIARY DATA HEADER
788 // AUXILIARY DATA HEADER
743 header->sid = sid;
789 header->sid = sid;
744 header->biaStatusInfo = 0x00;
790 header->biaStatusInfo = 0x00;
745 header->time[0] = 0x00;
791 header->time[0] = 0x00;
746 header->time[0] = 0x00;
792 header->time[0] = 0x00;
747 header->time[0] = 0x00;
793 header->time[0] = 0x00;
748 header->time[0] = 0x00;
794 header->time[0] = 0x00;
749 header->time[0] = 0x00;
795 header->time[0] = 0x00;
750 header->time[0] = 0x00;
796 header->time[0] = 0x00;
751 header->pa_lfr_bp_blk_nr[0] = 0x00; // BLK_NR MSB
797 header->pa_lfr_bp_blk_nr[0] = 0x00; // BLK_NR MSB
752 header->pa_lfr_bp_blk_nr[1] = blkNr; // BLK_NR LSB
798 header->pa_lfr_bp_blk_nr[1] = blkNr; // BLK_NR LSB
753 }
799 }
754
800
755 void init_header_bp_with_spare(Header_TM_LFR_SCIENCE_BP_with_spare_t *header,
801 void BP_init_header_with_spare(Header_TM_LFR_SCIENCE_BP_with_spare_t *header,
756 unsigned int apid, unsigned char sid,
802 unsigned int apid, unsigned char sid,
757 unsigned int packetLength , unsigned char blkNr)
803 unsigned int packetLength , unsigned char blkNr)
758 {
804 {
759 header->targetLogicalAddress = CCSDS_DESTINATION_ID;
805 header->targetLogicalAddress = CCSDS_DESTINATION_ID;
760 header->protocolIdentifier = CCSDS_PROTOCOLE_ID;
806 header->protocolIdentifier = CCSDS_PROTOCOLE_ID;
761 header->reserved = 0x00;
807 header->reserved = 0x00;
762 header->userApplication = CCSDS_USER_APP;
808 header->userApplication = CCSDS_USER_APP;
763 header->packetID[0] = (unsigned char) (apid >> 8);
809 header->packetID[0] = (unsigned char) (apid >> 8);
764 header->packetID[1] = (unsigned char) (apid);
810 header->packetID[1] = (unsigned char) (apid);
765 header->packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
811 header->packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
766 header->packetSequenceControl[1] = 0x00;
812 header->packetSequenceControl[1] = 0x00;
767 header->packetLength[0] = (unsigned char) (packetLength >> 8);
813 header->packetLength[0] = (unsigned char) (packetLength >> 8);
768 header->packetLength[1] = (unsigned char) (packetLength);
814 header->packetLength[1] = (unsigned char) (packetLength);
769 // DATA FIELD HEADER
815 // DATA FIELD HEADER
770 header->spare1_pusVersion_spare2 = 0x10;
816 header->spare1_pusVersion_spare2 = 0x10;
771 header->serviceType = TM_TYPE_LFR_SCIENCE; // service type
817 header->serviceType = TM_TYPE_LFR_SCIENCE; // service type
772 header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
818 header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
773 header->destinationID = TM_DESTINATION_ID_GROUND;
819 header->destinationID = TM_DESTINATION_ID_GROUND;
774 // AUXILIARY DATA HEADER
820 // AUXILIARY DATA HEADER
775 header->sid = sid;
821 header->sid = sid;
776 header->biaStatusInfo = 0x00;
822 header->biaStatusInfo = 0x00;
777 header->time[0] = 0x00;
823 header->time[0] = 0x00;
778 header->time[0] = 0x00;
824 header->time[0] = 0x00;
779 header->time[0] = 0x00;
825 header->time[0] = 0x00;
780 header->time[0] = 0x00;
826 header->time[0] = 0x00;
781 header->time[0] = 0x00;
827 header->time[0] = 0x00;
782 header->time[0] = 0x00;
828 header->time[0] = 0x00;
783 header->pa_lfr_bp_blk_nr[0] = 0x00; // BLK_NR MSB
829 header->pa_lfr_bp_blk_nr[0] = 0x00; // BLK_NR MSB
784 header->pa_lfr_bp_blk_nr[1] = blkNr; // BLK_NR LSB
830 header->pa_lfr_bp_blk_nr[1] = blkNr; // BLK_NR LSB
785 }
831 }
786
832
833 void BP_send(char *data, rtems_id queue_id, unsigned int nbBytesToSend )
834 {
835 rtems_status_code status;
836
837 // SEND PACKET
838 status = rtems_message_queue_send( queue_id, data, nbBytesToSend);
839 if (status != RTEMS_SUCCESSFUL)
840 {
841 printf("ERR *** in BP_send *** ERR %d\n", (int) status);
842 }
843 }
844
845 //******************
846 // general functions
847
787 void reset_spectral_matrix_regs( void )
848 void reset_spectral_matrix_regs( void )
788 {
849 {
789 /** This function resets the spectral matrices module registers.
850 /** This function resets the spectral matrices module registers.
790 *
851 *
791 * The registers affected by this function are located at the following offset addresses:
852 * The registers affected by this function are located at the following offset addresses:
792 *
853 *
793 * - 0x00 config
854 * - 0x00 config
794 * - 0x04 status
855 * - 0x04 status
795 * - 0x08 matrixF0_Address0
856 * - 0x08 matrixF0_Address0
796 * - 0x10 matrixFO_Address1
857 * - 0x10 matrixFO_Address1
797 * - 0x14 matrixF1_Address
858 * - 0x14 matrixF1_Address
798 * - 0x18 matrixF2_Address
859 * - 0x18 matrixF2_Address
799 *
860 *
800 */
861 */
801
862
802 spectral_matrix_regs->config = 0x00;
863 spectral_matrix_regs->config = 0x00;
803 spectral_matrix_regs->status = 0x00;
864 spectral_matrix_regs->status = 0x00;
804
865
805 spectral_matrix_regs->matrixF0_Address0 = current_ring_node_sm_f0->buffer_address;
866 spectral_matrix_regs->matrixF0_Address0 = current_ring_node_sm_f0->buffer_address;
806 spectral_matrix_regs->matrixFO_Address1 = current_ring_node_sm_f0->buffer_address;
867 spectral_matrix_regs->matrixFO_Address1 = current_ring_node_sm_f0->buffer_address;
807 spectral_matrix_regs->matrixF1_Address = current_ring_node_sm_f1->buffer_address;
868 spectral_matrix_regs->matrixF1_Address = current_ring_node_sm_f1->buffer_address;
808 spectral_matrix_regs->matrixF2_Address = current_ring_node_sm_f2->buffer_address;
869 spectral_matrix_regs->matrixF2_Address = current_ring_node_sm_f2->buffer_address;
809 }
870 }
810
871
811 //******************
872 void set_time( unsigned char *time, unsigned char * timeInBuffer )
812 // general functions
813
814 void set_time( unsigned char *time, unsigned int coarseTime, unsigned int fineTime )
815 {
873 {
816 time[0] = (unsigned char) (coarseTime>>24);
874 // time[0] = timeInBuffer[2];
817 time[1] = (unsigned char) (coarseTime>>16);
875 // time[1] = timeInBuffer[3];
818 time[2] = (unsigned char) (coarseTime>>8);
876 // time[2] = timeInBuffer[0];
819 time[3] = (unsigned char) (coarseTime);
877 // time[3] = timeInBuffer[1];
820 time[4] = (unsigned char) (fineTime>>8);
878 // time[4] = timeInBuffer[6];
821 time[5] = (unsigned char) (fineTime);
879 // time[5] = timeInBuffer[7];
880
881 time[0] = timeInBuffer[0];
882 time[1] = timeInBuffer[1];
883 time[2] = timeInBuffer[2];
884 time[3] = timeInBuffer[3];
885 time[4] = timeInBuffer[6];
886 time[5] = timeInBuffer[7];
822 }
887 }
823
888
824
889
@@ -1,881 +1,886
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 );
71 close_action( &TC, result, queue_snd_id );
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 );
76 close_action( &TC, result, queue_snd_id );
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 );
81 close_action( &TC, result, queue_snd_id );
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 );
86 close_action( &TC, result, queue_snd_id );
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 );
91 close_action( &TC, result, queue_snd_id );
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 );
96 close_action( &TC, result, queue_snd_id );
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 );
101 close_action( &TC, result, queue_snd_id );
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 );
105 result = action_enter_mode( &TC, queue_snd_id );
106 close_action( &TC, result, queue_snd_id );
106 close_action( &TC, result, queue_snd_id );
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 );
111 close_action( &TC, result, queue_snd_id );
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 );
116 close_action( &TC, result, queue_snd_id );
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 );
121 close_action( &TC, result, queue_snd_id );
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 );
126 close_action( &TC, result, queue_snd_id );
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 )
152 int action_enter_mode(ccsdsTelecommandPacket_t *TC, rtems_id queue_id )
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 unsigned int *transitionCoarseTime_ptr;
163 unsigned int *transitionCoarseTime_ptr;
164 unsigned int transitionCoarseTime;
164 unsigned int transitionCoarseTime;
165 unsigned char * bytePosPtr;
165 unsigned char * bytePosPtr;
166
166
167 bytePosPtr = (unsigned char *) &TC->packetID;
167 bytePosPtr = (unsigned char *) &TC->packetID;
168
168
169 requestedMode = bytePosPtr[ BYTE_POS_CP_MODE_LFR_SET ];
169 requestedMode = bytePosPtr[ BYTE_POS_CP_MODE_LFR_SET ];
170 transitionCoarseTime_ptr = (unsigned int *) ( &bytePosPtr[ BYTE_POS_CP_LFR_ENTER_MODE_TIME ] );
170 transitionCoarseTime_ptr = (unsigned int *) ( &bytePosPtr[ BYTE_POS_CP_LFR_ENTER_MODE_TIME ] );
171 transitionCoarseTime = (*transitionCoarseTime_ptr) & 0x7fffffff;
171 transitionCoarseTime = (*transitionCoarseTime_ptr) & 0x7fffffff;
172
172
173 status = check_mode_value( requestedMode );
173 status = check_mode_value( requestedMode );
174
174
175 if ( status != LFR_SUCCESSFUL ) // the mode value is inconsistent
175 if ( status != LFR_SUCCESSFUL ) // the mode value is inconsistent
176 {
176 {
177 send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_CP_MODE_LFR_SET, requestedMode );
177 send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_CP_MODE_LFR_SET, requestedMode );
178 }
178 }
179 else // the mode value is consistent, check the transition
179 else // the mode value is consistent, check the transition
180 {
180 {
181 status = check_mode_transition(requestedMode);
181 status = check_mode_transition(requestedMode);
182 if (status != LFR_SUCCESSFUL)
182 if (status != LFR_SUCCESSFUL)
183 {
183 {
184 PRINTF("ERR *** in action_enter_mode *** check_mode_transition\n")
184 PRINTF("ERR *** in action_enter_mode *** check_mode_transition\n")
185 send_tm_lfr_tc_exe_not_executable( TC, queue_id );
185 send_tm_lfr_tc_exe_not_executable( TC, queue_id );
186 }
186 }
187 }
187 }
188
188
189 if ( status == LFR_SUCCESSFUL ) // the transition is valid, enter the mode
189 if ( status == LFR_SUCCESSFUL ) // the transition is valid, enter the mode
190 {
190 {
191 status = check_transition_date( transitionCoarseTime );
191 status = check_transition_date( transitionCoarseTime );
192 if (status != LFR_SUCCESSFUL)
192 if (status != LFR_SUCCESSFUL)
193 {
193 {
194 PRINTF("ERR *** in action_enter_mode *** check_transition_date\n")
194 PRINTF("ERR *** in action_enter_mode *** check_transition_date\n")
195 send_tm_lfr_tc_exe_inconsistent( TC, queue_id,
195 send_tm_lfr_tc_exe_inconsistent( TC, queue_id,
196 BYTE_POS_CP_LFR_ENTER_MODE_TIME,
196 BYTE_POS_CP_LFR_ENTER_MODE_TIME,
197 bytePosPtr[ BYTE_POS_CP_LFR_ENTER_MODE_TIME + 3 ] );
197 bytePosPtr[ BYTE_POS_CP_LFR_ENTER_MODE_TIME + 3 ] );
198 }
198 }
199 }
199 }
200
200
201 if ( status == LFR_SUCCESSFUL ) // the date is valid, enter the mode
201 if ( status == LFR_SUCCESSFUL ) // the date is valid, enter the mode
202 {
202 {
203 PRINTF1("OK *** in action_enter_mode *** enter mode %d\n", requestedMode);
203 PRINTF1("OK *** in action_enter_mode *** enter mode %d\n", requestedMode);
204 status = enter_mode( requestedMode, transitionCoarseTime );
204 status = enter_mode( requestedMode, transitionCoarseTime );
205 }
205 }
206
206
207 return status;
207 return status;
208 }
208 }
209
209
210 int action_update_info(ccsdsTelecommandPacket_t *TC, rtems_id queue_id)
210 int action_update_info(ccsdsTelecommandPacket_t *TC, rtems_id queue_id)
211 {
211 {
212 /** This function executes specific actions when a TC_LFR_UPDATE_INFO TeleCommand has been received.
212 /** This function executes specific actions when a TC_LFR_UPDATE_INFO TeleCommand has been received.
213 *
213 *
214 * @param TC points to the TeleCommand packet that is being processed
214 * @param TC points to the TeleCommand packet that is being processed
215 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
215 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
216 *
216 *
217 * @return LFR directive status code:
217 * @return LFR directive status code:
218 * - LFR_DEFAULT
218 * - LFR_DEFAULT
219 * - LFR_SUCCESSFUL
219 * - LFR_SUCCESSFUL
220 *
220 *
221 */
221 */
222
222
223 unsigned int val;
223 unsigned int val;
224 int result;
224 int result;
225 unsigned int status;
225 unsigned int status;
226 unsigned char mode;
226 unsigned char mode;
227 unsigned char * bytePosPtr;
227 unsigned char * bytePosPtr;
228
228
229 bytePosPtr = (unsigned char *) &TC->packetID;
229 bytePosPtr = (unsigned char *) &TC->packetID;
230
230
231 // check LFR mode
231 // check LFR mode
232 mode = (bytePosPtr[ BYTE_POS_UPDATE_INFO_PARAMETERS_SET5 ] & 0x1e) >> 1;
232 mode = (bytePosPtr[ BYTE_POS_UPDATE_INFO_PARAMETERS_SET5 ] & 0x1e) >> 1;
233 status = check_update_info_hk_lfr_mode( mode );
233 status = check_update_info_hk_lfr_mode( mode );
234 if (status == LFR_SUCCESSFUL) // check TDS mode
234 if (status == LFR_SUCCESSFUL) // check TDS mode
235 {
235 {
236 mode = (bytePosPtr[ BYTE_POS_UPDATE_INFO_PARAMETERS_SET6 ] & 0xf0) >> 4;
236 mode = (bytePosPtr[ BYTE_POS_UPDATE_INFO_PARAMETERS_SET6 ] & 0xf0) >> 4;
237 status = check_update_info_hk_tds_mode( mode );
237 status = check_update_info_hk_tds_mode( mode );
238 }
238 }
239 if (status == LFR_SUCCESSFUL) // check THR mode
239 if (status == LFR_SUCCESSFUL) // check THR mode
240 {
240 {
241 mode = (bytePosPtr[ BYTE_POS_UPDATE_INFO_PARAMETERS_SET6 ] & 0x0f);
241 mode = (bytePosPtr[ BYTE_POS_UPDATE_INFO_PARAMETERS_SET6 ] & 0x0f);
242 status = check_update_info_hk_thr_mode( mode );
242 status = check_update_info_hk_thr_mode( mode );
243 }
243 }
244 if (status == LFR_SUCCESSFUL) // if the parameter check is successful
244 if (status == LFR_SUCCESSFUL) // if the parameter check is successful
245 {
245 {
246 val = housekeeping_packet.hk_lfr_update_info_tc_cnt[0] * 256
246 val = housekeeping_packet.hk_lfr_update_info_tc_cnt[0] * 256
247 + housekeeping_packet.hk_lfr_update_info_tc_cnt[1];
247 + housekeeping_packet.hk_lfr_update_info_tc_cnt[1];
248 val++;
248 val++;
249 housekeeping_packet.hk_lfr_update_info_tc_cnt[0] = (unsigned char) (val >> 8);
249 housekeeping_packet.hk_lfr_update_info_tc_cnt[0] = (unsigned char) (val >> 8);
250 housekeeping_packet.hk_lfr_update_info_tc_cnt[1] = (unsigned char) (val);
250 housekeeping_packet.hk_lfr_update_info_tc_cnt[1] = (unsigned char) (val);
251 }
251 }
252
252
253 result = status;
253 result = status;
254
254
255 return result;
255 return result;
256 }
256 }
257
257
258 int action_enable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
258 int action_enable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
259 {
259 {
260 /** This function executes specific actions when a TC_LFR_ENABLE_CALIBRATION TeleCommand has been received.
260 /** This function executes specific actions when a TC_LFR_ENABLE_CALIBRATION TeleCommand has been received.
261 *
261 *
262 * @param TC points to the TeleCommand packet that is being processed
262 * @param TC points to the TeleCommand packet that is being processed
263 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
263 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
264 *
264 *
265 */
265 */
266
266
267 int result;
267 int result;
268 unsigned char lfrMode;
268 unsigned char lfrMode;
269
269
270 result = LFR_DEFAULT;
270 result = LFR_DEFAULT;
271 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
271 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
272
272
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_disable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
279 int action_disable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
280 {
280 {
281 /** This function executes specific actions when a TC_LFR_DISABLE_CALIBRATION TeleCommand has been received.
281 /** This function executes specific actions when a TC_LFR_DISABLE_CALIBRATION 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 */
286 */
287
287
288 int result;
288 int result;
289 unsigned char lfrMode;
289 unsigned char lfrMode;
290
290
291 result = LFR_DEFAULT;
291 result = LFR_DEFAULT;
292 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
292 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
293
293
294 send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time );
294 send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time );
295 result = LFR_DEFAULT;
295 result = LFR_DEFAULT;
296
296
297 return result;
297 return result;
298 }
298 }
299
299
300 int action_update_time(ccsdsTelecommandPacket_t *TC)
300 int action_update_time(ccsdsTelecommandPacket_t *TC)
301 {
301 {
302 /** This function executes specific actions when a TC_LFR_UPDATE_TIME TeleCommand has been received.
302 /** This function executes specific actions when a TC_LFR_UPDATE_TIME TeleCommand has been received.
303 *
303 *
304 * @param TC points to the TeleCommand packet that is being processed
304 * @param TC points to the TeleCommand packet that is being processed
305 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
305 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
306 *
306 *
307 * @return LFR_SUCCESSFUL
307 * @return LFR_SUCCESSFUL
308 *
308 *
309 */
309 */
310
310
311 unsigned int val;
311 unsigned int val;
312
312
313 time_management_regs->coarse_time_load = (TC->dataAndCRC[0] << 24)
313 time_management_regs->coarse_time_load = (TC->dataAndCRC[0] << 24)
314 + (TC->dataAndCRC[1] << 16)
314 + (TC->dataAndCRC[1] << 16)
315 + (TC->dataAndCRC[2] << 8)
315 + (TC->dataAndCRC[2] << 8)
316 + TC->dataAndCRC[3];
316 + TC->dataAndCRC[3];
317
317
318 PRINTF1("time received: %x\n", time_management_regs->coarse_time_load)
318 PRINTF1("time received: %x\n", time_management_regs->coarse_time_load)
319
319
320 val = housekeeping_packet.hk_lfr_update_time_tc_cnt[0] * 256
320 val = housekeeping_packet.hk_lfr_update_time_tc_cnt[0] * 256
321 + housekeeping_packet.hk_lfr_update_time_tc_cnt[1];
321 + housekeeping_packet.hk_lfr_update_time_tc_cnt[1];
322 val++;
322 val++;
323 housekeeping_packet.hk_lfr_update_time_tc_cnt[0] = (unsigned char) (val >> 8);
323 housekeeping_packet.hk_lfr_update_time_tc_cnt[0] = (unsigned char) (val >> 8);
324 housekeeping_packet.hk_lfr_update_time_tc_cnt[1] = (unsigned char) (val);
324 housekeeping_packet.hk_lfr_update_time_tc_cnt[1] = (unsigned char) (val);
325 // time_management_regs->ctrl = time_management_regs->ctrl | 1; // force tick
325 // time_management_regs->ctrl = time_management_regs->ctrl | 1; // force tick
326
326
327 return LFR_SUCCESSFUL;
327 return LFR_SUCCESSFUL;
328 }
328 }
329
329
330 //*******************
330 //*******************
331 // ENTERING THE MODES
331 // ENTERING THE MODES
332 int check_mode_value( unsigned char requestedMode )
332 int check_mode_value( unsigned char requestedMode )
333 {
333 {
334 int status;
334 int status;
335
335
336 if ( (requestedMode != LFR_MODE_STANDBY)
336 if ( (requestedMode != LFR_MODE_STANDBY)
337 && (requestedMode != LFR_MODE_NORMAL) && (requestedMode != LFR_MODE_BURST)
337 && (requestedMode != LFR_MODE_NORMAL) && (requestedMode != LFR_MODE_BURST)
338 && (requestedMode != LFR_MODE_SBM1) && (requestedMode != LFR_MODE_SBM2) )
338 && (requestedMode != LFR_MODE_SBM1) && (requestedMode != LFR_MODE_SBM2) )
339 {
339 {
340 status = LFR_DEFAULT;
340 status = LFR_DEFAULT;
341 }
341 }
342 else
342 else
343 {
343 {
344 status = LFR_SUCCESSFUL;
344 status = LFR_SUCCESSFUL;
345 }
345 }
346
346
347 return status;
347 return status;
348 }
348 }
349
349
350 int check_mode_transition( unsigned char requestedMode )
350 int check_mode_transition( unsigned char requestedMode )
351 {
351 {
352 /** This function checks the validity of the transition requested by the TC_LFR_ENTER_MODE.
352 /** This function checks the validity of the transition requested by the TC_LFR_ENTER_MODE.
353 *
353 *
354 * @param requestedMode is the mode requested by the TC_LFR_ENTER_MODE
354 * @param requestedMode is the mode requested by the TC_LFR_ENTER_MODE
355 *
355 *
356 * @return LFR directive status codes:
356 * @return LFR directive status codes:
357 * - LFR_SUCCESSFUL - the transition is authorized
357 * - LFR_SUCCESSFUL - the transition is authorized
358 * - LFR_DEFAULT - the transition is not authorized
358 * - LFR_DEFAULT - the transition is not authorized
359 *
359 *
360 */
360 */
361
361
362 int status;
362 int status;
363
363
364 switch (requestedMode)
364 switch (requestedMode)
365 {
365 {
366 case LFR_MODE_STANDBY:
366 case LFR_MODE_STANDBY:
367 if ( lfrCurrentMode == LFR_MODE_STANDBY ) {
367 if ( lfrCurrentMode == LFR_MODE_STANDBY ) {
368 status = LFR_DEFAULT;
368 status = LFR_DEFAULT;
369 }
369 }
370 else
370 else
371 {
371 {
372 status = LFR_SUCCESSFUL;
372 status = LFR_SUCCESSFUL;
373 }
373 }
374 break;
374 break;
375 case LFR_MODE_NORMAL:
375 case LFR_MODE_NORMAL:
376 if ( lfrCurrentMode == LFR_MODE_NORMAL ) {
376 if ( lfrCurrentMode == LFR_MODE_NORMAL ) {
377 status = LFR_DEFAULT;
377 status = LFR_DEFAULT;
378 }
378 }
379 else {
379 else {
380 status = LFR_SUCCESSFUL;
380 status = LFR_SUCCESSFUL;
381 }
381 }
382 break;
382 break;
383 case LFR_MODE_BURST:
383 case LFR_MODE_BURST:
384 if ( lfrCurrentMode == LFR_MODE_BURST ) {
384 if ( lfrCurrentMode == LFR_MODE_BURST ) {
385 status = LFR_DEFAULT;
385 status = LFR_DEFAULT;
386 }
386 }
387 else {
387 else {
388 status = LFR_SUCCESSFUL;
388 status = LFR_SUCCESSFUL;
389 }
389 }
390 break;
390 break;
391 case LFR_MODE_SBM1:
391 case LFR_MODE_SBM1:
392 if ( lfrCurrentMode == LFR_MODE_SBM1 ) {
392 if ( lfrCurrentMode == LFR_MODE_SBM1 ) {
393 status = LFR_DEFAULT;
393 status = LFR_DEFAULT;
394 }
394 }
395 else {
395 else {
396 status = LFR_SUCCESSFUL;
396 status = LFR_SUCCESSFUL;
397 }
397 }
398 break;
398 break;
399 case LFR_MODE_SBM2:
399 case LFR_MODE_SBM2:
400 if ( lfrCurrentMode == LFR_MODE_SBM2 ) {
400 if ( lfrCurrentMode == LFR_MODE_SBM2 ) {
401 status = LFR_DEFAULT;
401 status = LFR_DEFAULT;
402 }
402 }
403 else {
403 else {
404 status = LFR_SUCCESSFUL;
404 status = LFR_SUCCESSFUL;
405 }
405 }
406 break;
406 break;
407 default:
407 default:
408 status = LFR_DEFAULT;
408 status = LFR_DEFAULT;
409 break;
409 break;
410 }
410 }
411
411
412 return status;
412 return status;
413 }
413 }
414
414
415 int check_transition_date( unsigned int transitionCoarseTime )
415 int check_transition_date( unsigned int transitionCoarseTime )
416 {
416 {
417 int status;
417 int status;
418 unsigned int localCoarseTime;
418 unsigned int localCoarseTime;
419 unsigned int deltaCoarseTime;
419 unsigned int deltaCoarseTime;
420
420
421 status = LFR_SUCCESSFUL;
421 status = LFR_SUCCESSFUL;
422
422
423 if (transitionCoarseTime == 0) // transition time = 0 means an instant transition
423 if (transitionCoarseTime == 0) // transition time = 0 means an instant transition
424 {
424 {
425 status = LFR_SUCCESSFUL;
425 status = LFR_SUCCESSFUL;
426 }
426 }
427 else
427 else
428 {
428 {
429 localCoarseTime = time_management_regs->coarse_time & 0x7fffffff;
429 localCoarseTime = time_management_regs->coarse_time & 0x7fffffff;
430
430
431 if ( transitionCoarseTime <= localCoarseTime ) // SSS-CP-EQS-322
431 if ( transitionCoarseTime <= localCoarseTime ) // SSS-CP-EQS-322
432 {
432 {
433 status = LFR_DEFAULT;
433 status = LFR_DEFAULT;
434 PRINTF2("ERR *** in check_transition_date *** transition = %x, local = %x\n", transitionCoarseTime, localCoarseTime)
434 PRINTF2("ERR *** in check_transition_date *** transition = %x, local = %x\n", transitionCoarseTime, localCoarseTime)
435 }
435 }
436
436
437 if (status == LFR_SUCCESSFUL)
437 if (status == LFR_SUCCESSFUL)
438 {
438 {
439 deltaCoarseTime = transitionCoarseTime - localCoarseTime;
439 deltaCoarseTime = transitionCoarseTime - localCoarseTime;
440 if ( deltaCoarseTime > 3 ) // SSS-CP-EQS-323
440 if ( deltaCoarseTime > 3 ) // SSS-CP-EQS-323
441 {
441 {
442 status = LFR_DEFAULT;
442 status = LFR_DEFAULT;
443 PRINTF1("ERR *** in check_transition_date *** deltaCoarseTime = %x\n", deltaCoarseTime)
443 PRINTF1("ERR *** in check_transition_date *** deltaCoarseTime = %x\n", deltaCoarseTime)
444 }
444 }
445 }
445 }
446 }
446 }
447
447
448 return status;
448 return status;
449 }
449 }
450
450
451 int stop_current_mode( void )
451 int stop_current_mode( void )
452 {
452 {
453 /** This function stops the current mode by masking interrupt lines and suspending science tasks.
453 /** This function stops the current mode by masking interrupt lines and suspending science tasks.
454 *
454 *
455 * @return RTEMS directive status codes:
455 * @return RTEMS directive status codes:
456 * - RTEMS_SUCCESSFUL - task restarted successfully
456 * - RTEMS_SUCCESSFUL - task restarted successfully
457 * - RTEMS_INVALID_ID - task id invalid
457 * - RTEMS_INVALID_ID - task id invalid
458 * - RTEMS_ALREADY_SUSPENDED - task already suspended
458 * - RTEMS_ALREADY_SUSPENDED - task already suspended
459 *
459 *
460 */
460 */
461
461
462 rtems_status_code status;
462 rtems_status_code status;
463
463
464 status = RTEMS_SUCCESSFUL;
464 status = RTEMS_SUCCESSFUL;
465
465
466 // (1) mask interruptions
466 // (1) mask interruptions
467 LEON_Mask_interrupt( IRQ_WAVEFORM_PICKER ); // mask waveform picker interrupt
467 LEON_Mask_interrupt( IRQ_WAVEFORM_PICKER ); // mask waveform picker interrupt
468 LEON_Mask_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt
468 LEON_Mask_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt
469
469
470 // (2) clear interruptions
470 // (2) clear interruptions
471 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); // clear waveform picker interrupt
471 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); // clear waveform picker interrupt
472 LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt
472 LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt
473
473
474 // (3) reset waveform picker registers
474 // (3) reset waveform picker registers
475 reset_wfp_burst_enable(); // reset burst and enable bits
475 reset_wfp_burst_enable(); // reset burst and enable bits
476 reset_wfp_status(); // reset all the status bits
476 reset_wfp_status(); // reset all the status bits
477
477
478 // (4) reset spectral matrices registers
478 // (4) reset spectral matrices registers
479 set_irq_on_new_ready_matrix( 0 ); // stop the spectral matrices
479 set_irq_on_new_ready_matrix( 0 ); // stop the spectral matrices
480 set_run_matrix_spectral( 0 ); // run_matrix_spectral is set to 0
480 set_run_matrix_spectral( 0 ); // run_matrix_spectral is set to 0
481 reset_extractSWF(); // reset the extractSWF flag to false
481 reset_extractSWF(); // reset the extractSWF flag to false
482
482
483 // <Spectral Matrices simulator>
483 // <Spectral Matrices simulator>
484 LEON_Mask_interrupt( IRQ_SM_SIMULATOR ); // mask spectral matrix interrupt simulator
484 LEON_Mask_interrupt( IRQ_SM_SIMULATOR ); // mask spectral matrix interrupt simulator
485 timer_stop( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR );
485 timer_stop( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR );
486 LEON_Clear_interrupt( IRQ_SM_SIMULATOR ); // clear spectral matrix interrupt simulator
486 LEON_Clear_interrupt( IRQ_SM_SIMULATOR ); // clear spectral matrix interrupt simulator
487 // </Spectral Matrices simulator>
487 // </Spectral Matrices simulator>
488
488
489 // suspend several tasks
489 // suspend several tasks
490 if (lfrCurrentMode != LFR_MODE_STANDBY) {
490 if (lfrCurrentMode != LFR_MODE_STANDBY) {
491 status = suspend_science_tasks();
491 status = suspend_science_tasks();
492 }
492 }
493
493
494 if (status != RTEMS_SUCCESSFUL)
494 if (status != RTEMS_SUCCESSFUL)
495 {
495 {
496 PRINTF1("in stop_current_mode *** in suspend_science_tasks *** ERR code: %d\n", status)
496 PRINTF1("in stop_current_mode *** in suspend_science_tasks *** ERR code: %d\n", status)
497 }
497 }
498
498
499 return status;
499 return status;
500 }
500 }
501
501
502 int enter_mode( unsigned char mode, unsigned int transitionCoarseTime )
502 int enter_mode( unsigned char mode, unsigned int transitionCoarseTime )
503 {
503 {
504 /** This function is launched after a mode transition validation.
504 /** This function is launched after a mode transition validation.
505 *
505 *
506 * @param mode is the mode in which LFR will be put.
506 * @param mode is the mode in which LFR will be put.
507 *
507 *
508 * @return RTEMS directive status codes:
508 * @return RTEMS directive status codes:
509 * - RTEMS_SUCCESSFUL - the mode has been entered successfully
509 * - RTEMS_SUCCESSFUL - the mode has been entered successfully
510 * - RTEMS_NOT_SATISFIED - the mode has not been entered successfully
510 * - RTEMS_NOT_SATISFIED - the mode has not been entered successfully
511 *
511 *
512 */
512 */
513
513
514 rtems_status_code status;
514 rtems_status_code status;
515
515
516 //**********************
516 //**********************
517 // STOP THE CURRENT MODE
517 // STOP THE CURRENT MODE
518 status = stop_current_mode();
518 status = stop_current_mode();
519 if (status != RTEMS_SUCCESSFUL)
519 if (status != RTEMS_SUCCESSFUL)
520 {
520 {
521 PRINTF1("ERR *** in enter_mode *** stop_current_mode with mode = %d\n", mode)
521 PRINTF1("ERR *** in enter_mode *** stop_current_mode with mode = %d\n", mode)
522 }
522 }
523
523
524 //*************************
524 //*************************
525 // ENTER THE REQUESTED MODE
525 // ENTER THE REQUESTED MODE
526 if ( (mode == LFR_MODE_NORMAL) || (mode == LFR_MODE_BURST)
526 if ( (mode == LFR_MODE_NORMAL) || (mode == LFR_MODE_BURST)
527 || (mode == LFR_MODE_SBM1) || (mode == LFR_MODE_SBM2) )
527 || (mode == LFR_MODE_SBM1) || (mode == LFR_MODE_SBM2) )
528 {
528 {
529 #ifdef PRINT_TASK_STATISTICS
529 #ifdef PRINT_TASK_STATISTICS
530 rtems_cpu_usage_reset();
530 rtems_cpu_usage_reset();
531 maxCount = 0;
531 maxCount = 0;
532 #endif
532 #endif
533 status = restart_science_tasks();
533 status = restart_science_tasks( mode );
534 launch_waveform_picker( mode, transitionCoarseTime );
534 launch_waveform_picker( mode, transitionCoarseTime );
535 launch_spectral_matrix_simu( mode );
535 launch_spectral_matrix_simu( mode );
536 }
536 }
537 else if ( mode == LFR_MODE_STANDBY )
537 else if ( mode == LFR_MODE_STANDBY )
538 {
538 {
539 #ifdef PRINT_TASK_STATISTICS
539 #ifdef PRINT_TASK_STATISTICS
540 rtems_cpu_usage_report();
540 rtems_cpu_usage_report();
541 #endif
541 #endif
542
542
543 #ifdef PRINT_STACK_REPORT
543 #ifdef PRINT_STACK_REPORT
544 rtems_stack_checker_report_usage();
544 rtems_stack_checker_report_usage();
545 #endif
545 #endif
546 PRINTF1("maxCount = %d\n", maxCount)
546 PRINTF1("maxCount = %d\n", maxCount)
547 }
547 }
548 else
548 else
549 {
549 {
550 status = RTEMS_UNSATISFIED;
550 status = RTEMS_UNSATISFIED;
551 }
551 }
552
552
553 if (status != RTEMS_SUCCESSFUL)
553 if (status != RTEMS_SUCCESSFUL)
554 {
554 {
555 PRINTF1("ERR *** in enter_mode *** status = %d\n", status)
555 PRINTF1("ERR *** in enter_mode *** status = %d\n", status)
556 status = RTEMS_UNSATISFIED;
556 status = RTEMS_UNSATISFIED;
557 }
557 }
558
558
559 return status;
559 return status;
560 }
560 }
561
561
562 int restart_science_tasks()
562 int restart_science_tasks(unsigned char lfrRequestedMode )
563 {
563 {
564 /** This function is used to restart all science tasks.
564 /** This function is used to restart all science tasks.
565 *
565 *
566 * @return RTEMS directive status codes:
566 * @return RTEMS directive status codes:
567 * - RTEMS_SUCCESSFUL - task restarted successfully
567 * - RTEMS_SUCCESSFUL - task restarted successfully
568 * - RTEMS_INVALID_ID - task id invalid
568 * - RTEMS_INVALID_ID - task id invalid
569 * - RTEMS_INCORRECT_STATE - task never started
569 * - RTEMS_INCORRECT_STATE - task never started
570 * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task
570 * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task
571 *
571 *
572 * Science tasks are AVF0, BPF0, WFRM, CWF3, CW2, CWF1
572 * Science tasks are AVF0, BPF0, WFRM, CWF3, CW2, CWF1
573 *
573 *
574 */
574 */
575
575
576 rtems_status_code status[6];
576 rtems_status_code status[7];
577 rtems_status_code ret;
577 rtems_status_code ret;
578
578
579 ret = RTEMS_SUCCESSFUL;
579 ret = RTEMS_SUCCESSFUL;
580
580
581 status[0] = rtems_task_restart( Task_id[TASKID_AVF0], 1 );
581 status[0] = rtems_task_restart( Task_id[TASKID_AVF0], lfrRequestedMode );
582 if (status[0] != RTEMS_SUCCESSFUL)
582 if (status[0] != RTEMS_SUCCESSFUL)
583 {
583 {
584 PRINTF1("in restart_science_task *** 0 ERR %d\n", status[0])
584 PRINTF1("in restart_science_task *** 0 ERR %d\n", status[0])
585 }
585 }
586
586
587 status[2] = rtems_task_restart( Task_id[TASKID_WFRM],1 );
587 status[2] = rtems_task_restart( Task_id[TASKID_WFRM],1 );
588 if (status[2] != RTEMS_SUCCESSFUL)
588 if (status[2] != RTEMS_SUCCESSFUL)
589 {
589 {
590 PRINTF1("in restart_science_task *** 2 ERR %d\n", status[2])
590 PRINTF1("in restart_science_task *** 2 ERR %d\n", status[2])
591 }
591 }
592
592
593 status[3] = rtems_task_restart( Task_id[TASKID_CWF3],1 );
593 status[3] = rtems_task_restart( Task_id[TASKID_CWF3],1 );
594 if (status[3] != RTEMS_SUCCESSFUL)
594 if (status[3] != RTEMS_SUCCESSFUL)
595 {
595 {
596 PRINTF1("in restart_science_task *** 3 ERR %d\n", status[3])
596 PRINTF1("in restart_science_task *** 3 ERR %d\n", status[3])
597 }
597 }
598
598
599 status[4] = rtems_task_restart( Task_id[TASKID_CWF2],1 );
599 status[4] = rtems_task_restart( Task_id[TASKID_CWF2],1 );
600 if (status[4] != RTEMS_SUCCESSFUL)
600 if (status[4] != RTEMS_SUCCESSFUL)
601 {
601 {
602 PRINTF1("in restart_science_task *** 4 ERR %d\n", status[4])
602 PRINTF1("in restart_science_task *** 4 ERR %d\n", status[4])
603 }
603 }
604
604
605 status[5] = rtems_task_restart( Task_id[TASKID_CWF1],1 );
605 status[5] = rtems_task_restart( Task_id[TASKID_CWF1],1 );
606 if (status[5] != RTEMS_SUCCESSFUL)
606 if (status[5] != RTEMS_SUCCESSFUL)
607 {
607 {
608 PRINTF1("in restart_science_task *** 5 ERR %d\n", status[5])
608 PRINTF1("in restart_science_task *** 5 ERR %d\n", status[5])
609 }
609 }
610
610
611 status[6] = rtems_task_restart( Task_id[TASKID_MATR], lfrRequestedMode );
612 if (status[6] != RTEMS_SUCCESSFUL)
613 {
614 PRINTF1("in restart_science_task *** 6 ERR %d\n", status[6])
615 }
616
611 if ( (status[0] != RTEMS_SUCCESSFUL) || (status[2] != RTEMS_SUCCESSFUL) ||
617 if ( (status[0] != RTEMS_SUCCESSFUL) || (status[2] != RTEMS_SUCCESSFUL) ||
612 (status[3] != RTEMS_SUCCESSFUL) || (status[4] != RTEMS_SUCCESSFUL) || (status[5] != RTEMS_SUCCESSFUL) )
618 (status[3] != RTEMS_SUCCESSFUL) || (status[4] != RTEMS_SUCCESSFUL) ||
619 (status[5] != RTEMS_SUCCESSFUL) || (status[6] != RTEMS_SUCCESSFUL) )
613 {
620 {
614 ret = RTEMS_UNSATISFIED;
621 ret = RTEMS_UNSATISFIED;
615 }
622 }
616
623
617 return ret;
624 return ret;
618 }
625 }
619
626
620 int suspend_science_tasks()
627 int suspend_science_tasks()
621 {
628 {
622 /** This function suspends the science tasks.
629 /** This function suspends the science tasks.
623 *
630 *
624 * @return RTEMS directive status codes:
631 * @return RTEMS directive status codes:
625 * - RTEMS_SUCCESSFUL - task restarted successfully
632 * - RTEMS_SUCCESSFUL - task restarted successfully
626 * - RTEMS_INVALID_ID - task id invalid
633 * - RTEMS_INVALID_ID - task id invalid
627 * - RTEMS_ALREADY_SUSPENDED - task already suspended
634 * - RTEMS_ALREADY_SUSPENDED - task already suspended
628 *
635 *
629 */
636 */
630
637
631 rtems_status_code status;
638 rtems_status_code status;
632
639
633 status = rtems_task_suspend( Task_id[TASKID_AVF0] );
640 status = rtems_task_suspend( Task_id[TASKID_AVF0] );
634 if (status != RTEMS_SUCCESSFUL)
641 if (status != RTEMS_SUCCESSFUL)
635 {
642 {
636 PRINTF1("in suspend_science_task *** AVF0 ERR %d\n", status)
643 PRINTF1("in suspend_science_task *** AVF0 ERR %d\n", status)
637 }
644 }
638
645
639 if (status == RTEMS_SUCCESSFUL) // suspend WFRM
646 if (status == RTEMS_SUCCESSFUL) // suspend WFRM
640 {
647 {
641 status = rtems_task_suspend( Task_id[TASKID_WFRM] );
648 status = rtems_task_suspend( Task_id[TASKID_WFRM] );
642 if (status != RTEMS_SUCCESSFUL)
649 if (status != RTEMS_SUCCESSFUL)
643 {
650 {
644 PRINTF1("in suspend_science_task *** WFRM ERR %d\n", status)
651 PRINTF1("in suspend_science_task *** WFRM ERR %d\n", status)
645 }
652 }
646 }
653 }
647
654
648 if (status == RTEMS_SUCCESSFUL) // suspend CWF3
655 if (status == RTEMS_SUCCESSFUL) // suspend CWF3
649 {
656 {
650 status = rtems_task_suspend( Task_id[TASKID_CWF3] );
657 status = rtems_task_suspend( Task_id[TASKID_CWF3] );
651 if (status != RTEMS_SUCCESSFUL)
658 if (status != RTEMS_SUCCESSFUL)
652 {
659 {
653 PRINTF1("in suspend_science_task *** CWF3 ERR %d\n", status)
660 PRINTF1("in suspend_science_task *** CWF3 ERR %d\n", status)
654 }
661 }
655 }
662 }
656
663
657 if (status == RTEMS_SUCCESSFUL) // suspend CWF2
664 if (status == RTEMS_SUCCESSFUL) // suspend CWF2
658 {
665 {
659 status = rtems_task_suspend( Task_id[TASKID_CWF2] );
666 status = rtems_task_suspend( Task_id[TASKID_CWF2] );
660 if (status != RTEMS_SUCCESSFUL)
667 if (status != RTEMS_SUCCESSFUL)
661 {
668 {
662 PRINTF1("in suspend_science_task *** CWF2 ERR %d\n", status)
669 PRINTF1("in suspend_science_task *** CWF2 ERR %d\n", status)
663 }
670 }
664 }
671 }
665
672
666 if (status == RTEMS_SUCCESSFUL) // suspend CWF1
673 if (status == RTEMS_SUCCESSFUL) // suspend CWF1
667 {
674 {
668 status = rtems_task_suspend( Task_id[TASKID_CWF1] );
675 status = rtems_task_suspend( Task_id[TASKID_CWF1] );
669 if (status != RTEMS_SUCCESSFUL)
676 if (status != RTEMS_SUCCESSFUL)
670 {
677 {
671 PRINTF1("in suspend_science_task *** CWF1 ERR %d\n", status)
678 PRINTF1("in suspend_science_task *** CWF1 ERR %d\n", status)
672 }
679 }
673 }
680 }
674
681
675 return status;
682 return status;
676 }
683 }
677
684
678 void launch_waveform_picker( unsigned char mode, unsigned int transitionCoarseTime )
685 void launch_waveform_picker( unsigned char mode, unsigned int transitionCoarseTime )
679 {
686 {
680 reset_current_ring_nodes();
687 reset_current_ring_nodes();
681 reset_waveform_picker_regs();
688 reset_waveform_picker_regs();
682 set_wfp_burst_enable_register( mode );
689 set_wfp_burst_enable_register( mode );
683
690
684 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER );
691 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER );
685 LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER );
692 LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER );
686
693
687 waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x80; // [1000 0000]
694 waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x80; // [1000 0000]
688 if (transitionCoarseTime == 0)
695 if (transitionCoarseTime == 0)
689 {
696 {
690 waveform_picker_regs->start_date = time_management_regs->coarse_time;
697 waveform_picker_regs->start_date = time_management_regs->coarse_time;
691 }
698 }
692 else
699 else
693 {
700 {
694 waveform_picker_regs->start_date = transitionCoarseTime;
701 waveform_picker_regs->start_date = transitionCoarseTime;
695 }
702 }
696 }
703 }
697
704
698 void launch_spectral_matrix( unsigned char mode )
705 void launch_spectral_matrix( unsigned char mode )
699 {
706 {
700 reset_nb_sm_f0();
707 SM_reset_current_ring_nodes();
701 reset_current_sm_ring_nodes();
708 ASM_reset_current_ring_node();
702 reset_current_bp_ring_nodes();
703 reset_spectral_matrix_regs();
709 reset_spectral_matrix_regs();
704
710
705 struct grgpio_regs_str *grgpio_regs = (struct grgpio_regs_str *) REGS_ADDR_GRGPIO;
711 struct grgpio_regs_str *grgpio_regs = (struct grgpio_regs_str *) REGS_ADDR_GRGPIO;
706 grgpio_regs->io_port_direction_register =
712 grgpio_regs->io_port_direction_register =
707 grgpio_regs->io_port_direction_register | 0x01; // [0001 1000], 0 = output disabled, 1 = output enabled
713 grgpio_regs->io_port_direction_register | 0x01; // [0001 1000], 0 = output disabled, 1 = output enabled
708 grgpio_regs->io_port_output_register = grgpio_regs->io_port_output_register | 0x00; // set the bit 0 to 1
714 grgpio_regs->io_port_output_register = grgpio_regs->io_port_output_register | 0x00; // set the bit 0 to 1
709 set_irq_on_new_ready_matrix( 1 );
715 set_irq_on_new_ready_matrix( 1 );
710 LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX );
716 LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX );
711 LEON_Unmask_interrupt( IRQ_SPECTRAL_MATRIX );
717 LEON_Unmask_interrupt( IRQ_SPECTRAL_MATRIX );
712 set_run_matrix_spectral( 1 );
718 set_run_matrix_spectral( 1 );
713
719
714 }
720 }
715
721
716 void set_irq_on_new_ready_matrix( unsigned char value )
722 void set_irq_on_new_ready_matrix( unsigned char value )
717 {
723 {
718 if (value == 1)
724 if (value == 1)
719 {
725 {
720 spectral_matrix_regs->config = spectral_matrix_regs->config | 0x01;
726 spectral_matrix_regs->config = spectral_matrix_regs->config | 0x01;
721 }
727 }
722 else
728 else
723 {
729 {
724 spectral_matrix_regs->config = spectral_matrix_regs->config & 0xfffffffe; // 1110
730 spectral_matrix_regs->config = spectral_matrix_regs->config & 0xfffffffe; // 1110
725 }
731 }
726 }
732 }
727
733
728 void set_run_matrix_spectral( unsigned char value )
734 void set_run_matrix_spectral( unsigned char value )
729 {
735 {
730 if (value == 1)
736 if (value == 1)
731 {
737 {
732 spectral_matrix_regs->config = spectral_matrix_regs->config | 0x4; // [0100] set run_matrix spectral to 1
738 spectral_matrix_regs->config = spectral_matrix_regs->config | 0x4; // [0100] set run_matrix spectral to 1
733 }
739 }
734 else
740 else
735 {
741 {
736 spectral_matrix_regs->config = spectral_matrix_regs->config & 0xfffffffb; // [1011] set run_matrix spectral to 0
742 spectral_matrix_regs->config = spectral_matrix_regs->config & 0xfffffffb; // [1011] set run_matrix spectral to 0
737 }
743 }
738 }
744 }
739
745
740 void launch_spectral_matrix_simu( unsigned char mode )
746 void launch_spectral_matrix_simu( unsigned char mode )
741 {
747 {
742 reset_nb_sm_f0();
748 SM_reset_current_ring_nodes();
743 reset_current_sm_ring_nodes();
749 ASM_reset_current_ring_node();
744 reset_current_bp_ring_nodes();
745 reset_spectral_matrix_regs();
750 reset_spectral_matrix_regs();
746
751
747 // Spectral Matrices simulator
752 // Spectral Matrices simulator
748 timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR );
753 timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR );
749 LEON_Clear_interrupt( IRQ_SM_SIMULATOR );
754 LEON_Clear_interrupt( IRQ_SM_SIMULATOR );
750 LEON_Unmask_interrupt( IRQ_SM_SIMULATOR );
755 LEON_Unmask_interrupt( IRQ_SM_SIMULATOR );
751 set_local_nb_interrupt_f0_MAX();
756 set_local_nb_interrupt_f0_MAX();
752 }
757 }
753
758
754 //****************
759 //****************
755 // CLOSING ACTIONS
760 // CLOSING ACTIONS
756 void update_last_TC_exe( ccsdsTelecommandPacket_t *TC, unsigned char * time )
761 void update_last_TC_exe( ccsdsTelecommandPacket_t *TC, unsigned char * time )
757 {
762 {
758 /** This function is used to update the HK packets statistics after a successful TC execution.
763 /** This function is used to update the HK packets statistics after a successful TC execution.
759 *
764 *
760 * @param TC points to the TC being processed
765 * @param TC points to the TC being processed
761 * @param time is the time used to date the TC execution
766 * @param time is the time used to date the TC execution
762 *
767 *
763 */
768 */
764
769
765 unsigned int val;
770 unsigned int val;
766
771
767 housekeeping_packet.hk_lfr_last_exe_tc_id[0] = TC->packetID[0];
772 housekeeping_packet.hk_lfr_last_exe_tc_id[0] = TC->packetID[0];
768 housekeeping_packet.hk_lfr_last_exe_tc_id[1] = TC->packetID[1];
773 housekeeping_packet.hk_lfr_last_exe_tc_id[1] = TC->packetID[1];
769 housekeeping_packet.hk_lfr_last_exe_tc_type[0] = 0x00;
774 housekeeping_packet.hk_lfr_last_exe_tc_type[0] = 0x00;
770 housekeeping_packet.hk_lfr_last_exe_tc_type[1] = TC->serviceType;
775 housekeeping_packet.hk_lfr_last_exe_tc_type[1] = TC->serviceType;
771 housekeeping_packet.hk_lfr_last_exe_tc_subtype[0] = 0x00;
776 housekeeping_packet.hk_lfr_last_exe_tc_subtype[0] = 0x00;
772 housekeeping_packet.hk_lfr_last_exe_tc_subtype[1] = TC->serviceSubType;
777 housekeeping_packet.hk_lfr_last_exe_tc_subtype[1] = TC->serviceSubType;
773 housekeeping_packet.hk_lfr_last_exe_tc_time[0] = time[0];
778 housekeeping_packet.hk_lfr_last_exe_tc_time[0] = time[0];
774 housekeeping_packet.hk_lfr_last_exe_tc_time[1] = time[1];
779 housekeeping_packet.hk_lfr_last_exe_tc_time[1] = time[1];
775 housekeeping_packet.hk_lfr_last_exe_tc_time[2] = time[2];
780 housekeeping_packet.hk_lfr_last_exe_tc_time[2] = time[2];
776 housekeeping_packet.hk_lfr_last_exe_tc_time[3] = time[3];
781 housekeeping_packet.hk_lfr_last_exe_tc_time[3] = time[3];
777 housekeeping_packet.hk_lfr_last_exe_tc_time[4] = time[4];
782 housekeeping_packet.hk_lfr_last_exe_tc_time[4] = time[4];
778 housekeeping_packet.hk_lfr_last_exe_tc_time[5] = time[5];
783 housekeeping_packet.hk_lfr_last_exe_tc_time[5] = time[5];
779
784
780 val = housekeeping_packet.hk_lfr_exe_tc_cnt[0] * 256 + housekeeping_packet.hk_lfr_exe_tc_cnt[1];
785 val = housekeeping_packet.hk_lfr_exe_tc_cnt[0] * 256 + housekeeping_packet.hk_lfr_exe_tc_cnt[1];
781 val++;
786 val++;
782 housekeeping_packet.hk_lfr_exe_tc_cnt[0] = (unsigned char) (val >> 8);
787 housekeeping_packet.hk_lfr_exe_tc_cnt[0] = (unsigned char) (val >> 8);
783 housekeeping_packet.hk_lfr_exe_tc_cnt[1] = (unsigned char) (val);
788 housekeeping_packet.hk_lfr_exe_tc_cnt[1] = (unsigned char) (val);
784 }
789 }
785
790
786 void update_last_TC_rej(ccsdsTelecommandPacket_t *TC, unsigned char * time )
791 void update_last_TC_rej(ccsdsTelecommandPacket_t *TC, unsigned char * time )
787 {
792 {
788 /** This function is used to update the HK packets statistics after a TC rejection.
793 /** This function is used to update the HK packets statistics after a TC rejection.
789 *
794 *
790 * @param TC points to the TC being processed
795 * @param TC points to the TC being processed
791 * @param time is the time used to date the TC rejection
796 * @param time is the time used to date the TC rejection
792 *
797 *
793 */
798 */
794
799
795 unsigned int val;
800 unsigned int val;
796
801
797 housekeeping_packet.hk_lfr_last_rej_tc_id[0] = TC->packetID[0];
802 housekeeping_packet.hk_lfr_last_rej_tc_id[0] = TC->packetID[0];
798 housekeeping_packet.hk_lfr_last_rej_tc_id[1] = TC->packetID[1];
803 housekeeping_packet.hk_lfr_last_rej_tc_id[1] = TC->packetID[1];
799 housekeeping_packet.hk_lfr_last_rej_tc_type[0] = 0x00;
804 housekeeping_packet.hk_lfr_last_rej_tc_type[0] = 0x00;
800 housekeeping_packet.hk_lfr_last_rej_tc_type[1] = TC->serviceType;
805 housekeeping_packet.hk_lfr_last_rej_tc_type[1] = TC->serviceType;
801 housekeeping_packet.hk_lfr_last_rej_tc_subtype[0] = 0x00;
806 housekeeping_packet.hk_lfr_last_rej_tc_subtype[0] = 0x00;
802 housekeeping_packet.hk_lfr_last_rej_tc_subtype[1] = TC->serviceSubType;
807 housekeeping_packet.hk_lfr_last_rej_tc_subtype[1] = TC->serviceSubType;
803 housekeeping_packet.hk_lfr_last_rej_tc_time[0] = time[0];
808 housekeeping_packet.hk_lfr_last_rej_tc_time[0] = time[0];
804 housekeeping_packet.hk_lfr_last_rej_tc_time[1] = time[1];
809 housekeeping_packet.hk_lfr_last_rej_tc_time[1] = time[1];
805 housekeeping_packet.hk_lfr_last_rej_tc_time[2] = time[2];
810 housekeeping_packet.hk_lfr_last_rej_tc_time[2] = time[2];
806 housekeeping_packet.hk_lfr_last_rej_tc_time[3] = time[3];
811 housekeeping_packet.hk_lfr_last_rej_tc_time[3] = time[3];
807 housekeeping_packet.hk_lfr_last_rej_tc_time[4] = time[4];
812 housekeeping_packet.hk_lfr_last_rej_tc_time[4] = time[4];
808 housekeeping_packet.hk_lfr_last_rej_tc_time[5] = time[5];
813 housekeeping_packet.hk_lfr_last_rej_tc_time[5] = time[5];
809
814
810 val = housekeeping_packet.hk_lfr_rej_tc_cnt[0] * 256 + housekeeping_packet.hk_lfr_rej_tc_cnt[1];
815 val = housekeeping_packet.hk_lfr_rej_tc_cnt[0] * 256 + housekeeping_packet.hk_lfr_rej_tc_cnt[1];
811 val++;
816 val++;
812 housekeeping_packet.hk_lfr_rej_tc_cnt[0] = (unsigned char) (val >> 8);
817 housekeeping_packet.hk_lfr_rej_tc_cnt[0] = (unsigned char) (val >> 8);
813 housekeeping_packet.hk_lfr_rej_tc_cnt[1] = (unsigned char) (val);
818 housekeeping_packet.hk_lfr_rej_tc_cnt[1] = (unsigned char) (val);
814 }
819 }
815
820
816 void close_action(ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id )
821 void close_action(ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id )
817 {
822 {
818 /** This function is the last step of the TC execution workflow.
823 /** This function is the last step of the TC execution workflow.
819 *
824 *
820 * @param TC points to the TC being processed
825 * @param TC points to the TC being processed
821 * @param result is the result of the TC execution (LFR_SUCCESSFUL / LFR_DEFAULT)
826 * @param result is the result of the TC execution (LFR_SUCCESSFUL / LFR_DEFAULT)
822 * @param queue_id is the id of the RTEMS message queue used to send TM packets
827 * @param queue_id is the id of the RTEMS message queue used to send TM packets
823 * @param time is the time used to date the TC execution
828 * @param time is the time used to date the TC execution
824 *
829 *
825 */
830 */
826
831
827 unsigned char requestedMode;
832 unsigned char requestedMode;
828
833
829 if (result == LFR_SUCCESSFUL)
834 if (result == LFR_SUCCESSFUL)
830 {
835 {
831 if ( !( (TC->serviceType==TC_TYPE_TIME) & (TC->serviceSubType==TC_SUBTYPE_UPDT_TIME) )
836 if ( !( (TC->serviceType==TC_TYPE_TIME) & (TC->serviceSubType==TC_SUBTYPE_UPDT_TIME) )
832 &
837 &
833 !( (TC->serviceType==TC_TYPE_GEN) & (TC->serviceSubType==TC_SUBTYPE_UPDT_INFO))
838 !( (TC->serviceType==TC_TYPE_GEN) & (TC->serviceSubType==TC_SUBTYPE_UPDT_INFO))
834 )
839 )
835 {
840 {
836 send_tm_lfr_tc_exe_success( TC, queue_id );
841 send_tm_lfr_tc_exe_success( TC, queue_id );
837 }
842 }
838 if ( (TC->serviceType == TC_TYPE_GEN) & (TC->serviceSubType == TC_SUBTYPE_ENTER) )
843 if ( (TC->serviceType == TC_TYPE_GEN) & (TC->serviceSubType == TC_SUBTYPE_ENTER) )
839 {
844 {
840 //**********************************
845 //**********************************
841 // UPDATE THE LFRMODE LOCAL VARIABLE
846 // UPDATE THE LFRMODE LOCAL VARIABLE
842 requestedMode = TC->dataAndCRC[1];
847 requestedMode = TC->dataAndCRC[1];
843 housekeeping_packet.lfr_status_word[0] = (unsigned char) ((requestedMode << 4) + 0x0d);
848 housekeeping_packet.lfr_status_word[0] = (unsigned char) ((requestedMode << 4) + 0x0d);
844 updateLFRCurrentMode();
849 updateLFRCurrentMode();
845 }
850 }
846 }
851 }
847 else if (result == LFR_EXE_ERROR)
852 else if (result == LFR_EXE_ERROR)
848 {
853 {
849 send_tm_lfr_tc_exe_error( TC, queue_id );
854 send_tm_lfr_tc_exe_error( TC, queue_id );
850 }
855 }
851 }
856 }
852
857
853 //***************************
858 //***************************
854 // Interrupt Service Routines
859 // Interrupt Service Routines
855 rtems_isr commutation_isr1( rtems_vector_number vector )
860 rtems_isr commutation_isr1( rtems_vector_number vector )
856 {
861 {
857 if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
862 if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
858 printf("In commutation_isr1 *** Error sending event to DUMB\n");
863 printf("In commutation_isr1 *** Error sending event to DUMB\n");
859 }
864 }
860 }
865 }
861
866
862 rtems_isr commutation_isr2( rtems_vector_number vector )
867 rtems_isr commutation_isr2( rtems_vector_number vector )
863 {
868 {
864 if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
869 if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
865 printf("In commutation_isr2 *** Error sending event to DUMB\n");
870 printf("In commutation_isr2 *** Error sending event to DUMB\n");
866 }
871 }
867 }
872 }
868
873
869 //****************
874 //****************
870 // OTHER FUNCTIONS
875 // OTHER FUNCTIONS
871 void updateLFRCurrentMode()
876 void updateLFRCurrentMode()
872 {
877 {
873 /** This function updates the value of the global variable lfrCurrentMode.
878 /** This function updates the value of the global variable lfrCurrentMode.
874 *
879 *
875 * lfrCurrentMode is a parameter used by several functions to know in which mode LFR is running.
880 * lfrCurrentMode is a parameter used by several functions to know in which mode LFR is running.
876 *
881 *
877 */
882 */
878 // update the local value of lfrCurrentMode with the value contained in the housekeeping_packet structure
883 // update the local value of lfrCurrentMode with the value contained in the housekeeping_packet structure
879 lfrCurrentMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
884 lfrCurrentMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
880 }
885 }
881
886
@@ -1,539 +1,759
1 /** Functions to load and dump parameters in the LFR registers.
1 /** Functions to load and dump parameters in the LFR registers.
2 *
2 *
3 * @file
3 * @file
4 * @author P. LEROY
4 * @author P. LEROY
5 *
5 *
6 * A group of functions to handle TC related to parameter loading and dumping.\n
6 * A group of functions to handle TC related to parameter loading and dumping.\n
7 * TC_LFR_LOAD_COMMON_PAR\n
7 * TC_LFR_LOAD_COMMON_PAR\n
8 * TC_LFR_LOAD_NORMAL_PAR\n
8 * TC_LFR_LOAD_NORMAL_PAR\n
9 * TC_LFR_LOAD_BURST_PAR\n
9 * TC_LFR_LOAD_BURST_PAR\n
10 * TC_LFR_LOAD_SBM1_PAR\n
10 * TC_LFR_LOAD_SBM1_PAR\n
11 * TC_LFR_LOAD_SBM2_PAR\n
11 * TC_LFR_LOAD_SBM2_PAR\n
12 *
12 *
13 */
13 */
14
14
15 #include "tc_load_dump_parameters.h"
15 #include "tc_load_dump_parameters.h"
16
16
17 int action_load_common_par(ccsdsTelecommandPacket_t *TC)
17 int action_load_common_par(ccsdsTelecommandPacket_t *TC)
18 {
18 {
19 /** This function updates the LFR registers with the incoming common parameters.
19 /** This function updates the LFR registers with the incoming common parameters.
20 *
20 *
21 * @param TC points to the TeleCommand packet that is being processed
21 * @param TC points to the TeleCommand packet that is being processed
22 *
22 *
23 *
23 *
24 */
24 */
25
25
26 parameter_dump_packet.unused0 = TC->dataAndCRC[0];
26 parameter_dump_packet.unused0 = TC->dataAndCRC[0];
27 parameter_dump_packet.bw_sp0_sp1_r0_r1 = TC->dataAndCRC[1];
27 parameter_dump_packet.bw_sp0_sp1_r0_r1 = TC->dataAndCRC[1];
28 set_wfp_data_shaping( );
28 set_wfp_data_shaping( );
29 return LFR_SUCCESSFUL;
29 return LFR_SUCCESSFUL;
30 }
30 }
31
31
32 int action_load_normal_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
32 int action_load_normal_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
33 {
33 {
34 /** This function updates the LFR registers with the incoming normal parameters.
34 /** This function updates the LFR registers with the incoming normal parameters.
35 *
35 *
36 * @param TC points to the TeleCommand packet that is being processed
36 * @param TC points to the TeleCommand packet that is being processed
37 * @param queue_id is the id of the queue which handles TM related to this execution step
37 * @param queue_id is the id of the queue which handles TM related to this execution step
38 *
38 *
39 */
39 */
40
40
41 int result;
41 int result;
42 int flag;
42 int flag;
43 rtems_status_code status;
43 rtems_status_code status;
44 unsigned char sy_lfr_n_bp_p0;
45 unsigned char sy_lfr_n_bp_p1;
46 float aux;
44
47
45 flag = LFR_SUCCESSFUL;
48 flag = LFR_SUCCESSFUL;
46
49
47 if ( (lfrCurrentMode == LFR_MODE_NORMAL) ||
50 if ( (lfrCurrentMode == LFR_MODE_NORMAL) ||
48 (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) {
51 (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) {
49 status = send_tm_lfr_tc_exe_not_executable( TC, queue_id );
52 status = send_tm_lfr_tc_exe_not_executable( TC, queue_id );
50 flag = LFR_DEFAULT;
53 flag = LFR_DEFAULT;
51 }
54 }
52
55
53 //***************
56 //***************
54 // sy_lfr_n_swf_l
57 // sy_lfr_n_swf_l
55 if (flag == LFR_SUCCESSFUL)
58 if (flag == LFR_SUCCESSFUL)
56 {
59 {
57 result = set_sy_lfr_n_swf_l( TC, queue_id, time );
60 result = set_sy_lfr_n_swf_l( TC, queue_id, time );
58 if (result != LFR_SUCCESSFUL)
61 if (result != LFR_SUCCESSFUL)
59 {
62 {
60 flag = LFR_DEFAULT;
63 flag = LFR_DEFAULT;
61 }
64 }
62 }
65 }
63
66
64 //***************
67 //***************
65 // sy_lfr_n_swf_p
68 // sy_lfr_n_swf_p
66 if (flag == LFR_SUCCESSFUL)
69 if (flag == LFR_SUCCESSFUL)
67 {
70 {
68 result = set_sy_lfr_n_swf_p( TC, queue_id, time );
71 result = set_sy_lfr_n_swf_p( TC, queue_id, time );
69 if (result != LFR_SUCCESSFUL)
72 if (result != LFR_SUCCESSFUL)
70 {
73 {
71 flag = LFR_DEFAULT;
74 flag = LFR_DEFAULT;
72 }
75 }
73 }
76 }
74
77
75 //***************
78 //***************
76 // sy_lfr_n_asm_p
79 // sy_lfr_n_asm_p
77 if (flag == LFR_SUCCESSFUL)
80 if (flag == LFR_SUCCESSFUL)
78 {
81 {
79 result = set_sy_lfr_n_asm_p( TC, queue_id );
82 result = set_sy_lfr_n_asm_p( TC, queue_id );
80 if (result != LFR_SUCCESSFUL)
83 if (result != LFR_SUCCESSFUL)
81 {
84 {
82 flag = LFR_DEFAULT;
85 flag = LFR_DEFAULT;
83 }
86 }
84 }
87 }
85
88
89 //****************************************************************
90 // check the consistency between sy_lfr_n_bp_p0 and sy_lfr_n_bp_p1
91 if (flag == LFR_SUCCESSFUL)
92 {
93 sy_lfr_n_bp_p0 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_BP_P0 ];
94 sy_lfr_n_bp_p1 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_BP_P1 ];
95 aux = ( (float ) sy_lfr_n_bp_p1 / sy_lfr_n_bp_p0 ) - floor(sy_lfr_n_bp_p1 / sy_lfr_n_bp_p0);
96 if (aux != 0)
97 {
98 status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_POS_SY_LFR_N_BP_P0+10, sy_lfr_n_bp_p0 );
99 flag = LFR_DEFAULT;
100 }
101 }
102
86 //***************
103 //***************
87 // sy_lfr_n_bp_p0
104 // sy_lfr_n_bp_p0
88 if (flag == LFR_SUCCESSFUL)
105 if (flag == LFR_SUCCESSFUL)
89 {
106 {
90 result = set_sy_lfr_n_bp_p0( TC, queue_id );
107 result = set_sy_lfr_n_bp_p0( TC, queue_id );
91 if (result != LFR_SUCCESSFUL)
108 if (result != LFR_SUCCESSFUL)
92 {
109 {
93 flag = LFR_DEFAULT;
110 flag = LFR_DEFAULT;
94 }
111 }
95 }
112 }
96
113
97 //***************
114 //***************
98 // sy_lfr_n_bp_p1
115 // sy_lfr_n_bp_p1
99 if (flag == LFR_SUCCESSFUL)
116 if (flag == LFR_SUCCESSFUL)
100 {
117 {
101 result = set_sy_lfr_n_bp_p1( TC, queue_id );
118 result = set_sy_lfr_n_bp_p1( TC, queue_id );
102 if (result != LFR_SUCCESSFUL)
119 if (result != LFR_SUCCESSFUL)
103 {
120 {
104 flag = LFR_DEFAULT;
121 flag = LFR_DEFAULT;
105 }
122 }
106 }
123 }
107
124
108 //*********************
125 //*********************
109 // sy_lfr_n_cwf_long_f3
126 // sy_lfr_n_cwf_long_f3
110 if (flag == LFR_SUCCESSFUL)
127 if (flag == LFR_SUCCESSFUL)
111 {
128 {
112 result = set_sy_lfr_n_cwf_long_f3( TC, queue_id );
129 result = set_sy_lfr_n_cwf_long_f3( TC, queue_id );
113 if (result != LFR_SUCCESSFUL)
130 if (result != LFR_SUCCESSFUL)
114 {
131 {
115 flag = LFR_DEFAULT;
132 flag = LFR_DEFAULT;
116 }
133 }
117 }
134 }
118
135
119 return flag;
136 return flag;
120 }
137 }
121
138
122 int action_load_burst_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
139 int action_load_burst_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
123 {
140 {
124 /** This function updates the LFR registers with the incoming burst parameters.
141 /** This function updates the LFR registers with the incoming burst parameters.
125 *
142 *
126 * @param TC points to the TeleCommand packet that is being processed
143 * @param TC points to the TeleCommand packet that is being processed
127 * @param queue_id is the id of the queue which handles TM related to this execution step
144 * @param queue_id is the id of the queue which handles TM related to this execution step
128 *
145 *
129 */
146 */
130
147
131 int result;
148 int result;
132 unsigned char lfrMode;
149 int flag;
133 rtems_status_code status;
150 rtems_status_code status;
151 unsigned char sy_lfr_b_bp_p0;
152 unsigned char sy_lfr_b_bp_p1;
153 float aux;
134
154
135 result = LFR_DEFAULT;
155 flag = LFR_SUCCESSFUL;
136 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
137
156
138 if ( lfrMode == LFR_MODE_BURST ) {
157 if ( lfrCurrentMode == LFR_MODE_BURST ) {
139 status = send_tm_lfr_tc_exe_not_executable( TC, queue_id );
158 status = send_tm_lfr_tc_exe_not_executable( TC, queue_id );
140 result = LFR_DEFAULT;
159 result = LFR_DEFAULT;
141 }
160 }
142 else {
143 parameter_dump_packet.sy_lfr_b_bp_p0 = TC->dataAndCRC[0];
144 parameter_dump_packet.sy_lfr_b_bp_p1 = TC->dataAndCRC[1];
145
161
146 result = LFR_SUCCESSFUL;
162 //****************************************************************
163 // check the consistency between sy_lfr_b_bp_p0 and sy_lfr_b_bp_p1
164 if (flag == LFR_SUCCESSFUL)
165 {
166 sy_lfr_b_bp_p0 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_B_BP_P0 ];
167 sy_lfr_b_bp_p1 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_B_BP_P1 ];
168 aux = ( (float ) sy_lfr_b_bp_p1 / sy_lfr_b_bp_p0 ) - floor(sy_lfr_b_bp_p1 / sy_lfr_b_bp_p0);
169 if (aux != 0)
170 {
171 status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_POS_SY_LFR_B_BP_P0+10, sy_lfr_b_bp_p0 );
172 flag = LFR_DEFAULT;
173 }
147 }
174 }
148
175
149 return result;
176 //***************
177 // sy_lfr_b_bp_p0
178 if (flag == LFR_SUCCESSFUL)
179 {
180 result = set_sy_lfr_b_bp_p0( TC, queue_id );
181 if (result != LFR_SUCCESSFUL)
182 {
183 flag = LFR_DEFAULT;
184 }
185 }
186
187 //***************
188 // sy_lfr_b_bp_p1
189 if (flag == LFR_SUCCESSFUL)
190 {
191 result = set_sy_lfr_b_bp_p1( TC, queue_id );
192 if (result != LFR_SUCCESSFUL)
193 {
194 flag = LFR_DEFAULT;
195 }
196 }
197
198 return flag;
150 }
199 }
151
200
152 int action_load_sbm1_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
201 int action_load_sbm1_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
153 {
202 {
154 /** This function updates the LFR registers with the incoming sbm1 parameters.
203 /** This function updates the LFR registers with the incoming sbm1 parameters.
155 *
204 *
156 * @param TC points to the TeleCommand packet that is being processed
205 * @param TC points to the TeleCommand packet that is being processed
157 * @param queue_id is the id of the queue which handles TM related to this execution step
206 * @param queue_id is the id of the queue which handles TM related to this execution step
158 *
207 *
159 */
208 */
160 int result;
161 unsigned char lfrMode;
162 rtems_status_code status;
163
209
164 result = LFR_DEFAULT;
210 int result;
165 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
211 int flag;
212 rtems_status_code status;
213 unsigned char sy_lfr_s1_bp_p0;
214 unsigned char sy_lfr_s1_bp_p1;
215 float aux;
166
216
167 if ( lfrMode == LFR_MODE_SBM1 ) {
217 flag = LFR_SUCCESSFUL;
218
219 if ( lfrCurrentMode == LFR_MODE_SBM1 ) {
168 status = send_tm_lfr_tc_exe_not_executable( TC, queue_id );
220 status = send_tm_lfr_tc_exe_not_executable( TC, queue_id );
169 result = LFR_DEFAULT;
221 result = LFR_DEFAULT;
170 }
222 }
171 else {
172 parameter_dump_packet.sy_lfr_s1_bp_p0 = TC->dataAndCRC[0];
173 parameter_dump_packet.sy_lfr_s1_bp_p1 = TC->dataAndCRC[1];
174
223
175 result = LFR_SUCCESSFUL;
224 //******************************************************************
225 // check the consistency between sy_lfr_s1_bp_p0 and sy_lfr_s1_bp_p1
226 if (flag == LFR_SUCCESSFUL)
227 {
228 sy_lfr_s1_bp_p0 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_S1_BP_P0 ];
229 sy_lfr_s1_bp_p1 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_S1_BP_P1 ];
230 aux = ( (float ) sy_lfr_s1_bp_p1 / (sy_lfr_s1_bp_p0*0.25) ) - floor(sy_lfr_s1_bp_p1 / (sy_lfr_s1_bp_p0*0.25));
231 if (aux != 0)
232 {
233 status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_POS_SY_LFR_S1_BP_P0+10, sy_lfr_s1_bp_p0 );
234 flag = LFR_DEFAULT;
235 }
176 }
236 }
177
237
178 return result;
238 //***************
239 // sy_lfr_s1_bp_p0
240 if (flag == LFR_SUCCESSFUL)
241 {
242 result = set_sy_lfr_s1_bp_p0( TC, queue_id );
243 if (result != LFR_SUCCESSFUL)
244 {
245 flag = LFR_DEFAULT;
246 }
247 }
248
249 //***************
250 // sy_lfr_s1_bp_p1
251 if (flag == LFR_SUCCESSFUL)
252 {
253 result = set_sy_lfr_s1_bp_p1( TC, queue_id );
254 if (result != LFR_SUCCESSFUL)
255 {
256 flag = LFR_DEFAULT;
257 }
258 }
259
260 return flag;
179 }
261 }
180
262
181 int action_load_sbm2_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
263 int action_load_sbm2_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
182 {
264 {
183 /** This function updates the LFR registers with the incoming sbm2 parameters.
265 /** This function updates the LFR registers with the incoming sbm2 parameters.
184 *
266 *
185 * @param TC points to the TeleCommand packet that is being processed
267 * @param TC points to the TeleCommand packet that is being processed
186 * @param queue_id is the id of the queue which handles TM related to this execution step
268 * @param queue_id is the id of the queue which handles TM related to this execution step
187 *
269 *
188 */
270 */
189
271
190 int result;
272 int result;
191 unsigned char lfrMode;
273 int flag;
192 rtems_status_code status;
274 rtems_status_code status;
275 unsigned char sy_lfr_s2_bp_p0;
276 unsigned char sy_lfr_s2_bp_p1;
277 float aux;
193
278
194 result = LFR_DEFAULT;
279 flag = LFR_SUCCESSFUL;
195 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
196
280
197 if ( lfrMode == LFR_MODE_SBM2 ) {
281 if ( lfrCurrentMode == LFR_MODE_SBM2 ) {
198 status = send_tm_lfr_tc_exe_not_executable( TC, queue_id );
282 status = send_tm_lfr_tc_exe_not_executable( TC, queue_id );
199 result = LFR_DEFAULT;
283 result = LFR_DEFAULT;
200 }
284 }
201 else {
202 parameter_dump_packet.sy_lfr_s2_bp_p0 = TC->dataAndCRC[0];
203 parameter_dump_packet.sy_lfr_s2_bp_p1 = TC->dataAndCRC[1];
204
285
205 result = LFR_SUCCESSFUL;
286 //******************************************************************
287 // check the consistency between sy_lfr_s2_bp_p0 and sy_lfr_s2_bp_p1
288 if (flag == LFR_SUCCESSFUL)
289 {
290 sy_lfr_s2_bp_p0 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_S2_BP_P0 ];
291 sy_lfr_s2_bp_p1 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_S2_BP_P1 ];
292 aux = ( (float ) sy_lfr_s2_bp_p1 / sy_lfr_s2_bp_p0 ) - floor(sy_lfr_s2_bp_p1 / sy_lfr_s2_bp_p0);
293 if (aux != 0)
294 {
295 status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_POS_SY_LFR_S2_BP_P0+10, sy_lfr_s2_bp_p0 );
296 flag = LFR_DEFAULT;
297 }
206 }
298 }
207
299
208 return result;
300 //***************
301 // sy_lfr_s2_bp_p0
302 if (flag == LFR_SUCCESSFUL)
303 {
304 result = set_sy_lfr_s2_bp_p0( TC, queue_id );
305 if (result != LFR_SUCCESSFUL)
306 {
307 flag = LFR_DEFAULT;
308 }
309 }
310
311 //***************
312 // sy_lfr_s2_bp_p1
313 if (flag == LFR_SUCCESSFUL)
314 {
315 result = set_sy_lfr_s2_bp_p1( TC, queue_id );
316 if (result != LFR_SUCCESSFUL)
317 {
318 flag = LFR_DEFAULT;
319 }
320 }
321
322 return flag;
209 }
323 }
210
324
211 int action_dump_par( rtems_id queue_id )
325 int action_dump_par( rtems_id queue_id )
212 {
326 {
213 /** This function dumps the LFR parameters by sending the appropriate TM packet to the dedicated RTEMS message queue.
327 /** This function dumps the LFR parameters by sending the appropriate TM packet to the dedicated RTEMS message queue.
214 *
328 *
215 * @param queue_id is the id of the queue which handles TM related to this execution step.
329 * @param queue_id is the id of the queue which handles TM related to this execution step.
216 *
330 *
217 * @return RTEMS directive status codes:
331 * @return RTEMS directive status codes:
218 * - RTEMS_SUCCESSFUL - message sent successfully
332 * - RTEMS_SUCCESSFUL - message sent successfully
219 * - RTEMS_INVALID_ID - invalid queue id
333 * - RTEMS_INVALID_ID - invalid queue id
220 * - RTEMS_INVALID_SIZE - invalid message size
334 * - RTEMS_INVALID_SIZE - invalid message size
221 * - RTEMS_INVALID_ADDRESS - buffer is NULL
335 * - RTEMS_INVALID_ADDRESS - buffer is NULL
222 * - RTEMS_UNSATISFIED - out of message buffers
336 * - RTEMS_UNSATISFIED - out of message buffers
223 * - RTEMS_TOO_MANY - queue s limit has been reached
337 * - RTEMS_TOO_MANY - queue s limit has been reached
224 *
338 *
225 */
339 */
226
340
227 int status;
341 int status;
228
342
229 // UPDATE TIME
343 // UPDATE TIME
230 increment_seq_counter( parameter_dump_packet.packetSequenceControl );
344 increment_seq_counter( parameter_dump_packet.packetSequenceControl );
231 parameter_dump_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
345 parameter_dump_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
232 parameter_dump_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
346 parameter_dump_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
233 parameter_dump_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
347 parameter_dump_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
234 parameter_dump_packet.time[3] = (unsigned char) (time_management_regs->coarse_time);
348 parameter_dump_packet.time[3] = (unsigned char) (time_management_regs->coarse_time);
235 parameter_dump_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
349 parameter_dump_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
236 parameter_dump_packet.time[5] = (unsigned char) (time_management_regs->fine_time);
350 parameter_dump_packet.time[5] = (unsigned char) (time_management_regs->fine_time);
237 // SEND DATA
351 // SEND DATA
238 status = rtems_message_queue_send( queue_id, &parameter_dump_packet,
352 status = rtems_message_queue_send( queue_id, &parameter_dump_packet,
239 PACKET_LENGTH_PARAMETER_DUMP + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES);
353 PACKET_LENGTH_PARAMETER_DUMP + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES);
240 if (status != RTEMS_SUCCESSFUL) {
354 if (status != RTEMS_SUCCESSFUL) {
241 PRINTF1("in action_dump *** ERR sending packet, code %d", status)
355 PRINTF1("in action_dump *** ERR sending packet, code %d", status)
242 }
356 }
243
357
244 return status;
358 return status;
245 }
359 }
246
360
247 //***********************
361 //***********************
248 // NORMAL MODE PARAMETERS
362 // NORMAL MODE PARAMETERS
249
363
250 int set_sy_lfr_n_swf_l( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time )
364 int set_sy_lfr_n_swf_l( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time )
251 {
365 {
252 /** This function sets the number of points of a snapshot (sy_lfr_n_swf_l).
366 /** This function sets the number of points of a snapshot (sy_lfr_n_swf_l).
253 *
367 *
254 * @param TC points to the TeleCommand packet that is being processed
368 * @param TC points to the TeleCommand packet that is being processed
255 * @param queue_id is the id of the queue which handles TM related to this execution step
369 * @param queue_id is the id of the queue which handles TM related to this execution step
256 *
370 *
257 */
371 */
258
372
259 unsigned int tmp;
373 unsigned int tmp;
260 int result;
374 int result;
261 unsigned char msb;
375 unsigned char msb;
262 unsigned char lsb;
376 unsigned char lsb;
263 rtems_status_code status;
377 rtems_status_code status;
264
378
265 msb = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_SWF_L ];
379 msb = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_SWF_L ];
266 lsb = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_SWF_L+1 ];
380 lsb = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_SWF_L+1 ];
267
381
268 tmp = ( unsigned int ) floor(
382 tmp = ( unsigned int ) floor(
269 ( ( msb*256 ) + lsb ) / 16
383 ( ( msb*256 ) + lsb ) / 16
270 ) * 16;
384 ) * 16;
271
385
272 if ( (tmp < 16) || (tmp > 2048) ) // the snapshot period is a multiple of 16
386 if ( (tmp < 16) || (tmp > 2048) ) // the snapshot period is a multiple of 16
273 { // 2048 is the maximum limit due to the size of the buffers
387 { // 2048 is the maximum limit due to the size of the buffers
274 status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_POS_SY_LFR_N_SWF_L+10, lsb );
388 status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_POS_SY_LFR_N_SWF_L+10, lsb );
275 result = WRONG_APP_DATA;
389 result = WRONG_APP_DATA;
276 }
390 }
277 else if (tmp != 2048)
391 else if (tmp != 2048)
278 {
392 {
279 status = send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time );
393 status = send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time );
280 result = FUNCT_NOT_IMPL;
394 result = FUNCT_NOT_IMPL;
281 }
395 }
282 else
396 else
283 {
397 {
284 parameter_dump_packet.sy_lfr_n_swf_l[0] = (unsigned char) (tmp >> 8);
398 parameter_dump_packet.sy_lfr_n_swf_l[0] = (unsigned char) (tmp >> 8);
285 parameter_dump_packet.sy_lfr_n_swf_l[1] = (unsigned char) (tmp );
399 parameter_dump_packet.sy_lfr_n_swf_l[1] = (unsigned char) (tmp );
286 result = LFR_SUCCESSFUL;
400 result = LFR_SUCCESSFUL;
287 }
401 }
288
402
289 return result;
403 return result;
290 }
404 }
291
405
292 int set_sy_lfr_n_swf_p(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time)
406 int set_sy_lfr_n_swf_p(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time)
293 {
407 {
294 /** This function sets the time between two snapshots, in s (sy_lfr_n_swf_p).
408 /** This function sets the time between two snapshots, in s (sy_lfr_n_swf_p).
295 *
409 *
296 * @param TC points to the TeleCommand packet that is being processed
410 * @param TC points to the TeleCommand packet that is being processed
297 * @param queue_id is the id of the queue which handles TM related to this execution step
411 * @param queue_id is the id of the queue which handles TM related to this execution step
298 *
412 *
299 */
413 */
300
414
301 unsigned int tmp;
415 unsigned int tmp;
302 int result;
416 int result;
303 unsigned char msb;
417 unsigned char msb;
304 unsigned char lsb;
418 unsigned char lsb;
305 rtems_status_code status;
419 rtems_status_code status;
306
420
307 msb = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_SWF_P ];
421 msb = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_SWF_P ];
308 lsb = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_SWF_P+1 ];
422 lsb = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_SWF_P+1 ];
309
423
310 tmp = msb * 256 + lsb;
424 tmp = msb * 256 + lsb;
311
425
312 if ( tmp < 16 )
426 if ( tmp < 16 )
313 {
427 {
314 status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_POS_SY_LFR_N_SWF_P+10, lsb );
428 status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_POS_SY_LFR_N_SWF_P+10, lsb );
315 result = WRONG_APP_DATA;
429 result = WRONG_APP_DATA;
316 }
430 }
317 else
431 else
318 {
432 {
319 parameter_dump_packet.sy_lfr_n_swf_p[0] = (unsigned char) (tmp >> 8);
433 parameter_dump_packet.sy_lfr_n_swf_p[0] = (unsigned char) (tmp >> 8);
320 parameter_dump_packet.sy_lfr_n_swf_p[1] = (unsigned char) (tmp );
434 parameter_dump_packet.sy_lfr_n_swf_p[1] = (unsigned char) (tmp );
321 result = LFR_SUCCESSFUL;
435 result = LFR_SUCCESSFUL;
322 }
436 }
323
437
324 return result;
438 return result;
325 }
439 }
326
440
327 int set_sy_lfr_n_asm_p( ccsdsTelecommandPacket_t *TC, rtems_id queue_id )
441 int set_sy_lfr_n_asm_p( ccsdsTelecommandPacket_t *TC, rtems_id queue_id )
328 {
442 {
329 /** This function sets the time between two full spectral matrices transmission, in s (SY_LFR_N_ASM_P).
443 /** This function sets the time between two full spectral matrices transmission, in s (SY_LFR_N_ASM_P).
330 *
444 *
331 * @param TC points to the TeleCommand packet that is being processed
445 * @param TC points to the TeleCommand packet that is being processed
332 * @param queue_id is the id of the queue which handles TM related to this execution step
446 * @param queue_id is the id of the queue which handles TM related to this execution step
333 *
447 *
334 */
448 */
335
449
336 int result;
450 int result;
337 unsigned char msb;
451 unsigned char msb;
338 unsigned char lsb;
452 unsigned char lsb;
339
453
340 msb = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_ASM_P ];
454 msb = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_ASM_P ];
341 lsb = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_ASM_P+1 ];
455 lsb = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_ASM_P+1 ];
342
456
343 parameter_dump_packet.sy_lfr_n_asm_p[0] = msb;
457 parameter_dump_packet.sy_lfr_n_asm_p[0] = msb;
344 parameter_dump_packet.sy_lfr_n_asm_p[1] = lsb;
458 parameter_dump_packet.sy_lfr_n_asm_p[1] = lsb;
345 result = LFR_SUCCESSFUL;
459 result = LFR_SUCCESSFUL;
346
460
347 return result;
461 return result;
348 }
462 }
349
463
350 int set_sy_lfr_n_bp_p0( ccsdsTelecommandPacket_t *TC, rtems_id queue_id )
464 int set_sy_lfr_n_bp_p0( ccsdsTelecommandPacket_t *TC, rtems_id queue_id )
351 {
465 {
352 /** This function sets the time between two basic parameter sets, in s (SY_LFR_N_BP_P0).
466 /** This function sets the time between two basic parameter sets, in s (SY_LFR_N_BP_P0).
353 *
467 *
354 * @param TC points to the TeleCommand packet that is being processed
468 * @param TC points to the TeleCommand packet that is being processed
355 * @param queue_id is the id of the queue which handles TM related to this execution step
469 * @param queue_id is the id of the queue which handles TM related to this execution step
356 *
470 *
357 */
471 */
358
472
359 int status;
473 int status;
360
474
361 status = LFR_SUCCESSFUL;
475 status = LFR_SUCCESSFUL;
362
476
363 parameter_dump_packet.sy_lfr_n_bp_p0 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_BP_P0 ];
477 parameter_dump_packet.sy_lfr_n_bp_p0 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_BP_P0 ];
364
478
365 return status;
479 return status;
366 }
480 }
367
481
368 int set_sy_lfr_n_bp_p1(ccsdsTelecommandPacket_t *TC, rtems_id queue_id)
482 int set_sy_lfr_n_bp_p1(ccsdsTelecommandPacket_t *TC, rtems_id queue_id)
369 {
483 {
370 /** This function sets the time between two basic parameter sets (autocorrelation + crosscorrelation), in s (sy_lfr_n_bp_p1).
484 /** This function sets the time between two basic parameter sets (autocorrelation + crosscorrelation), in s (sy_lfr_n_bp_p1).
371 *
485 *
372 * @param TC points to the TeleCommand packet that is being processed
486 * @param TC points to the TeleCommand packet that is being processed
373 * @param queue_id is the id of the queue which handles TM related to this execution step
487 * @param queue_id is the id of the queue which handles TM related to this execution step
374 *
488 *
375 */
489 */
376
490
377 int status;
491 int status;
378
492
379 status = LFR_SUCCESSFUL;
493 status = LFR_SUCCESSFUL;
380
494
381 parameter_dump_packet.sy_lfr_n_bp_p1 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_BP_P1 ];
495 parameter_dump_packet.sy_lfr_n_bp_p1 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_BP_P1 ];
382
496
383 return status;
497 return status;
384 }
498 }
385
499
386 int set_sy_lfr_n_cwf_long_f3(ccsdsTelecommandPacket_t *TC, rtems_id queue_id)
500 int set_sy_lfr_n_cwf_long_f3(ccsdsTelecommandPacket_t *TC, rtems_id queue_id)
387 {
501 {
388 /** This function allows to switch from CWF_F3 packets to CWF_LONG_F3 packets.
502 /** This function allows to switch from CWF_F3 packets to CWF_LONG_F3 packets.
389 *
503 *
390 * @param TC points to the TeleCommand packet that is being processed
504 * @param TC points to the TeleCommand packet that is being processed
391 * @param queue_id is the id of the queue which handles TM related to this execution step
505 * @param queue_id is the id of the queue which handles TM related to this execution step
392 *
506 *
393 */
507 */
394
508
395 int status;
509 int status;
396
510
397 status = LFR_SUCCESSFUL;
511 status = LFR_SUCCESSFUL;
398
512
399 parameter_dump_packet.sy_lfr_n_cwf_long_f3 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_CWF_LONG_F3 ];
513 parameter_dump_packet.sy_lfr_n_cwf_long_f3 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_CWF_LONG_F3 ];
400
514
401 return status;
515 return status;
402 }
516 }
403
517
404 //**********************
518 //**********************
405 // BURST MODE PARAMETERS
519 // BURST MODE PARAMETERS
520 int set_sy_lfr_b_bp_p0( ccsdsTelecommandPacket_t *TC, rtems_id queue_id )
521 {
522 /** This function sets the time between two basic parameter sets, in s (SY_LFR_B_BP_P0).
523 *
524 * @param TC points to the TeleCommand packet that is being processed
525 * @param queue_id is the id of the queue which handles TM related to this execution step
526 *
527 */
528
529 int status;
530
531 status = LFR_SUCCESSFUL;
532
533 parameter_dump_packet.sy_lfr_b_bp_p0 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_B_BP_P0 ];
534
535 return status;
536 }
537
538 int set_sy_lfr_b_bp_p1( ccsdsTelecommandPacket_t *TC, rtems_id queue_id )
539 {
540 /** This function sets the time between two basic parameter sets, in s (SY_LFR_B_BP_P1).
541 *
542 * @param TC points to the TeleCommand packet that is being processed
543 * @param queue_id is the id of the queue which handles TM related to this execution step
544 *
545 */
546
547 int status;
548
549 status = LFR_SUCCESSFUL;
550
551 parameter_dump_packet.sy_lfr_b_bp_p1 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_B_BP_P1 ];
552
553 return status;
554 }
406
555
407 //*********************
556 //*********************
408 // SBM1 MODE PARAMETERS
557 // SBM1 MODE PARAMETERS
558 int set_sy_lfr_s1_bp_p0( ccsdsTelecommandPacket_t *TC, rtems_id queue_id )
559 {
560 /** This function sets the time between two basic parameter sets, in s (SY_LFR_S1_BP_P0).
561 *
562 * @param TC points to the TeleCommand packet that is being processed
563 * @param queue_id is the id of the queue which handles TM related to this execution step
564 *
565 */
566
567 int status;
568
569 status = LFR_SUCCESSFUL;
570
571 parameter_dump_packet.sy_lfr_s1_bp_p0 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_S1_BP_P0 ];
572
573 return status;
574 }
575
576 int set_sy_lfr_s1_bp_p1( ccsdsTelecommandPacket_t *TC, rtems_id queue_id )
577 {
578 /** This function sets the time between two basic parameter sets, in s (SY_LFR_S1_BP_P1).
579 *
580 * @param TC points to the TeleCommand packet that is being processed
581 * @param queue_id is the id of the queue which handles TM related to this execution step
582 *
583 */
584
585 int status;
586
587 status = LFR_SUCCESSFUL;
588
589 parameter_dump_packet.sy_lfr_s1_bp_p1 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_S1_BP_P1 ];
590
591 return status;
592 }
409
593
410 //*********************
594 //*********************
411 // SBM2 MODE PARAMETERS
595 // SBM2 MODE PARAMETERS
596 int set_sy_lfr_s2_bp_p0( ccsdsTelecommandPacket_t *TC, rtems_id queue_id )
597 {
598 /** This function sets the time between two basic parameter sets, in s (SY_LFR_S2_BP_P0).
599 *
600 * @param TC points to the TeleCommand packet that is being processed
601 * @param queue_id is the id of the queue which handles TM related to this execution step
602 *
603 */
604
605 int status;
606
607 status = LFR_SUCCESSFUL;
608
609 parameter_dump_packet.sy_lfr_s2_bp_p0 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_S2_BP_P0 ];
610
611 return status;
612 }
613
614 int set_sy_lfr_s2_bp_p1( ccsdsTelecommandPacket_t *TC, rtems_id queue_id )
615 {
616 /** This function sets the time between two basic parameter sets, in s (SY_LFR_S2_BP_P1).
617 *
618 * @param TC points to the TeleCommand packet that is being processed
619 * @param queue_id is the id of the queue which handles TM related to this execution step
620 *
621 */
622
623 int status;
624
625 status = LFR_SUCCESSFUL;
626
627 parameter_dump_packet.sy_lfr_s2_bp_p1 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_S2_BP_P1 ];
628
629 return status;
630 }
631
412
632
413 //*******************
633 //*******************
414 // TC_LFR_UPDATE_INFO
634 // TC_LFR_UPDATE_INFO
415 unsigned int check_update_info_hk_lfr_mode( unsigned char mode )
635 unsigned int check_update_info_hk_lfr_mode( unsigned char mode )
416 {
636 {
417 unsigned int status;
637 unsigned int status;
418
638
419 if ( (mode == LFR_MODE_STANDBY) || (mode == LFR_MODE_NORMAL)
639 if ( (mode == LFR_MODE_STANDBY) || (mode == LFR_MODE_NORMAL)
420 || (mode == LFR_MODE_BURST)
640 || (mode == LFR_MODE_BURST)
421 || (mode == LFR_MODE_SBM1) || (mode == LFR_MODE_SBM2))
641 || (mode == LFR_MODE_SBM1) || (mode == LFR_MODE_SBM2))
422 {
642 {
423 status = LFR_SUCCESSFUL;
643 status = LFR_SUCCESSFUL;
424 }
644 }
425 else
645 else
426 {
646 {
427 status = LFR_DEFAULT;
647 status = LFR_DEFAULT;
428 }
648 }
429
649
430 return status;
650 return status;
431 }
651 }
432
652
433 unsigned int check_update_info_hk_tds_mode( unsigned char mode )
653 unsigned int check_update_info_hk_tds_mode( unsigned char mode )
434 {
654 {
435 unsigned int status;
655 unsigned int status;
436
656
437 if ( (mode == TDS_MODE_STANDBY) || (mode == TDS_MODE_NORMAL)
657 if ( (mode == TDS_MODE_STANDBY) || (mode == TDS_MODE_NORMAL)
438 || (mode == TDS_MODE_BURST)
658 || (mode == TDS_MODE_BURST)
439 || (mode == TDS_MODE_SBM1) || (mode == TDS_MODE_SBM2)
659 || (mode == TDS_MODE_SBM1) || (mode == TDS_MODE_SBM2)
440 || (mode == TDS_MODE_LFM))
660 || (mode == TDS_MODE_LFM))
441 {
661 {
442 status = LFR_SUCCESSFUL;
662 status = LFR_SUCCESSFUL;
443 }
663 }
444 else
664 else
445 {
665 {
446 status = LFR_DEFAULT;
666 status = LFR_DEFAULT;
447 }
667 }
448
668
449 return status;
669 return status;
450 }
670 }
451
671
452 unsigned int check_update_info_hk_thr_mode( unsigned char mode )
672 unsigned int check_update_info_hk_thr_mode( unsigned char mode )
453 {
673 {
454 unsigned int status;
674 unsigned int status;
455
675
456 if ( (mode == THR_MODE_STANDBY) || (mode == THR_MODE_NORMAL)
676 if ( (mode == THR_MODE_STANDBY) || (mode == THR_MODE_NORMAL)
457 || (mode == THR_MODE_BURST))
677 || (mode == THR_MODE_BURST))
458 {
678 {
459 status = LFR_SUCCESSFUL;
679 status = LFR_SUCCESSFUL;
460 }
680 }
461 else
681 else
462 {
682 {
463 status = LFR_DEFAULT;
683 status = LFR_DEFAULT;
464 }
684 }
465
685
466 return status;
686 return status;
467 }
687 }
468
688
469 //**********
689 //**********
470 // init dump
690 // init dump
471
691
472 void init_parameter_dump( void )
692 void init_parameter_dump( void )
473 {
693 {
474 /** This function initialize the parameter_dump_packet global variable with default values.
694 /** This function initialize the parameter_dump_packet global variable with default values.
475 *
695 *
476 */
696 */
477
697
478 parameter_dump_packet.targetLogicalAddress = CCSDS_DESTINATION_ID;
698 parameter_dump_packet.targetLogicalAddress = CCSDS_DESTINATION_ID;
479 parameter_dump_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID;
699 parameter_dump_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID;
480 parameter_dump_packet.reserved = CCSDS_RESERVED;
700 parameter_dump_packet.reserved = CCSDS_RESERVED;
481 parameter_dump_packet.userApplication = CCSDS_USER_APP;
701 parameter_dump_packet.userApplication = CCSDS_USER_APP;
482 parameter_dump_packet.packetID[0] = (unsigned char) (APID_TM_PARAMETER_DUMP >> 8);
702 parameter_dump_packet.packetID[0] = (unsigned char) (APID_TM_PARAMETER_DUMP >> 8);
483 parameter_dump_packet.packetID[1] = (unsigned char) APID_TM_PARAMETER_DUMP;
703 parameter_dump_packet.packetID[1] = (unsigned char) APID_TM_PARAMETER_DUMP;
484 parameter_dump_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
704 parameter_dump_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
485 parameter_dump_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
705 parameter_dump_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
486 parameter_dump_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_PARAMETER_DUMP >> 8);
706 parameter_dump_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_PARAMETER_DUMP >> 8);
487 parameter_dump_packet.packetLength[1] = (unsigned char) PACKET_LENGTH_PARAMETER_DUMP;
707 parameter_dump_packet.packetLength[1] = (unsigned char) PACKET_LENGTH_PARAMETER_DUMP;
488 // DATA FIELD HEADER
708 // DATA FIELD HEADER
489 parameter_dump_packet.spare1_pusVersion_spare2 = SPARE1_PUSVERSION_SPARE2;
709 parameter_dump_packet.spare1_pusVersion_spare2 = SPARE1_PUSVERSION_SPARE2;
490 parameter_dump_packet.serviceType = TM_TYPE_PARAMETER_DUMP;
710 parameter_dump_packet.serviceType = TM_TYPE_PARAMETER_DUMP;
491 parameter_dump_packet.serviceSubType = TM_SUBTYPE_PARAMETER_DUMP;
711 parameter_dump_packet.serviceSubType = TM_SUBTYPE_PARAMETER_DUMP;
492 parameter_dump_packet.destinationID = TM_DESTINATION_ID_GROUND;
712 parameter_dump_packet.destinationID = TM_DESTINATION_ID_GROUND;
493 parameter_dump_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
713 parameter_dump_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
494 parameter_dump_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
714 parameter_dump_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
495 parameter_dump_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
715 parameter_dump_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
496 parameter_dump_packet.time[3] = (unsigned char) (time_management_regs->coarse_time);
716 parameter_dump_packet.time[3] = (unsigned char) (time_management_regs->coarse_time);
497 parameter_dump_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
717 parameter_dump_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
498 parameter_dump_packet.time[5] = (unsigned char) (time_management_regs->fine_time);
718 parameter_dump_packet.time[5] = (unsigned char) (time_management_regs->fine_time);
499 parameter_dump_packet.sid = SID_PARAMETER_DUMP;
719 parameter_dump_packet.sid = SID_PARAMETER_DUMP;
500
720
501 //******************
721 //******************
502 // COMMON PARAMETERS
722 // COMMON PARAMETERS
503 parameter_dump_packet.unused0 = DEFAULT_SY_LFR_COMMON0;
723 parameter_dump_packet.unused0 = DEFAULT_SY_LFR_COMMON0;
504 parameter_dump_packet.bw_sp0_sp1_r0_r1 = DEFAULT_SY_LFR_COMMON1;
724 parameter_dump_packet.bw_sp0_sp1_r0_r1 = DEFAULT_SY_LFR_COMMON1;
505
725
506 //******************
726 //******************
507 // NORMAL PARAMETERS
727 // NORMAL PARAMETERS
508 parameter_dump_packet.sy_lfr_n_swf_l[0] = (unsigned char) (SY_LFR_N_SWF_L >> 8);
728 parameter_dump_packet.sy_lfr_n_swf_l[0] = (unsigned char) (SY_LFR_N_SWF_L >> 8);
509 parameter_dump_packet.sy_lfr_n_swf_l[1] = (unsigned char) (SY_LFR_N_SWF_L );
729 parameter_dump_packet.sy_lfr_n_swf_l[1] = (unsigned char) (SY_LFR_N_SWF_L );
510 parameter_dump_packet.sy_lfr_n_swf_p[0] = (unsigned char) (SY_LFR_N_SWF_P >> 8);
730 parameter_dump_packet.sy_lfr_n_swf_p[0] = (unsigned char) (SY_LFR_N_SWF_P >> 8);
511 parameter_dump_packet.sy_lfr_n_swf_p[1] = (unsigned char) (SY_LFR_N_SWF_P );
731 parameter_dump_packet.sy_lfr_n_swf_p[1] = (unsigned char) (SY_LFR_N_SWF_P );
512 parameter_dump_packet.sy_lfr_n_asm_p[0] = (unsigned char) (SY_LFR_N_ASM_P >> 8);
732 parameter_dump_packet.sy_lfr_n_asm_p[0] = (unsigned char) (SY_LFR_N_ASM_P >> 8);
513 parameter_dump_packet.sy_lfr_n_asm_p[1] = (unsigned char) (SY_LFR_N_ASM_P );
733 parameter_dump_packet.sy_lfr_n_asm_p[1] = (unsigned char) (SY_LFR_N_ASM_P );
514 parameter_dump_packet.sy_lfr_n_bp_p0 = (unsigned char) SY_LFR_N_BP_P0;
734 parameter_dump_packet.sy_lfr_n_bp_p0 = (unsigned char) SY_LFR_N_BP_P0;
515 parameter_dump_packet.sy_lfr_n_bp_p1 = (unsigned char) SY_LFR_N_BP_P1;
735 parameter_dump_packet.sy_lfr_n_bp_p1 = (unsigned char) SY_LFR_N_BP_P1;
516 parameter_dump_packet.sy_lfr_n_cwf_long_f3 = (unsigned char) SY_LFR_N_CWF_LONG_F3;
736 parameter_dump_packet.sy_lfr_n_cwf_long_f3 = (unsigned char) SY_LFR_N_CWF_LONG_F3;
517
737
518 //*****************
738 //*****************
519 // BURST PARAMETERS
739 // BURST PARAMETERS
520 parameter_dump_packet.sy_lfr_b_bp_p0 = (unsigned char) DEFAULT_SY_LFR_B_BP_P0;
740 parameter_dump_packet.sy_lfr_b_bp_p0 = (unsigned char) DEFAULT_SY_LFR_B_BP_P0;
521 parameter_dump_packet.sy_lfr_b_bp_p1 = (unsigned char) DEFAULT_SY_LFR_B_BP_P1;
741 parameter_dump_packet.sy_lfr_b_bp_p1 = (unsigned char) DEFAULT_SY_LFR_B_BP_P1;
522
742
523 //****************
743 //****************
524 // SBM1 PARAMETERS
744 // SBM1 PARAMETERS
525 parameter_dump_packet.sy_lfr_s1_bp_p0 = (unsigned char) DEFAULT_SY_LFR_S1_BP_P0; // min value is 0.25 s for the period
745 parameter_dump_packet.sy_lfr_s1_bp_p0 = (unsigned char) DEFAULT_SY_LFR_S1_BP_P0; // min value is 0.25 s for the period
526 parameter_dump_packet.sy_lfr_s1_bp_p1 = (unsigned char) DEFAULT_SY_LFR_S1_BP_P1;
746 parameter_dump_packet.sy_lfr_s1_bp_p1 = (unsigned char) DEFAULT_SY_LFR_S1_BP_P1;
527
747
528 //****************
748 //****************
529 // SBM2 PARAMETERS
749 // SBM2 PARAMETERS
530 parameter_dump_packet.sy_lfr_s2_bp_p0 = (unsigned char) DEFAULT_SY_LFR_S2_BP_P0;
750 parameter_dump_packet.sy_lfr_s2_bp_p0 = (unsigned char) DEFAULT_SY_LFR_S2_BP_P0;
531 parameter_dump_packet.sy_lfr_s2_bp_p1 = (unsigned char) DEFAULT_SY_LFR_S2_BP_P1;
751 parameter_dump_packet.sy_lfr_s2_bp_p1 = (unsigned char) DEFAULT_SY_LFR_S2_BP_P1;
532 }
752 }
533
753
534
754
535
755
536
756
537
757
538
758
539
759
General Comments 0
You need to be logged in to leave comments. Login now