##// END OF EJS Templates
minor updates on documentation
paul -
r240:8d5977010643 R3
parent child
Show More
@@ -1,2 +1,2
1 3081d1f9bb20b2b64a192585337a292a9804e0c5 LFR_basic-parameters
1 3081d1f9bb20b2b64a192585337a292a9804e0c5 LFR_basic-parameters
2 721463c11a484e6a3439e16c99f8bd27720b9265 header/lfr_common_headers
2 ff85ce82cd9845f180cb578272717bcb76b62cb5 header/lfr_common_headers
@@ -1,77 +1,78
1 #ifndef FSW_MISC_H_INCLUDED
1 #ifndef FSW_MISC_H_INCLUDED
2 #define FSW_MISC_H_INCLUDED
2 #define FSW_MISC_H_INCLUDED
3
3
4 #include <rtems.h>
4 #include <rtems.h>
5 #include <stdio.h>
5 #include <stdio.h>
6 #include <grspw.h>
6 #include <grspw.h>
7 #include <grlib_regs.h>
7 #include <grlib_regs.h>
8
8
9 #include "fsw_params.h"
9 #include "fsw_params.h"
10 #include "fsw_spacewire.h"
10 #include "fsw_spacewire.h"
11 #include "lfr_cpu_usage_report.h"
11 #include "lfr_cpu_usage_report.h"
12
12
13 enum lfr_reset_cause_t{
13 enum lfr_reset_cause_t{
14 UNKNOWN_CAUSE,
14 UNKNOWN_CAUSE,
15 POWER_ON,
15 POWER_ON,
16 TC_RESET,
16 TC_RESET,
17 WATCHDOG,
17 WATCHDOG,
18 ERROR_RESET,
18 ERROR_RESET,
19 UNEXP_RESET
19 UNEXP_RESET
20 };
20 };
21
21
22 extern gptimer_regs_t *gptimer_regs;
22 extern gptimer_regs_t *gptimer_regs;
23
23
24 #define LFR_RESET_CAUSE_UNKNOWN_CAUSE 0
24 #define LFR_RESET_CAUSE_UNKNOWN_CAUSE 0
25
25
26 rtems_name name_hk_rate_monotonic; // name of the HK rate monotonic
26 rtems_name name_hk_rate_monotonic; // name of the HK rate monotonic
27 rtems_id HK_id; // id of the HK rate monotonic period
27 rtems_id HK_id; // id of the HK rate monotonic period
28
28
29 void timer_configure( unsigned char timer, unsigned int clock_divider,
29 void timer_configure( unsigned char timer, unsigned int clock_divider,
30 unsigned char interrupt_level, rtems_isr (*timer_isr)() );
30 unsigned char interrupt_level, rtems_isr (*timer_isr)() );
31 void timer_start( unsigned char timer );
31 void timer_start( unsigned char timer );
32 void timer_stop( unsigned char timer );
32 void timer_stop( unsigned char timer );
33 void timer_set_clock_divider(unsigned char timer, unsigned int clock_divider);
33 void timer_set_clock_divider(unsigned char timer, unsigned int clock_divider);
34
34
35 // WATCHDOG
35 // WATCHDOG
36 rtems_isr watchdog_isr( rtems_vector_number vector );
36 rtems_isr watchdog_isr( rtems_vector_number vector );
37 void watchdog_configure(void);
37 void watchdog_configure(void);
38 void watchdog_stop(void);
38 void watchdog_stop(void);
39 void watchdog_start(void);
39 void watchdog_start(void);
40
40
41 // SERIAL LINK
41 // SERIAL LINK
42 int send_console_outputs_on_apbuart_port( void );
42 int send_console_outputs_on_apbuart_port( void );
43 int enable_apbuart_transmitter( void );
43 int enable_apbuart_transmitter( void );
44 void set_apbuart_scaler_reload_register(unsigned int regs, unsigned int value);
44 void set_apbuart_scaler_reload_register(unsigned int regs, unsigned int value);
45
45
46 // RTEMS TASKS
46 // RTEMS TASKS
47 rtems_task load_task( rtems_task_argument argument );
47 rtems_task load_task( rtems_task_argument argument );
48 rtems_task hous_task( rtems_task_argument argument );
48 rtems_task hous_task( rtems_task_argument argument );
49 rtems_task dumb_task( rtems_task_argument unused );
49 rtems_task dumb_task( rtems_task_argument unused );
50
50
51 void init_housekeeping_parameters( void );
51 void init_housekeeping_parameters( void );
52 void increment_seq_counter(unsigned short *packetSequenceControl);
52 void increment_seq_counter(unsigned short *packetSequenceControl);
53 void getTime( unsigned char *time);
53 void getTime( unsigned char *time);
54 unsigned long long int getTimeAsUnsignedLongLongInt( );
54 unsigned long long int getTimeAsUnsignedLongLongInt( );
55 void send_dumb_hk( void );
55 void send_dumb_hk( void );
56 void get_temperatures( unsigned char *temperatures );
56 void get_temperatures( unsigned char *temperatures );
57 void get_v_e1_e2_f3( unsigned char *spacecraft_potential );
57 void get_v_e1_e2_f3( unsigned char *spacecraft_potential );
58 void get_cpu_load( unsigned char *resource_statistics );
58 void get_cpu_load( unsigned char *resource_statistics );
59 void set_hk_lfr_sc_potential_flag( bool state );
59 void set_hk_lfr_sc_potential_flag( bool state );
60 void set_hk_lfr_mag_fields_flag( bool state );
60 void set_hk_lfr_mag_fields_flag( bool state );
61 void set_hk_lfr_calib_enable( bool state );
61 void set_hk_lfr_calib_enable( bool state );
62 void set_hk_lfr_reset_cause( enum lfr_reset_cause_t lfr_reset_cause );
62 void set_hk_lfr_reset_cause( enum lfr_reset_cause_t lfr_reset_cause );
63 void hk_lfr_le_me_he_update();
63
64
64 extern int sched_yield( void );
65 extern int sched_yield( void );
65 extern void rtems_cpu_usage_reset();
66 extern void rtems_cpu_usage_reset();
66 extern ring_node *current_ring_node_f3;
67 extern ring_node *current_ring_node_f3;
67 extern ring_node *ring_node_to_send_cwf_f3;
68 extern ring_node *ring_node_to_send_cwf_f3;
68 extern ring_node waveform_ring_f3[];
69 extern ring_node waveform_ring_f3[];
69 extern unsigned short sequenceCounterHK;
70 extern unsigned short sequenceCounterHK;
70
71
71 extern unsigned char hk_lfr_q_sd_fifo_size_max;
72 extern unsigned char hk_lfr_q_sd_fifo_size_max;
72 extern unsigned char hk_lfr_q_rv_fifo_size_max;
73 extern unsigned char hk_lfr_q_rv_fifo_size_max;
73 extern unsigned char hk_lfr_q_p0_fifo_size_max;
74 extern unsigned char hk_lfr_q_p0_fifo_size_max;
74 extern unsigned char hk_lfr_q_p1_fifo_size_max;
75 extern unsigned char hk_lfr_q_p1_fifo_size_max;
75 extern unsigned char hk_lfr_q_p2_fifo_size_max;
76 extern unsigned char hk_lfr_q_p2_fifo_size_max;
76
77
77 #endif // FSW_MISC_H_INCLUDED
78 #endif // FSW_MISC_H_INCLUDED
@@ -1,51 +1,50
1 #ifndef FSW_SPACEWIRE_H_INCLUDED
1 #ifndef FSW_SPACEWIRE_H_INCLUDED
2 #define FSW_SPACEWIRE_H_INCLUDED
2 #define FSW_SPACEWIRE_H_INCLUDED
3
3
4 #include <rtems.h>
4 #include <rtems.h>
5 #include <grspw.h>
5 #include <grspw.h>
6
6
7 #include <fcntl.h> // for O_RDWR
7 #include <fcntl.h> // for O_RDWR
8 #include <unistd.h> // for the read call
8 #include <unistd.h> // for the read call
9 #include <sys/ioctl.h> // for the ioctl call
9 #include <sys/ioctl.h> // for the ioctl call
10 #include <errno.h>
10 #include <errno.h>
11
11
12 #include "fsw_params.h"
12 #include "fsw_params.h"
13 #include "tc_handler.h"
13 #include "tc_handler.h"
14 #include "fsw_init.h"
14 #include "fsw_init.h"
15
15
16 extern spw_stats spacewire_stats;
16 extern spw_stats spacewire_stats;
17 extern spw_stats spacewire_stats_backup;
17 extern spw_stats spacewire_stats_backup;
18
18
19 // RTEMS TASK
19 // RTEMS TASK
20 rtems_task spiq_task( rtems_task_argument argument );
20 rtems_task spiq_task( rtems_task_argument argument );
21 rtems_task recv_task( rtems_task_argument unused );
21 rtems_task recv_task( rtems_task_argument unused );
22 rtems_task send_task( rtems_task_argument argument );
22 rtems_task send_task( rtems_task_argument argument );
23 rtems_task wtdg_task( rtems_task_argument argument );
23 rtems_task wtdg_task( rtems_task_argument argument );
24
24
25 int spacewire_open_link( void );
25 int spacewire_open_link( void );
26 int spacewire_start_link( int fd );
26 int spacewire_start_link( int fd );
27 int spacewire_stop_and_start_link( int fd );
27 int spacewire_stop_and_start_link( int fd );
28 int spacewire_configure_link(int fd );
28 int spacewire_configure_link(int fd );
29 int spacewire_reset_link( void );
29 int spacewire_reset_link( void );
30 void spacewire_set_NP( unsigned char val, unsigned int regAddr ); // No Port force
30 void spacewire_set_NP( unsigned char val, unsigned int regAddr ); // No Port force
31 void spacewire_set_RE( unsigned char val, unsigned int regAddr ); // RMAP Enable
31 void spacewire_set_RE( unsigned char val, unsigned int regAddr ); // RMAP Enable
32 void spacewire_compute_stats_offsets( void );
32 void spacewire_compute_stats_offsets( void );
33 void spacewire_update_statistics( void );
33 void spacewire_update_statistics( void );
34
34
35 void init_header_cwf( Header_TM_LFR_SCIENCE_CWF_t *header );
35 void init_header_cwf( Header_TM_LFR_SCIENCE_CWF_t *header );
36 void init_header_swf( Header_TM_LFR_SCIENCE_SWF_t *header );
36 void init_header_swf( Header_TM_LFR_SCIENCE_SWF_t *header );
37 void init_header_asm( Header_TM_LFR_SCIENCE_ASM_t *header );
37 void init_header_asm( Header_TM_LFR_SCIENCE_ASM_t *header );
38 int spw_send_waveform_CWF( ring_node *ring_node_to_send, Header_TM_LFR_SCIENCE_CWF_t *header );
38 int spw_send_waveform_CWF( ring_node *ring_node_to_send, Header_TM_LFR_SCIENCE_CWF_t *header );
39 int spw_send_waveform_SWF( ring_node *ring_node_to_send, Header_TM_LFR_SCIENCE_SWF_t *header );
39 int spw_send_waveform_SWF( ring_node *ring_node_to_send, Header_TM_LFR_SCIENCE_SWF_t *header );
40 int spw_send_waveform_CWF3_light( ring_node *ring_node_to_send, Header_TM_LFR_SCIENCE_CWF_t *header );
40 int spw_send_waveform_CWF3_light( ring_node *ring_node_to_send, Header_TM_LFR_SCIENCE_CWF_t *header );
41 void spw_send_asm_f0( ring_node *ring_node_to_send, Header_TM_LFR_SCIENCE_ASM_t *header );
41 void spw_send_asm_f0( ring_node *ring_node_to_send, Header_TM_LFR_SCIENCE_ASM_t *header );
42 void spw_send_asm_f1( ring_node *ring_node_to_send, Header_TM_LFR_SCIENCE_ASM_t *header );
42 void spw_send_asm_f1( ring_node *ring_node_to_send, Header_TM_LFR_SCIENCE_ASM_t *header );
43 void spw_send_asm_f2( ring_node *ring_node_to_send, Header_TM_LFR_SCIENCE_ASM_t *header );
43 void spw_send_asm_f2( ring_node *ring_node_to_send, Header_TM_LFR_SCIENCE_ASM_t *header );
44 void spw_send_k_dump( ring_node *ring_node_to_send );
44 void spw_send_k_dump( ring_node *ring_node_to_send );
45
45
46 void timecode_irq_handler( void *pDev, void *regs, int minor, unsigned int tc );
46 void timecode_irq_handler( void *pDev, void *regs, int minor, unsigned int tc );
47 rtems_timer_service_routine user_routine( rtems_id timer_id, void *user_data );
48
47
49 void (*grspw_timecode_callback) ( void *pDev, void *regs, int minor, unsigned int tc );
48 void (*grspw_timecode_callback) ( void *pDev, void *regs, int minor, unsigned int tc );
50
49
51 #endif // FSW_SPACEWIRE_H_INCLUDED
50 #endif // FSW_SPACEWIRE_H_INCLUDED
@@ -1,77 +1,80
1 #ifndef TC_HANDLER_H_INCLUDED
1 #ifndef TC_HANDLER_H_INCLUDED
2 #define TC_HANDLER_H_INCLUDED
2 #define TC_HANDLER_H_INCLUDED
3
3
4 #include <rtems.h>
4 #include <rtems.h>
5 #include <leon.h>
5 #include <leon.h>
6
6
7 #include "tc_load_dump_parameters.h"
7 #include "tc_load_dump_parameters.h"
8 #include "tc_acceptance.h"
8 #include "tc_acceptance.h"
9 #include "tm_lfr_tc_exe.h"
9 #include "tm_lfr_tc_exe.h"
10 #include "wf_handler.h"
10 #include "wf_handler.h"
11 #include "fsw_processing.h"
11 #include "fsw_processing.h"
12
12
13 #include "lfr_cpu_usage_report.h"
13 #include "lfr_cpu_usage_report.h"
14
14
15 extern unsigned int lastValidTransitionDate;
16
15 //****
17 //****
16 // ISR
18 // ISR
17 rtems_isr commutation_isr1( rtems_vector_number vector );
19 rtems_isr commutation_isr1( rtems_vector_number vector );
18 rtems_isr commutation_isr2( rtems_vector_number vector );
20 rtems_isr commutation_isr2( rtems_vector_number vector );
19
21
20 //***********
22 //***********
21 // RTEMS TASK
23 // RTEMS TASK
22 rtems_task actn_task( rtems_task_argument unused );
24 rtems_task actn_task( rtems_task_argument unused );
23
25
24 //***********
26 //***********
25 // TC ACTIONS
27 // TC ACTIONS
26 int action_reset( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time );
28 int action_reset( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time );
27 int action_enter_mode(ccsdsTelecommandPacket_t *TC, rtems_id queue_id);
29 int action_enter_mode(ccsdsTelecommandPacket_t *TC, rtems_id queue_id);
28 int action_update_info( ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
30 int action_update_info( ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
29 int action_enable_calibration( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time );
31 int action_enable_calibration( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time );
30 int action_disable_calibration( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time );
32 int action_disable_calibration( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time );
31 int action_update_time( ccsdsTelecommandPacket_t *TC);
33 int action_update_time( ccsdsTelecommandPacket_t *TC);
32
34
33 // mode transition
35 // mode transition
34 int check_mode_value( unsigned char requestedMode );
36 int check_mode_value( unsigned char requestedMode );
35 int check_mode_transition( unsigned char requestedMode );
37 int check_mode_transition( unsigned char requestedMode );
38 void update_last_valid_transition_date( unsigned int transitionCoarseTime );
36 int check_transition_date( unsigned int transitionCoarseTime );
39 int check_transition_date( unsigned int transitionCoarseTime );
37 int stop_spectral_matrices( void );
40 int stop_spectral_matrices( void );
38 int stop_current_mode( void );
41 int stop_current_mode( void );
39 int enter_mode_standby( void );
42 int enter_mode_standby( void );
40 int enter_mode_normal( unsigned int transitionCoarseTime );
43 int enter_mode_normal( unsigned int transitionCoarseTime );
41 int enter_mode_burst( unsigned int transitionCoarseTime );
44 int enter_mode_burst( unsigned int transitionCoarseTime );
42 int enter_mode_sbm1( unsigned int transitionCoarseTime );
45 int enter_mode_sbm1( unsigned int transitionCoarseTime );
43 int enter_mode_sbm2( unsigned int transitionCoarseTime );
46 int enter_mode_sbm2( unsigned int transitionCoarseTime );
44 int restart_science_tasks( unsigned char lfrRequestedMode );
47 int restart_science_tasks( unsigned char lfrRequestedMode );
45 int restart_asm_tasks(unsigned char lfrRequestedMode );
48 int restart_asm_tasks(unsigned char lfrRequestedMode );
46 int suspend_science_tasks(void);
49 int suspend_science_tasks(void);
47 int suspend_asm_tasks( void );
50 int suspend_asm_tasks( void );
48 void launch_waveform_picker( unsigned char mode , unsigned int transitionCoarseTime );
51 void launch_waveform_picker( unsigned char mode , unsigned int transitionCoarseTime );
49 void launch_spectral_matrix( void );
52 void launch_spectral_matrix( void );
50 void set_sm_irq_onNewMatrix( unsigned char value );
53 void set_sm_irq_onNewMatrix( unsigned char value );
51 void set_sm_irq_onError( unsigned char value );
54 void set_sm_irq_onError( unsigned char value );
52
55
53 // other functions
56 // other functions
54 void updateLFRCurrentMode();
57 void updateLFRCurrentMode();
55 void set_lfr_soft_reset( unsigned char value );
58 void set_lfr_soft_reset( unsigned char value );
56 void reset_lfr( void );
59 void reset_lfr( void );
57 // CALIBRATION
60 // CALIBRATION
58 void setCalibrationPrescaler( unsigned int prescaler );
61 void setCalibrationPrescaler( unsigned int prescaler );
59 void setCalibrationDivisor( unsigned int divisionFactor );
62 void setCalibrationDivisor( unsigned int divisionFactor );
60 void setCalibrationData( void );
63 void setCalibrationData( void );
61 void setCalibrationReload( bool state);
64 void setCalibrationReload( bool state);
62 void setCalibrationEnable( bool state );
65 void setCalibrationEnable( bool state );
63 void setCalibrationInterleaved( bool state );
66 void setCalibrationInterleaved( bool state );
64 void setCalibration( bool state );
67 void setCalibration( bool state );
65 void configureCalibration( bool interleaved );
68 void configureCalibration( bool interleaved );
66 //
69 //
67 void update_last_TC_exe( ccsdsTelecommandPacket_t *TC , unsigned char *time );
70 void update_last_TC_exe( ccsdsTelecommandPacket_t *TC , unsigned char *time );
68 void update_last_TC_rej(ccsdsTelecommandPacket_t *TC , unsigned char *time );
71 void update_last_TC_rej(ccsdsTelecommandPacket_t *TC , unsigned char *time );
69 void close_action( ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id );
72 void close_action( ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id );
70
73
71 extern rtems_status_code get_message_queue_id_send( rtems_id *queue_id );
74 extern rtems_status_code get_message_queue_id_send( rtems_id *queue_id );
72 extern rtems_status_code get_message_queue_id_recv( rtems_id *queue_id );
75 extern rtems_status_code get_message_queue_id_recv( rtems_id *queue_id );
73
76
74 #endif // TC_HANDLER_H_INCLUDED
77 #endif // TC_HANDLER_H_INCLUDED
75
78
76
79
77
80
@@ -1,79 +1,80
1 /** Global variables of the LFR flight software.
1 /** Global variables of the LFR flight software.
2 *
2 *
3 * @file
3 * @file
4 * @author P. LEROY
4 * @author P. LEROY
5 *
5 *
6 * Among global variables, there are:
6 * Among global variables, there are:
7 * - RTEMS names and id.
7 * - RTEMS names and id.
8 * - APB configuration registers.
8 * - APB configuration registers.
9 * - waveforms global buffers, used by the waveform picker hardware module to store data.
9 * - waveforms global buffers, used by the waveform picker hardware module to store data.
10 * - spectral matrices buffesr, used by the hardware module to store data.
10 * - spectral matrices buffesr, used by the hardware module to store data.
11 * - variable related to LFR modes parameters.
11 * - variable related to LFR modes parameters.
12 * - the global HK packet buffer.
12 * - the global HK packet buffer.
13 * - the global dump parameter buffer.
13 * - the global dump parameter buffer.
14 *
14 *
15 */
15 */
16
16
17 #include <rtems.h>
17 #include <rtems.h>
18 #include <grspw.h>
18 #include <grspw.h>
19
19
20 #include "ccsds_types.h"
20 #include "ccsds_types.h"
21 #include "grlib_regs.h"
21 #include "grlib_regs.h"
22 #include "fsw_params.h"
22 #include "fsw_params.h"
23 #include "fsw_params_wf_handler.h"
23 #include "fsw_params_wf_handler.h"
24
24
25 // RTEMS GLOBAL VARIABLES
25 // RTEMS GLOBAL VARIABLES
26 rtems_name misc_name[5];
26 rtems_name misc_name[5];
27 rtems_name Task_name[20]; /* array of task names */
27 rtems_name Task_name[20]; /* array of task names */
28 rtems_id Task_id[20]; /* array of task ids */
28 rtems_id Task_id[20]; /* array of task ids */
29 int fdSPW = 0;
29 int fdSPW = 0;
30 int fdUART = 0;
30 int fdUART = 0;
31 unsigned char lfrCurrentMode;
31 unsigned char lfrCurrentMode;
32 unsigned char pa_bia_status_info;
32 unsigned char pa_bia_status_info;
33
33
34 // WAVEFORMS GLOBAL VARIABLES // 2048 * 3 * 4 + 2 * 4 = 24576 + 8 bytes = 24584
34 // WAVEFORMS GLOBAL VARIABLES // 2048 * 3 * 4 + 2 * 4 = 24576 + 8 bytes = 24584
35 // 97 * 256 = 24832 => delta = 248 bytes = 62 words
35 // 97 * 256 = 24832 => delta = 248 bytes = 62 words
36 // WAVEFORMS GLOBAL VARIABLES // 2688 * 3 * 4 + 2 * 4 = 32256 + 8 bytes = 32264
36 // WAVEFORMS GLOBAL VARIABLES // 2688 * 3 * 4 + 2 * 4 = 32256 + 8 bytes = 32264
37 // 127 * 256 = 32512 => delta = 248 bytes = 62 words
37 // 127 * 256 = 32512 => delta = 248 bytes = 62 words
38 // F0 F1 F2 F3
38 // F0 F1 F2 F3
39 volatile int wf_buffer_f0[ NB_RING_NODES_F0 * WFRM_BUFFER ] __attribute__((aligned(0x100)));
39 volatile int wf_buffer_f0[ NB_RING_NODES_F0 * WFRM_BUFFER ] __attribute__((aligned(0x100)));
40 volatile int wf_buffer_f1[ NB_RING_NODES_F1 * WFRM_BUFFER ] __attribute__((aligned(0x100)));
40 volatile int wf_buffer_f1[ NB_RING_NODES_F1 * WFRM_BUFFER ] __attribute__((aligned(0x100)));
41 volatile int wf_buffer_f2[ NB_RING_NODES_F2 * WFRM_BUFFER ] __attribute__((aligned(0x100)));
41 volatile int wf_buffer_f2[ NB_RING_NODES_F2 * WFRM_BUFFER ] __attribute__((aligned(0x100)));
42 volatile int wf_buffer_f3[ NB_RING_NODES_F3 * WFRM_BUFFER ] __attribute__((aligned(0x100)));
42 volatile int wf_buffer_f3[ NB_RING_NODES_F3 * WFRM_BUFFER ] __attribute__((aligned(0x100)));
43
43
44 //***********************************
44 //***********************************
45 // SPECTRAL MATRICES GLOBAL VARIABLES
45 // SPECTRAL MATRICES GLOBAL VARIABLES
46
46
47 // alignment constraints for the spectral matrices buffers => the first data after the time (8 bytes) shall be aligned on 0x00
47 // alignment constraints for the spectral matrices buffers => the first data after the time (8 bytes) shall be aligned on 0x00
48 volatile int sm_f0[ NB_RING_NODES_SM_F0 * TOTAL_SIZE_SM ] __attribute__((aligned(0x100)));
48 volatile int sm_f0[ NB_RING_NODES_SM_F0 * TOTAL_SIZE_SM ] __attribute__((aligned(0x100)));
49 volatile int sm_f1[ NB_RING_NODES_SM_F1 * TOTAL_SIZE_SM ] __attribute__((aligned(0x100)));
49 volatile int sm_f1[ NB_RING_NODES_SM_F1 * TOTAL_SIZE_SM ] __attribute__((aligned(0x100)));
50 volatile int sm_f2[ NB_RING_NODES_SM_F2 * TOTAL_SIZE_SM ] __attribute__((aligned(0x100)));
50 volatile int sm_f2[ NB_RING_NODES_SM_F2 * TOTAL_SIZE_SM ] __attribute__((aligned(0x100)));
51
51
52 // APB CONFIGURATION REGISTERS
52 // APB CONFIGURATION REGISTERS
53 time_management_regs_t *time_management_regs = (time_management_regs_t*) REGS_ADDR_TIME_MANAGEMENT;
53 time_management_regs_t *time_management_regs = (time_management_regs_t*) REGS_ADDR_TIME_MANAGEMENT;
54 gptimer_regs_t *gptimer_regs = (gptimer_regs_t *) REGS_ADDR_GPTIMER;
54 gptimer_regs_t *gptimer_regs = (gptimer_regs_t *) REGS_ADDR_GPTIMER;
55 waveform_picker_regs_0_1_18_t *waveform_picker_regs = (waveform_picker_regs_0_1_18_t*) REGS_ADDR_WAVEFORM_PICKER;
55 waveform_picker_regs_0_1_18_t *waveform_picker_regs = (waveform_picker_regs_0_1_18_t*) REGS_ADDR_WAVEFORM_PICKER;
56 spectral_matrix_regs_t *spectral_matrix_regs = (spectral_matrix_regs_t*) REGS_ADDR_SPECTRAL_MATRIX;
56 spectral_matrix_regs_t *spectral_matrix_regs = (spectral_matrix_regs_t*) REGS_ADDR_SPECTRAL_MATRIX;
57
57
58 // MODE PARAMETERS
58 // MODE PARAMETERS
59 Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet;
59 Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet;
60 struct param_local_str param_local;
60 struct param_local_str param_local;
61 unsigned int lastValidTransitionDate;
61
62
62 // HK PACKETS
63 // HK PACKETS
63 Packet_TM_LFR_HK_t housekeeping_packet;
64 Packet_TM_LFR_HK_t housekeeping_packet;
64 // message queues occupancy
65 // message queues occupancy
65 unsigned char hk_lfr_q_sd_fifo_size_max;
66 unsigned char hk_lfr_q_sd_fifo_size_max;
66 unsigned char hk_lfr_q_rv_fifo_size_max;
67 unsigned char hk_lfr_q_rv_fifo_size_max;
67 unsigned char hk_lfr_q_p0_fifo_size_max;
68 unsigned char hk_lfr_q_p0_fifo_size_max;
68 unsigned char hk_lfr_q_p1_fifo_size_max;
69 unsigned char hk_lfr_q_p1_fifo_size_max;
69 unsigned char hk_lfr_q_p2_fifo_size_max;
70 unsigned char hk_lfr_q_p2_fifo_size_max;
70 // sequence counters are incremented by APID (PID + CAT) and destination ID
71 // sequence counters are incremented by APID (PID + CAT) and destination ID
71 unsigned short sequenceCounters_SCIENCE_NORMAL_BURST;
72 unsigned short sequenceCounters_SCIENCE_NORMAL_BURST;
72 unsigned short sequenceCounters_SCIENCE_SBM1_SBM2;
73 unsigned short sequenceCounters_SCIENCE_SBM1_SBM2;
73 unsigned short sequenceCounters_TC_EXE[SEQ_CNT_NB_DEST_ID];
74 unsigned short sequenceCounters_TC_EXE[SEQ_CNT_NB_DEST_ID];
74 unsigned short sequenceCounters_TM_DUMP[SEQ_CNT_NB_DEST_ID];
75 unsigned short sequenceCounters_TM_DUMP[SEQ_CNT_NB_DEST_ID];
75 unsigned short sequenceCounterHK;
76 unsigned short sequenceCounterHK;
76 spw_stats spacewire_stats;
77 spw_stats spacewire_stats;
77 spw_stats spacewire_stats_backup;
78 spw_stats spacewire_stats_backup;
78
79
79
80
@@ -1,864 +1,865
1 /** This is the RTEMS initialization module.
1 /** This is the RTEMS initialization module.
2 *
2 *
3 * @file
3 * @file
4 * @author P. LEROY
4 * @author P. LEROY
5 *
5 *
6 * This module contains two very different information:
6 * This module contains two very different information:
7 * - specific instructions to configure the compilation of the RTEMS executive
7 * - specific instructions to configure the compilation of the RTEMS executive
8 * - functions related to the fligth softwre initialization, especially the INIT RTEMS task
8 * - functions related to the fligth softwre initialization, especially the INIT RTEMS task
9 *
9 *
10 */
10 */
11
11
12 //*************************
12 //*************************
13 // GPL reminder to be added
13 // GPL reminder to be added
14 //*************************
14 //*************************
15
15
16 #include <rtems.h>
16 #include <rtems.h>
17
17
18 /* configuration information */
18 /* configuration information */
19
19
20 #define CONFIGURE_INIT
20 #define CONFIGURE_INIT
21
21
22 #include <bsp.h> /* for device driver prototypes */
22 #include <bsp.h> /* for device driver prototypes */
23
23
24 /* configuration information */
24 /* configuration information */
25
25
26 #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
26 #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
27 #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
27 #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
28
28
29 #define CONFIGURE_MAXIMUM_TASKS 20
29 #define CONFIGURE_MAXIMUM_TASKS 20
30 #define CONFIGURE_RTEMS_INIT_TASKS_TABLE
30 #define CONFIGURE_RTEMS_INIT_TASKS_TABLE
31 #define CONFIGURE_EXTRA_TASK_STACKS (3 * RTEMS_MINIMUM_STACK_SIZE)
31 #define CONFIGURE_EXTRA_TASK_STACKS (3 * RTEMS_MINIMUM_STACK_SIZE)
32 #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 32
32 #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 32
33 #define CONFIGURE_INIT_TASK_PRIORITY 1 // instead of 100
33 #define CONFIGURE_INIT_TASK_PRIORITY 1 // instead of 100
34 #define CONFIGURE_INIT_TASK_MODE (RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT)
34 #define CONFIGURE_INIT_TASK_MODE (RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT)
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 // STAT (1s), send SWF (0.3s), send CWF3 (1s)
38 #define CONFIGURE_MAXIMUM_TIMERS 5 // STAT (1s), send SWF (0.3s), send CWF3 (1s)
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
42 #endif
42 #endif
43
43
44 #include <rtems/confdefs.h>
44 #include <rtems/confdefs.h>
45
45
46 /* If --drvmgr was enabled during the configuration of the RTEMS kernel */
46 /* If --drvmgr was enabled during the configuration of the RTEMS kernel */
47 #ifdef RTEMS_DRVMGR_STARTUP
47 #ifdef RTEMS_DRVMGR_STARTUP
48 #ifdef LEON3
48 #ifdef LEON3
49 /* Add Timer and UART Driver */
49 /* Add Timer and UART Driver */
50 #ifdef CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
50 #ifdef CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
51 #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GPTIMER
51 #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GPTIMER
52 #endif
52 #endif
53 #ifdef CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
53 #ifdef CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
54 #define CONFIGURE_DRIVER_AMBAPP_GAISLER_APBUART
54 #define CONFIGURE_DRIVER_AMBAPP_GAISLER_APBUART
55 #endif
55 #endif
56 #endif
56 #endif
57 #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GRSPW /* GRSPW Driver */
57 #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GRSPW /* GRSPW Driver */
58 #include <drvmgr/drvmgr_confdefs.h>
58 #include <drvmgr/drvmgr_confdefs.h>
59 #endif
59 #endif
60
60
61 #include "fsw_init.h"
61 #include "fsw_init.h"
62 #include "fsw_config.c"
62 #include "fsw_config.c"
63 #include "GscMemoryLPP.hpp"
63 #include "GscMemoryLPP.hpp"
64
64
65 void initCache()
65 void initCache()
66 {
66 {
67 unsigned int cacheControlRegister;
67 unsigned int cacheControlRegister;
68
68
69 cacheControlRegister = getCacheControlRegister();
69 cacheControlRegister = getCacheControlRegister();
70 PRINTF1("(0) cacheControlRegister = %x\n", cacheControlRegister)
70 PRINTF1("(0) cacheControlRegister = %x\n", cacheControlRegister)
71
71
72 resetCacheControlRegister();
72 resetCacheControlRegister();
73
73
74 enableInstructionCache();
74 enableInstructionCache();
75 enableDataCache();
75 enableDataCache();
76 enableInstructionBurstFetch();
76 enableInstructionBurstFetch();
77
77
78 cacheControlRegister = getCacheControlRegister();
78 cacheControlRegister = getCacheControlRegister();
79 PRINTF1("(1) cacheControlRegister = %x\n", cacheControlRegister)
79 PRINTF1("(1) cacheControlRegister = %x\n", cacheControlRegister)
80 }
80 }
81
81
82 rtems_task Init( rtems_task_argument ignored )
82 rtems_task Init( rtems_task_argument ignored )
83 {
83 {
84 /** This is the RTEMS INIT taks, it is the first task launched by the system.
84 /** This is the RTEMS INIT taks, it is the first task launched by the system.
85 *
85 *
86 * @param unused is the starting argument of the RTEMS task
86 * @param unused is the starting argument of the RTEMS task
87 *
87 *
88 * The INIT task create and run all other RTEMS tasks.
88 * The INIT task create and run all other RTEMS tasks.
89 *
89 *
90 */
90 */
91
91
92 //***********
92 //***********
93 // INIT CACHE
93 // INIT CACHE
94
94
95 unsigned char *vhdlVersion;
95 unsigned char *vhdlVersion;
96
96
97 reset_lfr();
97 reset_lfr();
98
98
99 reset_local_time();
99 reset_local_time();
100
100
101 rtems_cpu_usage_reset();
101 rtems_cpu_usage_reset();
102
102
103 rtems_status_code status;
103 rtems_status_code status;
104 rtems_status_code status_spw;
104 rtems_status_code status_spw;
105 rtems_isr_entry old_isr_handler;
105 rtems_isr_entry old_isr_handler;
106
106
107 // UART settings
107 // UART settings
108 send_console_outputs_on_apbuart_port();
108 send_console_outputs_on_apbuart_port();
109 set_apbuart_scaler_reload_register(REGS_ADDR_APBUART, APBUART_SCALER_RELOAD_VALUE);
109 set_apbuart_scaler_reload_register(REGS_ADDR_APBUART, APBUART_SCALER_RELOAD_VALUE);
110 enable_apbuart_transmitter();
110 enable_apbuart_transmitter();
111
111
112 DEBUG_PRINTF("\n\n\n\n\nIn INIT *** Now the console is on port COM1\n")
112 DEBUG_PRINTF("\n\n\n\n\nIn INIT *** Now the console is on port COM1\n")
113
113
114
114
115 PRINTF("\n\n\n\n\n")
115 PRINTF("\n\n\n\n\n")
116
116
117 initCache();
117 initCache();
118
118
119 PRINTF("*************************\n")
119 PRINTF("*************************\n")
120 PRINTF("** LFR Flight Software **\n")
120 PRINTF("** LFR Flight Software **\n")
121 PRINTF1("** %d.", SW_VERSION_N1)
121 PRINTF1("** %d.", SW_VERSION_N1)
122 PRINTF1("%d." , SW_VERSION_N2)
122 PRINTF1("%d." , SW_VERSION_N2)
123 PRINTF1("%d." , SW_VERSION_N3)
123 PRINTF1("%d." , SW_VERSION_N3)
124 PRINTF1("%d **\n", SW_VERSION_N4)
124 PRINTF1("%d **\n", SW_VERSION_N4)
125
125
126 vhdlVersion = (unsigned char *) (REGS_ADDR_VHDL_VERSION);
126 vhdlVersion = (unsigned char *) (REGS_ADDR_VHDL_VERSION);
127 PRINTF("** VHDL **\n")
127 PRINTF("** VHDL **\n")
128 PRINTF1("** %d.", vhdlVersion[1])
128 PRINTF1("** %d.", vhdlVersion[1])
129 PRINTF1("%d." , vhdlVersion[2])
129 PRINTF1("%d." , vhdlVersion[2])
130 PRINTF1("%d **\n", vhdlVersion[3])
130 PRINTF1("%d **\n", vhdlVersion[3])
131 PRINTF("*************************\n")
131 PRINTF("*************************\n")
132 PRINTF("\n\n")
132 PRINTF("\n\n")
133
133
134 init_parameter_dump();
134 init_parameter_dump();
135 init_kcoefficients_dump();
135 init_kcoefficients_dump();
136 init_local_mode_parameters();
136 init_local_mode_parameters();
137 init_housekeeping_parameters();
137 init_housekeeping_parameters();
138 init_k_coefficients_prc0();
138 init_k_coefficients_prc0();
139 init_k_coefficients_prc1();
139 init_k_coefficients_prc1();
140 init_k_coefficients_prc2();
140 init_k_coefficients_prc2();
141 pa_bia_status_info = 0x00;
141 pa_bia_status_info = 0x00;
142 update_last_valid_transition_date( DEFAULT_LAST_VALID_TRANSITION_DATE );
142
143
143 // waveform picker initialization
144 // waveform picker initialization
144 WFP_init_rings(); LEON_Clear_interrupt( IRQ_SPARC_GPTIMER_WATCHDOG ); // initialize the waveform rings
145 WFP_init_rings(); LEON_Clear_interrupt( IRQ_SPARC_GPTIMER_WATCHDOG ); // initialize the waveform rings
145 WFP_reset_current_ring_nodes();
146 WFP_reset_current_ring_nodes();
146 reset_waveform_picker_regs();
147 reset_waveform_picker_regs();
147
148
148 // spectral matrices initialization
149 // spectral matrices initialization
149 SM_init_rings(); // initialize spectral matrices rings
150 SM_init_rings(); // initialize spectral matrices rings
150 SM_reset_current_ring_nodes();
151 SM_reset_current_ring_nodes();
151 reset_spectral_matrix_regs();
152 reset_spectral_matrix_regs();
152
153
153 // configure calibration
154 // configure calibration
154 configureCalibration( false ); // true means interleaved mode, false is for normal mode
155 configureCalibration( false ); // true means interleaved mode, false is for normal mode
155
156
156 updateLFRCurrentMode();
157 updateLFRCurrentMode();
157
158
158 BOOT_PRINTF1("in INIT *** lfrCurrentMode is %d\n", lfrCurrentMode)
159 BOOT_PRINTF1("in INIT *** lfrCurrentMode is %d\n", lfrCurrentMode)
159
160
160 create_names(); // create all names
161 create_names(); // create all names
161
162
162 status = create_message_queues(); // create message queues
163 status = create_message_queues(); // create message queues
163 if (status != RTEMS_SUCCESSFUL)
164 if (status != RTEMS_SUCCESSFUL)
164 {
165 {
165 PRINTF1("in INIT *** ERR in create_message_queues, code %d", status)
166 PRINTF1("in INIT *** ERR in create_message_queues, code %d", status)
166 }
167 }
167
168
168 status = create_all_tasks(); // create all tasks
169 status = create_all_tasks(); // create all tasks
169 if (status != RTEMS_SUCCESSFUL)
170 if (status != RTEMS_SUCCESSFUL)
170 {
171 {
171 PRINTF1("in INIT *** ERR in create_all_tasks, code %d\n", status)
172 PRINTF1("in INIT *** ERR in create_all_tasks, code %d\n", status)
172 }
173 }
173
174
174 // **************************
175 // **************************
175 // <SPACEWIRE INITIALIZATION>
176 // <SPACEWIRE INITIALIZATION>
176 grspw_timecode_callback = &timecode_irq_handler;
177 grspw_timecode_callback = &timecode_irq_handler;
177
178
178 status_spw = spacewire_open_link(); // (1) open the link
179 status_spw = spacewire_open_link(); // (1) open the link
179 if ( status_spw != RTEMS_SUCCESSFUL )
180 if ( status_spw != RTEMS_SUCCESSFUL )
180 {
181 {
181 PRINTF1("in INIT *** ERR spacewire_open_link code %d\n", status_spw )
182 PRINTF1("in INIT *** ERR spacewire_open_link code %d\n", status_spw )
182 }
183 }
183
184
184 if ( status_spw == RTEMS_SUCCESSFUL ) // (2) configure the link
185 if ( status_spw == RTEMS_SUCCESSFUL ) // (2) configure the link
185 {
186 {
186 status_spw = spacewire_configure_link( fdSPW );
187 status_spw = spacewire_configure_link( fdSPW );
187 if ( status_spw != RTEMS_SUCCESSFUL )
188 if ( status_spw != RTEMS_SUCCESSFUL )
188 {
189 {
189 PRINTF1("in INIT *** ERR spacewire_configure_link code %d\n", status_spw )
190 PRINTF1("in INIT *** ERR spacewire_configure_link code %d\n", status_spw )
190 }
191 }
191 }
192 }
192
193
193 if ( status_spw == RTEMS_SUCCESSFUL) // (3) start the link
194 if ( status_spw == RTEMS_SUCCESSFUL) // (3) start the link
194 {
195 {
195 status_spw = spacewire_start_link( fdSPW );
196 status_spw = spacewire_start_link( fdSPW );
196 if ( status_spw != RTEMS_SUCCESSFUL )
197 if ( status_spw != RTEMS_SUCCESSFUL )
197 {
198 {
198 PRINTF1("in INIT *** ERR spacewire_start_link code %d\n", status_spw )
199 PRINTF1("in INIT *** ERR spacewire_start_link code %d\n", status_spw )
199 }
200 }
200 }
201 }
201 // </SPACEWIRE INITIALIZATION>
202 // </SPACEWIRE INITIALIZATION>
202 // ***************************
203 // ***************************
203
204
204 status = start_all_tasks(); // start all tasks
205 status = start_all_tasks(); // start all tasks
205 if (status != RTEMS_SUCCESSFUL)
206 if (status != RTEMS_SUCCESSFUL)
206 {
207 {
207 PRINTF1("in INIT *** ERR in start_all_tasks, code %d", status)
208 PRINTF1("in INIT *** ERR in start_all_tasks, code %d", status)
208 }
209 }
209
210
210 // start RECV and SEND *AFTER* SpaceWire Initialization, due to the timeout of the start call during the initialization
211 // start RECV and SEND *AFTER* SpaceWire Initialization, due to the timeout of the start call during the initialization
211 status = start_recv_send_tasks();
212 status = start_recv_send_tasks();
212 if ( status != RTEMS_SUCCESSFUL )
213 if ( status != RTEMS_SUCCESSFUL )
213 {
214 {
214 PRINTF1("in INIT *** ERR start_recv_send_tasks code %d\n", status )
215 PRINTF1("in INIT *** ERR start_recv_send_tasks code %d\n", status )
215 }
216 }
216
217
217 // suspend science tasks, they will be restarted later depending on the mode
218 // suspend science tasks, they will be restarted later depending on the mode
218 status = suspend_science_tasks(); // suspend science tasks (not done in stop_current_mode if current mode = STANDBY)
219 status = suspend_science_tasks(); // suspend science tasks (not done in stop_current_mode if current mode = STANDBY)
219 if (status != RTEMS_SUCCESSFUL)
220 if (status != RTEMS_SUCCESSFUL)
220 {
221 {
221 PRINTF1("in INIT *** in suspend_science_tasks *** ERR code: %d\n", status)
222 PRINTF1("in INIT *** in suspend_science_tasks *** ERR code: %d\n", status)
222 }
223 }
223
224
224 // configure IRQ handling for the waveform picker unit
225 // configure IRQ handling for the waveform picker unit
225 status = rtems_interrupt_catch( waveforms_isr,
226 status = rtems_interrupt_catch( waveforms_isr,
226 IRQ_SPARC_WAVEFORM_PICKER,
227 IRQ_SPARC_WAVEFORM_PICKER,
227 &old_isr_handler) ;
228 &old_isr_handler) ;
228 // configure IRQ handling for the spectral matrices unit
229 // configure IRQ handling for the spectral matrices unit
229 status = rtems_interrupt_catch( spectral_matrices_isr,
230 status = rtems_interrupt_catch( spectral_matrices_isr,
230 IRQ_SPARC_SPECTRAL_MATRIX,
231 IRQ_SPARC_SPECTRAL_MATRIX,
231 &old_isr_handler) ;
232 &old_isr_handler) ;
232
233
233 // if the spacewire link is not up then send an event to the SPIQ task for link recovery
234 // if the spacewire link is not up then send an event to the SPIQ task for link recovery
234 if ( status_spw != RTEMS_SUCCESSFUL )
235 if ( status_spw != RTEMS_SUCCESSFUL )
235 {
236 {
236 status = rtems_event_send( Task_id[TASKID_SPIQ], SPW_LINKERR_EVENT );
237 status = rtems_event_send( Task_id[TASKID_SPIQ], SPW_LINKERR_EVENT );
237 if ( status != RTEMS_SUCCESSFUL ) {
238 if ( status != RTEMS_SUCCESSFUL ) {
238 PRINTF1("in INIT *** ERR rtems_event_send to SPIQ code %d\n", status )
239 PRINTF1("in INIT *** ERR rtems_event_send to SPIQ code %d\n", status )
239 }
240 }
240 }
241 }
241
242
242 BOOT_PRINTF("delete INIT\n")
243 BOOT_PRINTF("delete INIT\n")
243
244
244 set_hk_lfr_sc_potential_flag( true );
245 set_hk_lfr_sc_potential_flag( true );
245
246
246 status = rtems_task_delete(RTEMS_SELF);
247 status = rtems_task_delete(RTEMS_SELF);
247
248
248 }
249 }
249
250
250 void init_local_mode_parameters( void )
251 void init_local_mode_parameters( void )
251 {
252 {
252 /** This function initialize the param_local global variable with default values.
253 /** This function initialize the param_local global variable with default values.
253 *
254 *
254 */
255 */
255
256
256 unsigned int i;
257 unsigned int i;
257
258
258 // LOCAL PARAMETERS
259 // LOCAL PARAMETERS
259
260
260 BOOT_PRINTF1("local_sbm1_nb_cwf_max %d \n", param_local.local_sbm1_nb_cwf_max)
261 BOOT_PRINTF1("local_sbm1_nb_cwf_max %d \n", param_local.local_sbm1_nb_cwf_max)
261 BOOT_PRINTF1("local_sbm2_nb_cwf_max %d \n", param_local.local_sbm2_nb_cwf_max)
262 BOOT_PRINTF1("local_sbm2_nb_cwf_max %d \n", param_local.local_sbm2_nb_cwf_max)
262 BOOT_PRINTF1("nb_interrupt_f0_MAX = %d\n", param_local.local_nb_interrupt_f0_MAX)
263 BOOT_PRINTF1("nb_interrupt_f0_MAX = %d\n", param_local.local_nb_interrupt_f0_MAX)
263
264
264 // init sequence counters
265 // init sequence counters
265
266
266 for(i = 0; i<SEQ_CNT_NB_DEST_ID; i++)
267 for(i = 0; i<SEQ_CNT_NB_DEST_ID; i++)
267 {
268 {
268 sequenceCounters_TC_EXE[i] = 0x00;
269 sequenceCounters_TC_EXE[i] = 0x00;
269 sequenceCounters_TM_DUMP[i] = 0x00;
270 sequenceCounters_TM_DUMP[i] = 0x00;
270 }
271 }
271 sequenceCounters_SCIENCE_NORMAL_BURST = 0x00;
272 sequenceCounters_SCIENCE_NORMAL_BURST = 0x00;
272 sequenceCounters_SCIENCE_SBM1_SBM2 = 0x00;
273 sequenceCounters_SCIENCE_SBM1_SBM2 = 0x00;
273 sequenceCounterHK = TM_PACKET_SEQ_CTRL_STANDALONE << 8;
274 sequenceCounterHK = TM_PACKET_SEQ_CTRL_STANDALONE << 8;
274 }
275 }
275
276
276 void reset_local_time( void )
277 void reset_local_time( void )
277 {
278 {
278 time_management_regs->ctrl = time_management_regs->ctrl | 0x02; // [0010] software reset, coarse time = 0x80000000
279 time_management_regs->ctrl = time_management_regs->ctrl | 0x02; // [0010] software reset, coarse time = 0x80000000
279 }
280 }
280
281
281 void create_names( void ) // create all names for tasks and queues
282 void create_names( void ) // create all names for tasks and queues
282 {
283 {
283 /** This function creates all RTEMS names used in the software for tasks and queues.
284 /** This function creates all RTEMS names used in the software for tasks and queues.
284 *
285 *
285 * @return RTEMS directive status codes:
286 * @return RTEMS directive status codes:
286 * - RTEMS_SUCCESSFUL - successful completion
287 * - RTEMS_SUCCESSFUL - successful completion
287 *
288 *
288 */
289 */
289
290
290 // task names
291 // task names
291 Task_name[TASKID_RECV] = rtems_build_name( 'R', 'E', 'C', 'V' );
292 Task_name[TASKID_RECV] = rtems_build_name( 'R', 'E', 'C', 'V' );
292 Task_name[TASKID_ACTN] = rtems_build_name( 'A', 'C', 'T', 'N' );
293 Task_name[TASKID_ACTN] = rtems_build_name( 'A', 'C', 'T', 'N' );
293 Task_name[TASKID_SPIQ] = rtems_build_name( 'S', 'P', 'I', 'Q' );
294 Task_name[TASKID_SPIQ] = rtems_build_name( 'S', 'P', 'I', 'Q' );
294 Task_name[TASKID_LOAD] = rtems_build_name( 'L', 'O', 'A', 'D' );
295 Task_name[TASKID_LOAD] = rtems_build_name( 'L', 'O', 'A', 'D' );
295 Task_name[TASKID_AVF0] = rtems_build_name( 'A', 'V', 'F', '0' );
296 Task_name[TASKID_AVF0] = rtems_build_name( 'A', 'V', 'F', '0' );
296 Task_name[TASKID_SWBD] = rtems_build_name( 'S', 'W', 'B', 'D' );
297 Task_name[TASKID_SWBD] = rtems_build_name( 'S', 'W', 'B', 'D' );
297 Task_name[TASKID_WFRM] = rtems_build_name( 'W', 'F', 'R', 'M' );
298 Task_name[TASKID_WFRM] = rtems_build_name( 'W', 'F', 'R', 'M' );
298 Task_name[TASKID_DUMB] = rtems_build_name( 'D', 'U', 'M', 'B' );
299 Task_name[TASKID_DUMB] = rtems_build_name( 'D', 'U', 'M', 'B' );
299 Task_name[TASKID_HOUS] = rtems_build_name( 'H', 'O', 'U', 'S' );
300 Task_name[TASKID_HOUS] = rtems_build_name( 'H', 'O', 'U', 'S' );
300 Task_name[TASKID_PRC0] = rtems_build_name( 'P', 'R', 'C', '0' );
301 Task_name[TASKID_PRC0] = rtems_build_name( 'P', 'R', 'C', '0' );
301 Task_name[TASKID_CWF3] = rtems_build_name( 'C', 'W', 'F', '3' );
302 Task_name[TASKID_CWF3] = rtems_build_name( 'C', 'W', 'F', '3' );
302 Task_name[TASKID_CWF2] = rtems_build_name( 'C', 'W', 'F', '2' );
303 Task_name[TASKID_CWF2] = rtems_build_name( 'C', 'W', 'F', '2' );
303 Task_name[TASKID_CWF1] = rtems_build_name( 'C', 'W', 'F', '1' );