@@ -1,2 +1,2 | |||||
1 | a586fe639ac179e95bdc150ebdbab0312f31dc30 LFR_basic-parameters |
|
1 | a586fe639ac179e95bdc150ebdbab0312f31dc30 LFR_basic-parameters | |
2 | a806a190dcd72f71d336545073400d3cdaaa3119 header/lfr_common_headers |
|
2 | 72c4d5eb0bb95a1546beb2b22c8b88c31322ae31 header/lfr_common_headers |
@@ -1,112 +1,112 | |||||
1 | TEMPLATE = app |
|
1 | TEMPLATE = app | |
2 | # CONFIG += console v8 sim |
|
2 | # CONFIG += console v8 sim | |
3 | # CONFIG options = verbose *** boot_messages *** debug_messages *** cpu_usage_report *** stack_report *** vhdl_dev *** debug_tch |
|
3 | # CONFIG options = verbose *** boot_messages *** debug_messages *** cpu_usage_report *** stack_report *** vhdl_dev *** debug_tch | |
4 | # lpp_dpu_destid |
|
4 | # lpp_dpu_destid | |
5 | CONFIG += console verbose lpp_dpu_destid |
|
5 | CONFIG += console verbose lpp_dpu_destid cpu_usage_report | |
6 | CONFIG -= qt |
|
6 | CONFIG -= qt | |
7 |
|
7 | |||
8 | include(./sparc.pri) |
|
8 | include(./sparc.pri) | |
9 |
|
9 | |||
10 | # flight software version |
|
10 | # flight software version | |
11 | SWVERSION=-1-0 |
|
11 | SWVERSION=-1-0 | |
12 | DEFINES += SW_VERSION_N1=3 # major |
|
12 | DEFINES += SW_VERSION_N1=3 # major | |
13 | DEFINES += SW_VERSION_N2=0 # minor |
|
13 | DEFINES += SW_VERSION_N2=0 # minor | |
14 | DEFINES += SW_VERSION_N3=0 # patch |
|
14 | DEFINES += SW_VERSION_N3=0 # patch | |
15 | DEFINES += SW_VERSION_N4=0 # internal |
|
15 | DEFINES += SW_VERSION_N4=0 # internal | |
16 |
|
16 | |||
17 | # <GCOV> |
|
17 | # <GCOV> | |
18 | #QMAKE_CFLAGS_RELEASE += -fprofile-arcs -ftest-coverage |
|
18 | #QMAKE_CFLAGS_RELEASE += -fprofile-arcs -ftest-coverage | |
19 | #LIBS += -lgcov /opt/GCOV/01A/lib/overload.o -lc |
|
19 | #LIBS += -lgcov /opt/GCOV/01A/lib/overload.o -lc | |
20 | # </GCOV> |
|
20 | # </GCOV> | |
21 |
|
21 | |||
22 | # <CHANGE BEFORE FLIGHT> |
|
22 | # <CHANGE BEFORE FLIGHT> | |
23 | contains( CONFIG, lpp_dpu_destid ) { |
|
23 | contains( CONFIG, lpp_dpu_destid ) { | |
24 | DEFINES += LPP_DPU_DESTID |
|
24 | DEFINES += LPP_DPU_DESTID | |
25 | } |
|
25 | } | |
26 | # </CHANGE BEFORE FLIGHT> |
|
26 | # </CHANGE BEFORE FLIGHT> | |
27 |
|
27 | |||
28 | contains( CONFIG, debug_tch ) { |
|
28 | contains( CONFIG, debug_tch ) { | |
29 | DEFINES += DEBUG_TCH |
|
29 | DEFINES += DEBUG_TCH | |
30 | } |
|
30 | } | |
31 | DEFINES += MSB_FIRST_TCH |
|
31 | DEFINES += MSB_FIRST_TCH | |
32 |
|
32 | |||
33 | contains( CONFIG, vhdl_dev ) { |
|
33 | contains( CONFIG, vhdl_dev ) { | |
34 | DEFINES += VHDL_DEV |
|
34 | DEFINES += VHDL_DEV | |
35 | } |
|
35 | } | |
36 |
|
36 | |||
37 | contains( CONFIG, verbose ) { |
|
37 | contains( CONFIG, verbose ) { | |
38 | DEFINES += PRINT_MESSAGES_ON_CONSOLE |
|
38 | DEFINES += PRINT_MESSAGES_ON_CONSOLE | |
39 | } |
|
39 | } | |
40 |
|
40 | |||
41 | contains( CONFIG, debug_messages ) { |
|
41 | contains( CONFIG, debug_messages ) { | |
42 | DEFINES += DEBUG_MESSAGES |
|
42 | DEFINES += DEBUG_MESSAGES | |
43 | } |
|
43 | } | |
44 |
|
44 | |||
45 | contains( CONFIG, cpu_usage_report ) { |
|
45 | contains( CONFIG, cpu_usage_report ) { | |
46 | DEFINES += PRINT_TASK_STATISTICS |
|
46 | DEFINES += PRINT_TASK_STATISTICS | |
47 | } |
|
47 | } | |
48 |
|
48 | |||
49 | contains( CONFIG, stack_report ) { |
|
49 | contains( CONFIG, stack_report ) { | |
50 | DEFINES += PRINT_STACK_REPORT |
|
50 | DEFINES += PRINT_STACK_REPORT | |
51 | } |
|
51 | } | |
52 |
|
52 | |||
53 | contains( CONFIG, boot_messages ) { |
|
53 | contains( CONFIG, boot_messages ) { | |
54 | DEFINES += BOOT_MESSAGES |
|
54 | DEFINES += BOOT_MESSAGES | |
55 | } |
|
55 | } | |
56 |
|
56 | |||
57 | #doxygen.target = doxygen |
|
57 | #doxygen.target = doxygen | |
58 | #doxygen.commands = doxygen ../doc/Doxyfile |
|
58 | #doxygen.commands = doxygen ../doc/Doxyfile | |
59 | #QMAKE_EXTRA_TARGETS += doxygen |
|
59 | #QMAKE_EXTRA_TARGETS += doxygen | |
60 |
|
60 | |||
61 | TARGET = fsw |
|
61 | TARGET = fsw | |
62 |
|
62 | |||
63 | INCLUDEPATH += \ |
|
63 | INCLUDEPATH += \ | |
64 | $${PWD}/../src \ |
|
64 | $${PWD}/../src \ | |
65 | $${PWD}/../header \ |
|
65 | $${PWD}/../header \ | |
66 | $${PWD}/../header/lfr_common_headers \ |
|
66 | $${PWD}/../header/lfr_common_headers \ | |
67 | $${PWD}/../header/processing \ |
|
67 | $${PWD}/../header/processing \ | |
68 | $${PWD}/../LFR_basic-parameters |
|
68 | $${PWD}/../LFR_basic-parameters | |
69 |
|
69 | |||
70 | SOURCES += \ |
|
70 | SOURCES += \ | |
71 | ../src/wf_handler.c \ |
|
71 | ../src/wf_handler.c \ | |
72 | ../src/tc_handler.c \ |
|
72 | ../src/tc_handler.c \ | |
73 | ../src/fsw_misc.c \ |
|
73 | ../src/fsw_misc.c \ | |
74 | ../src/fsw_init.c \ |
|
74 | ../src/fsw_init.c \ | |
75 | ../src/fsw_globals.c \ |
|
75 | ../src/fsw_globals.c \ | |
76 | ../src/fsw_spacewire.c \ |
|
76 | ../src/fsw_spacewire.c \ | |
77 | ../src/tc_load_dump_parameters.c \ |
|
77 | ../src/tc_load_dump_parameters.c \ | |
78 | ../src/tm_lfr_tc_exe.c \ |
|
78 | ../src/tm_lfr_tc_exe.c \ | |
79 | ../src/tc_acceptance.c \ |
|
79 | ../src/tc_acceptance.c \ | |
80 | ../src/processing/fsw_processing.c \ |
|
80 | ../src/processing/fsw_processing.c \ | |
81 | ../src/processing/avf0_prc0.c \ |
|
81 | ../src/processing/avf0_prc0.c \ | |
82 | ../src/processing/avf1_prc1.c \ |
|
82 | ../src/processing/avf1_prc1.c \ | |
83 | ../src/processing/avf2_prc2.c \ |
|
83 | ../src/processing/avf2_prc2.c \ | |
84 | ../src/lfr_cpu_usage_report.c \ |
|
84 | ../src/lfr_cpu_usage_report.c \ | |
85 | ../LFR_basic-parameters/basic_parameters.c |
|
85 | ../LFR_basic-parameters/basic_parameters.c | |
86 |
|
86 | |||
87 | HEADERS += \ |
|
87 | HEADERS += \ | |
88 | ../header/wf_handler.h \ |
|
88 | ../header/wf_handler.h \ | |
89 | ../header/tc_handler.h \ |
|
89 | ../header/tc_handler.h \ | |
90 | ../header/grlib_regs.h \ |
|
90 | ../header/grlib_regs.h \ | |
91 | ../header/fsw_misc.h \ |
|
91 | ../header/fsw_misc.h \ | |
92 | ../header/fsw_init.h \ |
|
92 | ../header/fsw_init.h \ | |
93 | ../header/fsw_spacewire.h \ |
|
93 | ../header/fsw_spacewire.h \ | |
94 | ../header/tc_load_dump_parameters.h \ |
|
94 | ../header/tc_load_dump_parameters.h \ | |
95 | ../header/tm_lfr_tc_exe.h \ |
|
95 | ../header/tm_lfr_tc_exe.h \ | |
96 | ../header/tc_acceptance.h \ |
|
96 | ../header/tc_acceptance.h \ | |
97 | ../header/processing/fsw_processing.h \ |
|
97 | ../header/processing/fsw_processing.h \ | |
98 | ../header/processing/avf0_prc0.h \ |
|
98 | ../header/processing/avf0_prc0.h \ | |
99 | ../header/processing/avf1_prc1.h \ |
|
99 | ../header/processing/avf1_prc1.h \ | |
100 | ../header/processing/avf2_prc2.h \ |
|
100 | ../header/processing/avf2_prc2.h \ | |
101 | ../header/fsw_params_wf_handler.h \ |
|
101 | ../header/fsw_params_wf_handler.h \ | |
102 | ../header/lfr_cpu_usage_report.h \ |
|
102 | ../header/lfr_cpu_usage_report.h \ | |
103 | ../header/lfr_common_headers/ccsds_types.h \ |
|
103 | ../header/lfr_common_headers/ccsds_types.h \ | |
104 | ../header/lfr_common_headers/fsw_params.h \ |
|
104 | ../header/lfr_common_headers/fsw_params.h \ | |
105 | ../header/lfr_common_headers/fsw_params_nb_bytes.h \ |
|
105 | ../header/lfr_common_headers/fsw_params_nb_bytes.h \ | |
106 | ../header/lfr_common_headers/fsw_params_processing.h \ |
|
106 | ../header/lfr_common_headers/fsw_params_processing.h \ | |
107 | ../header/lfr_common_headers/TC_types.h \ |
|
107 | ../header/lfr_common_headers/TC_types.h \ | |
108 | ../header/lfr_common_headers/tm_byte_positions.h \ |
|
108 | ../header/lfr_common_headers/tm_byte_positions.h \ | |
109 | ../LFR_basic-parameters/basic_parameters.h \ |
|
109 | ../LFR_basic-parameters/basic_parameters.h \ | |
110 | ../LFR_basic-parameters/basic_parameters_params.h \ |
|
110 | ../LFR_basic-parameters/basic_parameters_params.h \ | |
111 | ../header/GscMemoryLPP.hpp |
|
111 | ../header/GscMemoryLPP.hpp | |
112 |
|
112 |
@@ -1,62 +1,69 | |||||
1 | #ifndef GSCMEMORY_HPP_ |
|
1 | #ifndef GSCMEMORY_HPP_ | |
2 | #define GSCMEMORY_HPP_ |
|
2 | #define GSCMEMORY_HPP_ | |
3 |
|
3 | |||
4 | #ifndef LEON3 |
|
4 | #ifndef LEON3 | |
5 | #define LEON3 |
|
5 | #define LEON3 | |
6 | #endif |
|
6 | #endif | |
7 |
|
7 | |||
8 | static unsigned int getCacheControlRegister(){ |
|
8 | static unsigned int getCacheControlRegister(){ | |
9 | #ifdef LEON3 |
|
9 | #ifdef LEON3 | |
10 | unsigned int cacheControlRegister = 0; |
|
10 | unsigned int cacheControlRegister = 0; | |
11 | __asm__ __volatile__("lda [%%g0] 2, %0" : "=r"(cacheControlRegister) : ); |
|
11 | __asm__ __volatile__("lda [%%g0] 2, %0" : "=r"(cacheControlRegister) : ); | |
12 | return cacheControlRegister; |
|
12 | return cacheControlRegister; | |
13 | #endif |
|
13 | #endif | |
14 | } |
|
14 | } | |
15 |
|
15 | |||
16 | static void setCacheControlRegister(unsigned int cacheControlRegister) |
|
16 | static void setCacheControlRegister(unsigned int cacheControlRegister) | |
17 | { |
|
17 | { | |
18 | #ifdef LEON3 |
|
18 | #ifdef LEON3 | |
19 | __asm__ __volatile__("sta %0, [%%g0] 2" : : "r"(cacheControlRegister)); |
|
19 | __asm__ __volatile__("sta %0, [%%g0] 2" : : "r"(cacheControlRegister)); | |
20 | #endif |
|
20 | #endif | |
21 | } |
|
21 | } | |
22 |
|
22 | |||
23 |
|
23 | |||
24 | /** |
|
24 | /** | |
25 | * Flush the data cache and the instruction cache. |
|
25 | * Flush the data cache and the instruction cache. | |
26 | * |
|
26 | * | |
27 | * @return |
|
27 | * @return | |
28 | */ |
|
28 | */ | |
29 | static inline void flushCache() { |
|
29 | static inline void flushCache() { | |
30 | asm("flush"); |
|
30 | asm("flush"); | |
31 | } |
|
31 | } | |
32 |
|
32 | |||
|
33 | static void resetCacheControlRegister() { | |||
|
34 | #ifdef LEON3 | |||
|
35 | unsigned int cacheControlRegister; | |||
|
36 | cacheControlRegister = 0x00; | |||
|
37 | setCacheControlRegister(cacheControlRegister); | |||
|
38 | #endif | |||
|
39 | } | |||
33 |
|
40 | |||
34 | static void enableInstructionCache() { |
|
41 | static void enableInstructionCache() { | |
35 | #ifdef LEON3 |
|
42 | #ifdef LEON3 | |
36 | unsigned int cacheControlRegister; |
|
43 | unsigned int cacheControlRegister; | |
37 | cacheControlRegister = getCacheControlRegister(); |
|
44 | cacheControlRegister = getCacheControlRegister(); | |
38 | cacheControlRegister = (cacheControlRegister | 0x3); |
|
45 | cacheControlRegister = (cacheControlRegister | 0x3); | |
39 | setCacheControlRegister(cacheControlRegister); |
|
46 | setCacheControlRegister(cacheControlRegister); | |
40 | #endif |
|
47 | #endif | |
41 | } |
|
48 | } | |
42 |
|
49 | |||
43 | static void enableDataCache() { |
|
50 | static void enableDataCache() { | |
44 | #ifdef LEON3 |
|
51 | #ifdef LEON3 | |
45 | unsigned int cacheControlRegister; |
|
52 | unsigned int cacheControlRegister; | |
46 | cacheControlRegister = getCacheControlRegister(); |
|
53 | cacheControlRegister = getCacheControlRegister(); | |
47 | cacheControlRegister = (cacheControlRegister | 0xc); |
|
54 | cacheControlRegister = (cacheControlRegister | 0xc); | |
48 | setCacheControlRegister(cacheControlRegister); |
|
55 | setCacheControlRegister(cacheControlRegister); | |
49 | #endif |
|
56 | #endif | |
50 | } |
|
57 | } | |
51 |
|
58 | |||
52 | static void enableInstructionBurstFetch() { |
|
59 | static void enableInstructionBurstFetch() { | |
53 | #ifdef LEON3 |
|
60 | #ifdef LEON3 | |
54 | unsigned int cacheControlRegister; |
|
61 | unsigned int cacheControlRegister; | |
55 | cacheControlRegister = getCacheControlRegister(); |
|
62 | cacheControlRegister = getCacheControlRegister(); | |
56 | // set the bit IB to 1 |
|
63 | // set the bit IB to 1 | |
57 | cacheControlRegister = (cacheControlRegister | 0x10000); |
|
64 | cacheControlRegister = (cacheControlRegister | 0x10000); | |
58 | setCacheControlRegister(cacheControlRegister); |
|
65 | setCacheControlRegister(cacheControlRegister); | |
59 | #endif |
|
66 | #endif | |
60 | } |
|
67 | } | |
61 |
|
68 | |||
62 | #endif /* GSCMEMORY_HPP_ */ |
|
69 | #endif /* GSCMEMORY_HPP_ */ |
@@ -1,48 +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 |
|
14 | |||
15 | extern spw_stats spacewire_stats; |
|
15 | extern spw_stats spacewire_stats; | |
16 | extern spw_stats spacewire_stats_backup; |
|
16 | extern spw_stats spacewire_stats_backup; | |
17 |
|
17 | |||
18 | // RTEMS TASK |
|
18 | // RTEMS TASK | |
19 | rtems_task spiq_task( rtems_task_argument argument ); |
|
19 | rtems_task spiq_task( rtems_task_argument argument ); | |
20 | rtems_task recv_task( rtems_task_argument unused ); |
|
20 | rtems_task recv_task( rtems_task_argument unused ); | |
21 | rtems_task send_task( rtems_task_argument argument ); |
|
21 | rtems_task send_task( rtems_task_argument argument ); | |
22 | rtems_task wtdg_task( rtems_task_argument argument ); |
|
22 | rtems_task wtdg_task( rtems_task_argument argument ); | |
23 |
|
23 | |||
24 | int spacewire_open_link( void ); |
|
24 | int spacewire_open_link( void ); | |
25 | int spacewire_start_link( int fd ); |
|
25 | int spacewire_start_link( int fd ); | |
26 | int spacewire_stop_and_start_link( int fd ); |
|
26 | int spacewire_stop_and_start_link( int fd ); | |
27 | int spacewire_configure_link(int fd ); |
|
27 | int spacewire_configure_link(int fd ); | |
28 | int spacewire_reset_link( void ); |
|
28 | int spacewire_reset_link( void ); | |
29 | void spacewire_set_NP( unsigned char val, unsigned int regAddr ); // No Port force |
|
29 | void spacewire_set_NP( unsigned char val, unsigned int regAddr ); // No Port force | |
30 | void spacewire_set_RE( unsigned char val, unsigned int regAddr ); // RMAP Enable |
|
30 | void spacewire_set_RE( unsigned char val, unsigned int regAddr ); // RMAP Enable | |
31 | void spacewire_compute_stats_offsets( void ); |
|
31 | void spacewire_compute_stats_offsets( void ); | |
32 | void spacewire_update_statistics( void ); |
|
32 | void spacewire_update_statistics( void ); | |
33 |
|
33 | |||
34 | void init_header_cwf( Header_TM_LFR_SCIENCE_CWF_t *header ); |
|
34 | void init_header_cwf( Header_TM_LFR_SCIENCE_CWF_t *header ); | |
35 | void init_header_swf( Header_TM_LFR_SCIENCE_SWF_t *header ); |
|
35 | void init_header_swf( Header_TM_LFR_SCIENCE_SWF_t *header ); | |
36 | void init_header_asm( Header_TM_LFR_SCIENCE_ASM_t *header ); |
|
36 | void init_header_asm( Header_TM_LFR_SCIENCE_ASM_t *header ); | |
37 | int spw_send_waveform_CWF( ring_node *ring_node_to_send, Header_TM_LFR_SCIENCE_CWF_t *header ); |
|
37 | int spw_send_waveform_CWF( ring_node *ring_node_to_send, Header_TM_LFR_SCIENCE_CWF_t *header ); | |
38 | int spw_send_waveform_SWF( ring_node *ring_node_to_send, Header_TM_LFR_SCIENCE_SWF_t *header ); |
|
38 | int spw_send_waveform_SWF( ring_node *ring_node_to_send, Header_TM_LFR_SCIENCE_SWF_t *header ); | |
39 | int spw_send_waveform_CWF3_light( ring_node *ring_node_to_send, Header_TM_LFR_SCIENCE_CWF_t *header ); |
|
39 | int spw_send_waveform_CWF3_light( ring_node *ring_node_to_send, Header_TM_LFR_SCIENCE_CWF_t *header ); | |
40 | void spw_send_asm( ring_node *ring_node_to_send, Header_TM_LFR_SCIENCE_ASM_t *header ); |
|
40 | void spw_send_asm_f0( ring_node *ring_node_to_send, Header_TM_LFR_SCIENCE_ASM_t *header ); | |
|
41 | void spw_send_asm_f1( ring_node *ring_node_to_send, Header_TM_LFR_SCIENCE_ASM_t *header ); | |||
|
42 | void spw_send_asm_f2( ring_node *ring_node_to_send, Header_TM_LFR_SCIENCE_ASM_t *header ); | |||
41 | void spw_send_k_dump( ring_node *ring_node_to_send ); |
|
43 | void spw_send_k_dump( ring_node *ring_node_to_send ); | |
42 |
|
44 | |||
43 | void timecode_irq_handler( void *pDev, void *regs, int minor, unsigned int tc ); |
|
45 | void timecode_irq_handler( void *pDev, void *regs, int minor, unsigned int tc ); | |
44 | rtems_timer_service_routine user_routine( rtems_id timer_id, void *user_data ); |
|
46 | rtems_timer_service_routine user_routine( rtems_id timer_id, void *user_data ); | |
45 |
|
47 | |||
46 | 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 ); | |
47 |
|
49 | |||
48 | #endif // FSW_SPACEWIRE_H_INCLUDED |
|
50 | #endif // FSW_SPACEWIRE_H_INCLUDED |
@@ -1,14 +1,14 | |||||
1 | # LOAD FSW USING LINK 1 |
|
1 | # LOAD FSW USING LINK 1 | |
2 |
SpwPlugin0.StarDundeeSelectLinkNumber( |
|
2 | SpwPlugin0.StarDundeeSelectLinkNumber( 1 ) | |
3 |
|
3 | |||
4 | dsu3plugin0.openFile("/opt/DEV_PLE/FSW-qt/bin/fsw") |
|
4 | dsu3plugin0.openFile("/opt/DEV_PLE/FSW-qt/bin/fsw") | |
5 | #dsu3plugin0.openFile("/opt/LFR/LFR-FSW/2.0.2.3/fsw") |
|
5 | #dsu3plugin0.openFile("/opt/LFR/LFR-FSW/2.0.2.3/fsw") | |
6 | dsu3plugin0.loadFile() |
|
6 | dsu3plugin0.loadFile() | |
7 |
|
7 | |||
8 | dsu3plugin0.run() |
|
8 | dsu3plugin0.run() | |
9 |
|
9 | |||
10 | # START SENDING TIMECODES AT 1 Hz |
|
10 | # START SENDING TIMECODES AT 1 Hz | |
11 | SpwPlugin0.StarDundeeStartTimecodes( 1 ) |
|
11 | SpwPlugin0.StarDundeeStartTimecodes( 1 ) | |
12 |
|
12 | |||
13 | # it is possible to change the time code frequency |
|
13 | # it is possible to change the time code frequency | |
14 | #RMAPPlugin0.changeTimecodeFrequency(2) |
|
14 | #RMAPPlugin0.changeTimecodeFrequency(2) |
@@ -1,25 +1,25 | |||||
1 | #include <drvmgr/ambapp_bus.h> |
|
1 | #include <drvmgr/ambapp_bus.h> | |
2 |
|
2 | |||
3 | // GRSPW0 resources |
|
3 | // GRSPW0 resources | |
4 | struct drvmgr_key grlib_grspw_0n1_res[] = { |
|
4 | struct drvmgr_key grlib_grspw_0n1_res[] = { | |
5 | {"txBdCnt", KEY_TYPE_INT, {(unsigned int)50}}, // 7 SWF_F0, 7 SWF_F1, 7 SWF_F2, 7 CWF_F3, 7 CWF_F1 ou 7 CWF_F2 |
|
5 | {"txBdCnt", KEY_TYPE_INT, {(unsigned int)50}}, // 7 SWF_F0, 7 SWF_F1, 7 SWF_F2, 7 CWF_F3, 7 CWF_F1 ou 7 CWF_F2 | |
6 | {"rxBdCnt", KEY_TYPE_INT, {(unsigned int)10}}, |
|
6 | {"rxBdCnt", KEY_TYPE_INT, {(unsigned int)10}}, | |
7 | {"txDataSize", KEY_TYPE_INT, {(unsigned int)4096}}, |
|
7 | {"txDataSize", KEY_TYPE_INT, {(unsigned int)4096}}, | |
8 |
|
|
8 | {"txHdrSize", KEY_TYPE_INT, {(unsigned int)34}}, | |
9 | {"rxPktSize", KEY_TYPE_INT, {(unsigned int)248+4}}, |
|
9 | {"rxPktSize", KEY_TYPE_INT, {(unsigned int)248+4}}, | |
10 | KEY_EMPTY |
|
10 | KEY_EMPTY | |
11 | }; |
|
11 | }; | |
12 |
|
12 | |||
13 | // If RTEMS_DRVMGR_STARTUP is defined we override the "weak defaults" that is defined by the LEON3 BSP. |
|
13 | // If RTEMS_DRVMGR_STARTUP is defined we override the "weak defaults" that is defined by the LEON3 BSP. | |
14 |
|
14 | |||
15 | struct drvmgr_bus_res grlib_drv_resources = { |
|
15 | struct drvmgr_bus_res grlib_drv_resources = { | |
16 | .next = NULL, |
|
16 | .next = NULL, | |
17 | .resource = { |
|
17 | .resource = { | |
18 | {DRIVER_AMBAPP_GAISLER_GRSPW_ID, 0, &grlib_grspw_0n1_res[0]}, |
|
18 | {DRIVER_AMBAPP_GAISLER_GRSPW_ID, 0, &grlib_grspw_0n1_res[0]}, | |
19 | // {DRIVER_AMBAPP_GAISLER_APBUART_ID, 0, &grlib_drv_res_apbuart0[0]}, |
|
19 | // {DRIVER_AMBAPP_GAISLER_APBUART_ID, 0, &grlib_drv_res_apbuart0[0]}, | |
20 | // {DRIVER_AMBAPP_GAISLER_APBUART_ID, 1, &grlib_drv_res_apbuart1[0]}, |
|
20 | // {DRIVER_AMBAPP_GAISLER_APBUART_ID, 1, &grlib_drv_res_apbuart1[0]}, | |
21 | RES_EMPTY /* Mark end of device resource array */ |
|
21 | RES_EMPTY /* Mark end of device resource array */ | |
22 | } |
|
22 | } | |
23 | }; |
|
23 | }; | |
24 |
|
24 | |||
25 |
|
25 |
@@ -1,812 +1,814 | |||||
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 |
|
63 | |||
64 | void initCache() |
|
64 | void initCache() | |
65 | { |
|
65 | { | |
66 |
|
|
66 | unsigned int cacheControlRegister; | |
67 |
|
67 | |||
68 |
|
|
68 | cacheControlRegister = getCacheControlRegister(); | |
69 |
|
|
69 | printf("(0) cacheControlRegister = %x\n", cacheControlRegister); | |
|
70 | ||||
|
71 | resetCacheControlRegister(); | |||
70 |
|
72 | |||
71 | enableInstructionCache(); |
|
73 | enableInstructionCache(); | |
72 | enableDataCache(); |
|
74 | enableDataCache(); | |
73 | enableInstructionBurstFetch(); |
|
75 | enableInstructionBurstFetch(); | |
74 |
|
76 | |||
75 |
|
|
77 | cacheControlRegister = getCacheControlRegister(); | |
76 |
|
|
78 | printf("(1) cacheControlRegister = %x\n", cacheControlRegister); | |
77 | } |
|
79 | } | |
78 |
|
80 | |||
79 | rtems_task Init( rtems_task_argument ignored ) |
|
81 | rtems_task Init( rtems_task_argument ignored ) | |
80 | { |
|
82 | { | |
81 | /** This is the RTEMS INIT taks, it the first task launched by the system. |
|
83 | /** This is the RTEMS INIT taks, it is the first task launched by the system. | |
82 | * |
|
84 | * | |
83 | * @param unused is the starting argument of the RTEMS task |
|
85 | * @param unused is the starting argument of the RTEMS task | |
84 | * |
|
86 | * | |
85 | * The INIT task create and run all other RTEMS tasks. |
|
87 | * The INIT task create and run all other RTEMS tasks. | |
86 | * |
|
88 | * | |
87 | */ |
|
89 | */ | |
88 |
|
90 | |||
89 | //*********** |
|
91 | //*********** | |
90 | // INIT CACHE |
|
92 | // INIT CACHE | |
91 |
|
93 | |||
92 | unsigned char *vhdlVersion; |
|
94 | unsigned char *vhdlVersion; | |
93 |
|
95 | |||
94 | reset_lfr(); |
|
96 | reset_lfr(); | |
95 |
|
97 | |||
96 | reset_local_time(); |
|
98 | reset_local_time(); | |
97 |
|
99 | |||
98 | rtems_cpu_usage_reset(); |
|
100 | rtems_cpu_usage_reset(); | |
99 |
|
101 | |||
100 | rtems_status_code status; |
|
102 | rtems_status_code status; | |
101 | rtems_status_code status_spw; |
|
103 | rtems_status_code status_spw; | |
102 | rtems_isr_entry old_isr_handler; |
|
104 | rtems_isr_entry old_isr_handler; | |
103 |
|
105 | |||
104 | // UART settings |
|
106 | // UART settings | |
105 | send_console_outputs_on_apbuart_port(); |
|
107 | send_console_outputs_on_apbuart_port(); | |
106 | set_apbuart_scaler_reload_register(REGS_ADDR_APBUART, APBUART_SCALER_RELOAD_VALUE); |
|
108 | set_apbuart_scaler_reload_register(REGS_ADDR_APBUART, APBUART_SCALER_RELOAD_VALUE); | |
107 | enable_apbuart_transmitter(); |
|
109 | enable_apbuart_transmitter(); | |
108 |
|
110 | |||
109 | DEBUG_PRINTF("\n\n\n\n\nIn INIT *** Now the console is on port COM1\n") |
|
111 | DEBUG_PRINTF("\n\n\n\n\nIn INIT *** Now the console is on port COM1\n") | |
110 |
|
112 | |||
111 |
|
113 | |||
112 | PRINTF("\n\n\n\n\n") |
|
114 | PRINTF("\n\n\n\n\n") | |
113 |
|
115 | |||
114 | initCache(); |
|
116 | initCache(); | |
115 |
|
117 | |||
116 | PRINTF("*************************\n") |
|
118 | PRINTF("*************************\n") | |
117 | PRINTF("** LFR Flight Software **\n") |
|
119 | PRINTF("** LFR Flight Software **\n") | |
118 | PRINTF1("** %d.", SW_VERSION_N1) |
|
120 | PRINTF1("** %d.", SW_VERSION_N1) | |
119 | PRINTF1("%d." , SW_VERSION_N2) |
|
121 | PRINTF1("%d." , SW_VERSION_N2) | |
120 | PRINTF1("%d." , SW_VERSION_N3) |
|
122 | PRINTF1("%d." , SW_VERSION_N3) | |
121 | PRINTF1("%d **\n", SW_VERSION_N4) |
|
123 | PRINTF1("%d **\n", SW_VERSION_N4) | |
122 |
|
124 | |||
123 | vhdlVersion = (unsigned char *) (REGS_ADDR_VHDL_VERSION); |
|
125 | vhdlVersion = (unsigned char *) (REGS_ADDR_VHDL_VERSION); | |
124 | PRINTF("** VHDL **\n") |
|
126 | PRINTF("** VHDL **\n") | |
125 | PRINTF1("** %d.", vhdlVersion[1]) |
|
127 | PRINTF1("** %d.", vhdlVersion[1]) | |
126 | PRINTF1("%d." , vhdlVersion[2]) |
|
128 | PRINTF1("%d." , vhdlVersion[2]) | |
127 | PRINTF1("%d **\n", vhdlVersion[3]) |
|
129 | PRINTF1("%d **\n", vhdlVersion[3]) | |
128 | PRINTF("*************************\n") |
|
130 | PRINTF("*************************\n") | |
129 | PRINTF("\n\n") |
|
131 | PRINTF("\n\n") | |
130 |
|
132 | |||
131 | init_parameter_dump(); |
|
133 | init_parameter_dump(); | |
132 | init_kcoefficients_dump(); |
|
134 | init_kcoefficients_dump(); | |
133 | init_local_mode_parameters(); |
|
135 | init_local_mode_parameters(); | |
134 | init_housekeeping_parameters(); |
|
136 | init_housekeeping_parameters(); | |
135 | init_k_coefficients_f0(); |
|
137 | init_k_coefficients_f0(); | |
136 | init_k_coefficients_f1(); |
|
138 | init_k_coefficients_f1(); | |
137 | init_k_coefficients_f2(); |
|
139 | init_k_coefficients_f2(); | |
138 |
|
140 | |||
139 | // waveform picker initialization |
|
141 | // waveform picker initialization | |
140 | WFP_init_rings(); // initialize the waveform rings |
|
142 | WFP_init_rings(); // initialize the waveform rings | |
141 | WFP_reset_current_ring_nodes(); |
|
143 | WFP_reset_current_ring_nodes(); | |
142 | reset_waveform_picker_regs(); |
|
144 | reset_waveform_picker_regs(); | |
143 |
|
145 | |||
144 | // spectral matrices initialization |
|
146 | // spectral matrices initialization | |
145 | SM_init_rings(); // initialize spectral matrices rings |
|
147 | SM_init_rings(); // initialize spectral matrices rings | |
146 | SM_reset_current_ring_nodes(); |
|
148 | SM_reset_current_ring_nodes(); | |
147 | reset_spectral_matrix_regs(); |
|
149 | reset_spectral_matrix_regs(); | |
148 |
|
150 | |||
149 | // configure calibration |
|
151 | // configure calibration | |
150 | configureCalibration( false ); // true means interleaved mode, false is for normal mode |
|
152 | configureCalibration( false ); // true means interleaved mode, false is for normal mode | |
151 |
|
153 | |||
152 | updateLFRCurrentMode(); |
|
154 | updateLFRCurrentMode(); | |
153 |
|
155 | |||
154 | BOOT_PRINTF1("in INIT *** lfrCurrentMode is %d\n", lfrCurrentMode) |
|
156 | BOOT_PRINTF1("in INIT *** lfrCurrentMode is %d\n", lfrCurrentMode) | |
155 |
|
157 | |||
156 | create_names(); // create all names |
|
158 | create_names(); // create all names | |
157 |
|
159 | |||
158 | status = create_message_queues(); // create message queues |
|
160 | status = create_message_queues(); // create message queues | |
159 | if (status != RTEMS_SUCCESSFUL) |
|
161 | if (status != RTEMS_SUCCESSFUL) | |
160 | { |
|
162 | { | |
161 | PRINTF1("in INIT *** ERR in create_message_queues, code %d", status) |
|
163 | PRINTF1("in INIT *** ERR in create_message_queues, code %d", status) | |
162 | } |
|
164 | } | |
163 |
|
165 | |||
164 | status = create_all_tasks(); // create all tasks |
|
166 | status = create_all_tasks(); // create all tasks | |
165 | if (status != RTEMS_SUCCESSFUL) |
|
167 | if (status != RTEMS_SUCCESSFUL) | |
166 | { |
|
168 | { | |
167 | PRINTF1("in INIT *** ERR in create_all_tasks, code %d\n", status) |
|
169 | PRINTF1("in INIT *** ERR in create_all_tasks, code %d\n", status) | |
168 | } |
|
170 | } | |
169 |
|
171 | |||
170 | // ************************** |
|
172 | // ************************** | |
171 | // <SPACEWIRE INITIALIZATION> |
|
173 | // <SPACEWIRE INITIALIZATION> | |
172 | grspw_timecode_callback = &timecode_irq_handler; |
|
174 | grspw_timecode_callback = &timecode_irq_handler; | |
173 |
|
175 | |||
174 | status_spw = spacewire_open_link(); // (1) open the link |
|
176 | status_spw = spacewire_open_link(); // (1) open the link | |
175 | if ( status_spw != RTEMS_SUCCESSFUL ) |
|
177 | if ( status_spw != RTEMS_SUCCESSFUL ) | |
176 | { |
|
178 | { | |
177 | PRINTF1("in INIT *** ERR spacewire_open_link code %d\n", status_spw ) |
|
179 | PRINTF1("in INIT *** ERR spacewire_open_link code %d\n", status_spw ) | |
178 | } |
|
180 | } | |
179 |
|
181 | |||
180 | if ( status_spw == RTEMS_SUCCESSFUL ) // (2) configure the link |
|
182 | if ( status_spw == RTEMS_SUCCESSFUL ) // (2) configure the link | |
181 | { |
|
183 | { | |
182 | status_spw = spacewire_configure_link( fdSPW ); |
|
184 | status_spw = spacewire_configure_link( fdSPW ); | |
183 | if ( status_spw != RTEMS_SUCCESSFUL ) |
|
185 | if ( status_spw != RTEMS_SUCCESSFUL ) | |
184 | { |
|
186 | { | |
185 | PRINTF1("in INIT *** ERR spacewire_configure_link code %d\n", status_spw ) |
|
187 | PRINTF1("in INIT *** ERR spacewire_configure_link code %d\n", status_spw ) | |
186 | } |
|
188 | } | |
187 | } |
|
189 | } | |
188 |
|
190 | |||
189 | if ( status_spw == RTEMS_SUCCESSFUL) // (3) start the link |
|
191 | if ( status_spw == RTEMS_SUCCESSFUL) // (3) start the link | |
190 | { |
|
192 | { | |
191 | status_spw = spacewire_start_link( fdSPW ); |
|
193 | status_spw = spacewire_start_link( fdSPW ); | |
192 | if ( status_spw != RTEMS_SUCCESSFUL ) |
|
194 | if ( status_spw != RTEMS_SUCCESSFUL ) | |
193 | { |
|
195 | { | |
194 | PRINTF1("in INIT *** ERR spacewire_start_link code %d\n", status_spw ) |
|
196 | PRINTF1("in INIT *** ERR spacewire_start_link code %d\n", status_spw ) | |
195 | } |
|
197 | } | |
196 | } |
|
198 | } | |
197 | // </SPACEWIRE INITIALIZATION> |
|
199 | // </SPACEWIRE INITIALIZATION> | |
198 | // *************************** |
|
200 | // *************************** | |
199 |
|
201 | |||
200 | status = start_all_tasks(); // start all tasks |
|
202 | status = start_all_tasks(); // start all tasks | |
201 | if (status != RTEMS_SUCCESSFUL) |
|
203 | if (status != RTEMS_SUCCESSFUL) | |
202 | { |
|
204 | { | |
203 | PRINTF1("in INIT *** ERR in start_all_tasks, code %d", status) |
|
205 | PRINTF1("in INIT *** ERR in start_all_tasks, code %d", status) | |
204 | } |
|
206 | } | |
205 |
|
207 | |||
206 | // start RECV and SEND *AFTER* SpaceWire Initialization, due to the timeout of the start call during the initialization |
|
208 | // start RECV and SEND *AFTER* SpaceWire Initialization, due to the timeout of the start call during the initialization | |
207 | status = start_recv_send_tasks(); |
|
209 | status = start_recv_send_tasks(); | |
208 | if ( status != RTEMS_SUCCESSFUL ) |
|
210 | if ( status != RTEMS_SUCCESSFUL ) | |
209 | { |
|
211 | { | |
210 | PRINTF1("in INIT *** ERR start_recv_send_tasks code %d\n", status ) |
|
212 | PRINTF1("in INIT *** ERR start_recv_send_tasks code %d\n", status ) | |
211 | } |
|
213 | } | |
212 |
|
214 | |||
213 | // suspend science tasks, they will be restarted later depending on the mode |
|
215 | // suspend science tasks, they will be restarted later depending on the mode | |
214 | status = suspend_science_tasks(); // suspend science tasks (not done in stop_current_mode if current mode = STANDBY) |
|
216 | status = suspend_science_tasks(); // suspend science tasks (not done in stop_current_mode if current mode = STANDBY) | |
215 | if (status != RTEMS_SUCCESSFUL) |
|
217 | if (status != RTEMS_SUCCESSFUL) | |
216 | { |
|
218 | { | |
217 | PRINTF1("in INIT *** in suspend_science_tasks *** ERR code: %d\n", status) |
|
219 | PRINTF1("in INIT *** in suspend_science_tasks *** ERR code: %d\n", status) | |
218 | } |
|
220 | } | |
219 |
|
221 | |||
220 | //****************************** |
|
222 | //****************************** | |
221 | // <SPECTRAL MATRICES SIMULATOR> |
|
223 | // <SPECTRAL MATRICES SIMULATOR> | |
222 | LEON_Mask_interrupt( IRQ_SM_SIMULATOR ); |
|
224 | LEON_Mask_interrupt( IRQ_SM_SIMULATOR ); | |
223 | configure_timer((gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR, CLKDIV_SM_SIMULATOR, |
|
225 | configure_timer((gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR, CLKDIV_SM_SIMULATOR, | |
224 | IRQ_SPARC_SM_SIMULATOR, spectral_matrices_isr_simu ); |
|
226 | IRQ_SPARC_SM_SIMULATOR, spectral_matrices_isr_simu ); | |
225 | // </SPECTRAL MATRICES SIMULATOR> |
|
227 | // </SPECTRAL MATRICES SIMULATOR> | |
226 | //******************************* |
|
228 | //******************************* | |
227 |
|
229 | |||
228 | // configure IRQ handling for the waveform picker unit |
|
230 | // configure IRQ handling for the waveform picker unit | |
229 | status = rtems_interrupt_catch( waveforms_isr, |
|
231 | status = rtems_interrupt_catch( waveforms_isr, | |
230 | IRQ_SPARC_WAVEFORM_PICKER, |
|
232 | IRQ_SPARC_WAVEFORM_PICKER, | |
231 | &old_isr_handler) ; |
|
233 | &old_isr_handler) ; | |
232 | // configure IRQ handling for the spectral matrices unit |
|
234 | // configure IRQ handling for the spectral matrices unit | |
233 | status = rtems_interrupt_catch( spectral_matrices_isr, |
|
235 | status = rtems_interrupt_catch( spectral_matrices_isr, | |
234 | IRQ_SPARC_SPECTRAL_MATRIX, |
|
236 | IRQ_SPARC_SPECTRAL_MATRIX, | |
235 | &old_isr_handler) ; |
|
237 | &old_isr_handler) ; | |
236 |
|
238 | |||
237 | // if the spacewire link is not up then send an event to the SPIQ task for link recovery |
|
239 | // if the spacewire link is not up then send an event to the SPIQ task for link recovery | |
238 | if ( status_spw != RTEMS_SUCCESSFUL ) |
|
240 | if ( status_spw != RTEMS_SUCCESSFUL ) | |
239 | { |
|
241 | { | |
240 | status = rtems_event_send( Task_id[TASKID_SPIQ], SPW_LINKERR_EVENT ); |
|
242 | status = rtems_event_send( Task_id[TASKID_SPIQ], SPW_LINKERR_EVENT ); | |
241 | if ( status != RTEMS_SUCCESSFUL ) { |
|
243 | if ( status != RTEMS_SUCCESSFUL ) { | |
242 | PRINTF1("in INIT *** ERR rtems_event_send to SPIQ code %d\n", status ) |
|
244 | PRINTF1("in INIT *** ERR rtems_event_send to SPIQ code %d\n", status ) | |
243 | } |
|
245 | } | |
244 | } |
|
246 | } | |
245 |
|
247 | |||
246 | BOOT_PRINTF("delete INIT\n") |
|
248 | BOOT_PRINTF("delete INIT\n") | |
247 |
|
249 | |||
248 | status = rtems_task_delete(RTEMS_SELF); |
|
250 | status = rtems_task_delete(RTEMS_SELF); | |
249 |
|
251 | |||
250 | } |
|
252 | } | |
251 |
|
253 | |||
252 | void init_local_mode_parameters( void ) |
|
254 | void init_local_mode_parameters( void ) | |
253 | { |
|
255 | { | |
254 | /** This function initialize the param_local global variable with default values. |
|
256 | /** This function initialize the param_local global variable with default values. | |
255 | * |
|
257 | * | |
256 | */ |
|
258 | */ | |
257 |
|
259 | |||
258 | unsigned int i; |
|
260 | unsigned int i; | |
259 |
|
261 | |||
260 | // LOCAL PARAMETERS |
|
262 | // LOCAL PARAMETERS | |
261 |
|
263 | |||
262 | BOOT_PRINTF1("local_sbm1_nb_cwf_max %d \n", param_local.local_sbm1_nb_cwf_max) |
|
264 | BOOT_PRINTF1("local_sbm1_nb_cwf_max %d \n", param_local.local_sbm1_nb_cwf_max) | |
263 | BOOT_PRINTF1("local_sbm2_nb_cwf_max %d \n", param_local.local_sbm2_nb_cwf_max) |
|
265 | BOOT_PRINTF1("local_sbm2_nb_cwf_max %d \n", param_local.local_sbm2_nb_cwf_max) | |
264 | BOOT_PRINTF1("nb_interrupt_f0_MAX = %d\n", param_local.local_nb_interrupt_f0_MAX) |
|
266 | BOOT_PRINTF1("nb_interrupt_f0_MAX = %d\n", param_local.local_nb_interrupt_f0_MAX) | |
265 |
|
267 | |||
266 | // init sequence counters |
|
268 | // init sequence counters | |
267 |
|
269 | |||
268 | for(i = 0; i<SEQ_CNT_NB_DEST_ID; i++) |
|
270 | for(i = 0; i<SEQ_CNT_NB_DEST_ID; i++) | |
269 | { |
|
271 | { | |
270 | sequenceCounters_TC_EXE[i] = 0x00; |
|
272 | sequenceCounters_TC_EXE[i] = 0x00; | |
271 | } |
|
273 | } | |
272 | sequenceCounters_SCIENCE_NORMAL_BURST = 0x00; |
|
274 | sequenceCounters_SCIENCE_NORMAL_BURST = 0x00; | |
273 | sequenceCounters_SCIENCE_SBM1_SBM2 = 0x00; |
|
275 | sequenceCounters_SCIENCE_SBM1_SBM2 = 0x00; | |
274 | sequenceCounterHK = TM_PACKET_SEQ_CTRL_STANDALONE << 8; |
|
276 | sequenceCounterHK = TM_PACKET_SEQ_CTRL_STANDALONE << 8; | |
275 | sequenceCounterParameterDump = TM_PACKET_SEQ_CTRL_STANDALONE << 8; |
|
277 | sequenceCounterParameterDump = TM_PACKET_SEQ_CTRL_STANDALONE << 8; | |
276 | } |
|
278 | } | |
277 |
|
279 | |||
278 | void reset_local_time( void ) |
|
280 | void reset_local_time( void ) | |
279 | { |
|
281 | { | |
280 | time_management_regs->ctrl = time_management_regs->ctrl | 0x02; // [0010] software reset, coarse time = 0x80000000 |
|
282 | time_management_regs->ctrl = time_management_regs->ctrl | 0x02; // [0010] software reset, coarse time = 0x80000000 | |
281 | } |
|
283 | } | |
282 |
|
284 | |||
283 | void create_names( void ) // create all names for tasks and queues |
|
285 | void create_names( void ) // create all names for tasks and queues | |
284 | { |
|
286 | { | |
285 | /** This function creates all RTEMS names used in the software for tasks and queues. |
|
287 | /** This function creates all RTEMS names used in the software for tasks and queues. | |
286 | * |
|
288 | * | |
287 | * @return RTEMS directive status codes: |
|
289 | * @return RTEMS directive status codes: | |
288 | * - RTEMS_SUCCESSFUL - successful completion |
|
290 | * - RTEMS_SUCCESSFUL - successful completion | |
289 | * |
|
291 | * | |
290 | */ |
|
292 | */ | |
291 |
|
293 | |||
292 | // task names |
|
294 | // task names | |
293 | Task_name[TASKID_RECV] = rtems_build_name( 'R', 'E', 'C', 'V' ); |
|
295 | Task_name[TASKID_RECV] = rtems_build_name( 'R', 'E', 'C', 'V' ); | |
294 | Task_name[TASKID_ACTN] = rtems_build_name( 'A', 'C', 'T', 'N' ); |
|
296 | Task_name[TASKID_ACTN] = rtems_build_name( 'A', 'C', 'T', 'N' ); | |
295 | Task_name[TASKID_SPIQ] = rtems_build_name( 'S', 'P', 'I', 'Q' ); |
|
297 | Task_name[TASKID_SPIQ] = rtems_build_name( 'S', 'P', 'I', 'Q' ); | |
296 | Task_name[TASKID_STAT] = rtems_build_name( 'S', 'T', 'A', 'T' ); |
|
298 | Task_name[TASKID_STAT] = rtems_build_name( 'S', 'T', 'A', 'T' ); | |
297 | Task_name[TASKID_AVF0] = rtems_build_name( 'A', 'V', 'F', '0' ); |
|
299 | Task_name[TASKID_AVF0] = rtems_build_name( 'A', 'V', 'F', '0' ); | |
298 | Task_name[TASKID_SWBD] = rtems_build_name( 'S', 'W', 'B', 'D' ); |
|
300 | Task_name[TASKID_SWBD] = rtems_build_name( 'S', 'W', 'B', 'D' ); | |
299 | Task_name[TASKID_WFRM] = rtems_build_name( 'W', 'F', 'R', 'M' ); |
|
301 | Task_name[TASKID_WFRM] = rtems_build_name( 'W', 'F', 'R', 'M' ); | |
300 | Task_name[TASKID_DUMB] = rtems_build_name( 'D', 'U', 'M', 'B' ); |
|
302 | Task_name[TASKID_DUMB] = rtems_build_name( 'D', 'U', 'M', 'B' ); | |
301 | Task_name[TASKID_HOUS] = rtems_build_name( 'H', 'O', 'U', 'S' ); |
|
303 | Task_name[TASKID_HOUS] = rtems_build_name( 'H', 'O', 'U', 'S' ); | |
302 | Task_name[TASKID_PRC0] = rtems_build_name( 'P', 'R', 'C', '0' ); |
|
304 | Task_name[TASKID_PRC0] = rtems_build_name( 'P', 'R', 'C', '0' ); | |
303 | Task_name[TASKID_CWF3] = rtems_build_name( 'C', 'W', 'F', '3' ); |
|
305 | Task_name[TASKID_CWF3] = rtems_build_name( 'C', 'W', 'F', '3' ); | |
304 | Task_name[TASKID_CWF2] = rtems_build_name( 'C', 'W', 'F', '2' ); |
|
306 | Task_name[TASKID_CWF2] = rtems_build_name( 'C', 'W', 'F', '2' ); | |
305 | Task_name[TASKID_CWF1] = rtems_build_name( 'C', 'W', 'F', '1' ); |
|
307 | Task_name[TASKID_CWF1] = rtems_build_name( 'C', 'W', 'F', '1' ); | |
306 | Task_name[TASKID_SEND] = rtems_build_name( 'S', 'E', 'N', 'D' ); |
|
308 | Task_name[TASKID_SEND] = rtems_build_name( 'S', 'E', 'N', 'D' ); | |
307 | Task_name[TASKID_WTDG] = rtems_build_name( 'W', 'T', 'D', 'G' ); |
|
309 | Task_name[TASKID_WTDG] = rtems_build_name( 'W', 'T', 'D', 'G' ); | |
308 | Task_name[TASKID_AVF1] = rtems_build_name( 'A', 'V', 'F', '1' ); |
|
310 | Task_name[TASKID_AVF1] = rtems_build_name( 'A', 'V', 'F', '1' ); | |
309 | Task_name[TASKID_PRC1] = rtems_build_name( 'P', 'R', 'C', '1' ); |
|
311 | Task_name[TASKID_PRC1] = rtems_build_name( 'P', 'R', 'C', '1' ); | |
310 | Task_name[TASKID_AVF2] = rtems_build_name( 'A', 'V', 'F', '2' ); |
|
312 | Task_name[TASKID_AVF2] = rtems_build_name( 'A', 'V', 'F', '2' ); | |
311 | Task_name[TASKID_PRC2] = rtems_build_name( 'P', 'R', 'C', '2' ); |
|
313 | Task_name[TASKID_PRC2] = rtems_build_name( 'P', 'R', 'C', '2' ); | |
312 |
|
314 | |||
313 | // rate monotonic period names |
|
315 | // rate monotonic period names | |
314 | name_hk_rate_monotonic = rtems_build_name( 'H', 'O', 'U', 'S' ); |
|
316 | name_hk_rate_monotonic = rtems_build_name( 'H', 'O', 'U', 'S' ); | |
315 |
|
317 | |||
316 | misc_name[QUEUE_RECV] = rtems_build_name( 'Q', '_', 'R', 'V' ); |
|
318 | misc_name[QUEUE_RECV] = rtems_build_name( 'Q', '_', 'R', 'V' ); | |
317 | misc_name[QUEUE_SEND] = rtems_build_name( 'Q', '_', 'S', 'D' ); |