|
@@
-1,1692
+1,1694
|
|
1
|
/*------------------------------------------------------------------------------
|
|
1
|
/*------------------------------------------------------------------------------
|
|
2
|
-- Solar Orbiter's Low Frequency Receiver Flight Software (LFR FSW),
|
|
2
|
-- Solar Orbiter's Low Frequency Receiver Flight Software (LFR FSW),
|
|
3
|
-- This file is a part of the LFR FSW
|
|
3
|
-- This file is a part of the LFR FSW
|
|
4
|
-- Copyright (C) 2012-2018, Plasma Physics Laboratory - CNRS
|
|
4
|
-- Copyright (C) 2012-2018, Plasma Physics Laboratory - CNRS
|
|
5
|
--
|
|
5
|
--
|
|
6
|
-- This program is free software; you can redistribute it and/or modify
|
|
6
|
-- This program is free software; you can redistribute it and/or modify
|
|
7
|
-- it under the terms of the GNU General Public License as published by
|
|
7
|
-- it under the terms of the GNU General Public License as published by
|
|
8
|
-- the Free Software Foundation; either version 2 of the License, or
|
|
8
|
-- the Free Software Foundation; either version 2 of the License, or
|
|
9
|
-- (at your option) any later version.
|
|
9
|
-- (at your option) any later version.
|
|
10
|
--
|
|
10
|
--
|
|
11
|
-- This program is distributed in the hope that it will be useful,
|
|
11
|
-- This program is distributed in the hope that it will be useful,
|
|
12
|
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
-- GNU General Public License for more details.
|
|
14
|
-- GNU General Public License for more details.
|
|
15
|
--
|
|
15
|
--
|
|
16
|
-- You should have received a copy of the GNU General Public License
|
|
16
|
-- You should have received a copy of the GNU General Public License
|
|
17
|
-- along with this program; if not, write to the Free Software
|
|
17
|
-- along with this program; if not, write to the Free Software
|
|
18
|
-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
18
|
-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
19
|
-------------------------------------------------------------------------------*/
|
|
19
|
-------------------------------------------------------------------------------*/
|
|
20
|
/*-- Author : Paul Leroy
|
|
20
|
/*-- Author : Paul Leroy
|
|
21
|
-- Contact : Alexis Jeandet
|
|
21
|
-- Contact : Alexis Jeandet
|
|
22
|
-- Mail : alexis.jeandet@lpp.polytechnique.fr
|
|
22
|
-- Mail : alexis.jeandet@lpp.polytechnique.fr
|
|
23
|
----------------------------------------------------------------------------*/
|
|
23
|
----------------------------------------------------------------------------*/
|
|
24
|
/** Functions and tasks related to TeleCommand handling.
|
|
24
|
/** Functions and tasks related to TeleCommand handling.
|
|
25
|
*
|
|
25
|
*
|
|
26
|
* @file
|
|
26
|
* @file
|
|
27
|
* @author P. LEROY
|
|
27
|
* @author P. LEROY
|
|
28
|
*
|
|
28
|
*
|
|
29
|
* A group of functions to handle TeleCommands:\n
|
|
29
|
* A group of functions to handle TeleCommands:\n
|
|
30
|
* action launching\n
|
|
30
|
* action launching\n
|
|
31
|
* TC parsing\n
|
|
31
|
* TC parsing\n
|
|
32
|
* ...
|
|
32
|
* ...
|
|
33
|
*
|
|
33
|
*
|
|
34
|
*/
|
|
34
|
*/
|
|
35
|
|
|
35
|
|
|
36
|
#include "tc_handler.h"
|
|
36
|
#include "tc_handler.h"
|
|
37
|
#include "math.h"
|
|
37
|
#include "math.h"
|
|
38
|
|
|
38
|
|
|
39
|
//***********
|
|
39
|
//***********
|
|
40
|
// RTEMS TASK
|
|
40
|
// RTEMS TASK
|
|
41
|
|
|
41
|
|
|
42
|
rtems_task actn_task( rtems_task_argument unused )
|
|
42
|
rtems_task actn_task( rtems_task_argument unused )
|
|
43
|
{
|
|
43
|
{
|
|
44
|
/** This RTEMS task is responsible for launching actions upton the reception of valid TeleCommands.
|
|
44
|
/** This RTEMS task is responsible for launching actions upton the reception of valid TeleCommands.
|
|
45
|
*
|
|
45
|
*
|
|
46
|
* @param unused is the starting argument of the RTEMS task
|
|
46
|
* @param unused is the starting argument of the RTEMS task
|
|
47
|
*
|
|
47
|
*
|
|
48
|
* The ACTN task waits for data coming from an RTEMS msesage queue. When data arrives, it launches specific actions depending
|
|
48
|
* The ACTN task waits for data coming from an RTEMS msesage queue. When data arrives, it launches specific actions depending
|
|
49
|
* on the incoming TeleCommand.
|
|
49
|
* on the incoming TeleCommand.
|
|
50
|
*
|
|
50
|
*
|
|
51
|
*/
|
|
51
|
*/
|
|
52
|
|
|
52
|
|
|
53
|
int result;
|
|
53
|
int result;
|
|
54
|
rtems_status_code status; // RTEMS status code
|
|
54
|
rtems_status_code status; // RTEMS status code
|
|
55
|
ccsdsTelecommandPacket_t __attribute__((aligned(4))) TC; // TC sent to the ACTN task
|
|
55
|
ccsdsTelecommandPacket_t __attribute__((aligned(4))) TC; // TC sent to the ACTN task
|
|
56
|
size_t size; // size of the incoming TC packet
|
|
56
|
size_t size; // size of the incoming TC packet
|
|
57
|
unsigned char subtype; // subtype of the current TC packet
|
|
57
|
unsigned char subtype; // subtype of the current TC packet
|
|
58
|
unsigned char time[BYTES_PER_TIME];
|
|
58
|
unsigned char time[BYTES_PER_TIME];
|
|
59
|
rtems_id queue_rcv_id;
|
|
59
|
rtems_id queue_rcv_id;
|
|
60
|
rtems_id queue_snd_id;
|
|
60
|
rtems_id queue_snd_id;
|
|
61
|
|
|
61
|
|
|
62
|
memset(&TC, 0, sizeof(ccsdsTelecommandPacket_t));
|
|
62
|
memset(&TC, 0, sizeof(ccsdsTelecommandPacket_t));
|
|
63
|
size = 0;
|
|
63
|
size = 0;
|
|
64
|
queue_rcv_id = RTEMS_ID_NONE;
|
|
64
|
queue_rcv_id = RTEMS_ID_NONE;
|
|
65
|
queue_snd_id = RTEMS_ID_NONE;
|
|
65
|
queue_snd_id = RTEMS_ID_NONE;
|
|
66
|
|
|
66
|
|
|
67
|
status = get_message_queue_id_recv( &queue_rcv_id );
|
|
67
|
status = get_message_queue_id_recv( &queue_rcv_id );
|
|
68
|
if (status != RTEMS_SUCCESSFUL)
|
|
68
|
if (status != RTEMS_SUCCESSFUL)
|
|
69
|
{
|
|
69
|
{
|
|
70
|
PRINTF1("in ACTN *** ERR get_message_queue_id_recv %d\n", status)
|
|
70
|
PRINTF1("in ACTN *** ERR get_message_queue_id_recv %d\n", status)
|
|
71
|
}
|
|
71
|
}
|
|
72
|
|
|
72
|
|
|
73
|
status = get_message_queue_id_send( &queue_snd_id );
|
|
73
|
status = get_message_queue_id_send( &queue_snd_id );
|
|
74
|
if (status != RTEMS_SUCCESSFUL)
|
|
74
|
if (status != RTEMS_SUCCESSFUL)
|
|
75
|
{
|
|
75
|
{
|
|
76
|
PRINTF1("in ACTN *** ERR get_message_queue_id_send %d\n", status)
|
|
76
|
PRINTF1("in ACTN *** ERR get_message_queue_id_send %d\n", status)
|
|
77
|
}
|
|
77
|
}
|
|
78
|
|
|
78
|
|
|
79
|
result = LFR_SUCCESSFUL;
|
|
79
|
result = LFR_SUCCESSFUL;
|
|
80
|
subtype = 0; // subtype of the current TC packet
|
|
80
|
subtype = 0; // subtype of the current TC packet
|
|
81
|
|
|
81
|
|
|
82
|
BOOT_PRINTF("in ACTN *** \n");
|
|
82
|
BOOT_PRINTF("in ACTN *** \n");
|
|
83
|
|
|
83
|
|
|
84
|
while(1)
|
|
84
|
while(1)
|
|
85
|
{
|
|
85
|
{
|
|
86
|
status = rtems_message_queue_receive( queue_rcv_id, (char*) &TC, &size,
|
|
86
|
status = rtems_message_queue_receive( queue_rcv_id, (char*) &TC, &size,
|
|
87
|
RTEMS_WAIT, RTEMS_NO_TIMEOUT);
|
|
87
|
RTEMS_WAIT, RTEMS_NO_TIMEOUT);
|
|
88
|
getTime( time ); // set time to the current time
|
|
88
|
getTime( time ); // set time to the current time
|
|
89
|
if (status!=RTEMS_SUCCESSFUL)
|
|
89
|
if (status!=RTEMS_SUCCESSFUL)
|
|
90
|
{
|
|
90
|
{
|
|
91
|
PRINTF1("ERR *** in task ACTN *** error receiving a message, code %d \n", status)
|
|
91
|
PRINTF1("ERR *** in task ACTN *** error receiving a message, code %d \n", status)
|
|
92
|
}
|
|
92
|
}
|
|
93
|
else
|
|
93
|
else
|
|
94
|
{
|
|
94
|
{
|
|
95
|
subtype = TC.serviceSubType;
|
|
95
|
subtype = TC.serviceSubType;
|
|
96
|
switch(subtype)
|
|
96
|
switch(subtype)
|
|
97
|
{
|
|
97
|
{
|
|
98
|
case TC_SUBTYPE_RESET:
|
|
98
|
case TC_SUBTYPE_RESET:
|
|
99
|
result = action_reset( &TC, queue_snd_id, time );
|
|
99
|
result = action_reset( &TC, queue_snd_id, time );
|
|
100
|
close_action( &TC, result, queue_snd_id );
|
|
100
|
close_action( &TC, result, queue_snd_id );
|
|
101
|
break;
|
|
101
|
break;
|
|
102
|
case TC_SUBTYPE_LOAD_COMM:
|
|
102
|
case TC_SUBTYPE_LOAD_COMM:
|
|
103
|
result = action_load_common_par( &TC );
|
|
103
|
result = action_load_common_par( &TC );
|
|
104
|
close_action( &TC, result, queue_snd_id );
|
|
104
|
close_action( &TC, result, queue_snd_id );
|
|
105
|
break;
|
|
105
|
break;
|
|
106
|
case TC_SUBTYPE_LOAD_NORM:
|
|
106
|
case TC_SUBTYPE_LOAD_NORM:
|
|
107
|
result = action_load_normal_par( &TC, queue_snd_id, time );
|
|
107
|
result = action_load_normal_par( &TC, queue_snd_id, time );
|
|
108
|
close_action( &TC, result, queue_snd_id );
|
|
108
|
close_action( &TC, result, queue_snd_id );
|
|
109
|
break;
|
|
109
|
break;
|
|
110
|
case TC_SUBTYPE_LOAD_BURST:
|
|
110
|
case TC_SUBTYPE_LOAD_BURST:
|
|
111
|
result = action_load_burst_par( &TC, queue_snd_id, time );
|
|
111
|
result = action_load_burst_par( &TC, queue_snd_id, time );
|
|
112
|
close_action( &TC, result, queue_snd_id );
|
|
112
|
close_action( &TC, result, queue_snd_id );
|
|
113
|
break;
|
|
113
|
break;
|
|
114
|
case TC_SUBTYPE_LOAD_SBM1:
|
|
114
|
case TC_SUBTYPE_LOAD_SBM1:
|
|
115
|
result = action_load_sbm1_par( &TC, queue_snd_id, time );
|
|
115
|
result = action_load_sbm1_par( &TC, queue_snd_id, time );
|
|
116
|
close_action( &TC, result, queue_snd_id );
|
|
116
|
close_action( &TC, result, queue_snd_id );
|
|
117
|
break;
|
|
117
|
break;
|
|
118
|
case TC_SUBTYPE_LOAD_SBM2:
|
|
118
|
case TC_SUBTYPE_LOAD_SBM2:
|
|
119
|
result = action_load_sbm2_par( &TC, queue_snd_id, time );
|
|
119
|
result = action_load_sbm2_par( &TC, queue_snd_id, time );
|
|
120
|
close_action( &TC, result, queue_snd_id );
|
|
120
|
close_action( &TC, result, queue_snd_id );
|
|
121
|
break;
|
|
121
|
break;
|
|
122
|
case TC_SUBTYPE_DUMP:
|
|
122
|
case TC_SUBTYPE_DUMP:
|
|
123
|
result = action_dump_par( &TC, queue_snd_id );
|
|
123
|
result = action_dump_par( &TC, queue_snd_id );
|
|
124
|
close_action( &TC, result, queue_snd_id );
|
|
124
|
close_action( &TC, result, queue_snd_id );
|
|
125
|
break;
|
|
125
|
break;
|
|
126
|
case TC_SUBTYPE_ENTER:
|
|
126
|
case TC_SUBTYPE_ENTER:
|
|
127
|
result = action_enter_mode( &TC, queue_snd_id );
|
|
127
|
result = action_enter_mode( &TC, queue_snd_id );
|
|
128
|
close_action( &TC, result, queue_snd_id );
|
|
128
|
close_action( &TC, result, queue_snd_id );
|
|
129
|
break;
|
|
129
|
break;
|
|
130
|
case TC_SUBTYPE_UPDT_INFO:
|
|
130
|
case TC_SUBTYPE_UPDT_INFO:
|
|
131
|
result = action_update_info( &TC, queue_snd_id );
|
|
131
|
result = action_update_info( &TC, queue_snd_id );
|
|
132
|
close_action( &TC, result, queue_snd_id );
|
|
132
|
close_action( &TC, result, queue_snd_id );
|
|
133
|
break;
|
|
133
|
break;
|
|
134
|
case TC_SUBTYPE_EN_CAL:
|
|
134
|
case TC_SUBTYPE_EN_CAL:
|
|
135
|
result = action_enable_calibration( &TC, queue_snd_id, time );
|
|
135
|
result = action_enable_calibration( &TC, queue_snd_id, time );
|
|
136
|
close_action( &TC, result, queue_snd_id );
|
|
136
|
close_action( &TC, result, queue_snd_id );
|
|
137
|
break;
|
|
137
|
break;
|
|
138
|
case TC_SUBTYPE_DIS_CAL:
|
|
138
|
case TC_SUBTYPE_DIS_CAL:
|
|
139
|
result = action_disable_calibration( &TC, queue_snd_id, time );
|
|
139
|
result = action_disable_calibration( &TC, queue_snd_id, time );
|
|
140
|
close_action( &TC, result, queue_snd_id );
|
|
140
|
close_action( &TC, result, queue_snd_id );
|
|
141
|
break;
|
|
141
|
break;
|
|
142
|
case TC_SUBTYPE_LOAD_K:
|
|
142
|
case TC_SUBTYPE_LOAD_K:
|
|
143
|
result = action_load_kcoefficients( &TC, queue_snd_id, time );
|
|
143
|
result = action_load_kcoefficients( &TC, queue_snd_id, time );
|
|
144
|
close_action( &TC, result, queue_snd_id );
|
|
144
|
close_action( &TC, result, queue_snd_id );
|
|
145
|
break;
|
|
145
|
break;
|
|
146
|
case TC_SUBTYPE_DUMP_K:
|
|
146
|
case TC_SUBTYPE_DUMP_K:
|
|
147
|
result = action_dump_kcoefficients( &TC, queue_snd_id, time );
|
|
147
|
result = action_dump_kcoefficients( &TC, queue_snd_id, time );
|
|
148
|
close_action( &TC, result, queue_snd_id );
|
|
148
|
close_action( &TC, result, queue_snd_id );
|
|
149
|
break;
|
|
149
|
break;
|
|
150
|
case TC_SUBTYPE_LOAD_FBINS:
|
|
150
|
case TC_SUBTYPE_LOAD_FBINS:
|
|
151
|
result = action_load_fbins_mask( &TC, queue_snd_id, time );
|
|
151
|
result = action_load_fbins_mask( &TC, queue_snd_id, time );
|
|
152
|
close_action( &TC, result, queue_snd_id );
|
|
152
|
close_action( &TC, result, queue_snd_id );
|
|
153
|
break;
|
|
153
|
break;
|
|
154
|
case TC_SUBTYPE_LOAD_FILTER_PAR:
|
|
154
|
case TC_SUBTYPE_LOAD_FILTER_PAR:
|
|
155
|
result = action_load_filter_par( &TC, queue_snd_id, time );
|
|
155
|
result = action_load_filter_par( &TC, queue_snd_id, time );
|
|
156
|
close_action( &TC, result, queue_snd_id );
|
|
156
|
close_action( &TC, result, queue_snd_id );
|
|
157
|
break;
|
|
157
|
break;
|
|
158
|
case TC_SUBTYPE_UPDT_TIME:
|
|
158
|
case TC_SUBTYPE_UPDT_TIME:
|
|
159
|
result = action_update_time( &TC );
|
|
159
|
result = action_update_time( &TC );
|
|
160
|
close_action( &TC, result, queue_snd_id );
|
|
160
|
close_action( &TC, result, queue_snd_id );
|
|
161
|
break;
|
|
161
|
break;
|
|
162
|
default:
|
|
162
|
default:
|
|
163
|
break;
|
|
163
|
break;
|
|
164
|
}
|
|
164
|
}
|
|
165
|
}
|
|
165
|
}
|
|
166
|
}
|
|
166
|
}
|
|
167
|
}
|
|
167
|
}
|
|
168
|
|
|
168
|
|
|
169
|
//***********
|
|
169
|
//***********
|
|
170
|
// TC ACTIONS
|
|
170
|
// TC ACTIONS
|
|
171
|
|
|
171
|
|
|
172
|
int action_reset(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
|
|
172
|
int action_reset(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
|
|
173
|
{
|
|
173
|
{
|
|
174
|
/** This function executes specific actions when a TC_LFR_RESET TeleCommand has been received.
|
|
174
|
/** This function executes specific actions when a TC_LFR_RESET TeleCommand has been received.
|
|
175
|
*
|
|
175
|
*
|
|
176
|
* @param TC points to the TeleCommand packet that is being processed
|
|
176
|
* @param TC points to the TeleCommand packet that is being processed
|
|
177
|
* @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
|
|
177
|
* @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
|
|
178
|
*
|
|
178
|
*
|
|
179
|
*/
|
|
179
|
*/
|
|
180
|
|
|
180
|
|
|
181
|
PRINTF("this is the end!!!\n");
|
|
181
|
PRINTF("this is the end!!!\n");
|
|
182
|
#ifdef GCOV_ENABLED
|
|
182
|
#ifdef GCOV_ENABLED
|
|
183
|
#ifndef GCOV_USE_EXIT
|
|
183
|
#ifndef GCOV_USE_EXIT
|
|
184
|
extern void gcov_exit (void);
|
|
184
|
extern void gcov_exit (void);
|
|
185
|
gcov_exit();
|
|
185
|
gcov_exit();
|
|
186
|
#endif
|
|
186
|
#endif
|
|
187
|
#endif
|
|
187
|
#endif
|
|
188
|
exit(0);
|
|
188
|
exit(0);
|
|
189
|
|
|
189
|
|
|
|
|
|
190
|
#ifdef ENABLE_DEAD_CODE
|
|
190
|
send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time );
|
|
191
|
send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time );
|
|
|
|
|
192
|
#endif
|
|
191
|
|
|
193
|
|
|
192
|
return LFR_DEFAULT;
|
|
194
|
return LFR_DEFAULT;
|
|
193
|
}
|
|
195
|
}
|
|
194
|
|
|
196
|
|
|
195
|
int action_enter_mode(ccsdsTelecommandPacket_t *TC, rtems_id queue_id )
|
|
197
|
int action_enter_mode(ccsdsTelecommandPacket_t *TC, rtems_id queue_id )
|
|
196
|
{
|
|
198
|
{
|
|
197
|
/** This function executes specific actions when a TC_LFR_ENTER_MODE TeleCommand has been received.
|
|
199
|
/** This function executes specific actions when a TC_LFR_ENTER_MODE TeleCommand has been received.
|
|
198
|
*
|
|
200
|
*
|
|
199
|
* @param TC points to the TeleCommand packet that is being processed
|
|
201
|
* @param TC points to the TeleCommand packet that is being processed
|
|
200
|
* @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
|
|
202
|
* @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
|
|
201
|
*
|
|
203
|
*
|
|
202
|
*/
|
|
204
|
*/
|
|
203
|
|
|
205
|
|
|
204
|
rtems_status_code status;
|
|
206
|
rtems_status_code status;
|
|
205
|
unsigned char requestedMode;
|
|
207
|
unsigned char requestedMode;
|
|
206
|
unsigned int transitionCoarseTime;
|
|
208
|
unsigned int transitionCoarseTime;
|
|
207
|
unsigned char * bytePosPtr;
|
|
209
|
unsigned char * bytePosPtr;
|
|
208
|
|
|
210
|
|
|
209
|
bytePosPtr = (unsigned char *) &TC->packetID;
|
|
211
|
bytePosPtr = (unsigned char *) &TC->packetID;
|
|
210
|
requestedMode = bytePosPtr[ BYTE_POS_CP_MODE_LFR_SET ];
|
|
212
|
requestedMode = bytePosPtr[ BYTE_POS_CP_MODE_LFR_SET ];
|
|
211
|
copyInt32ByChar( (char*) &transitionCoarseTime, &bytePosPtr[ BYTE_POS_CP_LFR_ENTER_MODE_TIME ] );
|
|
213
|
copyInt32ByChar( (char*) &transitionCoarseTime, &bytePosPtr[ BYTE_POS_CP_LFR_ENTER_MODE_TIME ] );
|
|
212
|
transitionCoarseTime = transitionCoarseTime & COARSE_TIME_MASK;
|
|
214
|
transitionCoarseTime = transitionCoarseTime & COARSE_TIME_MASK;
|
|
213
|
status = check_mode_value( requestedMode );
|
|
215
|
status = check_mode_value( requestedMode );
|
|
214
|
|
|
216
|
|
|
215
|
if ( status != LFR_SUCCESSFUL ) // the mode value is inconsistent
|
|
217
|
if ( status != LFR_SUCCESSFUL ) // the mode value is inconsistent
|
|
216
|
{
|
|
218
|
{
|
|
217
|
send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_CP_MODE_LFR_SET, requestedMode );
|
|
219
|
send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_CP_MODE_LFR_SET, requestedMode );
|
|
218
|
}
|
|
220
|
}
|
|
219
|
|
|
221
|
|
|
220
|
else // the mode value is valid, check the transition
|
|
222
|
else // the mode value is valid, check the transition
|
|
221
|
{
|
|
223
|
{
|
|
222
|
status = check_mode_transition(requestedMode);
|
|
224
|
status = check_mode_transition(requestedMode);
|
|
223
|
if (status != LFR_SUCCESSFUL)
|
|
225
|
if (status != LFR_SUCCESSFUL)
|
|
224
|
{
|
|
226
|
{
|
|
225
|
PRINTF("ERR *** in action_enter_mode *** check_mode_transition\n")
|
|
227
|
PRINTF("ERR *** in action_enter_mode *** check_mode_transition\n")
|
|
226
|
send_tm_lfr_tc_exe_not_executable( TC, queue_id );
|
|
228
|
send_tm_lfr_tc_exe_not_executable( TC, queue_id );
|
|
227
|
}
|
|
229
|
}
|
|
228
|
}
|
|
230
|
}
|
|
229
|
|
|
231
|
|
|
230
|
if ( status == LFR_SUCCESSFUL ) // the transition is valid, check the date
|
|
232
|
if ( status == LFR_SUCCESSFUL ) // the transition is valid, check the date
|
|
231
|
{
|
|
233
|
{
|
|
232
|
status = check_transition_date( transitionCoarseTime );
|
|
234
|
status = check_transition_date( transitionCoarseTime );
|
|
233
|
if (status != LFR_SUCCESSFUL)
|
|
235
|
if (status != LFR_SUCCESSFUL)
|
|
234
|
{
|
|
236
|
{
|
|
235
|
PRINTF("ERR *** in action_enter_mode *** check_transition_date\n");
|
|
237
|
PRINTF("ERR *** in action_enter_mode *** check_transition_date\n");
|
|
236
|
send_tm_lfr_tc_exe_not_executable(TC, queue_id );
|
|
238
|
send_tm_lfr_tc_exe_not_executable(TC, queue_id );
|
|
237
|
}
|
|
239
|
}
|
|
238
|
}
|
|
240
|
}
|
|
239
|
|
|
241
|
|
|
240
|
if ( status == LFR_SUCCESSFUL ) // the date is valid, enter the mode
|
|
242
|
if ( status == LFR_SUCCESSFUL ) // the date is valid, enter the mode
|
|
241
|
{
|
|
243
|
{
|
|
242
|
PRINTF1("OK *** in action_enter_mode *** enter mode %d\n", requestedMode);
|
|
244
|
PRINTF1("OK *** in action_enter_mode *** enter mode %d\n", requestedMode);
|
|
243
|
|
|
245
|
|
|
244
|
switch(requestedMode)
|
|
246
|
switch(requestedMode)
|
|
245
|
{
|
|
247
|
{
|
|
246
|
case LFR_MODE_STANDBY:
|
|
248
|
case LFR_MODE_STANDBY:
|
|
247
|
status = enter_mode_standby();
|
|
249
|
status = enter_mode_standby();
|
|
248
|
break;
|
|
250
|
break;
|
|
249
|
case LFR_MODE_NORMAL:
|
|
251
|
case LFR_MODE_NORMAL:
|
|
250
|
status = enter_mode_normal( transitionCoarseTime );
|
|
252
|
status = enter_mode_normal( transitionCoarseTime );
|
|
251
|
break;
|
|
253
|
break;
|
|
252
|
case LFR_MODE_BURST:
|
|
254
|
case LFR_MODE_BURST:
|
|
253
|
status = enter_mode_burst( transitionCoarseTime );
|
|
255
|
status = enter_mode_burst( transitionCoarseTime );
|
|
254
|
break;
|
|
256
|
break;
|
|
255
|
case LFR_MODE_SBM1:
|
|
257
|
case LFR_MODE_SBM1:
|
|
256
|
status = enter_mode_sbm1( transitionCoarseTime );
|
|
258
|
status = enter_mode_sbm1( transitionCoarseTime );
|
|
257
|
break;
|
|
259
|
break;
|
|
258
|
case LFR_MODE_SBM2:
|
|
260
|
case LFR_MODE_SBM2:
|
|
259
|
status = enter_mode_sbm2( transitionCoarseTime );
|
|
261
|
status = enter_mode_sbm2( transitionCoarseTime );
|
|
260
|
break;
|
|
262
|
break;
|
|
261
|
default:
|
|
263
|
default:
|
|
262
|
break;
|
|
264
|
break;
|
|
263
|
}
|
|
265
|
}
|
|
264
|
|
|
266
|
|
|
265
|
if (status != RTEMS_SUCCESSFUL)
|
|
267
|
if (status != RTEMS_SUCCESSFUL)
|
|
266
|
{
|
|
268
|
{
|
|
267
|
status = LFR_EXE_ERROR;
|
|
269
|
status = LFR_EXE_ERROR;
|
|
268
|
}
|
|
270
|
}
|
|
269
|
}
|
|
271
|
}
|
|
270
|
|
|
272
|
|
|
271
|
return status;
|
|
273
|
return status;
|
|
272
|
}
|
|
274
|
}
|
|
273
|
|
|
275
|
|
|
274
|
int action_update_info(ccsdsTelecommandPacket_t *TC, rtems_id queue_id)
|
|
276
|
int action_update_info(ccsdsTelecommandPacket_t *TC, rtems_id queue_id)
|
|
275
|
{
|
|
277
|
{
|
|
276
|
/** This function executes specific actions when a TC_LFR_UPDATE_INFO TeleCommand has been received.
|
|
278
|
/** This function executes specific actions when a TC_LFR_UPDATE_INFO TeleCommand has been received.
|
|
277
|
*
|
|
279
|
*
|
|
278
|
* @param TC points to the TeleCommand packet that is being processed
|
|
280
|
* @param TC points to the TeleCommand packet that is being processed
|
|
279
|
* @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
|
|
281
|
* @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
|
|
280
|
*
|
|
282
|
*
|
|
281
|
* @return LFR directive status code:
|
|
283
|
* @return LFR directive status code:
|
|
282
|
* - LFR_DEFAULT
|
|
284
|
* - LFR_DEFAULT
|
|
283
|
* - LFR_SUCCESSFUL
|
|
285
|
* - LFR_SUCCESSFUL
|
|
284
|
*
|
|
286
|
*
|
|
285
|
*/
|
|
287
|
*/
|
|
286
|
|
|
288
|
|
|
287
|
unsigned int val;
|
|
289
|
unsigned int val;
|
|
288
|
unsigned int status;
|
|
290
|
unsigned int status;
|
|
289
|
unsigned char mode;
|
|
291
|
unsigned char mode;
|
|
290
|
unsigned char * bytePosPtr;
|
|
292
|
unsigned char * bytePosPtr;
|
|
291
|
int pos;
|
|
293
|
int pos;
|
|
292
|
float value;
|
|
294
|
float value;
|
|
293
|
|
|
295
|
|
|
294
|
pos = INIT_CHAR;
|
|
296
|
pos = INIT_CHAR;
|
|
295
|
value = INIT_FLOAT;
|
|
297
|
value = INIT_FLOAT;
|
|
296
|
|
|
298
|
|
|
297
|
status = LFR_DEFAULT;
|
|
299
|
status = LFR_DEFAULT;
|
|
298
|
|
|
300
|
|
|
299
|
bytePosPtr = (unsigned char *) &TC->packetID;
|
|
301
|
bytePosPtr = (unsigned char *) &TC->packetID;
|
|
300
|
|
|
302
|
|
|
301
|
// check LFR mode
|
|
303
|
// check LFR mode
|
|
302
|
mode = (bytePosPtr[ BYTE_POS_UPDATE_INFO_PARAMETERS_SET5 ] & BITS_LFR_MODE) >> SHIFT_LFR_MODE;
|
|
304
|
mode = (bytePosPtr[ BYTE_POS_UPDATE_INFO_PARAMETERS_SET5 ] & BITS_LFR_MODE) >> SHIFT_LFR_MODE;
|
|
303
|
status = check_update_info_hk_lfr_mode( mode );
|
|
305
|
status = check_update_info_hk_lfr_mode( mode );
|
|
304
|
if (status == LFR_SUCCESSFUL) // check TDS mode
|
|
306
|
if (status == LFR_SUCCESSFUL) // check TDS mode
|
|
305
|
{
|
|
307
|
{
|
|
306
|
mode = (bytePosPtr[ BYTE_POS_UPDATE_INFO_PARAMETERS_SET6 ] & BITS_TDS_MODE) >> SHIFT_TDS_MODE;
|
|
308
|
mode = (bytePosPtr[ BYTE_POS_UPDATE_INFO_PARAMETERS_SET6 ] & BITS_TDS_MODE) >> SHIFT_TDS_MODE;
|
|
307
|
status = check_update_info_hk_tds_mode( mode );
|
|
309
|
status = check_update_info_hk_tds_mode( mode );
|
|
308
|
}
|
|
310
|
}
|
|
309
|
if (status == LFR_SUCCESSFUL) // check THR mode
|
|
311
|
if (status == LFR_SUCCESSFUL) // check THR mode
|
|
310
|
{
|
|
312
|
{
|
|
311
|
mode = (bytePosPtr[ BYTE_POS_UPDATE_INFO_PARAMETERS_SET6 ] & BITS_THR_MODE);
|
|
313
|
mode = (bytePosPtr[ BYTE_POS_UPDATE_INFO_PARAMETERS_SET6 ] & BITS_THR_MODE);
|
|
312
|
status = check_update_info_hk_thr_mode( mode );
|
|
314
|
status = check_update_info_hk_thr_mode( mode );
|
|
313
|
}
|
|
315
|
}
|
|
314
|
if (status == LFR_SUCCESSFUL) // check reaction wheels frequencies
|
|
316
|
if (status == LFR_SUCCESSFUL) // check reaction wheels frequencies
|
|
315
|
{
|
|
317
|
{
|
|
316
|
status = check_all_sy_lfr_rw_f(TC, &pos, &value);
|
|
318
|
status = check_all_sy_lfr_rw_f(TC, &pos, &value);
|
|
317
|
}
|
|
319
|
}
|
|
318
|
|
|
320
|
|
|
319
|
// if the parameters checking succeeds, udpate all parameters
|
|
321
|
// if the parameters checking succeeds, udpate all parameters
|
|
320
|
if (status == LFR_SUCCESSFUL)
|
|
322
|
if (status == LFR_SUCCESSFUL)
|
|
321
|
{
|
|
323
|
{
|
|
322
|
// pa_bia_status_info
|
|
324
|
// pa_bia_status_info
|
|
323
|
// => pa_bia_mode_mux_set 3 bits
|
|
325
|
// => pa_bia_mode_mux_set 3 bits
|
|
324
|
// => pa_bia_mode_hv_enabled 1 bit
|
|
326
|
// => pa_bia_mode_hv_enabled 1 bit
|
|
325
|
// => pa_bia_mode_bias1_enabled 1 bit
|
|
327
|
// => pa_bia_mode_bias1_enabled 1 bit
|
|
326
|
// => pa_bia_mode_bias2_enabled 1 bit
|
|
328
|
// => pa_bia_mode_bias2_enabled 1 bit
|
|
327
|
// => pa_bia_mode_bias3_enabled 1 bit
|
|
329
|
// => pa_bia_mode_bias3_enabled 1 bit
|
|
328
|
// => pa_bia_on_off (cp_dpu_bias_on_off)
|
|
330
|
// => pa_bia_on_off (cp_dpu_bias_on_off)
|
|
329
|
pa_bia_status_info = bytePosPtr[ BYTE_POS_UPDATE_INFO_PARAMETERS_SET2 ] & BITS_BIA; // [1111 1110]
|
|
331
|
pa_bia_status_info = bytePosPtr[ BYTE_POS_UPDATE_INFO_PARAMETERS_SET2 ] & BITS_BIA; // [1111 1110]
|
|
330
|
pa_bia_status_info = pa_bia_status_info
|
|
332
|
pa_bia_status_info = pa_bia_status_info
|
|
331
|
| (bytePosPtr[ BYTE_POS_UPDATE_INFO_PARAMETERS_SET1 ] & 1);
|
|
333
|
| (bytePosPtr[ BYTE_POS_UPDATE_INFO_PARAMETERS_SET1 ] & 1);
|
|
332
|
|
|
334
|
|
|
333
|
// REACTION_WHEELS_FREQUENCY, copy the incoming parameters in the local variable (to be copied in HK packets)
|
|
335
|
// REACTION_WHEELS_FREQUENCY, copy the incoming parameters in the local variable (to be copied in HK packets)
|
|
334
|
getReactionWheelsFrequencies( TC );
|
|
336
|
getReactionWheelsFrequencies( TC );
|
|
335
|
set_hk_lfr_sc_rw_f_flags();
|
|
337
|
set_hk_lfr_sc_rw_f_flags();
|
|
336
|
build_sy_lfr_rw_masks();
|
|
338
|
build_sy_lfr_rw_masks();
|
|
337
|
|
|
339
|
|
|
338
|
// once the masks are built, they have to be merged with the fbins_mask
|
|
340
|
// once the masks are built, they have to be merged with the fbins_mask
|
|
339
|
merge_fbins_masks();
|
|
341
|
merge_fbins_masks();
|
|
340
|
|
|
342
|
|
|
341
|
// increase the TC_LFR_UPDATE_INFO counter
|
|
343
|
// increase the TC_LFR_UPDATE_INFO counter
|
|
342
|
if (status == LFR_SUCCESSFUL) // if the parameter check is successful
|
|
344
|
if (status == LFR_SUCCESSFUL) // if the parameter check is successful
|
|
343
|
{
|
|
345
|
{
|
|
344
|
val = (housekeeping_packet.hk_lfr_update_info_tc_cnt[0] * CONST_256)
|
|
346
|
val = (housekeeping_packet.hk_lfr_update_info_tc_cnt[0] * CONST_256)
|
|
345
|
+ housekeeping_packet.hk_lfr_update_info_tc_cnt[1];
|
|
347
|
+ housekeeping_packet.hk_lfr_update_info_tc_cnt[1];
|
|
346
|
val++;
|
|
348
|
val++;
|
|
347
|
housekeeping_packet.hk_lfr_update_info_tc_cnt[0] = (unsigned char) (val >> SHIFT_1_BYTE);
|
|
349
|
housekeeping_packet.hk_lfr_update_info_tc_cnt[0] = (unsigned char) (val >> SHIFT_1_BYTE);
|
|
348
|
housekeeping_packet.hk_lfr_update_info_tc_cnt[1] = (unsigned char) (val);
|
|
350
|
housekeeping_packet.hk_lfr_update_info_tc_cnt[1] = (unsigned char) (val);
|
|
349
|
}
|
|
351
|
}
|
|
350
|
}
|
|
352
|
}
|
|
351
|
|
|
353
|
|
|
352
|
return status;
|
|
354
|
return status;
|
|
353
|
}
|
|
355
|
}
|
|
354
|
|
|
356
|
|
|
355
|
int action_enable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
|
|
357
|
int action_enable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
|
|
356
|
{
|
|
358
|
{
|
|
357
|
/** This function executes specific actions when a TC_LFR_ENABLE_CALIBRATION TeleCommand has been received.
|
|
359
|
/** This function executes specific actions when a TC_LFR_ENABLE_CALIBRATION TeleCommand has been received.
|
|
358
|
*
|
|
360
|
*
|
|
359
|
* @param TC points to the TeleCommand packet that is being processed
|
|
361
|
* @param TC points to the TeleCommand packet that is being processed
|
|
360
|
* @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
|
|
362
|
* @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
|
|
361
|
*
|
|
363
|
*
|
|
362
|
*/
|
|
364
|
*/
|
|
363
|
|
|
365
|
|
|
364
|
int result;
|
|
366
|
int result;
|
|
365
|
|
|
367
|
|
|
366
|
result = LFR_DEFAULT;
|
|
368
|
result = LFR_DEFAULT;
|
|
367
|
|
|
369
|
|
|
368
|
setCalibration( true );
|
|
370
|
setCalibration( true );
|
|
369
|
|
|
371
|
|
|
370
|
result = LFR_SUCCESSFUL;
|
|
372
|
result = LFR_SUCCESSFUL;
|
|
371
|
|
|
373
|
|
|
372
|
return result;
|
|
374
|
return result;
|
|
373
|
}
|
|
375
|
}
|
|
374
|
|
|
376
|
|
|
375
|
int action_disable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
|
|
377
|
int action_disable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
|
|
376
|
{
|
|
378
|
{
|
|
377
|
/** This function executes specific actions when a TC_LFR_DISABLE_CALIBRATION TeleCommand has been received.
|
|
379
|
/** This function executes specific actions when a TC_LFR_DISABLE_CALIBRATION TeleCommand has been received.
|
|
378
|
*
|
|
380
|
*
|
|
379
|
* @param TC points to the TeleCommand packet that is being processed
|
|
381
|
* @param TC points to the TeleCommand packet that is being processed
|
|
380
|
* @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
|
|
382
|
* @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
|
|
381
|
*
|
|
383
|
*
|
|
382
|
*/
|
|
384
|
*/
|
|
383
|
|
|
385
|
|
|
384
|
int result;
|
|
386
|
int result;
|
|
385
|
|
|
387
|
|
|
386
|
result = LFR_DEFAULT;
|
|
388
|
result = LFR_DEFAULT;
|
|
387
|
|
|
389
|
|
|
388
|
setCalibration( false );
|
|
390
|
setCalibration( false );
|
|
389
|
|
|
391
|
|
|
390
|
result = LFR_SUCCESSFUL;
|
|
392
|
result = LFR_SUCCESSFUL;
|
|
391
|
|
|
393
|
|
|
392
|
return result;
|
|
394
|
return result;
|
|
393
|
}
|
|
395
|
}
|
|
394
|
|
|
396
|
|
|
395
|
int action_update_time(ccsdsTelecommandPacket_t *TC)
|
|
397
|
int action_update_time(ccsdsTelecommandPacket_t *TC)
|
|
396
|
{
|
|
398
|
{
|
|
397
|
/** This function executes specific actions when a TC_LFR_UPDATE_TIME TeleCommand has been received.
|
|
399
|
/** This function executes specific actions when a TC_LFR_UPDATE_TIME TeleCommand has been received.
|
|
398
|
*
|
|
400
|
*
|
|
399
|
* @param TC points to the TeleCommand packet that is being processed
|
|
401
|
* @param TC points to the TeleCommand packet that is being processed
|
|
400
|
* @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
|
|
402
|
* @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
|
|
401
|
*
|
|
403
|
*
|
|
402
|
* @return LFR_SUCCESSFUL
|
|
404
|
* @return LFR_SUCCESSFUL
|
|
403
|
*
|
|
405
|
*
|
|
404
|
*/
|
|
406
|
*/
|
|
405
|
|
|
407
|
|
|
406
|
unsigned int val;
|
|
408
|
unsigned int val;
|
|
407
|
|
|
409
|
|
|
408
|
time_management_regs->coarse_time_load = (TC->dataAndCRC[BYTE_0] << SHIFT_3_BYTES)
|
|
410
|
time_management_regs->coarse_time_load = (TC->dataAndCRC[BYTE_0] << SHIFT_3_BYTES)
|
|
409
|
+ (TC->dataAndCRC[BYTE_1] << SHIFT_2_BYTES)
|
|
411
|
+ (TC->dataAndCRC[BYTE_1] << SHIFT_2_BYTES)
|
|
410
|
+ (TC->dataAndCRC[BYTE_2] << SHIFT_1_BYTE)
|
|
412
|
+ (TC->dataAndCRC[BYTE_2] << SHIFT_1_BYTE)
|
|
411
|
+ TC->dataAndCRC[BYTE_3];
|
|
413
|
+ TC->dataAndCRC[BYTE_3];
|
|
412
|
|
|
414
|
|
|
413
|
val = (housekeeping_packet.hk_lfr_update_time_tc_cnt[0] * CONST_256)
|
|
415
|
val = (housekeeping_packet.hk_lfr_update_time_tc_cnt[0] * CONST_256)
|
|
414
|
+ housekeeping_packet.hk_lfr_update_time_tc_cnt[1];
|
|
416
|
+ housekeeping_packet.hk_lfr_update_time_tc_cnt[1];
|
|
415
|
val++;
|
|
417
|
val++;
|
|
416
|
housekeeping_packet.hk_lfr_update_time_tc_cnt[0] = (unsigned char) (val >> SHIFT_1_BYTE);
|
|
418
|
housekeeping_packet.hk_lfr_update_time_tc_cnt[0] = (unsigned char) (val >> SHIFT_1_BYTE);
|
|
417
|
housekeeping_packet.hk_lfr_update_time_tc_cnt[1] = (unsigned char) (val);
|
|
419
|
housekeeping_packet.hk_lfr_update_time_tc_cnt[1] = (unsigned char) (val);
|
|
418
|
|
|
420
|
|
|
419
|
oneTcLfrUpdateTimeReceived = 1;
|
|
421
|
oneTcLfrUpdateTimeReceived = 1;
|
|
420
|
|
|
422
|
|
|
421
|
return LFR_SUCCESSFUL;
|
|
423
|
return LFR_SUCCESSFUL;
|
|
422
|
}
|
|
424
|
}
|
|
423
|
|
|
425
|
|
|
424
|
//*******************
|
|
426
|
//*******************
|
|
425
|
// ENTERING THE MODES
|
|
427
|
// ENTERING THE MODES
|
|
426
|
int check_mode_value( unsigned char requestedMode )
|
|
428
|
int check_mode_value( unsigned char requestedMode )
|
|
427
|
{
|
|
429
|
{
|
|
428
|
int status;
|
|
430
|
int status;
|
|
429
|
|
|
431
|
|
|
430
|
status = LFR_DEFAULT;
|
|
432
|
status = LFR_DEFAULT;
|
|
431
|
|
|
433
|
|
|
432
|
if ( (requestedMode != LFR_MODE_STANDBY)
|
|
434
|
if ( (requestedMode != LFR_MODE_STANDBY)
|
|
433
|
&& (requestedMode != LFR_MODE_NORMAL) && (requestedMode != LFR_MODE_BURST)
|
|
435
|
&& (requestedMode != LFR_MODE_NORMAL) && (requestedMode != LFR_MODE_BURST)
|
|
434
|
&& (requestedMode != LFR_MODE_SBM1) && (requestedMode != LFR_MODE_SBM2) )
|
|
436
|
&& (requestedMode != LFR_MODE_SBM1) && (requestedMode != LFR_MODE_SBM2) )
|
|
435
|
{
|
|
437
|
{
|
|
436
|
status = LFR_DEFAULT;
|
|
438
|
status = LFR_DEFAULT;
|
|
437
|
}
|
|
439
|
}
|
|
438
|
else
|
|
440
|
else
|
|
439
|
{
|
|
441
|
{
|
|
440
|
status = LFR_SUCCESSFUL;
|
|
442
|
status = LFR_SUCCESSFUL;
|
|
441
|
}
|
|
443
|
}
|
|
442
|
|
|
444
|
|
|
443
|
return status;
|
|
445
|
return status;
|
|
444
|
}
|
|
446
|
}
|
|
445
|
|
|
447
|
|
|
446
|
int check_mode_transition( unsigned char requestedMode )
|
|
448
|
int check_mode_transition( unsigned char requestedMode )
|
|
447
|
{
|
|
449
|
{
|
|
448
|
/** This function checks the validity of the transition requested by the TC_LFR_ENTER_MODE.
|
|
450
|
/** This function checks the validity of the transition requested by the TC_LFR_ENTER_MODE.
|
|
449
|
*
|
|
451
|
*
|
|
450
|
* @param requestedMode is the mode requested by the TC_LFR_ENTER_MODE
|
|
452
|
* @param requestedMode is the mode requested by the TC_LFR_ENTER_MODE
|
|
451
|
*
|
|
453
|
*
|
|
452
|
* @return LFR directive status codes:
|
|
454
|
* @return LFR directive status codes:
|
|
453
|
* - LFR_SUCCESSFUL - the transition is authorized
|
|
455
|
* - LFR_SUCCESSFUL - the transition is authorized
|
|
454
|
* - LFR_DEFAULT - the transition is not authorized
|
|
456
|
* - LFR_DEFAULT - the transition is not authorized
|
|
455
|
*
|
|
457
|
*
|
|
456
|
*/
|
|
458
|
*/
|
|
457
|
|
|
459
|
|
|
458
|
int status;
|
|
460
|
int status;
|
|
459
|
|
|
461
|
|
|
460
|
switch (requestedMode)
|
|
462
|
switch (requestedMode)
|
|
461
|
{
|
|
463
|
{
|
|
462
|
case LFR_MODE_STANDBY:
|
|
464
|
case LFR_MODE_STANDBY:
|
|
463
|
if ( lfrCurrentMode == LFR_MODE_STANDBY ) {
|
|
465
|
if ( lfrCurrentMode == LFR_MODE_STANDBY ) {
|
|
464
|
status = LFR_DEFAULT;
|
|
466
|
status = LFR_DEFAULT;
|
|
465
|
}
|
|
467
|
}
|
|
466
|
else
|
|
468
|
else
|
|
467
|
{
|
|
469
|
{
|
|
468
|
status = LFR_SUCCESSFUL;
|
|
470
|
status = LFR_SUCCESSFUL;
|
|
469
|
}
|
|
471
|
}
|
|
470
|
break;
|
|
472
|
break;
|
|
471
|
case LFR_MODE_NORMAL:
|
|
473
|
case LFR_MODE_NORMAL:
|
|
472
|
if ( lfrCurrentMode == LFR_MODE_NORMAL ) {
|
|
474
|
if ( lfrCurrentMode == LFR_MODE_NORMAL ) {
|
|
473
|
status = LFR_DEFAULT;
|
|
475
|
status = LFR_DEFAULT;
|
|
474
|
}
|
|
476
|
}
|
|
475
|
else {
|
|
477
|
else {
|
|
476
|
status = LFR_SUCCESSFUL;
|
|
478
|
status = LFR_SUCCESSFUL;
|
|
477
|
}
|
|
479
|
}
|
|
478
|
break;
|
|
480
|
break;
|
|
479
|
case LFR_MODE_BURST:
|
|
481
|
case LFR_MODE_BURST:
|
|
480
|
if ( lfrCurrentMode == LFR_MODE_BURST ) {
|
|
482
|
if ( lfrCurrentMode == LFR_MODE_BURST ) {
|
|
481
|
status = LFR_DEFAULT;
|
|
483
|
status = LFR_DEFAULT;
|
|
482
|
}
|
|
484
|
}
|
|
483
|
else {
|
|
485
|
else {
|
|
484
|
status = LFR_SUCCESSFUL;
|
|
486
|
status = LFR_SUCCESSFUL;
|
|
485
|
}
|
|
487
|
}
|
|
486
|
break;
|
|
488
|
break;
|
|
487
|
case LFR_MODE_SBM1:
|
|
489
|
case LFR_MODE_SBM1:
|
|
488
|
if ( lfrCurrentMode == LFR_MODE_SBM1 ) {
|
|
490
|
if ( lfrCurrentMode == LFR_MODE_SBM1 ) {
|
|
489
|
status = LFR_DEFAULT;
|
|
491
|
status = LFR_DEFAULT;
|
|
490
|
}
|
|
492
|
}
|
|
491
|
else {
|
|
493
|
else {
|
|
492
|
status = LFR_SUCCESSFUL;
|
|
494
|
status = LFR_SUCCESSFUL;
|
|
493
|
}
|
|
495
|
}
|
|
494
|
break;
|
|
496
|
break;
|
|
495
|
case LFR_MODE_SBM2:
|
|
497
|
case LFR_MODE_SBM2:
|
|
496
|
if ( lfrCurrentMode == LFR_MODE_SBM2 ) {
|
|
498
|
if ( lfrCurrentMode == LFR_MODE_SBM2 ) {
|
|
497
|
status = LFR_DEFAULT;
|
|
499
|
status = LFR_DEFAULT;
|
|
498
|
}
|
|
500
|
}
|
|
499
|
else {
|
|
501
|
else {
|
|
500
|
status = LFR_SUCCESSFUL;
|
|
502
|
status = LFR_SUCCESSFUL;
|
|
501
|
}
|
|
503
|
}
|
|
502
|
break;
|
|
504
|
break;
|
|
503
|
default:
|
|
505
|
default:
|
|
504
|
status = LFR_DEFAULT;
|
|
506
|
status = LFR_DEFAULT;
|
|
505
|
break;
|
|
507
|
break;
|
|
506
|
}
|
|
508
|
}
|
|
507
|
|
|
509
|
|
|
508
|
return status;
|
|
510
|
return status;
|
|
509
|
}
|
|
511
|
}
|
|
510
|
|
|
512
|
|
|
511
|
void update_last_valid_transition_date( unsigned int transitionCoarseTime )
|
|
513
|
void update_last_valid_transition_date( unsigned int transitionCoarseTime )
|
|
512
|
{
|
|
514
|
{
|
|
513
|
if (transitionCoarseTime == 0)
|
|
515
|
if (transitionCoarseTime == 0)
|
|
514
|
{
|
|
516
|
{
|
|
515
|
lastValidEnterModeTime = time_management_regs->coarse_time + 1;
|
|
517
|
lastValidEnterModeTime = time_management_regs->coarse_time + 1;
|
|
516
|
PRINTF1("lastValidEnterModeTime = 0x%x (transitionCoarseTime = 0 => coarse_time+1)\n", lastValidEnterModeTime);
|
|
518
|
PRINTF1("lastValidEnterModeTime = 0x%x (transitionCoarseTime = 0 => coarse_time+1)\n", lastValidEnterModeTime);
|
|
517
|
}
|
|
519
|
}
|
|
518
|
else
|
|
520
|
else
|
|
519
|
{
|
|
521
|
{
|
|
520
|
lastValidEnterModeTime = transitionCoarseTime;
|
|
522
|
lastValidEnterModeTime = transitionCoarseTime;
|
|
521
|
PRINTF1("lastValidEnterModeTime = 0x%x\n", transitionCoarseTime);
|
|
523
|
PRINTF1("lastValidEnterModeTime = 0x%x\n", transitionCoarseTime);
|
|
522
|
}
|
|
524
|
}
|
|
523
|
}
|
|
525
|
}
|
|
524
|
|
|
526
|
|
|
525
|
int check_transition_date( unsigned int transitionCoarseTime )
|
|
527
|
int check_transition_date( unsigned int transitionCoarseTime )
|
|
526
|
{
|
|
528
|
{
|
|
527
|
int status;
|
|
529
|
int status;
|
|
528
|
unsigned int localCoarseTime;
|
|
530
|
unsigned int localCoarseTime;
|
|
529
|
unsigned int deltaCoarseTime;
|
|
531
|
unsigned int deltaCoarseTime;
|
|
530
|
|
|
532
|
|
|
531
|
status = LFR_SUCCESSFUL;
|
|
533
|
status = LFR_SUCCESSFUL;
|
|
532
|
|
|
534
|
|
|
533
|
if (transitionCoarseTime == 0) // transition time = 0 means an instant transition
|
|
535
|
if (transitionCoarseTime == 0) // transition time = 0 means an instant transition
|
|
534
|
{
|
|
536
|
{
|
|
535
|
status = LFR_SUCCESSFUL;
|
|
537
|
status = LFR_SUCCESSFUL;
|
|
536
|
}
|
|
538
|
}
|
|
537
|
else
|
|
539
|
else
|
|
538
|
{
|
|
540
|
{
|
|
539
|
localCoarseTime = time_management_regs->coarse_time & COARSE_TIME_MASK;
|
|
541
|
localCoarseTime = time_management_regs->coarse_time & COARSE_TIME_MASK;
|
|
540
|
|
|
542
|
|
|
541
|
PRINTF2("localTime = %x, transitionTime = %x\n", localCoarseTime, transitionCoarseTime);
|
|
543
|
PRINTF2("localTime = %x, transitionTime = %x\n", localCoarseTime, transitionCoarseTime);
|
|
542
|
|
|
544
|
|
|
543
|
if ( transitionCoarseTime <= localCoarseTime ) // SSS-CP-EQS-322
|
|
545
|
if ( transitionCoarseTime <= localCoarseTime ) // SSS-CP-EQS-322
|
|
544
|
{
|
|
546
|
{
|
|
545
|
status = LFR_DEFAULT;
|
|
547
|
status = LFR_DEFAULT;
|
|
546
|
PRINTF("ERR *** in check_transition_date *** transitionCoarseTime <= localCoarseTime\n");
|
|
548
|
PRINTF("ERR *** in check_transition_date *** transitionCoarseTime <= localCoarseTime\n");
|
|
547
|
}
|
|
549
|
}
|
|
548
|
|
|
550
|
|
|
549
|
if (status == LFR_SUCCESSFUL)
|
|
551
|
if (status == LFR_SUCCESSFUL)
|
|
550
|
{
|
|
552
|
{
|
|
551
|
deltaCoarseTime = transitionCoarseTime - localCoarseTime;
|
|
553
|
deltaCoarseTime = transitionCoarseTime - localCoarseTime;
|
|
552
|
if ( deltaCoarseTime > MAX_DELTA_COARSE_TIME ) // SSS-CP-EQS-323
|
|
554
|
if ( deltaCoarseTime > MAX_DELTA_COARSE_TIME ) // SSS-CP-EQS-323
|
|
553
|
{
|
|
555
|
{
|
|
554
|
status = LFR_DEFAULT;
|
|
556
|
status = LFR_DEFAULT;
|
|
555
|
PRINTF1("ERR *** in check_transition_date *** deltaCoarseTime = %x\n", deltaCoarseTime)
|
|
557
|
PRINTF1("ERR *** in check_transition_date *** deltaCoarseTime = %x\n", deltaCoarseTime)
|
|
556
|
}
|
|
558
|
}
|
|
557
|
}
|
|
559
|
}
|
|
558
|
}
|
|
560
|
}
|
|
559
|
|
|
561
|
|
|
560
|
return status;
|
|
562
|
return status;
|
|
561
|
}
|
|
563
|
}
|
|
562
|
|
|
564
|
|
|
563
|
int restart_asm_activities( unsigned char lfrRequestedMode )
|
|
565
|
int restart_asm_activities( unsigned char lfrRequestedMode )
|
|
564
|
{
|
|
566
|
{
|
|
565
|
rtems_status_code status;
|
|
567
|
rtems_status_code status;
|
|
566
|
|
|
568
|
|
|
567
|
status = stop_spectral_matrices();
|
|
569
|
status = stop_spectral_matrices();
|
|
568
|
|
|
570
|
|
|
569
|
thisIsAnASMRestart = 1;
|
|
571
|
thisIsAnASMRestart = 1;
|
|
570
|
|
|
572
|
|
|
571
|
status = restart_asm_tasks( lfrRequestedMode );
|
|
573
|
status = restart_asm_tasks( lfrRequestedMode );
|
|
572
|
|
|
574
|
|
|
573
|
launch_spectral_matrix();
|
|
575
|
launch_spectral_matrix();
|
|
574
|
|
|
576
|
|
|
575
|
return status;
|
|
577
|
return status;
|
|
576
|
}
|
|
578
|
}
|
|
577
|
|
|
579
|
|
|
578
|
int stop_spectral_matrices( void )
|
|
580
|
int stop_spectral_matrices( void )
|
|
579
|
{
|
|
581
|
{
|
|
580
|
/** This function stops and restarts the current mode average spectral matrices activities.
|
|
582
|
/** This function stops and restarts the current mode average spectral matrices activities.
|
|
581
|
*
|
|
583
|
*
|
|
582
|
* @return RTEMS directive status codes:
|
|
584
|
* @return RTEMS directive status codes:
|
|
583
|
* - RTEMS_SUCCESSFUL - task restarted successfully
|
|
585
|
* - RTEMS_SUCCESSFUL - task restarted successfully
|
|
584
|
* - RTEMS_INVALID_ID - task id invalid
|
|
586
|
* - RTEMS_INVALID_ID - task id invalid
|
|
585
|
* - RTEMS_ALREADY_SUSPENDED - task already suspended
|
|
587
|
* - RTEMS_ALREADY_SUSPENDED - task already suspended
|
|
586
|
*
|
|
588
|
*
|
|
587
|
*/
|
|
589
|
*/
|
|
588
|
|
|
590
|
|
|
589
|
rtems_status_code status;
|
|
591
|
rtems_status_code status;
|
|
590
|
|
|
592
|
|
|
591
|
status = RTEMS_SUCCESSFUL;
|
|
593
|
status = RTEMS_SUCCESSFUL;
|
|
592
|
|
|
594
|
|
|
593
|
// (1) mask interruptions
|
|
595
|
// (1) mask interruptions
|
|
594
|
LEON_Mask_interrupt( IRQ_SPECTRAL_MATRIX ); // mask spectral matrix interrupt
|
|
596
|
LEON_Mask_interrupt( IRQ_SPECTRAL_MATRIX ); // mask spectral matrix interrupt
|
|
595
|
|
|
597
|
|
|
596
|
// (2) reset spectral matrices registers
|
|
598
|
// (2) reset spectral matrices registers
|
|
597
|
set_sm_irq_onNewMatrix( 0 ); // stop the spectral matrices
|
|
599
|
set_sm_irq_onNewMatrix( 0 ); // stop the spectral matrices
|
|
598
|
reset_sm_status();
|
|
600
|
reset_sm_status();
|
|
599
|
|
|
601
|
|
|
600
|
// (3) clear interruptions
|
|
602
|
// (3) clear interruptions
|
|
601
|
LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt
|
|
603
|
LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt
|
|
602
|
|
|
604
|
|
|
603
|
// suspend several tasks
|
|
605
|
// suspend several tasks
|
|
604
|
if (lfrCurrentMode != LFR_MODE_STANDBY) {
|
|
606
|
if (lfrCurrentMode != LFR_MODE_STANDBY) {
|
|
605
|
status = suspend_asm_tasks();
|
|
607
|
status = suspend_asm_tasks();
|
|
606
|
}
|
|
608
|
}
|
|
607
|
|
|
609
|
|
|
608
|
if (status != RTEMS_SUCCESSFUL)
|
|
610
|
if (status != RTEMS_SUCCESSFUL)
|
|
609
|
{
|
|
611
|
{
|
|
610
|
PRINTF1("in stop_current_mode *** in suspend_science_tasks *** ERR code: %d\n", status)
|
|
612
|
PRINTF1("in stop_current_mode *** in suspend_science_tasks *** ERR code: %d\n", status)
|
|
611
|
}
|
|
613
|
}
|
|
612
|
|
|
614
|
|
|
613
|
return status;
|
|
615
|
return status;
|
|
614
|
}
|
|
616
|
}
|
|
615
|
|
|
617
|
|
|
616
|
int stop_current_mode( void )
|
|
618
|
int stop_current_mode( void )
|
|
617
|
{
|
|
619
|
{
|
|
618
|
/** This function stops the current mode by masking interrupt lines and suspending science tasks.
|
|
620
|
/** This function stops the current mode by masking interrupt lines and suspending science tasks.
|
|
619
|
*
|
|
621
|
*
|
|
620
|
* @return RTEMS directive status codes:
|
|
622
|
* @return RTEMS directive status codes:
|
|
621
|
* - RTEMS_SUCCESSFUL - task restarted successfully
|
|
623
|
* - RTEMS_SUCCESSFUL - task restarted successfully
|
|
622
|
* - RTEMS_INVALID_ID - task id invalid
|
|
624
|
* - RTEMS_INVALID_ID - task id invalid
|
|
623
|
* - RTEMS_ALREADY_SUSPENDED - task already suspended
|
|
625
|
* - RTEMS_ALREADY_SUSPENDED - task already suspended
|
|
624
|
*
|
|
626
|
*
|
|
625
|
*/
|
|
627
|
*/
|
|
626
|
|
|
628
|
|
|
627
|
rtems_status_code status;
|
|
629
|
rtems_status_code status;
|
|
628
|
|
|
630
|
|
|
629
|
status = RTEMS_SUCCESSFUL;
|
|
631
|
status = RTEMS_SUCCESSFUL;
|
|
630
|
|
|
632
|
|
|
631
|
// (1) mask interruptions
|
|
633
|
// (1) mask interruptions
|
|
632
|
LEON_Mask_interrupt( IRQ_WAVEFORM_PICKER ); // mask waveform picker interrupt
|
|
634
|
LEON_Mask_interrupt( IRQ_WAVEFORM_PICKER ); // mask waveform picker interrupt
|
|
633
|
LEON_Mask_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt
|
|
635
|
LEON_Mask_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt
|
|
634
|
|
|
636
|
|
|
635
|
// (2) reset waveform picker registers
|
|
637
|
// (2) reset waveform picker registers
|
|
636
|
reset_wfp_burst_enable(); // reset burst and enable bits
|
|
638
|
reset_wfp_burst_enable(); // reset burst and enable bits
|
|
637
|
reset_wfp_status(); // reset all the status bits
|
|
639
|
reset_wfp_status(); // reset all the status bits
|
|
638
|
|
|
640
|
|
|
639
|
// (3) reset spectral matrices registers
|
|
641
|
// (3) reset spectral matrices registers
|
|
640
|
set_sm_irq_onNewMatrix( 0 ); // stop the spectral matrices
|
|
642
|
set_sm_irq_onNewMatrix( 0 ); // stop the spectral matrices
|
|
641
|
reset_sm_status();
|
|
643
|
reset_sm_status();
|
|
642
|
|
|
644
|
|
|
643
|
// reset lfr VHDL module
|
|
645
|
// reset lfr VHDL module
|
|
644
|
reset_lfr();
|
|
646
|
reset_lfr();
|
|
645
|
|
|
647
|
|
|
646
|
reset_extractSWF(); // reset the extractSWF flag to false
|
|
648
|
reset_extractSWF(); // reset the extractSWF flag to false
|
|
647
|
|
|
649
|
|
|
648
|
// (4) clear interruptions
|
|
650
|
// (4) clear interruptions
|
|
649
|
LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); // clear waveform picker interrupt
|
|
651
|
LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); // clear waveform picker interrupt
|
|
650
|
LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt
|
|
652
|
LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt
|
|
651
|
|
|
653
|
|
|
652
|
// suspend several tasks
|
|
654
|
// suspend several tasks
|
|
653
|
if (lfrCurrentMode != LFR_MODE_STANDBY) {
|
|
655
|
if (lfrCurrentMode != LFR_MODE_STANDBY) {
|
|
654
|
status = suspend_science_tasks();
|
|
656
|
status = suspend_science_tasks();
|
|
655
|
}
|
|
657
|
}
|
|
656
|
|
|
658
|
|
|
657
|
if (status != RTEMS_SUCCESSFUL)
|
|
659
|
if (status != RTEMS_SUCCESSFUL)
|
|
658
|
{
|
|
660
|
{
|
|
659
|
PRINTF1("in stop_current_mode *** in suspend_science_tasks *** ERR code: %d\n", status)
|
|
661
|
PRINTF1("in stop_current_mode *** in suspend_science_tasks *** ERR code: %d\n", status)
|
|
660
|
}
|
|
662
|
}
|
|
661
|
|
|
663
|
|
|
662
|
return status;
|
|
664
|
return status;
|
|
663
|
}
|
|
665
|
}
|
|
664
|
|
|
666
|
|
|
665
|
int enter_mode_standby( void )
|
|
667
|
int enter_mode_standby( void )
|
|
666
|
{
|
|
668
|
{
|
|
667
|
/** This function is used to put LFR in the STANDBY mode.
|
|
669
|
/** This function is used to put LFR in the STANDBY mode.
|
|
668
|
*
|
|
670
|
*
|
|
669
|
* @param transitionCoarseTime is the requested transition time contained in the TC_LFR_ENTER_MODE
|
|
671
|
* @param transitionCoarseTime is the requested transition time contained in the TC_LFR_ENTER_MODE
|
|
670
|
*
|
|
672
|
*
|
|
671
|
* @return RTEMS directive status codes:
|
|
673
|
* @return RTEMS directive status codes:
|
|
672
|
* - RTEMS_SUCCESSFUL - task restarted successfully
|
|
674
|
* - RTEMS_SUCCESSFUL - task restarted successfully
|
|
673
|
* - RTEMS_INVALID_ID - task id invalid
|
|
675
|
* - RTEMS_INVALID_ID - task id invalid
|
|
674
|
* - RTEMS_INCORRECT_STATE - task never started
|
|
676
|
* - RTEMS_INCORRECT_STATE - task never started
|
|
675
|
* - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task
|
|
677
|
* - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task
|
|
676
|
*
|
|
678
|
*
|
|
677
|
* The STANDBY mode does not depends on a specific transition date, the effect of the TC_LFR_ENTER_MODE
|
|
679
|
* The STANDBY mode does not depends on a specific transition date, the effect of the TC_LFR_ENTER_MODE
|
|
678
|
* is immediate.
|
|
680
|
* is immediate.
|
|
679
|
*
|
|
681
|
*
|
|
680
|
*/
|
|
682
|
*/
|
|
681
|
|
|
683
|
|
|
682
|
int status;
|
|
684
|
int status;
|
|
683
|
|
|
685
|
|
|
684
|
status = stop_current_mode(); // STOP THE CURRENT MODE
|
|
686
|
status = stop_current_mode(); // STOP THE CURRENT MODE
|
|
685
|
|
|
687
|
|
|
686
|
#ifdef PRINT_TASK_STATISTICS
|
|
688
|
#ifdef PRINT_TASK_STATISTICS
|
|
687
|
rtems_cpu_usage_report();
|
|
689
|
rtems_cpu_usage_report();
|
|
688
|
#endif
|
|
690
|
#endif
|
|
689
|
|
|
691
|
|
|
690
|
#ifdef PRINT_STACK_REPORT
|
|
692
|
#ifdef PRINT_STACK_REPORT
|
|
691
|
PRINTF("stack report selected\n")
|
|
693
|
PRINTF("stack report selected\n")
|
|
692
|
rtems_stack_checker_report_usage();
|
|
694
|
rtems_stack_checker_report_usage();
|
|
693
|
#endif
|
|
695
|
#endif
|
|
694
|
|
|
696
|
|
|
695
|
return status;
|
|
697
|
return status;
|
|
696
|
}
|
|
698
|
}
|
|
697
|
|
|
699
|
|
|
698
|
int enter_mode_normal( unsigned int transitionCoarseTime )
|
|
700
|
int enter_mode_normal( unsigned int transitionCoarseTime )
|
|
699
|
{
|
|
701
|
{
|
|
700
|
/** This function is used to start the NORMAL mode.
|
|
702
|
/** This function is used to start the NORMAL mode.
|
|
701
|
*
|
|
703
|
*
|
|
702
|
* @param transitionCoarseTime is the requested transition time contained in the TC_LFR_ENTER_MODE
|
|
704
|
* @param transitionCoarseTime is the requested transition time contained in the TC_LFR_ENTER_MODE
|
|
703
|
*
|
|
705
|
*
|
|
704
|
* @return RTEMS directive status codes:
|
|
706
|
* @return RTEMS directive status codes:
|
|
705
|
* - RTEMS_SUCCESSFUL - task restarted successfully
|
|
707
|
* - RTEMS_SUCCESSFUL - task restarted successfully
|
|
706
|
* - RTEMS_INVALID_ID - task id invalid
|
|
708
|
* - RTEMS_INVALID_ID - task id invalid
|
|
707
|
* - RTEMS_INCORRECT_STATE - task never started
|
|
709
|
* - RTEMS_INCORRECT_STATE - task never started
|
|
708
|
* - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task
|
|
710
|
* - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task
|
|
709
|
*
|
|
711
|
*
|
|
710
|
* The way the NORMAL mode is started depends on the LFR current mode. If LFR is in SBM1 or SBM2,
|
|
712
|
* The way the NORMAL mode is started depends on the LFR current mode. If LFR is in SBM1 or SBM2,
|
|
711
|
* the snapshots are not restarted, only ASM, BP and CWF data generation are affected.
|
|
713
|
* the snapshots are not restarted, only ASM, BP and CWF data generation are affected.
|
|
712
|
*
|
|
714
|
*
|
|
713
|
*/
|
|
715
|
*/
|
|
714
|
|
|
716
|
|
|
715
|
int status;
|
|
717
|
int status;
|
|
716
|
|
|
718
|
|
|
717
|
#ifdef PRINT_TASK_STATISTICS
|
|
719
|
#ifdef PRINT_TASK_STATISTICS
|
|
718
|
rtems_cpu_usage_reset();
|
|
720
|
rtems_cpu_usage_reset();
|
|
719
|
#endif
|
|
721
|
#endif
|
|
720
|
|
|
722
|
|
|
721
|
status = RTEMS_UNSATISFIED;
|
|
723
|
status = RTEMS_UNSATISFIED;
|
|
722
|
|
|
724
|
|
|
723
|
switch( lfrCurrentMode )
|
|
725
|
switch( lfrCurrentMode )
|
|
724
|
{
|
|
726
|
{
|
|
725
|
case LFR_MODE_STANDBY:
|
|
727
|
case LFR_MODE_STANDBY:
|
|
726
|
status = restart_science_tasks( LFR_MODE_NORMAL ); // restart science tasks
|
|
728
|
status = restart_science_tasks( LFR_MODE_NORMAL ); // restart science tasks
|
|
727
|
if (status == RTEMS_SUCCESSFUL) // relaunch spectral_matrix and waveform_picker modules
|
|
729
|
if (status == RTEMS_SUCCESSFUL) // relaunch spectral_matrix and waveform_picker modules
|
|
728
|
{
|
|
730
|
{
|
|
729
|
launch_spectral_matrix( );
|
|
731
|
launch_spectral_matrix( );
|
|
730
|
launch_waveform_picker( LFR_MODE_NORMAL, transitionCoarseTime );
|
|
732
|
launch_waveform_picker( LFR_MODE_NORMAL, transitionCoarseTime );
|
|
731
|
}
|
|
733
|
}
|
|
732
|
break;
|
|
734
|
break;
|
|
733
|
case LFR_MODE_BURST:
|
|
735
|
case LFR_MODE_BURST:
|
|
734
|
status = stop_current_mode(); // stop the current mode
|
|
736
|
status = stop_current_mode(); // stop the current mode
|
|
735
|
status = restart_science_tasks( LFR_MODE_NORMAL ); // restart the science tasks
|
|
737
|
status = restart_science_tasks( LFR_MODE_NORMAL ); // restart the science tasks
|
|
736
|
if (status == RTEMS_SUCCESSFUL) // relaunch spectral_matrix and waveform_picker modules
|
|
738
|
if (status == RTEMS_SUCCESSFUL) // relaunch spectral_matrix and waveform_picker modules
|
|
737
|
{
|
|
739
|
{
|
|
738
|
launch_spectral_matrix( );
|
|
740
|
launch_spectral_matrix( );
|
|
739
|
launch_waveform_picker( LFR_MODE_NORMAL, transitionCoarseTime );
|
|
741
|
launch_waveform_picker( LFR_MODE_NORMAL, transitionCoarseTime );
|
|
740
|
}
|
|
742
|
}
|
|
741
|
break;
|
|
743
|
break;
|
|
742
|
case LFR_MODE_SBM1:
|
|
744
|
case LFR_MODE_SBM1:
|
|
743
|
status = restart_asm_activities( LFR_MODE_NORMAL ); // this is necessary to restart ASM tasks to update the parameters
|
|
745
|
status = restart_asm_activities( LFR_MODE_NORMAL ); // this is necessary to restart ASM tasks to update the parameters
|
|
744
|
status = LFR_SUCCESSFUL; // lfrCurrentMode will be updated after the execution of close_action
|
|
746
|
status = LFR_SUCCESSFUL; // lfrCurrentMode will be updated after the execution of close_action
|
|
745
|
update_last_valid_transition_date( transitionCoarseTime );
|
|
747
|
update_last_valid_transition_date( transitionCoarseTime );
|
|
746
|
break;
|
|
748
|
break;
|
|
747
|
case LFR_MODE_SBM2:
|
|
749
|
case LFR_MODE_SBM2:
|
|
748
|
status = restart_asm_activities( LFR_MODE_NORMAL ); // this is necessary to restart ASM tasks to update the parameters
|
|
750
|
status = restart_asm_activities( LFR_MODE_NORMAL ); // this is necessary to restart ASM tasks to update the parameters
|
|
749
|
status = LFR_SUCCESSFUL; // lfrCurrentMode will be updated after the execution of close_action
|
|
751
|
status = LFR_SUCCESSFUL; // lfrCurrentMode will be updated after the execution of close_action
|
|
750
|
update_last_valid_transition_date( transitionCoarseTime );
|
|
752
|
update_last_valid_transition_date( transitionCoarseTime );
|
|
751
|
break;
|
|
753
|
break;
|
|
752
|
default:
|
|
754
|
default:
|
|
753
|
break;
|
|
755
|
break;
|
|
754
|
}
|
|
756
|
}
|
|
755
|
|
|
757
|
|
|
756
|
if (status != RTEMS_SUCCESSFUL)
|
|
758
|
if (status != RTEMS_SUCCESSFUL)
|
|
757
|
{
|
|
759
|
{
|
|
758
|
PRINTF1("ERR *** in enter_mode_normal *** status = %d\n", status)
|
|
760
|
PRINTF1("ERR *** in enter_mode_normal *** status = %d\n", status)
|
|
759
|
status = RTEMS_UNSATISFIED;
|
|
761
|
status = RTEMS_UNSATISFIED;
|
|
760
|
}
|
|
762
|
}
|
|
761
|
|
|
763
|
|
|
762
|
return status;
|
|
764
|
return status;
|
|
763
|
}
|
|
765
|
}
|
|
764
|
|
|
766
|
|
|
765
|
int enter_mode_burst( unsigned int transitionCoarseTime )
|
|
767
|
int enter_mode_burst( unsigned int transitionCoarseTime )
|
|
766
|
{
|
|
768
|
{
|
|
767
|
/** This function is used to start the BURST mode.
|
|
769
|
/** This function is used to start the BURST mode.
|
|
768
|
*
|
|
770
|
*
|
|
769
|
* @param transitionCoarseTime is the requested transition time contained in the TC_LFR_ENTER_MODE
|
|
771
|
* @param transitionCoarseTime is the requested transition time contained in the TC_LFR_ENTER_MODE
|
|
770
|
*
|
|
772
|
*
|
|
771
|
* @return RTEMS directive status codes:
|
|
773
|
* @return RTEMS directive status codes:
|
|
772
|
* - RTEMS_SUCCESSFUL - task restarted successfully
|
|
774
|
* - RTEMS_SUCCESSFUL - task restarted successfully
|
|
773
|
* - RTEMS_INVALID_ID - task id invalid
|
|
775
|
* - RTEMS_INVALID_ID - task id invalid
|
|
774
|
* - RTEMS_INCORRECT_STATE - task never started
|
|
776
|
* - RTEMS_INCORRECT_STATE - task never started
|
|
775
|
* - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task
|
|
777
|
* - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task
|
|
776
|
*
|
|
778
|
*
|
|
777
|
* The way the BURST mode is started does not depend on the LFR current mode.
|
|
779
|
* The way the BURST mode is started does not depend on the LFR current mode.
|
|
778
|
*
|
|
780
|
*
|
|
779
|
*/
|
|
781
|
*/
|
|
780
|
|
|
782
|
|
|
781
|
|
|
783
|
|
|
782
|
int status;
|
|
784
|
int status;
|
|
783
|
|
|
785
|
|
|
784
|
#ifdef PRINT_TASK_STATISTICS
|
|
786
|
#ifdef PRINT_TASK_STATISTICS
|
|
785
|
rtems_cpu_usage_reset();
|
|
787
|
rtems_cpu_usage_reset();
|
|
786
|
#endif
|
|
788
|
#endif
|
|
787
|
|
|
789
|
|
|
788
|
status = stop_current_mode(); // stop the current mode
|
|
790
|
status = stop_current_mode(); // stop the current mode
|
|
789
|
status = restart_science_tasks( LFR_MODE_BURST ); // restart the science tasks
|
|
791
|
status = restart_science_tasks( LFR_MODE_BURST ); // restart the science tasks
|
|
790
|
if (status == RTEMS_SUCCESSFUL) // relaunch spectral_matrix and waveform_picker modules
|
|
792
|
if (status == RTEMS_SUCCESSFUL) // relaunch spectral_matrix and waveform_picker modules
|
|
791
|
{
|
|
793
|
{
|
|
792
|
launch_spectral_matrix( );
|
|
794
|
launch_spectral_matrix( );
|
|
793
|
launch_waveform_picker( LFR_MODE_BURST, transitionCoarseTime );
|
|
795
|
launch_waveform_picker( LFR_MODE_BURST, transitionCoarseTime );
|
|
794
|
}
|
|
796
|
}
|
|
795
|
|
|
797
|
|
|
796
|
if (status != RTEMS_SUCCESSFUL)
|
|
798
|
if (status != RTEMS_SUCCESSFUL)
|
|
797
|
{
|
|
799
|
{
|
|
798
|
PRINTF1("ERR *** in enter_mode_burst *** status = %d\n", status)
|
|
800
|
PRINTF1("ERR *** in enter_mode_burst *** status = %d\n", status)
|
|
799
|
status = RTEMS_UNSATISFIED;
|
|
801
|
status = RTEMS_UNSATISFIED;
|
|
800
|
}
|
|
802
|
}
|
|
801
|
|
|
803
|
|
|
802
|
return status;
|
|
804
|
return status;
|
|
803
|
}
|
|
805
|
}
|
|
804
|
|
|
806
|
|
|
805
|
int enter_mode_sbm1( unsigned int transitionCoarseTime )
|
|
807
|
int enter_mode_sbm1( unsigned int transitionCoarseTime )
|
|
806
|
{
|
|
808
|
{
|
|
807
|
/** This function is used to start the SBM1 mode.
|
|
809
|
/** This function is used to start the SBM1 mode.
|
|
808
|
*
|
|
810
|
*
|
|
809
|
* @param transitionCoarseTime is the requested transition time contained in the TC_LFR_ENTER_MODE
|
|
811
|
* @param transitionCoarseTime is the requested transition time contained in the TC_LFR_ENTER_MODE
|
|
810
|
*
|
|
812
|
*
|
|
811
|
* @return RTEMS directive status codes:
|
|
813
|
* @return RTEMS directive status codes:
|
|
812
|
* - RTEMS_SUCCESSFUL - task restarted successfully
|
|
814
|
* - RTEMS_SUCCESSFUL - task restarted successfully
|
|
813
|
* - RTEMS_INVALID_ID - task id invalid
|
|
815
|
* - RTEMS_INVALID_ID - task id invalid
|
|
814
|
* - RTEMS_INCORRECT_STATE - task never started
|
|
816
|
* - RTEMS_INCORRECT_STATE - task never started
|
|
815
|
* - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task
|
|
817
|
* - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task
|
|
816
|
*
|
|
818
|
*
|
|
817
|
* The way the SBM1 mode is started depends on the LFR current mode. If LFR is in NORMAL or SBM2,
|
|
819
|
* The way the SBM1 mode is started depends on the LFR current mode. If LFR is in NORMAL or SBM2,
|
|
818
|
* the snapshots are not restarted, only ASM, BP and CWF data generation are affected. In other
|
|
820
|
* the snapshots are not restarted, only ASM, BP and CWF data generation are affected. In other
|
|
819
|
* cases, the acquisition is completely restarted.
|
|
821
|
* cases, the acquisition is completely restarted.
|
|
820
|
*
|
|
822
|
*
|
|
821
|
*/
|
|
823
|
*/
|
|
822
|
|
|
824
|
|
|
823
|
int status;
|
|
825
|
int status;
|
|
824
|
|
|
826
|
|
|
825
|
#ifdef PRINT_TASK_STATISTICS
|
|
827
|
#ifdef PRINT_TASK_STATISTICS
|
|
826
|
rtems_cpu_usage_reset();
|
|
828
|
rtems_cpu_usage_reset();
|
|
827
|
#endif
|
|
829
|
#endif
|
|
828
|
|
|
830
|
|
|
829
|
status = RTEMS_UNSATISFIED;
|
|
831
|
status = RTEMS_UNSATISFIED;
|
|
830
|
|
|
832
|
|
|
831
|
switch( lfrCurrentMode )
|
|
833
|
switch( lfrCurrentMode )
|
|
832
|
{
|
|
834
|
{
|
|
833
|
case LFR_MODE_STANDBY:
|
|
835
|
case LFR_MODE_STANDBY:
|
|
834
|
status = restart_science_tasks( LFR_MODE_SBM1 ); // restart science tasks
|
|
836
|
status = restart_science_tasks( LFR_MODE_SBM1 ); // restart science tasks
|
|
835
|
if (status == RTEMS_SUCCESSFUL) // relaunch spectral_matrix and waveform_picker modules
|
|
837
|
if (status == RTEMS_SUCCESSFUL) // relaunch spectral_matrix and waveform_picker modules
|
|
836
|
{
|
|
838
|
{
|
|
837
|
launch_spectral_matrix( );
|
|
839
|
launch_spectral_matrix( );
|
|
838
|
launch_waveform_picker( LFR_MODE_SBM1, transitionCoarseTime );
|
|
840
|
launch_waveform_picker( LFR_MODE_SBM1, transitionCoarseTime );
|
|
839
|
}
|
|
841
|
}
|
|
840
|
break;
|
|
842
|
break;
|
|
841
|
case LFR_MODE_NORMAL: // lfrCurrentMode will be updated after the execution of close_action
|
|
843
|
case LFR_MODE_NORMAL: // lfrCurrentMode will be updated after the execution of close_action
|
|
842
|
status = restart_asm_activities( LFR_MODE_SBM1 );
|
|
844
|
status = restart_asm_activities( LFR_MODE_SBM1 );
|
|
843
|
status = LFR_SUCCESSFUL;
|
|
845
|
status = LFR_SUCCESSFUL;
|
|
844
|
update_last_valid_transition_date( transitionCoarseTime );
|
|
846
|
update_last_valid_transition_date( transitionCoarseTime );
|
|
845
|
break;
|
|
847
|
break;
|
|
846
|
case LFR_MODE_BURST:
|
|
848
|
case LFR_MODE_BURST:
|
|
847
|
status = stop_current_mode(); // stop the current mode
|
|
849
|
status = stop_current_mode(); // stop the current mode
|
|
848
|
status = restart_science_tasks( LFR_MODE_SBM1 ); // restart the science tasks
|
|
850
|
status = restart_science_tasks( LFR_MODE_SBM1 ); // restart the science tasks
|
|
849
|
if (status == RTEMS_SUCCESSFUL) // relaunch spectral_matrix and waveform_picker modules
|
|
851
|
if (status == RTEMS_SUCCESSFUL) // relaunch spectral_matrix and waveform_picker modules
|
|
850
|
{
|
|
852
|
{
|
|
851
|
launch_spectral_matrix( );
|
|
853
|
launch_spectral_matrix( );
|
|
852
|
launch_waveform_picker( LFR_MODE_SBM1, transitionCoarseTime );
|
|
854
|
launch_waveform_picker( LFR_MODE_SBM1, transitionCoarseTime );
|
|
853
|
}
|
|
855
|
}
|
|
854
|
break;
|
|
856
|
break;
|
|
855
|
case LFR_MODE_SBM2:
|
|
857
|
case LFR_MODE_SBM2:
|
|
856
|
status = restart_asm_activities( LFR_MODE_SBM1 );
|
|
858
|
status = restart_asm_activities( LFR_MODE_SBM1 );
|
|
857
|
status = LFR_SUCCESSFUL; // lfrCurrentMode will be updated after the execution of close_action
|
|
859
|
status = LFR_SUCCESSFUL; // lfrCurrentMode will be updated after the execution of close_action
|
|
858
|
update_last_valid_transition_date( transitionCoarseTime );
|
|
860
|
update_last_valid_transition_date( transitionCoarseTime );
|
|
859
|
break;
|
|
861
|
break;
|
|
860
|
default:
|
|
862
|
default:
|
|
861
|
break;
|
|
863
|
break;
|
|
862
|
}
|
|
864
|
}
|
|
863
|
|
|
865
|
|
|
864
|
if (status != RTEMS_SUCCESSFUL)
|
|
866
|
if (status != RTEMS_SUCCESSFUL)
|
|
865
|
{
|
|
867
|
{
|
|
866
|
PRINTF1("ERR *** in enter_mode_sbm1 *** status = %d\n", status);
|
|
868
|
PRINTF1("ERR *** in enter_mode_sbm1 *** status = %d\n", status);
|
|
867
|
status = RTEMS_UNSATISFIED;
|
|
869
|
status = RTEMS_UNSATISFIED;
|
|
868
|
}
|
|
870
|
}
|
|
869
|
|
|
871
|
|
|
870
|
return status;
|
|
872
|
return status;
|
|
871
|
}
|
|
873
|
}
|
|
872
|
|
|
874
|
|
|
873
|
int enter_mode_sbm2( unsigned int transitionCoarseTime )
|
|
875
|
int enter_mode_sbm2( unsigned int transitionCoarseTime )
|
|
874
|
{
|
|
876
|
{
|
|
875
|
/** This function is used to start the SBM2 mode.
|
|
877
|
/** This function is used to start the SBM2 mode.
|
|
876
|
*
|
|
878
|
*
|
|
877
|
* @param transitionCoarseTime is the requested transition time contained in the TC_LFR_ENTER_MODE
|
|
879
|
* @param transitionCoarseTime is the requested transition time contained in the TC_LFR_ENTER_MODE
|
|
878
|
*
|
|
880
|
*
|
|
879
|
* @return RTEMS directive status codes:
|
|
881
|
* @return RTEMS directive status codes:
|
|
880
|
* - RTEMS_SUCCESSFUL - task restarted successfully
|
|
882
|
* - RTEMS_SUCCESSFUL - task restarted successfully
|
|
881
|
* - RTEMS_INVALID_ID - task id invalid
|
|
883
|
* - RTEMS_INVALID_ID - task id invalid
|
|
882
|
* - RTEMS_INCORRECT_STATE - task never started
|
|
884
|
* - RTEMS_INCORRECT_STATE - task never started
|
|
883
|
* - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task
|
|
885
|
* - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task
|
|
884
|
*
|
|
886
|
*
|
|
885
|
* The way the SBM2 mode is started depends on the LFR current mode. If LFR is in NORMAL or SBM1,
|
|
887
|
* The way the SBM2 mode is started depends on the LFR current mode. If LFR is in NORMAL or SBM1,
|
|
886
|
* the snapshots are not restarted, only ASM, BP and CWF data generation are affected. In other
|
|
888
|
* the snapshots are not restarted, only ASM, BP and CWF data generation are affected. In other
|
|
887
|
* cases, the acquisition is completely restarted.
|
|
889
|
* cases, the acquisition is completely restarted.
|
|
888
|
*
|
|
890
|
*
|
|
889
|
*/
|
|
891
|
*/
|
|
890
|
|
|
892
|
|
|
891
|
int status;
|
|
893
|
int status;
|
|
892
|
|
|
894
|
|
|
893
|
#ifdef PRINT_TASK_STATISTICS
|
|
895
|
#ifdef PRINT_TASK_STATISTICS
|
|
894
|
rtems_cpu_usage_reset();
|
|
896
|
rtems_cpu_usage_reset();
|
|
895
|
#endif
|
|
897
|
#endif
|
|
896
|
|
|
898
|
|
|
897
|
status = RTEMS_UNSATISFIED;
|
|
899
|
status = RTEMS_UNSATISFIED;
|
|
898
|
|
|
900
|
|
|
899
|
switch( lfrCurrentMode )
|
|
901
|
switch( lfrCurrentMode )
|
|
900
|
{
|
|
902
|
{
|
|
901
|
case LFR_MODE_STANDBY:
|
|
903
|
case LFR_MODE_STANDBY:
|
|
902
|
status = restart_science_tasks( LFR_MODE_SBM2 ); // restart science tasks
|
|
904
|
status = restart_science_tasks( LFR_MODE_SBM2 ); // restart science tasks
|
|
903
|
if (status == RTEMS_SUCCESSFUL) // relaunch spectral_matrix and waveform_picker modules
|
|
905
|
if (status == RTEMS_SUCCESSFUL) // relaunch spectral_matrix and waveform_picker modules
|
|
904
|
{
|
|
906
|
{
|
|
905
|
launch_spectral_matrix( );
|
|
907
|
launch_spectral_matrix( );
|
|
906
|
launch_waveform_picker( LFR_MODE_SBM2, transitionCoarseTime );
|
|
908
|
launch_waveform_picker( LFR_MODE_SBM2, transitionCoarseTime );
|
|
907
|
}
|
|
909
|
}
|
|
908
|
break;
|
|
910
|
break;
|
|
909
|
case LFR_MODE_NORMAL:
|
|
911
|
case LFR_MODE_NORMAL:
|
|
910
|
status = restart_asm_activities( LFR_MODE_SBM2 );
|
|
912
|
status = restart_asm_activities( LFR_MODE_SBM2 );
|
|
911
|
status = LFR_SUCCESSFUL; // lfrCurrentMode will be updated after the execution of close_action
|
|
913
|
status = LFR_SUCCESSFUL; // lfrCurrentMode will be updated after the execution of close_action
|
|
912
|
update_last_valid_transition_date( transitionCoarseTime );
|
|
914
|
update_last_valid_transition_date( transitionCoarseTime );
|
|
913
|
break;
|
|
915
|
break;
|
|
914
|
case LFR_MODE_BURST:
|
|
916
|
case LFR_MODE_BURST:
|
|
915
|
status = stop_current_mode(); // stop the current mode
|
|
917
|
status = stop_current_mode(); // stop the current mode
|
|
916
|
status = restart_science_tasks( LFR_MODE_SBM2 ); // restart the science tasks
|
|
918
|
status = restart_science_tasks( LFR_MODE_SBM2 ); // restart the science tasks
|
|
917
|
if (status == RTEMS_SUCCESSFUL) // relaunch spectral_matrix and waveform_picker modules
|
|
919
|
if (status == RTEMS_SUCCESSFUL) // relaunch spectral_matrix and waveform_picker modules
|
|
918
|
{
|
|
920
|
{
|
|
919
|
launch_spectral_matrix( );
|
|
921
|
launch_spectral_matrix( );
|
|
920
|
launch_waveform_picker( LFR_MODE_SBM2, transitionCoarseTime );
|
|
922
|
launch_waveform_picker( LFR_MODE_SBM2, transitionCoarseTime );
|
|
921
|
}
|
|
923
|
}
|
|
922
|
break;
|
|
924
|
break;
|
|
923
|
case LFR_MODE_SBM1:
|
|
925
|
case LFR_MODE_SBM1:
|
|
924
|
status = restart_asm_activities( LFR_MODE_SBM2 );
|
|
926
|
status = restart_asm_activities( LFR_MODE_SBM2 );
|
|
925
|
status = LFR_SUCCESSFUL; // lfrCurrentMode will be updated after the execution of close_action
|
|
927
|
status = LFR_SUCCESSFUL; // lfrCurrentMode will be updated after the execution of close_action
|
|
926
|
update_last_valid_transition_date( transitionCoarseTime );
|
|
928
|
update_last_valid_transition_date( transitionCoarseTime );
|
|
927
|
break;
|
|
929
|
break;
|
|
928
|
default:
|
|
930
|
default:
|
|
929
|
break;
|
|
931
|
break;
|
|
930
|
}
|
|
932
|
}
|
|
931
|
|
|
933
|
|
|
932
|
if (status != RTEMS_SUCCESSFUL)
|
|
934
|
if (status != RTEMS_SUCCESSFUL)
|
|
933
|
{
|
|
935
|
{
|
|
934
|
PRINTF1("ERR *** in enter_mode_sbm2 *** status = %d\n", status)
|
|
936
|
PRINTF1("ERR *** in enter_mode_sbm2 *** status = %d\n", status)
|
|
935
|
status = RTEMS_UNSATISFIED;
|
|
937
|
status = RTEMS_UNSATISFIED;
|
|
936
|
}
|
|
938
|
}
|
|
937
|
|
|
939
|
|
|
938
|
return status;
|
|
940
|
return status;
|
|
939
|
}
|
|
941
|
}
|
|
940
|
|
|
942
|
|
|
941
|
int restart_science_tasks( unsigned char lfrRequestedMode )
|
|
943
|
int restart_science_tasks( unsigned char lfrRequestedMode )
|
|
942
|
{
|
|
944
|
{
|
|
943
|
/** This function is used to restart all science tasks.
|
|
945
|
/** This function is used to restart all science tasks.
|
|
944
|
*
|
|
946
|
*
|
|
945
|
* @return RTEMS directive status codes:
|
|
947
|
* @return RTEMS directive status codes:
|
|
946
|
* - RTEMS_SUCCESSFUL - task restarted successfully
|
|
948
|
* - RTEMS_SUCCESSFUL - task restarted successfully
|
|
947
|
* - RTEMS_INVALID_ID - task id invalid
|
|
949
|
* - RTEMS_INVALID_ID - task id invalid
|
|
948
|
* - RTEMS_INCORRECT_STATE - task never started
|
|
950
|
* - RTEMS_INCORRECT_STATE - task never started
|
|
949
|
* - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task
|
|
951
|
* - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task
|
|
950
|
*
|
|
952
|
*
|
|
951
|
* Science tasks are AVF0, PRC0, WFRM, CWF3, CW2, CWF1
|
|
953
|
* Science tasks are AVF0, PRC0, WFRM, CWF3, CW2, CWF1
|
|
952
|
*
|
|
954
|
*
|
|
953
|
*/
|
|
955
|
*/
|
|
954
|
|
|
956
|
|
|
955
|
rtems_status_code status[NB_SCIENCE_TASKS];
|
|
957
|
rtems_status_code status[NB_SCIENCE_TASKS];
|
|
956
|
rtems_status_code ret;
|
|
958
|
rtems_status_code ret;
|
|
957
|
|
|
959
|
|
|
958
|
ret = RTEMS_SUCCESSFUL;
|
|
960
|
ret = RTEMS_SUCCESSFUL;
|
|
959
|
|
|
961
|
|
|
960
|
status[STATUS_0] = rtems_task_restart( Task_id[TASKID_AVF0], lfrRequestedMode );
|
|
962
|
status[STATUS_0] = rtems_task_restart( Task_id[TASKID_AVF0], lfrRequestedMode );
|
|
961
|
if (status[STATUS_0] != RTEMS_SUCCESSFUL)
|
|
963
|
if (status[STATUS_0] != RTEMS_SUCCESSFUL)
|
|
962
|
{
|
|
964
|
{
|
|
963
|
PRINTF1("in restart_science_task *** AVF0 ERR %d\n", status[STATUS_0])
|
|
965
|
PRINTF1("in restart_science_task *** AVF0 ERR %d\n", status[STATUS_0])
|
|
964
|
}
|
|
966
|
}
|
|
965
|
|
|
967
|
|
|
966
|
status[STATUS_1] = rtems_task_restart( Task_id[TASKID_PRC0], lfrRequestedMode );
|
|
968
|
status[STATUS_1] = rtems_task_restart( Task_id[TASKID_PRC0], lfrRequestedMode );
|
|
967
|
if (status[STATUS_1] != RTEMS_SUCCESSFUL)
|
|
969
|
if (status[STATUS_1] != RTEMS_SUCCESSFUL)
|
|
968
|
{
|
|
970
|
{
|
|
969
|
PRINTF1("in restart_science_task *** PRC0 ERR %d\n", status[STATUS_1])
|
|
971
|
PRINTF1("in restart_science_task *** PRC0 ERR %d\n", status[STATUS_1])
|
|
970
|
}
|
|
972
|
}
|
|
971
|
|
|
973
|
|
|
972
|
status[STATUS_2] = rtems_task_restart( Task_id[TASKID_WFRM],1 );
|
|
974
|
status[STATUS_2] = rtems_task_restart( Task_id[TASKID_WFRM],1 );
|
|
973
|
if (status[STATUS_2] != RTEMS_SUCCESSFUL)
|
|
975
|
if (status[STATUS_2] != RTEMS_SUCCESSFUL)
|
|
974
|
{
|
|
976
|
{
|
|
975
|
PRINTF1("in restart_science_task *** WFRM ERR %d\n", status[STATUS_2])
|
|
977
|
PRINTF1("in restart_science_task *** WFRM ERR %d\n", status[STATUS_2])
|
|
976
|
}
|
|
978
|
}
|
|
977
|
|
|
979
|
|
|
978
|
status[STATUS_3] = rtems_task_restart( Task_id[TASKID_CWF3],1 );
|
|
980
|
status[STATUS_3] = rtems_task_restart( Task_id[TASKID_CWF3],1 );
|
|
979
|
if (status[STATUS_3] != RTEMS_SUCCESSFUL)
|
|
981
|
if (status[STATUS_3] != RTEMS_SUCCESSFUL)
|
|
980
|
{
|
|
982
|
{
|
|
981
|
PRINTF1("in restart_science_task *** CWF3 ERR %d\n", status[STATUS_3])
|
|
983
|
PRINTF1("in restart_science_task *** CWF3 ERR %d\n", status[STATUS_3])
|
|
982
|
}
|
|
984
|
}
|
|
983
|
|
|
985
|
|
|
984
|
status[STATUS_4] = rtems_task_restart( Task_id[TASKID_CWF2],1 );
|
|
986
|
status[STATUS_4] = rtems_task_restart( Task_id[TASKID_CWF2],1 );
|
|
985
|
if (status[STATUS_4] != RTEMS_SUCCESSFUL)
|
|
987
|
if (status[STATUS_4] != RTEMS_SUCCESSFUL)
|
|
986
|
{
|
|
988
|
{
|
|
987
|
PRINTF1("in restart_science_task *** CWF2 ERR %d\n", status[STATUS_4])
|
|
989
|
PRINTF1("in restart_science_task *** CWF2 ERR %d\n", status[STATUS_4])
|
|
988
|
}
|
|
990
|
}
|
|
989
|
|
|
991
|
|
|
990
|
status[STATUS_5] = rtems_task_restart( Task_id[TASKID_CWF1],1 );
|
|
992
|
status[STATUS_5] = rtems_task_restart( Task_id[TASKID_CWF1],1 );
|
|
991
|
if (status[STATUS_5] != RTEMS_SUCCESSFUL)
|
|
993
|
if (status[STATUS_5] != RTEMS_SUCCESSFUL)
|
|
992
|
{
|
|
994
|
{
|
|
993
|
PRINTF1("in restart_science_task *** CWF1 ERR %d\n", status[STATUS_5])
|
|
995
|
PRINTF1("in restart_science_task *** CWF1 ERR %d\n", status[STATUS_5])
|
|
994
|
}
|
|
996
|
}
|
|
995
|
|
|
997
|
|
|
996
|
status[STATUS_6] = rtems_task_restart( Task_id[TASKID_AVF1], lfrRequestedMode );
|
|
998
|
status[STATUS_6] = rtems_task_restart( Task_id[TASKID_AVF1], lfrRequestedMode );
|
|
997
|
if (status[STATUS_6] != RTEMS_SUCCESSFUL)
|
|
999
|
if (status[STATUS_6] != RTEMS_SUCCESSFUL)
|
|
998
|
{
|
|
1000
|
{
|
|
999
|
PRINTF1("in restart_science_task *** AVF1 ERR %d\n", status[STATUS_6])
|
|
1001
|
PRINTF1("in restart_science_task *** AVF1 ERR %d\n", status[STATUS_6])
|
|
1000
|
}
|
|
1002
|
}
|
|
1001
|
|
|
1003
|
|
|
1002
|
status[STATUS_7] = rtems_task_restart( Task_id[TASKID_PRC1],lfrRequestedMode );
|
|
1004
|
status[STATUS_7] = rtems_task_restart( Task_id[TASKID_PRC1],lfrRequestedMode );
|
|
1003
|
if (status[STATUS_7] != RTEMS_SUCCESSFUL)
|
|
1005
|
if (status[STATUS_7] != RTEMS_SUCCESSFUL)
|
|
1004
|
{
|
|
1006
|
{
|
|
1005
|
PRINTF1("in restart_science_task *** PRC1 ERR %d\n", status[STATUS_7])
|
|
1007
|
PRINTF1("in restart_science_task *** PRC1 ERR %d\n", status[STATUS_7])
|
|
1006
|
}
|
|
1008
|
}
|
|
1007
|
|
|
1009
|
|
|
1008
|
status[STATUS_8] = rtems_task_restart( Task_id[TASKID_AVF2], 1 );
|
|
1010
|
status[STATUS_8] = rtems_task_restart( Task_id[TASKID_AVF2], 1 );
|
|
1009
|
if (status[STATUS_8] != RTEMS_SUCCESSFUL)
|
|
1011
|
if (status[STATUS_8] != RTEMS_SUCCESSFUL)
|
|
1010
|
{
|
|
1012
|
{
|
|
1011
|
PRINTF1("in restart_science_task *** AVF2 ERR %d\n", status[STATUS_8])
|
|
1013
|
PRINTF1("in restart_science_task *** AVF2 ERR %d\n", status[STATUS_8])
|
|
1012
|
}
|
|
1014
|
}
|
|
1013
|
|
|
1015
|
|
|
1014
|
status[STATUS_9] = rtems_task_restart( Task_id[TASKID_PRC2], 1 );
|
|
1016
|
status[STATUS_9] = rtems_task_restart( Task_id[TASKID_PRC2], 1 );
|
|
1015
|
if (status[STATUS_9] != RTEMS_SUCCESSFUL)
|
|
1017
|
if (status[STATUS_9] != RTEMS_SUCCESSFUL)
|
|
1016
|
{
|
|
1018
|
{
|
|
1017
|
PRINTF1("in restart_science_task *** PRC2 ERR %d\n", status[STATUS_9])
|
|
1019
|
PRINTF1("in restart_science_task *** PRC2 ERR %d\n", status[STATUS_9])
|
|
1018
|
}
|
|
1020
|
}
|
|
1019
|
|
|
1021
|
|
|
1020
|
if ( (status[STATUS_0] != RTEMS_SUCCESSFUL) || (status[STATUS_1] != RTEMS_SUCCESSFUL) ||
|
|
1022
|
if ( (status[STATUS_0] != RTEMS_SUCCESSFUL) || (status[STATUS_1] != RTEMS_SUCCESSFUL) ||
|
|
1021
|
(status[STATUS_2] != RTEMS_SUCCESSFUL) || (status[STATUS_3] != RTEMS_SUCCESSFUL) ||
|
|
1023
|
(status[STATUS_2] != RTEMS_SUCCESSFUL) || (status[STATUS_3] != RTEMS_SUCCESSFUL) ||
|
|
1022
|
(status[STATUS_4] != RTEMS_SUCCESSFUL) || (status[STATUS_5] != RTEMS_SUCCESSFUL) ||
|
|
1024
|
(status[STATUS_4] != RTEMS_SUCCESSFUL) || (status[STATUS_5] != RTEMS_SUCCESSFUL) ||
|
|
1023
|
(status[STATUS_6] != RTEMS_SUCCESSFUL) || (status[STATUS_7] != RTEMS_SUCCESSFUL) ||
|
|
1025
|
(status[STATUS_6] != RTEMS_SUCCESSFUL) || (status[STATUS_7] != RTEMS_SUCCESSFUL) ||
|
|
1024
|
(status[STATUS_8] != RTEMS_SUCCESSFUL) || (status[STATUS_9] != RTEMS_SUCCESSFUL) )
|
|
1026
|
(status[STATUS_8] != RTEMS_SUCCESSFUL) || (status[STATUS_9] != RTEMS_SUCCESSFUL) )
|
|
1025
|
{
|
|
1027
|
{
|
|
1026
|
ret = RTEMS_UNSATISFIED;
|
|
1028
|
ret = RTEMS_UNSATISFIED;
|
|
1027
|
}
|
|
1029
|
}
|
|
1028
|
|
|
1030
|
|
|
1029
|
return ret;
|
|
1031
|
return ret;
|
|
1030
|
}
|
|
1032
|
}
|
|
1031
|
|
|
1033
|
|
|
1032
|
int restart_asm_tasks( unsigned char lfrRequestedMode )
|
|
1034
|
int restart_asm_tasks( unsigned char lfrRequestedMode )
|
|
1033
|
{
|
|
1035
|
{
|
|
1034
|
/** This function is used to restart average spectral matrices tasks.
|
|
1036
|
/** This function is used to restart average spectral matrices tasks.
|
|
1035
|
*
|
|
1037
|
*
|
|
1036
|
* @return RTEMS directive status codes:
|
|
1038
|
* @return RTEMS directive status codes:
|
|
1037
|
* - RTEMS_SUCCESSFUL - task restarted successfully
|
|
1039
|
* - RTEMS_SUCCESSFUL - task restarted successfully
|
|
1038
|
* - RTEMS_INVALID_ID - task id invalid
|
|
1040
|
* - RTEMS_INVALID_ID - task id invalid
|
|
1039
|
* - RTEMS_INCORRECT_STATE - task never started
|
|
1041
|
* - RTEMS_INCORRECT_STATE - task never started
|
|
1040
|
* - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task
|
|
1042
|
* - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task
|
|
1041
|
*
|
|
1043
|
*
|
|
1042
|
* ASM tasks are AVF0, PRC0, AVF1, PRC1, AVF2 and PRC2
|
|
1044
|
* ASM tasks are AVF0, PRC0, AVF1, PRC1, AVF2 and PRC2
|
|
1043
|
*
|
|
1045
|
*
|
|
1044
|
*/
|
|
1046
|
*/
|
|
1045
|
|
|
1047
|
|
|
1046
|
rtems_status_code status[NB_ASM_TASKS];
|
|
1048
|
rtems_status_code status[NB_ASM_TASKS];
|
|
1047
|
rtems_status_code ret;
|
|
1049
|
rtems_status_code ret;
|
|
1048
|
|
|
1050
|
|
|
1049
|
ret = RTEMS_SUCCESSFUL;
|
|
1051
|
ret = RTEMS_SUCCESSFUL;
|
|
1050
|
|
|
1052
|
|
|
1051
|
status[STATUS_0] = rtems_task_restart( Task_id[TASKID_AVF0], lfrRequestedMode );
|
|
1053
|
status[STATUS_0] = rtems_task_restart( Task_id[TASKID_AVF0], lfrRequestedMode );
|
|
1052
|
if (status[STATUS_0] != RTEMS_SUCCESSFUL)
|
|
1054
|
if (status[STATUS_0] != RTEMS_SUCCESSFUL)
|
|
1053
|
{
|
|
1055
|
{
|
|
1054
|
PRINTF1("in restart_science_task *** AVF0 ERR %d\n", status[STATUS_0])
|
|
1056
|
PRINTF1("in restart_science_task *** AVF0 ERR %d\n", status[STATUS_0])
|
|
1055
|
}
|
|
1057
|
}
|
|
1056
|
|
|
1058
|
|
|
1057
|
status[STATUS_1] = rtems_task_restart( Task_id[TASKID_PRC0], lfrRequestedMode );
|
|
1059
|
status[STATUS_1] = rtems_task_restart( Task_id[TASKID_PRC0], lfrRequestedMode );
|
|
1058
|
if (status[STATUS_1] != RTEMS_SUCCESSFUL)
|
|
1060
|
if (status[STATUS_1] != RTEMS_SUCCESSFUL)
|
|
1059
|
{
|
|
1061
|
{
|
|
1060
|
PRINTF1("in restart_science_task *** PRC0 ERR %d\n", status[STATUS_1])
|
|
1062
|
PRINTF1("in restart_science_task *** PRC0 ERR %d\n", status[STATUS_1])
|
|
1061
|
}
|
|
1063
|
}
|
|
1062
|
|
|
1064
|
|
|
1063
|
status[STATUS_2] = rtems_task_restart( Task_id[TASKID_AVF1], lfrRequestedMode );
|
|
1065
|
status[STATUS_2] = rtems_task_restart( Task_id[TASKID_AVF1], lfrRequestedMode );
|
|
1064
|
if (status[STATUS_2] != RTEMS_SUCCESSFUL)
|
|
1066
|
if (status[STATUS_2] != RTEMS_SUCCESSFUL)
|
|
1065
|
{
|
|
1067
|
{
|
|
1066
|
PRINTF1("in restart_science_task *** AVF1 ERR %d\n", status[STATUS_2])
|
|
1068
|
PRINTF1("in restart_science_task *** AVF1 ERR %d\n", status[STATUS_2])
|
|
1067
|
}
|
|
1069
|
}
|
|
1068
|
|
|
1070
|
|
|
1069
|
status[STATUS_3] = rtems_task_restart( Task_id[TASKID_PRC1],lfrRequestedMode );
|
|
1071
|
status[STATUS_3] = rtems_task_restart( Task_id[TASKID_PRC1],lfrRequestedMode );
|
|
1070
|
if (status[STATUS_3] != RTEMS_SUCCESSFUL)
|
|
1072
|
if (status[STATUS_3] != RTEMS_SUCCESSFUL)
|
|
1071
|
{
|
|
1073
|
{
|
|
1072
|
PRINTF1("in restart_science_task *** PRC1 ERR %d\n", status[STATUS_3])
|
|
1074
|
PRINTF1("in restart_science_task *** PRC1 ERR %d\n", status[STATUS_3])
|
|
1073
|
}
|
|
1075
|
}
|
|
1074
|
|
|
1076
|
|
|
1075
|
status[STATUS_4] = rtems_task_restart( Task_id[TASKID_AVF2], 1 );
|
|
1077
|
status[STATUS_4] = rtems_task_restart( Task_id[TASKID_AVF2], 1 );
|
|
1076
|
if (status[STATUS_4] != RTEMS_SUCCESSFUL)
|
|
1078
|
if (status[STATUS_4] != RTEMS_SUCCESSFUL)
|
|
1077
|
{
|
|
1079
|
{
|
|
1078
|
PRINTF1("in restart_science_task *** AVF2 ERR %d\n", status[STATUS_4])
|
|
1080
|
PRINTF1("in restart_science_task *** AVF2 ERR %d\n", status[STATUS_4])
|
|
1079
|
}
|
|
1081
|
}
|
|
1080
|
|
|
1082
|
|
|
1081
|
status[STATUS_5] = rtems_task_restart( Task_id[TASKID_PRC2], 1 );
|
|
1083
|
status[STATUS_5] = rtems_task_restart( Task_id[TASKID_PRC2], 1 );
|
|
1082
|
if (status[STATUS_5] != RTEMS_SUCCESSFUL)
|
|
1084
|
if (status[STATUS_5] != RTEMS_SUCCESSFUL)
|
|
1083
|
{
|
|
1085
|
{
|
|
1084
|
PRINTF1("in restart_science_task *** PRC2 ERR %d\n", status[STATUS_5])
|
|
1086
|
PRINTF1("in restart_science_task *** PRC2 ERR %d\n", status[STATUS_5])
|
|
1085
|
}
|
|
1087
|
}
|
|
1086
|
|
|
1088
|
|
|
1087
|
if ( (status[STATUS_0] != RTEMS_SUCCESSFUL) || (status[STATUS_1] != RTEMS_SUCCESSFUL) ||
|
|
1089
|
if ( (status[STATUS_0] != RTEMS_SUCCESSFUL) || (status[STATUS_1] != RTEMS_SUCCESSFUL) ||
|
|
1088
|
(status[STATUS_2] != RTEMS_SUCCESSFUL) || (status[STATUS_3] != RTEMS_SUCCESSFUL) ||
|
|
1090
|
(status[STATUS_2] != RTEMS_SUCCESSFUL) || (status[STATUS_3] != RTEMS_SUCCESSFUL) ||
|
|
1089
|
(status[STATUS_4] != RTEMS_SUCCESSFUL) || (status[STATUS_5] != RTEMS_SUCCESSFUL) )
|
|
1091
|
(status[STATUS_4] != RTEMS_SUCCESSFUL) || (status[STATUS_5] != RTEMS_SUCCESSFUL) )
|
|
1090
|
{
|
|
1092
|
{
|
|
1091
|
ret = RTEMS_UNSATISFIED;
|
|
1093
|
ret = RTEMS_UNSATISFIED;
|
|
1092
|
}
|
|
1094
|
}
|
|
1093
|
|
|
1095
|
|
|
1094
|
return ret;
|
|
1096
|
return ret;
|
|
1095
|
}
|
|
1097
|
}
|
|
1096
|
|
|
1098
|
|
|
1097
|
int suspend_science_tasks( void )
|
|
1099
|
int suspend_science_tasks( void )
|
|
1098
|
{
|
|
1100
|
{
|
|
1099
|
/** This function suspends the science tasks.
|
|
1101
|
/** This function suspends the science tasks.
|
|
1100
|
*
|
|
1102
|
*
|
|
1101
|
* @return RTEMS directive status codes:
|
|
1103
|
* @return RTEMS directive status codes:
|
|
1102
|
* - RTEMS_SUCCESSFUL - task restarted successfully
|
|
1104
|
* - RTEMS_SUCCESSFUL - task restarted successfully
|
|
1103
|
* - RTEMS_INVALID_ID - task id invalid
|
|
1105
|
* - RTEMS_INVALID_ID - task id invalid
|
|
1104
|
* - RTEMS_ALREADY_SUSPENDED - task already suspended
|
|
1106
|
* - RTEMS_ALREADY_SUSPENDED - task already suspended
|
|
1105
|
*
|
|
1107
|
*
|
|
1106
|
*/
|
|
1108
|
*/
|
|
1107
|
|
|
1109
|
|
|
1108
|
rtems_status_code status;
|
|
1110
|
rtems_status_code status;
|
|
1109
|
|
|
1111
|
|
|
1110
|
PRINTF("in suspend_science_tasks\n")
|
|
1112
|
PRINTF("in suspend_science_tasks\n")
|
|
1111
|
|
|
1113
|
|
|
1112
|
status = rtems_task_suspend( Task_id[TASKID_AVF0] ); // suspend AVF0
|
|
1114
|
status = rtems_task_suspend( Task_id[TASKID_AVF0] ); // suspend AVF0
|
|
1113
|
if ((status != RTEMS_SUCCESSFUL) && (status != RTEMS_ALREADY_SUSPENDED))
|
|
1115
|
if ((status != RTEMS_SUCCESSFUL) && (status != RTEMS_ALREADY_SUSPENDED))
|
|
1114
|
{
|
|
1116
|
{
|
|
1115
|
PRINTF1("in suspend_science_task *** AVF0 ERR %d\n", status)
|
|
1117
|
PRINTF1("in suspend_science_task *** AVF0 ERR %d\n", status)
|
|
1116
|
}
|
|
1118
|
}
|
|
1117
|
else
|
|
1119
|
else
|
|
1118
|
{
|
|
1120
|
{
|
|
1119
|
status = RTEMS_SUCCESSFUL;
|
|
1121
|
status = RTEMS_SUCCESSFUL;
|
|
1120
|
}
|
|
1122
|
}
|
|
1121
|
if (status == RTEMS_SUCCESSFUL) // suspend PRC0
|
|
1123
|
if (status == RTEMS_SUCCESSFUL) // suspend PRC0
|
|
1122
|
{
|
|
1124
|
{
|
|
1123
|
status = rtems_task_suspend( Task_id[TASKID_PRC0] );
|
|
1125
|
status = rtems_task_suspend( Task_id[TASKID_PRC0] );
|
|
1124
|
if ((status != RTEMS_SUCCESSFUL) && (status != RTEMS_ALREADY_SUSPENDED))
|
|
1126
|
if ((status != RTEMS_SUCCESSFUL) && (status != RTEMS_ALREADY_SUSPENDED))
|
|
1125
|
{
|
|
1127
|
{
|
|
1126
|
PRINTF1("in suspend_science_task *** PRC0 ERR %d\n", status)
|
|
1128
|
PRINTF1("in suspend_science_task *** PRC0 ERR %d\n", status)
|
|
1127
|
}
|
|
1129
|
}
|
|
1128
|
else
|
|
1130
|
else
|
|
1129
|
{
|
|
1131
|
{
|
|
1130
|
status = RTEMS_SUCCESSFUL;
|
|
1132
|
status = RTEMS_SUCCESSFUL;
|
|
1131
|
}
|
|
1133
|
}
|
|
1132
|
}
|
|
1134
|
}
|
|
1133
|
if (status == RTEMS_SUCCESSFUL) // suspend AVF1
|
|
1135
|
if (status == RTEMS_SUCCESSFUL) // suspend AVF1
|
|
1134
|
{
|
|
1136
|
{
|
|
1135
|
status = rtems_task_suspend( Task_id[TASKID_AVF1] );
|
|
1137
|
status = rtems_task_suspend( Task_id[TASKID_AVF1] );
|
|
1136
|
if ((status != RTEMS_SUCCESSFUL) && (status != RTEMS_ALREADY_SUSPENDED))
|
|
1138
|
if ((status != RTEMS_SUCCESSFUL) && (status != RTEMS_ALREADY_SUSPENDED))
|
|
1137
|
{
|
|
1139
|
{
|
|
1138
|
PRINTF1("in suspend_science_task *** AVF1 ERR %d\n", status)
|
|
1140
|
PRINTF1("in suspend_science_task *** AVF1 ERR %d\n", status)
|
|
1139
|
}
|
|
1141
|
}
|
|
1140
|
else
|
|
1142
|
else
|
|
1141
|
{
|
|
1143
|
{
|
|
1142
|
status = RTEMS_SUCCESSFUL;
|
|
1144
|
status = RTEMS_SUCCESSFUL;
|
|
1143
|
}
|
|
1145
|
}
|
|
1144
|
}
|
|
1146
|
}
|
|
1145
|
if (status == RTEMS_SUCCESSFUL) // suspend PRC1
|
|
1147
|
if (status == RTEMS_SUCCESSFUL) // suspend PRC1
|
|
1146
|
{
|
|
1148
|
{
|
|
1147
|
status = rtems_task_suspend( Task_id[TASKID_PRC1] );
|
|
1149
|
status = rtems_task_suspend( Task_id[TASKID_PRC1] );
|
|
1148
|
if ((status != RTEMS_SUCCESSFUL) && (status != RTEMS_ALREADY_SUSPENDED))
|
|
1150
|
if ((status != RTEMS_SUCCESSFUL) && (status != RTEMS_ALREADY_SUSPENDED))
|
|
1149
|
{
|
|
1151
|
{
|
|
1150
|
PRINTF1("in suspend_science_task *** PRC1 ERR %d\n", status)
|
|
1152
|
PRINTF1("in suspend_science_task *** PRC1 ERR %d\n", status)
|
|
1151
|
}
|
|
1153
|
}
|
|
1152
|
else
|
|
1154
|
else
|
|
1153
|
{
|
|
1155
|
{
|
|
1154
|
status = RTEMS_SUCCESSFUL;
|
|
1156
|
status = RTEMS_SUCCESSFUL;
|
|
1155
|
}
|
|
1157
|
}
|
|
1156
|
}
|
|
1158
|
}
|
|
1157
|
if (status == RTEMS_SUCCESSFUL) // suspend AVF2
|
|
1159
|
if (status == RTEMS_SUCCESSFUL) // suspend AVF2
|
|
1158
|
{
|
|
1160
|
{
|
|
1159
|
status = rtems_task_suspend( Task_id[TASKID_AVF2] );
|
|
1161
|
status = rtems_task_suspend( Task_id[TASKID_AVF2] );
|
|
1160
|
if ((status != RTEMS_SUCCESSFUL) && (status != RTEMS_ALREADY_SUSPENDED))
|
|
1162
|
if ((status != RTEMS_SUCCESSFUL) && (status != RTEMS_ALREADY_SUSPENDED))
|
|
1161
|
{
|
|
1163
|
{
|
|
1162
|
PRINTF1("in suspend_science_task *** AVF2 ERR %d\n", status)
|
|
1164
|
PRINTF1("in suspend_science_task *** AVF2 ERR %d\n", status)
|
|
1163
|
}
|
|
1165
|
}
|
|
1164
|
else
|
|
1166
|
else
|
|
1165
|
{
|
|
1167
|
{
|
|
1166
|
status = RTEMS_SUCCESSFUL;
|
|
1168
|
status = RTEMS_SUCCESSFUL;
|
|
1167
|
}
|
|
1169
|
}
|
|
1168
|
}
|
|
1170
|
}
|
|
1169
|
if (status == RTEMS_SUCCESSFUL) // suspend PRC2
|
|
1171
|
if (status == RTEMS_SUCCESSFUL) // suspend PRC2
|
|
1170
|
{
|
|
1172
|
{
|
|
1171
|
status = rtems_task_suspend( Task_id[TASKID_PRC2] );
|
|
1173
|
status = rtems_task_suspend( Task_id[TASKID_PRC2] );
|
|
1172
|
if ((status != RTEMS_SUCCESSFUL) && (status != RTEMS_ALREADY_SUSPENDED))
|
|
1174
|
if ((status != RTEMS_SUCCESSFUL) && (status != RTEMS_ALREADY_SUSPENDED))
|
|
1173
|
{
|
|
1175
|
{
|
|
1174
|
PRINTF1("in suspend_science_task *** PRC2 ERR %d\n", status)
|
|
1176
|
PRINTF1("in suspend_science_task *** PRC2 ERR %d\n", status)
|
|
1175
|
}
|
|
1177
|
}
|
|
1176
|
else
|
|
1178
|
else
|
|
1177
|
{
|
|
1179
|
{
|
|
1178
|
status = RTEMS_SUCCESSFUL;
|
|
1180
|
status = RTEMS_SUCCESSFUL;
|
|
1179
|
}
|
|
1181
|
}
|
|
1180
|
}
|
|
1182
|
}
|
|
1181
|
if (status == RTEMS_SUCCESSFUL) // suspend WFRM
|
|
1183
|
if (status == RTEMS_SUCCESSFUL) // suspend WFRM
|
|
1182
|
{
|
|
1184
|
{
|
|
1183
|
status = rtems_task_suspend( Task_id[TASKID_WFRM] );
|
|
1185
|
status = rtems_task_suspend( Task_id[TASKID_WFRM] );
|
|
1184
|
if ((status != RTEMS_SUCCESSFUL) && (status != RTEMS_ALREADY_SUSPENDED))
|
|
1186
|
if ((status != RTEMS_SUCCESSFUL) && (status != RTEMS_ALREADY_SUSPENDED))
|
|
1185
|
{
|
|
1187
|
{
|
|
1186
|
PRINTF1("in suspend_science_task *** WFRM ERR %d\n", status)
|
|
1188
|
PRINTF1("in suspend_science_task *** WFRM ERR %d\n", status)
|
|
1187
|
}
|
|
1189
|
}
|
|
1188
|
else
|
|
1190
|
else
|
|
1189
|
{
|
|
1191
|
{
|
|
1190
|
status = RTEMS_SUCCESSFUL;
|
|
1192
|
status = RTEMS_SUCCESSFUL;
|
|
1191
|
}
|
|
1193
|
}
|
|
1192
|
}
|
|
1194
|
}
|
|
1193
|
if (status == RTEMS_SUCCESSFUL) // suspend CWF3
|
|
1195
|
if (status == RTEMS_SUCCESSFUL) // suspend CWF3
|
|
1194
|
{
|
|
1196
|
{
|
|
1195
|
status = rtems_task_suspend( Task_id[TASKID_CWF3] );
|
|
1197
|
status = rtems_task_suspend( Task_id[TASKID_CWF3] );
|
|
1196
|
if ((status != RTEMS_SUCCESSFUL) && (status != RTEMS_ALREADY_SUSPENDED))
|
|
1198
|
if ((status != RTEMS_SUCCESSFUL) && (status != RTEMS_ALREADY_SUSPENDED))
|
|
1197
|
{
|
|
1199
|
{
|
|
1198
|
PRINTF1("in suspend_science_task *** CWF3 ERR %d\n", status)
|
|
1200
|
PRINTF1("in suspend_science_task *** CWF3 ERR %d\n", status)
|
|
1199
|
}
|
|
1201
|
}
|
|
1200
|
else
|
|
1202
|
else
|
|
1201
|
{
|
|
1203
|
{
|
|
1202
|
status = RTEMS_SUCCESSFUL;
|
|
1204
|
status = RTEMS_SUCCESSFUL;
|
|
1203
|
}
|
|
1205
|
}
|
|
1204
|
}
|
|
1206
|
}
|
|
1205
|
if (status == RTEMS_SUCCESSFUL) // suspend CWF2
|
|
1207
|
if (status == RTEMS_SUCCESSFUL) // suspend CWF2
|
|
1206
|
{
|
|
1208
|
{
|
|
1207
|
status = rtems_task_suspend( Task_id[TASKID_CWF2] );
|
|
1209
|
status = rtems_task_suspend( Task_id[TASKID_CWF2] );
|
|
1208
|
if ((status != RTEMS_SUCCESSFUL) && (status != RTEMS_ALREADY_SUSPENDED))
|
|
1210
|
if ((status != RTEMS_SUCCESSFUL) && (status != RTEMS_ALREADY_SUSPENDED))
|
|
1209
|
{
|
|
1211
|
{
|
|
1210
|
PRINTF1("in suspend_science_task *** CWF2 ERR %d\n", status)
|
|
1212
|
PRINTF1("in suspend_science_task *** CWF2 ERR %d\n", status)
|
|
1211
|
}
|
|
1213
|
}
|
|
1212
|
else
|
|
1214
|
else
|
|
1213
|
{
|
|
1215
|
{
|
|
1214
|
status = RTEMS_SUCCESSFUL;
|
|
1216
|
status = RTEMS_SUCCESSFUL;
|
|
1215
|
}
|
|
1217
|
}
|
|
1216
|
}
|
|
1218
|
}
|
|
1217
|
if (status == RTEMS_SUCCESSFUL) // suspend CWF1
|
|
1219
|
if (status == RTEMS_SUCCESSFUL) // suspend CWF1
|
|
1218
|
{
|
|
1220
|
{
|
|
1219
|
status = rtems_task_suspend( Task_id[TASKID_CWF1] );
|
|
1221
|
status = rtems_task_suspend( Task_id[TASKID_CWF1] );
|
|
1220
|
if ((status != RTEMS_SUCCESSFUL) && (status != RTEMS_ALREADY_SUSPENDED))
|
|
1222
|
if ((status != RTEMS_SUCCESSFUL) && (status != RTEMS_ALREADY_SUSPENDED))
|
|
1221
|
{
|
|
1223
|
{
|
|
1222
|
PRINTF1("in suspend_science_task *** CWF1 ERR %d\n", status)
|
|
1224
|
PRINTF1("in suspend_science_task *** CWF1 ERR %d\n", status)
|
|
1223
|
}
|
|
1225
|
}
|
|
1224
|
else
|
|
1226
|
else
|
|
1225
|
{
|
|
1227
|
{
|
|
1226
|
status = RTEMS_SUCCESSFUL;
|
|
1228
|
status = RTEMS_SUCCESSFUL;
|
|
1227
|
}
|
|
1229
|
}
|
|
1228
|
}
|
|
1230
|
}
|
|
1229
|
|
|
1231
|
|
|
1230
|
return status;
|
|
1232
|
return status;
|
|
1231
|
}
|
|
1233
|
}
|
|
1232
|
|
|
1234
|
|
|
1233
|
int suspend_asm_tasks( void )
|
|
1235
|
int suspend_asm_tasks( void )
|
|
1234
|
{
|
|
1236
|
{
|
|
1235
|
/** This function suspends the science tasks.
|
|
1237
|
/** This function suspends the science tasks.
|
|
1236
|
*
|
|
1238
|
*
|
|
1237
|
* @return RTEMS directive status codes:
|
|
1239
|
* @return RTEMS directive status codes:
|
|
1238
|
* - RTEMS_SUCCESSFUL - task restarted successfully
|
|
1240
|
* - RTEMS_SUCCESSFUL - task restarted successfully
|
|
1239
|
* - RTEMS_INVALID_ID - task id invalid
|
|
1241
|
* - RTEMS_INVALID_ID - task id invalid
|
|
1240
|
* - RTEMS_ALREADY_SUSPENDED - task already suspended
|
|
1242
|
* - RTEMS_ALREADY_SUSPENDED - task already suspended
|
|
1241
|
*
|
|
1243
|
*
|
|
1242
|
*/
|
|
1244
|
*/
|
|
1243
|
|
|
1245
|
|
|
1244
|
rtems_status_code status;
|
|
1246
|
rtems_status_code status;
|
|
1245
|
|
|
1247
|
|
|
1246
|
PRINTF("in suspend_science_tasks\n")
|
|
1248
|
PRINTF("in suspend_science_tasks\n")
|
|
1247
|
|
|
1249
|
|
|
1248
|
status = rtems_task_suspend( Task_id[TASKID_AVF0] ); // suspend AVF0
|
|
1250
|
status = rtems_task_suspend( Task_id[TASKID_AVF0] ); // suspend AVF0
|
|
1249
|
if ((status != RTEMS_SUCCESSFUL) && (status != RTEMS_ALREADY_SUSPENDED))
|
|
1251
|
if ((status != RTEMS_SUCCESSFUL) && (status != RTEMS_ALREADY_SUSPENDED))
|
|
1250
|
{
|
|
1252
|
{
|
|
1251
|
PRINTF1("in suspend_science_task *** AVF0 ERR %d\n", status)
|
|
1253
|
PRINTF1("in suspend_science_task *** AVF0 ERR %d\n", status)
|
|
1252
|
}
|
|
1254
|
}
|
|
1253
|
else
|
|
1255
|
else
|
|
1254
|
{
|
|
1256
|
{
|
|
1255
|
status = RTEMS_SUCCESSFUL;
|
|
1257
|
status = RTEMS_SUCCESSFUL;
|
|
1256
|
}
|
|
1258
|
}
|
|
1257
|
|
|
1259
|
|
|
1258
|
if (status == RTEMS_SUCCESSFUL) // suspend PRC0
|
|
1260
|
if (status == RTEMS_SUCCESSFUL) // suspend PRC0
|
|
1259
|
{
|
|
1261
|
{
|
|
1260
|
status = rtems_task_suspend( Task_id[TASKID_PRC0] );
|
|
1262
|
status = rtems_task_suspend( Task_id[TASKID_PRC0] );
|
|
1261
|
if ((status != RTEMS_SUCCESSFUL) && (status != RTEMS_ALREADY_SUSPENDED))
|
|
1263
|
if ((status != RTEMS_SUCCESSFUL) && (status != RTEMS_ALREADY_SUSPENDED))
|
|
1262
|
{
|
|
1264
|
{
|
|
1263
|
PRINTF1("in suspend_science_task *** PRC0 ERR %d\n", status)
|
|
1265
|
PRINTF1("in suspend_science_task *** PRC0 ERR %d\n", status)
|
|
1264
|
}
|
|
1266
|
}
|
|
1265
|
else
|
|
1267
|
else
|
|
1266
|
{
|
|
1268
|
{
|
|
1267
|
status = RTEMS_SUCCESSFUL;
|
|
1269
|
status = RTEMS_SUCCESSFUL;
|
|
1268
|
}
|
|
1270
|
}
|
|
1269
|
}
|
|
1271
|
}
|
|
1270
|
|
|
1272
|
|
|
1271
|
if (status == RTEMS_SUCCESSFUL) // suspend AVF1
|
|
1273
|
if (status == RTEMS_SUCCESSFUL) // suspend AVF1
|
|
1272
|
{
|
|
1274
|
{
|
|
1273
|
status = rtems_task_suspend( Task_id[TASKID_AVF1] );
|
|
1275
|
status = rtems_task_suspend( Task_id[TASKID_AVF1] );
|
|
1274
|
if ((status != RTEMS_SUCCESSFUL) && (status != RTEMS_ALREADY_SUSPENDED))
|
|
1276
|
if ((status != RTEMS_SUCCESSFUL) && (status != RTEMS_ALREADY_SUSPENDED))
|
|
1275
|
{
|
|
1277
|
{
|
|
1276
|
PRINTF1("in suspend_science_task *** AVF1 ERR %d\n", status)
|
|
1278
|
PRINTF1("in suspend_science_task *** AVF1 ERR %d\n", status)
|
|
1277
|
}
|
|
1279
|
}
|
|
1278
|
else
|
|
1280
|
else
|
|
1279
|
{
|
|
1281
|
{
|
|
1280
|
status = RTEMS_SUCCESSFUL;
|
|
1282
|
status = RTEMS_SUCCESSFUL;
|
|
1281
|
}
|
|
1283
|
}
|
|
1282
|
}
|
|
1284
|
}
|
|
1283
|
|
|
1285
|
|
|
1284
|
if (status == RTEMS_SUCCESSFUL) // suspend PRC1
|
|
1286
|
if (status == RTEMS_SUCCESSFUL) // suspend PRC1
|
|
1285
|
{
|
|
1287
|
{
|
|
1286
|
status = rtems_task_suspend( Task_id[TASKID_PRC1] );
|
|
1288
|
status = rtems_task_suspend( Task_id[TASKID_PRC1] );
|
|
1287
|
if ((status != RTEMS_SUCCESSFUL) && (status != RTEMS_ALREADY_SUSPENDED))
|
|
1289
|
if ((status != RTEMS_SUCCESSFUL) && (status != RTEMS_ALREADY_SUSPENDED))
|
|
1288
|
{
|
|
1290
|
{
|
|
1289
|
PRINTF1("in suspend_science_task *** PRC1 ERR %d\n", status)
|
|
1291
|
PRINTF1("in suspend_science_task *** PRC1 ERR %d\n", status)
|
|
1290
|
}
|
|
1292
|
}
|
|
1291
|
else
|
|
1293
|
else
|
|
1292
|
{
|
|
1294
|
{
|
|
1293
|
status = RTEMS_SUCCESSFUL;
|
|
1295
|
status = RTEMS_SUCCESSFUL;
|
|
1294
|
}
|
|
1296
|
}
|
|
1295
|
}
|
|
1297
|
}
|
|
1296
|
|
|
1298
|
|
|
1297
|
if (status == RTEMS_SUCCESSFUL) // suspend AVF2
|
|
1299
|
if (status == RTEMS_SUCCESSFUL) // suspend AVF2
|
|
1298
|
{
|
|
1300
|
{
|
|
1299
|
status = rtems_task_suspend( Task_id[TASKID_AVF2] );
|
|
1301
|
status = rtems_task_suspend( Task_id[TASKID_AVF2] );
|
|
1300
|
if ((status != RTEMS_SUCCESSFUL) && (status != RTEMS_ALREADY_SUSPENDED))
|
|
1302
|
if ((status != RTEMS_SUCCESSFUL) && (status != RTEMS_ALREADY_SUSPENDED))
|
|
1301
|
{
|
|
1303
|
{
|
|
1302
|
PRINTF1("in suspend_science_task *** AVF2 ERR %d\n", status)
|
|
1304
|
PRINTF1("in suspend_science_task *** AVF2 ERR %d\n", status)
|
|
1303
|
}
|
|
1305
|
}
|
|
1304
|
else
|
|
1306
|
else
|
|
1305
|
{
|
|
1307
|
{
|
|
1306
|
status = RTEMS_SUCCESSFUL;
|
|
1308
|
status = RTEMS_SUCCESSFUL;
|
|
1307
|
}
|
|
1309
|
}
|
|
1308
|
}
|
|
1310
|
}
|
|
1309
|
|
|
1311
|
|
|
1310
|
if (status == RTEMS_SUCCESSFUL) // suspend PRC2
|
|
1312
|
if (status == RTEMS_SUCCESSFUL) // suspend PRC2
|
|
1311
|
{
|
|
1313
|
{
|
|
1312
|
status = rtems_task_suspend( Task_id[TASKID_PRC2] );
|
|
1314
|
status = rtems_task_suspend( Task_id[TASKID_PRC2] );
|
|
1313
|
if ((status != RTEMS_SUCCESSFUL) && (status != RTEMS_ALREADY_SUSPENDED))
|
|
1315
|
if ((status != RTEMS_SUCCESSFUL) && (status != RTEMS_ALREADY_SUSPENDED))
|
|
1314
|
{
|
|
1316
|
{
|
|
1315
|
PRINTF1("in suspend_science_task *** PRC2 ERR %d\n", status)
|
|
1317
|
PRINTF1("in suspend_science_task *** PRC2 ERR %d\n", status)
|
|
1316
|
}
|
|
1318
|
}
|
|
1317
|
else
|
|
1319
|
else
|
|
1318
|
{
|
|
1320
|
{
|
|
1319
|
status = RTEMS_SUCCESSFUL;
|
|
1321
|
status = RTEMS_SUCCESSFUL;
|
|
1320
|
}
|
|
1322
|
}
|
|
1321
|
}
|
|
1323
|
}
|
|
1322
|
|
|
1324
|
|
|
1323
|
return status;
|
|
1325
|
return status;
|
|
1324
|
}
|
|
1326
|
}
|
|
1325
|
|
|
1327
|
|
|
1326
|
void launch_waveform_picker( unsigned char mode, unsigned int transitionCoarseTime )
|
|
1328
|
void launch_waveform_picker( unsigned char mode, unsigned int transitionCoarseTime )
|
|
1327
|
{
|
|
1329
|
{
|
|
1328
|
|
|
1330
|
|
|
1329
|
WFP_reset_current_ring_nodes();
|
|
1331
|
WFP_reset_current_ring_nodes();
|
|
1330
|
|
|
1332
|
|
|
1331
|
reset_waveform_picker_regs();
|
|
1333
|
reset_waveform_picker_regs();
|
|
1332
|
|
|
1334
|
|
|
1333
|
set_wfp_burst_enable_register( mode );
|
|
1335
|
set_wfp_burst_enable_register( mode );
|
|
1334
|
|
|
1336
|
|
|
1335
|
LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER );
|
|
1337
|
LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER );
|
|
1336
|
LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER );
|
|
1338
|
LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER );
|
|
1337
|
|
|
1339
|
|
|
1338
|
if (transitionCoarseTime == 0)
|
|
1340
|
if (transitionCoarseTime == 0)
|
|
1339
|
{
|
|
1341
|
{
|
|
1340
|
// instant transition means transition on the next valid date
|
|
1342
|
// instant transition means transition on the next valid date
|
|
1341
|
// this is mandatory to have a good snapshot period and a good correction of the snapshot period
|
|
1343
|
// this is mandatory to have a good snapshot period and a good correction of the snapshot period
|
|
1342
|
waveform_picker_regs->start_date = time_management_regs->coarse_time + 1;
|
|
1344
|
waveform_picker_regs->start_date = time_management_regs->coarse_time + 1;
|
|
1343
|
}
|
|
1345
|
}
|
|
1344
|
else
|
|
1346
|
else
|
|
1345
|
{
|
|
1347
|
{
|
|
1346
|
waveform_picker_regs->start_date = transitionCoarseTime;
|
|
1348
|
waveform_picker_regs->start_date = transitionCoarseTime;
|
|
1347
|
}
|
|
1349
|
}
|
|
1348
|
|
|
1350
|
|
|
1349
|
update_last_valid_transition_date(waveform_picker_regs->start_date);
|
|
1351
|
update_last_valid_transition_date(waveform_picker_regs->start_date);
|
|
1350
|
|
|
1352
|
|
|
1351
|
}
|
|
1353
|
}
|
|
1352
|
|
|
1354
|
|
|
1353
|
void launch_spectral_matrix( void )
|
|
1355
|
void launch_spectral_matrix( void )
|
|
1354
|
{
|
|
1356
|
{
|
|
1355
|
SM_reset_current_ring_nodes();
|
|
1357
|
SM_reset_current_ring_nodes();
|
|
1356
|
|
|
1358
|
|
|
1357
|
reset_spectral_matrix_regs();
|
|
1359
|
reset_spectral_matrix_regs();
|
|
1358
|
|
|
1360
|
|
|
1359
|
reset_nb_sm();
|
|
1361
|
reset_nb_sm();
|
|
1360
|
|
|
1362
|
|
|
1361
|
set_sm_irq_onNewMatrix( 1 );
|
|
1363
|
set_sm_irq_onNewMatrix( 1 );
|
|
1362
|
|
|
1364
|
|
|
1363
|
LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX );
|
|
1365
|
LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX );
|
|
1364
|
LEON_Unmask_interrupt( IRQ_SPECTRAL_MATRIX );
|
|
1366
|
LEON_Unmask_interrupt( IRQ_SPECTRAL_MATRIX );
|
|
1365
|
|
|
1367
|
|
|
1366
|
}
|
|
1368
|
}
|
|
1367
|
|
|
1369
|
|
|
1368
|
void set_sm_irq_onNewMatrix( unsigned char value )
|
|
1370
|
void set_sm_irq_onNewMatrix( unsigned char value )
|
|
1369
|
{
|
|
1371
|
{
|
|
1370
|
if (value == 1)
|
|
1372
|
if (value == 1)
|
|
1371
|
{
|
|
1373
|
{
|
|
1372
|
spectral_matrix_regs->config = spectral_matrix_regs->config | BIT_IRQ_ON_NEW_MATRIX;
|
|
1374
|
spectral_matrix_regs->config = spectral_matrix_regs->config | BIT_IRQ_ON_NEW_MATRIX;
|
|
1373
|
}
|
|
1375
|
}
|
|
1374
|
else
|
|
1376
|
else
|
|
1375
|
{
|
|
1377
|
{
|
|
1376
|
spectral_matrix_regs->config = spectral_matrix_regs->config & MASK_IRQ_ON_NEW_MATRIX; // 1110
|
|
1378
|
spectral_matrix_regs->config = spectral_matrix_regs->config & MASK_IRQ_ON_NEW_MATRIX; // 1110
|
|
1377
|
}
|
|
1379
|
}
|
|
1378
|
}
|
|
1380
|
}
|
|
1379
|
|
|
1381
|
|
|
1380
|
void set_sm_irq_onError( unsigned char value )
|
|
1382
|
void set_sm_irq_onError( unsigned char value )
|
|
1381
|
{
|
|
1383
|
{
|
|
1382
|
if (value == 1)
|
|
1384
|
if (value == 1)
|
|
1383
|
{
|
|
1385
|
{
|
|
1384
|
spectral_matrix_regs->config = spectral_matrix_regs->config | BIT_IRQ_ON_ERROR;
|
|
1386
|
spectral_matrix_regs->config = spectral_matrix_regs->config | BIT_IRQ_ON_ERROR;
|
|
1385
|
}
|
|
1387
|
}
|
|
1386
|
else
|
|
1388
|
else
|
|
1387
|
{
|
|
1389
|
{
|
|
1388
|
spectral_matrix_regs->config = spectral_matrix_regs->config & MASK_IRQ_ON_ERROR; // 1101
|
|
1390
|
spectral_matrix_regs->config = spectral_matrix_regs->config & MASK_IRQ_ON_ERROR; // 1101
|
|
1389
|
}
|
|
1391
|
}
|
|
1390
|
}
|
|
1392
|
}
|
|
1391
|
|
|
1393
|
|
|
1392
|
//*****************************
|
|
1394
|
//*****************************
|
|
1393
|
// CONFIGURE CALIBRATION SIGNAL
|
|
1395
|
// CONFIGURE CALIBRATION SIGNAL
|
|
1394
|
void setCalibrationPrescaler( unsigned int prescaler )
|
|
1396
|
void setCalibrationPrescaler( unsigned int prescaler )
|
|
1395
|
{
|
|
1397
|
{
|
|
1396
|
// prescaling of the master clock (25 MHz)
|
|
1398
|
// prescaling of the master clock (25 MHz)
|
|
1397
|
// master clock is divided by 2^prescaler
|
|
1399
|
// master clock is divided by 2^prescaler
|
|
1398
|
time_management_regs->calPrescaler = prescaler;
|
|
1400
|
time_management_regs->calPrescaler = prescaler;
|
|
1399
|
}
|
|
1401
|
}
|
|
1400
|
|
|
1402
|
|
|
1401
|
void setCalibrationDivisor( unsigned int divisionFactor )
|
|
1403
|
void setCalibrationDivisor( unsigned int divisionFactor )
|
|
1402
|
{
|
|
1404
|
{
|
|
1403
|
// division of the prescaled clock by the division factor
|
|
1405
|
// division of the prescaled clock by the division factor
|
|
1404
|
time_management_regs->calDivisor = divisionFactor;
|
|
1406
|
time_management_regs->calDivisor = divisionFactor;
|
|
1405
|
}
|
|
1407
|
}
|
|
1406
|
|
|
1408
|
|
|
1407
|
void setCalibrationData( void )
|
|
1409
|
void setCalibrationData( void )
|
|
1408
|
{
|
|
1410
|
{
|
|
1409
|
/** This function is used to store the values used to drive the DAC in order to generate the SCM calibration signal
|
|
1411
|
/** This function is used to store the values used to drive the DAC in order to generate the SCM calibration signal
|
|
1410
|
*
|
|
1412
|
*
|
|
1411
|
* @param void
|
|
1413
|
* @param void
|
|
1412
|
*
|
|
1414
|
*
|
|
1413
|
* @return void
|
|
1415
|
* @return void
|
|
1414
|
*
|
|
1416
|
*
|
|
1415
|
*/
|
|
1417
|
*/
|
|
1416
|
|
|
1418
|
|
|
1417
|
unsigned int k;
|
|
1419
|
unsigned int k;
|
|
1418
|
unsigned short data;
|
|
1420
|
unsigned short data;
|
|
1419
|
float val;
|
|
1421
|
float val;
|
|
1420
|
float Ts;
|
|
1422
|
float Ts;
|
|
1421
|
|
|
1423
|
|
|
1422
|
time_management_regs->calDataPtr = INIT_CHAR;
|
|
1424
|
time_management_regs->calDataPtr = INIT_CHAR;
|
|
1423
|
|
|
1425
|
|
|
1424
|
Ts = 1 / CAL_FS;
|
|
1426
|
Ts = 1 / CAL_FS;
|
|
1425
|
|
|
1427
|
|
|
1426
|
// build the signal for the SCM calibration
|
|
1428
|
// build the signal for the SCM calibration
|
|
1427
|
for (k = 0; k < CAL_NB_PTS; k++)
|
|
1429
|
for (k = 0; k < CAL_NB_PTS; k++)
|
|
1428
|
{
|
|
1430
|
{
|
|
1429
|
val = CAL_A0 * sin( CAL_W0 * k * Ts )
|
|
1431
|
val = CAL_A0 * sin( CAL_W0 * k * Ts )
|
|
1430
|
+ CAL_A1 * sin( CAL_W1 * k * Ts );
|
|
1432
|
+ CAL_A1 * sin( CAL_W1 * k * Ts );
|
|
1431
|
data = (unsigned short) ((val * CAL_SCALE_FACTOR) + CONST_2048);
|
|
1433
|
data = (unsigned short) ((val * CAL_SCALE_FACTOR) + CONST_2048);
|
|
1432
|
time_management_regs->calData = data & CAL_DATA_MASK;
|
|
1434
|
time_management_regs->calData = data & CAL_DATA_MASK;
|
|
1433
|
}
|
|
1435
|
}
|
|
1434
|
}
|
|
1436
|
}
|
|
1435
|
|
|
1437
|
|
|
1436
|
#ifdef ENABLE_DEAD_CODE
|
|
1438
|
#ifdef ENABLE_DEAD_CODE
|
|
1437
|
void setCalibrationDataInterleaved( void )
|
|
1439
|
void setCalibrationDataInterleaved( void )
|
|
1438
|
{
|
|
1440
|
{
|
|
1439
|
/** This function is used to store the values used to drive the DAC in order to generate the SCM calibration signal
|
|
1441
|
/** This function is used to store the values used to drive the DAC in order to generate the SCM calibration signal
|
|
1440
|
*
|
|
1442
|
*
|
|
1441
|
* @param void
|
|
1443
|
* @param void
|
|
1442
|
*
|
|
1444
|
*
|
|
1443
|
* @return void
|
|
1445
|
* @return void
|
|
1444
|
*
|
|
1446
|
*
|
|
1445
|
* In interleaved mode, one can store more values than in normal mode.
|
|
1447
|
* In interleaved mode, one can store more values than in normal mode.
|
|
1446
|
* The data are stored in bunch of 18 bits, 12 bits from one sample and 6 bits from another sample.
|
|
1448
|
* The data are stored in bunch of 18 bits, 12 bits from one sample and 6 bits from another sample.
|
|
1447
|
* T store 3 values, one need two write operations.
|
|
1449
|
* T store 3 values, one need two write operations.
|
|
1448
|
* s1 [ b11 b10 b9 b8 b7 b6 ] s0 [ b11 b10 b9 b8 b7 b6 b5 b3 b2 b1 b0 ]
|
|
1450
|
* s1 [ b11 b10 b9 b8 b7 b6 ] s0 [ b11 b10 b9 b8 b7 b6 b5 b3 b2 b1 b0 ]
|
|
1449
|
* s1 [ b5 b4 b3 b2 b1 b0 ] s2 [ b11 b10 b9 b8 b7 b6 b5 b3 b2 b1 b0 ]
|
|
1451
|
* s1 [ b5 b4 b3 b2 b1 b0 ] s2 [ b11 b10 b9 b8 b7 b6 b5 b3 b2 b1 b0 ]
|
|
1450
|
*
|
|
1452
|
*
|
|
1451
|
*/
|
|
1453
|
*/
|
|
1452
|
|
|
1454
|
|
|
1453
|
unsigned int k;
|
|
1455
|
unsigned int k;
|
|
1454
|
float val;
|
|
1456
|
float val;
|
|
1455
|
float Ts;
|
|
1457
|
float Ts;
|
|
1456
|
unsigned short data[CAL_NB_PTS_INTER];
|
|
1458
|
unsigned short data[CAL_NB_PTS_INTER];
|
|
1457
|
unsigned char *dataPtr;
|
|
1459
|
unsigned char *dataPtr;
|
|
1458
|
|
|
1460
|
|
|
1459
|
Ts = 1 / CAL_FS_INTER;
|
|
1461
|
Ts = 1 / CAL_FS_INTER;
|
|
1460
|
|
|
1462
|
|
|
1461
|
time_management_regs->calDataPtr = INIT_CHAR;
|
|
1463
|
time_management_regs->calDataPtr = INIT_CHAR;
|
|
1462
|
|
|
1464
|
|
|
1463
|
// build the signal for the SCM calibration
|
|
1465
|
// build the signal for the SCM calibration
|
|
1464
|
for (k=0; k<CAL_NB_PTS_INTER; k++)
|
|
1466
|
for (k=0; k<CAL_NB_PTS_INTER; k++)
|
|
1465
|
{
|
|
1467
|
{
|
|
1466
|
val = sin( 2 * pi * CAL_F0 * k * Ts )
|
|
1468
|
val = sin( 2 * pi * CAL_F0 * k * Ts )
|
|
1467
|
+ sin( 2 * pi * CAL_F1 * k * Ts );
|
|
1469
|
+ sin( 2 * pi * CAL_F1 * k * Ts );
|
|
1468
|
data[k] = (unsigned short) ((val * CONST_512) + CONST_2048);
|
|
1470
|
data[k] = (unsigned short) ((val * CONST_512) + CONST_2048);
|
|
1469
|
}
|
|
1471
|
}
|
|
1470
|
|
|
1472
|
|
|
1471
|
// write the signal in interleaved mode
|
|
1473
|
// write the signal in interleaved mode
|
|
1472
|
for (k=0; k < STEPS_FOR_STORAGE_INTER; k++)
|
|
1474
|
for (k=0; k < STEPS_FOR_STORAGE_INTER; k++)
|
|
1473
|
{
|
|
1475
|
{
|
|
1474
|
dataPtr = (unsigned char*) &data[ (k * BYTES_FOR_2_SAMPLES) + 2 ];
|
|
1476
|
dataPtr = (unsigned char*) &data[ (k * BYTES_FOR_2_SAMPLES) + 2 ];
|
|
1475
|
time_management_regs->calData = ( data[ k * BYTES_FOR_2_SAMPLES ] & CAL_DATA_MASK )
|
|
1477
|
time_management_regs->calData = ( data[ k * BYTES_FOR_2_SAMPLES ] & CAL_DATA_MASK )
|
|
1476
|
+ ( (dataPtr[0] & CAL_DATA_MASK_INTER) << CAL_DATA_SHIFT_INTER);
|
|
1478
|
+ ( (dataPtr[0] & CAL_DATA_MASK_INTER) << CAL_DATA_SHIFT_INTER);
|
|
1477
|
time_management_regs->calData = ( data[(k * BYTES_FOR_2_SAMPLES) + 1] & CAL_DATA_MASK )
|
|
1479
|
time_management_regs->calData = ( data[(k * BYTES_FOR_2_SAMPLES) + 1] & CAL_DATA_MASK )
|
|
1478
|
+ ( (dataPtr[1] & CAL_DATA_MASK_INTER) << CAL_DATA_SHIFT_INTER);
|
|
1480
|
+ ( (dataPtr[1] & CAL_DATA_MASK_INTER) << CAL_DATA_SHIFT_INTER);
|
|
1479
|
}
|
|
1481
|
}
|
|
1480
|
}
|
|
1482
|
}
|
|
1481
|
#endif
|
|
1483
|
#endif
|
|
1482
|
|
|
1484
|
|
|
1483
|
void setCalibrationReload( bool state)
|
|
1485
|
void setCalibrationReload( bool state)
|
|
1484
|
{
|
|
1486
|
{
|
|
1485
|
if (state == true)
|
|
1487
|
if (state == true)
|
|
1486
|
{
|
|
1488
|
{
|
|
1487
|
time_management_regs->calDACCtrl = time_management_regs->calDACCtrl | BIT_CAL_RELOAD; // [0001 0000]
|
|
1489
|
time_management_regs->calDACCtrl = time_management_regs->calDACCtrl | BIT_CAL_RELOAD; // [0001 0000]
|
|
1488
|
}
|
|
1490
|
}
|
|
1489
|
else
|
|
1491
|
else
|
|
1490
|
{
|
|
1492
|
{
|
|
1491
|
time_management_regs->calDACCtrl = time_management_regs->calDACCtrl & MASK_CAL_RELOAD; // [1110 1111]
|
|
1493
|
time_management_regs->calDACCtrl = time_management_regs->calDACCtrl & MASK_CAL_RELOAD; // [1110 1111]
|
|
1492
|
}
|
|
1494
|
}
|
|
1493
|
}
|
|
1495
|
}
|
|
1494
|
|
|
1496
|
|
|
1495
|
void setCalibrationEnable( bool state )
|
|
1497
|
void setCalibrationEnable( bool state )
|
|
1496
|
{
|
|
1498
|
{
|
|
1497
|
// this bit drives the multiplexer
|
|
1499
|
// this bit drives the multiplexer
|
|
1498
|
if (state == true)
|
|
1500
|
if (state == true)
|
|
1499
|
{
|
|
1501
|
{
|
|
1500
|
time_management_regs->calDACCtrl = time_management_regs->calDACCtrl | BIT_CAL_ENABLE; // [0100 0000]
|
|
1502
|
time_management_regs->calDACCtrl = time_management_regs->calDACCtrl | BIT_CAL_ENABLE; // [0100 0000]
|
|
1501
|
}
|
|
1503
|
}
|
|
1502
|
else
|
|
1504
|
else
|
|
1503
|
{
|
|
1505
|
{
|
|
1504
|
time_management_regs->calDACCtrl = time_management_regs->calDACCtrl & MASK_CAL_ENABLE; // [1011 1111]
|
|
1506
|
time_management_regs->calDACCtrl = time_management_regs->calDACCtrl & MASK_CAL_ENABLE; // [1011 1111]
|
|
1505
|
}
|
|
1507
|
}
|
|
1506
|
}
|
|
1508
|
}
|
|
1507
|
|
|
1509
|
|
|
1508
|
#ifdef ENABLE_DEAD_CODE
|
|
1510
|
#ifdef ENABLE_DEAD_CODE
|
|
1509
|
void setCalibrationInterleaved( bool state )
|
|
1511
|
void setCalibrationInterleaved( bool state )
|
|
1510
|
{
|
|
1512
|
{
|
|
1511
|
// this bit drives the multiplexer
|
|
1513
|
// this bit drives the multiplexer
|
|
1512
|
if (state == true)
|
|
1514
|
if (state == true)
|
|
1513
|
{
|
|
1515
|
{
|
|
1514
|
time_management_regs->calDACCtrl = time_management_regs->calDACCtrl | BIT_SET_INTERLEAVED; // [0010 0000]
|
|
1516
|
time_management_regs->calDACCtrl = time_management_regs->calDACCtrl | BIT_SET_INTERLEAVED; // [0010 0000]
|
|
1515
|
}
|
|
1517
|
}
|
|
1516
|
else
|
|
1518
|
else
|
|
1517
|
{
|
|
1519
|
{
|
|
1518
|
time_management_regs->calDACCtrl = time_management_regs->calDACCtrl & MASK_SET_INTERLEAVED; // [1101 1111]
|
|
1520
|
time_management_regs->calDACCtrl = time_management_regs->calDACCtrl & MASK_SET_INTERLEAVED; // [1101 1111]
|
|
1519
|
}
|
|
1521
|
}
|
|
1520
|
}
|
|
1522
|
}
|
|
1521
|
#endif
|
|
1523
|
#endif
|
|
1522
|
|
|
1524
|
|
|
1523
|
void setCalibration( bool state )
|
|
1525
|
void setCalibration( bool state )
|
|
1524
|
{
|
|
1526
|
{
|
|
1525
|
if (state == true)
|
|
1527
|
if (state == true)
|
|
1526
|
{
|
|
1528
|
{
|
|
1527
|
setCalibrationEnable( true );
|
|
1529
|
setCalibrationEnable( true );
|
|
1528
|
setCalibrationReload( false );
|
|
1530
|
setCalibrationReload( false );
|
|
1529
|
set_hk_lfr_calib_enable( true );
|
|
1531
|
set_hk_lfr_calib_enable( true );
|
|
1530
|
}
|
|
1532
|
}
|
|
1531
|
else
|
|
1533
|
else
|
|
1532
|
{
|
|
1534
|
{
|
|
1533
|
setCalibrationEnable( false );
|
|
1535
|
setCalibrationEnable( false );
|
|
1534
|
setCalibrationReload( true );
|
|
1536
|
setCalibrationReload( true );
|
|
1535
|
set_hk_lfr_calib_enable( false );
|
|
1537
|
set_hk_lfr_calib_enable( false );
|
|
1536
|
}
|
|
1538
|
}
|
|
1537
|
}
|
|
1539
|
}
|
|
1538
|
|
|
1540
|
|
|
1539
|
void configureCalibration( bool interleaved )
|
|
1541
|
void configureCalibration( bool interleaved )
|
|
1540
|
{
|
|
1542
|
{
|
|
1541
|
setCalibration( false );
|
|
1543
|
setCalibration( false );
|
|
1542
|
#ifdef ENABLE_DEAD_CODE
|
|
1544
|
#ifdef ENABLE_DEAD_CODE
|
|
1543
|
if ( interleaved == true )
|
|
1545
|
if ( interleaved == true )
|
|
1544
|
{
|
|
1546
|
{
|
|
1545
|
setCalibrationInterleaved( true );
|
|
1547
|
setCalibrationInterleaved( true );
|
|
1546
|
setCalibrationPrescaler( 0 ); // 25 MHz => 25 000 000
|
|
1548
|
setCalibrationPrescaler( 0 ); // 25 MHz => 25 000 000
|
|
1547
|
setCalibrationDivisor( CAL_F_DIVISOR_INTER ); // => 240 384
|
|
1549
|
setCalibrationDivisor( CAL_F_DIVISOR_INTER ); // => 240 384
|
|
1548
|
setCalibrationDataInterleaved();
|
|
1550
|
setCalibrationDataInterleaved();
|
|
1549
|
}
|
|
1551
|
}
|
|
1550
|
else
|
|
1552
|
else
|
|
1551
|
#endif
|
|
1553
|
#endif
|
|
1552
|
{
|
|
1554
|
{
|
|
1553
|
setCalibrationPrescaler( 0 ); // 25 MHz => 25 000 000
|
|
1555
|
setCalibrationPrescaler( 0 ); // 25 MHz => 25 000 000
|
|
1554
|
setCalibrationDivisor( CAL_F_DIVISOR ); // => 160 256 (39 - 1)
|
|
1556
|
setCalibrationDivisor( CAL_F_DIVISOR ); // => 160 256 (39 - 1)
|
|
1555
|
setCalibrationData();
|
|
1557
|
setCalibrationData();
|
|
1556
|
}
|
|
1558
|
}
|
|
1557
|
}
|
|
1559
|
}
|
|
1558
|
|
|
1560
|
|
|
1559
|
//****************
|
|
1561
|
//****************
|
|
1560
|
// CLOSING ACTIONS
|
|
1562
|
// CLOSING ACTIONS
|
|
1561
|
void update_last_TC_exe( ccsdsTelecommandPacket_t *TC, unsigned char * time )
|
|
1563
|
void update_last_TC_exe( ccsdsTelecommandPacket_t *TC, unsigned char * time )
|
|
1562
|
{
|
|
1564
|
{
|
|
1563
|
/** This function is used to update the HK packets statistics after a successful TC execution.
|
|
1565
|
/** This function is used to update the HK packets statistics after a successful TC execution.
|
|
1564
|
*
|
|
1566
|
*
|
|
1565
|
* @param TC points to the TC being processed
|
|
1567
|
* @param TC points to the TC being processed
|
|
1566
|
* @param time is the time used to date the TC execution
|
|
1568
|
* @param time is the time used to date the TC execution
|
|
1567
|
*
|
|
1569
|
*
|
|
1568
|
*/
|
|
1570
|
*/
|
|
1569
|
|
|
1571
|
|
|
1570
|
unsigned int val;
|
|
1572
|
unsigned int val;
|
|
1571
|
|
|
1573
|
|
|
1572
|
housekeeping_packet.hk_lfr_last_exe_tc_id[0] = TC->packetID[0];
|
|
1574
|
housekeeping_packet.hk_lfr_last_exe_tc_id[0] = TC->packetID[0];
|
|
1573
|
housekeeping_packet.hk_lfr_last_exe_tc_id[1] = TC->packetID[1];
|
|
1575
|
housekeeping_packet.hk_lfr_last_exe_tc_id[1] = TC->packetID[1];
|
|
1574
|
housekeeping_packet.hk_lfr_last_exe_tc_type[0] = INIT_CHAR;
|
|
1576
|
housekeeping_packet.hk_lfr_last_exe_tc_type[0] = INIT_CHAR;
|
|
1575
|
housekeeping_packet.hk_lfr_last_exe_tc_type[1] = TC->serviceType;
|
|
1577
|
housekeeping_packet.hk_lfr_last_exe_tc_type[1] = TC->serviceType;
|
|
1576
|
housekeeping_packet.hk_lfr_last_exe_tc_subtype[0] = INIT_CHAR;
|
|
1578
|
housekeeping_packet.hk_lfr_last_exe_tc_subtype[0] = INIT_CHAR;
|
|
1577
|
housekeeping_packet.hk_lfr_last_exe_tc_subtype[1] = TC->serviceSubType;
|
|
1579
|
housekeeping_packet.hk_lfr_last_exe_tc_subtype[1] = TC->serviceSubType;
|
|
1578
|
housekeeping_packet.hk_lfr_last_exe_tc_time[BYTE_0] = time[BYTE_0];
|
|
1580
|
housekeeping_packet.hk_lfr_last_exe_tc_time[BYTE_0] = time[BYTE_0];
|
|
1579
|
housekeeping_packet.hk_lfr_last_exe_tc_time[BYTE_1] = time[BYTE_1];
|
|
1581
|
housekeeping_packet.hk_lfr_last_exe_tc_time[BYTE_1] = time[BYTE_1];
|
|
1580
|
housekeeping_packet.hk_lfr_last_exe_tc_time[BYTE_2] = time[BYTE_2];
|
|
1582
|
housekeeping_packet.hk_lfr_last_exe_tc_time[BYTE_2] = time[BYTE_2];
|
|
1581
|
housekeeping_packet.hk_lfr_last_exe_tc_time[BYTE_3] = time[BYTE_3];
|
|
1583
|
housekeeping_packet.hk_lfr_last_exe_tc_time[BYTE_3] = time[BYTE_3];
|
|
1582
|
housekeeping_packet.hk_lfr_last_exe_tc_time[BYTE_4] = time[BYTE_4];
|
|
1584
|
housekeeping_packet.hk_lfr_last_exe_tc_time[BYTE_4] = time[BYTE_4];
|
|
1583
|
housekeeping_packet.hk_lfr_last_exe_tc_time[BYTE_5] = time[BYTE_5];
|
|
1585
|
housekeeping_packet.hk_lfr_last_exe_tc_time[BYTE_5] = time[BYTE_5];
|
|
1584
|
|
|
1586
|
|
|
1585
|
val = (housekeeping_packet.hk_lfr_exe_tc_cnt[0] * CONST_256) + housekeeping_packet.hk_lfr_exe_tc_cnt[1];
|
|
1587
|
val = (housekeeping_packet.hk_lfr_exe_tc_cnt[0] * CONST_256) + housekeeping_packet.hk_lfr_exe_tc_cnt[1];
|
|
1586
|
val++;
|
|
1588
|
val++;
|
|
1587
|
housekeeping_packet.hk_lfr_exe_tc_cnt[0] = (unsigned char) (val >> SHIFT_1_BYTE);
|
|
1589
|
housekeeping_packet.hk_lfr_exe_tc_cnt[0] = (unsigned char) (val >> SHIFT_1_BYTE);
|
|
1588
|
housekeeping_packet.hk_lfr_exe_tc_cnt[1] = (unsigned char) (val);
|
|
1590
|
housekeeping_packet.hk_lfr_exe_tc_cnt[1] = (unsigned char) (val);
|
|
1589
|
}
|
|
1591
|
}
|
|
1590
|
|
|
1592
|
|
|
1591
|
void update_last_TC_rej(ccsdsTelecommandPacket_t *TC, unsigned char * time )
|
|
1593
|
void update_last_TC_rej(ccsdsTelecommandPacket_t *TC, unsigned char * time )
|
|
1592
|
{
|
|
1594
|
{
|
|
1593
|
/** This function is used to update the HK packets statistics after a TC rejection.
|
|
1595
|
/** This function is used to update the HK packets statistics after a TC rejection.
|
|
1594
|
*
|
|
1596
|
*
|
|
1595
|
* @param TC points to the TC being processed
|
|
1597
|
* @param TC points to the TC being processed
|
|
1596
|
* @param time is the time used to date the TC rejection
|
|
1598
|
* @param time is the time used to date the TC rejection
|
|
1597
|
*
|
|
1599
|
*
|
|
1598
|
*/
|
|
1600
|
*/
|
|
1599
|
|
|
1601
|
|
|
1600
|
unsigned int val;
|
|
1602
|
unsigned int val;
|
|
1601
|
|
|
1603
|
|
|
1602
|
housekeeping_packet.hk_lfr_last_rej_tc_id[0] = TC->packetID[0];
|
|
1604
|
housekeeping_packet.hk_lfr_last_rej_tc_id[0] = TC->packetID[0];
|
|
1603
|
housekeeping_packet.hk_lfr_last_rej_tc_id[1] = TC->packetID[1];
|
|
1605
|
housekeeping_packet.hk_lfr_last_rej_tc_id[1] = TC->packetID[1];
|
|
1604
|
housekeeping_packet.hk_lfr_last_rej_tc_type[0] = INIT_CHAR;
|
|
1606
|
housekeeping_packet.hk_lfr_last_rej_tc_type[0] = INIT_CHAR;
|
|
1605
|
housekeeping_packet.hk_lfr_last_rej_tc_type[1] = TC->serviceType;
|
|
1607
|
housekeeping_packet.hk_lfr_last_rej_tc_type[1] = TC->serviceType;
|
|
1606
|
housekeeping_packet.hk_lfr_last_rej_tc_subtype[0] = INIT_CHAR;
|
|
1608
|
housekeeping_packet.hk_lfr_last_rej_tc_subtype[0] = INIT_CHAR;
|
|
1607
|
housekeeping_packet.hk_lfr_last_rej_tc_subtype[1] = TC->serviceSubType;
|
|
1609
|
housekeeping_packet.hk_lfr_last_rej_tc_subtype[1] = TC->serviceSubType;
|
|
1608
|
housekeeping_packet.hk_lfr_last_rej_tc_time[BYTE_0] = time[BYTE_0];
|
|
1610
|
housekeeping_packet.hk_lfr_last_rej_tc_time[BYTE_0] = time[BYTE_0];
|
|
1609
|
housekeeping_packet.hk_lfr_last_rej_tc_time[BYTE_1] = time[BYTE_1];
|
|
1611
|
housekeeping_packet.hk_lfr_last_rej_tc_time[BYTE_1] = time[BYTE_1];
|
|
1610
|
housekeeping_packet.hk_lfr_last_rej_tc_time[BYTE_2] = time[BYTE_2];
|
|
1612
|
housekeeping_packet.hk_lfr_last_rej_tc_time[BYTE_2] = time[BYTE_2];
|
|
1611
|
housekeeping_packet.hk_lfr_last_rej_tc_time[BYTE_3] = time[BYTE_3];
|
|
1613
|
housekeeping_packet.hk_lfr_last_rej_tc_time[BYTE_3] = time[BYTE_3];
|
|
1612
|
housekeeping_packet.hk_lfr_last_rej_tc_time[BYTE_4] = time[BYTE_4];
|
|
1614
|
housekeeping_packet.hk_lfr_last_rej_tc_time[BYTE_4] = time[BYTE_4];
|
|
1613
|
housekeeping_packet.hk_lfr_last_rej_tc_time[BYTE_5] = time[BYTE_5];
|
|
1615
|
housekeeping_packet.hk_lfr_last_rej_tc_time[BYTE_5] = time[BYTE_5];
|
|
1614
|
|
|
1616
|
|
|
1615
|
val = (housekeeping_packet.hk_lfr_rej_tc_cnt[0] * CONST_256) + housekeeping_packet.hk_lfr_rej_tc_cnt[1];
|
|
1617
|
val = (housekeeping_packet.hk_lfr_rej_tc_cnt[0] * CONST_256) + housekeeping_packet.hk_lfr_rej_tc_cnt[1];
|
|
1616
|
val++;
|
|
1618
|
val++;
|
|
1617
|
housekeeping_packet.hk_lfr_rej_tc_cnt[0] = (unsigned char) (val >> SHIFT_1_BYTE);
|
|
1619
|
housekeeping_packet.hk_lfr_rej_tc_cnt[0] = (unsigned char) (val >> SHIFT_1_BYTE);
|
|
1618
|
housekeeping_packet.hk_lfr_rej_tc_cnt[1] = (unsigned char) (val);
|
|
1620
|
housekeeping_packet.hk_lfr_rej_tc_cnt[1] = (unsigned char) (val);
|
|
1619
|
}
|
|
1621
|
}
|
|
1620
|
|
|
1622
|
|
|
1621
|
void close_action(ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id )
|
|
1623
|
void close_action(ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id )
|
|
1622
|
{
|
|
1624
|
{
|
|
1623
|
/** This function is the last step of the TC execution workflow.
|
|
1625
|
/** This function is the last step of the TC execution workflow.
|
|
1624
|
*
|
|
1626
|
*
|
|
1625
|
* @param TC points to the TC being processed
|
|
1627
|
* @param TC points to the TC being processed
|
|
1626
|
* @param result is the result of the TC execution (LFR_SUCCESSFUL / LFR_DEFAULT)
|
|
1628
|
* @param result is the result of the TC execution (LFR_SUCCESSFUL / LFR_DEFAULT)
|
|
1627
|
* @param queue_id is the id of the RTEMS message queue used to send TM packets
|
|
1629
|
* @param queue_id is the id of the RTEMS message queue used to send TM packets
|
|
1628
|
* @param time is the time used to date the TC execution
|
|
1630
|
* @param time is the time used to date the TC execution
|
|
1629
|
*
|
|
1631
|
*
|
|
1630
|
*/
|
|
1632
|
*/
|
|
1631
|
|
|
1633
|
|
|
1632
|
unsigned char requestedMode;
|
|
1634
|
unsigned char requestedMode;
|
|
1633
|
|
|
1635
|
|
|
1634
|
if (result == LFR_SUCCESSFUL)
|
|
1636
|
if (result == LFR_SUCCESSFUL)
|
|
1635
|
{
|
|
1637
|
{
|
|
1636
|
if ( !( (TC->serviceType==TC_TYPE_TIME) & (TC->serviceSubType==TC_SUBTYPE_UPDT_TIME) )
|
|
1638
|
if ( !( (TC->serviceType==TC_TYPE_TIME) & (TC->serviceSubType==TC_SUBTYPE_UPDT_TIME) )
|
|
1637
|
&
|
|
1639
|
&
|
|
1638
|
!( (TC->serviceType==TC_TYPE_GEN) & (TC->serviceSubType==TC_SUBTYPE_UPDT_INFO))
|
|
1640
|
!( (TC->serviceType==TC_TYPE_GEN) & (TC->serviceSubType==TC_SUBTYPE_UPDT_INFO))
|
|
1639
|
)
|
|
1641
|
)
|
|
1640
|
{
|
|
1642
|
{
|
|
1641
|
send_tm_lfr_tc_exe_success( TC, queue_id );
|
|
1643
|
send_tm_lfr_tc_exe_success( TC, queue_id );
|
|
1642
|
}
|
|
1644
|
}
|
|
1643
|
if ( (TC->serviceType == TC_TYPE_GEN) & (TC->serviceSubType == TC_SUBTYPE_ENTER) )
|
|
1645
|
if ( (TC->serviceType == TC_TYPE_GEN) & (TC->serviceSubType == TC_SUBTYPE_ENTER) )
|
|
1644
|
{
|
|
1646
|
{
|
|
1645
|
//**********************************
|
|
1647
|
//**********************************
|
|
1646
|
// UPDATE THE LFRMODE LOCAL VARIABLE
|
|
1648
|
// UPDATE THE LFRMODE LOCAL VARIABLE
|
|
1647
|
requestedMode = TC->dataAndCRC[1];
|
|
1649
|
requestedMode = TC->dataAndCRC[1];
|
|
1648
|
updateLFRCurrentMode( requestedMode );
|
|
1650
|
updateLFRCurrentMode( requestedMode );
|
|
1649
|
}
|
|
1651
|
}
|
|
1650
|
}
|
|
1652
|
}
|
|
1651
|
else if (result == LFR_EXE_ERROR)
|
|
1653
|
else if (result == LFR_EXE_ERROR)
|
|
1652
|
{
|
|
1654
|
{
|
|
1653
|
send_tm_lfr_tc_exe_error( TC, queue_id );
|
|
1655
|
send_tm_lfr_tc_exe_error( TC, queue_id );
|
|
1654
|
}
|
|
1656
|
}
|
|
1655
|
}
|
|
1657
|
}
|
|
1656
|
|
|
1658
|
|
|
1657
|
//****************
|
|
1659
|
//****************
|
|
1658
|
// OTHER FUNCTIONS
|
|
1660
|
// OTHER FUNCTIONS
|
|
1659
|
void updateLFRCurrentMode( unsigned char requestedMode )
|
|
1661
|
void updateLFRCurrentMode( unsigned char requestedMode )
|
|
1660
|
{
|
|
1662
|
{
|
|
1661
|
/** This function updates the value of the global variable lfrCurrentMode.
|
|
1663
|
/** This function updates the value of the global variable lfrCurrentMode.
|
|
1662
|
*
|
|
1664
|
*
|
|
1663
|
* lfrCurrentMode is a parameter used by several functions to know in which mode LFR is running.
|
|
1665
|
* lfrCurrentMode is a parameter used by several functions to know in which mode LFR is running.
|
|
1664
|
*
|
|
1666
|
*
|
|
1665
|
*/
|
|
1667
|
*/
|
|
1666
|
|
|
1668
|
|
|
1667
|
// update the local value of lfrCurrentMode with the value contained in the housekeeping_packet structure
|
|
1669
|
// update the local value of lfrCurrentMode with the value contained in the housekeeping_packet structure
|
|
1668
|
housekeeping_packet.lfr_status_word[0] = (housekeeping_packet.lfr_status_word[0] & STATUS_WORD_LFR_MODE_MASK)
|
|
1670
|
housekeeping_packet.lfr_status_word[0] = (housekeeping_packet.lfr_status_word[0] & STATUS_WORD_LFR_MODE_MASK)
|
|
1669
|
+ (unsigned char) ( requestedMode << STATUS_WORD_LFR_MODE_SHIFT );
|
|
1671
|
+ (unsigned char) ( requestedMode << STATUS_WORD_LFR_MODE_SHIFT );
|
|
1670
|
lfrCurrentMode = requestedMode;
|
|
1672
|
lfrCurrentMode = requestedMode;
|
|
1671
|
}
|
|
1673
|
}
|
|
1672
|
|
|
1674
|
|
|
1673
|
void set_lfr_soft_reset( unsigned char value )
|
|
1675
|
void set_lfr_soft_reset( unsigned char value )
|
|
1674
|
{
|
|
1676
|
{
|
|
1675
|
if (value == 1)
|
|
1677
|
if (value == 1)
|
|
1676
|
{
|
|
1678
|
{
|
|
1677
|
time_management_regs->ctrl = time_management_regs->ctrl | BIT_SOFT_RESET; // [0100]
|
|
1679
|
time_management_regs->ctrl = time_management_regs->ctrl | BIT_SOFT_RESET; // [0100]
|
|
1678
|
}
|
|
1680
|
}
|
|
1679
|
else
|
|
1681
|
else
|
|
1680
|
{
|
|
1682
|
{
|
|
1681
|
time_management_regs->ctrl = time_management_regs->ctrl & MASK_SOFT_RESET; // [1011]
|
|
1683
|
time_management_regs->ctrl = time_management_regs->ctrl & MASK_SOFT_RESET; // [1011]
|
|
1682
|
}
|
|
1684
|
}
|
|
1683
|
}
|
|
1685
|
}
|
|
1684
|
|
|
1686
|
|
|
1685
|
void reset_lfr( void )
|
|
1687
|
void reset_lfr( void )
|
|
1686
|
{
|
|
1688
|
{
|
|
1687
|
set_lfr_soft_reset( 1 );
|
|
1689
|
set_lfr_soft_reset( 1 );
|
|
1688
|
|
|
1690
|
|
|
1689
|
set_lfr_soft_reset( 0 );
|
|
1691
|
set_lfr_soft_reset( 0 );
|
|
1690
|
|
|
1692
|
|
|
1691
|
set_hk_lfr_sc_potential_flag( true );
|
|
1693
|
set_hk_lfr_sc_potential_flag( true );
|
|
1692
|
}
|
|
1694
|
}
|