@@ -1,339 +1,339 | |||
|
1 | 1 | <?xml version="1.0" encoding="UTF-8"?> |
|
2 | 2 | <!DOCTYPE QtCreatorProject> |
|
3 |
<!-- Written by QtCreator 3.0.0, 2014-02-1 |
|
|
3 | <!-- Written by QtCreator 3.0.0, 2014-02-14T07:07:03. --> | |
|
4 | 4 | <qtcreator> |
|
5 | 5 | <data> |
|
6 | 6 | <variable>ProjectExplorer.Project.ActiveTarget</variable> |
|
7 | 7 | <value type="int">1</value> |
|
8 | 8 | </data> |
|
9 | 9 | <data> |
|
10 | 10 | <variable>ProjectExplorer.Project.EditorSettings</variable> |
|
11 | 11 | <valuemap type="QVariantMap"> |
|
12 | 12 | <value type="bool" key="EditorConfiguration.AutoIndent">true</value> |
|
13 | 13 | <value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value> |
|
14 | 14 | <value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value> |
|
15 | 15 | <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0"> |
|
16 | 16 | <value type="QString" key="language">Cpp</value> |
|
17 | 17 | <valuemap type="QVariantMap" key="value"> |
|
18 | 18 | <value type="QByteArray" key="CurrentPreferences">CppGlobal</value> |
|
19 | 19 | </valuemap> |
|
20 | 20 | </valuemap> |
|
21 | 21 | <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1"> |
|
22 | 22 | <value type="QString" key="language">QmlJS</value> |
|
23 | 23 | <valuemap type="QVariantMap" key="value"> |
|
24 | 24 | <value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value> |
|
25 | 25 | </valuemap> |
|
26 | 26 | </valuemap> |
|
27 | 27 | <value type="int" key="EditorConfiguration.CodeStyle.Count">2</value> |
|
28 | 28 | <value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value> |
|
29 | 29 | <value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value> |
|
30 | 30 | <value type="int" key="EditorConfiguration.IndentSize">4</value> |
|
31 | 31 | <value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value> |
|
32 | 32 | <value type="bool" key="EditorConfiguration.MouseNavigation">true</value> |
|
33 | 33 | <value type="int" key="EditorConfiguration.PaddingMode">1</value> |
|
34 | 34 | <value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value> |
|
35 | 35 | <value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value> |
|
36 | 36 | <value type="bool" key="EditorConfiguration.SpacesForTabs">true</value> |
|
37 | 37 | <value type="int" key="EditorConfiguration.TabKeyBehavior">0</value> |
|
38 | 38 | <value type="int" key="EditorConfiguration.TabSize">8</value> |
|
39 | 39 | <value type="bool" key="EditorConfiguration.UseGlobal">true</value> |
|
40 | 40 | <value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value> |
|
41 | 41 | <value type="bool" key="EditorConfiguration.addFinalNewLine">true</value> |
|
42 | 42 | <value type="bool" key="EditorConfiguration.cleanIndentation">true</value> |
|
43 | 43 | <value type="bool" key="EditorConfiguration.cleanWhitespace">true</value> |
|
44 | 44 | <value type="bool" key="EditorConfiguration.inEntireDocument">false</value> |
|
45 | 45 | </valuemap> |
|
46 | 46 | </data> |
|
47 | 47 | <data> |
|
48 | 48 | <variable>ProjectExplorer.Project.PluginSettings</variable> |
|
49 | 49 | <valuemap type="QVariantMap"/> |
|
50 | 50 | </data> |
|
51 | 51 | <data> |
|
52 | 52 | <variable>ProjectExplorer.Project.Target.0</variable> |
|
53 | 53 | <valuemap type="QVariantMap"> |
|
54 | 54 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop</value> |
|
55 | 55 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop</value> |
|
56 | 56 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{e04e3924-0bd8-4708-be18-f1474e45608e}</value> |
|
57 | 57 | <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value> |
|
58 | 58 | <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value> |
|
59 | 59 | <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value> |
|
60 | 60 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0"> |
|
61 | 61 | <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory"></value> |
|
62 | 62 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> |
|
63 | 63 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> |
|
64 | 64 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
|
65 | 65 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value> |
|
66 | 66 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
67 | 67 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value> |
|
68 | 68 | <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value> |
|
69 | 69 | <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">false</value> |
|
70 | 70 | <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value> |
|
71 | 71 | <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value> |
|
72 | 72 | </valuemap> |
|
73 | 73 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1"> |
|
74 | 74 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
|
75 | 75 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> |
|
76 | 76 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
77 | 77 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> |
|
78 | 78 | <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> |
|
79 | 79 | <value type="QString">-w</value> |
|
80 | 80 | <value type="QString">-r</value> |
|
81 | 81 | </valuelist> |
|
82 | 82 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value> |
|
83 | 83 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value> |
|
84 | 84 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> |
|
85 | 85 | </valuemap> |
|
86 | 86 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value> |
|
87 | 87 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value> |
|
88 | 88 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
89 | 89 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value> |
|
90 | 90 | </valuemap> |
|
91 | 91 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1"> |
|
92 | 92 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> |
|
93 | 93 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
|
94 | 94 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> |
|
95 | 95 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
96 | 96 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> |
|
97 | 97 | <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> |
|
98 | 98 | <value type="QString">-w</value> |
|
99 | 99 | <value type="QString">-r</value> |
|
100 | 100 | </valuelist> |
|
101 | 101 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value> |
|
102 | 102 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value> |
|
103 | 103 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> |
|
104 | 104 | </valuemap> |
|
105 | 105 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value> |
|
106 | 106 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value> |
|
107 | 107 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
108 | 108 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value> |
|
109 | 109 | </valuemap> |
|
110 | 110 | <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value> |
|
111 | 111 | <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value> |
|
112 | 112 | <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/> |
|
113 | 113 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value> |
|
114 | 114 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
115 | 115 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value> |
|
116 | 116 | <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value> |
|
117 | 117 | <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value> |
|
118 | 118 | </valuemap> |
|
119 | 119 | <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">1</value> |
|
120 | 120 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0"> |
|
121 | 121 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> |
|
122 | 122 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value> |
|
123 | 123 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value> |
|
124 | 124 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
125 | 125 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value> |
|
126 | 126 | </valuemap> |
|
127 | 127 | <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value> |
|
128 | 128 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy locally</value> |
|
129 | 129 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
130 | 130 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value> |
|
131 | 131 | </valuemap> |
|
132 | 132 | <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value> |
|
133 | 133 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/> |
|
134 | 134 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0"> |
|
135 | 135 | <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/> |
|
136 | 136 | <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value> |
|
137 | 137 | <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value> |
|
138 | 138 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value> |
|
139 | 139 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value> |
|
140 | 140 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value> |
|
141 | 141 | <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value> |
|
142 | 142 | <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value> |
|
143 | 143 | <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value> |
|
144 | 144 | <value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value> |
|
145 | 145 | <value type="int" key="Analyzer.Valgrind.NumCallers">25</value> |
|
146 | 146 | <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/> |
|
147 | 147 | <value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value> |
|
148 | 148 | <value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value> |
|
149 | 149 | <value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value> |
|
150 | 150 | <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value> |
|
151 | 151 | <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value> |
|
152 | 152 | <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds"> |
|
153 | 153 | <value type="int">0</value> |
|
154 | 154 | <value type="int">1</value> |
|
155 | 155 | <value type="int">2</value> |
|
156 | 156 | <value type="int">3</value> |
|
157 | 157 | <value type="int">4</value> |
|
158 | 158 | <value type="int">5</value> |
|
159 | 159 | <value type="int">6</value> |
|
160 | 160 | <value type="int">7</value> |
|
161 | 161 | <value type="int">8</value> |
|
162 | 162 | <value type="int">9</value> |
|
163 | 163 | <value type="int">10</value> |
|
164 | 164 | <value type="int">11</value> |
|
165 | 165 | <value type="int">12</value> |
|
166 | 166 | <value type="int">13</value> |
|
167 | 167 | <value type="int">14</value> |
|
168 | 168 | </valuelist> |
|
169 | 169 | <value type="int" key="PE.EnvironmentAspect.Base">2</value> |
|
170 | 170 | <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/> |
|
171 | 171 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">fsw-qt</value> |
|
172 | 172 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
173 | 173 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/opt/DEV_PLE/FSW-qt/fsw-qt.pro</value> |
|
174 | 174 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value> |
|
175 | 175 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">fsw-qt.pro</value> |
|
176 | 176 | <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value> |
|
177 | 177 | <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">true</value> |
|
178 | 178 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value> |
|
179 | 179 | <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value> |
|
180 | 180 | <value type="bool" key="RunConfiguration.UseCppDebugger">false</value> |
|
181 | 181 | <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value> |
|
182 | 182 | <value type="bool" key="RunConfiguration.UseMultiProcess">false</value> |
|
183 | 183 | <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value> |
|
184 | 184 | <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value> |
|
185 | 185 | </valuemap> |
|
186 | 186 | <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value> |
|
187 | 187 | </valuemap> |
|
188 | 188 | </data> |
|
189 | 189 | <data> |
|
190 | 190 | <variable>ProjectExplorer.Project.Target.1</variable> |
|
191 | 191 | <valuemap type="QVariantMap"> |
|
192 | 192 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop-Qt 4.8.2 in PATH (System)</value> |
|
193 | 193 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop-Qt 4.8.2 in PATH (System)</value> |
|
194 | 194 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{5289e843-9ef2-45ce-88c6-ad27d8e08def}</value> |
|
195 | 195 | <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value> |
|
196 | 196 | <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value> |
|
197 | 197 | <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value> |
|
198 | 198 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0"> |
|
199 | 199 | <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory"></value> |
|
200 | 200 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> |
|
201 | 201 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> |
|
202 | 202 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
|
203 | 203 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value> |
|
204 | 204 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
205 | 205 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value> |
|
206 | 206 | <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value> |
|
207 | 207 | <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">false</value> |
|
208 | 208 | <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value> |
|
209 | 209 | <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value> |
|
210 | 210 | </valuemap> |
|
211 | 211 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1"> |
|
212 | 212 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
|
213 | 213 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> |
|
214 | 214 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
215 | 215 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> |
|
216 | 216 | <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> |
|
217 | 217 | <value type="QString">-w</value> |
|
218 | 218 | <value type="QString">-r</value> |
|
219 | 219 | </valuelist> |
|
220 | 220 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value> |
|
221 | 221 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value> |
|
222 | 222 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> |
|
223 | 223 | </valuemap> |
|
224 | 224 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value> |
|
225 | 225 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value> |
|
226 | 226 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
227 | 227 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value> |
|
228 | 228 | </valuemap> |
|
229 | 229 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1"> |
|
230 | 230 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> |
|
231 | 231 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
|
232 | 232 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> |
|
233 | 233 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
234 | 234 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> |
|
235 | 235 | <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> |
|
236 | 236 | <value type="QString">-w</value> |
|
237 | 237 | <value type="QString">-r</value> |
|
238 | 238 | </valuelist> |
|
239 | 239 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value> |
|
240 | 240 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value> |
|
241 | 241 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> |
|
242 | 242 | </valuemap> |
|
243 | 243 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value> |
|
244 | 244 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value> |
|
245 | 245 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
246 | 246 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value> |
|
247 | 247 | </valuemap> |
|
248 | 248 | <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value> |
|
249 | 249 | <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value> |
|
250 | 250 | <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/> |
|
251 | 251 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value> |
|
252 | 252 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
253 | 253 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value> |
|
254 | 254 | <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value> |
|
255 | 255 | <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value> |
|
256 | 256 | </valuemap> |
|
257 | 257 | <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">1</value> |
|
258 | 258 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0"> |
|
259 | 259 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> |
|
260 | 260 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value> |
|
261 | 261 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value> |
|
262 | 262 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
263 | 263 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value> |
|
264 | 264 | </valuemap> |
|
265 | 265 | <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value> |
|
266 | 266 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy locally</value> |
|
267 | 267 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
268 | 268 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value> |
|
269 | 269 | </valuemap> |
|
270 | 270 | <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value> |
|
271 | 271 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/> |
|
272 | 272 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0"> |
|
273 | 273 | <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/> |
|
274 | 274 | <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value> |
|
275 | 275 | <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value> |
|
276 | 276 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value> |
|
277 | 277 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value> |
|
278 | 278 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value> |
|
279 | 279 | <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value> |
|
280 | 280 | <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value> |
|
281 | 281 | <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value> |
|
282 | 282 | <value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value> |
|
283 | 283 | <value type="int" key="Analyzer.Valgrind.NumCallers">25</value> |
|
284 | 284 | <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/> |
|
285 | 285 | <value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value> |
|
286 | 286 | <value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value> |
|
287 | 287 | <value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value> |
|
288 | 288 | <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value> |
|
289 | 289 | <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value> |
|
290 | 290 | <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds"> |
|
291 | 291 | <value type="int">0</value> |
|
292 | 292 | <value type="int">1</value> |
|
293 | 293 | <value type="int">2</value> |
|
294 | 294 | <value type="int">3</value> |
|
295 | 295 | <value type="int">4</value> |
|
296 | 296 | <value type="int">5</value> |
|
297 | 297 | <value type="int">6</value> |
|
298 | 298 | <value type="int">7</value> |
|
299 | 299 | <value type="int">8</value> |
|
300 | 300 | <value type="int">9</value> |
|
301 | 301 | <value type="int">10</value> |
|
302 | 302 | <value type="int">11</value> |
|
303 | 303 | <value type="int">12</value> |
|
304 | 304 | <value type="int">13</value> |
|
305 | 305 | <value type="int">14</value> |
|
306 | 306 | </valuelist> |
|
307 | 307 | <value type="int" key="PE.EnvironmentAspect.Base">2</value> |
|
308 | 308 | <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/> |
|
309 | 309 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">fsw-qt</value> |
|
310 | 310 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
311 | 311 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/opt/DEV_PLE/FSW-qt/fsw-qt.pro</value> |
|
312 | 312 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value> |
|
313 | 313 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">fsw-qt.pro</value> |
|
314 | 314 | <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value> |
|
315 | 315 | <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">true</value> |
|
316 | 316 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value> |
|
317 | 317 | <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value> |
|
318 | 318 | <value type="bool" key="RunConfiguration.UseCppDebugger">true</value> |
|
319 | 319 | <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value> |
|
320 | 320 | <value type="bool" key="RunConfiguration.UseMultiProcess">false</value> |
|
321 | 321 | <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value> |
|
322 | 322 | <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value> |
|
323 | 323 | </valuemap> |
|
324 | 324 | <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value> |
|
325 | 325 | </valuemap> |
|
326 | 326 | </data> |
|
327 | 327 | <data> |
|
328 | 328 | <variable>ProjectExplorer.Project.TargetCount</variable> |
|
329 | 329 | <value type="int">2</value> |
|
330 | 330 | </data> |
|
331 | 331 | <data> |
|
332 | 332 | <variable>ProjectExplorer.Project.Updater.EnvironmentId</variable> |
|
333 | 333 | <value type="QByteArray">{2e58a81f-9962-4bba-ae6b-760177f0656c}</value> |
|
334 | 334 | </data> |
|
335 | 335 | <data> |
|
336 | 336 | <variable>ProjectExplorer.Project.Updater.FileVersion</variable> |
|
337 | 337 | <value type="int">15</value> |
|
338 | 338 | </data> |
|
339 | 339 | </qtcreator> |
@@ -1,230 +1,230 | |||
|
1 | 1 | #ifndef FSW_PARAMS_H_INCLUDED |
|
2 | 2 | #define FSW_PARAMS_H_INCLUDED |
|
3 | 3 | |
|
4 | 4 | #include "grlib_regs.h" |
|
5 | 5 | #include "fsw_params_processing.h" |
|
6 | 6 | #include "tm_byte_positions.h" |
|
7 | 7 | #include "ccsds_types.h" |
|
8 | 8 | |
|
9 | 9 | #define GRSPW_DEVICE_NAME "/dev/grspw0" |
|
10 | 10 | #define UART_DEVICE_NAME "/dev/console" |
|
11 | 11 | |
|
12 | 12 | typedef struct ring_node |
|
13 | 13 | { |
|
14 | 14 | struct ring_node *previous; |
|
15 | 15 | int buffer_address; |
|
16 | 16 | struct ring_node *next; |
|
17 | 17 | unsigned int status; |
|
18 | 18 | } ring_node; |
|
19 | 19 | |
|
20 | 20 | typedef struct ring_node_sm |
|
21 | 21 | { |
|
22 | 22 | struct ring_node *previous; |
|
23 | 23 | volatile int *buffer_address; |
|
24 | 24 | struct ring_node *next; |
|
25 | 25 | unsigned int status; |
|
26 | 26 | } ring_node_sm; |
|
27 | 27 | |
|
28 | 28 | //************************ |
|
29 | 29 | // flight software version |
|
30 | 30 | // this parameters is handled by the Qt project options |
|
31 | 31 | |
|
32 | 32 | //#define NB_SAMPLES_PER_SNAPSHOT 2048 |
|
33 | 33 | #define NB_SAMPLES_PER_SNAPSHOT 2352 // 336 * 7 = 2352 |
|
34 | 34 | #define TIME_OFFSET 2 |
|
35 | 35 | #define TIME_OFFSET_IN_BYTES 8 |
|
36 | 36 | #define WAVEFORM_EXTENDED_HEADER_OFFSET 22 |
|
37 | 37 | #define NB_BYTES_SWF_BLK (2 * 6) |
|
38 | 38 | #define NB_WORDS_SWF_BLK 3 |
|
39 | 39 | #define NB_BYTES_CWF3_LIGHT_BLK 6 |
|
40 | 40 | #define WFRM_INDEX_OF_LAST_PACKET 6 // waveforms are transmitted in groups of 2048 blocks, 6 packets of 340 and 1 of 8 |
|
41 | 41 | #define NB_RING_NODES_F0 3 // AT LEAST 3 |
|
42 | 42 | #define NB_RING_NODES_F1 5 // AT LEAST 3 |
|
43 | 43 | #define NB_RING_NODES_F2 5 // AT LEAST 3 |
|
44 |
#define NB_RING_NODES_ASM_F0 12 |
|
|
44 | #define NB_RING_NODES_ASM_F0 12 // AT LEAST 3 | |
|
45 | 45 | #define NB_RING_NODES_ASM_F1 2 // AT LEAST 3 |
|
46 | 46 | #define NB_RING_NODES_ASM_F2 2 // AT LEAST 3 |
|
47 | 47 | |
|
48 | 48 | //********** |
|
49 | 49 | // LFR MODES |
|
50 | 50 | #define LFR_MODE_STANDBY 0 |
|
51 | 51 | #define LFR_MODE_NORMAL 1 |
|
52 | 52 | #define LFR_MODE_BURST 2 |
|
53 | 53 | #define LFR_MODE_SBM1 3 |
|
54 | 54 | #define LFR_MODE_SBM2 4 |
|
55 | 55 | #define LFR_MODE_NORMAL_CWF_F3 5 |
|
56 | 56 | |
|
57 | 57 | #define RTEMS_EVENT_MODE_STANDBY RTEMS_EVENT_0 |
|
58 | 58 | #define RTEMS_EVENT_MODE_NORMAL RTEMS_EVENT_1 |
|
59 | 59 | #define RTEMS_EVENT_MODE_BURST RTEMS_EVENT_2 |
|
60 | 60 | #define RTEMS_EVENT_MODE_SBM1 RTEMS_EVENT_3 |
|
61 | 61 | #define RTEMS_EVENT_MODE_SBM2 RTEMS_EVENT_4 |
|
62 | 62 | #define RTEMS_EVENT_MODE_SBM2_WFRM RTEMS_EVENT_5 |
|
63 | 63 | #define RTEMS_EVENT_MODE_NORMAL_SWF_F0 RTEMS_EVENT_6 |
|
64 | 64 | #define RTEMS_EVENT_MODE_NORMAL_SWF_F1 RTEMS_EVENT_7 |
|
65 | 65 | #define RTEMS_EVENT_MODE_NORMAL_SWF_F2 RTEMS_EVENT_8 |
|
66 | 66 | |
|
67 | 67 | //**************************** |
|
68 | 68 | // LFR DEFAULT MODE PARAMETERS |
|
69 | 69 | // COMMON |
|
70 | 70 | #define DEFAULT_SY_LFR_COMMON0 0x00 |
|
71 | 71 | #define DEFAULT_SY_LFR_COMMON1 0x10 // default value 0 0 0 1 0 0 0 0 |
|
72 | 72 | // NORM |
|
73 | 73 | #define SY_LFR_N_SWF_L 2048 // nb sample |
|
74 |
#define SY_LFR_N_SWF_P |
|
|
74 | #define SY_LFR_N_SWF_P 300 // sec | |
|
75 | 75 | #define SY_LFR_N_ASM_P 3600 // sec |
|
76 | 76 | #define SY_LFR_N_BP_P0 4 // sec |
|
77 | 77 | #define SY_LFR_N_BP_P1 20 // sec |
|
78 | 78 | #define MIN_DELTA_SNAPSHOT 16 // sec |
|
79 | 79 | // BURST |
|
80 | 80 | #define DEFAULT_SY_LFR_B_BP_P0 1 // sec |
|
81 | 81 | #define DEFAULT_SY_LFR_B_BP_P1 5 // sec |
|
82 | 82 | // SBM1 |
|
83 | 83 | #define DEFAULT_SY_LFR_S1_BP_P0 1 // sec |
|
84 | 84 | #define DEFAULT_SY_LFR_S1_BP_P1 1 // sec |
|
85 | 85 | // SBM2 |
|
86 | 86 | #define DEFAULT_SY_LFR_S2_BP_P0 1 // sec |
|
87 | 87 | #define DEFAULT_SY_LFR_S2_BP_P1 5 // sec |
|
88 | 88 | // ADDITIONAL PARAMETERS |
|
89 | 89 | #define TIME_BETWEEN_TWO_SWF_PACKETS 30 // nb x 10 ms => 300 ms |
|
90 | 90 | #define TIME_BETWEEN_TWO_CWF3_PACKETS 1000 // nb x 10 ms => 10 s |
|
91 | 91 | // STATUS WORD |
|
92 | 92 | #define DEFAULT_STATUS_WORD_BYTE0 0x0d // [0000] [1] [101] mode 4 bits / SPW enabled 1 bit / state is run 3 bits |
|
93 | 93 | #define DEFAULT_STATUS_WORD_BYTE1 0x00 |
|
94 | 94 | // |
|
95 | 95 | #define SY_LFR_DPU_CONNECT_TIMEOUT 100 // 100 * 10 ms = 1 s |
|
96 | 96 | #define SY_LFR_DPU_CONNECT_ATTEMPT 3 |
|
97 | 97 | //**************************** |
|
98 | 98 | |
|
99 | 99 | //***************************** |
|
100 | 100 | // APB REGISTERS BASE ADDRESSES |
|
101 | 101 | #define REGS_ADDR_APBUART 0x80000100 |
|
102 | 102 | #define REGS_ADDR_GPTIMER 0x80000300 |
|
103 | 103 | #define REGS_ADDR_GRSPW 0x80000500 |
|
104 | 104 | #define REGS_ADDR_TIME_MANAGEMENT 0x80000600 |
|
105 | 105 | #define REGS_ADDR_SPECTRAL_MATRIX 0x80000f00 |
|
106 | 106 | |
|
107 | 107 | #ifdef GSA |
|
108 | 108 | #else |
|
109 | 109 | #define REGS_ADDR_WAVEFORM_PICKER 0x80000f20 |
|
110 | 110 | #endif |
|
111 | 111 | |
|
112 | 112 | #define APBUART_CTRL_REG_MASK_DB 0xfffff7ff |
|
113 | 113 | #define APBUART_CTRL_REG_MASK_TE 0x00000002 |
|
114 | 114 | #define APBUART_SCALER_RELOAD_VALUE 0x00000050 // 25 MHz => about 38400 (0x50) |
|
115 | 115 | |
|
116 | 116 | //********** |
|
117 | 117 | // IRQ LINES |
|
118 | 118 | #define IRQ_SM 9 |
|
119 | 119 | #define IRQ_SPARC_SM 0x19 // see sparcv8.pdf p.76 for interrupt levels |
|
120 | 120 | #define IRQ_WF 10 |
|
121 | 121 | #define IRQ_SPARC_WF 0x1a // see sparcv8.pdf p.76 for interrupt levels |
|
122 | 122 | #define IRQ_TIME1 12 |
|
123 | 123 | #define IRQ_SPARC_TIME1 0x1c // see sparcv8.pdf p.76 for interrupt levels |
|
124 | 124 | #define IRQ_TIME2 13 |
|
125 | 125 | #define IRQ_SPARC_TIME2 0x1d // see sparcv8.pdf p.76 for interrupt levels |
|
126 | 126 | #define IRQ_WAVEFORM_PICKER 14 |
|
127 | 127 | #define IRQ_SPARC_WAVEFORM_PICKER 0x1e // see sparcv8.pdf p.76 for interrupt levels |
|
128 | 128 | #define IRQ_SPECTRAL_MATRIX 6 |
|
129 | 129 | #define IRQ_SPARC_SPECTRAL_MATRIX 0x16 // see sparcv8.pdf p.76 for interrupt levels |
|
130 | 130 | |
|
131 | 131 | //***** |
|
132 | 132 | // TIME |
|
133 | 133 | #define CLKDIV_SM_SIMULATOR (10000 - 1) // 10 ms |
|
134 | 134 | #define CLKDIV_WF_SIMULATOR (10000000 - 1) // 10 000 000 * 1 us = 10 s |
|
135 | 135 | #define TIMER_SM_SIMULATOR 1 |
|
136 | 136 | #define TIMER_WF_SIMULATOR 2 |
|
137 | 137 | #define HK_PERIOD 100 // 100 * 10ms => 1sec |
|
138 | 138 | |
|
139 | 139 | //********** |
|
140 | 140 | // LPP CODES |
|
141 | 141 | #define LFR_SUCCESSFUL 0 |
|
142 | 142 | #define LFR_DEFAULT 1 |
|
143 | 143 | |
|
144 | 144 | //****** |
|
145 | 145 | // RTEMS |
|
146 | 146 | #define TASKID_RECV 1 |
|
147 | 147 | #define TASKID_ACTN 2 |
|
148 | 148 | #define TASKID_SPIQ 3 |
|
149 | 149 | #define TASKID_SMIQ 4 |
|
150 | 150 | #define TASKID_STAT 5 |
|
151 | 151 | #define TASKID_AVF0 6 |
|
152 | 152 | #define TASKID_BPF0 7 |
|
153 | 153 | #define TASKID_WFRM 8 |
|
154 | 154 | #define TASKID_DUMB 9 |
|
155 | 155 | #define TASKID_HOUS 10 |
|
156 | 156 | #define TASKID_MATR 11 |
|
157 | 157 | #define TASKID_CWF3 12 |
|
158 | 158 | #define TASKID_CWF2 13 |
|
159 | 159 | #define TASKID_CWF1 14 |
|
160 | 160 | #define TASKID_SEND 15 |
|
161 | 161 | #define TASKID_WTDG 16 |
|
162 | 162 | |
|
163 | 163 | #define TASK_PRIORITY_SPIQ 5 |
|
164 | 164 | #define TASK_PRIORITY_SMIQ 10 |
|
165 | 165 | #define TASK_PRIORITY_WTDG 20 |
|
166 | 166 | #define TASK_PRIORITY_HOUS 30 |
|
167 | 167 | #define TASK_PRIORITY_CWF1 35 // CWF1 and CWF2 are never running together |
|
168 | 168 | #define TASK_PRIORITY_CWF2 35 // |
|
169 | 169 | #define TASK_PRIORITY_WFRM 40 |
|
170 | 170 | #define TASK_PRIORITY_CWF3 40 // there is a printf in this function, be careful with its priority wrt CWF1 |
|
171 | 171 | #define TASK_PRIORITY_SEND 45 |
|
172 | 172 | #define TASK_PRIORITY_RECV 50 |
|
173 | 173 | #define TASK_PRIORITY_ACTN 50 |
|
174 | 174 | #define TASK_PRIORITY_AVF0 60 |
|
175 | 175 | #define TASK_PRIORITY_BPF0 60 |
|
176 | 176 | #define TASK_PRIORITY_MATR 100 |
|
177 | 177 | #define TASK_PRIORITY_STAT 200 |
|
178 | 178 | #define TASK_PRIORITY_DUMB 200 |
|
179 | 179 | |
|
180 | 180 | #define ACTION_MSG_QUEUE_COUNT 10 |
|
181 | 181 | #define ACTION_MSG_PKTS_COUNT 50 |
|
182 | 182 | #define ACTION_MSG_PKTS_MAX_SIZE (PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES) |
|
183 | 183 | #define ACTION_MSG_SPW_IOCTL_SEND_SIZE 24 // hlen *hdr dlen *data sent options |
|
184 | 184 | |
|
185 | 185 | #define QUEUE_RECV 0 |
|
186 | 186 | #define QUEUE_SEND 1 |
|
187 | 187 | |
|
188 | 188 | //******* |
|
189 | 189 | // MACROS |
|
190 | 190 | #ifdef PRINT_MESSAGES_ON_CONSOLE |
|
191 | 191 | #define PRINTF(x) printf(x); |
|
192 | 192 | #define PRINTF1(x,y) printf(x,y); |
|
193 | 193 | #define PRINTF2(x,y,z) printf(x,y,z); |
|
194 | 194 | #else |
|
195 | 195 | #define PRINTF(x) ; |
|
196 | 196 | #define PRINTF1(x,y) ; |
|
197 | 197 | #define PRINTF2(x,y,z) ; |
|
198 | 198 | #endif |
|
199 | 199 | |
|
200 | 200 | #ifdef BOOT_MESSAGES |
|
201 | 201 | #define BOOT_PRINTF(x) printf(x); |
|
202 | 202 | #define BOOT_PRINTF1(x,y) printf(x,y); |
|
203 | 203 | #define BOOT_PRINTF2(x,y,z) printf(x,y,z); |
|
204 | 204 | #else |
|
205 | 205 | #define BOOT_PRINTF(x) ; |
|
206 | 206 | #define BOOT_PRINTF1(x,y) ; |
|
207 | 207 | #define BOOT_PRINTF2(x,y,z) ; |
|
208 | 208 | #endif |
|
209 | 209 | |
|
210 | 210 | #ifdef DEBUG_MESSAGES |
|
211 | 211 | #define DEBUG_PRINTF(x) printf(x); |
|
212 | 212 | #define DEBUG_PRINTF1(x,y) printf(x,y); |
|
213 | 213 | #define DEBUG_PRINTF2(x,y,z) printf(x,y,z); |
|
214 | 214 | #else |
|
215 | 215 | #define DEBUG_PRINTF(x) ; |
|
216 | 216 | #define DEBUG_PRINTF1(x,y) ; |
|
217 | 217 | #define DEBUG_PRINTF2(x,y,z) ; |
|
218 | 218 | #endif |
|
219 | 219 | |
|
220 | 220 | #define CPU_USAGE_REPORT_PERIOD 6 // * 10 s = period |
|
221 | 221 | |
|
222 | 222 | struct param_local_str{ |
|
223 | 223 | unsigned int local_sbm1_nb_cwf_sent; |
|
224 | 224 | unsigned int local_sbm1_nb_cwf_max; |
|
225 | 225 | unsigned int local_sbm2_nb_cwf_sent; |
|
226 | 226 | unsigned int local_sbm2_nb_cwf_max; |
|
227 | 227 | unsigned int local_nb_interrupt_f0_MAX; |
|
228 | 228 | }; |
|
229 | 229 | |
|
230 | 230 | #endif // FSW_PARAMS_H_INCLUDED |
@@ -1,92 +1,93 | |||
|
1 | 1 | #ifndef WF_HANDLER_H_INCLUDED |
|
2 | 2 | #define WF_HANDLER_H_INCLUDED |
|
3 | 3 | |
|
4 | 4 | #include <rtems.h> |
|
5 | 5 | #include <grspw.h> |
|
6 | 6 | #include <stdio.h> |
|
7 | 7 | #include <math.h> |
|
8 | 8 | |
|
9 | 9 | #include "fsw_params.h" |
|
10 | 10 | #include "fsw_spacewire.h" |
|
11 | 11 | #include "fsw_misc.h" |
|
12 | 12 | |
|
13 | 13 | #define pi 3.1415 |
|
14 | 14 | |
|
15 | 15 | extern int fdSPW; |
|
16 | 16 | |
|
17 | 17 | //***************** |
|
18 | 18 | // waveform buffers |
|
19 | 19 | // F0 |
|
20 | 20 | //extern volatile int wf_snap_f0[ ]; |
|
21 | 21 | // F1 F2 |
|
22 | 22 | extern volatile int wf_snap_f0[ ][ (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK) + TIME_OFFSET + 46 ]; |
|
23 | 23 | extern volatile int wf_snap_f1[ ][ (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK) + TIME_OFFSET + 46 ]; |
|
24 | 24 | extern volatile int wf_snap_f2[ ][ (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK) + TIME_OFFSET + 46 ]; |
|
25 | 25 | // F3 |
|
26 | 26 | extern volatile int wf_cont_f3_a[ ]; |
|
27 | 27 | extern volatile int wf_cont_f3_b[ ]; |
|
28 | 28 | extern char wf_cont_f3_light[ ]; |
|
29 | 29 | |
|
30 | 30 | #ifdef VHDL_DEV |
|
31 | 31 | extern waveform_picker_regs_new_t *waveform_picker_regs; |
|
32 | 32 | #else |
|
33 | 33 | extern waveform_picker_regs_t *waveform_picker_regs; |
|
34 | 34 | #endif |
|
35 | 35 | extern time_management_regs_t *time_management_regs; |
|
36 | 36 | extern Packet_TM_LFR_HK_t housekeeping_packet; |
|
37 | 37 | extern Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet; |
|
38 | 38 | extern struct param_local_str param_local; |
|
39 | 39 | |
|
40 | 40 | extern unsigned short sequenceCounters_SCIENCE_NORMAL_BURST; |
|
41 | 41 | extern unsigned short sequenceCounters_SCIENCE_SBM1_SBM2; |
|
42 | 42 | |
|
43 | 43 | extern rtems_id Task_id[20]; /* array of task ids */ |
|
44 | 44 | |
|
45 | 45 | extern unsigned char lfrCurrentMode; |
|
46 | 46 | |
|
47 | 47 | rtems_isr waveforms_isr( rtems_vector_number vector ); |
|
48 | 48 | rtems_isr waveforms_isr_alt( rtems_vector_number vector ); |
|
49 | 49 | rtems_task wfrm_task( rtems_task_argument argument ); |
|
50 | 50 | rtems_task cwf3_task( rtems_task_argument argument ); |
|
51 | 51 | rtems_task cwf2_task( rtems_task_argument argument ); |
|
52 | 52 | rtems_task cwf1_task( rtems_task_argument argument ); |
|
53 | 53 | |
|
54 | 54 | //****************** |
|
55 | 55 | // general functions |
|
56 | 56 | void init_waveforms( void ); |
|
57 | 57 | void init_waveform_rings( void ); |
|
58 | 58 | void reset_current_ring_nodes( void ); |
|
59 | 59 | // |
|
60 | 60 | int init_header_snapshot_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF ); |
|
61 | 61 | int init_header_continuous_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF ); |
|
62 | 62 | int init_header_continuous_cwf3_light_table( Header_TM_LFR_SCIENCE_CWF_t *headerCWF ); |
|
63 | 63 | // |
|
64 | 64 | int send_waveform_SWF( volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF, rtems_id queue_id ); |
|
65 | 65 | int send_waveform_CWF( volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id ); |
|
66 | 66 | int send_waveform_CWF3( volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id ); |
|
67 | 67 | int send_waveform_CWF3_light( volatile int *waveform, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id ); |
|
68 | 68 | // |
|
69 | 69 | void compute_acquisition_time(unsigned int *coarseTime, unsigned int *fineTime, unsigned int sid, unsigned char pa_lfr_pkt_nr ); |
|
70 | 70 | // |
|
71 | 71 | rtems_id get_pkts_queue_id( void ); |
|
72 | 72 | |
|
73 | 73 | //************** |
|
74 | 74 | // wfp registers |
|
75 | void set_wfp_data_shaping(); | |
|
76 | char set_wfp_delta_snapshot(); | |
|
75 | // RESET | |
|
76 | void reset_wfp_burst_enable( void ); | |
|
77 | void reset_wfp_status(void); | |
|
78 | void reset_waveform_picker_regs( void ); | |
|
79 | // SET | |
|
80 | void set_wfp_data_shaping(void); | |
|
77 | 81 | void set_wfp_burst_enable_register( unsigned char mode ); |
|
78 | void reset_wfp_burst_enable(); | |
|
79 |
void |
|
|
80 | void reset_waveform_picker_regs_vhdl_dev(); | |
|
81 | void reset_waveform_picker_regs_vhdl_dev_debug(); | |
|
82 | void reset_waveform_picker_regs_vhdl_dev_debug_64(); | |
|
83 | void reset_waveform_picker_regs(); | |
|
84 | void reset_new_waveform_picker_regs(); | |
|
82 | void set_wfp_delta_snapshot( void ); | |
|
83 | void set_wfp_delta_f0_f0_2( void ); | |
|
84 | void set_wfp_delta_f1( void ); | |
|
85 | void set_wfp_delta_f2( void ); | |
|
85 | 86 | |
|
86 | 87 | //***************** |
|
87 | 88 | // local parameters |
|
88 | 89 | void set_local_nb_interrupt_f0_MAX( void ); |
|
89 | 90 | |
|
90 | 91 | void increment_seq_counter_source_id( unsigned char *packet_sequence_control, unsigned int sid ); |
|
91 | 92 | |
|
92 | 93 | #endif // WF_HANDLER_H_INCLUDED |
@@ -1,837 +1,837 | |||
|
1 | 1 | /** Functions and tasks related to TeleCommand handling. |
|
2 | 2 | * |
|
3 | 3 | * @file |
|
4 | 4 | * @author P. LEROY |
|
5 | 5 | * |
|
6 | 6 | * A group of functions to handle TeleCommands:\n |
|
7 | 7 | * action launching\n |
|
8 | 8 | * TC parsing\n |
|
9 | 9 | * ... |
|
10 | 10 | * |
|
11 | 11 | */ |
|
12 | 12 | |
|
13 | 13 | #include "tc_handler.h" |
|
14 | 14 | |
|
15 | 15 | //*********** |
|
16 | 16 | // RTEMS TASK |
|
17 | 17 | |
|
18 | 18 | rtems_task actn_task( rtems_task_argument unused ) |
|
19 | 19 | { |
|
20 | 20 | /** This RTEMS task is responsible for launching actions upton the reception of valid TeleCommands. |
|
21 | 21 | * |
|
22 | 22 | * @param unused is the starting argument of the RTEMS task |
|
23 | 23 | * |
|
24 | 24 | * The ACTN task waits for data coming from an RTEMS msesage queue. When data arrives, it launches specific actions depending |
|
25 | 25 | * on the incoming TeleCommand. |
|
26 | 26 | * |
|
27 | 27 | */ |
|
28 | 28 | |
|
29 | 29 | int result; |
|
30 | 30 | rtems_status_code status; // RTEMS status code |
|
31 | 31 | ccsdsTelecommandPacket_t TC; // TC sent to the ACTN task |
|
32 | 32 | size_t size; // size of the incoming TC packet |
|
33 | 33 | unsigned char subtype; // subtype of the current TC packet |
|
34 | 34 | unsigned char time[6]; |
|
35 | 35 | rtems_id queue_rcv_id; |
|
36 | 36 | rtems_id queue_snd_id; |
|
37 | 37 | |
|
38 | 38 | status = get_message_queue_id_recv( &queue_rcv_id ); |
|
39 | 39 | if (status != RTEMS_SUCCESSFUL) |
|
40 | 40 | { |
|
41 | 41 | PRINTF1("in ACTN *** ERR get_message_queue_id_recv %d\n", status) |
|
42 | 42 | } |
|
43 | 43 | |
|
44 | 44 | status = get_message_queue_id_send( &queue_snd_id ); |
|
45 | 45 | if (status != RTEMS_SUCCESSFUL) |
|
46 | 46 | { |
|
47 | 47 | PRINTF1("in ACTN *** ERR get_message_queue_id_send %d\n", status) |
|
48 | 48 | } |
|
49 | 49 | |
|
50 | 50 | result = LFR_SUCCESSFUL; |
|
51 | 51 | subtype = 0; // subtype of the current TC packet |
|
52 | 52 | |
|
53 | 53 | BOOT_PRINTF("in ACTN *** \n") |
|
54 | 54 | |
|
55 | 55 | while(1) |
|
56 | 56 | { |
|
57 | 57 | status = rtems_message_queue_receive( queue_rcv_id, (char*) &TC, &size, |
|
58 | 58 | RTEMS_WAIT, RTEMS_NO_TIMEOUT); |
|
59 | 59 | getTime( time ); // set time to the current time |
|
60 | 60 | if (status!=RTEMS_SUCCESSFUL) |
|
61 | 61 | { |
|
62 | 62 | PRINTF1("ERR *** in task ACTN *** error receiving a message, code %d \n", status) |
|
63 | 63 | } |
|
64 | 64 | else |
|
65 | 65 | { |
|
66 | 66 | subtype = TC.serviceSubType; |
|
67 | 67 | switch(subtype) |
|
68 | 68 | { |
|
69 | 69 | case TC_SUBTYPE_RESET: |
|
70 | 70 | result = action_reset( &TC, queue_snd_id, time ); |
|
71 | 71 | close_action( &TC, result, queue_snd_id, time ); |
|
72 | 72 | break; |
|
73 | 73 | // |
|
74 | 74 | case TC_SUBTYPE_LOAD_COMM: |
|
75 | 75 | result = action_load_common_par( &TC ); |
|
76 | 76 | close_action( &TC, result, queue_snd_id, time ); |
|
77 | 77 | break; |
|
78 | 78 | // |
|
79 | 79 | case TC_SUBTYPE_LOAD_NORM: |
|
80 | 80 | result = action_load_normal_par( &TC, queue_snd_id, time ); |
|
81 | 81 | close_action( &TC, result, queue_snd_id, time ); |
|
82 | 82 | break; |
|
83 | 83 | // |
|
84 | 84 | case TC_SUBTYPE_LOAD_BURST: |
|
85 | 85 | result = action_load_burst_par( &TC, queue_snd_id, time ); |
|
86 | 86 | close_action( &TC, result, queue_snd_id, time ); |
|
87 | 87 | break; |
|
88 | 88 | // |
|
89 | 89 | case TC_SUBTYPE_LOAD_SBM1: |
|
90 | 90 | result = action_load_sbm1_par( &TC, queue_snd_id, time ); |
|
91 | 91 | close_action( &TC, result, queue_snd_id, time ); |
|
92 | 92 | break; |
|
93 | 93 | // |
|
94 | 94 | case TC_SUBTYPE_LOAD_SBM2: |
|
95 | 95 | result = action_load_sbm2_par( &TC, queue_snd_id, time ); |
|
96 | 96 | close_action( &TC, result, queue_snd_id, time ); |
|
97 | 97 | break; |
|
98 | 98 | // |
|
99 | 99 | case TC_SUBTYPE_DUMP: |
|
100 | 100 | result = action_dump_par( queue_snd_id ); |
|
101 | 101 | close_action( &TC, result, queue_snd_id, time ); |
|
102 | 102 | break; |
|
103 | 103 | // |
|
104 | 104 | case TC_SUBTYPE_ENTER: |
|
105 | 105 | result = action_enter_mode( &TC, queue_snd_id, time ); |
|
106 | 106 | close_action( &TC, result, queue_snd_id, time ); |
|
107 | 107 | break; |
|
108 | 108 | // |
|
109 | 109 | case TC_SUBTYPE_UPDT_INFO: |
|
110 | 110 | result = action_update_info( &TC, queue_snd_id ); |
|
111 | 111 | close_action( &TC, result, queue_snd_id, time ); |
|
112 | 112 | break; |
|
113 | 113 | // |
|
114 | 114 | case TC_SUBTYPE_EN_CAL: |
|
115 | 115 | result = action_enable_calibration( &TC, queue_snd_id, time ); |
|
116 | 116 | close_action( &TC, result, queue_snd_id, time ); |
|
117 | 117 | break; |
|
118 | 118 | // |
|
119 | 119 | case TC_SUBTYPE_DIS_CAL: |
|
120 | 120 | result = action_disable_calibration( &TC, queue_snd_id, time ); |
|
121 | 121 | close_action( &TC, result, queue_snd_id, time ); |
|
122 | 122 | break; |
|
123 | 123 | // |
|
124 | 124 | case TC_SUBTYPE_UPDT_TIME: |
|
125 | 125 | result = action_update_time( &TC ); |
|
126 | 126 | close_action( &TC, result, queue_snd_id, time ); |
|
127 | 127 | break; |
|
128 | 128 | // |
|
129 | 129 | default: |
|
130 | 130 | break; |
|
131 | 131 | } |
|
132 | 132 | } |
|
133 | 133 | } |
|
134 | 134 | } |
|
135 | 135 | |
|
136 | 136 | //*********** |
|
137 | 137 | // TC ACTIONS |
|
138 | 138 | |
|
139 | 139 | int action_reset(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time) |
|
140 | 140 | { |
|
141 | 141 | /** This function executes specific actions when a TC_LFR_RESET TeleCommand has been received. |
|
142 | 142 | * |
|
143 | 143 | * @param TC points to the TeleCommand packet that is being processed |
|
144 | 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 | 148 | send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time ); |
|
149 | 149 | return LFR_DEFAULT; |
|
150 | 150 | } |
|
151 | 151 | |
|
152 | 152 | int action_enter_mode(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time) |
|
153 | 153 | { |
|
154 | 154 | /** This function executes specific actions when a TC_LFR_ENTER_MODE TeleCommand has been received. |
|
155 | 155 | * |
|
156 | 156 | * @param TC points to the TeleCommand packet that is being processed |
|
157 | 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 | 161 | rtems_status_code status; |
|
162 | 162 | unsigned char requestedMode; |
|
163 | 163 | |
|
164 | 164 | requestedMode = TC->dataAndCRC[1]; |
|
165 | 165 | |
|
166 | 166 | if ( (requestedMode != LFR_MODE_STANDBY) |
|
167 | 167 | && (requestedMode != LFR_MODE_NORMAL) && (requestedMode != LFR_MODE_BURST) |
|
168 | 168 | && (requestedMode != LFR_MODE_SBM1) && (requestedMode != LFR_MODE_SBM2) ) |
|
169 | 169 | { |
|
170 | 170 | status = RTEMS_UNSATISFIED; |
|
171 | 171 | send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_CP_LFR_MODE, requestedMode, time ); |
|
172 | 172 | } |
|
173 | 173 | else |
|
174 | 174 | { |
|
175 | 175 | printf("in action_enter_mode *** enter mode %d\n", requestedMode); |
|
176 | 176 | |
|
177 | 177 | #ifdef PRINT_TASK_STATISTICS |
|
178 | 178 | if (requestedMode != LFR_MODE_STANDBY) |
|
179 | 179 | { |
|
180 | 180 | rtems_cpu_usage_reset(); |
|
181 | 181 | maxCount = 0; |
|
182 | 182 | } |
|
183 | 183 | #endif |
|
184 | 184 | |
|
185 | 185 | status = transition_validation(requestedMode); |
|
186 | 186 | |
|
187 | 187 | if ( status == LFR_SUCCESSFUL ) { |
|
188 | 188 | if ( lfrCurrentMode != LFR_MODE_STANDBY) |
|
189 | 189 | { |
|
190 | 190 | status = stop_current_mode(); |
|
191 | 191 | } |
|
192 | 192 | if (status != RTEMS_SUCCESSFUL) |
|
193 | 193 | { |
|
194 | 194 | PRINTF("ERR *** in action_enter *** stop_current_mode\n") |
|
195 | 195 | } |
|
196 | 196 | status = enter_mode( requestedMode ); |
|
197 | 197 | } |
|
198 | 198 | else |
|
199 | 199 | { |
|
200 | 200 | PRINTF("ERR *** in action_enter *** transition rejected\n") |
|
201 | 201 | send_tm_lfr_tc_exe_not_executable( TC, queue_id, time ); |
|
202 | 202 | } |
|
203 | 203 | } |
|
204 | 204 | |
|
205 | 205 | return status; |
|
206 | 206 | } |
|
207 | 207 | |
|
208 | 208 | int action_update_info(ccsdsTelecommandPacket_t *TC, rtems_id queue_id) |
|
209 | 209 | { |
|
210 | 210 | /** This function executes specific actions when a TC_LFR_UPDATE_INFO TeleCommand has been received. |
|
211 | 211 | * |
|
212 | 212 | * @param TC points to the TeleCommand packet that is being processed |
|
213 | 213 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver |
|
214 | 214 | * |
|
215 | 215 | * @return LFR directive status code: |
|
216 | 216 | * - LFR_DEFAULT |
|
217 | 217 | * - LFR_SUCCESSFUL |
|
218 | 218 | * |
|
219 | 219 | */ |
|
220 | 220 | |
|
221 | 221 | unsigned int val; |
|
222 | 222 | int result; |
|
223 | 223 | |
|
224 | 224 | result = LFR_SUCCESSFUL; |
|
225 | 225 | |
|
226 | 226 | val = housekeeping_packet.hk_lfr_update_info_tc_cnt[0] * 256 |
|
227 | 227 | + housekeeping_packet.hk_lfr_update_info_tc_cnt[1]; |
|
228 | 228 | val++; |
|
229 | 229 | housekeeping_packet.hk_lfr_update_info_tc_cnt[0] = (unsigned char) (val >> 8); |
|
230 | 230 | housekeeping_packet.hk_lfr_update_info_tc_cnt[1] = (unsigned char) (val); |
|
231 | 231 | |
|
232 | 232 | return result; |
|
233 | 233 | } |
|
234 | 234 | |
|
235 | 235 | int action_enable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time) |
|
236 | 236 | { |
|
237 | 237 | /** This function executes specific actions when a TC_LFR_ENABLE_CALIBRATION TeleCommand has been received. |
|
238 | 238 | * |
|
239 | 239 | * @param TC points to the TeleCommand packet that is being processed |
|
240 | 240 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver |
|
241 | 241 | * |
|
242 | 242 | */ |
|
243 | 243 | |
|
244 | 244 | int result; |
|
245 | 245 | unsigned char lfrMode; |
|
246 | 246 | |
|
247 | 247 | result = LFR_DEFAULT; |
|
248 | 248 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; |
|
249 | 249 | |
|
250 | 250 | if ( (lfrMode == LFR_MODE_STANDBY) || (lfrMode == LFR_MODE_BURST) || (lfrMode == LFR_MODE_SBM2) ) { |
|
251 | 251 | send_tm_lfr_tc_exe_not_executable( TC, queue_id, time ); |
|
252 | 252 | result = LFR_DEFAULT; |
|
253 | 253 | } |
|
254 | 254 | else { |
|
255 | 255 | send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time ); |
|
256 | 256 | result = LFR_DEFAULT; |
|
257 | 257 | } |
|
258 | 258 | return result; |
|
259 | 259 | } |
|
260 | 260 | |
|
261 | 261 | int action_disable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time) |
|
262 | 262 | { |
|
263 | 263 | /** This function executes specific actions when a TC_LFR_DISABLE_CALIBRATION TeleCommand has been received. |
|
264 | 264 | * |
|
265 | 265 | * @param TC points to the TeleCommand packet that is being processed |
|
266 | 266 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver |
|
267 | 267 | * |
|
268 | 268 | */ |
|
269 | 269 | |
|
270 | 270 | int result; |
|
271 | 271 | unsigned char lfrMode; |
|
272 | 272 | |
|
273 | 273 | result = LFR_DEFAULT; |
|
274 | 274 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; |
|
275 | 275 | |
|
276 | 276 | if ( (lfrMode == LFR_MODE_STANDBY) || (lfrMode == LFR_MODE_BURST) || (lfrMode == LFR_MODE_SBM2) ) { |
|
277 | 277 | send_tm_lfr_tc_exe_not_executable( TC, queue_id, time ); |
|
278 | 278 | result = LFR_DEFAULT; |
|
279 | 279 | } |
|
280 | 280 | else { |
|
281 | 281 | send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time ); |
|
282 | 282 | result = LFR_DEFAULT; |
|
283 | 283 | } |
|
284 | 284 | return result; |
|
285 | 285 | } |
|
286 | 286 | |
|
287 | 287 | int action_update_time(ccsdsTelecommandPacket_t *TC) |
|
288 | 288 | { |
|
289 | 289 | /** This function executes specific actions when a TC_LFR_UPDATE_TIME TeleCommand has been received. |
|
290 | 290 | * |
|
291 | 291 | * @param TC points to the TeleCommand packet that is being processed |
|
292 | 292 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver |
|
293 | 293 | * |
|
294 | 294 | * @return LFR_SUCCESSFUL |
|
295 | 295 | * |
|
296 | 296 | */ |
|
297 | 297 | |
|
298 | 298 | unsigned int val; |
|
299 | 299 | |
|
300 | 300 | time_management_regs->coarse_time_load = (TC->dataAndCRC[0] << 24) |
|
301 | 301 | + (TC->dataAndCRC[1] << 16) |
|
302 | 302 | + (TC->dataAndCRC[2] << 8) |
|
303 | 303 | + TC->dataAndCRC[3]; |
|
304 | 304 | val = housekeeping_packet.hk_lfr_update_time_tc_cnt[0] * 256 |
|
305 | 305 | + housekeeping_packet.hk_lfr_update_time_tc_cnt[1]; |
|
306 | 306 | val++; |
|
307 | 307 | housekeeping_packet.hk_lfr_update_time_tc_cnt[0] = (unsigned char) (val >> 8); |
|
308 | 308 | housekeeping_packet.hk_lfr_update_time_tc_cnt[1] = (unsigned char) (val); |
|
309 | 309 | time_management_regs->ctrl = time_management_regs->ctrl | 1; |
|
310 | 310 | |
|
311 | 311 | return LFR_SUCCESSFUL; |
|
312 | 312 | } |
|
313 | 313 | |
|
314 | 314 | //******************* |
|
315 | 315 | // ENTERING THE MODES |
|
316 | 316 | |
|
317 | 317 | int transition_validation(unsigned char requestedMode) |
|
318 | 318 | { |
|
319 | 319 | /** This function checks the validity of the transition requested by the TC_LFR_ENTER_MODE. |
|
320 | 320 | * |
|
321 | 321 | * @param requestedMode is the mode requested by the TC_LFR_ENTER_MODE |
|
322 | 322 | * |
|
323 | 323 | * @return LFR directive status codes: |
|
324 | 324 | * - LFR_SUCCESSFUL - the transition is authorized |
|
325 | 325 | * - LFR_DEFAULT - the transition is not authorized |
|
326 | 326 | * |
|
327 | 327 | */ |
|
328 | 328 | |
|
329 | 329 | int status; |
|
330 | 330 | |
|
331 | 331 | switch (requestedMode) |
|
332 | 332 | { |
|
333 | 333 | case LFR_MODE_STANDBY: |
|
334 | 334 | if ( lfrCurrentMode == LFR_MODE_STANDBY ) { |
|
335 | 335 | status = LFR_DEFAULT; |
|
336 | 336 | } |
|
337 | 337 | else |
|
338 | 338 | { |
|
339 | 339 | status = LFR_SUCCESSFUL; |
|
340 | 340 | } |
|
341 | 341 | break; |
|
342 | 342 | case LFR_MODE_NORMAL: |
|
343 | 343 | if ( lfrCurrentMode == LFR_MODE_NORMAL ) { |
|
344 | 344 | status = LFR_DEFAULT; |
|
345 | 345 | } |
|
346 | 346 | else { |
|
347 | 347 | status = LFR_SUCCESSFUL; |
|
348 | 348 | } |
|
349 | 349 | break; |
|
350 | 350 | case LFR_MODE_BURST: |
|
351 | 351 | if ( lfrCurrentMode == LFR_MODE_BURST ) { |
|
352 | 352 | status = LFR_DEFAULT; |
|
353 | 353 | } |
|
354 | 354 | else { |
|
355 | 355 | status = LFR_SUCCESSFUL; |
|
356 | 356 | } |
|
357 | 357 | break; |
|
358 | 358 | case LFR_MODE_SBM1: |
|
359 | 359 | if ( lfrCurrentMode == LFR_MODE_SBM1 ) { |
|
360 | 360 | status = LFR_DEFAULT; |
|
361 | 361 | } |
|
362 | 362 | else { |
|
363 | 363 | status = LFR_SUCCESSFUL; |
|
364 | 364 | } |
|
365 | 365 | break; |
|
366 | 366 | case LFR_MODE_SBM2: |
|
367 | 367 | if ( lfrCurrentMode == LFR_MODE_SBM2 ) { |
|
368 | 368 | status = LFR_DEFAULT; |
|
369 | 369 | } |
|
370 | 370 | else { |
|
371 | 371 | status = LFR_SUCCESSFUL; |
|
372 | 372 | } |
|
373 | 373 | break; |
|
374 | 374 | default: |
|
375 | 375 | status = LFR_DEFAULT; |
|
376 | 376 | break; |
|
377 | 377 | } |
|
378 | 378 | |
|
379 | 379 | return status; |
|
380 | 380 | } |
|
381 | 381 | |
|
382 | 382 | int stop_current_mode() |
|
383 | 383 | { |
|
384 | 384 | /** This function stops the current mode by masking interrupt lines and suspending science tasks. |
|
385 | 385 | * |
|
386 | 386 | * @return RTEMS directive status codes: |
|
387 | 387 | * - RTEMS_SUCCESSFUL - task restarted successfully |
|
388 | 388 | * - RTEMS_INVALID_ID - task id invalid |
|
389 | 389 | * - RTEMS_ALREADY_SUSPENDED - task already suspended |
|
390 | 390 | * |
|
391 | 391 | */ |
|
392 | 392 | |
|
393 | 393 | rtems_status_code status; |
|
394 | 394 | |
|
395 | 395 | status = RTEMS_SUCCESSFUL; |
|
396 | 396 | |
|
397 | 397 | // mask interruptions |
|
398 | 398 | LEON_Mask_interrupt( IRQ_WAVEFORM_PICKER ); // mask waveform picker interrupt |
|
399 | 399 | //LEON_Mask_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt |
|
400 | 400 | LEON_Mask_interrupt( IRQ_SM ); // mask spectral matrix interrupt simulator |
|
401 | 401 | // reset registers |
|
402 | 402 | reset_wfp_burst_enable(); // reset burst and enable bits |
|
403 | 403 | reset_wfp_status(); // reset all the status bits |
|
404 | 404 | // clear interruptions |
|
405 | 405 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); // clear waveform picker interrupt |
|
406 | 406 | //LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt |
|
407 | 407 | LEON_Clear_interrupt( IRQ_SM ); // clear spectral matrix interrupt simulator |
|
408 | 408 | //********************** |
|
409 | 409 | // suspend several tasks |
|
410 | 410 | if (lfrCurrentMode != LFR_MODE_STANDBY) { |
|
411 | 411 | status = suspend_science_tasks(); |
|
412 | 412 | } |
|
413 | 413 | |
|
414 | 414 | if (status != RTEMS_SUCCESSFUL) |
|
415 | 415 | { |
|
416 | 416 | PRINTF1("in stop_current_mode *** in suspend_science_tasks *** ERR code: %d\n", status) |
|
417 | 417 | } |
|
418 | 418 | |
|
419 | 419 | return status; |
|
420 | 420 | } |
|
421 | 421 | |
|
422 | 422 | int enter_mode(unsigned char mode ) |
|
423 | 423 | { |
|
424 | 424 | /** This function is launched after a mode transition validation. |
|
425 | 425 | * |
|
426 | 426 | * @param mode is the mode in which LFR will be put. |
|
427 | 427 | * |
|
428 | 428 | * @return RTEMS directive status codes: |
|
429 | 429 | * - RTEMS_SUCCESSFUL - the mode has been entered successfully |
|
430 | 430 | * - RTEMS_NOT_SATISFIED - the mode has not been entered successfully |
|
431 | 431 | * |
|
432 | 432 | */ |
|
433 | 433 | |
|
434 | 434 | rtems_status_code status; |
|
435 | 435 | |
|
436 | 436 | status = RTEMS_UNSATISFIED; |
|
437 | 437 | |
|
438 | 438 | housekeeping_packet.lfr_status_word[0] = (unsigned char) ((mode << 4) + 0x0d); |
|
439 | 439 | updateLFRCurrentMode(); |
|
440 | 440 | |
|
441 | 441 | switch(mode){ |
|
442 | 442 | case LFR_MODE_STANDBY: |
|
443 | 443 | status = enter_standby_mode( ); |
|
444 | 444 | break; |
|
445 | 445 | case LFR_MODE_NORMAL: |
|
446 | 446 | status = enter_normal_mode( ); |
|
447 | 447 | break; |
|
448 | 448 | case LFR_MODE_BURST: |
|
449 | 449 | status = enter_burst_mode( ); |
|
450 | 450 | break; |
|
451 | 451 | case LFR_MODE_SBM1: |
|
452 | 452 | status = enter_sbm1_mode( ); |
|
453 | 453 | break; |
|
454 | 454 | case LFR_MODE_SBM2: |
|
455 | 455 | status = enter_sbm2_mode( ); |
|
456 | 456 | break; |
|
457 | 457 | default: |
|
458 | 458 | status = RTEMS_UNSATISFIED; |
|
459 | 459 | } |
|
460 | 460 | |
|
461 | 461 | if (status != RTEMS_SUCCESSFUL) |
|
462 | 462 | { |
|
463 | 463 | PRINTF("in enter_mode *** ERR\n") |
|
464 | 464 | status = RTEMS_UNSATISFIED; |
|
465 | 465 | } |
|
466 | 466 | |
|
467 | 467 | return status; |
|
468 | 468 | } |
|
469 | 469 | |
|
470 | 470 | int enter_standby_mode() |
|
471 | 471 | { |
|
472 | 472 | /** This function is used to enter the STANDBY mode. |
|
473 | 473 | * |
|
474 | 474 | * @return RTEMS directive status codes: |
|
475 | 475 | * - RTEMS_SUCCESSFUL - the mode has been entered successfully |
|
476 | 476 | * |
|
477 | 477 | */ |
|
478 | 478 | |
|
479 | 479 | PRINTF1("maxCount = %d\n", maxCount) |
|
480 | 480 | |
|
481 | 481 | #ifdef PRINT_TASK_STATISTICS |
|
482 | 482 | rtems_cpu_usage_report(); |
|
483 | 483 | #endif |
|
484 | 484 | |
|
485 | 485 | #ifdef PRINT_STACK_REPORT |
|
486 | 486 | rtems_stack_checker_report_usage(); |
|
487 | 487 | #endif |
|
488 | 488 | |
|
489 | 489 | return LFR_SUCCESSFUL; |
|
490 | 490 | } |
|
491 | 491 | |
|
492 | 492 | int enter_normal_mode() |
|
493 | 493 | { |
|
494 | 494 | rtems_status_code status; |
|
495 | 495 | |
|
496 | 496 | status = restart_science_tasks(); |
|
497 | 497 | |
|
498 | 498 | launch_waveform_picker( LFR_MODE_NORMAL ); |
|
499 | 499 | // launch_spectral_matrix( LFR_MODE_NORMAL ); |
|
500 | 500 | |
|
501 | 501 | return status; |
|
502 | 502 | } |
|
503 | 503 | |
|
504 | 504 | int enter_burst_mode() |
|
505 | 505 | { |
|
506 | 506 | /** This function is used to enter the STANDBY mode. |
|
507 | 507 | * |
|
508 | 508 | * @return RTEMS directive status codes: |
|
509 | 509 | * - RTEMS_SUCCESSFUL - the mode has been entered successfully |
|
510 | 510 | * - RTEMS_INVALID_ID - task id invalid |
|
511 | 511 | * - RTEMS_INCORRECT_STATE - task never started |
|
512 | 512 | * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task |
|
513 | 513 | * |
|
514 | 514 | */ |
|
515 | 515 | |
|
516 | 516 | rtems_status_code status; |
|
517 | 517 | |
|
518 | 518 | status = restart_science_tasks(); |
|
519 | 519 | |
|
520 | 520 | launch_waveform_picker( LFR_MODE_BURST ); |
|
521 | 521 | |
|
522 | 522 | return status; |
|
523 | 523 | } |
|
524 | 524 | |
|
525 | 525 | int enter_sbm1_mode() |
|
526 | 526 | { |
|
527 | 527 | /** This function is used to enter the SBM1 mode. |
|
528 | 528 | * |
|
529 | 529 | * @return RTEMS directive status codes: |
|
530 | 530 | * - RTEMS_SUCCESSFUL - the mode has been entered successfully |
|
531 | 531 | * - RTEMS_INVALID_ID - task id invalid |
|
532 | 532 | * - RTEMS_INCORRECT_STATE - task never started |
|
533 | 533 | * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task |
|
534 | 534 | * |
|
535 | 535 | */ |
|
536 | 536 | |
|
537 | 537 | rtems_status_code status; |
|
538 | 538 | |
|
539 | 539 | status = restart_science_tasks(); |
|
540 | 540 | |
|
541 | 541 | launch_waveform_picker( LFR_MODE_SBM1 ); |
|
542 | 542 | |
|
543 | 543 | return status; |
|
544 | 544 | } |
|
545 | 545 | |
|
546 | 546 | int enter_sbm2_mode() |
|
547 | 547 | { |
|
548 | 548 | /** This function is used to enter the SBM2 mode. |
|
549 | 549 | * |
|
550 | 550 | * @return RTEMS directive status codes: |
|
551 | 551 | * - RTEMS_SUCCESSFUL - the mode has been entered successfully |
|
552 | 552 | * - RTEMS_INVALID_ID - task id invalid |
|
553 | 553 | * - RTEMS_INCORRECT_STATE - task never started |
|
554 | 554 | * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task |
|
555 | 555 | * |
|
556 | 556 | */ |
|
557 | 557 | |
|
558 | 558 | rtems_status_code status; |
|
559 | 559 | |
|
560 | 560 | status = restart_science_tasks(); |
|
561 | 561 | |
|
562 | 562 | launch_waveform_picker( LFR_MODE_SBM2 ); |
|
563 | 563 | |
|
564 | 564 | return status; |
|
565 | 565 | } |
|
566 | 566 | |
|
567 | 567 | int restart_science_tasks() |
|
568 | 568 | { |
|
569 | 569 | /** This function is used to restart all science tasks. |
|
570 | 570 | * |
|
571 | 571 | * @return RTEMS directive status codes: |
|
572 | 572 | * - RTEMS_SUCCESSFUL - task restarted successfully |
|
573 | 573 | * - RTEMS_INVALID_ID - task id invalid |
|
574 | 574 | * - RTEMS_INCORRECT_STATE - task never started |
|
575 | 575 | * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task |
|
576 | 576 | * |
|
577 | 577 | * Science tasks are AVF0, BPF0, WFRM, CWF3, CW2, CWF1 |
|
578 | 578 | * |
|
579 | 579 | */ |
|
580 | 580 | |
|
581 | 581 | rtems_status_code status[6]; |
|
582 | 582 | rtems_status_code ret; |
|
583 | 583 | |
|
584 | 584 | ret = RTEMS_SUCCESSFUL; |
|
585 | 585 | |
|
586 | 586 | status[0] = rtems_task_restart( Task_id[TASKID_AVF0], 1 ); |
|
587 | 587 | if (status[0] != RTEMS_SUCCESSFUL) |
|
588 | 588 | { |
|
589 | 589 | PRINTF1("in restart_science_task *** 0 ERR %d\n", status[0]) |
|
590 | 590 | } |
|
591 | 591 | |
|
592 | 592 | status[1] = rtems_task_restart( Task_id[TASKID_BPF0],1 ); |
|
593 | 593 | if (status[1] != RTEMS_SUCCESSFUL) |
|
594 | 594 | { |
|
595 | 595 | PRINTF1("in restart_science_task *** 1 ERR %d\n", status[1]) |
|
596 | 596 | } |
|
597 | 597 | |
|
598 | 598 | status[2] = rtems_task_restart( Task_id[TASKID_WFRM],1 ); |
|
599 | 599 | if (status[2] != RTEMS_SUCCESSFUL) |
|
600 | 600 | { |
|
601 | 601 | PRINTF1("in restart_science_task *** 2 ERR %d\n", status[2]) |
|
602 | 602 | } |
|
603 | 603 | |
|
604 | 604 | status[3] = rtems_task_restart( Task_id[TASKID_CWF3],1 ); |
|
605 | 605 | if (status[3] != RTEMS_SUCCESSFUL) |
|
606 | 606 | { |
|
607 | 607 | PRINTF1("in restart_science_task *** 3 ERR %d\n", status[3]) |
|
608 | 608 | } |
|
609 | 609 | |
|
610 | 610 | status[4] = rtems_task_restart( Task_id[TASKID_CWF2],1 ); |
|
611 | 611 | if (status[4] != RTEMS_SUCCESSFUL) |
|
612 | 612 | { |
|
613 | 613 | PRINTF1("in restart_science_task *** 4 ERR %d\n", status[4]) |
|
614 | 614 | } |
|
615 | 615 | |
|
616 | 616 | status[5] = rtems_task_restart( Task_id[TASKID_CWF1],1 ); |
|
617 | 617 | if (status[5] != RTEMS_SUCCESSFUL) |
|
618 | 618 | { |
|
619 | 619 | PRINTF1("in restart_science_task *** 5 ERR %d\n", status[5]) |
|
620 | 620 | } |
|
621 | 621 | |
|
622 | 622 | if ( (status[0] != RTEMS_SUCCESSFUL) || (status[1] != RTEMS_SUCCESSFUL) || (status[2] != RTEMS_SUCCESSFUL) || |
|
623 | 623 | (status[3] != RTEMS_SUCCESSFUL) || (status[4] != RTEMS_SUCCESSFUL) || (status[5] != RTEMS_SUCCESSFUL) ) |
|
624 | 624 | { |
|
625 | 625 | ret = RTEMS_UNSATISFIED; |
|
626 | 626 | } |
|
627 | 627 | |
|
628 | 628 | return ret; |
|
629 | 629 | } |
|
630 | 630 | |
|
631 | 631 | int suspend_science_tasks() |
|
632 | 632 | { |
|
633 | 633 | /** This function suspends the science tasks. |
|
634 | 634 | * |
|
635 | 635 | * @return RTEMS directive status codes: |
|
636 | 636 | * - RTEMS_SUCCESSFUL - task restarted successfully |
|
637 | 637 | * - RTEMS_INVALID_ID - task id invalid |
|
638 | 638 | * - RTEMS_ALREADY_SUSPENDED - task already suspended |
|
639 | 639 | * |
|
640 | 640 | */ |
|
641 | 641 | |
|
642 | 642 | rtems_status_code status; |
|
643 | 643 | |
|
644 | 644 | status = rtems_task_suspend( Task_id[TASKID_AVF0] ); |
|
645 | 645 | if (status != RTEMS_SUCCESSFUL) |
|
646 | 646 | { |
|
647 | 647 | PRINTF1("in suspend_science_task *** AVF0 ERR %d\n", status) |
|
648 | 648 | } |
|
649 | 649 | |
|
650 | 650 | if (status == RTEMS_SUCCESSFUL) // suspend BPF0 |
|
651 | 651 | { |
|
652 | 652 | status = rtems_task_suspend( Task_id[TASKID_BPF0] ); |
|
653 | 653 | if (status != RTEMS_SUCCESSFUL) |
|
654 | 654 | { |
|
655 | 655 | PRINTF1("in suspend_science_task *** BPF0 ERR %d\n", status) |
|
656 | 656 | } |
|
657 | 657 | } |
|
658 | 658 | |
|
659 | 659 | if (status == RTEMS_SUCCESSFUL) // suspend WFRM |
|
660 | 660 | { |
|
661 | 661 | status = rtems_task_suspend( Task_id[TASKID_WFRM] ); |
|
662 | 662 | if (status != RTEMS_SUCCESSFUL) |
|
663 | 663 | { |
|
664 | 664 | PRINTF1("in suspend_science_task *** WFRM ERR %d\n", status) |
|
665 | 665 | } |
|
666 | 666 | } |
|
667 | 667 | |
|
668 | 668 | if (status == RTEMS_SUCCESSFUL) // suspend CWF3 |
|
669 | 669 | { |
|
670 | 670 | status = rtems_task_suspend( Task_id[TASKID_CWF3] ); |
|
671 | 671 | if (status != RTEMS_SUCCESSFUL) |
|
672 | 672 | { |
|
673 | 673 | PRINTF1("in suspend_science_task *** CWF3 ERR %d\n", status) |
|
674 | 674 | } |
|
675 | 675 | } |
|
676 | 676 | |
|
677 | 677 | if (status == RTEMS_SUCCESSFUL) // suspend CWF2 |
|
678 | 678 | { |
|
679 | 679 | status = rtems_task_suspend( Task_id[TASKID_CWF2] ); |
|
680 | 680 | if (status != RTEMS_SUCCESSFUL) |
|
681 | 681 | { |
|
682 | 682 | PRINTF1("in suspend_science_task *** CWF2 ERR %d\n", status) |
|
683 | 683 | } |
|
684 | 684 | } |
|
685 | 685 | |
|
686 | 686 | if (status == RTEMS_SUCCESSFUL) // suspend CWF1 |
|
687 | 687 | { |
|
688 | 688 | status = rtems_task_suspend( Task_id[TASKID_CWF1] ); |
|
689 | 689 | if (status != RTEMS_SUCCESSFUL) |
|
690 | 690 | { |
|
691 | 691 | PRINTF1("in suspend_science_task *** CWF1 ERR %d\n", status) |
|
692 | 692 | } |
|
693 | 693 | } |
|
694 | 694 | |
|
695 | 695 | return status; |
|
696 | 696 | } |
|
697 | 697 | |
|
698 | 698 | void launch_waveform_picker( unsigned char mode ) |
|
699 | 699 | { |
|
700 | 700 | int startDate; |
|
701 | 701 | |
|
702 | 702 | reset_current_ring_nodes(); |
|
703 |
reset_waveform_picker_regs |
|
|
703 | reset_waveform_picker_regs(); | |
|
704 | 704 | set_wfp_burst_enable_register( mode ); |
|
705 | 705 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); |
|
706 | 706 | LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER ); |
|
707 | 707 | startDate = time_management_regs->coarse_time + 2; |
|
708 | 708 | waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x80; // [1000 0000] |
|
709 | 709 | waveform_picker_regs->start_date = startDate; |
|
710 | 710 | } |
|
711 | 711 | |
|
712 | 712 | void launch_spectral_matrix( unsigned char mode ) |
|
713 | 713 | { |
|
714 | 714 | reset_current_sm_ring_nodes(); |
|
715 | 715 | reset_spectral_matrix_regs(); |
|
716 | 716 | // Spectral Matrices simulator |
|
717 | 717 | timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR ); |
|
718 | 718 | set_local_nb_interrupt_f0_MAX(); |
|
719 | 719 | LEON_Clear_interrupt( IRQ_SM ); |
|
720 | 720 | LEON_Unmask_interrupt( IRQ_SM ); |
|
721 | 721 | } |
|
722 | 722 | |
|
723 | 723 | //**************** |
|
724 | 724 | // CLOSING ACTIONS |
|
725 | 725 | void update_last_TC_exe(ccsdsTelecommandPacket_t *TC, unsigned char *time) |
|
726 | 726 | { |
|
727 | 727 | /** This function is used to update the HK packets statistics after a successful TC execution. |
|
728 | 728 | * |
|
729 | 729 | * @param TC points to the TC being processed |
|
730 | 730 | * @param time is the time used to date the TC execution |
|
731 | 731 | * |
|
732 | 732 | */ |
|
733 | 733 | |
|
734 | 734 | housekeeping_packet.hk_lfr_last_exe_tc_id[0] = TC->packetID[0]; |
|
735 | 735 | housekeeping_packet.hk_lfr_last_exe_tc_id[1] = TC->packetID[1]; |
|
736 | 736 | housekeeping_packet.hk_lfr_last_exe_tc_type[0] = 0x00; |
|
737 | 737 | housekeeping_packet.hk_lfr_last_exe_tc_type[1] = TC->serviceType; |
|
738 | 738 | housekeeping_packet.hk_lfr_last_exe_tc_subtype[0] = 0x00; |
|
739 | 739 | housekeeping_packet.hk_lfr_last_exe_tc_subtype[1] = TC->serviceSubType; |
|
740 | 740 | housekeeping_packet.hk_lfr_last_exe_tc_time[0] = time[0]; |
|
741 | 741 | housekeeping_packet.hk_lfr_last_exe_tc_time[1] = time[1]; |
|
742 | 742 | housekeeping_packet.hk_lfr_last_exe_tc_time[2] = time[2]; |
|
743 | 743 | housekeeping_packet.hk_lfr_last_exe_tc_time[3] = time[3]; |
|
744 | 744 | housekeeping_packet.hk_lfr_last_exe_tc_time[4] = time[4]; |
|
745 | 745 | housekeeping_packet.hk_lfr_last_exe_tc_time[5] = time[5]; |
|
746 | 746 | } |
|
747 | 747 | |
|
748 | 748 | void update_last_TC_rej(ccsdsTelecommandPacket_t *TC, unsigned char *time) |
|
749 | 749 | { |
|
750 | 750 | /** This function is used to update the HK packets statistics after a TC rejection. |
|
751 | 751 | * |
|
752 | 752 | * @param TC points to the TC being processed |
|
753 | 753 | * @param time is the time used to date the TC rejection |
|
754 | 754 | * |
|
755 | 755 | */ |
|
756 | 756 | |
|
757 | 757 | housekeeping_packet.hk_lfr_last_rej_tc_id[0] = TC->packetID[0]; |
|
758 | 758 | housekeeping_packet.hk_lfr_last_rej_tc_id[1] = TC->packetID[1]; |
|
759 | 759 | housekeeping_packet.hk_lfr_last_rej_tc_type[0] = 0x00; |
|
760 | 760 | housekeeping_packet.hk_lfr_last_rej_tc_type[1] = TC->serviceType; |
|
761 | 761 | housekeeping_packet.hk_lfr_last_rej_tc_subtype[0] = 0x00; |
|
762 | 762 | housekeeping_packet.hk_lfr_last_rej_tc_subtype[1] = TC->serviceSubType; |
|
763 | 763 | housekeeping_packet.hk_lfr_last_rej_tc_time[0] = time[0]; |
|
764 | 764 | housekeeping_packet.hk_lfr_last_rej_tc_time[1] = time[1]; |
|
765 | 765 | housekeeping_packet.hk_lfr_last_rej_tc_time[2] = time[2]; |
|
766 | 766 | housekeeping_packet.hk_lfr_last_rej_tc_time[3] = time[3]; |
|
767 | 767 | housekeeping_packet.hk_lfr_last_rej_tc_time[4] = time[4]; |
|
768 | 768 | housekeeping_packet.hk_lfr_last_rej_tc_time[5] = time[5]; |
|
769 | 769 | } |
|
770 | 770 | |
|
771 | 771 | void close_action(ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id, unsigned char *time) |
|
772 | 772 | { |
|
773 | 773 | /** This function is the last step of the TC execution workflow. |
|
774 | 774 | * |
|
775 | 775 | * @param TC points to the TC being processed |
|
776 | 776 | * @param result is the result of the TC execution (LFR_SUCCESSFUL / LFR_DEFAULT) |
|
777 | 777 | * @param queue_id is the id of the RTEMS message queue used to send TM packets |
|
778 | 778 | * @param time is the time used to date the TC execution |
|
779 | 779 | * |
|
780 | 780 | */ |
|
781 | 781 | |
|
782 | 782 | unsigned int val = 0; |
|
783 | 783 | |
|
784 | 784 | if (result == LFR_SUCCESSFUL) |
|
785 | 785 | { |
|
786 | 786 | if ( !( (TC->serviceType==TC_TYPE_TIME) && (TC->serviceSubType==TC_SUBTYPE_UPDT_TIME) ) |
|
787 | 787 | && |
|
788 | 788 | !( (TC->serviceType==TC_TYPE_GEN) && (TC->serviceSubType==TC_SUBTYPE_UPDT_INFO)) |
|
789 | 789 | ) |
|
790 | 790 | { |
|
791 | 791 | send_tm_lfr_tc_exe_success( TC, queue_id, time ); |
|
792 | 792 | } |
|
793 | 793 | update_last_TC_exe( TC, time ); |
|
794 | 794 | val = housekeeping_packet.hk_lfr_exe_tc_cnt[0] * 256 + housekeeping_packet.hk_lfr_exe_tc_cnt[1]; |
|
795 | 795 | val++; |
|
796 | 796 | housekeeping_packet.hk_lfr_exe_tc_cnt[0] = (unsigned char) (val >> 8); |
|
797 | 797 | housekeeping_packet.hk_lfr_exe_tc_cnt[1] = (unsigned char) (val); |
|
798 | 798 | } |
|
799 | 799 | else |
|
800 | 800 | { |
|
801 | 801 | update_last_TC_rej( TC, time ); |
|
802 | 802 | val = housekeeping_packet.hk_lfr_rej_tc_cnt[0] * 256 + housekeeping_packet.hk_lfr_rej_tc_cnt[1]; |
|
803 | 803 | val++; |
|
804 | 804 | housekeeping_packet.hk_lfr_rej_tc_cnt[0] = (unsigned char) (val >> 8); |
|
805 | 805 | housekeeping_packet.hk_lfr_rej_tc_cnt[1] = (unsigned char) (val); |
|
806 | 806 | } |
|
807 | 807 | } |
|
808 | 808 | |
|
809 | 809 | //*************************** |
|
810 | 810 | // Interrupt Service Routines |
|
811 | 811 | rtems_isr commutation_isr1( rtems_vector_number vector ) |
|
812 | 812 | { |
|
813 | 813 | if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { |
|
814 | 814 | printf("In commutation_isr1 *** Error sending event to DUMB\n"); |
|
815 | 815 | } |
|
816 | 816 | } |
|
817 | 817 | |
|
818 | 818 | rtems_isr commutation_isr2( rtems_vector_number vector ) |
|
819 | 819 | { |
|
820 | 820 | if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { |
|
821 | 821 | printf("In commutation_isr2 *** Error sending event to DUMB\n"); |
|
822 | 822 | } |
|
823 | 823 | } |
|
824 | 824 | |
|
825 | 825 | //**************** |
|
826 | 826 | // OTHER FUNCTIONS |
|
827 | 827 | void updateLFRCurrentMode() |
|
828 | 828 | { |
|
829 | 829 | /** This function updates the value of the global variable lfrCurrentMode. |
|
830 | 830 | * |
|
831 | 831 | * lfrCurrentMode is a parameter used by several functions to know in which mode LFR is running. |
|
832 | 832 | * |
|
833 | 833 | */ |
|
834 | 834 | // update the local value of lfrCurrentMode with the value contained in the housekeeping_packet structure |
|
835 | 835 | lfrCurrentMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; |
|
836 | 836 | } |
|
837 | 837 |
@@ -1,484 +1,482 | |||
|
1 | 1 | /** Functions to load and dump parameters in the LFR registers. |
|
2 | 2 | * |
|
3 | 3 | * @file |
|
4 | 4 | * @author P. LEROY |
|
5 | 5 | * |
|
6 | 6 | * A group of functions to handle TC related to parameter loading and dumping.\n |
|
7 | 7 | * TC_LFR_LOAD_COMMON_PAR\n |
|
8 | 8 | * TC_LFR_LOAD_NORMAL_PAR\n |
|
9 | 9 | * TC_LFR_LOAD_BURST_PAR\n |
|
10 | 10 | * TC_LFR_LOAD_SBM1_PAR\n |
|
11 | 11 | * TC_LFR_LOAD_SBM2_PAR\n |
|
12 | 12 | * |
|
13 | 13 | */ |
|
14 | 14 | |
|
15 | 15 | #include "tc_load_dump_parameters.h" |
|
16 | 16 | |
|
17 | 17 | int action_load_common_par(ccsdsTelecommandPacket_t *TC) |
|
18 | 18 | { |
|
19 | 19 | /** This function updates the LFR registers with the incoming common parameters. |
|
20 | 20 | * |
|
21 | 21 | * @param TC points to the TeleCommand packet that is being processed |
|
22 | 22 | * |
|
23 | 23 | * |
|
24 | 24 | */ |
|
25 | 25 | |
|
26 | 26 | parameter_dump_packet.unused0 = TC->dataAndCRC[0]; |
|
27 | 27 | parameter_dump_packet.bw_sp0_sp1_r0_r1 = TC->dataAndCRC[1]; |
|
28 | set_wfp_data_shaping(parameter_dump_packet.bw_sp0_sp1_r0_r1); | |
|
28 | set_wfp_data_shaping( ); | |
|
29 | 29 | return LFR_SUCCESSFUL; |
|
30 | 30 | } |
|
31 | 31 | |
|
32 | 32 | int action_load_normal_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time) |
|
33 | 33 | { |
|
34 | 34 | /** This function updates the LFR registers with the incoming normal parameters. |
|
35 | 35 | * |
|
36 | 36 | * @param TC points to the TeleCommand packet that is being processed |
|
37 | 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 | 41 | int result; |
|
42 | 42 | int flag; |
|
43 | 43 | rtems_status_code status; |
|
44 | 44 | |
|
45 | 45 | flag = LFR_SUCCESSFUL; |
|
46 | 46 | |
|
47 | 47 | if ( (lfrCurrentMode == LFR_MODE_NORMAL) || |
|
48 | 48 | (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) { |
|
49 | 49 | status = send_tm_lfr_tc_exe_not_executable( TC, queue_id, time ); |
|
50 | 50 | flag = LFR_DEFAULT; |
|
51 | 51 | } |
|
52 | 52 | |
|
53 | 53 | //*************** |
|
54 | 54 | // sy_lfr_n_swf_l |
|
55 | 55 | if (flag == LFR_SUCCESSFUL) |
|
56 | 56 | { |
|
57 | 57 | result = set_sy_lfr_n_swf_l( TC, queue_id, time ); |
|
58 | 58 | if (result != LFR_SUCCESSFUL) |
|
59 | 59 | { |
|
60 | 60 | flag = LFR_DEFAULT; |
|
61 | 61 | } |
|
62 | 62 | } |
|
63 | 63 | |
|
64 | 64 | //*************** |
|
65 | 65 | // sy_lfr_n_swf_p |
|
66 | 66 | if (flag == LFR_SUCCESSFUL) |
|
67 | 67 | { |
|
68 | 68 | result = set_sy_lfr_n_swf_p( TC, queue_id, time ); |
|
69 | 69 | if (result != LFR_SUCCESSFUL) |
|
70 | 70 | { |
|
71 | 71 | flag = LFR_DEFAULT; |
|
72 | 72 | } |
|
73 | 73 | } |
|
74 | 74 | |
|
75 | 75 | //*************** |
|
76 | 76 | // SY_LFR_N_ASM_P |
|
77 | 77 | if (flag == LFR_SUCCESSFUL) |
|
78 | 78 | { |
|
79 | 79 | result = set_sy_lfr_n_asm_p( TC, queue_id ); |
|
80 | 80 | if (result != LFR_SUCCESSFUL) |
|
81 | 81 | { |
|
82 | 82 | flag = LFR_DEFAULT; |
|
83 | 83 | } |
|
84 | 84 | } |
|
85 | 85 | |
|
86 | 86 | //*************** |
|
87 | 87 | // SY_LFR_N_BP_P0 |
|
88 | 88 | if (flag == LFR_SUCCESSFUL) |
|
89 | 89 | { |
|
90 | 90 | result = set_sy_lfr_n_bp_p0( TC, queue_id ); |
|
91 | 91 | if (result != LFR_SUCCESSFUL) |
|
92 | 92 | { |
|
93 | 93 | flag = LFR_DEFAULT; |
|
94 | 94 | } |
|
95 | 95 | } |
|
96 | 96 | |
|
97 | 97 | //*************** |
|
98 | 98 | // sy_lfr_n_bp_p1 |
|
99 | 99 | if (flag == LFR_SUCCESSFUL) |
|
100 | 100 | { |
|
101 | 101 | result = set_sy_lfr_n_bp_p1( TC, queue_id ); |
|
102 | 102 | if (result != LFR_SUCCESSFUL) |
|
103 | 103 | { |
|
104 | 104 | flag = LFR_DEFAULT; |
|
105 | 105 | } |
|
106 | 106 | } |
|
107 | 107 | |
|
108 | 108 | //********************* |
|
109 | 109 | // sy_lfr_n_cwf_long_f3 |
|
110 | 110 | if (flag == LFR_SUCCESSFUL) |
|
111 | 111 | { |
|
112 | 112 | result = set_sy_lfr_n_cwf_long_f3( TC, queue_id ); |
|
113 | 113 | if (result != LFR_SUCCESSFUL) |
|
114 | 114 | { |
|
115 | 115 | flag = LFR_DEFAULT; |
|
116 | 116 | } |
|
117 | 117 | } |
|
118 | 118 | |
|
119 | 119 | return flag; |
|
120 | 120 | } |
|
121 | 121 | |
|
122 | 122 | int action_load_burst_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time) |
|
123 | 123 | { |
|
124 | 124 | /** This function updates the LFR registers with the incoming burst parameters. |
|
125 | 125 | * |
|
126 | 126 | * @param TC points to the TeleCommand packet that is being processed |
|
127 | 127 | * @param queue_id is the id of the queue which handles TM related to this execution step |
|
128 | 128 | * |
|
129 | 129 | */ |
|
130 | 130 | |
|
131 | 131 | int result; |
|
132 | 132 | unsigned char lfrMode; |
|
133 | 133 | rtems_status_code status; |
|
134 | 134 | |
|
135 | 135 | result = LFR_DEFAULT; |
|
136 | 136 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; |
|
137 | 137 | |
|
138 | 138 | if ( lfrMode == LFR_MODE_BURST ) { |
|
139 | 139 | status = send_tm_lfr_tc_exe_not_executable( TC, queue_id, time ); |
|
140 | 140 | result = LFR_DEFAULT; |
|
141 | 141 | } |
|
142 | 142 | else { |
|
143 | 143 | parameter_dump_packet.sy_lfr_b_bp_p0 = TC->dataAndCRC[0]; |
|
144 | 144 | parameter_dump_packet.sy_lfr_b_bp_p1 = TC->dataAndCRC[1]; |
|
145 | 145 | |
|
146 | 146 | result = LFR_SUCCESSFUL; |
|
147 | 147 | } |
|
148 | 148 | |
|
149 | 149 | return result; |
|
150 | 150 | } |
|
151 | 151 | |
|
152 | 152 | int action_load_sbm1_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time) |
|
153 | 153 | { |
|
154 | 154 | /** This function updates the LFR registers with the incoming sbm1 parameters. |
|
155 | 155 | * |
|
156 | 156 | * @param TC points to the TeleCommand packet that is being processed |
|
157 | 157 | * @param queue_id is the id of the queue which handles TM related to this execution step |
|
158 | 158 | * |
|
159 | 159 | */ |
|
160 | 160 | int result; |
|
161 | 161 | unsigned char lfrMode; |
|
162 | 162 | rtems_status_code status; |
|
163 | 163 | |
|
164 | 164 | result = LFR_DEFAULT; |
|
165 | 165 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; |
|
166 | 166 | |
|
167 | 167 | if ( (lfrMode == LFR_MODE_SBM1) || (lfrMode == LFR_MODE_SBM2) ) { |
|
168 | 168 | status = send_tm_lfr_tc_exe_not_executable( TC, queue_id, time ); |
|
169 | 169 | result = LFR_DEFAULT; |
|
170 | 170 | } |
|
171 | 171 | else { |
|
172 | 172 | parameter_dump_packet.sy_lfr_s1_bp_p0 = TC->dataAndCRC[0]; |
|
173 | 173 | parameter_dump_packet.sy_lfr_s1_bp_p1 = TC->dataAndCRC[1]; |
|
174 | 174 | |
|
175 | 175 | result = LFR_SUCCESSFUL; |
|
176 | 176 | } |
|
177 | 177 | |
|
178 | 178 | return result; |
|
179 | 179 | } |
|
180 | 180 | |
|
181 | 181 | int action_load_sbm2_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time) |
|
182 | 182 | { |
|
183 | 183 | /** This function updates the LFR registers with the incoming sbm2 parameters. |
|
184 | 184 | * |
|
185 | 185 | * @param TC points to the TeleCommand packet that is being processed |
|
186 | 186 | * @param queue_id is the id of the queue which handles TM related to this execution step |
|
187 | 187 | * |
|
188 | 188 | */ |
|
189 | 189 | |
|
190 | 190 | int result; |
|
191 | 191 | unsigned char lfrMode; |
|
192 | 192 | rtems_status_code status; |
|
193 | 193 | |
|
194 | 194 | result = LFR_DEFAULT; |
|
195 | 195 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; |
|
196 | 196 | |
|
197 | 197 | if ( (lfrMode == LFR_MODE_SBM2) || (lfrMode == LFR_MODE_SBM2) ) { |
|
198 | 198 | status = send_tm_lfr_tc_exe_not_executable( TC, queue_id, time ); |
|
199 | 199 | result = LFR_DEFAULT; |
|
200 | 200 | } |
|
201 | 201 | else { |
|
202 | 202 | parameter_dump_packet.sy_lfr_s2_bp_p0 = TC->dataAndCRC[0]; |
|
203 | 203 | parameter_dump_packet.sy_lfr_s2_bp_p1 = TC->dataAndCRC[1]; |
|
204 | 204 | |
|
205 | 205 | result = LFR_SUCCESSFUL; |
|
206 | 206 | } |
|
207 | 207 | |
|
208 | 208 | return result; |
|
209 | 209 | } |
|
210 | 210 | |
|
211 | 211 | int action_dump_par( rtems_id queue_id ) |
|
212 | 212 | { |
|
213 | 213 | /** This function dumps the LFR parameters by sending the appropriate TM packet to the dedicated RTEMS message queue. |
|
214 | 214 | * |
|
215 | 215 | * @param queue_id is the id of the queue which handles TM related to this execution step. |
|
216 | 216 | * |
|
217 | 217 | * @return RTEMS directive status codes: |
|
218 | 218 | * - RTEMS_SUCCESSFUL - message sent successfully |
|
219 | 219 | * - RTEMS_INVALID_ID - invalid queue id |
|
220 | 220 | * - RTEMS_INVALID_SIZE - invalid message size |
|
221 | 221 | * - RTEMS_INVALID_ADDRESS - buffer is NULL |
|
222 | 222 | * - RTEMS_UNSATISFIED - out of message buffers |
|
223 | 223 | * - RTEMS_TOO_MANY - queue s limit has been reached |
|
224 | 224 | * |
|
225 | 225 | */ |
|
226 | 226 | |
|
227 | 227 | int status; |
|
228 | 228 | |
|
229 | 229 | // UPDATE TIME |
|
230 | 230 | increment_seq_counter( parameter_dump_packet.packetSequenceControl ); |
|
231 | 231 | parameter_dump_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
232 | 232 | parameter_dump_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
233 | 233 | parameter_dump_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
234 | 234 | parameter_dump_packet.time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
235 | 235 | parameter_dump_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
236 | 236 | parameter_dump_packet.time[5] = (unsigned char) (time_management_regs->fine_time); |
|
237 | 237 | // SEND DATA |
|
238 | 238 | status = rtems_message_queue_send( queue_id, ¶meter_dump_packet, |
|
239 | 239 | PACKET_LENGTH_PARAMETER_DUMP + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES); |
|
240 | 240 | if (status != RTEMS_SUCCESSFUL) { |
|
241 | 241 | PRINTF1("in action_dump *** ERR sending packet, code %d", status) |
|
242 | 242 | } |
|
243 | 243 | |
|
244 | 244 | return status; |
|
245 | 245 | } |
|
246 | 246 | |
|
247 | 247 | //*********************** |
|
248 | 248 | // NORMAL MODE PARAMETERS |
|
249 | 249 | |
|
250 | 250 | int set_sy_lfr_n_swf_l( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time ) |
|
251 | 251 | { |
|
252 | 252 | /** This function sets the number of points of a snapshot (sy_lfr_n_swf_l). |
|
253 | 253 | * |
|
254 | 254 | * @param TC points to the TeleCommand packet that is being processed |
|
255 | 255 | * @param queue_id is the id of the queue which handles TM related to this execution step |
|
256 | 256 | * |
|
257 | 257 | */ |
|
258 | 258 | |
|
259 | 259 | unsigned int tmp; |
|
260 | 260 | int result; |
|
261 | 261 | unsigned char msb; |
|
262 | 262 | unsigned char lsb; |
|
263 | 263 | rtems_status_code status; |
|
264 | 264 | |
|
265 | 265 | msb = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_SWF_L ]; |
|
266 | 266 | lsb = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_SWF_L+1 ]; |
|
267 | 267 | |
|
268 | 268 | tmp = ( unsigned int ) floor( |
|
269 | 269 | ( ( msb*256 ) + lsb ) / 16 |
|
270 | 270 | ) * 16; |
|
271 | 271 | |
|
272 | 272 | if ( (tmp < 16) || (tmp > 2048) ) // the snapshot period is a multiple of 16 |
|
273 | 273 | { // 2048 is the maximum limit due to the size of the buffers |
|
274 | 274 | status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_SY_LFR_N_SWF_L+10, lsb, time ); |
|
275 | 275 | result = WRONG_APP_DATA; |
|
276 | 276 | } |
|
277 | 277 | else if (tmp != 2048) |
|
278 | 278 | { |
|
279 | 279 | status = send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time ); |
|
280 | 280 | result = FUNCT_NOT_IMPL; |
|
281 | 281 | } |
|
282 | 282 | else |
|
283 | 283 | { |
|
284 | 284 | parameter_dump_packet.sy_lfr_n_swf_l[0] = (unsigned char) (tmp >> 8); |
|
285 | 285 | parameter_dump_packet.sy_lfr_n_swf_l[1] = (unsigned char) (tmp ); |
|
286 | 286 | result = LFR_SUCCESSFUL; |
|
287 | 287 | } |
|
288 | 288 | |
|
289 | 289 | return result; |
|
290 | 290 | } |
|
291 | 291 | |
|
292 | 292 | int set_sy_lfr_n_swf_p(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time) |
|
293 | 293 | { |
|
294 | 294 | /** This function sets the time between two snapshots, in s (sy_lfr_n_swf_p). |
|
295 | 295 | * |
|
296 | 296 | * @param TC points to the TeleCommand packet that is being processed |
|
297 | 297 | * @param queue_id is the id of the queue which handles TM related to this execution step |
|
298 | 298 | * |
|
299 | 299 | */ |
|
300 | 300 | |
|
301 | 301 | unsigned int tmp; |
|
302 | 302 | int result; |
|
303 | 303 | unsigned char msb; |
|
304 | 304 | unsigned char lsb; |
|
305 | 305 | rtems_status_code status; |
|
306 | 306 | |
|
307 | 307 | msb = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_SWF_P ]; |
|
308 | 308 | lsb = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_SWF_P+1 ]; |
|
309 | 309 | |
|
310 | tmp = ( unsigned int ) floor( | |
|
311 | ( ( msb*256 ) + lsb ) / 8 | |
|
312 | ) * 8; | |
|
310 | tmp = msb * 256 + lsb; | |
|
313 | 311 | |
|
314 |
if ( |
|
|
312 | if ( tmp < 16 ) | |
|
315 | 313 | { |
|
316 | 314 | status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_SY_LFR_N_SWF_P+10, lsb, time ); |
|
317 | 315 | result = WRONG_APP_DATA; |
|
318 | 316 | } |
|
319 | 317 | else |
|
320 | 318 | { |
|
321 | 319 | parameter_dump_packet.sy_lfr_n_swf_p[0] = (unsigned char) (tmp >> 8); |
|
322 | 320 | parameter_dump_packet.sy_lfr_n_swf_p[1] = (unsigned char) (tmp ); |
|
323 | 321 | result = LFR_SUCCESSFUL; |
|
324 | 322 | } |
|
325 | 323 | |
|
326 | 324 | return result; |
|
327 | 325 | } |
|
328 | 326 | |
|
329 | 327 | int set_sy_lfr_n_asm_p( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ) |
|
330 | 328 | { |
|
331 | 329 | /** This function sets the time between two full spectral matrices transmission, in s (SY_LFR_N_ASM_P). |
|
332 | 330 | * |
|
333 | 331 | * @param TC points to the TeleCommand packet that is being processed |
|
334 | 332 | * @param queue_id is the id of the queue which handles TM related to this execution step |
|
335 | 333 | * |
|
336 | 334 | */ |
|
337 | 335 | |
|
338 | 336 | int result; |
|
339 | 337 | unsigned char msb; |
|
340 | 338 | unsigned char lsb; |
|
341 | 339 | |
|
342 | 340 | msb = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_ASM_P ]; |
|
343 | 341 | lsb = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_ASM_P+1 ]; |
|
344 | 342 | |
|
345 | 343 | parameter_dump_packet.sy_lfr_n_asm_p[0] = msb; |
|
346 | 344 | parameter_dump_packet.sy_lfr_n_asm_p[1] = lsb; |
|
347 | 345 | result = LFR_SUCCESSFUL; |
|
348 | 346 | |
|
349 | 347 | return result; |
|
350 | 348 | } |
|
351 | 349 | |
|
352 | 350 | int set_sy_lfr_n_bp_p0( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ) |
|
353 | 351 | { |
|
354 | 352 | /** This function sets the time between two basic parameter sets, in s (SY_LFR_N_BP_P0). |
|
355 | 353 | * |
|
356 | 354 | * @param TC points to the TeleCommand packet that is being processed |
|
357 | 355 | * @param queue_id is the id of the queue which handles TM related to this execution step |
|
358 | 356 | * |
|
359 | 357 | */ |
|
360 | 358 | |
|
361 | 359 | int status; |
|
362 | 360 | |
|
363 | 361 | status = LFR_SUCCESSFUL; |
|
364 | 362 | |
|
365 | 363 | parameter_dump_packet.sy_lfr_n_bp_p0 = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_BP_P0 ]; |
|
366 | 364 | |
|
367 | 365 | return status; |
|
368 | 366 | } |
|
369 | 367 | |
|
370 | 368 | int set_sy_lfr_n_bp_p1(ccsdsTelecommandPacket_t *TC, rtems_id queue_id) |
|
371 | 369 | { |
|
372 | 370 | /** This function sets the time between two basic parameter sets (autocorrelation + crosscorrelation), in s (sy_lfr_n_bp_p1). |
|
373 | 371 | * |
|
374 | 372 | * @param TC points to the TeleCommand packet that is being processed |
|
375 | 373 | * @param queue_id is the id of the queue which handles TM related to this execution step |
|
376 | 374 | * |
|
377 | 375 | */ |
|
378 | 376 | |
|
379 | 377 | int status; |
|
380 | 378 | |
|
381 | 379 | status = LFR_SUCCESSFUL; |
|
382 | 380 | |
|
383 | 381 | parameter_dump_packet.sy_lfr_n_bp_p1 = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_BP_P1 ]; |
|
384 | 382 | |
|
385 | 383 | return status; |
|
386 | 384 | } |
|
387 | 385 | |
|
388 | 386 | int set_sy_lfr_n_cwf_long_f3(ccsdsTelecommandPacket_t *TC, rtems_id queue_id) |
|
389 | 387 | { |
|
390 | 388 | /** This function allows to switch from CWF_F3 packets to CWF_LONG_F3 packets. |
|
391 | 389 | * |
|
392 | 390 | * @param TC points to the TeleCommand packet that is being processed |
|
393 | 391 | * @param queue_id is the id of the queue which handles TM related to this execution step |
|
394 | 392 | * |
|
395 | 393 | */ |
|
396 | 394 | |
|
397 | 395 | int status; |
|
398 | 396 | |
|
399 | 397 | status = LFR_SUCCESSFUL; |
|
400 | 398 | |
|
401 | 399 | parameter_dump_packet.sy_lfr_n_cwf_long_f3 = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_CWF_LONG_F3 ]; |
|
402 | 400 | |
|
403 | 401 | return status; |
|
404 | 402 | } |
|
405 | 403 | |
|
406 | 404 | //********************** |
|
407 | 405 | // BURST MODE PARAMETERS |
|
408 | 406 | |
|
409 | 407 | //********************* |
|
410 | 408 | // SBM1 MODE PARAMETERS |
|
411 | 409 | |
|
412 | 410 | //********************* |
|
413 | 411 | // SBM2 MODE PARAMETERS |
|
414 | 412 | |
|
415 | 413 | //********** |
|
416 | 414 | // init dump |
|
417 | 415 | |
|
418 | 416 | void init_parameter_dump( void ) |
|
419 | 417 | { |
|
420 | 418 | /** This function initialize the parameter_dump_packet global variable with default values. |
|
421 | 419 | * |
|
422 | 420 | */ |
|
423 | 421 | |
|
424 | 422 | parameter_dump_packet.targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
425 | 423 | parameter_dump_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
426 | 424 | parameter_dump_packet.reserved = CCSDS_RESERVED; |
|
427 | 425 | parameter_dump_packet.userApplication = CCSDS_USER_APP; |
|
428 | 426 | parameter_dump_packet.packetID[0] = (unsigned char) (TM_PACKET_ID_PARAMETER_DUMP >> 8); |
|
429 | 427 | parameter_dump_packet.packetID[1] = (unsigned char) TM_PACKET_ID_PARAMETER_DUMP; |
|
430 | 428 | parameter_dump_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; |
|
431 | 429 | parameter_dump_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; |
|
432 | 430 | parameter_dump_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_PARAMETER_DUMP >> 8); |
|
433 | 431 | parameter_dump_packet.packetLength[1] = (unsigned char) PACKET_LENGTH_PARAMETER_DUMP; |
|
434 | 432 | // DATA FIELD HEADER |
|
435 | 433 | parameter_dump_packet.spare1_pusVersion_spare2 = SPARE1_PUSVERSION_SPARE2; |
|
436 | 434 | parameter_dump_packet.serviceType = TM_TYPE_PARAMETER_DUMP; |
|
437 | 435 | parameter_dump_packet.serviceSubType = TM_SUBTYPE_PARAMETER_DUMP; |
|
438 | 436 | parameter_dump_packet.destinationID = TM_DESTINATION_ID_GROUND; |
|
439 | 437 | parameter_dump_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
440 | 438 | parameter_dump_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
441 | 439 | parameter_dump_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
442 | 440 | parameter_dump_packet.time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
443 | 441 | parameter_dump_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
444 | 442 | parameter_dump_packet.time[5] = (unsigned char) (time_management_regs->fine_time); |
|
445 | 443 | parameter_dump_packet.sid = SID_PARAMETER_DUMP; |
|
446 | 444 | |
|
447 | 445 | //****************** |
|
448 | 446 | // COMMON PARAMETERS |
|
449 | 447 | parameter_dump_packet.unused0 = DEFAULT_SY_LFR_COMMON0; |
|
450 | 448 | parameter_dump_packet.bw_sp0_sp1_r0_r1 = DEFAULT_SY_LFR_COMMON1; |
|
451 | 449 | |
|
452 | 450 | //****************** |
|
453 | 451 | // NORMAL PARAMETERS |
|
454 | 452 | parameter_dump_packet.sy_lfr_n_swf_l[0] = (unsigned char) (SY_LFR_N_SWF_L >> 8); |
|
455 | 453 | parameter_dump_packet.sy_lfr_n_swf_l[1] = (unsigned char) (SY_LFR_N_SWF_L ); |
|
456 | 454 | parameter_dump_packet.sy_lfr_n_swf_p[0] = (unsigned char) (SY_LFR_N_SWF_P >> 8); |
|
457 | 455 | parameter_dump_packet.sy_lfr_n_swf_p[1] = (unsigned char) (SY_LFR_N_SWF_P ); |
|
458 | 456 | parameter_dump_packet.sy_lfr_n_asm_p[0] = (unsigned char) (SY_LFR_N_ASM_P >> 8); |
|
459 | 457 | parameter_dump_packet.sy_lfr_n_asm_p[1] = (unsigned char) (SY_LFR_N_ASM_P ); |
|
460 | 458 | parameter_dump_packet.sy_lfr_n_bp_p0 = (unsigned char) SY_LFR_N_BP_P0; |
|
461 | 459 | parameter_dump_packet.sy_lfr_n_bp_p1 = (unsigned char) SY_LFR_N_BP_P1; |
|
462 | 460 | |
|
463 | 461 | //***************** |
|
464 | 462 | // BURST PARAMETERS |
|
465 | 463 | parameter_dump_packet.sy_lfr_b_bp_p0 = (unsigned char) DEFAULT_SY_LFR_B_BP_P0; |
|
466 | 464 | parameter_dump_packet.sy_lfr_b_bp_p1 = (unsigned char) DEFAULT_SY_LFR_B_BP_P1; |
|
467 | 465 | |
|
468 | 466 | //**************** |
|
469 | 467 | // SBM1 PARAMETERS |
|
470 | 468 | 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 |
|
471 | 469 | parameter_dump_packet.sy_lfr_s1_bp_p1 = (unsigned char) DEFAULT_SY_LFR_S1_BP_P1; |
|
472 | 470 | |
|
473 | 471 | //**************** |
|
474 | 472 | // SBM2 PARAMETERS |
|
475 | 473 | parameter_dump_packet.sy_lfr_s2_bp_p0 = (unsigned char) DEFAULT_SY_LFR_S2_BP_P0; |
|
476 | 474 | parameter_dump_packet.sy_lfr_s2_bp_p1 = (unsigned char) DEFAULT_SY_LFR_S2_BP_P1; |
|
477 | 475 | } |
|
478 | 476 | |
|
479 | 477 | |
|
480 | 478 | |
|
481 | 479 | |
|
482 | 480 | |
|
483 | 481 | |
|
484 | 482 |
@@ -1,1519 +1,1350 | |||
|
1 | 1 | /** Functions and tasks related to waveform packet generation. |
|
2 | 2 | * |
|
3 | 3 | * @file |
|
4 | 4 | * @author P. LEROY |
|
5 | 5 | * |
|
6 | 6 | * A group of functions to handle waveforms, in snapshot or continuous format.\n |
|
7 | 7 | * |
|
8 | 8 | */ |
|
9 | 9 | |
|
10 | 10 | #include "wf_handler.h" |
|
11 | 11 | |
|
12 | 12 | //***************** |
|
13 | 13 | // waveform headers |
|
14 | 14 | // SWF |
|
15 | 15 | Header_TM_LFR_SCIENCE_SWF_t headerSWF_F0[7]; |
|
16 | 16 | Header_TM_LFR_SCIENCE_SWF_t headerSWF_F1[7]; |
|
17 | 17 | Header_TM_LFR_SCIENCE_SWF_t headerSWF_F2[7]; |
|
18 | 18 | // CWF |
|
19 | 19 | Header_TM_LFR_SCIENCE_CWF_t headerCWF_F1[7]; |
|
20 | 20 | Header_TM_LFR_SCIENCE_CWF_t headerCWF_F2_BURST[7]; |
|
21 | 21 | Header_TM_LFR_SCIENCE_CWF_t headerCWF_F2_SBM2[7]; |
|
22 | 22 | Header_TM_LFR_SCIENCE_CWF_t headerCWF_F3[7]; |
|
23 | 23 | Header_TM_LFR_SCIENCE_CWF_t headerCWF_F3_light[7]; |
|
24 | 24 | |
|
25 | 25 | //************** |
|
26 | 26 | // waveform ring |
|
27 | 27 | ring_node waveform_ring_f0[NB_RING_NODES_F0]; |
|
28 | 28 | ring_node waveform_ring_f1[NB_RING_NODES_F1]; |
|
29 | 29 | ring_node waveform_ring_f2[NB_RING_NODES_F2]; |
|
30 | 30 | ring_node *current_ring_node_f0; |
|
31 | 31 | ring_node *ring_node_to_send_swf_f0; |
|
32 | 32 | ring_node *current_ring_node_f1; |
|
33 | 33 | ring_node *ring_node_to_send_swf_f1; |
|
34 | 34 | ring_node *ring_node_to_send_cwf_f1; |
|
35 | 35 | ring_node *current_ring_node_f2; |
|
36 | 36 | ring_node *ring_node_to_send_swf_f2; |
|
37 | 37 | ring_node *ring_node_to_send_cwf_f2; |
|
38 | 38 | |
|
39 | 39 | rtems_isr waveforms_isr( rtems_vector_number vector ) |
|
40 | 40 | { |
|
41 | 41 | /** This is the interrupt sub routine called by the waveform picker core. |
|
42 | 42 | * |
|
43 | 43 | * This ISR launch different actions depending mainly on two pieces of information: |
|
44 | 44 | * 1. the values read in the registers of the waveform picker. |
|
45 | 45 | * 2. the current LFR mode. |
|
46 | 46 | * |
|
47 | 47 | */ |
|
48 | 48 | |
|
49 | 49 | static unsigned char nb_swf = 0; |
|
50 | 50 | |
|
51 | 51 | if ( (lfrCurrentMode == LFR_MODE_NORMAL) |
|
52 | 52 | || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) |
|
53 | 53 | { // in modes other than STANDBY and BURST, send the CWF_F3 data |
|
54 | 54 | if ((waveform_picker_regs->status & 0x08) == 0x08){ // [1000] f3 is full |
|
55 | 55 | // (1) change the receiving buffer for the waveform picker |
|
56 | 56 | if (waveform_picker_regs->addr_data_f3 == (int) wf_cont_f3_a) { |
|
57 | 57 | waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_b); |
|
58 | 58 | } |
|
59 | 59 | else { |
|
60 | 60 | waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_a); |
|
61 | 61 | } |
|
62 | 62 | // (2) send an event for the waveforms transmission |
|
63 | 63 | if (rtems_event_send( Task_id[TASKID_CWF3], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { |
|
64 | 64 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
65 | 65 | } |
|
66 | 66 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffff777; // reset f3 bits to 0, [1111 0111 0111 0111] |
|
67 | 67 | } |
|
68 | 68 | } |
|
69 | 69 | |
|
70 | 70 | switch(lfrCurrentMode) |
|
71 | 71 | { |
|
72 | 72 | //******** |
|
73 | 73 | // STANDBY |
|
74 | 74 | case(LFR_MODE_STANDBY): |
|
75 | 75 | break; |
|
76 | 76 | |
|
77 | 77 | //****** |
|
78 | 78 | // NORMAL |
|
79 | 79 | case(LFR_MODE_NORMAL): |
|
80 | 80 | if ( (waveform_picker_regs->status & 0xff8) != 0x00) // [1000] check the error bits |
|
81 | 81 | { |
|
82 | 82 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
83 | 83 | } |
|
84 | 84 | if ( (waveform_picker_regs->status & 0x07) == 0x07) // [0111] check the f2, f1, f0 full bits |
|
85 | 85 | { |
|
86 | 86 | // change F0 ring node |
|
87 | 87 | ring_node_to_send_swf_f0 = current_ring_node_f0; |
|
88 | 88 | current_ring_node_f0 = current_ring_node_f0->next; |
|
89 | 89 | waveform_picker_regs->addr_data_f0 = current_ring_node_f0->buffer_address; |
|
90 | 90 | // change F1 ring node |
|
91 | 91 | ring_node_to_send_swf_f1 = current_ring_node_f1; |
|
92 | 92 | current_ring_node_f1 = current_ring_node_f1->next; |
|
93 | 93 | waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address; |
|
94 | 94 | // change F2 ring node |
|
95 | 95 | ring_node_to_send_swf_f2 = current_ring_node_f2; |
|
96 | 96 | current_ring_node_f2 = current_ring_node_f2->next; |
|
97 | 97 | waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address; |
|
98 | 98 | // |
|
99 | if (nb_swf < 2) | |
|
100 |
|
|
|
99 | // if (nb_swf < 2) | |
|
100 | if (true) | |
|
101 | 101 | { |
|
102 | 102 | if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) { |
|
103 | 103 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
104 | 104 | } |
|
105 | 105 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffff888; // [1000 1000 1000] |
|
106 | 106 | nb_swf = nb_swf + 1; |
|
107 | 107 | } |
|
108 | 108 | else |
|
109 | 109 | { |
|
110 | 110 | reset_wfp_burst_enable(); |
|
111 | 111 | nb_swf = 0; |
|
112 | 112 | } |
|
113 | 113 | |
|
114 | 114 | } |
|
115 | 115 | |
|
116 | 116 | break; |
|
117 | 117 | |
|
118 | 118 | //****** |
|
119 | 119 | // BURST |
|
120 | 120 | case(LFR_MODE_BURST): |
|
121 | 121 | if ( (waveform_picker_regs->status & 0x04) == 0x04 ){ // [0100] check the f2 full bit |
|
122 | 122 | // (1) change the receiving buffer for the waveform picker |
|
123 | 123 | ring_node_to_send_cwf_f2 = current_ring_node_f2; |
|
124 | 124 | current_ring_node_f2 = current_ring_node_f2->next; |
|
125 | 125 | waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address; |
|
126 | 126 | // (2) send an event for the waveforms transmission |
|
127 | 127 | if (rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_BURST ) != RTEMS_SUCCESSFUL) { |
|
128 | 128 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
129 | 129 | } |
|
130 | 130 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bit = 0 |
|
131 | 131 | } |
|
132 | 132 | break; |
|
133 | 133 | |
|
134 | 134 | //***** |
|
135 | 135 | // SBM1 |
|
136 | 136 | case(LFR_MODE_SBM1): |
|
137 | 137 | if ( (waveform_picker_regs->status & 0x02) == 0x02 ) { // [0010] check the f1 full bit |
|
138 | 138 | // (1) change the receiving buffer for the waveform picker |
|
139 | 139 | ring_node_to_send_cwf_f1 = current_ring_node_f1; |
|
140 | 140 | current_ring_node_f1 = current_ring_node_f1->next; |
|
141 | 141 | waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address; |
|
142 | 142 | // (2) send an event for the waveforms transmission |
|
143 | 143 | if (rtems_event_send( Task_id[TASKID_CWF1], RTEMS_EVENT_MODE_SBM1 ) != RTEMS_SUCCESSFUL) { |
|
144 | 144 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
145 | 145 | } |
|
146 | 146 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffddd; // [1111 1101 1101 1101] f1 bit = 0 |
|
147 | 147 | } |
|
148 | 148 | if ( (waveform_picker_regs->status & 0x01) == 0x01 ) { // [0001] check the f0 full bit |
|
149 | 149 | ring_node_to_send_swf_f1 = current_ring_node_f1->previous; |
|
150 | 150 | } |
|
151 | 151 | if ( (waveform_picker_regs->status & 0x04) == 0x04 ) { // [0100] check the f2 full bit |
|
152 | 152 | if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) { |
|
153 | 153 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
154 | 154 | } |
|
155 | 155 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffaaa; // [1111 1010 1010 1010] f2 and f0 bits = 0 |
|
156 | 156 | } |
|
157 | 157 | break; |
|
158 | 158 | |
|
159 | 159 | //***** |
|
160 | 160 | // SBM2 |
|
161 | 161 | case(LFR_MODE_SBM2): |
|
162 | 162 | if ( (waveform_picker_regs->status & 0x04) == 0x04 ){ // [0100] check the f2 full bit |
|
163 | 163 | // (1) change the receiving buffer for the waveform picker |
|
164 | 164 | ring_node_to_send_cwf_f2 = current_ring_node_f2; |
|
165 | 165 | current_ring_node_f2 = current_ring_node_f2->next; |
|
166 | 166 | waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address; |
|
167 | 167 | // (2) send an event for the waveforms transmission |
|
168 | 168 | if (rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_SBM2 ) != RTEMS_SUCCESSFUL) { |
|
169 | 169 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
170 | 170 | } |
|
171 | 171 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bit = 0 |
|
172 | 172 | } |
|
173 | 173 | if ( (waveform_picker_regs->status & 0x01) == 0x01 ) { // [0001] check the f0 full bit |
|
174 | 174 | ring_node_to_send_swf_f2 = current_ring_node_f2->previous; |
|
175 | 175 | } |
|
176 | 176 | if ( (waveform_picker_regs->status & 0x02) == 0x02 ) { // [0010] check the f1 full bit |
|
177 | 177 | if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) { |
|
178 | 178 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
179 | 179 | } |
|
180 | 180 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffccc; // [1111 1100 1100 1100] f1, f0 bits = 0 |
|
181 | 181 | } |
|
182 | 182 | break; |
|
183 | 183 | |
|
184 | 184 | //******** |
|
185 | 185 | // DEFAULT |
|
186 | 186 | default: |
|
187 | 187 | break; |
|
188 | 188 | } |
|
189 | 189 | } |
|
190 | 190 | |
|
191 | 191 | rtems_isr waveforms_isr_alt( rtems_vector_number vector ) |
|
192 | 192 | { |
|
193 | 193 | /** This is the interrupt sub routine called by the waveform picker core. |
|
194 | 194 | * |
|
195 | 195 | * This ISR launch different actions depending mainly on two pieces of information: |
|
196 | 196 | * 1. the values read in the registers of the waveform picker. |
|
197 | 197 | * 2. the current LFR mode. |
|
198 | 198 | * |
|
199 | 199 | */ |
|
200 | 200 | |
|
201 | 201 | if ( (lfrCurrentMode == LFR_MODE_NORMAL) |
|
202 | 202 | || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) |
|
203 | 203 | { // in modes other than STANDBY and BURST, send the CWF_F3 data |
|
204 | 204 | if ((waveform_picker_regs->status & 0x08) == 0x08){ // [1000] f3 is full |
|
205 | 205 | // (1) change the receiving buffer for the waveform picker |
|
206 | 206 | if (waveform_picker_regs->addr_data_f3 == (int) wf_cont_f3_a) { |
|
207 | 207 | waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_b); |
|
208 | 208 | } |
|
209 | 209 | else { |
|
210 | 210 | waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_a); |
|
211 | 211 | } |
|
212 | 212 | // (2) send an event for the waveforms transmission |
|
213 | 213 | if (rtems_event_send( Task_id[TASKID_CWF3], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { |
|
214 | 214 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
215 | 215 | } |
|
216 | 216 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffff777; // reset f3 bits to 0, [1111 0111 0111 0111] |
|
217 | 217 | } |
|
218 | 218 | } |
|
219 | 219 | |
|
220 | 220 | switch(lfrCurrentMode) |
|
221 | 221 | { |
|
222 | 222 | //******** |
|
223 | 223 | // STANDBY |
|
224 | 224 | case(LFR_MODE_STANDBY): |
|
225 | 225 | break; |
|
226 | 226 | |
|
227 | 227 | //****** |
|
228 | 228 | // NORMAL |
|
229 | 229 | case(LFR_MODE_NORMAL): |
|
230 | 230 | if ( (waveform_picker_regs->status & 0xff8) != 0x00) // [1000] check the error bits |
|
231 | 231 | { |
|
232 | 232 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
233 | 233 | } |
|
234 | 234 | if ( (waveform_picker_regs->status & 0x01) == 0x01) // [0001] check the f0 full bit |
|
235 | 235 | { |
|
236 | 236 | // change F0 ring node |
|
237 | 237 | ring_node_to_send_swf_f0 = current_ring_node_f0; |
|
238 | 238 | current_ring_node_f0 = current_ring_node_f0->next; |
|
239 | 239 | waveform_picker_regs->addr_data_f0 = current_ring_node_f0->buffer_address; |
|
240 | 240 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffeee; // [1110 1110 1110] |
|
241 | 241 | if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL_SWF_F0 ) != RTEMS_SUCCESSFUL) { |
|
242 | 242 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
243 | 243 | } |
|
244 | 244 | } |
|
245 | 245 | if ( (waveform_picker_regs->status & 0x02) == 0x02) // [0010] check the f1 full bit |
|
246 | 246 | { |
|
247 | 247 | // change F1 ring node |
|
248 | 248 | ring_node_to_send_swf_f1 = current_ring_node_f1; |
|
249 | 249 | current_ring_node_f1 = current_ring_node_f1->next; |
|
250 | 250 | waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address; |
|
251 | 251 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffddd; // [1101 1101 1101] |
|
252 | 252 | if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL_SWF_F1 ) != RTEMS_SUCCESSFUL) { |
|
253 | 253 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
254 | 254 | } |
|
255 | 255 | } |
|
256 | 256 | if ( (waveform_picker_regs->status & 0x04) == 0x04) // [0100] check the f2 full bit |
|
257 | 257 | { |
|
258 | 258 | // change F2 ring node |
|
259 | 259 | ring_node_to_send_swf_f2 = current_ring_node_f2; |
|
260 | 260 | current_ring_node_f2 = current_ring_node_f2->next; |
|
261 | 261 | waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address; |
|
262 | 262 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1011 1011 1011] |
|
263 | 263 | if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL_SWF_F2 ) != RTEMS_SUCCESSFUL) { |
|
264 | 264 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
265 | 265 | } |
|
266 | 266 | } |
|
267 | 267 | break; |
|
268 | 268 | |
|
269 | 269 | //****** |
|
270 | 270 | // BURST |
|
271 | 271 | case(LFR_MODE_BURST): |
|
272 | 272 | if ( (waveform_picker_regs->status & 0x04) == 0x04 ){ // [0100] check the f2 full bit |
|
273 | 273 | // (1) change the receiving buffer for the waveform picker |
|
274 | 274 | ring_node_to_send_cwf_f2 = current_ring_node_f2; |
|
275 | 275 | current_ring_node_f2 = current_ring_node_f2->next; |
|
276 | 276 | waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address; |
|
277 | 277 | // (2) send an event for the waveforms transmission |
|
278 | 278 | if (rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_BURST ) != RTEMS_SUCCESSFUL) { |
|
279 | 279 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
280 | 280 | } |
|
281 | 281 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bit = 0 |
|
282 | 282 | } |
|
283 | 283 | break; |
|
284 | 284 | |
|
285 | 285 | //***** |
|
286 | 286 | // SBM1 |
|
287 | 287 | case(LFR_MODE_SBM1): |
|
288 | 288 | if ( (waveform_picker_regs->status & 0x02) == 0x02 ) { // [0010] check the f1 full bit |
|
289 | 289 | // (1) change the receiving buffer for the waveform picker |
|
290 | 290 | ring_node_to_send_cwf_f1 = current_ring_node_f1; |
|
291 | 291 | current_ring_node_f1 = current_ring_node_f1->next; |
|
292 | 292 | waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address; |
|
293 | 293 | // (2) send an event for the waveforms transmission |
|
294 | 294 | if (rtems_event_send( Task_id[TASKID_CWF1], RTEMS_EVENT_MODE_SBM1 ) != RTEMS_SUCCESSFUL) { |
|
295 | 295 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
296 | 296 | } |
|
297 | 297 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffddd; // [1111 1101 1101 1101] f1 bit = 0 |
|
298 | 298 | } |
|
299 | 299 | if ( (waveform_picker_regs->status & 0x01) == 0x01 ) { // [0001] check the f0 full bit |
|
300 | 300 | ring_node_to_send_swf_f1 = current_ring_node_f1->previous; |
|
301 | 301 | } |
|
302 | 302 | if ( (waveform_picker_regs->status & 0x04) == 0x04 ) { // [0100] check the f2 full bit |
|
303 | 303 | if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) { |
|
304 | 304 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
305 | 305 | } |
|
306 | 306 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffaaa; // [1111 1010 1010 1010] f2 and f0 bits = 0 |
|
307 | 307 | } |
|
308 | 308 | break; |
|
309 | 309 | |
|
310 | 310 | //***** |
|
311 | 311 | // SBM2 |
|
312 | 312 | case(LFR_MODE_SBM2): |
|
313 | 313 | if ( (waveform_picker_regs->status & 0x04) == 0x04 ){ // [0100] check the f2 full bit |
|
314 | 314 | // (1) change the receiving buffer for the waveform picker |
|
315 | 315 | ring_node_to_send_cwf_f2 = current_ring_node_f2; |
|
316 | 316 | current_ring_node_f2 = current_ring_node_f2->next; |
|
317 | 317 | waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address; |
|
318 | 318 | // (2) send an event for the waveforms transmission |
|
319 | 319 | if (rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_SBM2 ) != RTEMS_SUCCESSFUL) { |
|
320 | 320 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
321 | 321 | } |
|
322 | 322 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bit = 0 |
|
323 | 323 | } |
|
324 | 324 | if ( (waveform_picker_regs->status & 0x01) == 0x01 ) { // [0001] check the f0 full bit |
|
325 | 325 | ring_node_to_send_swf_f2 = current_ring_node_f2->previous; |
|
326 | 326 | } |
|
327 | 327 | if ( (waveform_picker_regs->status & 0x02) == 0x02 ) { // [0010] check the f1 full bit |
|
328 | 328 | if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) { |
|
329 | 329 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
330 | 330 | } |
|
331 | 331 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffccc; // [1111 1100 1100 1100] f1, f0 bits = 0 |
|
332 | 332 | } |
|
333 | 333 | break; |
|
334 | 334 | |
|
335 | 335 | //******** |
|
336 | 336 | // DEFAULT |
|
337 | 337 | default: |
|
338 | 338 | break; |
|
339 | 339 | } |
|
340 | 340 | } |
|
341 | 341 | |
|
342 | 342 | rtems_task wfrm_task(rtems_task_argument argument) //used with the waveform picker VHDL IP |
|
343 | 343 | { |
|
344 | 344 | /** This RTEMS task is dedicated to the transmission of snapshots of the NORMAL mode. |
|
345 | 345 | * |
|
346 | 346 | * @param unused is the starting argument of the RTEMS task |
|
347 | 347 | * |
|
348 | 348 | * The following data packets are sent by this task: |
|
349 | 349 | * - TM_LFR_SCIENCE_NORMAL_SWF_F0 |
|
350 | 350 | * - TM_LFR_SCIENCE_NORMAL_SWF_F1 |
|
351 | 351 | * - TM_LFR_SCIENCE_NORMAL_SWF_F2 |
|
352 | 352 | * |
|
353 | 353 | */ |
|
354 | 354 | |
|
355 | 355 | rtems_event_set event_out; |
|
356 | 356 | rtems_id queue_id; |
|
357 | 357 | rtems_status_code status; |
|
358 | 358 | |
|
359 | 359 | init_header_snapshot_wf_table( SID_NORM_SWF_F0, headerSWF_F0 ); |
|
360 | 360 | init_header_snapshot_wf_table( SID_NORM_SWF_F1, headerSWF_F1 ); |
|
361 | 361 | init_header_snapshot_wf_table( SID_NORM_SWF_F2, headerSWF_F2 ); |
|
362 | 362 | |
|
363 | 363 | init_waveforms(); |
|
364 | 364 | |
|
365 | 365 | status = get_message_queue_id_send( &queue_id ); |
|
366 | 366 | if (status != RTEMS_SUCCESSFUL) |
|
367 | 367 | { |
|
368 | 368 | PRINTF1("in WFRM *** ERR get_message_queue_id_send %d\n", status) |
|
369 | 369 | } |
|
370 | 370 | |
|
371 | 371 | BOOT_PRINTF("in WFRM ***\n") |
|
372 | 372 | |
|
373 | 373 | while(1){ |
|
374 | 374 | // wait for an RTEMS_EVENT |
|
375 | 375 | rtems_event_receive(RTEMS_EVENT_MODE_NORMAL | RTEMS_EVENT_MODE_SBM1 |
|
376 | 376 | | RTEMS_EVENT_MODE_SBM2 | RTEMS_EVENT_MODE_SBM2_WFRM |
|
377 | 377 | | RTEMS_EVENT_MODE_NORMAL_SWF_F0 |
|
378 | 378 | | RTEMS_EVENT_MODE_NORMAL_SWF_F1 |
|
379 | 379 | | RTEMS_EVENT_MODE_NORMAL_SWF_F2, |
|
380 | 380 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); |
|
381 | 381 | if (event_out == RTEMS_EVENT_MODE_NORMAL) |
|
382 | 382 | { |
|
383 | 383 | send_waveform_SWF((volatile int*) ring_node_to_send_swf_f0->buffer_address, SID_NORM_SWF_F0, headerSWF_F0, queue_id); |
|
384 | 384 | send_waveform_SWF((volatile int*) ring_node_to_send_swf_f1->buffer_address, SID_NORM_SWF_F1, headerSWF_F1, queue_id); |
|
385 | 385 | send_waveform_SWF((volatile int*) ring_node_to_send_swf_f2->buffer_address, SID_NORM_SWF_F2, headerSWF_F2, queue_id); |
|
386 | 386 | } |
|
387 | 387 | if ( (event_out & RTEMS_EVENT_MODE_NORMAL_SWF_F0) == RTEMS_EVENT_MODE_NORMAL_SWF_F0) |
|
388 | 388 | { |
|
389 | 389 | send_waveform_SWF((volatile int*) ring_node_to_send_swf_f0->buffer_address, SID_NORM_SWF_F0, headerSWF_F0, queue_id); |
|
390 | 390 | } |
|
391 | 391 | if ( (event_out & RTEMS_EVENT_MODE_NORMAL_SWF_F1) == RTEMS_EVENT_MODE_NORMAL_SWF_F1) |
|
392 | 392 | { |
|
393 | 393 | send_waveform_SWF((volatile int*) ring_node_to_send_swf_f1->buffer_address, SID_NORM_SWF_F1, headerSWF_F1, queue_id); |
|
394 | 394 | } |
|
395 | 395 | if ( (event_out & RTEMS_EVENT_MODE_NORMAL_SWF_F2) == RTEMS_EVENT_MODE_NORMAL_SWF_F2) |
|
396 | 396 | { |
|
397 | 397 | send_waveform_SWF((volatile int*) ring_node_to_send_swf_f2->buffer_address, SID_NORM_SWF_F2, headerSWF_F2, queue_id); |
|
398 | 398 | } |
|
399 | 399 | } |
|
400 | 400 | } |
|
401 | 401 | |
|
402 | 402 | rtems_task cwf3_task(rtems_task_argument argument) //used with the waveform picker VHDL IP |
|
403 | 403 | { |
|
404 | 404 | /** This RTEMS task is dedicated to the transmission of continuous waveforms at f3. |
|
405 | 405 | * |
|
406 | 406 | * @param unused is the starting argument of the RTEMS task |
|
407 | 407 | * |
|
408 | 408 | * The following data packet is sent by this task: |
|
409 | 409 | * - TM_LFR_SCIENCE_NORMAL_CWF_F3 |
|
410 | 410 | * |
|
411 | 411 | */ |
|
412 | 412 | |
|
413 | 413 | rtems_event_set event_out; |
|
414 | 414 | rtems_id queue_id; |
|
415 | 415 | rtems_status_code status; |
|
416 | 416 | |
|
417 | 417 | init_header_continuous_wf_table( SID_NORM_CWF_LONG_F3, headerCWF_F3 ); |
|
418 | 418 | init_header_continuous_cwf3_light_table( headerCWF_F3_light ); |
|
419 | 419 | |
|
420 | 420 | status = get_message_queue_id_send( &queue_id ); |
|
421 | 421 | if (status != RTEMS_SUCCESSFUL) |
|
422 | 422 | { |
|
423 | 423 | PRINTF1("in CWF3 *** ERR get_message_queue_id_send %d\n", status) |
|
424 | 424 | } |
|
425 | 425 | |
|
426 | 426 | BOOT_PRINTF("in CWF3 ***\n") |
|
427 | 427 | |
|
428 | 428 | while(1){ |
|
429 | 429 | // wait for an RTEMS_EVENT |
|
430 | 430 | rtems_event_receive( RTEMS_EVENT_0, |
|
431 | 431 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); |
|
432 | 432 | PRINTF("send CWF F3 \n") |
|
433 | 433 | if (waveform_picker_regs->addr_data_f3 == (int) wf_cont_f3_a) { |
|
434 | 434 | if ( (parameter_dump_packet.sy_lfr_n_cwf_long_f3 & 0x01) == 0x01) |
|
435 | 435 | { |
|
436 | 436 | send_waveform_CWF( wf_cont_f3_b, SID_NORM_CWF_LONG_F3, headerCWF_F3, queue_id ); |
|
437 | 437 | } |
|
438 | 438 | else |
|
439 | 439 | { |
|
440 | 440 | send_waveform_CWF3_light( wf_cont_f3_b, headerCWF_F3_light, queue_id ); |
|
441 | 441 | } |
|
442 | 442 | } |
|
443 | 443 | else |
|
444 | 444 | { |
|
445 | 445 | if ( (parameter_dump_packet.sy_lfr_n_cwf_long_f3 & 0x01) == 0x00) |
|
446 | 446 | { |
|
447 | 447 | send_waveform_CWF( wf_cont_f3_a, SID_NORM_CWF_LONG_F3, headerCWF_F3, queue_id ); |
|
448 | 448 | } |
|
449 | 449 | else |
|
450 | 450 | { |
|
451 | 451 | send_waveform_CWF3_light( wf_cont_f3_a, headerCWF_F3_light, queue_id ); |
|
452 | 452 | } |
|
453 | 453 | |
|
454 | 454 | } |
|
455 | 455 | } |
|
456 | 456 | } |
|
457 | 457 | |
|
458 | 458 | rtems_task cwf2_task(rtems_task_argument argument) // ONLY USED IN BURST AND SBM2 |
|
459 | 459 | { |
|
460 | 460 | /** This RTEMS task is dedicated to the transmission of continuous waveforms at f2. |
|
461 | 461 | * |
|
462 | 462 | * @param unused is the starting argument of the RTEMS task |
|
463 | 463 | * |
|
464 | 464 | * The following data packet is sent by this function: |
|
465 | 465 | * - TM_LFR_SCIENCE_BURST_CWF_F2 |
|
466 | 466 | * - TM_LFR_SCIENCE_SBM2_CWF_F2 |
|
467 | 467 | * |
|
468 | 468 | */ |
|
469 | 469 | |
|
470 | 470 | rtems_event_set event_out; |
|
471 | 471 | rtems_id queue_id; |
|
472 | 472 | rtems_status_code status; |
|
473 | 473 | |
|
474 | 474 | init_header_continuous_wf_table( SID_BURST_CWF_F2, headerCWF_F2_BURST ); |
|
475 | 475 | init_header_continuous_wf_table( SID_SBM2_CWF_F2, headerCWF_F2_SBM2 ); |
|
476 | 476 | |
|
477 | 477 | status = get_message_queue_id_send( &queue_id ); |
|
478 | 478 | if (status != RTEMS_SUCCESSFUL) |
|
479 | 479 | { |
|
480 | 480 | PRINTF1("in CWF2 *** ERR get_message_queue_id_send %d\n", status) |
|
481 | 481 | } |
|
482 | 482 | |
|
483 | 483 | BOOT_PRINTF("in CWF2 ***\n") |
|
484 | 484 | |
|
485 | 485 | while(1){ |
|
486 | 486 | // wait for an RTEMS_EVENT |
|
487 | 487 | rtems_event_receive( RTEMS_EVENT_MODE_BURST | RTEMS_EVENT_MODE_SBM2, |
|
488 | 488 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); |
|
489 | 489 | if (event_out == RTEMS_EVENT_MODE_BURST) |
|
490 | 490 | { |
|
491 | 491 | send_waveform_CWF( (volatile int *) ring_node_to_send_cwf_f2->buffer_address, SID_BURST_CWF_F2, headerCWF_F2_BURST, queue_id ); |
|
492 | 492 | } |
|
493 | 493 | if (event_out == RTEMS_EVENT_MODE_SBM2) |
|
494 | 494 | { |
|
495 | 495 | send_waveform_CWF( (volatile int *) ring_node_to_send_cwf_f2->buffer_address, SID_SBM2_CWF_F2, headerCWF_F2_SBM2, queue_id ); |
|
496 | 496 | } |
|
497 | 497 | } |
|
498 | 498 | } |
|
499 | 499 | |
|
500 | 500 | rtems_task cwf1_task(rtems_task_argument argument) // ONLY USED IN SBM1 |
|
501 | 501 | { |
|
502 | 502 | /** This RTEMS task is dedicated to the transmission of continuous waveforms at f1. |
|
503 | 503 | * |
|
504 | 504 | * @param unused is the starting argument of the RTEMS task |
|
505 | 505 | * |
|
506 | 506 | * The following data packet is sent by this function: |
|
507 | 507 | * - TM_LFR_SCIENCE_SBM1_CWF_F1 |
|
508 | 508 | * |
|
509 | 509 | */ |
|
510 | 510 | |
|
511 | 511 | rtems_event_set event_out; |
|
512 | 512 | rtems_id queue_id; |
|
513 | 513 | rtems_status_code status; |
|
514 | 514 | |
|
515 | 515 | init_header_continuous_wf_table( SID_SBM1_CWF_F1, headerCWF_F1 ); |
|
516 | 516 | |
|
517 | 517 | status = get_message_queue_id_send( &queue_id ); |
|
518 | 518 | if (status != RTEMS_SUCCESSFUL) |
|
519 | 519 | { |
|
520 | 520 | PRINTF1("in CWF1 *** ERR get_message_queue_id_send %d\n", status) |
|
521 | 521 | } |
|
522 | 522 | |
|
523 | 523 | BOOT_PRINTF("in CWF1 ***\n") |
|
524 | 524 | |
|
525 | 525 | while(1){ |
|
526 | 526 | // wait for an RTEMS_EVENT |
|
527 | 527 | rtems_event_receive( RTEMS_EVENT_MODE_SBM1, |
|
528 | 528 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); |
|
529 | 529 | send_waveform_CWF( (volatile int*) ring_node_to_send_cwf_f1->buffer_address, SID_SBM1_CWF_F1, headerCWF_F1, queue_id ); |
|
530 | 530 | } |
|
531 | 531 | } |
|
532 | 532 | |
|
533 | 533 | //****************** |
|
534 | 534 | // general functions |
|
535 | 535 | void init_waveforms( void ) |
|
536 | 536 | { |
|
537 | 537 | int i = 0; |
|
538 | 538 | |
|
539 | 539 | for (i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++) |
|
540 | 540 | { |
|
541 | 541 | //*** |
|
542 | 542 | // F0 |
|
543 | 543 | // wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x88887777; // |
|
544 | 544 | // wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x22221111; // |
|
545 | 545 | // wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0x44443333; // |
|
546 | 546 | |
|
547 | 547 | //*** |
|
548 | 548 | // F1 |
|
549 | 549 | // wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x22221111; |
|
550 | 550 | // wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x44443333; |
|
551 | 551 | // wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0xaaaa0000; |
|
552 | 552 | |
|
553 | 553 | //*** |
|
554 | 554 | // F2 |
|
555 | 555 | // wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x44443333; |
|
556 | 556 | // wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x22221111; |
|
557 | 557 | // wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0xaaaa0000; |
|
558 | 558 | |
|
559 | 559 | //*** |
|
560 | 560 | // F3 |
|
561 | 561 | // wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 0 ] = val1; |
|
562 | 562 | // wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 1 ] = val2; |
|
563 | 563 | // wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 2 ] = 0xaaaa0000; |
|
564 | 564 | } |
|
565 | 565 | } |
|
566 | 566 | |
|
567 | 567 | void init_waveform_rings( void ) |
|
568 | 568 | { |
|
569 | 569 | unsigned char i; |
|
570 | 570 | |
|
571 | 571 | // F0 RING |
|
572 | 572 | waveform_ring_f0[0].next = (ring_node*) &waveform_ring_f0[1]; |
|
573 | 573 | waveform_ring_f0[0].previous = (ring_node*) &waveform_ring_f0[NB_RING_NODES_F0-1]; |
|
574 | 574 | waveform_ring_f0[0].buffer_address = (int) &wf_snap_f0[0][0]; |
|
575 | 575 | |
|
576 | 576 | waveform_ring_f0[NB_RING_NODES_F0-1].next = (ring_node*) &waveform_ring_f0[0]; |
|
577 | 577 | waveform_ring_f0[NB_RING_NODES_F0-1].previous = (ring_node*) &waveform_ring_f0[NB_RING_NODES_F0-2]; |
|
578 | 578 | waveform_ring_f0[NB_RING_NODES_F0-1].buffer_address = (int) &wf_snap_f0[NB_RING_NODES_F0-1][0]; |
|
579 | 579 | |
|
580 | 580 | for(i=1; i<NB_RING_NODES_F0-1; i++) |
|
581 | 581 | { |
|
582 | 582 | waveform_ring_f0[i].next = (ring_node*) &waveform_ring_f0[i+1]; |
|
583 | 583 | waveform_ring_f0[i].previous = (ring_node*) &waveform_ring_f0[i-1]; |
|
584 | 584 | waveform_ring_f0[i].buffer_address = (int) &wf_snap_f0[i][0]; |
|
585 | 585 | } |
|
586 | 586 | |
|
587 | 587 | // F1 RING |
|
588 | 588 | waveform_ring_f1[0].next = (ring_node*) &waveform_ring_f1[1]; |
|
589 | 589 | waveform_ring_f1[0].previous = (ring_node*) &waveform_ring_f1[NB_RING_NODES_F1-1]; |
|
590 | 590 | waveform_ring_f1[0].buffer_address = (int) &wf_snap_f1[0][0]; |
|
591 | 591 | |
|
592 | 592 | waveform_ring_f1[NB_RING_NODES_F1-1].next = (ring_node*) &waveform_ring_f1[0]; |
|
593 | 593 | waveform_ring_f1[NB_RING_NODES_F1-1].previous = (ring_node*) &waveform_ring_f1[NB_RING_NODES_F1-2]; |
|
594 | 594 | waveform_ring_f1[NB_RING_NODES_F1-1].buffer_address = (int) &wf_snap_f1[NB_RING_NODES_F1-1][0]; |
|
595 | 595 | |
|
596 | 596 | for(i=1; i<NB_RING_NODES_F1-1; i++) |
|
597 | 597 | { |
|
598 | 598 | waveform_ring_f1[i].next = (ring_node*) &waveform_ring_f1[i+1]; |
|
599 | 599 | waveform_ring_f1[i].previous = (ring_node*) &waveform_ring_f1[i-1]; |
|
600 | 600 | waveform_ring_f1[i].buffer_address = (int) &wf_snap_f1[i][0]; |
|
601 | 601 | } |
|
602 | 602 | |
|
603 | 603 | // F2 RING |
|
604 | 604 | waveform_ring_f2[0].next = (ring_node*) &waveform_ring_f2[1]; |
|
605 | 605 | waveform_ring_f2[0].previous = (ring_node*) &waveform_ring_f2[NB_RING_NODES_F2-1]; |
|
606 | 606 | waveform_ring_f2[0].buffer_address = (int) &wf_snap_f2[0][0]; |
|
607 | 607 | |
|
608 | 608 | waveform_ring_f2[NB_RING_NODES_F2-1].next = (ring_node*) &waveform_ring_f2[0]; |
|
609 | 609 | waveform_ring_f2[NB_RING_NODES_F2-1].previous = (ring_node*) &waveform_ring_f2[NB_RING_NODES_F2-2]; |
|
610 | 610 | waveform_ring_f2[NB_RING_NODES_F2-1].buffer_address = (int) &wf_snap_f2[NB_RING_NODES_F2-1][0]; |
|
611 | 611 | |
|
612 | 612 | for(i=1; i<NB_RING_NODES_F2-1; i++) |
|
613 | 613 | { |
|
614 | 614 | waveform_ring_f2[i].next = (ring_node*) &waveform_ring_f2[i+1]; |
|
615 | 615 | waveform_ring_f2[i].previous = (ring_node*) &waveform_ring_f2[i-1]; |
|
616 | 616 | waveform_ring_f2[i].buffer_address = (int) &wf_snap_f2[i][0]; |
|
617 | 617 | } |
|
618 | 618 | |
|
619 | 619 | DEBUG_PRINTF1("waveform_ring_f0 @%x\n", (unsigned int) waveform_ring_f0) |
|
620 | 620 | DEBUG_PRINTF1("waveform_ring_f1 @%x\n", (unsigned int) waveform_ring_f1) |
|
621 | 621 | DEBUG_PRINTF1("waveform_ring_f2 @%x\n", (unsigned int) waveform_ring_f2) |
|
622 | 622 | |
|
623 | 623 | } |
|
624 | 624 | |
|
625 | 625 | void reset_current_ring_nodes( void ) |
|
626 | 626 | { |
|
627 | 627 | current_ring_node_f0 = waveform_ring_f0; |
|
628 | 628 | ring_node_to_send_swf_f0 = waveform_ring_f0; |
|
629 | 629 | |
|
630 | 630 | current_ring_node_f1 = waveform_ring_f1; |
|
631 | 631 | ring_node_to_send_cwf_f1 = waveform_ring_f1; |
|
632 | 632 | ring_node_to_send_swf_f1 = waveform_ring_f1; |
|
633 | 633 | |
|
634 | 634 | current_ring_node_f2 = waveform_ring_f2; |
|
635 | 635 | ring_node_to_send_cwf_f2 = waveform_ring_f2; |
|
636 | 636 | ring_node_to_send_swf_f2 = waveform_ring_f2; |
|
637 | 637 | } |
|
638 | 638 | |
|
639 | 639 | int init_header_snapshot_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF) |
|
640 | 640 | { |
|
641 | 641 | unsigned char i; |
|
642 | 642 | |
|
643 | 643 | for (i=0; i<7; i++) |
|
644 | 644 | { |
|
645 | 645 | headerSWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
646 | 646 | headerSWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
647 | 647 | headerSWF[ i ].reserved = DEFAULT_RESERVED; |
|
648 | 648 | headerSWF[ i ].userApplication = CCSDS_USER_APP; |
|
649 | 649 | headerSWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8); |
|
650 | 650 | headerSWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST); |
|
651 | 651 | headerSWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; |
|
652 | 652 | if (i == 6) |
|
653 | 653 | { |
|
654 | 654 | headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_224 >> 8); |
|
655 | 655 | headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_224 ); |
|
656 | 656 | headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_224 >> 8); |
|
657 | 657 | headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_224 ); |
|
658 | 658 | } |
|
659 | 659 | else |
|
660 | 660 | { |
|
661 | 661 | headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_304 >> 8); |
|
662 | 662 | headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_304 ); |
|
663 | 663 | headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_304 >> 8); |
|
664 | 664 | headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_304 ); |
|
665 | 665 | } |
|
666 | 666 | headerSWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; |
|
667 | 667 | headerSWF[ i ].pktCnt = DEFAULT_PKTCNT; // PKT_CNT |
|
668 | 668 | headerSWF[ i ].pktNr = i+1; // PKT_NR |
|
669 | 669 | // DATA FIELD HEADER |
|
670 | 670 | headerSWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
671 | 671 | headerSWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type |
|
672 | 672 | headerSWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype |
|
673 | 673 | headerSWF[ i ].destinationID = TM_DESTINATION_ID_GROUND; |
|
674 | 674 | // AUXILIARY DATA HEADER |
|
675 | 675 | headerSWF[ i ].time[0] = 0x00; |
|
676 | 676 | headerSWF[ i ].time[0] = 0x00; |
|
677 | 677 | headerSWF[ i ].time[0] = 0x00; |
|
678 | 678 | headerSWF[ i ].time[0] = 0x00; |
|
679 | 679 | headerSWF[ i ].time[0] = 0x00; |
|
680 | 680 | headerSWF[ i ].time[0] = 0x00; |
|
681 | 681 | headerSWF[ i ].sid = sid; |
|
682 | 682 | headerSWF[ i ].hkBIA = DEFAULT_HKBIA; |
|
683 | 683 | } |
|
684 | 684 | return LFR_SUCCESSFUL; |
|
685 | 685 | } |
|
686 | 686 | |
|
687 | 687 | int init_header_continuous_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF ) |
|
688 | 688 | { |
|
689 | 689 | unsigned int i; |
|
690 | 690 | |
|
691 | 691 | for (i=0; i<7; i++) |
|
692 | 692 | { |
|
693 | 693 | headerCWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
694 | 694 | headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
695 | 695 | headerCWF[ i ].reserved = DEFAULT_RESERVED; |
|
696 | 696 | headerCWF[ i ].userApplication = CCSDS_USER_APP; |
|
697 | 697 | if ( (sid == SID_SBM1_CWF_F1) || (sid == SID_SBM2_CWF_F2) ) |
|
698 | 698 | { |
|
699 | 699 | headerCWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_SBM1_SBM2 >> 8); |
|
700 | 700 | headerCWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_SBM1_SBM2); |
|
701 | 701 | } |
|
702 | 702 | else |
|
703 | 703 | { |
|
704 | 704 | headerCWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8); |
|
705 | 705 | headerCWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST); |
|
706 | 706 | } |
|
707 | 707 | headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; |
|
708 | 708 | headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_336 >> 8); |
|
709 | 709 | headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_336 ); |
|
710 | 710 | headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_CWF >> 8); |
|
711 | 711 | headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_CWF ); |
|
712 | 712 | headerCWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; |
|
713 | 713 | // DATA FIELD HEADER |
|
714 | 714 | headerCWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
715 | 715 | headerCWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type |
|
716 | 716 | headerCWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype |
|
717 | 717 | headerCWF[ i ].destinationID = TM_DESTINATION_ID_GROUND; |
|
718 | 718 | // AUXILIARY DATA HEADER |
|
719 | 719 | headerCWF[ i ].sid = sid; |
|
720 | 720 | headerCWF[ i ].hkBIA = DEFAULT_HKBIA; |
|
721 | 721 | headerCWF[ i ].time[0] = 0x00; |
|
722 | 722 | headerCWF[ i ].time[0] = 0x00; |
|
723 | 723 | headerCWF[ i ].time[0] = 0x00; |
|
724 | 724 | headerCWF[ i ].time[0] = 0x00; |
|
725 | 725 | headerCWF[ i ].time[0] = 0x00; |
|
726 | 726 | headerCWF[ i ].time[0] = 0x00; |
|
727 | 727 | } |
|
728 | 728 | return LFR_SUCCESSFUL; |
|
729 | 729 | } |
|
730 | 730 | |
|
731 | 731 | int init_header_continuous_cwf3_light_table( Header_TM_LFR_SCIENCE_CWF_t *headerCWF ) |
|
732 | 732 | { |
|
733 | 733 | unsigned int i; |
|
734 | 734 | |
|
735 | 735 | for (i=0; i<7; i++) |
|
736 | 736 | { |
|
737 | 737 | headerCWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
738 | 738 | headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
739 | 739 | headerCWF[ i ].reserved = DEFAULT_RESERVED; |
|
740 | 740 | headerCWF[ i ].userApplication = CCSDS_USER_APP; |
|
741 | 741 | |
|
742 | 742 | headerCWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8); |
|
743 | 743 | headerCWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST); |
|
744 | 744 | |
|
745 | 745 | headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; |
|
746 | 746 | headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_672 >> 8); |
|
747 | 747 | headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_672 ); |
|
748 | 748 | headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_CWF_SHORT_F3 >> 8); |
|
749 | 749 | headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_CWF_SHORT_F3 ); |
|
750 | 750 | |
|
751 | 751 | headerCWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; |
|
752 | 752 | // DATA FIELD HEADER |
|
753 | 753 | headerCWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
754 | 754 | headerCWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type |
|
755 | 755 | headerCWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype |
|
756 | 756 | headerCWF[ i ].destinationID = TM_DESTINATION_ID_GROUND; |
|
757 | 757 | // AUXILIARY DATA HEADER |
|
758 | 758 | headerCWF[ i ].sid = SID_NORM_CWF_F3; |
|
759 | 759 | headerCWF[ i ].hkBIA = DEFAULT_HKBIA; |
|
760 | 760 | headerCWF[ i ].time[0] = 0x00; |
|
761 | 761 | headerCWF[ i ].time[0] = 0x00; |
|
762 | 762 | headerCWF[ i ].time[0] = 0x00; |
|
763 | 763 | headerCWF[ i ].time[0] = 0x00; |
|
764 | 764 | headerCWF[ i ].time[0] = 0x00; |
|
765 | 765 | headerCWF[ i ].time[0] = 0x00; |
|
766 | 766 | } |
|
767 | 767 | return LFR_SUCCESSFUL; |
|
768 | 768 | } |
|
769 | 769 | |
|
770 | 770 | int send_waveform_SWF( volatile int *waveform, unsigned int sid, |
|
771 | 771 | Header_TM_LFR_SCIENCE_SWF_t *headerSWF, rtems_id queue_id ) |
|
772 | 772 | { |
|
773 | 773 | /** This function sends SWF CCSDS packets (F2, F1 or F0). |
|
774 | 774 | * |
|
775 | 775 | * @param waveform points to the buffer containing the data that will be send. |
|
776 | 776 | * @param sid is the source identifier of the data that will be sent. |
|
777 | 777 | * @param headerSWF points to a table of headers that have been prepared for the data transmission. |
|
778 | 778 | * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures |
|
779 | 779 | * contain information to setup the transmission of the data packets. |
|
780 | 780 | * |
|
781 | 781 | * One group of 2048 samples is sent as 7 consecutive packets, 6 packets containing 340 blocks and 8 packets containing 8 blocks. |
|
782 | 782 | * |
|
783 | 783 | */ |
|
784 | 784 | |
|
785 | 785 | unsigned int i; |
|
786 | 786 | int ret; |
|
787 | 787 | unsigned int coarseTime; |
|
788 | 788 | unsigned int fineTime; |
|
789 | 789 | rtems_status_code status; |
|
790 | 790 | spw_ioctl_pkt_send spw_ioctl_send_SWF; |
|
791 | 791 | |
|
792 | 792 | spw_ioctl_send_SWF.hlen = TM_HEADER_LEN + 4 + 12; // + 4 is for the protocole extra header, + 12 is for the auxiliary header |
|
793 | 793 | spw_ioctl_send_SWF.options = 0; |
|
794 | 794 | |
|
795 | 795 | ret = LFR_DEFAULT; |
|
796 | 796 | |
|
797 | 797 | PRINTF1("sid = %d, ", sid) |
|
798 | 798 | PRINTF2("coarse = %x, fine = %x\n", waveform[0], waveform[1]) |
|
799 | 799 | |
|
800 | 800 | for (i=0; i<7; i++) // send waveform |
|
801 | 801 | { |
|
802 | 802 | #ifdef VHDL_DEV |
|
803 | 803 | spw_ioctl_send_SWF.data = (char*) &waveform[ (i * BLK_NR_304 * NB_WORDS_SWF_BLK) + TIME_OFFSET]; |
|
804 | 804 | #else |
|
805 | 805 | spw_ioctl_send_SWF.data = (char*) &waveform[ (i * BLK_NR_304 * NB_WORDS_SWF_BLK) ]; |
|
806 | 806 | #endif |
|
807 | 807 | spw_ioctl_send_SWF.hdr = (char*) &headerSWF[ i ]; |
|
808 | 808 | // BUILD THE DATA |
|
809 | 809 | if (i==6) { |
|
810 | 810 | spw_ioctl_send_SWF.dlen = BLK_NR_224 * NB_BYTES_SWF_BLK; |
|
811 | 811 | } |
|
812 | 812 | else { |
|
813 | 813 | spw_ioctl_send_SWF.dlen = BLK_NR_304 * NB_BYTES_SWF_BLK; |
|
814 | 814 | } |
|
815 | 815 | // SET PACKET SEQUENCE COUNTER |
|
816 | 816 | increment_seq_counter_source_id( headerSWF[ i ].packetSequenceControl, sid ); |
|
817 | 817 | // SET PACKET TIME |
|
818 | 818 | #ifdef VHDL_DEV |
|
819 | 819 | coarseTime = waveform[0]; |
|
820 | 820 | fineTime = waveform[1]; |
|
821 | 821 | compute_acquisition_time( &coarseTime, &fineTime, sid, i); |
|
822 | 822 | |
|
823 | 823 | headerSWF[ i ].acquisitionTime[0] = (unsigned char) (coarseTime >> 24 ); |
|
824 | 824 | headerSWF[ i ].acquisitionTime[1] = (unsigned char) (coarseTime >> 16 ); |
|
825 | 825 | headerSWF[ i ].acquisitionTime[2] = (unsigned char) (coarseTime >> 8 ); |
|
826 | 826 | headerSWF[ i ].acquisitionTime[3] = (unsigned char) (coarseTime ); |
|
827 | 827 | headerSWF[ i ].acquisitionTime[4] = (unsigned char) (fineTime >> 8 ); |
|
828 | 828 | headerSWF[ i ].acquisitionTime[5] = (unsigned char) (fineTime ); |
|
829 | 829 | #else |
|
830 | 830 | headerSWF[ i ].acquisitionTime[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
831 | 831 | headerSWF[ i ].acquisitionTime[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
832 | 832 | headerSWF[ i ].acquisitionTime[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
833 | 833 | headerSWF[ i ].acquisitionTime[3] = (unsigned char) (time_management_regs->coarse_time); |
|
834 | 834 | headerSWF[ i ].acquisitionTime[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
835 | 835 | headerSWF[ i ].acquisitionTime[5] = (unsigned char) (time_management_regs->fine_time); |
|
836 | 836 | #endif |
|
837 | 837 | headerSWF[ i ].time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
838 | 838 | headerSWF[ i ].time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
839 | 839 | headerSWF[ i ].time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
840 | 840 | headerSWF[ i ].time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
841 | 841 | headerSWF[ i ].time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
842 | 842 | headerSWF[ i ].time[5] = (unsigned char) (time_management_regs->fine_time); |
|
843 | 843 | // SEND PACKET |
|
844 | 844 | status = rtems_message_queue_send( queue_id, &spw_ioctl_send_SWF, ACTION_MSG_SPW_IOCTL_SEND_SIZE); |
|
845 | 845 | if (status != RTEMS_SUCCESSFUL) { |
|
846 | 846 | printf("%d-%d, ERR %d\n", sid, i, (int) status); |
|
847 | 847 | ret = LFR_DEFAULT; |
|
848 | 848 | } |
|
849 | 849 | // rtems_task_wake_after(TIME_BETWEEN_TWO_SWF_PACKETS); // 300 ms between each packet => 7 * 3 = 21 packets => 6.3 seconds |
|
850 | 850 | } |
|
851 | 851 | |
|
852 | 852 | return ret; |
|
853 | 853 | } |
|
854 | 854 | |
|
855 | 855 | int send_waveform_CWF(volatile int *waveform, unsigned int sid, |
|
856 | 856 | Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id) |
|
857 | 857 | { |
|
858 | 858 | /** This function sends CWF CCSDS packets (F2, F1 or F0). |
|
859 | 859 | * |
|
860 | 860 | * @param waveform points to the buffer containing the data that will be send. |
|
861 | 861 | * @param sid is the source identifier of the data that will be sent. |
|
862 | 862 | * @param headerCWF points to a table of headers that have been prepared for the data transmission. |
|
863 | 863 | * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures |
|
864 | 864 | * contain information to setup the transmission of the data packets. |
|
865 | 865 | * |
|
866 | 866 | * One group of 2048 samples is sent as 7 consecutive packets, 6 packets containing 340 blocks and 8 packets containing 8 blocks. |
|
867 | 867 | * |
|
868 | 868 | */ |
|
869 | 869 | |
|
870 | 870 | unsigned int i; |
|
871 | 871 | int ret; |
|
872 | 872 | unsigned char *coarseTimePtr; |
|
873 | 873 | unsigned char *fineTimePtr; |
|
874 | 874 | rtems_status_code status; |
|
875 | 875 | spw_ioctl_pkt_send spw_ioctl_send_CWF; |
|
876 | 876 | |
|
877 | 877 | spw_ioctl_send_CWF.hlen = TM_HEADER_LEN + 4 + 10; // + 4 is for the protocole extra header, + 10 is for the auxiliary header |
|
878 | 878 | spw_ioctl_send_CWF.options = 0; |
|
879 | 879 | |
|
880 | 880 | ret = LFR_DEFAULT; |
|
881 | 881 | |
|
882 | 882 | for (i=0; i<7; i++) // send waveform |
|
883 | 883 | { |
|
884 | 884 | int coarseTime = 0x00; |
|
885 | 885 | int fineTime = 0x00; |
|
886 | 886 | #ifdef VHDL_DEV |
|
887 | 887 | spw_ioctl_send_CWF.data = (char*) &waveform[ (i * BLK_NR_CWF * NB_WORDS_SWF_BLK) + TIME_OFFSET]; |
|
888 | 888 | #else |
|
889 | 889 | spw_ioctl_send_CWF.data = (char*) &waveform[ (i * BLK_NR_CWF * NB_WORDS_SWF_BLK) ]; |
|
890 | 890 | #endif |
|
891 | 891 | spw_ioctl_send_CWF.hdr = (char*) &headerCWF[ i ]; |
|
892 | 892 | // BUILD THE DATA |
|
893 | 893 | spw_ioctl_send_CWF.dlen = BLK_NR_CWF * NB_BYTES_SWF_BLK; |
|
894 | 894 | // SET PACKET SEQUENCE COUNTER |
|
895 | 895 | increment_seq_counter_source_id( headerCWF[ i ].packetSequenceControl, sid ); |
|
896 | 896 | // SET PACKET TIME |
|
897 | 897 | #ifdef VHDL_DEV |
|
898 | 898 | coarseTimePtr = (unsigned char *) &waveform; |
|
899 | 899 | fineTimePtr = (unsigned char *) &waveform[1]; |
|
900 | 900 | headerCWF[ i ].acquisitionTime[0] = coarseTimePtr[2]; |
|
901 | 901 | headerCWF[ i ].acquisitionTime[1] = coarseTimePtr[3]; |
|
902 | 902 | headerCWF[ i ].acquisitionTime[2] = coarseTimePtr[0]; |
|
903 | 903 | headerCWF[ i ].acquisitionTime[3] = coarseTimePtr[1]; |
|
904 | 904 | headerCWF[ i ].acquisitionTime[4] = fineTimePtr[0]; |
|
905 | 905 | headerCWF[ i ].acquisitionTime[5] = fineTimePtr[1]; |
|
906 | 906 | #else |
|
907 | 907 | coarseTime = time_management_regs->coarse_time; |
|
908 | 908 | fineTime = time_management_regs->fine_time; |
|
909 | 909 | headerCWF[ i ].acquisitionTime[0] = (unsigned char) (coarseTime>>24); |
|
910 | 910 | headerCWF[ i ].acquisitionTime[1] = (unsigned char) (coarseTime>>16); |
|
911 | 911 | headerCWF[ i ].acquisitionTime[2] = (unsigned char) (coarseTime>>8); |
|
912 | 912 | headerCWF[ i ].acquisitionTime[3] = (unsigned char) (coarseTime); |
|
913 | 913 | headerCWF[ i ].acquisitionTime[4] = (unsigned char) (fineTime>>8); |
|
914 | 914 | headerCWF[ i ].acquisitionTime[5] = (unsigned char) (fineTime); |
|
915 | 915 | #endif |
|
916 | 916 | |
|
917 | 917 | headerCWF[ i ].time[0] = (unsigned char) (coarseTime>>24); |
|
918 | 918 | headerCWF[ i ].time[1] = (unsigned char) (coarseTime>>16); |
|
919 | 919 | headerCWF[ i ].time[2] = (unsigned char) (coarseTime>>8); |
|
920 | 920 | headerCWF[ i ].time[3] = (unsigned char) (coarseTime); |
|
921 | 921 | headerCWF[ i ].time[4] = (unsigned char) (fineTime>>8); |
|
922 | 922 | headerCWF[ i ].time[5] = (unsigned char) (fineTime); |
|
923 | 923 | // SEND PACKET |
|
924 | 924 | if (sid == SID_NORM_CWF_LONG_F3) |
|
925 | 925 | { |
|
926 | 926 | status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF)); |
|
927 | 927 | if (status != RTEMS_SUCCESSFUL) { |
|
928 | 928 | printf("%d-%d, ERR %d\n", sid, i, (int) status); |
|
929 | 929 | ret = LFR_DEFAULT; |
|
930 | 930 | } |
|
931 | 931 | rtems_task_wake_after(TIME_BETWEEN_TWO_CWF3_PACKETS); |
|
932 | 932 | } |
|
933 | 933 | else |
|
934 | 934 | { |
|
935 | 935 | status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF)); |
|
936 | 936 | if (status != RTEMS_SUCCESSFUL) { |
|
937 | 937 | printf("%d-%d, ERR %d\n", sid, i, (int) status); |
|
938 | 938 | ret = LFR_DEFAULT; |
|
939 | 939 | } |
|
940 | 940 | } |
|
941 | 941 | } |
|
942 | 942 | |
|
943 | 943 | return ret; |
|
944 | 944 | } |
|
945 | 945 | |
|
946 | 946 | int send_waveform_CWF3_light(volatile int *waveform, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id) |
|
947 | 947 | { |
|
948 | 948 | /** This function sends CWF_F3 CCSDS packets without the b1, b2 and b3 data. |
|
949 | 949 | * |
|
950 | 950 | * @param waveform points to the buffer containing the data that will be send. |
|
951 | 951 | * @param headerCWF points to a table of headers that have been prepared for the data transmission. |
|
952 | 952 | * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures |
|
953 | 953 | * contain information to setup the transmission of the data packets. |
|
954 | 954 | * |
|
955 | 955 | * By default, CWF_F3 packet are send without the b1, b2 and b3 data. This function rebuilds a data buffer |
|
956 | 956 | * from the incoming data and sends it in 7 packets, 6 containing 340 blocks and 1 one containing 8 blocks. |
|
957 | 957 | * |
|
958 | 958 | */ |
|
959 | 959 | |
|
960 | 960 | unsigned int i; |
|
961 | 961 | int ret; |
|
962 | 962 | unsigned char *coarseTimePtr; |
|
963 | 963 | unsigned char *fineTimePtr; |
|
964 | 964 | rtems_status_code status; |
|
965 | 965 | spw_ioctl_pkt_send spw_ioctl_send_CWF; |
|
966 | 966 | char *sample; |
|
967 | 967 | |
|
968 | 968 | spw_ioctl_send_CWF.hlen = TM_HEADER_LEN + 4 + 10; // + 4 is for the protocole extra header, + 10 is for the auxiliary header |
|
969 | 969 | spw_ioctl_send_CWF.options = 0; |
|
970 | 970 | |
|
971 | 971 | ret = LFR_DEFAULT; |
|
972 | 972 | |
|
973 | 973 | //********************** |
|
974 | 974 | // BUILD CWF3_light DATA |
|
975 | 975 | for ( i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++) |
|
976 | 976 | { |
|
977 | 977 | #ifdef VHDL_DEV |
|
978 | 978 | sample = (char*) &waveform[ (i * NB_WORDS_SWF_BLK) + TIME_OFFSET ]; |
|
979 | 979 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + TIME_OFFSET_IN_BYTES ] = sample[ 0 ]; |
|
980 | 980 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 1 + TIME_OFFSET_IN_BYTES ] = sample[ 1 ]; |
|
981 | 981 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 2 + TIME_OFFSET_IN_BYTES ] = sample[ 2 ]; |
|
982 | 982 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 3 + TIME_OFFSET_IN_BYTES ] = sample[ 3 ]; |
|
983 | 983 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 4 + TIME_OFFSET_IN_BYTES ] = sample[ 4 ]; |
|
984 | 984 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 5 + TIME_OFFSET_IN_BYTES ] = sample[ 5 ]; |
|
985 | 985 | #else |
|
986 | 986 | sample = (char*) &waveform[ i * NB_WORDS_SWF_BLK ]; |
|
987 | 987 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) ] = sample[ 0 ]; |
|
988 | 988 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 1 ] = sample[ 1 ]; |
|
989 | 989 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 2 ] = sample[ 2 ]; |
|
990 | 990 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 3 ] = sample[ 3 ]; |
|
991 | 991 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 4 ] = sample[ 4 ]; |
|
992 | 992 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 5 ] = sample[ 5 ]; |
|
993 | 993 | #endif |
|
994 | 994 | } |
|
995 | 995 | |
|
996 | 996 | //********************* |
|
997 | 997 | // SEND CWF3_light DATA |
|
998 | 998 | |
|
999 | 999 | for (i=0; i<7; i++) // send waveform |
|
1000 | 1000 | { |
|
1001 | 1001 | int coarseTime = 0x00; |
|
1002 | 1002 | int fineTime = 0x00; |
|
1003 | 1003 | |
|
1004 | 1004 | #ifdef VHDL_DEV |
|
1005 | 1005 | spw_ioctl_send_CWF.data = (char*) &wf_cont_f3_light[ (i * BLK_NR_CWF_SHORT_F3 * NB_BYTES_CWF3_LIGHT_BLK) + TIME_OFFSET_IN_BYTES]; |
|
1006 | 1006 | #else |
|
1007 | 1007 | spw_ioctl_send_CWF.data = (char*) &wf_cont_f3_light[ (i * BLK_NR_CWF_SHORT_F3 * NB_BYTES_CWF3_LIGHT_BLK) ]; |
|
1008 | 1008 | #endif |
|
1009 | 1009 | spw_ioctl_send_CWF.hdr = (char*) &headerCWF[ i ]; |
|
1010 | 1010 | // BUILD THE DATA |
|
1011 | 1011 | spw_ioctl_send_CWF.dlen = BLK_NR_CWF_SHORT_F3 * NB_BYTES_CWF3_LIGHT_BLK; |
|
1012 | 1012 | // SET PACKET SEQUENCE COUNTER |
|
1013 | 1013 | increment_seq_counter_source_id( headerCWF[ i ].packetSequenceControl, SID_NORM_CWF_F3 ); |
|
1014 | 1014 | // SET PACKET TIME |
|
1015 | 1015 | #ifdef VHDL_DEV |
|
1016 | 1016 | coarseTimePtr = (unsigned char *) &waveform; |
|
1017 | 1017 | fineTimePtr = (unsigned char *) &waveform[1]; |
|
1018 | 1018 | headerCWF[ i ].acquisitionTime[0] = coarseTimePtr[2]; |
|
1019 | 1019 | headerCWF[ i ].acquisitionTime[1] = coarseTimePtr[3]; |
|
1020 | 1020 | headerCWF[ i ].acquisitionTime[2] = coarseTimePtr[0]; |
|
1021 | 1021 | headerCWF[ i ].acquisitionTime[3] = coarseTimePtr[1]; |
|
1022 | 1022 | headerCWF[ i ].acquisitionTime[4] = fineTimePtr[0]; |
|
1023 | 1023 | headerCWF[ i ].acquisitionTime[5] = fineTimePtr[1]; |
|
1024 | 1024 | #else |
|
1025 | 1025 | coarseTime = time_management_regs->coarse_time; |
|
1026 | 1026 | fineTime = time_management_regs->fine_time; |
|
1027 | 1027 | headerCWF[ i ].acquisitionTime[0] = (unsigned char) (coarseTime>>24); |
|
1028 | 1028 | headerCWF[ i ].acquisitionTime[1] = (unsigned char) (coarseTime>>16); |
|
1029 | 1029 | headerCWF[ i ].acquisitionTime[2] = (unsigned char) (coarseTime>>8); |
|
1030 | 1030 | headerCWF[ i ].acquisitionTime[3] = (unsigned char) (coarseTime); |
|
1031 | 1031 | headerCWF[ i ].acquisitionTime[4] = (unsigned char) (fineTime>>8); |
|
1032 | 1032 | headerCWF[ i ].acquisitionTime[5] = (unsigned char) (fineTime); |
|
1033 | 1033 | #endif |
|
1034 | 1034 | headerCWF[ i ].time[0] = (unsigned char) (coarseTime>>24); |
|
1035 | 1035 | headerCWF[ i ].time[1] = (unsigned char) (coarseTime>>16); |
|
1036 | 1036 | headerCWF[ i ].time[2] = (unsigned char) (coarseTime>>8); |
|
1037 | 1037 | headerCWF[ i ].time[3] = (unsigned char) (coarseTime); |
|
1038 | 1038 | headerCWF[ i ].time[4] = (unsigned char) (fineTime>>8); |
|
1039 | 1039 | headerCWF[ i ].time[5] = (unsigned char) (fineTime); |
|
1040 | 1040 | // SEND PACKET |
|
1041 | 1041 | status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF)); |
|
1042 | 1042 | if (status != RTEMS_SUCCESSFUL) { |
|
1043 | 1043 | printf("%d-%d, ERR %d\n", SID_NORM_CWF_F3, i, (int) status); |
|
1044 | 1044 | ret = LFR_DEFAULT; |
|
1045 | 1045 | } |
|
1046 | 1046 | rtems_task_wake_after(TIME_BETWEEN_TWO_CWF3_PACKETS); |
|
1047 | 1047 | } |
|
1048 | 1048 | |
|
1049 | 1049 | return ret; |
|
1050 | 1050 | } |
|
1051 | 1051 | |
|
1052 | 1052 | void compute_acquisition_time( unsigned int *coarseTime, unsigned int *fineTime, unsigned int sid, unsigned char pa_lfr_pkt_nr ) |
|
1053 | 1053 | { |
|
1054 | 1054 | unsigned long long int acquisitionTimeAsLong; |
|
1055 | 1055 | unsigned char acquisitionTime[6]; |
|
1056 | 1056 | float deltaT = 0.; |
|
1057 | 1057 | |
|
1058 | 1058 | acquisitionTime[0] = (unsigned char) ( *coarseTime >> 8 ); |
|
1059 | 1059 | acquisitionTime[1] = (unsigned char) ( *coarseTime ); |
|
1060 | 1060 | acquisitionTime[2] = (unsigned char) ( *coarseTime >> 24 ); |
|
1061 | 1061 | acquisitionTime[3] = (unsigned char) ( *coarseTime >> 16 ); |
|
1062 | 1062 | acquisitionTime[4] = (unsigned char) ( *fineTime >> 24 ); |
|
1063 | 1063 | acquisitionTime[5] = (unsigned char) ( *fineTime >> 16 ); |
|
1064 | 1064 | |
|
1065 | 1065 | acquisitionTimeAsLong = ( (unsigned long long int) acquisitionTime[0] << 40 ) |
|
1066 | 1066 | + ( (unsigned long long int) acquisitionTime[1] << 32 ) |
|
1067 | 1067 | + ( acquisitionTime[2] << 24 ) |
|
1068 | 1068 | + ( acquisitionTime[3] << 16 ) |
|
1069 | 1069 | + ( acquisitionTime[4] << 8 ) |
|
1070 | 1070 | + ( acquisitionTime[5] ); |
|
1071 | 1071 | |
|
1072 | 1072 | switch( sid ) |
|
1073 | 1073 | { |
|
1074 | 1074 | case SID_NORM_SWF_F0: |
|
1075 | 1075 | deltaT = ( (float ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 24576. ; |
|
1076 | 1076 | break; |
|
1077 | 1077 | |
|
1078 | 1078 | case SID_NORM_SWF_F1: |
|
1079 | 1079 | deltaT = ( (float ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 4096. ; |
|
1080 | 1080 | break; |
|
1081 | 1081 | |
|
1082 | 1082 | case SID_NORM_SWF_F2: |
|
1083 | 1083 | deltaT = ( (float ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 256. ; |
|
1084 | 1084 | break; |
|
1085 | 1085 | |
|
1086 | 1086 | default: |
|
1087 | 1087 | deltaT = 0.; |
|
1088 | 1088 | break; |
|
1089 | 1089 | } |
|
1090 | 1090 | |
|
1091 | 1091 | acquisitionTimeAsLong = acquisitionTimeAsLong + (unsigned long long int) deltaT; |
|
1092 | 1092 | |
|
1093 | 1093 | *coarseTime = (unsigned int) (acquisitionTimeAsLong >> 16); |
|
1094 | 1094 | *fineTime = (unsigned int) (acquisitionTimeAsLong & 0xffff); |
|
1095 | 1095 | } |
|
1096 | 1096 | |
|
1097 | 1097 | //************** |
|
1098 | 1098 | // wfp registers |
|
1099 | void set_wfp_data_shaping() | |
|
1099 | void reset_wfp_burst_enable(void) | |
|
1100 | { | |
|
1101 | /** This function resets the waveform picker burst_enable register. | |
|
1102 | * | |
|
1103 | * The burst bits [f2 f1 f0] and the enable bits [f3 f2 f1 f0] are set to 0. | |
|
1104 | * | |
|
1105 | */ | |
|
1106 | ||
|
1107 | #ifdef VHDL_DEV | |
|
1108 | waveform_picker_regs->run_burst_enable = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0 | |
|
1109 | #else | |
|
1110 | waveform_picker_regs->burst_enable = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0 | |
|
1111 | #endif | |
|
1112 | } | |
|
1113 | ||
|
1114 | void reset_wfp_status( void ) | |
|
1115 | { | |
|
1116 | /** This function resets the waveform picker status register. | |
|
1117 | * | |
|
1118 | * All status bits are set to 0 [new_err full_err full]. | |
|
1119 | * | |
|
1120 | */ | |
|
1121 | ||
|
1122 | #ifdef GSA | |
|
1123 | #else | |
|
1124 | waveform_picker_regs->status = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0 | |
|
1125 | #endif | |
|
1126 | } | |
|
1127 | ||
|
1128 | void reset_waveform_picker_regs(void) | |
|
1129 | { | |
|
1130 | /** This function resets the waveform picker module registers. | |
|
1131 | * | |
|
1132 | * The registers affected by this function are located at the following offset addresses: | |
|
1133 | * - 0x00 data_shaping | |
|
1134 | * - 0x04 run_burst_enable | |
|
1135 | * - 0x08 addr_data_f0 | |
|
1136 | * - 0x0C addr_data_f1 | |
|
1137 | * - 0x10 addr_data_f2 | |
|
1138 | * - 0x14 addr_data_f3 | |
|
1139 | * - 0x18 status | |
|
1140 | * - 0x1C delta_snapshot | |
|
1141 | * - 0x20 delta_f0 | |
|
1142 | * - 0x24 delta_f0_2 | |
|
1143 | * - 0x28 delta_f1 | |
|
1144 | * - 0x2c delta_f2 | |
|
1145 | * - 0x30 nb_data_by_buffer | |
|
1146 | * - 0x34 nb_snapshot_param | |
|
1147 | * - 0x38 start_date | |
|
1148 | * - 0x3c nb_word_in_buffer | |
|
1149 | * | |
|
1150 | */ | |
|
1151 | ||
|
1152 | waveform_picker_regs->data_shaping = 0x01; // 0x00 *** R1 R0 SP1 SP0 BW | |
|
1153 | waveform_picker_regs->run_burst_enable = 0x00; // 0x04 *** [run *** burst f2, f1, f0 *** enable f3, f2, f1, f0 ] | |
|
1154 | waveform_picker_regs->addr_data_f0 = current_ring_node_f0->buffer_address; // 0x08 | |
|
1155 | waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address; // 0x0c | |
|
1156 | waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address; // 0x10 | |
|
1157 | waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_a); // 0x14 | |
|
1158 | waveform_picker_regs->status = 0x00; // 0x18 | |
|
1159 | // | |
|
1160 | set_wfp_delta_snapshot(); // 0x1c | |
|
1161 | set_wfp_delta_f0_f0_2(); // 0x20, 0x24 | |
|
1162 | set_wfp_delta_f1(); // 0x28 | |
|
1163 | set_wfp_delta_f2(); // 0x2c | |
|
1164 | DEBUG_PRINTF1("delta_snapshot %x\n", waveform_picker_regs->delta_snapshot) | |
|
1165 | DEBUG_PRINTF1("delta_f0 %x\n", waveform_picker_regs->delta_f0) | |
|
1166 | DEBUG_PRINTF1("delta_f0_2 %x\n", waveform_picker_regs->delta_f0_2) | |
|
1167 | DEBUG_PRINTF1("delta_f1 %x\n", waveform_picker_regs->delta_f1) | |
|
1168 | DEBUG_PRINTF1("delta_f2 %x\n", waveform_picker_regs->delta_f2) | |
|
1169 | // 2352 = 7 * 336 | |
|
1170 | waveform_picker_regs->nb_data_by_buffer = 0x92f; // 0x30 *** 2352 - 1 => nb samples -1 | |
|
1171 | waveform_picker_regs->snapshot_param = 0x930; // 0x34 *** 2352 => nb samples | |
|
1172 | waveform_picker_regs->start_date = 0x00; // 0x38 | |
|
1173 | waveform_picker_regs->nb_word_in_buffer = 0x1b92; // 0x3c *** 2352 * 3 + 2 = 7058 | |
|
1174 | } | |
|
1175 | ||
|
1176 | void set_wfp_data_shaping( void ) | |
|
1100 | 1177 | { |
|
1101 | 1178 | /** This function sets the data_shaping register of the waveform picker module. |
|
1102 | 1179 | * |
|
1103 | 1180 | * The value is read from one field of the parameter_dump_packet structure:\n |
|
1104 | 1181 | * bw_sp0_sp1_r0_r1 |
|
1105 | 1182 | * |
|
1106 | 1183 | */ |
|
1107 | 1184 | |
|
1108 | 1185 | unsigned char data_shaping; |
|
1109 | 1186 | |
|
1110 | 1187 | // get the parameters for the data shaping [BW SP0 SP1 R0 R1] in sy_lfr_common1 and configure the register |
|
1111 | 1188 | // waveform picker : [R1 R0 SP1 SP0 BW] |
|
1112 | 1189 | |
|
1113 | 1190 | data_shaping = parameter_dump_packet.bw_sp0_sp1_r0_r1; |
|
1114 | 1191 | |
|
1115 | #ifdef GSA | |
|
1116 | #else | |
|
1117 | 1192 | waveform_picker_regs->data_shaping = |
|
1118 | 1193 | ( (data_shaping & 0x10) >> 4 ) // BW |
|
1119 | 1194 | + ( (data_shaping & 0x08) >> 2 ) // SP0 |
|
1120 | 1195 | + ( (data_shaping & 0x04) ) // SP1 |
|
1121 | 1196 | + ( (data_shaping & 0x02) << 2 ) // R0 |
|
1122 | 1197 | + ( (data_shaping & 0x01) << 4 ); // R1 |
|
1123 | #endif | |
|
1124 | 1198 | } |
|
1125 | 1199 | |
|
1126 | char set_wfp_delta_snapshot() | |
|
1127 | { | |
|
1128 | /** This function sets the delta_snapshot register of the waveform picker module. | |
|
1129 | * | |
|
1130 | * The value is read from two (unsigned char) of the parameter_dump_packet structure: | |
|
1131 | * - sy_lfr_n_swf_p[0] | |
|
1132 | * - sy_lfr_n_swf_p[1] | |
|
1133 | * | |
|
1134 | */ | |
|
1135 | ||
|
1136 | char ret; | |
|
1137 | unsigned int delta_snapshot; | |
|
1138 | unsigned int aux; | |
|
1139 | ||
|
1140 | aux = 0; | |
|
1141 | ret = LFR_DEFAULT; | |
|
1142 | ||
|
1143 | delta_snapshot = parameter_dump_packet.sy_lfr_n_swf_p[0]*256 | |
|
1144 | + parameter_dump_packet.sy_lfr_n_swf_p[1]; | |
|
1145 | ||
|
1146 | #ifdef GSA | |
|
1147 | #else | |
|
1148 | if ( delta_snapshot < MIN_DELTA_SNAPSHOT ) | |
|
1149 | { | |
|
1150 | aux = MIN_DELTA_SNAPSHOT; | |
|
1151 | ret = LFR_DEFAULT; | |
|
1152 | } | |
|
1153 | else | |
|
1154 | { | |
|
1155 | aux = delta_snapshot ; | |
|
1156 | ret = LFR_SUCCESSFUL; | |
|
1157 | } | |
|
1158 | waveform_picker_regs->delta_snapshot = aux - 1; // max 2 bytes | |
|
1159 | #endif | |
|
1160 | ||
|
1161 | return ret; | |
|
1162 | } | |
|
1163 | ||
|
1164 | #ifdef VHDL_DEV | |
|
1165 | 1200 | void set_wfp_burst_enable_register( unsigned char mode ) |
|
1166 | 1201 | { |
|
1167 | 1202 | /** This function sets the waveform picker burst_enable register depending on the mode. |
|
1168 | 1203 | * |
|
1169 | 1204 | * @param mode is the LFR mode to launch. |
|
1170 | 1205 | * |
|
1171 | 1206 | * The burst bits shall be before the enable bits. |
|
1172 | 1207 | * |
|
1173 | 1208 | */ |
|
1174 | 1209 | |
|
1175 | 1210 | // [0000 0000] burst f2, f1, f0 enable f3 f2 f1 f0 |
|
1176 | 1211 | // the burst bits shall be set first, before the enable bits |
|
1177 | 1212 | switch(mode) { |
|
1178 | 1213 | case(LFR_MODE_NORMAL): |
|
1179 | 1214 | waveform_picker_regs->run_burst_enable = 0x00; // [0000 0000] no burst enable |
|
1180 | 1215 | waveform_picker_regs->run_burst_enable = 0x0f; // [0000 1111] enable f3 f2 f1 f0 |
|
1181 | 1216 | break; |
|
1182 | 1217 | case(LFR_MODE_BURST): |
|
1183 | 1218 | waveform_picker_regs->run_burst_enable = 0x40; // [0100 0000] f2 burst enabled |
|
1184 | 1219 | waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x04; // [0100] enable f2 |
|
1185 | 1220 | break; |
|
1186 | 1221 | case(LFR_MODE_SBM1): |
|
1187 | 1222 | waveform_picker_regs->run_burst_enable = 0x20; // [0010 0000] f1 burst enabled |
|
1188 | 1223 | waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0 |
|
1189 | 1224 | break; |
|
1190 | 1225 | case(LFR_MODE_SBM2): |
|
1191 | 1226 | waveform_picker_regs->run_burst_enable = 0x40; // [0100 0000] f2 burst enabled |
|
1192 | 1227 | waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0 |
|
1193 | 1228 | break; |
|
1194 | 1229 | default: |
|
1195 | 1230 | waveform_picker_regs->run_burst_enable = 0x00; // [0000 0000] no burst enabled, no waveform enabled |
|
1196 | 1231 | break; |
|
1197 | 1232 | } |
|
1198 | 1233 | } |
|
1199 | #else | |
|
1200 | void set_wfp_burst_enable_register( unsigned char mode ) | |
|
1234 | ||
|
1235 | void set_wfp_delta_snapshot( void ) | |
|
1201 | 1236 | { |
|
1202 | /** This function sets the waveform picker burst_enable register depending on the mode. | |
|
1203 | * | |
|
1204 | * @param mode is the LFR mode to launch. | |
|
1205 | * | |
|
1206 | * The burst bits shall be before the enable bits. | |
|
1237 | /** This function sets the delta_snapshot register of the waveform picker module. | |
|
1207 | 1238 | * |
|
1208 | */ | |
|
1209 | ||
|
1210 | // [0000 0000] burst f2, f1, f0 enable f3 f2 f1 f0 | |
|
1211 | // the burst bits shall be set first, before the enable bits | |
|
1212 | switch(mode) { | |
|
1213 | case(LFR_MODE_NORMAL): | |
|
1214 | waveform_picker_regs->burst_enable = 0x00; // [0000 0000] no burst enable | |
|
1215 | waveform_picker_regs->burst_enable = 0x0f; // [0000 1111] enable f3 f2 f1 f0 | |
|
1216 | break; | |
|
1217 | case(LFR_MODE_BURST): | |
|
1218 | waveform_picker_regs->burst_enable = 0x40; // [0100 0000] f2 burst enabled | |
|
1219 | waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable | 0x04; // [0100] enable f2 | |
|
1220 | break; | |
|
1221 | case(LFR_MODE_SBM1): | |
|
1222 | waveform_picker_regs->burst_enable = 0x20; // [0010 0000] f1 burst enabled | |
|
1223 | waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0 | |
|
1224 | break; | |
|
1225 | case(LFR_MODE_SBM2): | |
|
1226 | waveform_picker_regs->burst_enable = 0x40; // [0100 0000] f2 burst enabled | |
|
1227 | waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0 | |
|
1228 | break; | |
|
1229 | default: | |
|
1230 | waveform_picker_regs->burst_enable = 0x00; // [0000 0000] no burst enabled, no waveform enabled | |
|
1231 | break; | |
|
1232 | } | |
|
1233 | } | |
|
1234 | #endif | |
|
1235 | ||
|
1236 | void reset_wfp_burst_enable() | |
|
1237 | { | |
|
1238 | /** This function resets the waveform picker burst_enable register. | |
|
1239 | * | |
|
1240 | * The burst bits [f2 f1 f0] and the enable bits [f3 f2 f1 f0] are set to 0. | |
|
1241 | * | |
|
1242 | */ | |
|
1243 | ||
|
1244 | #ifdef VHDL_DEV | |
|
1245 | waveform_picker_regs->run_burst_enable = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0 | |
|
1246 | #else | |
|
1247 | waveform_picker_regs->burst_enable = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0 | |
|
1248 | #endif | |
|
1249 | } | |
|
1250 | ||
|
1251 | void reset_wfp_status() | |
|
1252 | { | |
|
1253 | /** This function resets the waveform picker status register. | |
|
1254 | * | |
|
1255 | * All status bits are set to 0 [new_err full_err full]. | |
|
1239 | * The value is read from two (unsigned char) of the parameter_dump_packet structure: | |
|
1240 | * - sy_lfr_n_swf_p[0] | |
|
1241 | * - sy_lfr_n_swf_p[1] | |
|
1256 | 1242 | * |
|
1257 | 1243 | */ |
|
1258 | 1244 | |
|
1259 | #ifdef GSA | |
|
1260 | #else | |
|
1261 | waveform_picker_regs->status = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0 | |
|
1262 | #endif | |
|
1263 | } | |
|
1245 | unsigned int delta_snapshot; | |
|
1246 | unsigned int delta_snapshot_in_T2; | |
|
1264 | 1247 | |
|
1265 | void reset_waveform_picker_regs_vhdl_dev() | |
|
1266 | { | |
|
1267 | /** This function resets the waveform picker module registers. | |
|
1268 | * | |
|
1269 | * The registers affected by this function are located at the following offset addresses: | |
|
1270 | * - 0x00 data_shaping | |
|
1271 | * - 0x04 run_burst_enable | |
|
1272 | * - 0x08 addr_data_f0 | |
|
1273 | * - 0x0C addr_data_f1 | |
|
1274 | * - 0x10 addr_data_f2 | |
|
1275 | * - 0x14 addr_data_f3 | |
|
1276 | * - 0x18 status | |
|
1277 | * - 0x1C delta_snapshot | |
|
1278 | * - 0x20 delta_f0 | |
|
1279 | * - 0x24 delta_f0_2 | |
|
1280 | * - 0x28 delta_f1 | |
|
1281 | * - 0x2c delta_f2 | |
|
1282 | * - 0x30 nb_data_by_buffer | |
|
1283 | * - 0x34 nb_snapshot_param | |
|
1284 | * - 0x38 start_date | |
|
1285 | * - 0x3c nb_word_in_buffer | |
|
1286 | * | |
|
1287 | */ | |
|
1288 | waveform_picker_regs->data_shaping = 0x01; // 0x00 *** R1 R0 SP1 SP0 BW | |
|
1289 | waveform_picker_regs->run_burst_enable = 0x00; // 0x04 *** [run *** burst f2, f1, f0 *** enable f3, f2, f1, f0 ] | |
|
1290 | //waveform_picker_regs->addr_data_f0 = (int) (wf_snap_f0); // 0x08 | |
|
1291 | waveform_picker_regs->addr_data_f0 = current_ring_node_f0->buffer_address; // 0x08 | |
|
1292 | waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address; // 0x0c | |
|
1293 | waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address; // 0x10 | |
|
1294 | waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_a); // 0x14 | |
|
1295 | waveform_picker_regs->status = 0x00; // 0x18 | |
|
1296 | // | |
|
1297 | waveform_picker_regs->delta_snapshot = 0x1000; // 0x1c *** 4096 = 16 * 256 | |
|
1298 | waveform_picker_regs->delta_f0 = 0xc0b; // 0x20 *** 3083 = 4096 - 1013 | |
|
1299 | waveform_picker_regs->delta_f0_2 = 0x7; // 0x24 *** 7 [7 bits] | |
|
1300 | waveform_picker_regs->delta_f1 = 0xc40; // 0x28 *** 3136 = 4096 - 960 | |
|
1301 | waveform_picker_regs->delta_f2 = 0xc00; // 0x2c *** 3072 = 12 * 256 | |
|
1302 | // | |
|
1303 | // waveform_picker_regs->delta_snapshot = 0x1000; // 0x1c *** 4096 = 16 * 256 | |
|
1304 | // waveform_picker_regs->delta_f0 = 0x1; // 0x20 *** | |
|
1305 | // waveform_picker_regs->delta_f0_2 = 0x7; // 0x24 *** 7 [7 bits] | |
|
1306 | // waveform_picker_regs->delta_f1 = 0x1; // 0x28 *** | |
|
1307 | // waveform_picker_regs->delta_f2 = 0x1; // 0x2c *** | |
|
1308 | // | |
|
1309 | // waveform_picker_regs->delta_snapshot = 0x1000; // 0x1c *** 4096 = 16 * 256 | |
|
1310 | // waveform_picker_regs->delta_f0 = 0x0fff; // 0x20 *** | |
|
1311 | // waveform_picker_regs->delta_f0_2 = 0x7; // 0x24 *** 7 [7 bits] | |
|
1312 | // waveform_picker_regs->delta_f1 = 0x0fff; // 0x28 *** | |
|
1313 | // waveform_picker_regs->delta_f2 = 0x1; // 0x2c *** | |
|
1314 | // 2048 | |
|
1315 | // waveform_picker_regs->nb_data_by_buffer = 0x7ff; // 0x30 *** 2048 -1 => nb samples -1 | |
|
1316 | // waveform_picker_regs->snapshot_param = 0x800; // 0x34 *** 2048 => nb samples | |
|
1317 | // waveform_picker_regs->start_date = 0x00; // 0x38 | |
|
1318 | // waveform_picker_regs->nb_word_in_buffer = 0x1802; // 0x3c *** 2048 * 3 + 2 = 6146 | |
|
1319 | // 2352 = 7 * 336 | |
|
1320 | // waveform_picker_regs->nb_data_by_buffer = 0x92f; // 0x30 *** 2352 - 1 => nb samples -1 | |
|
1321 | // waveform_picker_regs->snapshot_param = 0x930; // 0x34 *** 2352 => nb samples | |
|
1322 | // waveform_picker_regs->start_date = 0x00; // 0x38 | |
|
1323 | // waveform_picker_regs->nb_word_in_buffer = 0x1b92; // 0x3c *** 2352 * 3 + 2 = 7058 | |
|
1324 | // 128 | |
|
1325 | waveform_picker_regs->nb_data_by_buffer = 0x7f; // 0x30 *** 128 - 1 => nb samples -1 | |
|
1326 | waveform_picker_regs->snapshot_param = 0x80; // 0x34 *** 128 => nb samples | |
|
1327 | waveform_picker_regs->start_date = 0x00; // 0x38 | |
|
1328 | waveform_picker_regs->nb_word_in_buffer = 0x182; // 0x3c *** 128 * 3 + 2 = 386 | |
|
1248 | delta_snapshot = parameter_dump_packet.sy_lfr_n_swf_p[0]*256 | |
|
1249 | + parameter_dump_packet.sy_lfr_n_swf_p[1]; | |
|
1250 | ||
|
1251 | delta_snapshot_in_T2 = delta_snapshot * 256; | |
|
1252 | waveform_picker_regs->delta_snapshot = delta_snapshot_in_T2; // max 4 bytes | |
|
1329 | 1253 | } |
|
1330 | 1254 | |
|
1331 | void reset_waveform_picker_regs_vhdl_dev_debug() | |
|
1255 | void set_wfp_delta_f0_f0_2( void ) | |
|
1332 | 1256 | { |
|
1333 | /** This function resets the waveform picker module registers. | |
|
1334 | * | |
|
1335 | * The registers affected by this function are located at the following offset addresses: | |
|
1336 | * - 0x00 data_shaping | |
|
1337 | * - 0x04 run_burst_enable | |
|
1338 | * - 0x08 addr_data_f0 | |
|
1339 | * - 0x0C addr_data_f1 | |
|
1340 | * - 0x10 addr_data_f2 | |
|
1341 | * - 0x14 addr_data_f3 | |
|
1342 | * - 0x18 status | |
|
1343 | * - 0x1C delta_snapshot | |
|
1344 | * - 0x20 delta_f0 | |
|
1345 | * - 0x24 delta_f0_2 | |
|
1346 | * - 0x28 delta_f1 | |
|
1347 | * - 0x2c delta_f2 | |
|
1348 | * - 0x30 nb_data_by_buffer | |
|
1349 | * - 0x34 nb_snapshot_param | |
|
1350 | * - 0x38 start_date | |
|
1351 | * - 0x3c nb_word_in_buffer | |
|
1352 | * | |
|
1353 | */ | |
|
1354 | waveform_picker_regs->data_shaping = 0x01; // 0x00 *** R1 R0 SP1 SP0 BW | |
|
1355 | waveform_picker_regs->run_burst_enable = 0x00; // 0x04 *** [run *** burst f2, f1, f0 *** enable f3, f2, f1, f0 ] | |
|
1356 | //waveform_picker_regs->addr_data_f0 = (int) (wf_snap_f0); // 0x08 | |
|
1357 | waveform_picker_regs->addr_data_f0 = current_ring_node_f0->buffer_address; // 0x08 | |
|
1358 | waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address; // 0x0c | |
|
1359 | waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address; // 0x10 | |
|
1360 | waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_a); // 0x14 | |
|
1361 | waveform_picker_regs->status = 0x00; // 0x18 | |
|
1362 | // | |
|
1363 | waveform_picker_regs->delta_snapshot = 0x100; // 0x1c *** 256 | |
|
1364 | waveform_picker_regs->delta_f0 = 0xc1; // 0x20 *** 256 - 63 | |
|
1365 | waveform_picker_regs->delta_f0_2 = 0x7; // 0x24 *** 7 [7 bits] | |
|
1366 | waveform_picker_regs->delta_f1 = 0xc4; // 0x28 *** 256 - 60 | |
|
1367 | waveform_picker_regs->delta_f2 = 0xc0; // 0x2c *** 192 | |
|
1368 | // 128 | |
|
1369 | waveform_picker_regs->nb_data_by_buffer = 0x7f; // 0x30 *** 128 - 1 => nb samples -1 | |
|
1370 | waveform_picker_regs->snapshot_param = 0x80; // 0x34 *** 128 => nb samples | |
|
1371 | waveform_picker_regs->start_date = 0x00; // 0x38 | |
|
1372 | waveform_picker_regs->nb_word_in_buffer = 0x182; // 0x3c *** 128 * 3 + 2 = 386 | |
|
1257 | unsigned int delta_snapshot; | |
|
1258 | unsigned int nb_samples_per_snapshot; | |
|
1259 | float delta_f0_in_float; | |
|
1260 | ||
|
1261 | delta_snapshot = waveform_picker_regs->delta_snapshot; | |
|
1262 | nb_samples_per_snapshot = parameter_dump_packet.sy_lfr_n_swf_l[0] * 256 + parameter_dump_packet.sy_lfr_n_swf_l[1]; | |
|
1263 | delta_f0_in_float =nb_samples_per_snapshot / 2. * ( 1. / 256. - 1. / 24576.) * 256.; | |
|
1264 | ||
|
1265 | waveform_picker_regs->delta_f0 = delta_snapshot - floor( delta_f0_in_float ); | |
|
1266 | waveform_picker_regs->delta_f0_2 = 0x7; // max 7 bits | |
|
1373 | 1267 | } |
|
1374 | 1268 | |
|
1375 | void reset_waveform_picker_regs_vhdl_dev_debug_64() | |
|
1269 | void set_wfp_delta_f1( void ) | |
|
1376 | 1270 | { |
|
1377 | /** This function resets the waveform picker module registers. | |
|
1378 | * | |
|
1379 | * The registers affected by this function are located at the following offset addresses: | |
|
1380 | * - 0x00 data_shaping | |
|
1381 | * - 0x04 run_burst_enable | |
|
1382 | * - 0x08 addr_data_f0 | |
|
1383 | * - 0x0C addr_data_f1 | |
|
1384 | * - 0x10 addr_data_f2 | |
|
1385 | * - 0x14 addr_data_f3 | |
|
1386 | * - 0x18 status | |
|
1387 | * - 0x1C delta_snapshot | |
|
1388 | * - 0x20 delta_f0 | |
|
1389 | * - 0x24 delta_f0_2 | |
|
1390 | * - 0x28 delta_f1 | |
|
1391 | * - 0x2c delta_f2 | |
|
1392 | * - 0x30 nb_data_by_buffer | |
|
1393 | * - 0x34 nb_snapshot_param | |
|
1394 | * - 0x38 start_date | |
|
1395 | * - 0x3c nb_word_in_buffer | |
|
1396 | * | |
|
1397 | */ | |
|
1398 | waveform_picker_regs->data_shaping = 0x01; // 0x00 *** R1 R0 SP1 SP0 BW | |
|
1399 | waveform_picker_regs->run_burst_enable = 0x00; // 0x04 *** [run *** burst f2, f1, f0 *** enable f3, f2, f1, f0 ] | |
|
1400 | //waveform_picker_regs->addr_data_f0 = (int) (wf_snap_f0); // 0x08 | |
|
1401 | waveform_picker_regs->addr_data_f0 = current_ring_node_f0->buffer_address; // 0x08 | |
|
1402 | waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address; // 0x0c | |
|
1403 | waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address; // 0x10 | |
|
1404 | waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_a); // 0x14 | |
|
1405 | waveform_picker_regs->status = 0x00; // 0x18 | |
|
1406 | // | |
|
1407 | waveform_picker_regs->delta_snapshot = 0x80; // 0x1c *** 128 | |
|
1408 | waveform_picker_regs->delta_f0 = 0x60; // 0x20 *** 128 - 32 = 96 | |
|
1409 | waveform_picker_regs->delta_f0_2 = 0x7; // 0x24 *** 7 [7 bits] | |
|
1410 | waveform_picker_regs->delta_f1 = 0x62; // 0x28 *** 128 - 30 = 90 | |
|
1411 | waveform_picker_regs->delta_f2 = 0x60; // 0x2c *** 192 | |
|
1412 | // 128 | |
|
1413 | waveform_picker_regs->nb_data_by_buffer = 0x3f; // 0x30 *** 64 - 1 => nb samples -1 | |
|
1414 | waveform_picker_regs->snapshot_param = 0x40; // 0x34 *** 64 => nb samples | |
|
1415 | waveform_picker_regs->start_date = 0x00; // 0x38 | |
|
1416 | waveform_picker_regs->nb_word_in_buffer = 0xc2; // 0x3c *** 64 * 3 + 2 = 194 | |
|
1271 | unsigned int delta_snapshot; | |
|
1272 | unsigned int nb_samples_per_snapshot; | |
|
1273 | float delta_f1_in_float; | |
|
1274 | ||
|
1275 | delta_snapshot = waveform_picker_regs->delta_snapshot; | |
|
1276 | nb_samples_per_snapshot = parameter_dump_packet.sy_lfr_n_swf_l[0] * 256 + parameter_dump_packet.sy_lfr_n_swf_l[1]; | |
|
1277 | delta_f1_in_float = nb_samples_per_snapshot / 2. * ( 1. / 256. - 1. / 4096.) * 256.; | |
|
1278 | ||
|
1279 | waveform_picker_regs->delta_f1 = delta_snapshot - floor( delta_f1_in_float ); | |
|
1417 | 1280 | } |
|
1418 | 1281 | |
|
1419 | void reset_waveform_picker_regs() | |
|
1282 | void set_wfp_delta_f2() | |
|
1420 | 1283 | { |
|
1421 | /** This function resets the waveform picker module registers. | |
|
1422 | * | |
|
1423 | * The registers affected by this function are located at the following offset addresses: | |
|
1424 | * - 0x00 data_shaping | |
|
1425 | * - 0x04 burst_enable | |
|
1426 | * - 0x08 addr_data_f0 | |
|
1427 | * - 0x0C addr_data_f1 | |
|
1428 | * - 0x10 addr_data_f2 | |
|
1429 | * - 0x14 addr_data_f3 | |
|
1430 | * - 0x18 status | |
|
1431 | * - 0x1C delta_snapshot | |
|
1432 | * - 0x20 delta_f2_f1 | |
|
1433 | * - 0x24 delta_f2_f0 | |
|
1434 | * - 0x28 nb_burst | |
|
1435 | * - 0x2C nb_snapshot | |
|
1436 | * | |
|
1437 | */ | |
|
1284 | unsigned int delta_snapshot; | |
|
1285 | unsigned int nb_samples_per_snapshot; | |
|
1438 | 1286 | |
|
1439 | #ifdef VHDL_DEV | |
|
1440 | #else | |
|
1441 | reset_wfp_burst_enable(); | |
|
1442 | reset_wfp_status(); | |
|
1443 | // set buffer addresses | |
|
1444 | waveform_picker_regs->addr_data_f0 = (int) (wf_snap_f0); | |
|
1445 | waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address; | |
|
1446 | waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address; | |
|
1447 | waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_a); | |
|
1448 | // set other parameters | |
|
1449 | set_wfp_data_shaping(); | |
|
1450 | set_wfp_delta_snapshot(); // time in seconds between two snapshots | |
|
1451 | waveform_picker_regs->delta_f2_f1 = 0xffff; // 0x16800 => 92160 (max 4 bytes) | |
|
1452 | waveform_picker_regs->delta_f2_f0 = 0x17c00; // 97 280 (max 5 bytes) | |
|
1453 | // waveform_picker_regs->nb_burst_available = 0x180; // max 3 bytes, size of the buffer in burst (1 burst = 16 x 4 octets) | |
|
1454 | // // 3 * 2048 / 16 = 384 | |
|
1455 | // waveform_picker_regs->nb_snapshot_param = 0x7ff; // max 3 octets, 2048 - 1 | |
|
1456 | waveform_picker_regs->nb_burst_available = 0x1b9; // max 3 bytes, size of the buffer in burst (1 burst = 16 x 4 octets) | |
|
1457 | // 3 * 2352 / 16 = 441 | |
|
1458 | waveform_picker_regs->nb_snapshot_param = 0x944; // max 3 octets, 2372 - 1 | |
|
1459 | #endif | |
|
1287 | delta_snapshot = waveform_picker_regs->delta_snapshot; | |
|
1288 | nb_samples_per_snapshot = parameter_dump_packet.sy_lfr_n_swf_l[0] * 256 + parameter_dump_packet.sy_lfr_n_swf_l[1]; | |
|
1289 | ||
|
1290 | waveform_picker_regs->delta_f2 = delta_snapshot - nb_samples_per_snapshot / 2; | |
|
1460 | 1291 | } |
|
1461 | 1292 | |
|
1462 | 1293 | //***************** |
|
1463 | 1294 | // local parameters |
|
1464 | 1295 | void set_local_nb_interrupt_f0_MAX( void ) |
|
1465 | 1296 | { |
|
1466 | 1297 | /** This function sets the value of the nb_interrupt_f0_MAX local parameter. |
|
1467 | 1298 | * |
|
1468 | 1299 | * This parameter is used for the SM validation only.\n |
|
1469 | 1300 | * The software waits param_local.local_nb_interrupt_f0_MAX interruptions from the spectral matrices |
|
1470 | 1301 | * module before launching a basic processing. |
|
1471 | 1302 | * |
|
1472 | 1303 | */ |
|
1473 | 1304 | |
|
1474 | 1305 | param_local.local_nb_interrupt_f0_MAX = ( (parameter_dump_packet.sy_lfr_n_asm_p[0]) * 256 |
|
1475 | 1306 | + parameter_dump_packet.sy_lfr_n_asm_p[1] ) * 100; |
|
1476 | 1307 | } |
|
1477 | 1308 | |
|
1478 | 1309 | void increment_seq_counter_source_id( unsigned char *packet_sequence_control, unsigned int sid ) |
|
1479 | 1310 | { |
|
1480 | 1311 | unsigned short *sequence_cnt; |
|
1481 | 1312 | unsigned short segmentation_grouping_flag; |
|
1482 | 1313 | unsigned short new_packet_sequence_control; |
|
1483 | 1314 | |
|
1484 | 1315 | if ( (sid ==SID_NORM_SWF_F0) || (sid ==SID_NORM_SWF_F1) || (sid ==SID_NORM_SWF_F2) |
|
1485 | 1316 | || (sid ==SID_NORM_CWF_F3) || (sid==SID_NORM_CWF_LONG_F3) || (sid ==SID_BURST_CWF_F2) ) |
|
1486 | 1317 | { |
|
1487 | 1318 | sequence_cnt = &sequenceCounters_SCIENCE_NORMAL_BURST; |
|
1488 | 1319 | } |
|
1489 | 1320 | else if ( (sid ==SID_SBM1_CWF_F1) || (sid ==SID_SBM2_CWF_F2) ) |
|
1490 | 1321 | { |
|
1491 | 1322 | sequence_cnt = &sequenceCounters_SCIENCE_SBM1_SBM2; |
|
1492 | 1323 | } |
|
1493 | 1324 | else |
|
1494 | 1325 | { |
|
1495 | 1326 | sequence_cnt = NULL; |
|
1496 | 1327 | PRINTF1("in increment_seq_counter_source_id *** ERR apid_destid %d not known\n", sid) |
|
1497 | 1328 | } |
|
1498 | 1329 | |
|
1499 | 1330 | if (sequence_cnt != NULL) |
|
1500 | 1331 | { |
|
1501 | 1332 | segmentation_grouping_flag = (packet_sequence_control[ 0 ] & 0xc0) << 8; |
|
1502 | 1333 | *sequence_cnt = (*sequence_cnt) & 0x3fff; |
|
1503 | 1334 | |
|
1504 | 1335 | new_packet_sequence_control = segmentation_grouping_flag | *sequence_cnt ; |
|
1505 | 1336 | |
|
1506 | 1337 | packet_sequence_control[0] = (unsigned char) (new_packet_sequence_control >> 8); |
|
1507 | 1338 | packet_sequence_control[1] = (unsigned char) (new_packet_sequence_control ); |
|
1508 | 1339 | |
|
1509 | 1340 | // increment the sequence counter for the next packet |
|
1510 | 1341 | if ( *sequence_cnt < SEQ_CNT_MAX) |
|
1511 | 1342 | { |
|
1512 | 1343 | *sequence_cnt = *sequence_cnt + 1; |
|
1513 | 1344 | } |
|
1514 | 1345 | else |
|
1515 | 1346 | { |
|
1516 | 1347 | *sequence_cnt = 0; |
|
1517 | 1348 | } |
|
1518 | 1349 | } |
|
1519 | 1350 | } |
General Comments 0
You need to be logged in to leave comments.
Login now