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