@@ -1,2 +1,2 | |||||
1 | 3081d1f9bb20b2b64a192585337a292a9804e0c5 LFR_basic-parameters |
|
1 | 3081d1f9bb20b2b64a192585337a292a9804e0c5 LFR_basic-parameters | |
2 | 084fd0db5e4139a1096789935e32ef498192f395 header/lfr_common_headers |
|
2 | 80d727bb9d808ae67c801c4c6101811d68b94af6 header/lfr_common_headers |
@@ -22,7 +22,7 extern rtems_id timecode_timer_id; | |||||
22 | rtems_task spiq_task( rtems_task_argument argument ); |
|
22 | rtems_task spiq_task( rtems_task_argument argument ); | |
23 | rtems_task recv_task( rtems_task_argument unused ); |
|
23 | rtems_task recv_task( rtems_task_argument unused ); | |
24 | rtems_task send_task( rtems_task_argument argument ); |
|
24 | rtems_task send_task( rtems_task_argument argument ); | |
25 |
rtems_task |
|
25 | rtems_task link_task( rtems_task_argument argument ); | |
26 |
|
26 | |||
27 | int spacewire_open_link( void ); |
|
27 | int spacewire_open_link( void ); | |
28 | int spacewire_start_link( int fd ); |
|
28 | int spacewire_start_link( int fd ); |
@@ -39,7 +39,7 void update_last_valid_transition_date( | |||||
39 | int check_transition_date( unsigned int transitionCoarseTime ); |
|
39 | int check_transition_date( unsigned int transitionCoarseTime ); | |
40 | int stop_spectral_matrices( void ); |
|
40 | int stop_spectral_matrices( void ); | |
41 | int stop_current_mode( void ); |
|
41 | int stop_current_mode( void ); | |
42 |
int enter_mode_standby( |
|
42 | int enter_mode_standby(void ); | |
43 | int enter_mode_normal( unsigned int transitionCoarseTime ); |
|
43 | int enter_mode_normal( unsigned int transitionCoarseTime ); | |
44 | int enter_mode_burst( unsigned int transitionCoarseTime ); |
|
44 | int enter_mode_burst( unsigned int transitionCoarseTime ); | |
45 | int enter_mode_sbm1( unsigned int transitionCoarseTime ); |
|
45 | int enter_mode_sbm1( unsigned int transitionCoarseTime ); | |
@@ -54,7 +54,7 void set_sm_irq_onNewMatrix( unsigned ch | |||||
54 | void set_sm_irq_onError( unsigned char value ); |
|
54 | void set_sm_irq_onError( unsigned char value ); | |
55 |
|
55 | |||
56 | // other functions |
|
56 | // other functions | |
57 | void updateLFRCurrentMode(); |
|
57 | void updateLFRCurrentMode(unsigned char requestedMode); | |
58 | void set_lfr_soft_reset( unsigned char value ); |
|
58 | void set_lfr_soft_reset( unsigned char value ); | |
59 | void reset_lfr( void ); |
|
59 | void reset_lfr( void ); | |
60 | // CALIBRATION |
|
60 | // CALIBRATION |
@@ -35,7 +35,7 | |||||
35 | #define CONFIGURE_INIT_TASK_ATTRIBUTES (RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT) |
|
35 | #define CONFIGURE_INIT_TASK_ATTRIBUTES (RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT) | |
36 | #define CONFIGURE_MAXIMUM_DRIVERS 16 |
|
36 | #define CONFIGURE_MAXIMUM_DRIVERS 16 | |
37 | #define CONFIGURE_MAXIMUM_PERIODS 5 |
|
37 | #define CONFIGURE_MAXIMUM_PERIODS 5 | |
38 |
#define CONFIGURE_MAXIMUM_TIMERS 5 // [spiq] [ |
|
38 | #define CONFIGURE_MAXIMUM_TIMERS 5 // [spiq] [link] [spacewire_reset_link] | |
39 | #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 5 |
|
39 | #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 5 | |
40 | #ifdef PRINT_STACK_REPORT |
|
40 | #ifdef PRINT_STACK_REPORT | |
41 | #define CONFIGURE_STACK_CHECKER_ENABLED |
|
41 | #define CONFIGURE_STACK_CHECKER_ENABLED | |
@@ -172,7 +172,7 rtems_task Init( rtems_task_argument ign | |||||
172 | // configure calibration |
|
172 | // configure calibration | |
173 | configureCalibration( false ); // true means interleaved mode, false is for normal mode |
|
173 | configureCalibration( false ); // true means interleaved mode, false is for normal mode | |
174 |
|
174 | |||
175 | updateLFRCurrentMode(); |
|
175 | updateLFRCurrentMode( LFR_MODE_STANDBY ); | |
176 |
|
176 | |||
177 | BOOT_PRINTF1("in INIT *** lfrCurrentMode is %d\n", lfrCurrentMode) |
|
177 | BOOT_PRINTF1("in INIT *** lfrCurrentMode is %d\n", lfrCurrentMode) | |
178 |
|
178 | |||
@@ -327,7 +327,7 void create_names( void ) // create all | |||||
327 | Task_name[TASKID_CWF2] = rtems_build_name( 'C', 'W', 'F', '2' ); |
|
327 | Task_name[TASKID_CWF2] = rtems_build_name( 'C', 'W', 'F', '2' ); | |
328 | Task_name[TASKID_CWF1] = rtems_build_name( 'C', 'W', 'F', '1' ); |
|
328 | Task_name[TASKID_CWF1] = rtems_build_name( 'C', 'W', 'F', '1' ); | |
329 | Task_name[TASKID_SEND] = rtems_build_name( 'S', 'E', 'N', 'D' ); |
|
329 | Task_name[TASKID_SEND] = rtems_build_name( 'S', 'E', 'N', 'D' ); | |
330 |
Task_name[TASKID_ |
|
330 | Task_name[TASKID_LINK] = rtems_build_name( 'L', 'I', 'N', 'K' ); | |
331 | Task_name[TASKID_AVF1] = rtems_build_name( 'A', 'V', 'F', '1' ); |
|
331 | Task_name[TASKID_AVF1] = rtems_build_name( 'A', 'V', 'F', '1' ); | |
332 | Task_name[TASKID_PRC1] = rtems_build_name( 'P', 'R', 'C', '1' ); |
|
332 | Task_name[TASKID_PRC1] = rtems_build_name( 'P', 'R', 'C', '1' ); | |
333 | Task_name[TASKID_AVF2] = rtems_build_name( 'A', 'V', 'F', '2' ); |
|
333 | Task_name[TASKID_AVF2] = rtems_build_name( 'A', 'V', 'F', '2' ); | |
@@ -379,12 +379,12 int create_all_tasks( void ) // create a | |||||
379 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_SEND] |
|
379 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_SEND] | |
380 | ); |
|
380 | ); | |
381 | } |
|
381 | } | |
382 |
if (status == RTEMS_SUCCESSFUL) // |
|
382 | if (status == RTEMS_SUCCESSFUL) // LINK | |
383 | { |
|
383 | { | |
384 | status = rtems_task_create( |
|
384 | status = rtems_task_create( | |
385 |
Task_name[TASKID_ |
|
385 | Task_name[TASKID_LINK], TASK_PRIORITY_LINK, RTEMS_MINIMUM_STACK_SIZE, | |
386 | RTEMS_DEFAULT_MODES, |
|
386 | RTEMS_DEFAULT_MODES, | |
387 |
RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_ |
|
387 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_LINK] | |
388 | ); |
|
388 | ); | |
389 | } |
|
389 | } | |
390 | if (status == RTEMS_SUCCESSFUL) // ACTN |
|
390 | if (status == RTEMS_SUCCESSFUL) // ACTN | |
@@ -571,11 +571,11 int start_all_tasks( void ) // start all | |||||
571 | BOOT_PRINTF("in INIT *** Error starting TASK_SPIQ\n") |
|
571 | BOOT_PRINTF("in INIT *** Error starting TASK_SPIQ\n") | |
572 | } |
|
572 | } | |
573 |
|
573 | |||
574 |
if (status == RTEMS_SUCCESSFUL) // |
|
574 | if (status == RTEMS_SUCCESSFUL) // LINK | |
575 | { |
|
575 | { | |
576 |
status = rtems_task_start( Task_id[TASKID_ |
|
576 | status = rtems_task_start( Task_id[TASKID_LINK], link_task, 1 ); | |
577 | if (status!=RTEMS_SUCCESSFUL) { |
|
577 | if (status!=RTEMS_SUCCESSFUL) { | |
578 |
BOOT_PRINTF("in INIT *** Error starting TASK_ |
|
578 | BOOT_PRINTF("in INIT *** Error starting TASK_LINK\n") | |
579 | } |
|
579 | } | |
580 | } |
|
580 | } | |
581 |
|
581 |
@@ -97,8 +97,11 rtems_task spiq_task(rtems_task_argument | |||||
97 | { |
|
97 | { | |
98 | PRINTF1("in SPIQ *** ERR enter_standby_mode *** code %d\n", status) |
|
98 | PRINTF1("in SPIQ *** ERR enter_standby_mode *** code %d\n", status) | |
99 | } |
|
99 | } | |
100 | // wake the WTDG task up to wait for the link recovery |
|
100 | { | |
101 | status = rtems_event_send ( Task_id[TASKID_WTDG], RTEMS_EVENT_0 ); |
|
101 | updateLFRCurrentMode( LFR_MODE_STANDBY ); | |
|
102 | } | |||
|
103 | // wake the LINK task up to wait for the link recovery | |||
|
104 | status = rtems_event_send ( Task_id[TASKID_LINK], RTEMS_EVENT_0 ); | |||
102 | status = rtems_task_suspend( RTEMS_SELF ); |
|
105 | status = rtems_task_suspend( RTEMS_SELF ); | |
103 | } |
|
106 | } | |
104 | } |
|
107 | } | |
@@ -327,20 +330,20 rtems_task send_task( rtems_task_argumen | |||||
327 | } |
|
330 | } | |
328 | } |
|
331 | } | |
329 |
|
332 | |||
330 |
rtems_task |
|
333 | rtems_task link_task( rtems_task_argument argument ) | |
331 | { |
|
334 | { | |
332 | rtems_event_set event_out; |
|
335 | rtems_event_set event_out; | |
333 | rtems_status_code status; |
|
336 | rtems_status_code status; | |
334 | int linkStatus; |
|
337 | int linkStatus; | |
335 |
|
338 | |||
336 |
BOOT_PRINTF("in |
|
339 | BOOT_PRINTF("in LINK ***\n") | |
337 |
|
340 | |||
338 | while(1) |
|
341 | while(1) | |
339 | { |
|
342 | { | |
340 | // wait for an RTEMS_EVENT |
|
343 | // wait for an RTEMS_EVENT | |
341 | rtems_event_receive( RTEMS_EVENT_0, |
|
344 | rtems_event_receive( RTEMS_EVENT_0, | |
342 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); |
|
345 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); | |
343 |
PRINTF("in |
|
346 | PRINTF("in LINK *** wait for the link\n") | |
344 | status = ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status |
|
347 | status = ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status | |
345 | while( linkStatus != 5) // wait for the link |
|
348 | while( linkStatus != 5) // wait for the link | |
346 | { |
|
349 | { | |
@@ -352,11 +355,11 rtems_task wtdg_task( rtems_task_argumen | |||||
352 |
|
355 | |||
353 | if (status != RTEMS_SUCCESSFUL) |
|
356 | if (status != RTEMS_SUCCESSFUL) | |
354 | { |
|
357 | { | |
355 |
PRINTF1("in |
|
358 | PRINTF1("in LINK *** ERR link not started %d\n", status) | |
356 | } |
|
359 | } | |
357 | else |
|
360 | else | |
358 | { |
|
361 | { | |
359 |
PRINTF("in |
|
362 | PRINTF("in LINK *** OK link started\n") | |
360 | } |
|
363 | } | |
361 |
|
364 | |||
362 | // restart the SPIQ task |
|
365 | // restart the SPIQ task |
@@ -195,10 +195,8 int action_enter_mode(ccsdsTelecommandPa | |||||
195 | status = check_transition_date( transitionCoarseTime ); |
|
195 | status = check_transition_date( transitionCoarseTime ); | |
196 | if (status != LFR_SUCCESSFUL) |
|
196 | if (status != LFR_SUCCESSFUL) | |
197 | { |
|
197 | { | |
198 | PRINTF("ERR *** in action_enter_mode *** check_transition_date\n") |
|
198 | PRINTF("ERR *** in action_enter_mode *** check_transition_date\n"); | |
199 |
|
|
199 | send_tm_lfr_tc_exe_not_executable(TC, queue_id ); | |
200 | BYTE_POS_CP_LFR_ENTER_MODE_TIME, |
|
|||
201 | bytePosPtr[ BYTE_POS_CP_LFR_ENTER_MODE_TIME + 3 ] ); |
|
|||
202 | } |
|
200 | } | |
203 | } |
|
201 | } | |
204 |
|
202 | |||
@@ -588,7 +586,7 int stop_current_mode( void ) | |||||
588 | return status; |
|
586 | return status; | |
589 | } |
|
587 | } | |
590 |
|
588 | |||
591 | int enter_mode_standby() |
|
589 | int enter_mode_standby( void ) | |
592 | { |
|
590 | { | |
593 | /** This function is used to put LFR in the STANDBY mode. |
|
591 | /** This function is used to put LFR in the STANDBY mode. | |
594 | * |
|
592 | * | |
@@ -1546,8 +1544,7 void close_action(ccsdsTelecommandPacket | |||||
1546 | //********************************** |
|
1544 | //********************************** | |
1547 | // UPDATE THE LFRMODE LOCAL VARIABLE |
|
1545 | // UPDATE THE LFRMODE LOCAL VARIABLE | |
1548 | requestedMode = TC->dataAndCRC[1]; |
|
1546 | requestedMode = TC->dataAndCRC[1]; | |
1549 | housekeeping_packet.lfr_status_word[0] = (unsigned char) ((requestedMode << 4) + 0x0d); |
|
1547 | updateLFRCurrentMode( requestedMode ); | |
1550 | updateLFRCurrentMode(); |
|
|||
1551 | } |
|
1548 | } | |
1552 | } |
|
1549 | } | |
1553 | else if (result == LFR_EXE_ERROR) |
|
1550 | else if (result == LFR_EXE_ERROR) | |
@@ -1574,15 +1571,17 rtems_isr commutation_isr2( rtems_vector | |||||
1574 |
|
1571 | |||
1575 | //**************** |
|
1572 | //**************** | |
1576 | // OTHER FUNCTIONS |
|
1573 | // OTHER FUNCTIONS | |
1577 | void updateLFRCurrentMode() |
|
1574 | void updateLFRCurrentMode( unsigned char requestedMode ) | |
1578 | { |
|
1575 | { | |
1579 | /** This function updates the value of the global variable lfrCurrentMode. |
|
1576 | /** This function updates the value of the global variable lfrCurrentMode. | |
1580 | * |
|
1577 | * | |
1581 | * lfrCurrentMode is a parameter used by several functions to know in which mode LFR is running. |
|
1578 | * lfrCurrentMode is a parameter used by several functions to know in which mode LFR is running. | |
1582 | * |
|
1579 | * | |
1583 | */ |
|
1580 | */ | |
|
1581 | ||||
1584 | // update the local value of lfrCurrentMode with the value contained in the housekeeping_packet structure |
|
1582 | // update the local value of lfrCurrentMode with the value contained in the housekeeping_packet structure | |
1585 | lfrCurrentMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; |
|
1583 | housekeeping_packet.lfr_status_word[0] = (unsigned char) ((requestedMode << 4) + 0x0d); | |
|
1584 | lfrCurrentMode = requestedMode; | |||
1586 | } |
|
1585 | } | |
1587 |
|
1586 | |||
1588 | void set_lfr_soft_reset( unsigned char value ) |
|
1587 | void set_lfr_soft_reset( unsigned char value ) |
General Comments 0
You need to be logged in to leave comments.
Login now