@@ -1,6 +1,6 | |||||
1 | ############################################################################# |
|
1 | ############################################################################# | |
2 | # Makefile for building: bin/fsw |
|
2 | # Makefile for building: bin/fsw | |
3 |
# Generated by qmake (2.01a) (Qt 4.8.5) on: |
|
3 | # Generated by qmake (2.01a) (Qt 4.8.5) on: Fri Oct 25 11:58:08 2013 | |
4 | # Project: fsw-qt.pro |
|
4 | # Project: fsw-qt.pro | |
5 | # Template: app |
|
5 | # Template: app | |
6 | # Command: /usr/bin/qmake-qt4 -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro |
|
6 | # Command: /usr/bin/qmake-qt4 -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro | |
@@ -10,7 +10,7 | |||||
10 |
|
10 | |||
11 | CC = sparc-rtems-gcc |
|
11 | CC = sparc-rtems-gcc | |
12 | CXX = sparc-rtems-g++ |
|
12 | CXX = sparc-rtems-g++ | |
13 |
DEFINES = -DSW_VERSION_N1=0 -DSW_VERSION_N2=0 -DSW_VERSION_N3=0 -DSW_VERSION_N4=16 -DPRINT_MESSAGES_ON_CONSOLE |
|
13 | DEFINES = -DSW_VERSION_N1=0 -DSW_VERSION_N2=0 -DSW_VERSION_N3=0 -DSW_VERSION_N4=16 -DPRINT_MESSAGES_ON_CONSOLE | |
14 | CFLAGS = -pipe -O3 -Wall $(DEFINES) |
|
14 | CFLAGS = -pipe -O3 -Wall $(DEFINES) | |
15 | CXXFLAGS = -pipe -O3 -Wall $(DEFINES) |
|
15 | CXXFLAGS = -pipe -O3 -Wall $(DEFINES) | |
16 | INCPATH = -I/usr/lib64/qt4/mkspecs/linux-g++ -I. -I../src -I../header |
|
16 | INCPATH = -I/usr/lib64/qt4/mkspecs/linux-g++ -I. -I../src -I../header |
1 | NO CONTENT: modified file, binary diff hidden |
|
NO CONTENT: modified file, binary diff hidden |
@@ -1,7 +1,7 | |||||
1 | TEMPLATE = app |
|
1 | TEMPLATE = app | |
2 | # CONFIG += console v8 sim |
|
2 | # CONFIG += console v8 sim | |
3 | # CONFIG options = verbose *** boot_messages *** debug_messages *** cpu_usage_report *** stack_report *** gsa |
|
3 | # CONFIG options = verbose *** boot_messages *** debug_messages *** cpu_usage_report *** stack_report *** gsa | |
4 |
CONFIG += console verbose |
|
4 | CONFIG += console verbose | |
5 | CONFIG -= qt |
|
5 | CONFIG -= qt | |
6 |
|
6 | |||
7 | include(./sparc.pri) |
|
7 | include(./sparc.pri) |
@@ -1,6 +1,6 | |||||
1 | <?xml version="1.0" encoding="UTF-8"?> |
|
1 | <?xml version="1.0" encoding="UTF-8"?> | |
2 | <!DOCTYPE QtCreatorProject> |
|
2 | <!DOCTYPE QtCreatorProject> | |
3 |
<!-- Written by QtCreator 2.8.0, 2013-10-2 |
|
3 | <!-- Written by QtCreator 2.8.0, 2013-10-25T06:57:59. --> | |
4 | <qtcreator> |
|
4 | <qtcreator> | |
5 | <data> |
|
5 | <data> | |
6 | <variable>ProjectExplorer.Project.ActiveTarget</variable> |
|
6 | <variable>ProjectExplorer.Project.ActiveTarget</variable> |
@@ -129,6 +129,7 | |||||
129 | // |
|
129 | // | |
130 | #define TASK_PRIORITY_WTDG 20 |
|
130 | #define TASK_PRIORITY_WTDG 20 | |
131 | // |
|
131 | // | |
|
132 | #define TASK_PRIORITY_RECV 30 | |||
132 | #define TASK_PRIORITY_ACTN 30 |
|
133 | #define TASK_PRIORITY_ACTN 30 | |
133 | // |
|
134 | // | |
134 | #define TASK_PRIORITY_HOUS 40 |
|
135 | #define TASK_PRIORITY_HOUS 40 | |
@@ -136,10 +137,9 | |||||
136 | #define TASK_PRIORITY_CWF2 40 |
|
137 | #define TASK_PRIORITY_CWF2 40 | |
137 | #define TASK_PRIORITY_WFRM 40 |
|
138 | #define TASK_PRIORITY_WFRM 40 | |
138 | #define TASK_PRIORITY_CWF3 40 |
|
139 | #define TASK_PRIORITY_CWF3 40 | |
|
140 | // | |||
139 | #define TASK_PRIORITY_SEND 40 |
|
141 | #define TASK_PRIORITY_SEND 40 | |
140 | // |
|
142 | // | |
141 | #define TASK_PRIORITY_RECV 50 // this priority prevents the blocking of of other tasks in case of link deconnexion |
|
|||
142 | // |
|
|||
143 | #define TASK_PRIORITY_AVF0 60 |
|
143 | #define TASK_PRIORITY_AVF0 60 | |
144 | #define TASK_PRIORITY_BPF0 60 |
|
144 | #define TASK_PRIORITY_BPF0 60 | |
145 | #define TASK_PRIORITY_MATR 100 |
|
145 | #define TASK_PRIORITY_MATR 100 |
@@ -25,6 +25,7 rtems_task wtdg_task( rtems_task_argumen | |||||
25 |
|
25 | |||
26 | int spacewire_open_link( void ); |
|
26 | int spacewire_open_link( void ); | |
27 | int spacewire_start_link( int fd ); |
|
27 | int spacewire_start_link( int fd ); | |
|
28 | int spacewire_stop_start_link( int fd ); | |||
28 | int spacewire_configure_link(int fd ); |
|
29 | int spacewire_configure_link(int fd ); | |
29 | int spacewire_reset_link( void ); |
|
30 | int spacewire_reset_link( void ); | |
30 | void spacewire_set_NP( unsigned char val, unsigned int regAddr ); // No Port force |
|
31 | void spacewire_set_NP( unsigned char val, unsigned int regAddr ); // No Port force |
@@ -88,7 +88,12 rtems_task Init( rtems_task_argument ign | |||||
88 | init_local_mode_parameters(); |
|
88 | init_local_mode_parameters(); | |
89 | init_housekeeping_parameters(); |
|
89 | init_housekeeping_parameters(); | |
90 |
|
90 | |||
|
91 | updateLFRCurrentMode(); | |||
|
92 | ||||
|
93 | BOOT_PRINTF1("in INIT *** lfrCurrentMode is %d\n", lfrCurrentMode) | |||
|
94 | ||||
91 | create_names(); // create all names |
|
95 | create_names(); // create all names | |
|
96 | ||||
92 | status = create_message_queues(); // create message queues |
|
97 | status = create_message_queues(); // create message queues | |
93 | if (status != RTEMS_SUCCESSFUL) |
|
98 | if (status != RTEMS_SUCCESSFUL) | |
94 | { |
|
99 | { | |
@@ -137,13 +142,21 rtems_task Init( rtems_task_argument ign | |||||
137 | PRINTF1("in INIT *** ERR in start_all_tasks, code %d", status) |
|
142 | PRINTF1("in INIT *** ERR in start_all_tasks, code %d", status) | |
138 | } |
|
143 | } | |
139 |
|
144 | |||
|
145 | // start RECV and SEND *AFTER* SpaceWire Initialization, due to the timeout of the start call during the initialization | |||
140 | status = start_recv_send_tasks(); |
|
146 | status = start_recv_send_tasks(); | |
141 | if ( status != RTEMS_SUCCESSFUL ) |
|
147 | if ( status != RTEMS_SUCCESSFUL ) | |
142 | { |
|
148 | { | |
143 | PRINTF1("in INIT *** ERR start_recv_send_tasks code %d\n", status ) |
|
149 | PRINTF1("in INIT *** ERR start_recv_send_tasks code %d\n", status ) | |
144 | } |
|
150 | } | |
145 |
|
151 | |||
146 | status = stop_current_mode(); // go in STANDBY mode |
|
152 | // suspend science tasks. they will be restarted later depending on the mode | |
|
153 | status = suspend_science_tasks(); // suspend science tasks (not done in stop_current_mode if current mode = STANDBY) | |||
|
154 | if (status != RTEMS_SUCCESSFUL) | |||
|
155 | { | |||
|
156 | PRINTF1("in INIT *** in suspend_science_tasks *** ERR code: %d\n", status) | |||
|
157 | } | |||
|
158 | ||||
|
159 | status = stop_current_mode(); // go in STANDBY mode | |||
147 | if (status != RTEMS_SUCCESSFUL) |
|
160 | if (status != RTEMS_SUCCESSFUL) | |
148 | { |
|
161 | { | |
149 | PRINTF1("in INIT *** ERR in stop_current_mode, code %d", status) |
|
162 | PRINTF1("in INIT *** ERR in stop_current_mode, code %d", status) | |
@@ -160,25 +173,13 rtems_task Init( rtems_task_argument ign | |||||
160 | configure_timer((gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_WF_SIMULATOR, CLKDIV_WF_SIMULATOR, |
|
173 | configure_timer((gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_WF_SIMULATOR, CLKDIV_WF_SIMULATOR, | |
161 | IRQ_SPARC_WF, waveforms_simulator_isr ); |
|
174 | IRQ_SPARC_WF, waveforms_simulator_isr ); | |
162 | #else |
|
175 | #else | |
163 | // mask IRQ lines |
|
|||
164 | LEON_Mask_interrupt( IRQ_WAVEFORM_PICKER ); |
|
|||
165 | LEON_Mask_interrupt( IRQ_SPECTRAL_MATRIX ); |
|
|||
166 | // reset configuration registers |
|
|||
167 | reset_waveform_picker_regs(); |
|
|||
168 | reset_spectral_matrix_regs(); |
|
|||
169 | // configure IRQ handling for the waveform picker unit |
|
176 | // configure IRQ handling for the waveform picker unit | |
170 | status = rtems_interrupt_catch( waveforms_isr, |
|
177 | status = rtems_interrupt_catch( waveforms_isr, | |
171 | IRQ_SPARC_WAVEFORM_PICKER, |
|
178 | IRQ_SPARC_WAVEFORM_PICKER, | |
172 | &old_isr_handler) ; |
|
179 | &old_isr_handler) ; | |
173 | // configure IRQ handling for the spectral matrix unit |
|
|||
174 | // status = rtems_interrupt_catch( spectral_matrices_isr, |
|
|||
175 | // IRQ_SPARC_SPECTRAL_MATRIX, |
|
|||
176 | // &old_isr_handler) ; |
|
|||
177 | // Spectral Matrices simulator |
|
|||
178 | configure_timer((gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR, CLKDIV_SM_SIMULATOR, |
|
|||
179 | IRQ_SPARC_SM, spectral_matrices_isr_simu ); |
|
|||
180 | #endif |
|
180 | #endif | |
181 |
|
181 | |||
|
182 | // if the spacewire link is not up then send an event to the SPIQ task for link recovery | |||
182 | if ( status_spw != RTEMS_SUCCESSFUL ) |
|
183 | if ( status_spw != RTEMS_SUCCESSFUL ) | |
183 | { |
|
184 | { | |
184 | status = rtems_event_send( Task_id[TASKID_SPIQ], SPW_LINKERR_EVENT ); |
|
185 | status = rtems_event_send( Task_id[TASKID_SPIQ], SPW_LINKERR_EVENT ); |
@@ -40,32 +40,35 rtems_task spiq_task(rtems_task_argument | |||||
40 | while(true){ |
|
40 | while(true){ | |
41 | rtems_event_receive(SPW_LINKERR_EVENT, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an SPW_LINKERR_EVENT |
|
41 | rtems_event_receive(SPW_LINKERR_EVENT, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an SPW_LINKERR_EVENT | |
42 |
|
42 | |||
43 | // CHECK THE LINK |
|
43 | // [0] SUSPEND RECV ADN SEND TASKS | |
|
44 | rtems_task_suspend( Task_id[ TASKID_RECV ] ); | |||
|
45 | rtems_task_suspend( Task_id[ TASKID_SEND ] ); | |||
|
46 | ||||
|
47 | // [1] CHECK THE LINK | |||
44 | ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status (1) |
|
48 | ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status (1) | |
45 | if ( linkStatus != 5) { |
|
49 | if ( linkStatus != 5) { | |
46 | rtems_task_suspend( Task_id[ TASKID_RECV ] ); |
|
|||
47 | rtems_task_suspend( Task_id[ TASKID_SEND ] ); |
|
|||
48 | PRINTF1("in SPIQ *** linkStatus %d, wait...\n", linkStatus) |
|
50 | PRINTF1("in SPIQ *** linkStatus %d, wait...\n", linkStatus) | |
49 | rtems_task_wake_after( SY_LFR_DPU_CONNECT_TIMEOUT ); // wait SY_LFR_DPU_CONNECT_TIMEOUT 1000 ms |
|
51 | rtems_task_wake_after( SY_LFR_DPU_CONNECT_TIMEOUT ); // wait SY_LFR_DPU_CONNECT_TIMEOUT 1000 ms | |
50 | } |
|
52 | } | |
51 |
|
53 | |||
52 | // RECHECK THE LINK AFTER SY_LFR_DPU_CONNECT_TIMEOUT |
|
54 | // [2] RECHECK THE LINK AFTER SY_LFR_DPU_CONNECT_TIMEOUT | |
53 | ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status (2) |
|
55 | ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status (2) | |
54 | if ( linkStatus != 5 ) // not in run state, reset the link |
|
56 | if ( linkStatus != 5 ) // [2.a] not in run state, reset the link | |
55 | { |
|
57 | { | |
56 | spacewire_compute_stats_offsets(); |
|
58 | spacewire_compute_stats_offsets(); | |
57 | status = spacewire_reset_link( ); |
|
59 | status = spacewire_reset_link( ); | |
58 | } |
|
60 | } | |
59 | else |
|
61 | else // [2.b] in run state, start the link | |
60 | { // in run state, restart the link |
|
62 | { | |
61 |
status = spacewire_start_link( fdSPW ); // |
|
63 | status = spacewire_stop_start_link( fdSPW ); // start the link | |
62 | if ( status != RTEMS_SUCCESSFUL) |
|
64 | if ( status != RTEMS_SUCCESSFUL) | |
63 | { |
|
65 | { | |
64 | PRINTF1("in SPIQ *** ERR spacewire_start_link %d\n", status) |
|
66 | PRINTF1("in SPIQ *** ERR spacewire_start_link %d\n", status) | |
65 | } |
|
67 | } | |
66 | } |
|
68 | } | |
67 |
|
69 | |||
68 | if ( status == RTEMS_SUCCESSFUL ) // the link is in run state and has been started successfully |
|
70 | // [3] COMPLETE RECOVERY ACTION AFTER SY_LFR_DPU_CONNECT_ATTEMPTS | |
|
71 | if ( status == RTEMS_SUCCESSFUL ) // [3.a] the link is in run state and has been started successfully | |||
69 | { |
|
72 | { | |
70 | status = rtems_task_resume( Task_id[ TASKID_SEND ] ); |
|
73 | status = rtems_task_resume( Task_id[ TASKID_SEND ] ); | |
71 | if ( status != RTEMS_SUCCESSFUL ) { |
|
74 | if ( status != RTEMS_SUCCESSFUL ) { | |
@@ -76,7 +79,7 rtems_task spiq_task(rtems_task_argument | |||||
76 | PRINTF("in SPIQ *** ERR resuming RECV Task\n") |
|
79 | PRINTF("in SPIQ *** ERR resuming RECV Task\n") | |
77 | } |
|
80 | } | |
78 | } |
|
81 | } | |
79 | else // if the link is not up after SY_LFR_DPU_CONNECT_ATTEMPT tries, go in STANDBY mode |
|
82 | else // [3.b] the link is not in run state, go in STANDBY mode | |
80 | { |
|
83 | { | |
81 | status = enter_mode( LFR_MODE_STANDBY, NULL ); // enter the STANDBY mode |
|
84 | status = enter_mode( LFR_MODE_STANDBY, NULL ); // enter the STANDBY mode | |
82 | if ( status != RTEMS_SUCCESSFUL ) { |
|
85 | if ( status != RTEMS_SUCCESSFUL ) { | |
@@ -250,7 +253,8 rtems_task wtdg_task( rtems_task_argumen | |||||
250 |
|
253 | |||
251 | BOOT_PRINTF("in WTDG ***\n") |
|
254 | BOOT_PRINTF("in WTDG ***\n") | |
252 |
|
255 | |||
253 |
while(1) |
|
256 | while(1) | |
|
257 | { | |||
254 | // wait for an RTEMS_EVENT |
|
258 | // wait for an RTEMS_EVENT | |
255 | rtems_event_receive( RTEMS_EVENT_0, |
|
259 | rtems_event_receive( RTEMS_EVENT_0, | |
256 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); |
|
260 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); | |
@@ -262,22 +266,29 rtems_task wtdg_task( rtems_task_argumen | |||||
262 | ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status |
|
266 | ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status | |
263 | } |
|
267 | } | |
264 |
|
268 | |||
265 | // if START is not called, subsequent call to read and write will fail |
|
269 | status = spacewire_stop_start_link( fdSPW ); | |
266 | status = ioctl( fdSPW, SPACEWIRE_IOCTRL_START, -1); // returns successfuly if the link is in run state |
|
270 | ||
267 |
if ( |
|
271 | if (status != RTEMS_SUCCESSFUL) | |
268 | { |
|
272 | { | |
269 | PRINTF("in WTDG *** link started\n") |
|
273 | PRINTF1("in WTDG *** ERR link not started %d\n", status) | |
270 | } |
|
274 | } | |
271 | else |
|
275 | else | |
272 | { |
|
276 | { | |
273 |
PRINTF |
|
277 | PRINTF("in WTDG *** OK link started\n") | |
274 | } |
|
278 | } | |
275 |
|
279 | |||
|
280 | // restart the SPIQ task | |||
276 | rtems_task_restart( Task_id[TASKID_SPIQ], 1 ); |
|
281 | rtems_task_restart( Task_id[TASKID_SPIQ], 1 ); | |
277 |
|
282 | |||
278 | rtems_task_resume( Task_id[TASKID_RECV] ); |
|
283 | // resume RECV and SEND | |
279 |
|
284 | status = rtems_task_restart( Task_id[ TASKID_SEND ], 1 ); | ||
280 | rtems_task_resume( Task_id[TASKID_SEND] ); |
|
285 | if ( status != RTEMS_SUCCESSFUL ) { | |
|
286 | PRINTF("in SPIQ *** ERR resuming SEND Task\n") | |||
|
287 | } | |||
|
288 | status = rtems_task_restart( Task_id[ TASKID_RECV ], 1 ); | |||
|
289 | if ( status != RTEMS_SUCCESSFUL ) { | |||
|
290 | PRINTF("in SPIQ *** ERR resuming RECV Task\n") | |||
|
291 | } | |||
281 | } |
|
292 | } | |
282 | } |
|
293 | } | |
283 |
|
294 | |||
@@ -292,7 +303,6 int spacewire_open_link( void ) | |||||
292 | */ |
|
303 | */ | |
293 | rtems_status_code status; |
|
304 | rtems_status_code status; | |
294 |
|
305 | |||
295 | close( fdSPW ); // close the device if it is already open |
|
|||
296 | fdSPW = open(GRSPW_DEVICE_NAME, O_RDWR); // open the device. the open call resets the hardware |
|
306 | fdSPW = open(GRSPW_DEVICE_NAME, O_RDWR); // open the device. the open call resets the hardware | |
297 | if ( fdSPW < 0 ) { |
|
307 | if ( fdSPW < 0 ) { | |
298 | PRINTF1("ERR *** in configure_spw_link *** error opening "GRSPW_DEVICE_NAME" with ERR %d\n", errno) |
|
308 | PRINTF1("ERR *** in configure_spw_link *** error opening "GRSPW_DEVICE_NAME" with ERR %d\n", errno) | |
@@ -309,7 +319,18 int spacewire_start_link( int fd ) | |||||
309 | { |
|
319 | { | |
310 | rtems_status_code status; |
|
320 | rtems_status_code status; | |
311 |
|
321 | |||
312 |
status = ioctl( fdSPW, SPACEWIRE_IOCTRL_START, -1); // returns successfuly if the link is |
|
322 | status = ioctl( fdSPW, SPACEWIRE_IOCTRL_START, -1); // returns successfuly if the link is started | |
|
323 | // -1 default hardcoded driver timeout | |||
|
324 | ||||
|
325 | return status; | |||
|
326 | } | |||
|
327 | ||||
|
328 | int spacewire_stop_start_link( int fd ) | |||
|
329 | { | |||
|
330 | rtems_status_code status; | |||
|
331 | ||||
|
332 | status = ioctl( fdSPW, SPACEWIRE_IOCTRL_STOP); // start fails if link pDev->running != 0 | |||
|
333 | status = ioctl( fdSPW, SPACEWIRE_IOCTRL_START, -1); // returns successfuly if the link is started | |||
313 | // -1 default hardcoded driver timeout |
|
334 | // -1 default hardcoded driver timeout | |
314 |
|
335 | |||
315 | return status; |
|
336 | return status; | |
@@ -374,28 +395,13 int spacewire_reset_link( void ) | |||||
374 | for ( i=0; i<SY_LFR_DPU_CONNECT_ATTEMPT; i++ ) |
|
395 | for ( i=0; i<SY_LFR_DPU_CONNECT_ATTEMPT; i++ ) | |
375 | { |
|
396 | { | |
376 | PRINTF1("in spacewire_reset_link *** link recovery, try %d\n", i); |
|
397 | PRINTF1("in spacewire_reset_link *** link recovery, try %d\n", i); | |
377 | status_spw = spacewire_open_link(); // (1) open the link |
|
398 | ||
378 | if ( status_spw != RTEMS_SUCCESSFUL ) |
|
399 | // CLOSING THE DRIVER AT THIS POINT WILL MAKE THE SEND TASK BLOCK THE SYSTEM | |
379 | { |
|
|||
380 | PRINTF1("in spacewire_reset_link *** ERR spacewire_open_link code %d\n", status_spw) |
|
|||
381 | } |
|
|||
382 |
|
400 | |||
383 | if ( status_spw == RTEMS_SUCCESSFUL ) // (2) configure the link |
|
401 | status_spw = spacewire_stop_start_link( fdSPW ); | |
|
402 | if ( status_spw != RTEMS_SUCCESSFUL ) | |||
384 | { |
|
403 | { | |
385 | status_spw = spacewire_configure_link( fdSPW ); |
|
404 | PRINTF1("in spacewire_reset_link *** ERR spacewire_start_link code %d\n", status_spw) | |
386 | if ( status_spw != RTEMS_SUCCESSFUL ) |
|
|||
387 | { |
|
|||
388 | PRINTF1("in spacewire_reset_link *** ERR spacewire_configure_link code %d\n", status_spw) |
|
|||
389 | } |
|
|||
390 | } |
|
|||
391 |
|
||||
392 | if ( status_spw == RTEMS_SUCCESSFUL) // (3) start the link |
|
|||
393 | { |
|
|||
394 | status_spw = spacewire_start_link( fdSPW ); |
|
|||
395 | if ( status_spw != RTEMS_SUCCESSFUL ) |
|
|||
396 | { |
|
|||
397 | PRINTF1("in spacewire_reset_link *** ERR spacewire_start_link code %d\n", status_spw) |
|
|||
398 | } |
|
|||
399 | } |
|
405 | } | |
400 |
|
406 | |||
401 | if ( status_spw == RTEMS_SUCCESSFUL) |
|
407 | if ( status_spw == RTEMS_SUCCESSFUL) |
@@ -379,21 +379,20 int stop_current_mode() | |||||
379 |
|
379 | |||
380 | status = RTEMS_SUCCESSFUL; |
|
380 | status = RTEMS_SUCCESSFUL; | |
381 |
|
381 | |||
382 | // mask all IRQ lines related to signal processing |
|
|||
383 | LEON_Mask_interrupt( IRQ_SM ); // mask spectral matrices interrupt (coming from the timer VHDL IP) |
|
|||
384 | LEON_Clear_interrupt( IRQ_SM ); // clear spectral matrices interrupt (coming from the timer VHDL IP) |
|
|||
385 |
|
||||
386 | #ifdef GSA |
|
382 | #ifdef GSA | |
387 | LEON_Mask_interrupt( IRQ_WF ); // mask waveform interrupt (coming from the timer VHDL IP) |
|
383 | LEON_Mask_interrupt( IRQ_WF ); // mask waveform interrupt (coming from the timer VHDL IP) | |
388 | LEON_Clear_interrupt( IRQ_WF ); // clear waveform interrupt (coming from the timer VHDL IP) |
|
384 | LEON_Clear_interrupt( IRQ_WF ); // clear waveform interrupt (coming from the timer VHDL IP) | |
389 | timer_stop( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_WF_SIMULATOR ); |
|
385 | timer_stop( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_WF_SIMULATOR ); | |
390 | #else |
|
386 | #else | |
|
387 | // mask interruptions | |||
391 | LEON_Mask_interrupt( IRQ_WAVEFORM_PICKER ); // mask waveform picker interrupt |
|
388 | LEON_Mask_interrupt( IRQ_WAVEFORM_PICKER ); // mask waveform picker interrupt | |
392 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); // clear waveform picker interrupt |
|
|||
393 | LEON_Mask_interrupt( IRQ_SPECTRAL_MATRIX ); // mask spectral matrix interrupt |
|
389 | LEON_Mask_interrupt( IRQ_SPECTRAL_MATRIX ); // mask spectral matrix interrupt | |
394 | LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt |
|
390 | // reset registers | |
395 | LEON_Mask_interrupt( IRQ_SM ); // for SM simulation |
|
391 | reset_wfp_burst_enable(); // reset burst and enable bits | |
396 | LEON_Clear_interrupt( IRQ_SM ); // for SM simulation |
|
392 | reset_wfp_status(); // reset all the status bits | |
|
393 | // creal interruptions | |||
|
394 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); // clear waveform picker interrupt | |||
|
395 | LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectarl matrix interrupt | |||
397 | #endif |
|
396 | #endif | |
398 | //********************** |
|
397 | //********************** | |
399 | // suspend several tasks |
|
398 | // suspend several tasks | |
@@ -406,14 +405,6 int stop_current_mode() | |||||
406 | PRINTF1("in stop_current_mode *** in suspend_science_tasks *** ERR code: %d\n", status) |
|
405 | PRINTF1("in stop_current_mode *** in suspend_science_tasks *** ERR code: %d\n", status) | |
407 | } |
|
406 | } | |
408 |
|
407 | |||
409 | //************************* |
|
|||
410 | // initialize the registers |
|
|||
411 | #ifdef GSA |
|
|||
412 | #else |
|
|||
413 | reset_wfp_burst_enable(); // reset burst and enable bits |
|
|||
414 | reset_wfp_status(); // reset all the status bits |
|
|||
415 | #endif |
|
|||
416 |
|
||||
417 | return status; |
|
408 | return status; | |
418 | } |
|
409 | } | |
419 |
|
410 | |||
@@ -490,17 +481,12 int enter_normal_mode() | |||||
490 | #else |
|
481 | #else | |
491 | //**************** |
|
482 | //**************** | |
492 | // waveform picker |
|
483 | // waveform picker | |
|
484 | reset_waveform_picker_regs(); | |||
|
485 | set_wfp_burst_enable_register(LFR_MODE_NORMAL); | |||
493 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); |
|
486 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); | |
494 | LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER ); |
|
487 | LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER ); | |
495 | reset_waveform_picker_regs(); |
|
|||
496 | set_wfp_burst_enable_register(LFR_MODE_NORMAL); |
|
|||
497 | //**************** |
|
488 | //**************** | |
498 | // spectral matrix |
|
489 | // spectral matrix | |
499 | // set_local_nb_interrupt_f0_MAX(); |
|
|||
500 | // LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); // the IRQ_SM seems to be incompatible with the IRQ_WF on the xilinx board |
|
|||
501 | // LEON_Unmask_interrupt( IRQ_SPECTRAL_MATRIX ); |
|
|||
502 | // spectral_matrix_regs->config = 0x01; |
|
|||
503 | // spectral_matrix_regs->status = 0x00; |
|
|||
504 | #endif |
|
490 | #endif | |
505 |
|
491 | |||
506 | return status; |
|
492 | return status; | |
@@ -515,10 +501,10 int enter_burst_mode() | |||||
515 | #ifdef GSA |
|
501 | #ifdef GSA | |
516 | LEON_Unmask_interrupt( IRQ_SM ); |
|
502 | LEON_Unmask_interrupt( IRQ_SM ); | |
517 | #else |
|
503 | #else | |
|
504 | reset_waveform_picker_regs(); | |||
|
505 | set_wfp_burst_enable_register(LFR_MODE_BURST); | |||
518 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); |
|
506 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); | |
519 | LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER ); |
|
507 | LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER ); | |
520 | reset_waveform_picker_regs(); |
|
|||
521 | set_wfp_burst_enable_register(LFR_MODE_BURST); |
|
|||
522 | #endif |
|
508 | #endif | |
523 |
|
509 | |||
524 | return status; |
|
510 | return status; | |
@@ -537,10 +523,10 int enter_sbm1_mode() | |||||
537 | #ifdef GSA |
|
523 | #ifdef GSA | |
538 | LEON_Unmask_interrupt( IRQ_SM ); |
|
524 | LEON_Unmask_interrupt( IRQ_SM ); | |
539 | #else |
|
525 | #else | |
|
526 | reset_waveform_picker_regs(); | |||
|
527 | set_wfp_burst_enable_register(LFR_MODE_SBM1); | |||
540 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); |
|
528 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); | |
541 | LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER ); |
|
529 | LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER ); | |
542 | reset_waveform_picker_regs(); |
|
|||
543 | set_wfp_burst_enable_register(LFR_MODE_SBM1); |
|
|||
544 | // SM simulation |
|
530 | // SM simulation | |
545 | // timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR ); |
|
531 | // timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR ); | |
546 | // LEON_Clear_interrupt( IRQ_SM ); // the IRQ_SM seems to be incompatible with the IRQ_WF on the xilinx board |
|
532 | // LEON_Clear_interrupt( IRQ_SM ); // the IRQ_SM seems to be incompatible with the IRQ_WF on the xilinx board | |
@@ -563,10 +549,10 int enter_sbm2_mode() | |||||
563 | #ifdef GSA |
|
549 | #ifdef GSA | |
564 | LEON_Unmask_interrupt( IRQ_SM ); |
|
550 | LEON_Unmask_interrupt( IRQ_SM ); | |
565 | #else |
|
551 | #else | |
|
552 | reset_waveform_picker_regs(); | |||
|
553 | set_wfp_burst_enable_register(LFR_MODE_SBM2); | |||
566 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); |
|
554 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); | |
567 | LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER ); |
|
555 | LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER ); | |
568 | reset_waveform_picker_regs(); |
|
|||
569 | set_wfp_burst_enable_register(LFR_MODE_SBM2); |
|
|||
570 | #endif |
|
556 | #endif | |
571 |
|
557 | |||
572 | return status; |
|
558 | return status; | |
@@ -642,6 +628,7 int suspend_science_tasks() | |||||
642 | { |
|
628 | { | |
643 | PRINTF1("in suspend_science_task *** AVF0 ERR %d\n", status) |
|
629 | PRINTF1("in suspend_science_task *** AVF0 ERR %d\n", status) | |
644 | } |
|
630 | } | |
|
631 | ||||
645 | if (status == RTEMS_SUCCESSFUL) // suspend BPF0 |
|
632 | if (status == RTEMS_SUCCESSFUL) // suspend BPF0 | |
646 | { |
|
633 | { | |
647 | status = rtems_task_suspend( Task_id[TASKID_BPF0] ); |
|
634 | status = rtems_task_suspend( Task_id[TASKID_BPF0] ); | |
@@ -650,6 +637,7 int suspend_science_tasks() | |||||
650 | PRINTF1("in suspend_science_task *** BPF0 ERR %d\n", status) |
|
637 | PRINTF1("in suspend_science_task *** BPF0 ERR %d\n", status) | |
651 | } |
|
638 | } | |
652 | } |
|
639 | } | |
|
640 | ||||
653 | if (status == RTEMS_SUCCESSFUL) // suspend WFRM |
|
641 | if (status == RTEMS_SUCCESSFUL) // suspend WFRM | |
654 | { |
|
642 | { | |
655 | status = rtems_task_suspend( Task_id[TASKID_WFRM] ); |
|
643 | status = rtems_task_suspend( Task_id[TASKID_WFRM] ); | |
@@ -667,6 +655,7 int suspend_science_tasks() | |||||
667 | PRINTF1("in suspend_science_task *** CWF3 ERR %d\n", status) |
|
655 | PRINTF1("in suspend_science_task *** CWF3 ERR %d\n", status) | |
668 | } |
|
656 | } | |
669 | } |
|
657 | } | |
|
658 | ||||
670 | if (status == RTEMS_SUCCESSFUL) // suspend CWF2 |
|
659 | if (status == RTEMS_SUCCESSFUL) // suspend CWF2 | |
671 | { |
|
660 | { | |
672 | status = rtems_task_suspend( Task_id[TASKID_CWF2] ); |
|
661 | status = rtems_task_suspend( Task_id[TASKID_CWF2] ); | |
@@ -675,6 +664,7 int suspend_science_tasks() | |||||
675 | PRINTF1("in suspend_science_task *** CWF2 ERR %d\n", status) |
|
664 | PRINTF1("in suspend_science_task *** CWF2 ERR %d\n", status) | |
676 | } |
|
665 | } | |
677 | } |
|
666 | } | |
|
667 | ||||
678 | if (status == RTEMS_SUCCESSFUL) // suspend CWF1 |
|
668 | if (status == RTEMS_SUCCESSFUL) // suspend CWF1 | |
679 | { |
|
669 | { | |
680 | status = rtems_task_suspend( Task_id[TASKID_CWF1] ); |
|
670 | status = rtems_task_suspend( Task_id[TASKID_CWF1] ); |
@@ -253,7 +253,7 int set_sy_lfr_n_swf_l( ccsdsTelecommand | |||||
253 | ) * 16; |
|
253 | ) * 16; | |
254 |
|
254 | |||
255 | if ( (tmp < 16) || (tmp > 2048) ) // the snapshot period is a multiple of 16 |
|
255 | if ( (tmp < 16) || (tmp > 2048) ) // the snapshot period is a multiple of 16 | |
256 | { // 2048 is the maximum limit due to thesize of the buffers |
|
256 | { // 2048 is the maximum limit due to the size of the buffers | |
257 | send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_SY_LFR_N_SWF_L+10, lsb ); |
|
257 | send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_SY_LFR_N_SWF_L+10, lsb ); | |
258 | result = WRONG_APP_DATA; |
|
258 | result = WRONG_APP_DATA; | |
259 | } |
|
259 | } |
@@ -77,7 +77,8 rtems_isr waveforms_isr( rtems_vector_nu | |||||
77 | if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) { |
|
77 | if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) { | |
78 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
78 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); | |
79 | } |
|
79 | } | |
80 | waveform_picker_regs->status = waveform_picker_regs->status & 0x00; |
|
80 | // waveform_picker_regs->status = waveform_picker_regs->status & 0x00; | |
|
81 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffff888; | |||
81 | waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable | 0x07; // [0111] enable f2 f1 f0 |
|
82 | waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable | 0x07; // [0111] enable f2 f1 f0 | |
82 | } |
|
83 | } | |
83 | } |
|
84 | } | |
@@ -1069,8 +1070,8 void reset_waveform_picker_regs() | |||||
1069 |
|
1070 | |||
1070 | #ifdef GSA |
|
1071 | #ifdef GSA | |
1071 | #else |
|
1072 | #else | |
|
1073 | reset_wfp_burst_enable(); | |||
1072 | set_wfp_data_shaping(); |
|
1074 | set_wfp_data_shaping(); | |
1073 | reset_wfp_burst_enable(); |
|
|||
1074 | waveform_picker_regs->addr_data_f0 = (int) (wf_snap_f0); // |
|
1075 | waveform_picker_regs->addr_data_f0 = (int) (wf_snap_f0); // | |
1075 | waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1); // |
|
1076 | waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1); // | |
1076 | waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2); // |
|
1077 | waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2); // | |
@@ -1080,7 +1081,7 void reset_waveform_picker_regs() | |||||
1080 | waveform_picker_regs->delta_f2_f0 = 0x17c00; // 97 280 (max 5 bytes) |
|
1081 | waveform_picker_regs->delta_f2_f0 = 0x17c00; // 97 280 (max 5 bytes) | |
1081 | waveform_picker_regs->nb_burst_available = 0x180; // max 3 bytes, size of the buffer in burst (1 burst = 16 x 4 octets) |
|
1082 | waveform_picker_regs->nb_burst_available = 0x180; // max 3 bytes, size of the buffer in burst (1 burst = 16 x 4 octets) | |
1082 | waveform_picker_regs->nb_snapshot_param = 0x7ff; // max 3 octets, 2048 - 1 |
|
1083 | waveform_picker_regs->nb_snapshot_param = 0x7ff; // max 3 octets, 2048 - 1 | |
1083 | waveform_picker_regs->status = 0x00; // |
|
1084 | reset_wfp_status(); | |
1084 | #endif |
|
1085 | #endif | |
1085 | } |
|
1086 | } | |
1086 |
|
1087 |
General Comments 0
You need to be logged in to leave comments.
Login now