##// END OF EJS Templates
3.2.0.14...
paul -
r366:78a68c2c62b6 R3++ draft
parent child
Show More
@@ -1,169 +1,169
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 #define LFR_RESET_CAUSE_UNKNOWN_CAUSE 0
13 #define LFR_RESET_CAUSE_UNKNOWN_CAUSE 0
14 #define WATCHDOG_LOOP_PRINTF 10
14 #define WATCHDOG_LOOP_PRINTF 10
15 #define WATCHDOG_LOOP_DEBUG 3
15 #define WATCHDOG_LOOP_DEBUG 3
16
16
17 #define DUMB_MESSAGE_NB 15
17 #define DUMB_MESSAGE_NB 15
18 #define NB_RTEMS_EVENTS 32
18 #define NB_RTEMS_EVENTS 32
19 #define EVENT_12 12
19 #define EVENT_12 12
20 #define EVENT_13 13
20 #define EVENT_13 13
21 #define EVENT_14 14
21 #define EVENT_14 14
22 #define DUMB_MESSAGE_0 "in DUMB *** default"
22 #define DUMB_MESSAGE_0 "in DUMB *** default"
23 #define DUMB_MESSAGE_1 "in DUMB *** timecode_irq_handler"
23 #define DUMB_MESSAGE_1 "in DUMB *** timecode_irq_handler"
24 #define DUMB_MESSAGE_2 "in DUMB *** f3 buffer changed"
24 #define DUMB_MESSAGE_2 "in DUMB *** f3 buffer changed"
25 #define DUMB_MESSAGE_3 "in DUMB *** in SMIQ *** Error sending event to AVF0"
25 #define DUMB_MESSAGE_3 "in DUMB *** in SMIQ *** Error sending event to AVF0"
26 #define DUMB_MESSAGE_4 "in DUMB *** spectral_matrices_isr *** Error sending event to SMIQ"
26 #define DUMB_MESSAGE_4 "in DUMB *** spectral_matrices_isr *** Error sending event to SMIQ"
27 #define DUMB_MESSAGE_5 "in DUMB *** waveforms_simulator_isr"
27 #define DUMB_MESSAGE_5 "in DUMB *** waveforms_simulator_isr"
28 #define DUMB_MESSAGE_6 "VHDL SM *** two buffers f0 ready"
28 #define DUMB_MESSAGE_6 "VHDL SM *** two buffers f0 ready"
29 #define DUMB_MESSAGE_7 "ready for dump"
29 #define DUMB_MESSAGE_7 "ready for dump"
30 #define DUMB_MESSAGE_8 "VHDL ERR *** spectral matrix"
30 #define DUMB_MESSAGE_8 "VHDL ERR *** spectral matrix"
31 #define DUMB_MESSAGE_9 "tick"
31 #define DUMB_MESSAGE_9 "tick"
32 #define DUMB_MESSAGE_10 "VHDL ERR *** waveform picker"
32 #define DUMB_MESSAGE_10 "VHDL ERR *** waveform picker"
33 #define DUMB_MESSAGE_11 "VHDL ERR *** unexpected ready matrix values"
33 #define DUMB_MESSAGE_11 "VHDL ERR *** unexpected ready matrix values"
34 #define DUMB_MESSAGE_12 "WATCHDOG timer"
34 #define DUMB_MESSAGE_12 "WATCHDOG timer"
35 #define DUMB_MESSAGE_13 "TIMECODE timer"
35 #define DUMB_MESSAGE_13 "TIMECODE timer"
36 #define DUMB_MESSAGE_14 "TIMECODE ISR"
36 #define DUMB_MESSAGE_14 "TIMECODE ISR"
37
37
38 enum lfr_reset_cause_t{
38 enum lfr_reset_cause_t{
39 UNKNOWN_CAUSE,
39 UNKNOWN_CAUSE,
40 POWER_ON,
40 POWER_ON,
41 TC_RESET,
41 TC_RESET,
42 WATCHDOG,
42 WATCHDOG,
43 ERROR_RESET,
43 ERROR_RESET,
44 UNEXP_RESET
44 UNEXP_RESET
45 };
45 };
46
46
47 typedef struct{
47 typedef struct{
48 unsigned char dpu_spw_parity;
48 unsigned char dpu_spw_parity;
49 unsigned char dpu_spw_disconnect;
49 unsigned char dpu_spw_disconnect;
50 unsigned char dpu_spw_escape;
50 unsigned char dpu_spw_escape;
51 unsigned char dpu_spw_credit;
51 unsigned char dpu_spw_credit;
52 unsigned char dpu_spw_write_sync;
52 unsigned char dpu_spw_write_sync;
53 unsigned char timecode_erroneous;
53 unsigned char timecode_erroneous;
54 unsigned char timecode_missing;
54 unsigned char timecode_missing;
55 unsigned char timecode_invalid;
55 unsigned char timecode_invalid;
56 unsigned char time_timecode_it;
56 unsigned char time_timecode_it;
57 unsigned char time_not_synchro;
57 unsigned char time_not_synchro;
58 unsigned char time_timecode_ctr;
58 unsigned char time_timecode_ctr;
59 unsigned char ahb_correctable;
59 unsigned char ahb_correctable;
60 } hk_lfr_le_t;
60 } hk_lfr_le_t;
61
61
62 typedef struct{
62 typedef struct{
63 unsigned char dpu_spw_early_eop;
63 unsigned char dpu_spw_early_eop;
64 unsigned char dpu_spw_invalid_addr;
64 unsigned char dpu_spw_invalid_addr;
65 unsigned char dpu_spw_eep;
65 unsigned char dpu_spw_eep;
66 unsigned char dpu_spw_rx_too_big;
66 unsigned char dpu_spw_rx_too_big;
67 } hk_lfr_me_t;
67 } hk_lfr_me_t;
68
68
69 #define B00 65
69 #define B00 196
70 #define B01 65
70 #define B01 196
71 #define B02 0
71 #define B02 0
72 #define B10 2048
72 #define B10 131
73 #define B11 -3817
73 #define B11 -244
74 #define B12 2048
74 #define B12 131
75 #define B20 2048
75 #define B20 161
76 #define B21 -3987
76 #define B21 -314
77 #define B22 2048
77 #define B22 161
78
78
79 #define A00 1
79 #define A00 1
80 #define A01 -1850
80 #define A01 -925
81 #define A02 0
81 #define A02 0
82 #define A10 1
82 #define A10 1
83 #define A11 -3787
83 #define A11 -947
84 #define A12 1758
84 #define A12 439
85 #define A20 1
85 #define A20 1
86 #define A21 -3974
86 #define A21 -993
87 #define A22 1943
87 #define A22 486
88
88
89 #define GAIN_B0 17
89 #define GAIN_B0 12
90 #define GAIN_B1 11
90 #define GAIN_B1 11
91 #define GAIN_B2 11
91 #define GAIN_B2 10
92
92
93 #define GAIN_A0 11
93 #define GAIN_A0 10
94 #define GAIN_A1 11
94 #define GAIN_A1 9
95 #define GAIN_A2 11
95 #define GAIN_A2 9
96
96
97 #define NB_COEFFS 3
97 #define NB_COEFFS 3
98 #define COEFF0 0
98 #define COEFF0 0
99 #define COEFF1 1
99 #define COEFF1 1
100 #define COEFF2 2
100 #define COEFF2 2
101
101
102 typedef struct filter_ctx
102 typedef struct filter_ctx
103 {
103 {
104 int W[NB_COEFFS][NB_COEFFS];
104 int W[NB_COEFFS][NB_COEFFS];
105 }filter_ctx;
105 }filter_ctx;
106
106
107 extern gptimer_regs_t *gptimer_regs;
107 extern gptimer_regs_t *gptimer_regs;
108 extern void ASR16_get_FPRF_IURF_ErrorCounters( unsigned int*, unsigned int* );
108 extern void ASR16_get_FPRF_IURF_ErrorCounters( unsigned int*, unsigned int* );
109 extern void CCR_getInstructionAndDataErrorCounters( unsigned int*, unsigned int* );
109 extern void CCR_getInstructionAndDataErrorCounters( unsigned int*, unsigned int* );
110
110
111 extern rtems_name name_hk_rate_monotonic; // name of the HK rate monotonic
111 extern rtems_name name_hk_rate_monotonic; // name of the HK rate monotonic
112 extern rtems_id HK_id;// id of the HK rate monotonic period
112 extern rtems_id HK_id;// id of the HK rate monotonic period
113 extern rtems_name name_avgv_rate_monotonic; // name of the AVGV rate monotonic
113 extern rtems_name name_avgv_rate_monotonic; // name of the AVGV rate monotonic
114 extern rtems_id AVGV_id;// id of the AVGV rate monotonic period
114 extern rtems_id AVGV_id;// id of the AVGV rate monotonic period
115
115
116 void timer_configure( unsigned char timer, unsigned int clock_divider,
116 void timer_configure( unsigned char timer, unsigned int clock_divider,
117 unsigned char interrupt_level, rtems_isr (*timer_isr)() );
117 unsigned char interrupt_level, rtems_isr (*timer_isr)() );
118 void timer_start( unsigned char timer );
118 void timer_start( unsigned char timer );
119 void timer_stop( unsigned char timer );
119 void timer_stop( unsigned char timer );
120 void timer_set_clock_divider(unsigned char timer, unsigned int clock_divider);
120 void timer_set_clock_divider(unsigned char timer, unsigned int clock_divider);
121
121
122 // WATCHDOG
122 // WATCHDOG
123 rtems_isr watchdog_isr( rtems_vector_number vector );
123 rtems_isr watchdog_isr( rtems_vector_number vector );
124 void watchdog_configure(void);
124 void watchdog_configure(void);
125 void watchdog_stop(void);
125 void watchdog_stop(void);
126 void watchdog_reload(void);
126 void watchdog_reload(void);
127 void watchdog_start(void);
127 void watchdog_start(void);
128
128
129 // SERIAL LINK
129 // SERIAL LINK
130 int send_console_outputs_on_apbuart_port( void );
130 int send_console_outputs_on_apbuart_port( void );
131 int enable_apbuart_transmitter( void );
131 int enable_apbuart_transmitter( void );
132 void set_apbuart_scaler_reload_register(unsigned int regs, unsigned int value);
132 void set_apbuart_scaler_reload_register(unsigned int regs, unsigned int value);
133
133
134 // RTEMS TASKS
134 // RTEMS TASKS
135 rtems_task load_task( rtems_task_argument argument );
135 rtems_task load_task( rtems_task_argument argument );
136 rtems_task hous_task( rtems_task_argument argument );
136 rtems_task hous_task( rtems_task_argument argument );
137 rtems_task avgv_task( rtems_task_argument argument );
137 rtems_task avgv_task( rtems_task_argument argument );
138 rtems_task dumb_task( rtems_task_argument unused );
138 rtems_task dumb_task( rtems_task_argument unused );
139
139
140 void init_housekeeping_parameters( void );
140 void init_housekeeping_parameters( void );
141 void increment_seq_counter(unsigned short *packetSequenceControl);
141 void increment_seq_counter(unsigned short *packetSequenceControl);
142 void getTime( unsigned char *time);
142 void getTime( unsigned char *time);
143 unsigned long long int getTimeAsUnsignedLongLongInt( );
143 unsigned long long int getTimeAsUnsignedLongLongInt( );
144 void send_dumb_hk( void );
144 void send_dumb_hk( void );
145 void get_temperatures( unsigned char *temperatures );
145 void get_temperatures( unsigned char *temperatures );
146 void get_v_e1_e2_f3( unsigned char *spacecraft_potential );
146 void get_v_e1_e2_f3( unsigned char *spacecraft_potential );
147 void get_cpu_load( unsigned char *resource_statistics );
147 void get_cpu_load( unsigned char *resource_statistics );
148 void set_hk_lfr_sc_potential_flag( bool state );
148 void set_hk_lfr_sc_potential_flag( bool state );
149 void set_sy_lfr_pas_filter_enabled( bool state );
149 void set_sy_lfr_pas_filter_enabled( bool state );
150 void set_sy_lfr_watchdog_enabled( bool state );
150 void set_sy_lfr_watchdog_enabled( bool state );
151 void set_hk_lfr_calib_enable( bool state );
151 void set_hk_lfr_calib_enable( bool state );
152 void set_hk_lfr_reset_cause( enum lfr_reset_cause_t lfr_reset_cause );
152 void set_hk_lfr_reset_cause( enum lfr_reset_cause_t lfr_reset_cause );
153 void hk_lfr_le_me_he_update();
153 void hk_lfr_le_me_he_update();
154 void set_hk_lfr_time_not_synchro();
154 void set_hk_lfr_time_not_synchro();
155
155
156 extern int sched_yield( void );
156 extern int sched_yield( void );
157 extern void rtems_cpu_usage_reset();
157 extern void rtems_cpu_usage_reset();
158 extern ring_node *current_ring_node_f3;
158 extern ring_node *current_ring_node_f3;
159 extern ring_node *ring_node_to_send_cwf_f3;
159 extern ring_node *ring_node_to_send_cwf_f3;
160 extern ring_node waveform_ring_f3[];
160 extern ring_node waveform_ring_f3[];
161 extern unsigned short sequenceCounterHK;
161 extern unsigned short sequenceCounterHK;
162
162
163 extern unsigned char hk_lfr_q_sd_fifo_size_max;
163 extern unsigned char hk_lfr_q_sd_fifo_size_max;
164 extern unsigned char hk_lfr_q_rv_fifo_size_max;
164 extern unsigned char hk_lfr_q_rv_fifo_size_max;
165 extern unsigned char hk_lfr_q_p0_fifo_size_max;
165 extern unsigned char hk_lfr_q_p0_fifo_size_max;
166 extern unsigned char hk_lfr_q_p1_fifo_size_max;
166 extern unsigned char hk_lfr_q_p1_fifo_size_max;
167 extern unsigned char hk_lfr_q_p2_fifo_size_max;
167 extern unsigned char hk_lfr_q_p2_fifo_size_max;
168
168
169 #endif // FSW_MISC_H_INCLUDED
169 #endif // FSW_MISC_H_INCLUDED
@@ -1,107 +1,107
1 cmake_minimum_required (VERSION 2.6)
1 cmake_minimum_required (VERSION 2.6)
2 project (fsw)
2 project (fsw)
3
3
4 include(sparc-rtems)
4 include(sparc-rtems)
5 include(cppcheck)
5 include(cppcheck)
6
6
7 include_directories("../header"
7 include_directories("../header"
8 "../header/lfr_common_headers"
8 "../header/lfr_common_headers"
9 "../header/processing"
9 "../header/processing"
10 "../LFR_basic-parameters"
10 "../LFR_basic-parameters"
11 "../src")
11 "../src")
12
12
13 set(SOURCES wf_handler.c
13 set(SOURCES wf_handler.c
14 tc_handler.c
14 tc_handler.c
15 fsw_misc.c
15 fsw_misc.c
16 fsw_init.c
16 fsw_init.c
17 fsw_globals.c
17 fsw_globals.c
18 fsw_spacewire.c
18 fsw_spacewire.c
19 tc_load_dump_parameters.c
19 tc_load_dump_parameters.c
20 tm_lfr_tc_exe.c
20 tm_lfr_tc_exe.c
21 tc_acceptance.c
21 tc_acceptance.c
22 processing/fsw_processing.c
22 processing/fsw_processing.c
23 processing/avf0_prc0.c
23 processing/avf0_prc0.c
24 processing/avf1_prc1.c
24 processing/avf1_prc1.c
25 processing/avf2_prc2.c
25 processing/avf2_prc2.c
26 lfr_cpu_usage_report.c
26 lfr_cpu_usage_report.c
27 ${LFR_BP_SRC}
27 ${LFR_BP_SRC}
28 ../header/wf_handler.h
28 ../header/wf_handler.h
29 ../header/tc_handler.h
29 ../header/tc_handler.h
30 ../header/grlib_regs.h
30 ../header/grlib_regs.h
31 ../header/fsw_misc.h
31 ../header/fsw_misc.h
32 ../header/fsw_init.h
32 ../header/fsw_init.h
33 ../header/fsw_spacewire.h
33 ../header/fsw_spacewire.h
34 ../header/tc_load_dump_parameters.h
34 ../header/tc_load_dump_parameters.h
35 ../header/tm_lfr_tc_exe.h
35 ../header/tm_lfr_tc_exe.h
36 ../header/tc_acceptance.h
36 ../header/tc_acceptance.h
37 ../header/processing/fsw_processing.h
37 ../header/processing/fsw_processing.h
38 ../header/processing/avf0_prc0.h
38 ../header/processing/avf0_prc0.h
39 ../header/processing/avf1_prc1.h
39 ../header/processing/avf1_prc1.h
40 ../header/processing/avf2_prc2.h
40 ../header/processing/avf2_prc2.h
41 ../header/fsw_params_wf_handler.h
41 ../header/fsw_params_wf_handler.h
42 ../header/lfr_cpu_usage_report.h
42 ../header/lfr_cpu_usage_report.h
43 ../header/lfr_common_headers/ccsds_types.h
43 ../header/lfr_common_headers/ccsds_types.h
44 ../header/lfr_common_headers/fsw_params.h
44 ../header/lfr_common_headers/fsw_params.h
45 ../header/lfr_common_headers/fsw_params_nb_bytes.h
45 ../header/lfr_common_headers/fsw_params_nb_bytes.h
46 ../header/lfr_common_headers/fsw_params_processing.h
46 ../header/lfr_common_headers/fsw_params_processing.h
47 ../header/lfr_common_headers/tm_byte_positions.h
47 ../header/lfr_common_headers/tm_byte_positions.h
48 ../LFR_basic-parameters/basic_parameters.h
48 ../LFR_basic-parameters/basic_parameters.h
49 ../LFR_basic-parameters/basic_parameters_params.h
49 ../LFR_basic-parameters/basic_parameters_params.h
50 ../header/GscMemoryLPP.hpp
50 ../header/GscMemoryLPP.hpp
51 )
51 )
52
52
53
53
54 option(FSW_verbose "Enable verbose LFR" OFF)
54 option(FSW_verbose "Enable verbose LFR" OFF)
55 option(FSW_boot_messages "Enable LFR boot messages" OFF)
55 option(FSW_boot_messages "Enable LFR boot messages" OFF)
56 option(FSW_debug_messages "Enable LFR debug messages" OFF)
56 option(FSW_debug_messages "Enable LFR debug messages" OFF)
57 option(FSW_cpu_usage_report "Enable LFR cpu usage report" OFF)
57 option(FSW_cpu_usage_report "Enable LFR cpu usage report" OFF)
58 option(FSW_stack_report "Enable LFR stack report" OFF)
58 option(FSW_stack_report "Enable LFR stack report" OFF)
59 option(FSW_vhdl_dev "?" OFF)
59 option(FSW_vhdl_dev "?" OFF)
60 option(FSW_lpp_dpu_destid "Set to debug at LPP" OFF)
60 option(FSW_lpp_dpu_destid "Set to debug at LPP" ON)
61 option(FSW_debug_watchdog "Enable debug watchdog" OFF)
61 option(FSW_debug_watchdog "Enable debug watchdog" OFF)
62 option(FSW_debug_tch "?" OFF)
62 option(FSW_debug_tch "?" OFF)
63
63
64 set(SW_VERSION_N1 "3" CACHE STRING "Choose N1 FSW Version." FORCE)
64 set(SW_VERSION_N1 "3" CACHE STRING "Choose N1 FSW Version." FORCE)
65 set(SW_VERSION_N2 "2" CACHE STRING "Choose N2 FSW Version." FORCE)
65 set(SW_VERSION_N2 "2" CACHE STRING "Choose N2 FSW Version." FORCE)
66 set(SW_VERSION_N3 "0" CACHE STRING "Choose N3 FSW Version." FORCE)
66 set(SW_VERSION_N3 "0" CACHE STRING "Choose N3 FSW Version." FORCE)
67 set(SW_VERSION_N4 "13" CACHE STRING "Choose N4 FSW Version." FORCE)
67 set(SW_VERSION_N4 "14" CACHE STRING "Choose N4 FSW Version." FORCE)
68
68
69 if(FSW_verbose)
69 if(FSW_verbose)
70 add_definitions(-DPRINT_MESSAGES_ON_CONSOLE)
70 add_definitions(-DPRINT_MESSAGES_ON_CONSOLE)
71 endif()
71 endif()
72 if(FSW_boot_messages)
72 if(FSW_boot_messages)
73 add_definitions(-DBOOT_MESSAGES)
73 add_definitions(-DBOOT_MESSAGES)
74 endif()
74 endif()
75 if(FSW_debug_messages)
75 if(FSW_debug_messages)
76 add_definitions(-DDEBUG_MESSAGES)
76 add_definitions(-DDEBUG_MESSAGES)
77 endif()
77 endif()
78 if(FSW_cpu_usage_report)
78 if(FSW_cpu_usage_report)
79 add_definitions(-DPRINT_TASK_STATISTICS)
79 add_definitions(-DPRINT_TASK_STATISTICS)
80 endif()
80 endif()
81 if(FSW_stack_report)
81 if(FSW_stack_report)
82 add_definitions(-DPRINT_STACK_REPORT)
82 add_definitions(-DPRINT_STACK_REPORT)
83 endif()
83 endif()
84 if(FSW_vhdl_dev)
84 if(FSW_vhdl_dev)
85 add_definitions(-DVHDL_DEV)
85 add_definitions(-DVHDL_DEV)
86 endif()
86 endif()
87 if(FSW_lpp_dpu_destid)
87 if(FSW_lpp_dpu_destid)
88 add_definitions(-DLPP_DPU_DESTID)
88 add_definitions(-DLPP_DPU_DESTID)
89 endif()
89 endif()
90 if(FSW_debug_watchdog)
90 if(FSW_debug_watchdog)
91 add_definitions(-DDEBUG_WATCHDOG)
91 add_definitions(-DDEBUG_WATCHDOG)
92 endif()
92 endif()
93 if(FSW_debug_tch)
93 if(FSW_debug_tch)
94 add_definitions(-DDEBUG_TCH)
94 add_definitions(-DDEBUG_TCH)
95 endif()
95 endif()
96
96
97 add_definitions(-DMSB_FIRST_TCH)
97 add_definitions(-DMSB_FIRST_TCH)
98
98
99 add_definitions(-DSWVERSION=-1-0)
99 add_definitions(-DSWVERSION=-1-0)
100 add_definitions(-DSW_VERSION_N1=${SW_VERSION_N1})
100 add_definitions(-DSW_VERSION_N1=${SW_VERSION_N1})
101 add_definitions(-DSW_VERSION_N2=${SW_VERSION_N2})
101 add_definitions(-DSW_VERSION_N2=${SW_VERSION_N2})
102 add_definitions(-DSW_VERSION_N3=${SW_VERSION_N3})
102 add_definitions(-DSW_VERSION_N3=${SW_VERSION_N3})
103 add_definitions(-DSW_VERSION_N4=${SW_VERSION_N4})
103 add_definitions(-DSW_VERSION_N4=${SW_VERSION_N4})
104
104
105 add_executable(fsw ${SOURCES})
105 add_executable(fsw ${SOURCES})
106 add_test_cppcheck(fsw STYLE UNUSED_FUNCTIONS POSSIBLE_ERROR MISSING_INCLUDE)
106 add_test_cppcheck(fsw STYLE UNUSED_FUNCTIONS POSSIBLE_ERROR MISSING_INCLUDE)
107
107
General Comments 0
You need to be logged in to leave comments. Login now