##// END OF EJS Templates
rev 1.0.0.3
paul -
r109:be3fd1d0953f VHDLib206
parent child
Show More
@@ -1,6 +1,6
1 1 #############################################################################
2 2 # Makefile for building: bin/fsw
3 # Generated by qmake (2.01a) (Qt 4.8.5) on: Tue Mar 25 09:47:02 2014
3 # Generated by qmake (2.01a) (Qt 4.8.5) on: Thu Mar 27 13:16:57 2014
4 4 # Project: fsw-qt.pro
5 5 # Template: app
6 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 11 CC = sparc-rtems-gcc
12 12 CXX = sparc-rtems-g++
13 DEFINES = -DSW_VERSION_N1=1 -DSW_VERSION_N2=0 -DSW_VERSION_N3=0 -DSW_VERSION_N4=3 -DVHDL_DEV -DPRINT_MESSAGES_ON_CONSOLE
13 DEFINES = -DSW_VERSION_N1=1 -DSW_VERSION_N2=0 -DSW_VERSION_N3=0 -DSW_VERSION_N4=3 -DPRINT_MESSAGES_ON_CONSOLE
14 14 CFLAGS = -pipe -O3 -Wall $(DEFINES)
15 15 CXXFLAGS = -pipe -O3 -Wall $(DEFINES)
16 16 INCPATH = -I/usr/lib64/qt4/mkspecs/linux-g++ -I. -I../src -I../header -I../../LFR_basic-parameters
@@ -1,7 +1,7
1 1 TEMPLATE = app
2 2 # CONFIG += console v8 sim
3 3 # CONFIG options = verbose *** boot_messages *** debug_messages *** cpu_usage_report *** stack_report *** vhdl_dev *** debug_tch
4 CONFIG += console verbose vhdl_dev
4 CONFIG += console verbose
5 5 CONFIG -= qt
6 6
7 7 include(./sparc.pri)
@@ -1,6 +1,6
1 1 <?xml version="1.0" encoding="UTF-8"?>
2 2 <!DOCTYPE QtCreatorProject>
3 <!-- Written by QtCreator 3.0.1, 2014-03-25T08:40:48. -->
3 <!-- Written by QtCreator 3.0.1, 2014-03-27T07:16:29. -->
4 4 <qtcreator>
5 5 <data>
6 6 <variable>ProjectExplorer.Project.ActiveTarget</variable>
@@ -24,17 +24,18 rtems_task actn_task( rtems_task_argumen
24 24
25 25 //***********
26 26 // TC ACTIONS
27 int action_reset(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time);
28 int action_enter_mode(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time);
29 int action_update_info(ccsdsTelecommandPacket_t *TC, rtems_id queue_id);
30 int action_enable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time);
31 int action_disable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time);
32 int action_update_time(ccsdsTelecommandPacket_t *TC);
27 int action_reset( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time );
28 int action_enter_mode( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time );
29 int action_update_info( ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
30 int action_enable_calibration( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time );
31 int action_disable_calibration( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time );
32 int action_update_time( ccsdsTelecommandPacket_t *TC);
33 33
34 34 // mode transition
35 int transition_validation(unsigned char requestedMode);
35 int check_mode_value( unsigned char requestedMode );
36 int check_mode_transition( unsigned char requestedMode );
36 37 int stop_current_mode( void );
37 int enter_mode(unsigned char mode);
38 int enter_mode( unsigned char mode );
38 39 int restart_science_tasks();
39 40 int suspend_science_tasks();
40 41 void launch_waveform_picker( unsigned char mode );
@@ -252,7 +252,7 rtems_task dumb_task( rtems_task_argumen
252 252 unsigned int fine_time = 0;
253 253 rtems_event_set event_out;
254 254
255 char *DumbMessages[9] = {"in DUMB *** default", // RTEMS_EVENT_0
255 char *DumbMessages[10] = {"in DUMB *** default", // RTEMS_EVENT_0
256 256 "in DUMB *** timecode_irq_handler", // RTEMS_EVENT_1
257 257 "in DUMB *** waveforms_isr", // RTEMS_EVENT_2
258 258 "in DUMB *** in SMIQ *** Error sending event to AVF0", // RTEMS_EVENT_3
@@ -260,7 +260,8 rtems_task dumb_task( rtems_task_argumen
260 260 "in DUMB *** waveforms_simulator_isr", // RTEMS_EVENT_5
261 261 "ERR HK", // RTEMS_EVENT_6
262 262 "ready for dump", // RTEMS_EVENT_7
263 "in DUMB *** spectral_matrices_isr" // RTEMS_EVENT_8
263 "in DUMB *** spectral_matrices_isr", // RTEMS_EVENT_8
264 "tick" // RTEMS_EVENT_9
264 265 };
265 266
266 267 BOOT_PRINTF("in DUMB *** \n")
@@ -268,7 +269,7 rtems_task dumb_task( rtems_task_argumen
268 269 while(1){
269 270 rtems_event_receive(RTEMS_EVENT_0 | RTEMS_EVENT_1 | RTEMS_EVENT_2 | RTEMS_EVENT_3
270 271 | RTEMS_EVENT_4 | RTEMS_EVENT_5 | RTEMS_EVENT_6 | RTEMS_EVENT_7
271 | RTEMS_EVENT_8,
272 | RTEMS_EVENT_8 | RTEMS_EVENT_9,
272 273 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT
273 274 intEventOut = (unsigned int) event_out;
274 275 for ( i=0; i<32; i++)
@@ -580,7 +580,7 void spacewire_update_statistics( void )
580 580
581 581 void timecode_irq_handler( void *pDev, void *regs, int minor, unsigned int tc )
582 582 {
583 // rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_1 );
583 // rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_9 );
584 584 struct grgpio_regs_str *grgpio_regs = (struct grgpio_regs_str *) REGS_ADDR_GRGPIO;
585 585
586 586 grgpio_regs->io_port_direction_register =
@@ -594,7 +594,6 void timecode_irq_handler( void *pDev, v
594 594 {
595 595 grgpio_regs->io_port_output_register = grgpio_regs->io_port_output_register | 0x08;
596 596 }
597
598 597 }
599 598
600 599 rtems_timer_service_routine user_routine( rtems_id timer_id, void *user_data )
@@ -163,33 +163,23 int action_enter_mode(ccsdsTelecommandPa
163 163
164 164 requestedMode = TC->dataAndCRC[1];
165 165
166 if ( (requestedMode != LFR_MODE_STANDBY)
167 && (requestedMode != LFR_MODE_NORMAL) && (requestedMode != LFR_MODE_BURST)
168 && (requestedMode != LFR_MODE_SBM1) && (requestedMode != LFR_MODE_SBM2) )
166 status = check_mode_value( requestedMode );
167 if ( status != LFR_SUCCESSFUL )
169 168 {
170 status = RTEMS_UNSATISFIED;
171 169 send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_CP_LFR_MODE, requestedMode );
172 170 }
173 171 else
174 172 {
175 printf("in action_enter_mode *** enter mode %d\n", requestedMode);
176
177 status = transition_validation(requestedMode);
173 status = check_mode_transition(requestedMode);
178 174
179 if ( status == LFR_SUCCESSFUL ) {
180 if ( lfrCurrentMode != LFR_MODE_STANDBY)
181 {
182 status = stop_current_mode();
183 }
184 if (status != RTEMS_SUCCESSFUL)
185 {
186 PRINTF("ERR *** in action_enter *** stop_current_mode\n")
187 }
175 if ( status == LFR_SUCCESSFUL )
176 {
177 PRINTF1("OK *** in action_enter_mode *** enter mode %d\n", requestedMode);
188 178 status = enter_mode( requestedMode );
189 179 }
190 180 else
191 181 {
192 PRINTF("ERR *** in action_enter *** transition rejected\n")
182 PRINTF("ERR *** in action_enter_mode *** transition rejected\n")
193 183 send_tm_lfr_tc_exe_not_executable( TC, queue_id );
194 184 }
195 185 }
@@ -301,6 +291,9 int action_update_time(ccsdsTelecommandP
301 291 + (TC->dataAndCRC[1] << 16)
302 292 + (TC->dataAndCRC[2] << 8)
303 293 + TC->dataAndCRC[3];
294
295 PRINTF1("time received: %x\n", time_management_regs->coarse_time_load)
296
304 297 val = housekeeping_packet.hk_lfr_update_time_tc_cnt[0] * 256
305 298 + housekeeping_packet.hk_lfr_update_time_tc_cnt[1];
306 299 val++;
@@ -313,8 +306,25 int action_update_time(ccsdsTelecommandP
313 306
314 307 //*******************
315 308 // ENTERING THE MODES
309 int check_mode_value( unsigned char requestedMode )
310 {
311 int status;
316 312
317 int transition_validation(unsigned char requestedMode)
313 if ( (requestedMode != LFR_MODE_STANDBY)
314 && (requestedMode != LFR_MODE_NORMAL) && (requestedMode != LFR_MODE_BURST)
315 && (requestedMode != LFR_MODE_SBM1) && (requestedMode != LFR_MODE_SBM2) )
316 {
317 status = LFR_DEFAULT;
318 }
319 else
320 {
321 status = LFR_SUCCESSFUL;
322 }
323
324 return status;
325 }
326
327 int check_mode_transition( unsigned char requestedMode )
318 328 {
319 329 /** This function checks the validity of the transition requested by the TC_LFR_ENTER_MODE.
320 330 *
@@ -379,7 +389,7 int transition_validation(unsigned char
379 389 return status;
380 390 }
381 391
382 int stop_current_mode(void)
392 int stop_current_mode( void )
383 393 {
384 394 /** This function stops the current mode by masking interrupt lines and suspending science tasks.
385 395 *
@@ -430,7 +440,7 int stop_current_mode(void)
430 440 return status;
431 441 }
432 442
433 int enter_mode(unsigned char mode )
443 int enter_mode( unsigned char mode )
434 444 {
435 445 /** This function is launched after a mode transition validation.
436 446 *
@@ -444,11 +454,16 int enter_mode(unsigned char mode )
444 454
445 455 rtems_status_code status;
446 456
447 status = RTEMS_UNSATISFIED;
457 //**********************
458 // STOP THE CURRENT MODE
459 status = stop_current_mode();
460 if (status != RTEMS_SUCCESSFUL)
461 {
462 PRINTF1("ERR *** in enter_mode *** stop_current_mode with mode = %d\n", mode)
463 }
448 464
449 housekeeping_packet.lfr_status_word[0] = (unsigned char) ((mode << 4) + 0x0d);
450 updateLFRCurrentMode();
451
465 //*************************
466 // ENTER THE REQUESTED MODE
452 467 if ( (mode == LFR_MODE_NORMAL) || (mode == LFR_MODE_BURST)
453 468 || (mode == LFR_MODE_SBM1) || (mode == LFR_MODE_SBM2) )
454 469 {
@@ -458,7 +473,7 int enter_mode(unsigned char mode )
458 473 #endif
459 474 status = restart_science_tasks();
460 475 launch_waveform_picker( mode );
461 launch_spectral_matrix( mode );
476 // launch_spectral_matrix( mode );
462 477 }
463 478 else if ( mode == LFR_MODE_STANDBY )
464 479 {
@@ -469,7 +484,6 int enter_mode(unsigned char mode )
469 484 #ifdef PRINT_STACK_REPORT
470 485 rtems_stack_checker_report_usage();
471 486 #endif
472 status = stop_current_mode();
473 487 PRINTF1("maxCount = %d\n", maxCount)
474 488 }
475 489 else
@@ -479,7 +493,7 int enter_mode(unsigned char mode )
479 493
480 494 if (status != RTEMS_SUCCESSFUL)
481 495 {
482 PRINTF1("in enter_mode *** ERR = %d\n", status)
496 PRINTF1("ERR *** in enter_mode *** status = %d\n", status)
483 497 status = RTEMS_UNSATISFIED;
484 498 }
485 499
@@ -625,6 +639,10 void launch_spectral_matrix( unsigned ch
625 639 reset_spectral_matrix_regs();
626 640
627 641 #ifdef VHDL_DEV
642 struct grgpio_regs_str *grgpio_regs = (struct grgpio_regs_str *) REGS_ADDR_GRGPIO;
643 grgpio_regs->io_port_direction_register =
644 grgpio_regs->io_port_direction_register | 0x01; // [0001 1000], 0 = output disabled, 1 = output enabled
645 grgpio_regs->io_port_output_register = grgpio_regs->io_port_output_register | 0x01; // set the bit 0 to 1
628 646 set_irq_on_new_ready_matrix( 1 );
629 647 LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX );
630 648 LEON_Unmask_interrupt( IRQ_SPECTRAL_MATRIX );
@@ -747,6 +765,8 void close_action(ccsdsTelecommandPacket
747 765 *
748 766 */
749 767
768 unsigned char requestedMode;
769
750 770 if (result == LFR_SUCCESSFUL)
751 771 {
752 772 if ( !( (TC->serviceType==TC_TYPE_TIME) & (TC->serviceSubType==TC_SUBTYPE_UPDT_TIME) )
@@ -756,6 +776,14 void close_action(ccsdsTelecommandPacket
756 776 {
757 777 send_tm_lfr_tc_exe_success( TC, queue_id );
758 778 }
779 if ( (TC->serviceType == TC_TYPE_GEN) & (TC->serviceSubType == TC_SUBTYPE_ENTER) )
780 {
781 //**********************************
782 // UPDATE THE LFRMODE LOCAL VARIABLE
783 requestedMode = TC->dataAndCRC[1];
784 housekeeping_packet.lfr_status_word[0] = (unsigned char) ((requestedMode << 4) + 0x0d);
785 updateLFRCurrentMode();
786 }
759 787 }
760 788 }
761 789
General Comments 0
You need to be logged in to leave comments. Login now