@@ -1,113 +1,113 | |||||
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 | |
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=8 # internal |
|
15 | DEFINES += SW_VERSION_N4=8 # 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 | LIBS += -lgcov /opt/GCOV/HOWTO_gcov_for_lfr_test/01A/lib/overload.o -lc |
|
20 | LIBS += -lgcov /opt/GCOV/HOWTO_gcov_for_lfr_test/01A/lib/overload.o -lc | |
21 | # </GCOV> |
|
21 | # </GCOV> | |
22 |
|
22 | |||
23 | # <CHANGE BEFORE FLIGHT> |
|
23 | # <CHANGE BEFORE FLIGHT> | |
24 | contains( CONFIG, lpp_dpu_destid ) { |
|
24 | contains( CONFIG, lpp_dpu_destid ) { | |
25 | DEFINES += LPP_DPU_DESTID |
|
25 | DEFINES += LPP_DPU_DESTID | |
26 | } |
|
26 | } | |
27 | # </CHANGE BEFORE FLIGHT> |
|
27 | # </CHANGE BEFORE FLIGHT> | |
28 |
|
28 | |||
29 | contains( CONFIG, debug_tch ) { |
|
29 | contains( CONFIG, debug_tch ) { | |
30 | DEFINES += DEBUG_TCH |
|
30 | DEFINES += DEBUG_TCH | |
31 | } |
|
31 | } | |
32 | DEFINES += MSB_FIRST_TCH |
|
32 | DEFINES += MSB_FIRST_TCH | |
33 |
|
33 | |||
34 | contains( CONFIG, vhdl_dev ) { |
|
34 | contains( CONFIG, vhdl_dev ) { | |
35 | DEFINES += VHDL_DEV |
|
35 | DEFINES += VHDL_DEV | |
36 | } |
|
36 | } | |
37 |
|
37 | |||
38 | contains( CONFIG, verbose ) { |
|
38 | contains( CONFIG, verbose ) { | |
39 | DEFINES += PRINT_MESSAGES_ON_CONSOLE |
|
39 | DEFINES += PRINT_MESSAGES_ON_CONSOLE | |
40 | } |
|
40 | } | |
41 |
|
41 | |||
42 | contains( CONFIG, debug_messages ) { |
|
42 | contains( CONFIG, debug_messages ) { | |
43 | DEFINES += DEBUG_MESSAGES |
|
43 | DEFINES += DEBUG_MESSAGES | |
44 | } |
|
44 | } | |
45 |
|
45 | |||
46 | contains( CONFIG, cpu_usage_report ) { |
|
46 | contains( CONFIG, cpu_usage_report ) { | |
47 | DEFINES += PRINT_TASK_STATISTICS |
|
47 | DEFINES += PRINT_TASK_STATISTICS | |
48 | } |
|
48 | } | |
49 |
|
49 | |||
50 | contains( CONFIG, stack_report ) { |
|
50 | contains( CONFIG, stack_report ) { | |
51 | DEFINES += PRINT_STACK_REPORT |
|
51 | DEFINES += PRINT_STACK_REPORT | |
52 | } |
|
52 | } | |
53 |
|
53 | |||
54 | contains( CONFIG, boot_messages ) { |
|
54 | contains( CONFIG, boot_messages ) { | |
55 | DEFINES += BOOT_MESSAGES |
|
55 | DEFINES += BOOT_MESSAGES | |
56 | } |
|
56 | } | |
57 |
|
57 | |||
58 | #doxygen.target = doxygen |
|
58 | #doxygen.target = doxygen | |
59 | #doxygen.commands = doxygen ../doc/Doxyfile |
|
59 | #doxygen.commands = doxygen ../doc/Doxyfile | |
60 | #QMAKE_EXTRA_TARGETS += doxygen |
|
60 | #QMAKE_EXTRA_TARGETS += doxygen | |
61 |
|
61 | |||
62 | TARGET = fsw |
|
62 | TARGET = fsw | |
63 |
|
63 | |||
64 | INCLUDEPATH += \ |
|
64 | INCLUDEPATH += \ | |
65 | $${PWD}/../src \ |
|
65 | $${PWD}/../src \ | |
66 | $${PWD}/../header \ |
|
66 | $${PWD}/../header \ | |
67 | $${PWD}/../header/lfr_common_headers \ |
|
67 | $${PWD}/../header/lfr_common_headers \ | |
68 | $${PWD}/../header/processing \ |
|
68 | $${PWD}/../header/processing \ | |
69 | $${PWD}/../LFR_basic-parameters |
|
69 | $${PWD}/../LFR_basic-parameters | |
70 |
|
70 | |||
71 | SOURCES += \ |
|
71 | SOURCES += \ | |
72 | ../src/wf_handler.c \ |
|
72 | ../src/wf_handler.c \ | |
73 | ../src/tc_handler.c \ |
|
73 | ../src/tc_handler.c \ | |
74 | ../src/fsw_misc.c \ |
|
74 | ../src/fsw_misc.c \ | |
75 | ../src/fsw_init.c \ |
|
75 | ../src/fsw_init.c \ | |
76 | ../src/fsw_globals.c \ |
|
76 | ../src/fsw_globals.c \ | |
77 | ../src/fsw_spacewire.c \ |
|
77 | ../src/fsw_spacewire.c \ | |
78 | ../src/tc_load_dump_parameters.c \ |
|
78 | ../src/tc_load_dump_parameters.c \ | |
79 | ../src/tm_lfr_tc_exe.c \ |
|
79 | ../src/tm_lfr_tc_exe.c \ | |
80 | ../src/tc_acceptance.c \ |
|
80 | ../src/tc_acceptance.c \ | |
81 | ../src/processing/fsw_processing.c \ |
|
81 | ../src/processing/fsw_processing.c \ | |
82 | ../src/processing/avf0_prc0.c \ |
|
82 | ../src/processing/avf0_prc0.c \ | |
83 | ../src/processing/avf1_prc1.c \ |
|
83 | ../src/processing/avf1_prc1.c \ | |
84 | ../src/processing/avf2_prc2.c \ |
|
84 | ../src/processing/avf2_prc2.c \ | |
85 | ../src/lfr_cpu_usage_report.c \ |
|
85 | ../src/lfr_cpu_usage_report.c \ | |
86 | ../LFR_basic-parameters/basic_parameters.c |
|
86 | ../LFR_basic-parameters/basic_parameters.c | |
87 |
|
87 | |||
88 | HEADERS += \ |
|
88 | HEADERS += \ | |
89 | ../header/wf_handler.h \ |
|
89 | ../header/wf_handler.h \ | |
90 | ../header/tc_handler.h \ |
|
90 | ../header/tc_handler.h \ | |
91 | ../header/grlib_regs.h \ |
|
91 | ../header/grlib_regs.h \ | |
92 | ../header/fsw_misc.h \ |
|
92 | ../header/fsw_misc.h \ | |
93 | ../header/fsw_init.h \ |
|
93 | ../header/fsw_init.h \ | |
94 | ../header/fsw_spacewire.h \ |
|
94 | ../header/fsw_spacewire.h \ | |
95 | ../header/tc_load_dump_parameters.h \ |
|
95 | ../header/tc_load_dump_parameters.h \ | |
96 | ../header/tm_lfr_tc_exe.h \ |
|
96 | ../header/tm_lfr_tc_exe.h \ | |
97 | ../header/tc_acceptance.h \ |
|
97 | ../header/tc_acceptance.h \ | |
98 | ../header/processing/fsw_processing.h \ |
|
98 | ../header/processing/fsw_processing.h \ | |
99 | ../header/processing/avf0_prc0.h \ |
|
99 | ../header/processing/avf0_prc0.h \ | |
100 | ../header/processing/avf1_prc1.h \ |
|
100 | ../header/processing/avf1_prc1.h \ | |
101 | ../header/processing/avf2_prc2.h \ |
|
101 | ../header/processing/avf2_prc2.h \ | |
102 | ../header/fsw_params_wf_handler.h \ |
|
102 | ../header/fsw_params_wf_handler.h \ | |
103 | ../header/lfr_cpu_usage_report.h \ |
|
103 | ../header/lfr_cpu_usage_report.h \ | |
104 | ../header/lfr_common_headers/ccsds_types.h \ |
|
104 | ../header/lfr_common_headers/ccsds_types.h \ | |
105 | ../header/lfr_common_headers/fsw_params.h \ |
|
105 | ../header/lfr_common_headers/fsw_params.h \ | |
106 | ../header/lfr_common_headers/fsw_params_nb_bytes.h \ |
|
106 | ../header/lfr_common_headers/fsw_params_nb_bytes.h \ | |
107 | ../header/lfr_common_headers/fsw_params_processing.h \ |
|
107 | ../header/lfr_common_headers/fsw_params_processing.h \ | |
108 | ../header/lfr_common_headers/TC_types.h \ |
|
108 | ../header/lfr_common_headers/TC_types.h \ | |
109 | ../header/lfr_common_headers/tm_byte_positions.h \ |
|
109 | ../header/lfr_common_headers/tm_byte_positions.h \ | |
110 | ../LFR_basic-parameters/basic_parameters.h \ |
|
110 | ../LFR_basic-parameters/basic_parameters.h \ | |
111 | ../LFR_basic-parameters/basic_parameters_params.h \ |
|
111 | ../LFR_basic-parameters/basic_parameters_params.h \ | |
112 | ../header/GscMemoryLPP.hpp |
|
112 | ../header/GscMemoryLPP.hpp | |
113 |
|
113 |
@@ -1,906 +1,869 | |||||
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 test_bp1() |
|
|||
66 | { |
|
|||
67 | float test_matrix[25] = { |
|
|||
68 | 4.00109575e+06, |
|
|||
69 | -2.19891187e+03, |
|
|||
70 | 1.73193325e+06, |
|
|||
71 | 1.88106079e+03, |
|
|||
72 | -1.00001638e+06, |
|
|||
73 | 6.23724854e+02, |
|
|||
74 | 2.00016860e+07, |
|
|||
75 | -3.46422920e+07, |
|
|||
76 | -1.44333826e+03, |
|
|||
77 | 7.54424812e+05, |
|
|||
78 | -4.36785375e+05, |
|
|||
79 | 2.34538879e+02, |
|
|||
80 | 8.65882200e+06, |
|
|||
81 | -3.31611108e+03, |
|
|||
82 | 2.71719702e+03, |
|
|||
83 | 1.50027590e+07, |
|
|||
84 | 2.53229094e+05, |
|
|||
85 | -4.99895450e+06, |
|
|||
86 | 2.90329712e+03, |
|
|||
87 | -2.17048022e+03, |
|
|||
88 | -8.66275100e+06, |
|
|||
89 | 1.00002952e+08, |
|
|||
90 | -2.94739111e+03, |
|
|||
91 | 1.73206224e+08, |
|
|||
92 | 3.00003392e+08 |
|
|||
93 | }; |
|
|||
94 |
|
||||
95 | uint8_t lfr_bp1[11]; |
|
|||
96 |
|
||||
97 | BP1_set(test_matrix, k_coeff_intercalib_f0_norm, 1, lfr_bp1); |
|
|||
98 | } |
|
|||
99 |
|
||||
100 | void initCache() |
|
65 | void initCache() | |
101 | { |
|
66 | { | |
102 | unsigned int cacheControlRegister; |
|
67 | unsigned int cacheControlRegister; | |
103 |
|
68 | |||
104 | cacheControlRegister = getCacheControlRegister(); |
|
69 | cacheControlRegister = getCacheControlRegister(); | |
105 | printf("(0) cacheControlRegister = %x\n", cacheControlRegister); |
|
70 | printf("(0) cacheControlRegister = %x\n", cacheControlRegister); | |
106 |
|
71 | |||
107 | resetCacheControlRegister(); |
|
72 | resetCacheControlRegister(); | |
108 |
|
73 | |||
109 | enableInstructionCache(); |
|
74 | enableInstructionCache(); | |
110 | enableDataCache(); |
|
75 | enableDataCache(); | |
111 | enableInstructionBurstFetch(); |
|
76 | enableInstructionBurstFetch(); | |
112 |
|
77 | |||
113 | cacheControlRegister = getCacheControlRegister(); |
|
78 | cacheControlRegister = getCacheControlRegister(); | |
114 | printf("(1) cacheControlRegister = %x\n", cacheControlRegister); |
|
79 | printf("(1) cacheControlRegister = %x\n", cacheControlRegister); | |
115 | } |
|
80 | } | |
116 |
|
81 | |||
117 | rtems_task Init( rtems_task_argument ignored ) |
|
82 | rtems_task Init( rtems_task_argument ignored ) | |
118 | { |
|
83 | { | |
119 | /** 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. | |
120 | * |
|
85 | * | |
121 | * @param unused is the starting argument of the RTEMS task |
|
86 | * @param unused is the starting argument of the RTEMS task | |
122 | * |
|
87 | * | |
123 | * The INIT task create and run all other RTEMS tasks. |
|
88 | * The INIT task create and run all other RTEMS tasks. | |
124 | * |
|
89 | * | |
125 | */ |
|
90 | */ | |
126 |
|
91 | |||
127 | //*********** |
|
92 | //*********** | |
128 | // INIT CACHE |
|
93 | // INIT CACHE | |
129 |
|
94 | |||
130 | unsigned char *vhdlVersion; |
|
95 | unsigned char *vhdlVersion; | |
131 |
|
96 | |||
132 | reset_lfr(); |
|
97 | reset_lfr(); | |
133 |
|
98 | |||
134 | reset_local_time(); |
|
99 | reset_local_time(); | |
135 |
|
100 | |||
136 | rtems_cpu_usage_reset(); |
|
101 | rtems_cpu_usage_reset(); | |
137 |
|
102 | |||
138 | rtems_status_code status; |
|
103 | rtems_status_code status; | |
139 | rtems_status_code status_spw; |
|
104 | rtems_status_code status_spw; | |
140 | rtems_isr_entry old_isr_handler; |
|
105 | rtems_isr_entry old_isr_handler; | |
141 |
|
106 | |||
142 | // UART settings |
|
107 | // UART settings | |
143 | send_console_outputs_on_apbuart_port(); |
|
108 | send_console_outputs_on_apbuart_port(); | |
144 | 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); | |
145 | enable_apbuart_transmitter(); |
|
110 | enable_apbuart_transmitter(); | |
146 |
|
111 | |||
147 | 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") | |
148 |
|
113 | |||
149 |
|
114 | |||
150 | PRINTF("\n\n\n\n\n") |
|
115 | PRINTF("\n\n\n\n\n") | |
151 |
|
116 | |||
152 | initCache(); |
|
117 | initCache(); | |
153 |
|
118 | |||
154 | PRINTF("*************************\n") |
|
119 | PRINTF("*************************\n") | |
155 | PRINTF("** LFR Flight Software **\n") |
|
120 | PRINTF("** LFR Flight Software **\n") | |
156 | PRINTF1("** %d.", SW_VERSION_N1) |
|
121 | PRINTF1("** %d.", SW_VERSION_N1) | |
157 | PRINTF1("%d." , SW_VERSION_N2) |
|
122 | PRINTF1("%d." , SW_VERSION_N2) | |
158 | PRINTF1("%d." , SW_VERSION_N3) |
|
123 | PRINTF1("%d." , SW_VERSION_N3) | |
159 | PRINTF1("%d **\n", SW_VERSION_N4) |
|
124 | PRINTF1("%d **\n", SW_VERSION_N4) | |
160 |
|
125 | |||
161 | vhdlVersion = (unsigned char *) (REGS_ADDR_VHDL_VERSION); |
|
126 | vhdlVersion = (unsigned char *) (REGS_ADDR_VHDL_VERSION); | |
162 | PRINTF("** VHDL **\n") |
|
127 | PRINTF("** VHDL **\n") | |
163 | PRINTF1("** %d.", vhdlVersion[1]) |
|
128 | PRINTF1("** %d.", vhdlVersion[1]) | |
164 | PRINTF1("%d." , vhdlVersion[2]) |
|
129 | PRINTF1("%d." , vhdlVersion[2]) | |
165 | PRINTF1("%d **\n", vhdlVersion[3]) |
|
130 | PRINTF1("%d **\n", vhdlVersion[3]) | |
166 | PRINTF("*************************\n") |
|
131 | PRINTF("*************************\n") | |
167 | PRINTF("\n\n") |
|
132 | PRINTF("\n\n") | |
168 |
|
133 | |||
169 | init_parameter_dump(); |
|
134 | init_parameter_dump(); | |
170 | init_kcoefficients_dump(); |
|
135 | init_kcoefficients_dump(); | |
171 | init_local_mode_parameters(); |
|
136 | init_local_mode_parameters(); | |
172 | init_housekeeping_parameters(); |
|
137 | init_housekeeping_parameters(); | |
173 | init_k_coefficients_prc0(); |
|
138 | init_k_coefficients_prc0(); | |
174 | init_k_coefficients_prc1(); |
|
139 | init_k_coefficients_prc1(); | |
175 | init_k_coefficients_prc2(); |
|
140 | init_k_coefficients_prc2(); | |
176 |
|
141 | |||
177 | // waveform picker initialization |
|
142 | // waveform picker initialization | |
178 | WFP_init_rings(); // initialize the waveform rings |
|
143 | WFP_init_rings(); // initialize the waveform rings | |
179 | WFP_reset_current_ring_nodes(); |
|
144 | WFP_reset_current_ring_nodes(); | |
180 | reset_waveform_picker_regs(); |
|
145 | reset_waveform_picker_regs(); | |
181 |
|
146 | |||
182 | // spectral matrices initialization |
|
147 | // spectral matrices initialization | |
183 | SM_init_rings(); // initialize spectral matrices rings |
|
148 | SM_init_rings(); // initialize spectral matrices rings | |
184 | SM_reset_current_ring_nodes(); |
|
149 | SM_reset_current_ring_nodes(); | |
185 | reset_spectral_matrix_regs(); |
|
150 | reset_spectral_matrix_regs(); | |
186 |
|
151 | |||
187 | // configure calibration |
|
152 | // configure calibration | |
188 | configureCalibration( false ); // true means interleaved mode, false is for normal mode |
|
153 | configureCalibration( false ); // true means interleaved mode, false is for normal mode | |
189 |
|
154 | |||
190 | updateLFRCurrentMode(); |
|
155 | updateLFRCurrentMode(); | |
191 |
|
156 | |||
192 | BOOT_PRINTF1("in INIT *** lfrCurrentMode is %d\n", lfrCurrentMode) |
|
157 | BOOT_PRINTF1("in INIT *** lfrCurrentMode is %d\n", lfrCurrentMode) | |
193 |
|
158 | |||
194 | create_names(); // create all names |
|
159 | create_names(); // create all names | |
195 |
|
160 | |||
196 | status = create_message_queues(); // create message queues |
|
161 | status = create_message_queues(); // create message queues | |
197 | if (status != RTEMS_SUCCESSFUL) |
|
162 | if (status != RTEMS_SUCCESSFUL) | |
198 | { |
|
163 | { | |
199 | PRINTF1("in INIT *** ERR in create_message_queues, code %d", status) |
|
164 | PRINTF1("in INIT *** ERR in create_message_queues, code %d", status) | |
200 | } |
|
165 | } | |
201 |
|
166 | |||
202 | status = create_all_tasks(); // create all tasks |
|
167 | status = create_all_tasks(); // create all tasks | |
203 | if (status != RTEMS_SUCCESSFUL) |
|
168 | if (status != RTEMS_SUCCESSFUL) | |
204 | { |
|
169 | { | |
205 | PRINTF1("in INIT *** ERR in create_all_tasks, code %d\n", status) |
|
170 | PRINTF1("in INIT *** ERR in create_all_tasks, code %d\n", status) | |
206 | } |
|
171 | } | |
207 |
|
172 | |||
208 | // ************************** |
|
173 | // ************************** | |
209 | // <SPACEWIRE INITIALIZATION> |
|
174 | // <SPACEWIRE INITIALIZATION> | |
210 | grspw_timecode_callback = &timecode_irq_handler; |
|
175 | grspw_timecode_callback = &timecode_irq_handler; | |
211 |
|
176 | |||
212 | status_spw = spacewire_open_link(); // (1) open the link |
|
177 | status_spw = spacewire_open_link(); // (1) open the link | |
213 | if ( status_spw != RTEMS_SUCCESSFUL ) |
|
178 | if ( status_spw != RTEMS_SUCCESSFUL ) | |
214 | { |
|
179 | { | |
215 | PRINTF1("in INIT *** ERR spacewire_open_link code %d\n", status_spw ) |
|
180 | PRINTF1("in INIT *** ERR spacewire_open_link code %d\n", status_spw ) | |
216 | } |
|
181 | } | |
217 |
|
182 | |||
218 | if ( status_spw == RTEMS_SUCCESSFUL ) // (2) configure the link |
|
183 | if ( status_spw == RTEMS_SUCCESSFUL ) // (2) configure the link | |
219 | { |
|
184 | { | |
220 | status_spw = spacewire_configure_link( fdSPW ); |
|
185 | status_spw = spacewire_configure_link( fdSPW ); | |
221 | if ( status_spw != RTEMS_SUCCESSFUL ) |
|
186 | if ( status_spw != RTEMS_SUCCESSFUL ) | |
222 | { |
|
187 | { | |
223 | PRINTF1("in INIT *** ERR spacewire_configure_link code %d\n", status_spw ) |
|
188 | PRINTF1("in INIT *** ERR spacewire_configure_link code %d\n", status_spw ) | |
224 | } |
|
189 | } | |
225 | } |
|
190 | } | |
226 |
|
191 | |||
227 | if ( status_spw == RTEMS_SUCCESSFUL) // (3) start the link |
|
192 | if ( status_spw == RTEMS_SUCCESSFUL) // (3) start the link | |
228 | { |
|
193 | { | |
229 | status_spw = spacewire_start_link( fdSPW ); |
|
194 | status_spw = spacewire_start_link( fdSPW ); | |
230 | if ( status_spw != RTEMS_SUCCESSFUL ) |
|
195 | if ( status_spw != RTEMS_SUCCESSFUL ) | |
231 | { |
|
196 | { | |
232 | PRINTF1("in INIT *** ERR spacewire_start_link code %d\n", status_spw ) |
|
197 | PRINTF1("in INIT *** ERR spacewire_start_link code %d\n", status_spw ) | |
233 | } |
|
198 | } | |
234 | } |
|
199 | } | |
235 | // </SPACEWIRE INITIALIZATION> |
|
200 | // </SPACEWIRE INITIALIZATION> | |
236 | // *************************** |
|
201 | // *************************** | |
237 |
|
202 | |||
238 | status = start_all_tasks(); // start all tasks |
|
203 | status = start_all_tasks(); // start all tasks | |
239 | if (status != RTEMS_SUCCESSFUL) |
|
204 | if (status != RTEMS_SUCCESSFUL) | |
240 | { |
|
205 | { | |
241 | PRINTF1("in INIT *** ERR in start_all_tasks, code %d", status) |
|
206 | PRINTF1("in INIT *** ERR in start_all_tasks, code %d", status) | |
242 | } |
|
207 | } | |
243 |
|
208 | |||
244 | // start RECV and SEND *AFTER* SpaceWire Initialization, due to the timeout of the start call during the initialization |
|
209 | // start RECV and SEND *AFTER* SpaceWire Initialization, due to the timeout of the start call during the initialization | |
245 | status = start_recv_send_tasks(); |
|
210 | status = start_recv_send_tasks(); | |
246 | if ( status != RTEMS_SUCCESSFUL ) |
|
211 | if ( status != RTEMS_SUCCESSFUL ) | |
247 | { |
|
212 | { | |
248 | PRINTF1("in INIT *** ERR start_recv_send_tasks code %d\n", status ) |
|
213 | PRINTF1("in INIT *** ERR start_recv_send_tasks code %d\n", status ) | |
249 | } |
|
214 | } | |
250 |
|
215 | |||
251 | // suspend science tasks, they will be restarted later depending on the mode |
|
216 | // suspend science tasks, they will be restarted later depending on the mode | |
252 | status = suspend_science_tasks(); // suspend science tasks (not done in stop_current_mode if current mode = STANDBY) |
|
217 | status = suspend_science_tasks(); // suspend science tasks (not done in stop_current_mode if current mode = STANDBY) | |
253 | if (status != RTEMS_SUCCESSFUL) |
|
218 | if (status != RTEMS_SUCCESSFUL) | |
254 | { |
|
219 | { | |
255 | PRINTF1("in INIT *** in suspend_science_tasks *** ERR code: %d\n", status) |
|
220 | PRINTF1("in INIT *** in suspend_science_tasks *** ERR code: %d\n", status) | |
256 | } |
|
221 | } | |
257 |
|
222 | |||
258 | //****************************** |
|
223 | //****************************** | |
259 | // <SPECTRAL MATRICES SIMULATOR> |
|
224 | // <SPECTRAL MATRICES SIMULATOR> | |
260 | LEON_Mask_interrupt( IRQ_SM_SIMULATOR ); |
|
225 | LEON_Mask_interrupt( IRQ_SM_SIMULATOR ); | |
261 | configure_timer((gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR, CLKDIV_SM_SIMULATOR, |
|
226 | configure_timer((gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR, CLKDIV_SM_SIMULATOR, | |
262 | IRQ_SPARC_SM_SIMULATOR, spectral_matrices_isr_simu ); |
|
227 | IRQ_SPARC_SM_SIMULATOR, spectral_matrices_isr_simu ); | |
263 | // </SPECTRAL MATRICES SIMULATOR> |
|
228 | // </SPECTRAL MATRICES SIMULATOR> | |
264 | //******************************* |
|
229 | //******************************* | |
265 |
|
230 | |||
266 | // configure IRQ handling for the waveform picker unit |
|
231 | // configure IRQ handling for the waveform picker unit | |
267 | status = rtems_interrupt_catch( waveforms_isr, |
|
232 | status = rtems_interrupt_catch( waveforms_isr, | |
268 | IRQ_SPARC_WAVEFORM_PICKER, |
|
233 | IRQ_SPARC_WAVEFORM_PICKER, | |
269 | &old_isr_handler) ; |
|
234 | &old_isr_handler) ; | |
270 | // configure IRQ handling for the spectral matrices unit |
|
235 | // configure IRQ handling for the spectral matrices unit | |
271 | status = rtems_interrupt_catch( spectral_matrices_isr, |
|
236 | status = rtems_interrupt_catch( spectral_matrices_isr, | |
272 | IRQ_SPARC_SPECTRAL_MATRIX, |
|
237 | IRQ_SPARC_SPECTRAL_MATRIX, | |
273 | &old_isr_handler) ; |
|
238 | &old_isr_handler) ; | |
274 |
|
239 | |||
275 | // if the spacewire link is not up then send an event to the SPIQ task for link recovery |
|
240 | // if the spacewire link is not up then send an event to the SPIQ task for link recovery | |
276 | if ( status_spw != RTEMS_SUCCESSFUL ) |
|
241 | if ( status_spw != RTEMS_SUCCESSFUL ) | |
277 | { |
|
242 | { | |
278 | status = rtems_event_send( Task_id[TASKID_SPIQ], SPW_LINKERR_EVENT ); |
|
243 | status = rtems_event_send( Task_id[TASKID_SPIQ], SPW_LINKERR_EVENT ); | |
279 | if ( status != RTEMS_SUCCESSFUL ) { |
|
244 | if ( status != RTEMS_SUCCESSFUL ) { | |
280 | PRINTF1("in INIT *** ERR rtems_event_send to SPIQ code %d\n", status ) |
|
245 | PRINTF1("in INIT *** ERR rtems_event_send to SPIQ code %d\n", status ) | |
281 | } |
|
246 | } | |
282 | } |
|
247 | } | |
283 |
|
248 | |||
284 | BOOT_PRINTF("delete INIT\n") |
|
249 | BOOT_PRINTF("delete INIT\n") | |
285 |
|
250 | |||
286 | test_bp1(); |
|
|||
287 |
|
||||
288 | status = rtems_task_delete(RTEMS_SELF); |
|
251 | status = rtems_task_delete(RTEMS_SELF); | |
289 |
|
252 | |||
290 | } |
|
253 | } | |
291 |
|
254 | |||
292 | void init_local_mode_parameters( void ) |
|
255 | void init_local_mode_parameters( void ) | |
293 | { |
|
256 | { | |
294 | /** This function initialize the param_local global variable with default values. |
|
257 | /** This function initialize the param_local global variable with default values. | |
295 | * |
|
258 | * | |
296 | */ |
|
259 | */ | |
297 |
|
260 | |||
298 | unsigned int i; |
|
261 | unsigned int i; | |
299 |
|
262 | |||
300 | // LOCAL PARAMETERS |
|
263 | // LOCAL PARAMETERS | |
301 |
|
264 | |||
302 | BOOT_PRINTF1("local_sbm1_nb_cwf_max %d \n", param_local.local_sbm1_nb_cwf_max) |
|
265 | BOOT_PRINTF1("local_sbm1_nb_cwf_max %d \n", param_local.local_sbm1_nb_cwf_max) | |
303 | BOOT_PRINTF1("local_sbm2_nb_cwf_max %d \n", param_local.local_sbm2_nb_cwf_max) |
|
266 | BOOT_PRINTF1("local_sbm2_nb_cwf_max %d \n", param_local.local_sbm2_nb_cwf_max) | |
304 | BOOT_PRINTF1("nb_interrupt_f0_MAX = %d\n", param_local.local_nb_interrupt_f0_MAX) |
|
267 | BOOT_PRINTF1("nb_interrupt_f0_MAX = %d\n", param_local.local_nb_interrupt_f0_MAX) | |
305 |
|
268 | |||
306 | // init sequence counters |
|
269 | // init sequence counters | |
307 |
|
270 | |||
308 | for(i = 0; i<SEQ_CNT_NB_DEST_ID; i++) |
|
271 | for(i = 0; i<SEQ_CNT_NB_DEST_ID; i++) | |
309 | { |
|
272 | { | |
310 | sequenceCounters_TC_EXE[i] = 0x00; |
|
273 | sequenceCounters_TC_EXE[i] = 0x00; | |
311 | } |
|
274 | } | |
312 | sequenceCounters_SCIENCE_NORMAL_BURST = 0x00; |
|
275 | sequenceCounters_SCIENCE_NORMAL_BURST = 0x00; | |
313 | sequenceCounters_SCIENCE_SBM1_SBM2 = 0x00; |
|
276 | sequenceCounters_SCIENCE_SBM1_SBM2 = 0x00; | |
314 | sequenceCounterHK = TM_PACKET_SEQ_CTRL_STANDALONE << 8; |
|
277 | sequenceCounterHK = TM_PACKET_SEQ_CTRL_STANDALONE << 8; | |
315 | sequenceCounterParameterDump = TM_PACKET_SEQ_CTRL_STANDALONE << 8; |
|
278 | sequenceCounterParameterDump = TM_PACKET_SEQ_CTRL_STANDALONE << 8; | |
316 | } |
|
279 | } | |
317 |
|
280 | |||
318 | void reset_local_time( void ) |
|
281 | void reset_local_time( void ) | |
319 | { |
|
282 | { | |
320 | time_management_regs->ctrl = time_management_regs->ctrl | 0x02; // [0010] software reset, coarse time = 0x80000000 |
|
283 | time_management_regs->ctrl = time_management_regs->ctrl | 0x02; // [0010] software reset, coarse time = 0x80000000 | |
321 | } |
|
284 | } | |
322 |
|
285 | |||
323 | void create_names( void ) // create all names for tasks and queues |
|
286 | void create_names( void ) // create all names for tasks and queues | |
324 | { |
|
287 | { | |
325 | /** This function creates all RTEMS names used in the software for tasks and queues. |
|
288 | /** This function creates all RTEMS names used in the software for tasks and queues. | |
326 | * |
|
289 | * | |
327 | * @return RTEMS directive status codes: |
|
290 | * @return RTEMS directive status codes: | |
328 | * - RTEMS_SUCCESSFUL - successful completion |
|
291 | * - RTEMS_SUCCESSFUL - successful completion | |
329 | * |
|
292 | * | |
330 | */ |
|
293 | */ | |
331 |
|
294 | |||
332 | // task names |
|
295 | // task names | |
333 | Task_name[TASKID_RECV] = rtems_build_name( 'R', 'E', 'C', 'V' ); |
|
296 | Task_name[TASKID_RECV] = rtems_build_name( 'R', 'E', 'C', 'V' ); | |
334 | Task_name[TASKID_ACTN] = rtems_build_name( 'A', 'C', 'T', 'N' ); |
|
297 | Task_name[TASKID_ACTN] = rtems_build_name( 'A', 'C', 'T', 'N' ); | |
335 | Task_name[TASKID_SPIQ] = rtems_build_name( 'S', 'P', 'I', 'Q' ); |
|
298 | Task_name[TASKID_SPIQ] = rtems_build_name( 'S', 'P', 'I', 'Q' ); | |
336 | Task_name[TASKID_STAT] = rtems_build_name( 'S', 'T', 'A', 'T' ); |
|
299 | Task_name[TASKID_STAT] = rtems_build_name( 'S', 'T', 'A', 'T' ); | |
337 | Task_name[TASKID_AVF0] = rtems_build_name( 'A', 'V', 'F', '0' ); |
|
300 | Task_name[TASKID_AVF0] = rtems_build_name( 'A', 'V', 'F', '0' ); | |
338 | Task_name[TASKID_SWBD] = rtems_build_name( 'S', 'W', 'B', 'D' ); |
|
301 | Task_name[TASKID_SWBD] = rtems_build_name( 'S', 'W', 'B', 'D' ); | |
339 | Task_name[TASKID_WFRM] = rtems_build_name( 'W', 'F', 'R', 'M' ); |
|
302 | Task_name[TASKID_WFRM] = rtems_build_name( 'W', 'F', 'R', 'M' ); | |
340 | Task_name[TASKID_DUMB] = rtems_build_name( 'D', 'U', 'M', 'B' ); |
|
303 | Task_name[TASKID_DUMB] = rtems_build_name( 'D', 'U', 'M', 'B' ); | |
341 | Task_name[TASKID_HOUS] = rtems_build_name( 'H', 'O', 'U', 'S' ); |
|
304 | Task_name[TASKID_HOUS] = rtems_build_name( 'H', 'O', 'U', 'S' ); | |
342 | Task_name[TASKID_PRC0] = rtems_build_name( 'P', 'R', 'C', '0' ); |
|
305 | Task_name[TASKID_PRC0] = rtems_build_name( 'P', 'R', 'C', '0' ); | |
343 | Task_name[TASKID_CWF3] = rtems_build_name( 'C', 'W', 'F', '3' ); |
|
306 | Task_name[TASKID_CWF3] = rtems_build_name( 'C', 'W', 'F', '3' ); | |
344 | Task_name[TASKID_CWF2] = rtems_build_name( 'C', 'W', 'F', '2' ); |
|
307 | Task_name[TASKID_CWF2] = rtems_build_name( 'C', 'W', 'F', '2' ); | |
345 | Task_name[TASKID_CWF1] = rtems_build_name( 'C', 'W', 'F', '1' ); |
|
308 | Task_name[TASKID_CWF1] = rtems_build_name( 'C', 'W', 'F', '1' ); | |
346 | Task_name[TASKID_SEND] = rtems_build_name( 'S', 'E', 'N', 'D' ); |
|
309 | Task_name[TASKID_SEND] = rtems_build_name( 'S', 'E', 'N', 'D' ); | |
347 | Task_name[TASKID_WTDG] = rtems_build_name( 'W', 'T', 'D', 'G' ); |
|
310 | Task_name[TASKID_WTDG] = rtems_build_name( 'W', 'T', 'D', 'G' ); | |
348 | Task_name[TASKID_AVF1] = rtems_build_name( 'A', 'V', 'F', '1' ); |
|
311 | Task_name[TASKID_AVF1] = rtems_build_name( 'A', 'V', 'F', '1' ); | |
349 | Task_name[TASKID_PRC1] = rtems_build_name( 'P', 'R', 'C', '1' ); |
|
312 | Task_name[TASKID_PRC1] = rtems_build_name( 'P', 'R', 'C', '1' ); | |
350 | Task_name[TASKID_AVF2] = rtems_build_name( 'A', 'V', 'F', '2' ); |
|
313 | Task_name[TASKID_AVF2] = rtems_build_name( 'A', 'V', 'F', '2' ); | |
351 | Task_name[TASKID_PRC2] = rtems_build_name( 'P', 'R', 'C', '2' ); |
|
314 | Task_name[TASKID_PRC2] = rtems_build_name( 'P', 'R', 'C', '2' ); | |
352 |
|
315 | |||
353 | // rate monotonic period names |
|
316 | // rate monotonic period names | |
354 | name_hk_rate_monotonic = rtems_build_name( 'H', 'O', 'U', 'S' ); |
|
317 | name_hk_rate_monotonic = rtems_build_name( 'H', 'O', 'U', 'S' ); | |
355 |
|
318 | |||
356 | misc_name[QUEUE_RECV] = rtems_build_name( 'Q', '_', 'R', 'V' ); |
|
319 | misc_name[QUEUE_RECV] = rtems_build_name( 'Q', '_', 'R', 'V' ); | |
357 | misc_name[QUEUE_SEND] = rtems_build_name( 'Q', '_', 'S', 'D' ); |
|
320 | misc_name[QUEUE_SEND] = rtems_build_name( 'Q', '_', 'S', 'D' ); | |
358 | misc_name[QUEUE_PRC0] = rtems_build_name( 'Q', '_', 'P', '0' ); |
|
321 | misc_name[QUEUE_PRC0] = rtems_build_name( 'Q', '_', 'P', '0' ); | |
359 | misc_name[QUEUE_PRC1] = rtems_build_name( 'Q', '_', 'P', '1' ); |
|
322 | misc_name[QUEUE_PRC1] = rtems_build_name( 'Q', '_', 'P', '1' ); | |
360 | misc_name[QUEUE_PRC2] = rtems_build_name( 'Q', '_', 'P', '2' ); |
|
323 | misc_name[QUEUE_PRC2] = rtems_build_name( 'Q', '_', 'P', '2' ); | |
361 | } |
|
324 | } | |
362 |
|
325 | |||
363 | int create_all_tasks( void ) // create all tasks which run in the software |
|
326 | int create_all_tasks( void ) // create all tasks which run in the software | |
364 | { |
|
327 | { | |
365 | /** This function creates all RTEMS tasks used in the software. |
|
328 | /** This function creates all RTEMS tasks used in the software. | |
366 | * |
|
329 | * | |
367 | * @return RTEMS directive status codes: |
|
330 | * @return RTEMS directive status codes: | |
368 | * - RTEMS_SUCCESSFUL - task created successfully |
|
331 | * - RTEMS_SUCCESSFUL - task created successfully | |
369 | * - RTEMS_INVALID_ADDRESS - id is NULL |
|
332 | * - RTEMS_INVALID_ADDRESS - id is NULL | |
370 | * - RTEMS_INVALID_NAME - invalid task name |
|
333 | * - RTEMS_INVALID_NAME - invalid task name | |
371 | * - RTEMS_INVALID_PRIORITY - invalid task priority |
|
334 | * - RTEMS_INVALID_PRIORITY - invalid task priority | |
372 | * - RTEMS_MP_NOT_CONFIGURED - multiprocessing not configured |
|
335 | * - RTEMS_MP_NOT_CONFIGURED - multiprocessing not configured | |
373 | * - RTEMS_TOO_MANY - too many tasks created |
|
336 | * - RTEMS_TOO_MANY - too many tasks created | |
374 | * - RTEMS_UNSATISFIED - not enough memory for stack/FP context |
|
337 | * - RTEMS_UNSATISFIED - not enough memory for stack/FP context | |
375 | * - RTEMS_TOO_MANY - too many global objects |
|
338 | * - RTEMS_TOO_MANY - too many global objects | |
376 | * |
|
339 | * | |
377 | */ |
|
340 | */ | |
378 |
|
341 | |||
379 | rtems_status_code status; |
|
342 | rtems_status_code status; | |
380 |
|
343 | |||
381 | //********** |
|
344 | //********** | |
382 | // SPACEWIRE |
|
345 | // SPACEWIRE | |
383 | // RECV |
|
346 | // RECV | |
384 | status = rtems_task_create( |
|
347 | status = rtems_task_create( | |
385 | Task_name[TASKID_RECV], TASK_PRIORITY_RECV, RTEMS_MINIMUM_STACK_SIZE, |
|
348 | Task_name[TASKID_RECV], TASK_PRIORITY_RECV, RTEMS_MINIMUM_STACK_SIZE, | |
386 | RTEMS_DEFAULT_MODES, |
|
349 | RTEMS_DEFAULT_MODES, | |
387 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_RECV] |
|
350 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_RECV] | |
388 | ); |
|
351 | ); | |
389 | if (status == RTEMS_SUCCESSFUL) // SEND |
|
352 | if (status == RTEMS_SUCCESSFUL) // SEND | |
390 | { |
|
353 | { | |
391 | status = rtems_task_create( |
|
354 | status = rtems_task_create( | |
392 | Task_name[TASKID_SEND], TASK_PRIORITY_SEND, RTEMS_MINIMUM_STACK_SIZE * 2, |
|
355 | Task_name[TASKID_SEND], TASK_PRIORITY_SEND, RTEMS_MINIMUM_STACK_SIZE * 2, | |
393 | RTEMS_DEFAULT_MODES, |
|
356 | RTEMS_DEFAULT_MODES, | |
394 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_SEND] |
|
357 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_SEND] | |
395 | ); |
|
358 | ); | |
396 | } |
|
359 | } | |
397 | if (status == RTEMS_SUCCESSFUL) // WTDG |
|
360 | if (status == RTEMS_SUCCESSFUL) // WTDG | |
398 | { |
|
361 | { | |
399 | status = rtems_task_create( |
|
362 | status = rtems_task_create( | |
400 | Task_name[TASKID_WTDG], TASK_PRIORITY_WTDG, RTEMS_MINIMUM_STACK_SIZE, |
|
363 | Task_name[TASKID_WTDG], TASK_PRIORITY_WTDG, RTEMS_MINIMUM_STACK_SIZE, | |
401 | RTEMS_DEFAULT_MODES, |
|
364 | RTEMS_DEFAULT_MODES, | |
402 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_WTDG] |
|
365 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_WTDG] | |
403 | ); |
|
366 | ); | |
404 | } |
|
367 | } | |
405 | if (status == RTEMS_SUCCESSFUL) // ACTN |
|
368 | if (status == RTEMS_SUCCESSFUL) // ACTN | |
406 | { |
|
369 | { | |
407 | status = rtems_task_create( |
|
370 | status = rtems_task_create( | |
408 | Task_name[TASKID_ACTN], TASK_PRIORITY_ACTN, RTEMS_MINIMUM_STACK_SIZE, |
|
371 | Task_name[TASKID_ACTN], TASK_PRIORITY_ACTN, RTEMS_MINIMUM_STACK_SIZE, | |
409 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, |
|
372 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, | |
410 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_ACTN] |
|
373 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_ACTN] | |
411 | ); |
|
374 | ); | |
412 | } |
|
375 | } | |
413 | if (status == RTEMS_SUCCESSFUL) // SPIQ |
|
376 | if (status == RTEMS_SUCCESSFUL) // SPIQ | |
414 | { |
|
377 | { | |
415 | status = rtems_task_create( |
|
378 | status = rtems_task_create( | |
416 | Task_name[TASKID_SPIQ], TASK_PRIORITY_SPIQ, RTEMS_MINIMUM_STACK_SIZE, |
|
379 | Task_name[TASKID_SPIQ], TASK_PRIORITY_SPIQ, RTEMS_MINIMUM_STACK_SIZE, | |
417 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, |
|
380 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, | |
418 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SPIQ] |
|
381 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SPIQ] | |
419 | ); |
|
382 | ); | |
420 | } |
|
383 | } | |
421 |
|
384 | |||
422 | //****************** |
|
385 | //****************** | |
423 | // SPECTRAL MATRICES |
|
386 | // SPECTRAL MATRICES | |
424 | if (status == RTEMS_SUCCESSFUL) // AVF0 |
|
387 | if (status == RTEMS_SUCCESSFUL) // AVF0 | |
425 | { |
|
388 | { | |
426 | status = rtems_task_create( |
|
389 | status = rtems_task_create( | |
427 | Task_name[TASKID_AVF0], TASK_PRIORITY_AVF0, RTEMS_MINIMUM_STACK_SIZE, |
|
390 | Task_name[TASKID_AVF0], TASK_PRIORITY_AVF0, RTEMS_MINIMUM_STACK_SIZE, | |
428 | RTEMS_DEFAULT_MODES, |
|
391 | RTEMS_DEFAULT_MODES, | |
429 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF0] |
|
392 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF0] | |
430 | ); |
|
393 | ); | |
431 | } |
|
394 | } | |
432 | if (status == RTEMS_SUCCESSFUL) // PRC0 |
|
395 | if (status == RTEMS_SUCCESSFUL) // PRC0 | |
433 | { |
|
396 | { | |
434 | status = rtems_task_create( |
|
397 | status = rtems_task_create( | |
435 | Task_name[TASKID_PRC0], TASK_PRIORITY_PRC0, RTEMS_MINIMUM_STACK_SIZE * 2, |
|
398 | Task_name[TASKID_PRC0], TASK_PRIORITY_PRC0, RTEMS_MINIMUM_STACK_SIZE * 2, | |
436 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, |
|
399 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, | |
437 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_PRC0] |
|
400 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_PRC0] | |
438 | ); |
|
401 | ); | |
439 | } |
|
402 | } | |
440 | if (status == RTEMS_SUCCESSFUL) // AVF1 |
|
403 | if (status == RTEMS_SUCCESSFUL) // AVF1 | |
441 | { |
|
404 | { | |
442 | status = rtems_task_create( |
|
405 | status = rtems_task_create( | |
443 | Task_name[TASKID_AVF1], TASK_PRIORITY_AVF1, RTEMS_MINIMUM_STACK_SIZE, |
|
406 | Task_name[TASKID_AVF1], TASK_PRIORITY_AVF1, RTEMS_MINIMUM_STACK_SIZE, | |
444 | RTEMS_DEFAULT_MODES, |
|
407 | RTEMS_DEFAULT_MODES, | |
445 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF1] |
|
408 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF1] | |
446 | ); |
|
409 | ); | |
447 | } |
|
410 | } | |
448 | if (status == RTEMS_SUCCESSFUL) // PRC1 |
|
411 | if (status == RTEMS_SUCCESSFUL) // PRC1 | |
449 | { |
|
412 | { | |
450 | status = rtems_task_create( |
|
413 | status = rtems_task_create( | |
451 | Task_name[TASKID_PRC1], TASK_PRIORITY_PRC1, RTEMS_MINIMUM_STACK_SIZE * 2, |
|
414 | Task_name[TASKID_PRC1], TASK_PRIORITY_PRC1, RTEMS_MINIMUM_STACK_SIZE * 2, | |
452 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, |
|
415 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, | |
453 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_PRC1] |
|
416 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_PRC1] | |
454 | ); |
|
417 | ); | |
455 | } |
|
418 | } | |
456 | if (status == RTEMS_SUCCESSFUL) // AVF2 |
|
419 | if (status == RTEMS_SUCCESSFUL) // AVF2 | |
457 | { |
|
420 | { | |
458 | status = rtems_task_create( |
|
421 | status = rtems_task_create( | |
459 | Task_name[TASKID_AVF2], TASK_PRIORITY_AVF2, RTEMS_MINIMUM_STACK_SIZE, |
|
422 | Task_name[TASKID_AVF2], TASK_PRIORITY_AVF2, RTEMS_MINIMUM_STACK_SIZE, | |
460 | RTEMS_DEFAULT_MODES, |
|
423 | RTEMS_DEFAULT_MODES, | |
461 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF2] |
|
424 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF2] | |
462 | ); |
|
425 | ); | |
463 | } |
|
426 | } | |
464 | if (status == RTEMS_SUCCESSFUL) // PRC2 |
|
427 | if (status == RTEMS_SUCCESSFUL) // PRC2 | |
465 | { |
|
428 | { | |
466 | status = rtems_task_create( |
|
429 | status = rtems_task_create( | |
467 | Task_name[TASKID_PRC2], TASK_PRIORITY_PRC2, RTEMS_MINIMUM_STACK_SIZE * 2, |
|
430 | Task_name[TASKID_PRC2], TASK_PRIORITY_PRC2, RTEMS_MINIMUM_STACK_SIZE * 2, | |
468 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, |
|
431 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, | |
469 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_PRC2] |
|
432 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_PRC2] | |
470 | ); |
|
433 | ); | |
471 | } |
|
434 | } | |
472 |
|
435 | |||
473 | //**************** |
|
436 | //**************** | |
474 | // WAVEFORM PICKER |
|
437 | // WAVEFORM PICKER | |
475 | if (status == RTEMS_SUCCESSFUL) // WFRM |
|
438 | if (status == RTEMS_SUCCESSFUL) // WFRM | |
476 | { |
|
439 | { | |
477 | status = rtems_task_create( |
|
440 | status = rtems_task_create( | |
478 | Task_name[TASKID_WFRM], TASK_PRIORITY_WFRM, RTEMS_MINIMUM_STACK_SIZE, |
|
441 | Task_name[TASKID_WFRM], TASK_PRIORITY_WFRM, RTEMS_MINIMUM_STACK_SIZE, | |
479 | RTEMS_DEFAULT_MODES, |
|
442 | RTEMS_DEFAULT_MODES, | |
480 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_WFRM] |
|
443 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_WFRM] | |
481 | ); |
|
444 | ); | |
482 | } |
|
445 | } | |
483 | if (status == RTEMS_SUCCESSFUL) // CWF3 |
|
446 | if (status == RTEMS_SUCCESSFUL) // CWF3 | |
484 | { |
|
447 | { | |
485 | status = rtems_task_create( |
|
448 | status = rtems_task_create( | |
486 | Task_name[TASKID_CWF3], TASK_PRIORITY_CWF3, RTEMS_MINIMUM_STACK_SIZE, |
|
449 | Task_name[TASKID_CWF3], TASK_PRIORITY_CWF3, RTEMS_MINIMUM_STACK_SIZE, | |
487 | RTEMS_DEFAULT_MODES, |
|
450 | RTEMS_DEFAULT_MODES, | |
488 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF3] |
|
451 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF3] | |
489 | ); |
|
452 | ); | |
490 | } |
|
453 | } | |
491 | if (status == RTEMS_SUCCESSFUL) // CWF2 |
|
454 | if (status == RTEMS_SUCCESSFUL) // CWF2 | |
492 | { |
|
455 | { | |
493 | status = rtems_task_create( |
|
456 | status = rtems_task_create( | |
494 | Task_name[TASKID_CWF2], TASK_PRIORITY_CWF2, RTEMS_MINIMUM_STACK_SIZE, |
|
457 | Task_name[TASKID_CWF2], TASK_PRIORITY_CWF2, RTEMS_MINIMUM_STACK_SIZE, | |
495 | RTEMS_DEFAULT_MODES, |
|
458 | RTEMS_DEFAULT_MODES, | |
496 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF2] |
|
459 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF2] | |
497 | ); |
|
460 | ); | |
498 | } |
|
461 | } | |
499 | if (status == RTEMS_SUCCESSFUL) // CWF1 |
|
462 | if (status == RTEMS_SUCCESSFUL) // CWF1 | |
500 | { |
|
463 | { | |
501 | status = rtems_task_create( |
|
464 | status = rtems_task_create( | |
502 | Task_name[TASKID_CWF1], TASK_PRIORITY_CWF1, RTEMS_MINIMUM_STACK_SIZE, |
|
465 | Task_name[TASKID_CWF1], TASK_PRIORITY_CWF1, RTEMS_MINIMUM_STACK_SIZE, | |
503 | RTEMS_DEFAULT_MODES, |
|
466 | RTEMS_DEFAULT_MODES, | |
504 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF1] |
|
467 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF1] | |
505 | ); |
|
468 | ); | |
506 | } |
|
469 | } | |
507 | if (status == RTEMS_SUCCESSFUL) // SWBD |
|
470 | if (status == RTEMS_SUCCESSFUL) // SWBD | |
508 | { |
|
471 | { | |
509 | status = rtems_task_create( |
|
472 | status = rtems_task_create( | |
510 | Task_name[TASKID_SWBD], TASK_PRIORITY_SWBD, RTEMS_MINIMUM_STACK_SIZE, |
|
473 | Task_name[TASKID_SWBD], TASK_PRIORITY_SWBD, RTEMS_MINIMUM_STACK_SIZE, | |
511 | RTEMS_DEFAULT_MODES, |
|
474 | RTEMS_DEFAULT_MODES, | |
512 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_SWBD] |
|
475 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_SWBD] | |
513 | ); |
|
476 | ); | |
514 | } |
|
477 | } | |
515 |
|
478 | |||
516 | //***** |
|
479 | //***** | |
517 | // MISC |
|
480 | // MISC | |
518 | if (status == RTEMS_SUCCESSFUL) // STAT |
|
481 | if (status == RTEMS_SUCCESSFUL) // STAT | |
519 | { |
|
482 | { | |
520 | status = rtems_task_create( |
|
483 | status = rtems_task_create( | |
521 | Task_name[TASKID_STAT], TASK_PRIORITY_STAT, RTEMS_MINIMUM_STACK_SIZE, |
|
484 | Task_name[TASKID_STAT], TASK_PRIORITY_STAT, RTEMS_MINIMUM_STACK_SIZE, | |
522 | RTEMS_DEFAULT_MODES, |
|
485 | RTEMS_DEFAULT_MODES, | |
523 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_STAT] |
|
486 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_STAT] | |
524 | ); |
|
487 | ); | |
525 | } |
|
488 | } | |
526 | if (status == RTEMS_SUCCESSFUL) // DUMB |
|
489 | if (status == RTEMS_SUCCESSFUL) // DUMB | |
527 | { |
|
490 | { | |
528 | status = rtems_task_create( |
|
491 | status = rtems_task_create( | |
529 | Task_name[TASKID_DUMB], TASK_PRIORITY_DUMB, RTEMS_MINIMUM_STACK_SIZE, |
|
492 | Task_name[TASKID_DUMB], TASK_PRIORITY_DUMB, RTEMS_MINIMUM_STACK_SIZE, | |
530 | RTEMS_DEFAULT_MODES, |
|
493 | RTEMS_DEFAULT_MODES, | |
531 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_DUMB] |
|
494 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_DUMB] | |
532 | ); |
|
495 | ); | |
533 | } |
|
496 | } | |
534 | if (status == RTEMS_SUCCESSFUL) // HOUS |
|
497 | if (status == RTEMS_SUCCESSFUL) // HOUS | |
535 | { |
|
498 | { | |
536 | status = rtems_task_create( |
|
499 | status = rtems_task_create( | |
537 | Task_name[TASKID_HOUS], TASK_PRIORITY_HOUS, RTEMS_MINIMUM_STACK_SIZE, |
|
500 | Task_name[TASKID_HOUS], TASK_PRIORITY_HOUS, RTEMS_MINIMUM_STACK_SIZE, | |
538 | RTEMS_DEFAULT_MODES, |
|
501 | RTEMS_DEFAULT_MODES, | |
539 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_HOUS] |
|
502 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_HOUS] | |
540 | ); |
|
503 | ); | |
541 | } |
|
504 | } | |
542 |
|
505 | |||
543 | return status; |
|
506 | return status; | |
544 | } |
|
507 | } | |
545 |
|
508 | |||
546 | int start_recv_send_tasks( void ) |
|
509 | int start_recv_send_tasks( void ) | |
547 | { |
|
510 | { | |
548 | rtems_status_code status; |
|
511 | rtems_status_code status; | |
549 |
|
512 | |||
550 | status = rtems_task_start( Task_id[TASKID_RECV], recv_task, 1 ); |
|
513 | status = rtems_task_start( Task_id[TASKID_RECV], recv_task, 1 ); | |
551 | if (status!=RTEMS_SUCCESSFUL) { |
|
514 | if (status!=RTEMS_SUCCESSFUL) { | |
552 | BOOT_PRINTF("in INIT *** Error starting TASK_RECV\n") |
|
515 | BOOT_PRINTF("in INIT *** Error starting TASK_RECV\n") | |
553 | } |
|
516 | } | |
554 |
|
517 | |||
555 | if (status == RTEMS_SUCCESSFUL) // SEND |
|
518 | if (status == RTEMS_SUCCESSFUL) // SEND | |
556 | { |
|
519 | { | |
557 | status = rtems_task_start( Task_id[TASKID_SEND], send_task, 1 ); |
|
520 | status = rtems_task_start( Task_id[TASKID_SEND], send_task, 1 ); | |
558 | if (status!=RTEMS_SUCCESSFUL) { |
|
521 | if (status!=RTEMS_SUCCESSFUL) { | |
559 | BOOT_PRINTF("in INIT *** Error starting TASK_SEND\n") |
|
522 | BOOT_PRINTF("in INIT *** Error starting TASK_SEND\n") | |
560 | } |
|
523 | } | |
561 | } |
|
524 | } | |
562 |
|
525 | |||
563 | return status; |
|
526 | return status; | |
564 | } |
|
527 | } | |
565 |
|
528 | |||
566 | int start_all_tasks( void ) // start all tasks except SEND RECV and HOUS |
|
529 | int start_all_tasks( void ) // start all tasks except SEND RECV and HOUS | |
567 | { |
|
530 | { | |
568 | /** This function starts all RTEMS tasks used in the software. |
|
531 | /** This function starts all RTEMS tasks used in the software. | |
569 | * |
|
532 | * | |
570 | * @return RTEMS directive status codes: |
|
533 | * @return RTEMS directive status codes: | |
571 | * - RTEMS_SUCCESSFUL - ask started successfully |
|
534 | * - RTEMS_SUCCESSFUL - ask started successfully | |
572 | * - RTEMS_INVALID_ADDRESS - invalid task entry point |
|
535 | * - RTEMS_INVALID_ADDRESS - invalid task entry point | |
573 | * - RTEMS_INVALID_ID - invalid task id |
|
536 | * - RTEMS_INVALID_ID - invalid task id | |
574 | * - RTEMS_INCORRECT_STATE - task not in the dormant state |
|
537 | * - RTEMS_INCORRECT_STATE - task not in the dormant state | |
575 | * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot start remote task |
|
538 | * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot start remote task | |
576 | * |
|
539 | * | |
577 | */ |
|
540 | */ | |
578 | // starts all the tasks fot eh flight software |
|
541 | // starts all the tasks fot eh flight software | |
579 |
|
542 | |||
580 | rtems_status_code status; |
|
543 | rtems_status_code status; | |
581 |
|
544 | |||
582 | //********** |
|
545 | //********** | |
583 | // SPACEWIRE |
|
546 | // SPACEWIRE | |
584 | status = rtems_task_start( Task_id[TASKID_SPIQ], spiq_task, 1 ); |
|
547 | status = rtems_task_start( Task_id[TASKID_SPIQ], spiq_task, 1 ); | |
585 | if (status!=RTEMS_SUCCESSFUL) { |
|
548 | if (status!=RTEMS_SUCCESSFUL) { | |
586 | BOOT_PRINTF("in INIT *** Error starting TASK_SPIQ\n") |
|
549 | BOOT_PRINTF("in INIT *** Error starting TASK_SPIQ\n") | |
587 | } |
|
550 | } | |
588 |
|
551 | |||
589 | if (status == RTEMS_SUCCESSFUL) // WTDG |
|
552 | if (status == RTEMS_SUCCESSFUL) // WTDG | |
590 | { |
|
553 | { | |
591 | status = rtems_task_start( Task_id[TASKID_WTDG], wtdg_task, 1 ); |
|
554 | status = rtems_task_start( Task_id[TASKID_WTDG], wtdg_task, 1 ); | |
592 | if (status!=RTEMS_SUCCESSFUL) { |
|
555 | if (status!=RTEMS_SUCCESSFUL) { | |
593 | BOOT_PRINTF("in INIT *** Error starting TASK_WTDG\n") |
|
556 | BOOT_PRINTF("in INIT *** Error starting TASK_WTDG\n") | |
594 | } |
|
557 | } | |
595 | } |
|
558 | } | |
596 |
|
559 | |||
597 | if (status == RTEMS_SUCCESSFUL) // ACTN |
|
560 | if (status == RTEMS_SUCCESSFUL) // ACTN | |
598 | { |
|
561 | { | |
599 | status = rtems_task_start( Task_id[TASKID_ACTN], actn_task, 1 ); |
|
562 | status = rtems_task_start( Task_id[TASKID_ACTN], actn_task, 1 ); | |
600 | if (status!=RTEMS_SUCCESSFUL) { |
|
563 | if (status!=RTEMS_SUCCESSFUL) { | |
601 | BOOT_PRINTF("in INIT *** Error starting TASK_ACTN\n") |
|
564 | BOOT_PRINTF("in INIT *** Error starting TASK_ACTN\n") | |
602 | } |
|
565 | } | |
603 | } |
|
566 | } | |
604 |
|
567 | |||
605 | //****************** |
|
568 | //****************** | |
606 | // SPECTRAL MATRICES |
|
569 | // SPECTRAL MATRICES | |
607 | if (status == RTEMS_SUCCESSFUL) // AVF0 |
|
570 | if (status == RTEMS_SUCCESSFUL) // AVF0 | |
608 | { |
|
571 | { | |
609 | status = rtems_task_start( Task_id[TASKID_AVF0], avf0_task, LFR_MODE_STANDBY ); |
|
572 | status = rtems_task_start( Task_id[TASKID_AVF0], avf0_task, LFR_MODE_STANDBY ); | |
610 | if (status!=RTEMS_SUCCESSFUL) { |
|
573 | if (status!=RTEMS_SUCCESSFUL) { | |
611 | BOOT_PRINTF("in INIT *** Error starting TASK_AVF0\n") |
|
574 | BOOT_PRINTF("in INIT *** Error starting TASK_AVF0\n") | |
612 | } |
|
575 | } | |
613 | } |
|
576 | } | |
614 | if (status == RTEMS_SUCCESSFUL) // PRC0 |
|
577 | if (status == RTEMS_SUCCESSFUL) // PRC0 | |
615 | { |
|
578 | { | |
616 | status = rtems_task_start( Task_id[TASKID_PRC0], prc0_task, LFR_MODE_STANDBY ); |
|
579 | status = rtems_task_start( Task_id[TASKID_PRC0], prc0_task, LFR_MODE_STANDBY ); | |
617 | if (status!=RTEMS_SUCCESSFUL) { |
|
580 | if (status!=RTEMS_SUCCESSFUL) { | |
618 | BOOT_PRINTF("in INIT *** Error starting TASK_PRC0\n") |
|
581 | BOOT_PRINTF("in INIT *** Error starting TASK_PRC0\n") | |
619 | } |
|
582 | } | |
620 | } |
|
583 | } | |
621 | if (status == RTEMS_SUCCESSFUL) // AVF1 |
|
584 | if (status == RTEMS_SUCCESSFUL) // AVF1 | |
622 | { |
|
585 | { | |
623 | status = rtems_task_start( Task_id[TASKID_AVF1], avf1_task, LFR_MODE_STANDBY ); |
|
586 | status = rtems_task_start( Task_id[TASKID_AVF1], avf1_task, LFR_MODE_STANDBY ); | |
624 | if (status!=RTEMS_SUCCESSFUL) { |
|
587 | if (status!=RTEMS_SUCCESSFUL) { | |
625 | BOOT_PRINTF("in INIT *** Error starting TASK_AVF1\n") |
|
588 | BOOT_PRINTF("in INIT *** Error starting TASK_AVF1\n") | |
626 | } |
|
589 | } | |
627 | } |
|
590 | } | |
628 | if (status == RTEMS_SUCCESSFUL) // PRC1 |
|
591 | if (status == RTEMS_SUCCESSFUL) // PRC1 | |
629 | { |
|
592 | { | |
630 | status = rtems_task_start( Task_id[TASKID_PRC1], prc1_task, LFR_MODE_STANDBY ); |
|
593 | status = rtems_task_start( Task_id[TASKID_PRC1], prc1_task, LFR_MODE_STANDBY ); | |
631 | if (status!=RTEMS_SUCCESSFUL) { |
|
594 | if (status!=RTEMS_SUCCESSFUL) { | |
632 | BOOT_PRINTF("in INIT *** Error starting TASK_PRC1\n") |
|
595 | BOOT_PRINTF("in INIT *** Error starting TASK_PRC1\n") | |
633 | } |
|
596 | } | |
634 | } |
|
597 | } | |
635 | if (status == RTEMS_SUCCESSFUL) // AVF2 |
|
598 | if (status == RTEMS_SUCCESSFUL) // AVF2 | |
636 | { |
|
599 | { | |
637 | status = rtems_task_start( Task_id[TASKID_AVF2], avf2_task, 1 ); |
|
600 | status = rtems_task_start( Task_id[TASKID_AVF2], avf2_task, 1 ); | |
638 | if (status!=RTEMS_SUCCESSFUL) { |
|
601 | if (status!=RTEMS_SUCCESSFUL) { | |
639 | BOOT_PRINTF("in INIT *** Error starting TASK_AVF2\n") |
|
602 | BOOT_PRINTF("in INIT *** Error starting TASK_AVF2\n") | |
640 | } |
|
603 | } | |
641 | } |
|
604 | } | |
642 | if (status == RTEMS_SUCCESSFUL) // PRC2 |
|
605 | if (status == RTEMS_SUCCESSFUL) // PRC2 | |
643 | { |
|
606 | { | |
644 | status = rtems_task_start( Task_id[TASKID_PRC2], prc2_task, 1 ); |
|
607 | status = rtems_task_start( Task_id[TASKID_PRC2], prc2_task, 1 ); | |
645 | if (status!=RTEMS_SUCCESSFUL) { |
|
608 | if (status!=RTEMS_SUCCESSFUL) { | |
646 | BOOT_PRINTF("in INIT *** Error starting TASK_PRC2\n") |
|
609 | BOOT_PRINTF("in INIT *** Error starting TASK_PRC2\n") | |
647 | } |
|
610 | } | |
648 | } |
|
611 | } | |
649 |
|
612 | |||
650 | //**************** |
|
613 | //**************** | |
651 | // WAVEFORM PICKER |
|
614 | // WAVEFORM PICKER | |
652 | if (status == RTEMS_SUCCESSFUL) // WFRM |
|
615 | if (status == RTEMS_SUCCESSFUL) // WFRM | |
653 | { |
|
616 | { | |
654 | status = rtems_task_start( Task_id[TASKID_WFRM], wfrm_task, 1 ); |
|
617 | status = rtems_task_start( Task_id[TASKID_WFRM], wfrm_task, 1 ); | |
655 | if (status!=RTEMS_SUCCESSFUL) { |
|
618 | if (status!=RTEMS_SUCCESSFUL) { | |
656 | BOOT_PRINTF("in INIT *** Error starting TASK_WFRM\n") |
|
619 | BOOT_PRINTF("in INIT *** Error starting TASK_WFRM\n") | |
657 | } |
|
620 | } | |
658 | } |
|
621 | } | |
659 | if (status == RTEMS_SUCCESSFUL) // CWF3 |
|
622 | if (status == RTEMS_SUCCESSFUL) // CWF3 | |
660 | { |
|
623 | { | |
661 | status = rtems_task_start( Task_id[TASKID_CWF3], cwf3_task, 1 ); |
|
624 | status = rtems_task_start( Task_id[TASKID_CWF3], cwf3_task, 1 ); | |
662 | if (status!=RTEMS_SUCCESSFUL) { |
|
625 | if (status!=RTEMS_SUCCESSFUL) { | |
663 | BOOT_PRINTF("in INIT *** Error starting TASK_CWF3\n") |
|
626 | BOOT_PRINTF("in INIT *** Error starting TASK_CWF3\n") | |
664 | } |
|
627 | } | |
665 | } |
|
628 | } | |
666 | if (status == RTEMS_SUCCESSFUL) // CWF2 |
|
629 | if (status == RTEMS_SUCCESSFUL) // CWF2 | |
667 | { |
|
630 | { | |
668 | status = rtems_task_start( Task_id[TASKID_CWF2], cwf2_task, 1 ); |
|
631 | status = rtems_task_start( Task_id[TASKID_CWF2], cwf2_task, 1 ); | |
669 | if (status!=RTEMS_SUCCESSFUL) { |
|
632 | if (status!=RTEMS_SUCCESSFUL) { | |
670 | BOOT_PRINTF("in INIT *** Error starting TASK_CWF2\n") |
|
633 | BOOT_PRINTF("in INIT *** Error starting TASK_CWF2\n") | |
671 | } |
|
634 | } | |
672 | } |
|
635 | } | |
673 | if (status == RTEMS_SUCCESSFUL) // CWF1 |
|
636 | if (status == RTEMS_SUCCESSFUL) // CWF1 | |
674 | { |
|
637 | { | |
675 | status = rtems_task_start( Task_id[TASKID_CWF1], cwf1_task, 1 ); |
|
638 | status = rtems_task_start( Task_id[TASKID_CWF1], cwf1_task, 1 ); | |
676 | if (status!=RTEMS_SUCCESSFUL) { |
|
639 | if (status!=RTEMS_SUCCESSFUL) { | |
677 | BOOT_PRINTF("in INIT *** Error starting TASK_CWF1\n") |
|
640 | BOOT_PRINTF("in INIT *** Error starting TASK_CWF1\n") | |
678 | } |
|
641 | } | |
679 | } |
|
642 | } | |
680 | if (status == RTEMS_SUCCESSFUL) // SWBD |
|
643 | if (status == RTEMS_SUCCESSFUL) // SWBD | |
681 | { |
|
644 | { | |
682 | status = rtems_task_start( Task_id[TASKID_SWBD], swbd_task, 1 ); |
|
645 | status = rtems_task_start( Task_id[TASKID_SWBD], swbd_task, 1 ); | |
683 | if (status!=RTEMS_SUCCESSFUL) { |
|
646 | if (status!=RTEMS_SUCCESSFUL) { | |
684 | BOOT_PRINTF("in INIT *** Error starting TASK_SWBD\n") |
|
647 | BOOT_PRINTF("in INIT *** Error starting TASK_SWBD\n") | |
685 | } |
|
648 | } | |
686 | } |
|
649 | } | |
687 |
|
650 | |||
688 | //***** |
|
651 | //***** | |
689 | // MISC |
|
652 | // MISC | |
690 | if (status == RTEMS_SUCCESSFUL) // HOUS |
|
653 | if (status == RTEMS_SUCCESSFUL) // HOUS | |
691 | { |
|
654 | { | |
692 | status = rtems_task_start( Task_id[TASKID_HOUS], hous_task, 1 ); |
|
655 | status = rtems_task_start( Task_id[TASKID_HOUS], hous_task, 1 ); | |
693 | if (status!=RTEMS_SUCCESSFUL) { |
|
656 | if (status!=RTEMS_SUCCESSFUL) { | |
694 | BOOT_PRINTF("in INIT *** Error starting TASK_HOUS\n") |
|
657 | BOOT_PRINTF("in INIT *** Error starting TASK_HOUS\n") | |
695 | } |
|
658 | } | |
696 | } |
|
659 | } | |
697 | if (status == RTEMS_SUCCESSFUL) // DUMB |
|
660 | if (status == RTEMS_SUCCESSFUL) // DUMB | |
698 | { |
|
661 | { | |
699 | status = rtems_task_start( Task_id[TASKID_DUMB], dumb_task, 1 ); |
|
662 | status = rtems_task_start( Task_id[TASKID_DUMB], dumb_task, 1 ); | |
700 | if (status!=RTEMS_SUCCESSFUL) { |
|
663 | if (status!=RTEMS_SUCCESSFUL) { | |
701 | BOOT_PRINTF("in INIT *** Error starting TASK_DUMB\n") |
|
664 | BOOT_PRINTF("in INIT *** Error starting TASK_DUMB\n") | |
702 | } |
|
665 | } | |
703 | } |
|
666 | } | |
704 | if (status == RTEMS_SUCCESSFUL) // STAT |
|
667 | if (status == RTEMS_SUCCESSFUL) // STAT | |
705 | { |
|
668 | { | |
706 | status = rtems_task_start( Task_id[TASKID_STAT], stat_task, 1 ); |
|
669 | status = rtems_task_start( Task_id[TASKID_STAT], stat_task, 1 ); | |
707 | if (status!=RTEMS_SUCCESSFUL) { |
|
670 | if (status!=RTEMS_SUCCESSFUL) { | |
708 | BOOT_PRINTF("in INIT *** Error starting TASK_STAT\n") |
|
671 | BOOT_PRINTF("in INIT *** Error starting TASK_STAT\n") | |
709 | } |
|
672 | } | |
710 | } |
|
673 | } | |
711 |
|
674 | |||
712 | return status; |
|
675 | return status; | |
713 | } |
|
676 | } | |
714 |
|
677 | |||
715 | rtems_status_code create_message_queues( void ) // create the two message queues used in the software |
|
678 | rtems_status_code create_message_queues( void ) // create the two message queues used in the software | |
716 | { |
|
679 | { | |
717 | rtems_status_code status_recv; |
|
680 | rtems_status_code status_recv; | |
718 | rtems_status_code status_send; |
|
681 | rtems_status_code status_send; | |
719 | rtems_status_code status_q_p0; |
|
682 | rtems_status_code status_q_p0; | |
720 | rtems_status_code status_q_p1; |
|
683 | rtems_status_code status_q_p1; | |
721 | rtems_status_code status_q_p2; |
|
684 | rtems_status_code status_q_p2; | |
722 | rtems_status_code ret; |
|
685 | rtems_status_code ret; | |
723 | rtems_id queue_id; |
|
686 | rtems_id queue_id; | |
724 |
|
687 | |||
725 | //**************************************** |
|
688 | //**************************************** | |
726 | // create the queue for handling valid TCs |
|
689 | // create the queue for handling valid TCs | |
727 | status_recv = rtems_message_queue_create( misc_name[QUEUE_RECV], |
|
690 | status_recv = rtems_message_queue_create( misc_name[QUEUE_RECV], | |
728 | MSG_QUEUE_COUNT_RECV, CCSDS_TC_PKT_MAX_SIZE, |
|
691 | MSG_QUEUE_COUNT_RECV, CCSDS_TC_PKT_MAX_SIZE, | |
729 | RTEMS_FIFO | RTEMS_LOCAL, &queue_id ); |
|
692 | RTEMS_FIFO | RTEMS_LOCAL, &queue_id ); | |
730 | if ( status_recv != RTEMS_SUCCESSFUL ) { |
|
693 | if ( status_recv != RTEMS_SUCCESSFUL ) { | |
731 | PRINTF1("in create_message_queues *** ERR creating QUEU queue, %d\n", status_recv) |
|
694 | PRINTF1("in create_message_queues *** ERR creating QUEU queue, %d\n", status_recv) | |
732 | } |
|
695 | } | |
733 |
|
696 | |||
734 | //************************************************ |
|
697 | //************************************************ | |
735 | // create the queue for handling TM packet sending |
|
698 | // create the queue for handling TM packet sending | |
736 | status_send = rtems_message_queue_create( misc_name[QUEUE_SEND], |
|
699 | status_send = rtems_message_queue_create( misc_name[QUEUE_SEND], | |
737 | MSG_QUEUE_COUNT_SEND, MSG_QUEUE_SIZE_SEND, |
|
700 | MSG_QUEUE_COUNT_SEND, MSG_QUEUE_SIZE_SEND, | |
738 | RTEMS_FIFO | RTEMS_LOCAL, &queue_id ); |
|
701 | RTEMS_FIFO | RTEMS_LOCAL, &queue_id ); | |
739 | if ( status_send != RTEMS_SUCCESSFUL ) { |
|
702 | if ( status_send != RTEMS_SUCCESSFUL ) { | |
740 | PRINTF1("in create_message_queues *** ERR creating PKTS queue, %d\n", status_send) |
|
703 | PRINTF1("in create_message_queues *** ERR creating PKTS queue, %d\n", status_send) | |
741 | } |
|
704 | } | |
742 |
|
705 | |||
743 | //***************************************************************************** |
|
706 | //***************************************************************************** | |
744 | // create the queue for handling averaged spectral matrices for processing @ f0 |
|
707 | // create the queue for handling averaged spectral matrices for processing @ f0 | |
745 | status_q_p0 = rtems_message_queue_create( misc_name[QUEUE_PRC0], |
|
708 | status_q_p0 = rtems_message_queue_create( misc_name[QUEUE_PRC0], | |
746 | MSG_QUEUE_COUNT_PRC0, MSG_QUEUE_SIZE_PRC0, |
|
709 | MSG_QUEUE_COUNT_PRC0, MSG_QUEUE_SIZE_PRC0, | |
747 | RTEMS_FIFO | RTEMS_LOCAL, &queue_id ); |
|
710 | RTEMS_FIFO | RTEMS_LOCAL, &queue_id ); | |
748 | if ( status_q_p0 != RTEMS_SUCCESSFUL ) { |
|
711 | if ( status_q_p0 != RTEMS_SUCCESSFUL ) { | |
749 | PRINTF1("in create_message_queues *** ERR creating Q_P0 queue, %d\n", status_q_p0) |
|
712 | PRINTF1("in create_message_queues *** ERR creating Q_P0 queue, %d\n", status_q_p0) | |
750 | } |
|
713 | } | |
751 |
|
714 | |||
752 | //***************************************************************************** |
|
715 | //***************************************************************************** | |
753 | // create the queue for handling averaged spectral matrices for processing @ f1 |
|
716 | // create the queue for handling averaged spectral matrices for processing @ f1 | |
754 | status_q_p1 = rtems_message_queue_create( misc_name[QUEUE_PRC1], |
|
717 | status_q_p1 = rtems_message_queue_create( misc_name[QUEUE_PRC1], | |
755 | MSG_QUEUE_COUNT_PRC1, MSG_QUEUE_SIZE_PRC1, |
|
718 | MSG_QUEUE_COUNT_PRC1, MSG_QUEUE_SIZE_PRC1, | |
756 | RTEMS_FIFO | RTEMS_LOCAL, &queue_id ); |
|
719 | RTEMS_FIFO | RTEMS_LOCAL, &queue_id ); | |
757 | if ( status_q_p1 != RTEMS_SUCCESSFUL ) { |
|
720 | if ( status_q_p1 != RTEMS_SUCCESSFUL ) { | |
758 | PRINTF1("in create_message_queues *** ERR creating Q_P1 queue, %d\n", status_q_p1) |
|
721 | PRINTF1("in create_message_queues *** ERR creating Q_P1 queue, %d\n", status_q_p1) | |
759 | } |
|
722 | } | |
760 |
|
723 | |||
761 | //***************************************************************************** |
|
724 | //***************************************************************************** | |
762 | // create the queue for handling averaged spectral matrices for processing @ f2 |
|
725 | // create the queue for handling averaged spectral matrices for processing @ f2 | |
763 | status_q_p2 = rtems_message_queue_create( misc_name[QUEUE_PRC2], |
|
726 | status_q_p2 = rtems_message_queue_create( misc_name[QUEUE_PRC2], | |
764 | MSG_QUEUE_COUNT_PRC2, MSG_QUEUE_SIZE_PRC2, |
|
727 | MSG_QUEUE_COUNT_PRC2, MSG_QUEUE_SIZE_PRC2, | |
765 | RTEMS_FIFO | RTEMS_LOCAL, &queue_id ); |
|
728 | RTEMS_FIFO | RTEMS_LOCAL, &queue_id ); | |
766 | if ( status_q_p2 != RTEMS_SUCCESSFUL ) { |
|
729 | if ( status_q_p2 != RTEMS_SUCCESSFUL ) { | |
767 | PRINTF1("in create_message_queues *** ERR creating Q_P2 queue, %d\n", status_q_p2) |
|
730 | PRINTF1("in create_message_queues *** ERR creating Q_P2 queue, %d\n", status_q_p2) | |
768 | } |
|
731 | } | |
769 |
|
732 | |||
770 | if ( status_recv != RTEMS_SUCCESSFUL ) |
|
733 | if ( status_recv != RTEMS_SUCCESSFUL ) | |
771 | { |
|
734 | { | |
772 | ret = status_recv; |
|
735 | ret = status_recv; | |
773 | } |
|
736 | } | |
774 | else if( status_send != RTEMS_SUCCESSFUL ) |
|
737 | else if( status_send != RTEMS_SUCCESSFUL ) | |
775 | { |
|
738 | { | |
776 | ret = status_send; |
|
739 | ret = status_send; | |
777 | } |
|
740 | } | |
778 | else if( status_q_p0 != RTEMS_SUCCESSFUL ) |
|
741 | else if( status_q_p0 != RTEMS_SUCCESSFUL ) | |
779 | { |
|
742 | { | |
780 | ret = status_q_p0; |
|
743 | ret = status_q_p0; | |
781 | } |
|
744 | } | |
782 | else if( status_q_p1 != RTEMS_SUCCESSFUL ) |
|
745 | else if( status_q_p1 != RTEMS_SUCCESSFUL ) | |
783 | { |
|
746 | { | |
784 | ret = status_q_p1; |
|
747 | ret = status_q_p1; | |
785 | } |
|
748 | } | |
786 | else |
|
749 | else | |
787 | { |
|
750 | { | |
788 | ret = status_q_p2; |
|
751 | ret = status_q_p2; | |
789 | } |
|
752 | } | |
790 |
|
753 | |||
791 | return ret; |
|
754 | return ret; | |
792 | } |
|
755 | } | |
793 |
|
756 | |||
794 | rtems_status_code get_message_queue_id_send( rtems_id *queue_id ) |
|
757 | rtems_status_code get_message_queue_id_send( rtems_id *queue_id ) | |
795 | { |
|
758 | { | |
796 | rtems_status_code status; |
|
759 | rtems_status_code status; | |
797 | rtems_name queue_name; |
|
760 | rtems_name queue_name; | |
798 |
|
761 | |||
799 | queue_name = rtems_build_name( 'Q', '_', 'S', 'D' ); |
|
762 | queue_name = rtems_build_name( 'Q', '_', 'S', 'D' ); | |
800 |
|
763 | |||
801 | status = rtems_message_queue_ident( queue_name, 0, queue_id ); |
|
764 | status = rtems_message_queue_ident( queue_name, 0, queue_id ); | |
802 |
|
765 | |||
803 | return status; |
|
766 | return status; | |
804 | } |
|
767 | } | |
805 |
|
768 | |||
806 | rtems_status_code get_message_queue_id_recv( rtems_id *queue_id ) |
|
769 | rtems_status_code get_message_queue_id_recv( rtems_id *queue_id ) | |
807 | { |
|
770 | { | |
808 | rtems_status_code status; |
|
771 | rtems_status_code status; | |
809 | rtems_name queue_name; |
|
772 | rtems_name queue_name; | |
810 |
|
773 | |||
811 | queue_name = rtems_build_name( 'Q', '_', 'R', 'V' ); |
|
774 | queue_name = rtems_build_name( 'Q', '_', 'R', 'V' ); | |
812 |
|
775 | |||
813 | status = rtems_message_queue_ident( queue_name, 0, queue_id ); |
|
776 | status = rtems_message_queue_ident( queue_name, 0, queue_id ); | |
814 |
|
777 | |||
815 | return status; |
|
778 | return status; | |
816 | } |
|
779 | } | |
817 |
|
780 | |||
818 | rtems_status_code get_message_queue_id_prc0( rtems_id *queue_id ) |
|
781 | rtems_status_code get_message_queue_id_prc0( rtems_id *queue_id ) | |
819 | { |
|
782 | { | |
820 | rtems_status_code status; |
|
783 | rtems_status_code status; | |
821 | rtems_name queue_name; |
|
784 | rtems_name queue_name; | |
822 |
|
785 | |||
823 | queue_name = rtems_build_name( 'Q', '_', 'P', '0' ); |
|
786 | queue_name = rtems_build_name( 'Q', '_', 'P', '0' ); | |
824 |
|
787 | |||
825 | status = rtems_message_queue_ident( queue_name, 0, queue_id ); |
|
788 | status = rtems_message_queue_ident( queue_name, 0, queue_id ); | |
826 |
|
789 | |||
827 | return status; |
|
790 | return status; | |
828 | } |
|
791 | } | |
829 |
|
792 | |||
830 | rtems_status_code get_message_queue_id_prc1( rtems_id *queue_id ) |
|
793 | rtems_status_code get_message_queue_id_prc1( rtems_id *queue_id ) | |
831 | { |
|
794 | { | |
832 | rtems_status_code status; |
|
795 | rtems_status_code status; | |
833 | rtems_name queue_name; |
|
796 | rtems_name queue_name; | |
834 |
|
797 | |||
835 | queue_name = rtems_build_name( 'Q', '_', 'P', '1' ); |
|
798 | queue_name = rtems_build_name( 'Q', '_', 'P', '1' ); | |
836 |
|
799 | |||
837 | status = rtems_message_queue_ident( queue_name, 0, queue_id ); |
|
800 | status = rtems_message_queue_ident( queue_name, 0, queue_id ); | |
838 |
|
801 | |||
839 | return status; |
|
802 | return status; | |
840 | } |
|
803 | } | |
841 |
|
804 | |||
842 | rtems_status_code get_message_queue_id_prc2( rtems_id *queue_id ) |
|
805 | rtems_status_code get_message_queue_id_prc2( rtems_id *queue_id ) | |
843 | { |
|
806 | { | |
844 | rtems_status_code status; |
|
807 | rtems_status_code status; | |
845 | rtems_name queue_name; |
|
808 | rtems_name queue_name; | |
846 |
|
809 | |||
847 | queue_name = rtems_build_name( 'Q', '_', 'P', '2' ); |
|
810 | queue_name = rtems_build_name( 'Q', '_', 'P', '2' ); | |
848 |
|
811 | |||
849 | status = rtems_message_queue_ident( queue_name, 0, queue_id ); |
|
812 | status = rtems_message_queue_ident( queue_name, 0, queue_id ); | |
850 |
|
813 | |||
851 | return status; |
|
814 | return status; | |
852 | } |
|
815 | } | |
853 |
|
816 | |||
854 | void update_queue_max_count( rtems_id queue_id, unsigned char*fifo_size_max ) |
|
817 | void update_queue_max_count( rtems_id queue_id, unsigned char*fifo_size_max ) | |
855 | { |
|
818 | { | |
856 | u_int32_t count; |
|
819 | u_int32_t count; | |
857 | rtems_status_code status; |
|
820 | rtems_status_code status; | |
858 |
|
821 | |||
859 | status = rtems_message_queue_get_number_pending( queue_id, &count ); |
|
822 | status = rtems_message_queue_get_number_pending( queue_id, &count ); | |
860 |
|
823 | |||
861 | count = count + 1; |
|
824 | count = count + 1; | |
862 |
|
825 | |||
863 | if (status != RTEMS_SUCCESSFUL) |
|
826 | if (status != RTEMS_SUCCESSFUL) | |
864 | { |
|
827 | { | |
865 | PRINTF1("in update_queue_max_count *** ERR = %d\n", status) |
|
828 | PRINTF1("in update_queue_max_count *** ERR = %d\n", status) | |
866 | } |
|
829 | } | |
867 | else |
|
830 | else | |
868 | { |
|
831 | { | |
869 | if (count > *fifo_size_max) |
|
832 | if (count > *fifo_size_max) | |
870 | { |
|
833 | { | |
871 | *fifo_size_max = count; |
|
834 | *fifo_size_max = count; | |
872 | } |
|
835 | } | |
873 | } |
|
836 | } | |
874 | } |
|
837 | } | |
875 |
|
838 | |||
876 | void init_ring(ring_node ring[], unsigned char nbNodes, volatile int buffer[], unsigned int bufferSize ) |
|
839 | void init_ring(ring_node ring[], unsigned char nbNodes, volatile int buffer[], unsigned int bufferSize ) | |
877 | { |
|
840 | { | |
878 | unsigned char i; |
|
841 | unsigned char i; | |
879 |
|
842 | |||
880 | //*************** |
|
843 | //*************** | |
881 | // BUFFER ADDRESS |
|
844 | // BUFFER ADDRESS | |
882 | for(i=0; i<nbNodes; i++) |
|
845 | for(i=0; i<nbNodes; i++) | |
883 | { |
|
846 | { | |
884 | ring[i].coarseTime = 0xffffffff; |
|
847 | ring[i].coarseTime = 0xffffffff; | |
885 | ring[i].fineTime = 0xffffffff; |
|
848 | ring[i].fineTime = 0xffffffff; | |
886 | ring[i].sid = 0x00; |
|
849 | ring[i].sid = 0x00; | |
887 | ring[i].status = 0x00; |
|
850 | ring[i].status = 0x00; | |
888 | ring[i].buffer_address = (int) &buffer[ i * bufferSize ]; |
|
851 | ring[i].buffer_address = (int) &buffer[ i * bufferSize ]; | |
889 | } |
|
852 | } | |
890 |
|
853 | |||
891 | //***** |
|
854 | //***** | |
892 | // NEXT |
|
855 | // NEXT | |
893 | ring[ nbNodes - 1 ].next = (ring_node*) &ring[ 0 ]; |
|
856 | ring[ nbNodes - 1 ].next = (ring_node*) &ring[ 0 ]; | |
894 | for(i=0; i<nbNodes-1; i++) |
|
857 | for(i=0; i<nbNodes-1; i++) | |
895 | { |
|
858 | { | |
896 | ring[i].next = (ring_node*) &ring[ i + 1 ]; |
|
859 | ring[i].next = (ring_node*) &ring[ i + 1 ]; | |
897 | } |
|
860 | } | |
898 |
|
861 | |||
899 | //********* |
|
862 | //********* | |
900 | // PREVIOUS |
|
863 | // PREVIOUS | |
901 | ring[ 0 ].previous = (ring_node*) &ring[ nbNodes - 1 ]; |
|
864 | ring[ 0 ].previous = (ring_node*) &ring[ nbNodes - 1 ]; | |
902 | for(i=1; i<nbNodes; i++) |
|
865 | for(i=1; i<nbNodes; i++) | |
903 | { |
|
866 | { | |
904 | ring[i].previous = (ring_node*) &ring[ i - 1 ]; |
|
867 | ring[i].previous = (ring_node*) &ring[ i - 1 ]; | |
905 | } |
|
868 | } | |
906 | } |
|
869 | } |
General Comments 0
You need to be logged in to leave comments.
Login now