@@ -1,2 +1,2 | |||
|
1 | 1 | 3081d1f9bb20b2b64a192585337a292a9804e0c5 LFR_basic-parameters |
|
2 | 2450d4935652a4d0370245cc7fc60a4c51e6fc9b header/lfr_common_headers | |
|
2 | c378fa14eadd80b3b873ca7c8f9f387893c07692 header/lfr_common_headers |
@@ -1,123 +1,123 | |||
|
1 | 1 | TEMPLATE = app |
|
2 | 2 | # CONFIG += console v8 sim |
|
3 | 3 | # CONFIG options = |
|
4 | 4 | # verbose |
|
5 | 5 | # boot_messages |
|
6 | 6 | # debug_messages |
|
7 | 7 | # cpu_usage_report |
|
8 | 8 | # stack_report |
|
9 | 9 | # vhdl_dev |
|
10 | 10 | # debug_tch |
|
11 | 11 | # lpp_dpu_destid /!\ REMOVE BEFORE DELIVERY TO LESIA /!\ |
|
12 | 12 | # debug_watchdog |
|
13 | 13 | CONFIG += console verbose lpp_dpu_destid cpu_usage_report |
|
14 | 14 | CONFIG -= qt |
|
15 | 15 | |
|
16 | 16 | include(./sparc.pri) |
|
17 | 17 | |
|
18 | 18 | # flight software version |
|
19 | 19 | SWVERSION=-1-0 |
|
20 | 20 | DEFINES += SW_VERSION_N1=3 # major |
|
21 | 21 | DEFINES += SW_VERSION_N2=1 # minor |
|
22 | 22 | DEFINES += SW_VERSION_N3=0 # patch |
|
23 |
DEFINES += SW_VERSION_N4= |
|
|
23 | DEFINES += SW_VERSION_N4=2 # internal | |
|
24 | 24 | |
|
25 | 25 | # <GCOV> |
|
26 | 26 | #QMAKE_CFLAGS_RELEASE += -fprofile-arcs -ftest-coverage |
|
27 | 27 | #LIBS += -lgcov /opt/GCOV/01A/lib/overload.o -lc |
|
28 | 28 | # </GCOV> |
|
29 | 29 | |
|
30 | 30 | # <CHANGE BEFORE FLIGHT> |
|
31 | 31 | contains( CONFIG, lpp_dpu_destid ) { |
|
32 | 32 | DEFINES += LPP_DPU_DESTID |
|
33 | 33 | } |
|
34 | 34 | # </CHANGE BEFORE FLIGHT> |
|
35 | 35 | |
|
36 | 36 | contains( CONFIG, debug_tch ) { |
|
37 | 37 | DEFINES += DEBUG_TCH |
|
38 | 38 | } |
|
39 | 39 | DEFINES += MSB_FIRST_TCH |
|
40 | 40 | |
|
41 | 41 | contains( CONFIG, vhdl_dev ) { |
|
42 | 42 | DEFINES += VHDL_DEV |
|
43 | 43 | } |
|
44 | 44 | |
|
45 | 45 | contains( CONFIG, verbose ) { |
|
46 | 46 | DEFINES += PRINT_MESSAGES_ON_CONSOLE |
|
47 | 47 | } |
|
48 | 48 | |
|
49 | 49 | contains( CONFIG, debug_messages ) { |
|
50 | 50 | DEFINES += DEBUG_MESSAGES |
|
51 | 51 | } |
|
52 | 52 | |
|
53 | 53 | contains( CONFIG, cpu_usage_report ) { |
|
54 | 54 | DEFINES += PRINT_TASK_STATISTICS |
|
55 | 55 | } |
|
56 | 56 | |
|
57 | 57 | contains( CONFIG, stack_report ) { |
|
58 | 58 | DEFINES += PRINT_STACK_REPORT |
|
59 | 59 | } |
|
60 | 60 | |
|
61 | 61 | contains( CONFIG, boot_messages ) { |
|
62 | 62 | DEFINES += BOOT_MESSAGES |
|
63 | 63 | } |
|
64 | 64 | |
|
65 | 65 | contains( CONFIG, debug_watchdog ) { |
|
66 | 66 | DEFINES += DEBUG_WATCHDOG |
|
67 | 67 | } |
|
68 | 68 | |
|
69 | 69 | #doxygen.target = doxygen |
|
70 | 70 | #doxygen.commands = doxygen ../doc/Doxyfile |
|
71 | 71 | #QMAKE_EXTRA_TARGETS += doxygen |
|
72 | 72 | |
|
73 | 73 | TARGET = fsw |
|
74 | 74 | |
|
75 | 75 | INCLUDEPATH += \ |
|
76 | 76 | $${PWD}/../src \ |
|
77 | 77 | $${PWD}/../header \ |
|
78 | 78 | $${PWD}/../header/lfr_common_headers \ |
|
79 | 79 | $${PWD}/../header/processing \ |
|
80 | 80 | $${PWD}/../LFR_basic-parameters |
|
81 | 81 | |
|
82 | 82 | SOURCES += \ |
|
83 | 83 | ../src/wf_handler.c \ |
|
84 | 84 | ../src/tc_handler.c \ |
|
85 | 85 | ../src/fsw_misc.c \ |
|
86 | 86 | ../src/fsw_init.c \ |
|
87 | 87 | ../src/fsw_globals.c \ |
|
88 | 88 | ../src/fsw_spacewire.c \ |
|
89 | 89 | ../src/tc_load_dump_parameters.c \ |
|
90 | 90 | ../src/tm_lfr_tc_exe.c \ |
|
91 | 91 | ../src/tc_acceptance.c \ |
|
92 | 92 | ../src/processing/fsw_processing.c \ |
|
93 | 93 | ../src/processing/avf0_prc0.c \ |
|
94 | 94 | ../src/processing/avf1_prc1.c \ |
|
95 | 95 | ../src/processing/avf2_prc2.c \ |
|
96 | 96 | ../src/lfr_cpu_usage_report.c \ |
|
97 | 97 | ../LFR_basic-parameters/basic_parameters.c |
|
98 | 98 | |
|
99 | 99 | HEADERS += \ |
|
100 | 100 | ../header/wf_handler.h \ |
|
101 | 101 | ../header/tc_handler.h \ |
|
102 | 102 | ../header/grlib_regs.h \ |
|
103 | 103 | ../header/fsw_misc.h \ |
|
104 | 104 | ../header/fsw_init.h \ |
|
105 | 105 | ../header/fsw_spacewire.h \ |
|
106 | 106 | ../header/tc_load_dump_parameters.h \ |
|
107 | 107 | ../header/tm_lfr_tc_exe.h \ |
|
108 | 108 | ../header/tc_acceptance.h \ |
|
109 | 109 | ../header/processing/fsw_processing.h \ |
|
110 | 110 | ../header/processing/avf0_prc0.h \ |
|
111 | 111 | ../header/processing/avf1_prc1.h \ |
|
112 | 112 | ../header/processing/avf2_prc2.h \ |
|
113 | 113 | ../header/fsw_params_wf_handler.h \ |
|
114 | 114 | ../header/lfr_cpu_usage_report.h \ |
|
115 | 115 | ../header/lfr_common_headers/ccsds_types.h \ |
|
116 | 116 | ../header/lfr_common_headers/fsw_params.h \ |
|
117 | 117 | ../header/lfr_common_headers/fsw_params_nb_bytes.h \ |
|
118 | 118 | ../header/lfr_common_headers/fsw_params_processing.h \ |
|
119 | 119 | ../header/lfr_common_headers/tm_byte_positions.h \ |
|
120 | 120 | ../LFR_basic-parameters/basic_parameters.h \ |
|
121 | 121 | ../LFR_basic-parameters/basic_parameters_params.h \ |
|
122 | 122 | ../header/GscMemoryLPP.hpp |
|
123 | 123 |
@@ -1,64 +1,64 | |||
|
1 | 1 | #ifndef FSW_INIT_H_INCLUDED |
|
2 | 2 | #define FSW_INIT_H_INCLUDED |
|
3 | 3 | |
|
4 | 4 | #include <rtems.h> |
|
5 | 5 | #include <leon.h> |
|
6 | 6 | |
|
7 | 7 | #include "fsw_params.h" |
|
8 | 8 | #include "fsw_misc.h" |
|
9 | 9 | #include "fsw_processing.h" |
|
10 | 10 | |
|
11 | 11 | #include "tc_handler.h" |
|
12 | 12 | #include "wf_handler.h" |
|
13 | 13 | #include "fsw_spacewire.h" |
|
14 | 14 | |
|
15 | 15 | #include "avf0_prc0.h" |
|
16 | 16 | #include "avf1_prc1.h" |
|
17 | 17 | #include "avf2_prc2.h" |
|
18 | 18 | |
|
19 | 19 | extern rtems_name Task_name[20]; /* array of task names */ |
|
20 | 20 | extern rtems_id Task_id[20]; /* array of task ids */ |
|
21 | 21 | extern rtems_name timecode_timer_name; |
|
22 | 22 | extern rtems_id timecode_timer_id; |
|
23 | 23 | extern unsigned char pa_bia_status_info; |
|
24 | 24 | extern unsigned char cp_rpw_sc_rw_f_flags; |
|
25 | 25 | extern float cp_rpw_sc_rw1_f1; |
|
26 | 26 | extern float cp_rpw_sc_rw1_f2; |
|
27 | 27 | extern float cp_rpw_sc_rw2_f1; |
|
28 | 28 | extern float cp_rpw_sc_rw2_f2; |
|
29 | 29 | extern float cp_rpw_sc_rw3_f1; |
|
30 | 30 | extern float cp_rpw_sc_rw3_f2; |
|
31 | 31 | extern float cp_rpw_sc_rw4_f1; |
|
32 | 32 | extern float cp_rpw_sc_rw4_f2; |
|
33 | extern float sy_lfr_sc_rw_delta_f; | |
|
33 | extern filterPar_t filterPar; | |
|
34 | 34 | |
|
35 | 35 | // RTEMS TASKS |
|
36 | 36 | rtems_task Init( rtems_task_argument argument); |
|
37 | 37 | |
|
38 | 38 | // OTHER functions |
|
39 | 39 | void create_names( void ); |
|
40 | 40 | int create_all_tasks( void ); |
|
41 | 41 | int start_all_tasks( void ); |
|
42 | 42 | // |
|
43 | 43 | rtems_status_code create_message_queues( void ); |
|
44 | 44 | rtems_status_code create_timecode_timer( void ); |
|
45 | 45 | rtems_status_code get_message_queue_id_send( rtems_id *queue_id ); |
|
46 | 46 | rtems_status_code get_message_queue_id_recv( rtems_id *queue_id ); |
|
47 | 47 | rtems_status_code get_message_queue_id_prc0( rtems_id *queue_id ); |
|
48 | 48 | rtems_status_code get_message_queue_id_prc1( rtems_id *queue_id ); |
|
49 | 49 | rtems_status_code get_message_queue_id_prc2( rtems_id *queue_id ); |
|
50 | 50 | void update_queue_max_count( rtems_id queue_id, unsigned char*fifo_size_max ); |
|
51 | 51 | void init_ring(ring_node ring[], unsigned char nbNodes, volatile int buffer[], unsigned int bufferSize ); |
|
52 | 52 | // |
|
53 | 53 | int start_recv_send_tasks( void ); |
|
54 | 54 | // |
|
55 | 55 | void init_local_mode_parameters( void ); |
|
56 | 56 | void reset_local_time( void ); |
|
57 | 57 | |
|
58 | 58 | extern void rtems_cpu_usage_report( void ); |
|
59 | 59 | extern void rtems_cpu_usage_reset( void ); |
|
60 | 60 | extern void rtems_stack_checker_report_usage( void ); |
|
61 | 61 | |
|
62 | 62 | extern int sched_yield( void ); |
|
63 | 63 | |
|
64 | 64 | #endif // FSW_INIT_H_INCLUDED |
@@ -1,96 +1,98 | |||
|
1 | 1 | /** Global variables of the LFR flight software. |
|
2 | 2 | * |
|
3 | 3 | * @file |
|
4 | 4 | * @author P. LEROY |
|
5 | 5 | * |
|
6 | 6 | * Among global variables, there are: |
|
7 | 7 | * - RTEMS names and id. |
|
8 | 8 | * - APB configuration registers. |
|
9 | 9 | * - waveforms global buffers, used by the waveform picker hardware module to store data. |
|
10 | 10 | * - spectral matrices buffesr, used by the hardware module to store data. |
|
11 | 11 | * - variable related to LFR modes parameters. |
|
12 | 12 | * - the global HK packet buffer. |
|
13 | 13 | * - the global dump parameter buffer. |
|
14 | 14 | * |
|
15 | 15 | */ |
|
16 | 16 | |
|
17 | 17 | #include <rtems.h> |
|
18 | 18 | #include <grspw.h> |
|
19 | 19 | |
|
20 | 20 | #include "ccsds_types.h" |
|
21 | 21 | #include "grlib_regs.h" |
|
22 | 22 | #include "fsw_params.h" |
|
23 | 23 | #include "fsw_params_wf_handler.h" |
|
24 | 24 | |
|
25 | 25 | // RTEMS GLOBAL VARIABLES |
|
26 | 26 | rtems_name misc_name[5]; |
|
27 | 27 | rtems_name Task_name[20]; /* array of task names */ |
|
28 | 28 | rtems_id Task_id[20]; /* array of task ids */ |
|
29 | 29 | rtems_name timecode_timer_name; |
|
30 | 30 | rtems_id timecode_timer_id; |
|
31 | 31 | int fdSPW = 0; |
|
32 | 32 | int fdUART = 0; |
|
33 | 33 | unsigned char lfrCurrentMode; |
|
34 | 34 | unsigned char pa_bia_status_info; |
|
35 | 35 | unsigned char thisIsAnASMRestart = 0; |
|
36 | 36 | unsigned char oneTcLfrUpdateTimeReceived = 0; |
|
37 | 37 | |
|
38 | 38 | // WAVEFORMS GLOBAL VARIABLES // 2048 * 3 * 4 + 2 * 4 = 24576 + 8 bytes = 24584 |
|
39 | 39 | // 97 * 256 = 24832 => delta = 248 bytes = 62 words |
|
40 | 40 | // WAVEFORMS GLOBAL VARIABLES // 2688 * 3 * 4 + 2 * 4 = 32256 + 8 bytes = 32264 |
|
41 | 41 | // 127 * 256 = 32512 => delta = 248 bytes = 62 words |
|
42 | 42 | // F0 F1 F2 F3 |
|
43 | 43 | volatile int wf_buffer_f0[ NB_RING_NODES_F0 * WFRM_BUFFER ] __attribute__((aligned(0x100))); |
|
44 | 44 | volatile int wf_buffer_f1[ NB_RING_NODES_F1 * WFRM_BUFFER ] __attribute__((aligned(0x100))); |
|
45 | 45 | volatile int wf_buffer_f2[ NB_RING_NODES_F2 * WFRM_BUFFER ] __attribute__((aligned(0x100))); |
|
46 | 46 | volatile int wf_buffer_f3[ NB_RING_NODES_F3 * WFRM_BUFFER ] __attribute__((aligned(0x100))); |
|
47 | 47 | |
|
48 | 48 | //*********************************** |
|
49 | 49 | // SPECTRAL MATRICES GLOBAL VARIABLES |
|
50 | 50 | |
|
51 | 51 | // alignment constraints for the spectral matrices buffers => the first data after the time (8 bytes) shall be aligned on 0x00 |
|
52 | 52 | volatile int sm_f0[ NB_RING_NODES_SM_F0 * TOTAL_SIZE_SM ] __attribute__((aligned(0x100))); |
|
53 | 53 | volatile int sm_f1[ NB_RING_NODES_SM_F1 * TOTAL_SIZE_SM ] __attribute__((aligned(0x100))); |
|
54 | 54 | volatile int sm_f2[ NB_RING_NODES_SM_F2 * TOTAL_SIZE_SM ] __attribute__((aligned(0x100))); |
|
55 | 55 | |
|
56 | 56 | // APB CONFIGURATION REGISTERS |
|
57 | 57 | time_management_regs_t *time_management_regs = (time_management_regs_t*) REGS_ADDR_TIME_MANAGEMENT; |
|
58 | 58 | gptimer_regs_t *gptimer_regs = (gptimer_regs_t *) REGS_ADDR_GPTIMER; |
|
59 | 59 | waveform_picker_regs_0_1_18_t *waveform_picker_regs = (waveform_picker_regs_0_1_18_t*) REGS_ADDR_WAVEFORM_PICKER; |
|
60 | 60 | spectral_matrix_regs_t *spectral_matrix_regs = (spectral_matrix_regs_t*) REGS_ADDR_SPECTRAL_MATRIX; |
|
61 | 61 | |
|
62 | 62 | // MODE PARAMETERS |
|
63 | 63 | Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet; |
|
64 | 64 | struct param_local_str param_local; |
|
65 | 65 | unsigned int lastValidEnterModeTime; |
|
66 | 66 | |
|
67 | 67 | // HK PACKETS |
|
68 | 68 | Packet_TM_LFR_HK_t housekeeping_packet; |
|
69 | 69 | unsigned char cp_rpw_sc_rw_f_flags; |
|
70 | 70 | // message queues occupancy |
|
71 | 71 | unsigned char hk_lfr_q_sd_fifo_size_max; |
|
72 | 72 | unsigned char hk_lfr_q_rv_fifo_size_max; |
|
73 | 73 | unsigned char hk_lfr_q_p0_fifo_size_max; |
|
74 | 74 | unsigned char hk_lfr_q_p1_fifo_size_max; |
|
75 | 75 | unsigned char hk_lfr_q_p2_fifo_size_max; |
|
76 | 76 | // sequence counters are incremented by APID (PID + CAT) and destination ID |
|
77 | 77 | unsigned short sequenceCounters_SCIENCE_NORMAL_BURST; |
|
78 | 78 | unsigned short sequenceCounters_SCIENCE_SBM1_SBM2; |
|
79 | 79 | unsigned short sequenceCounters_TC_EXE[SEQ_CNT_NB_DEST_ID]; |
|
80 | 80 | unsigned short sequenceCounters_TM_DUMP[SEQ_CNT_NB_DEST_ID]; |
|
81 | 81 | unsigned short sequenceCounterHK; |
|
82 | 82 | spw_stats grspw_stats; |
|
83 | 83 | |
|
84 | 84 | // TC_LFR_UPDATE_INFO |
|
85 | 85 | float cp_rpw_sc_rw1_f1; |
|
86 | 86 | float cp_rpw_sc_rw1_f2; |
|
87 | 87 | float cp_rpw_sc_rw2_f1; |
|
88 | 88 | float cp_rpw_sc_rw2_f2; |
|
89 | 89 | float cp_rpw_sc_rw3_f1; |
|
90 | 90 | float cp_rpw_sc_rw3_f2; |
|
91 | 91 | float cp_rpw_sc_rw4_f1; |
|
92 | 92 | float cp_rpw_sc_rw4_f2; |
|
93 | float sy_lfr_sc_rw_delta_f; | |
|
93 | ||
|
94 | // TC_LFR_LOAD_FILTER_PAR | |
|
95 | filterPar_t filterPar; | |
|
94 | 96 | |
|
95 | 97 | fbins_masks_t fbins_masks; |
|
96 | 98 | unsigned int acquisitionDurations[3] = {ACQUISITION_DURATION_F0, ACQUISITION_DURATION_F1, ACQUISITION_DURATION_F2}; |
@@ -1,928 +1,934 | |||
|
1 | 1 | /** This is the RTEMS initialization module. |
|
2 | 2 | * |
|
3 | 3 | * @file |
|
4 | 4 | * @author P. LEROY |
|
5 | 5 | * |
|
6 | 6 | * This module contains two very different information: |
|
7 | 7 | * - specific instructions to configure the compilation of the RTEMS executive |
|
8 | 8 | * - functions related to the fligth softwre initialization, especially the INIT RTEMS task |
|
9 | 9 | * |
|
10 | 10 | */ |
|
11 | 11 | |
|
12 | 12 | //************************* |
|
13 | 13 | // GPL reminder to be added |
|
14 | 14 | //************************* |
|
15 | 15 | |
|
16 | 16 | #include <rtems.h> |
|
17 | 17 | |
|
18 | 18 | /* configuration information */ |
|
19 | 19 | |
|
20 | 20 | #define CONFIGURE_INIT |
|
21 | 21 | |
|
22 | 22 | #include <bsp.h> /* for device driver prototypes */ |
|
23 | 23 | |
|
24 | 24 | /* configuration information */ |
|
25 | 25 | |
|
26 | 26 | #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER |
|
27 | 27 | #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER |
|
28 | 28 | |
|
29 | 29 | #define CONFIGURE_MAXIMUM_TASKS 20 |
|
30 | 30 | #define CONFIGURE_RTEMS_INIT_TASKS_TABLE |
|
31 | 31 | #define CONFIGURE_EXTRA_TASK_STACKS (3 * RTEMS_MINIMUM_STACK_SIZE) |
|
32 | 32 | #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 32 |
|
33 | 33 | #define CONFIGURE_INIT_TASK_PRIORITY 1 // instead of 100 |
|
34 | 34 | #define CONFIGURE_INIT_TASK_MODE (RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT) |
|
35 | 35 | #define CONFIGURE_INIT_TASK_ATTRIBUTES (RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT) |
|
36 | 36 | #define CONFIGURE_MAXIMUM_DRIVERS 16 |
|
37 | 37 | #define CONFIGURE_MAXIMUM_PERIODS 5 |
|
38 | 38 | #define CONFIGURE_MAXIMUM_TIMERS 5 // [spiq] [link] [spacewire_reset_link] |
|
39 | 39 | #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 5 |
|
40 | 40 | #ifdef PRINT_STACK_REPORT |
|
41 | 41 | #define CONFIGURE_STACK_CHECKER_ENABLED |
|
42 | 42 | #endif |
|
43 | 43 | |
|
44 | 44 | #include <rtems/confdefs.h> |
|
45 | 45 | |
|
46 | 46 | /* If --drvmgr was enabled during the configuration of the RTEMS kernel */ |
|
47 | 47 | #ifdef RTEMS_DRVMGR_STARTUP |
|
48 | 48 | #ifdef LEON3 |
|
49 | 49 | /* Add Timer and UART Driver */ |
|
50 | 50 | #ifdef CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER |
|
51 | 51 | #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GPTIMER |
|
52 | 52 | #endif |
|
53 | 53 | #ifdef CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER |
|
54 | 54 | #define CONFIGURE_DRIVER_AMBAPP_GAISLER_APBUART |
|
55 | 55 | #endif |
|
56 | 56 | #endif |
|
57 | 57 | #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GRSPW /* GRSPW Driver */ |
|
58 | 58 | #include <drvmgr/drvmgr_confdefs.h> |
|
59 | 59 | #endif |
|
60 | 60 | |
|
61 | 61 | #include "fsw_init.h" |
|
62 | 62 | #include "fsw_config.c" |
|
63 | 63 | #include "GscMemoryLPP.hpp" |
|
64 | 64 | |
|
65 | 65 | void initCache() |
|
66 | 66 | { |
|
67 | 67 | // ASI 2 contains a few control registers that have not been assigned as ancillary state registers. |
|
68 | 68 | // These should only be read and written using 32-bit LDA/STA instructions. |
|
69 | 69 | // All cache registers are accessed through load/store operations to the alternate address space (LDA/STA), using ASI = 2. |
|
70 | 70 | // The table below shows the register addresses: |
|
71 | 71 | // 0x00 Cache control register |
|
72 | 72 | // 0x04 Reserved |
|
73 | 73 | // 0x08 Instruction cache configuration register |
|
74 | 74 | // 0x0C Data cache configuration register |
|
75 | 75 | |
|
76 | 76 | // Cache Control Register Leon3 / Leon3FT |
|
77 | 77 | // 31..30 29 28 27..24 23 22 21 20..19 18 17 16 |
|
78 | 78 | // RFT PS TB DS FD FI FT ST IB |
|
79 | 79 | // 15 14 13..12 11..10 9..8 7..6 5 4 3..2 1..0 |
|
80 | 80 | // IP DP ITE IDE DTE DDE DF IF DCS ICS |
|
81 | 81 | |
|
82 | 82 | unsigned int cacheControlRegister; |
|
83 | 83 | |
|
84 | 84 | CCR_resetCacheControlRegister(); |
|
85 | 85 | ASR16_resetRegisterProtectionControlRegister(); |
|
86 | 86 | |
|
87 | 87 | cacheControlRegister = CCR_getValue(); |
|
88 | 88 | PRINTF1("(0) CCR - Cache Control Register = %x\n", cacheControlRegister); |
|
89 | 89 | PRINTF1("(0) ASR16 = %x\n", *asr16Ptr); |
|
90 | 90 | |
|
91 | 91 | CCR_enableInstructionCache(); // ICS bits |
|
92 | 92 | CCR_enableDataCache(); // DCS bits |
|
93 | 93 | CCR_enableInstructionBurstFetch(); // IB bit |
|
94 | 94 | |
|
95 | 95 | faultTolerantScheme(); |
|
96 | 96 | |
|
97 | 97 | cacheControlRegister = CCR_getValue(); |
|
98 | 98 | PRINTF1("(1) CCR - Cache Control Register = %x\n", cacheControlRegister); |
|
99 | 99 | PRINTF1("(1) ASR16 Register protection control register = %x\n", *asr16Ptr); |
|
100 | 100 | |
|
101 | 101 | PRINTF("\n"); |
|
102 | 102 | } |
|
103 | 103 | |
|
104 | 104 | rtems_task Init( rtems_task_argument ignored ) |
|
105 | 105 | { |
|
106 | 106 | /** This is the RTEMS INIT taks, it is the first task launched by the system. |
|
107 | 107 | * |
|
108 | 108 | * @param unused is the starting argument of the RTEMS task |
|
109 | 109 | * |
|
110 | 110 | * The INIT task create and run all other RTEMS tasks. |
|
111 | 111 | * |
|
112 | 112 | */ |
|
113 | 113 | |
|
114 | 114 | //*********** |
|
115 | 115 | // INIT CACHE |
|
116 | 116 | |
|
117 | 117 | unsigned char *vhdlVersion; |
|
118 | 118 | |
|
119 | 119 | reset_lfr(); |
|
120 | 120 | |
|
121 | 121 | reset_local_time(); |
|
122 | 122 | |
|
123 | 123 | rtems_cpu_usage_reset(); |
|
124 | 124 | |
|
125 | 125 | rtems_status_code status; |
|
126 | 126 | rtems_status_code status_spw; |
|
127 | 127 | rtems_isr_entry old_isr_handler; |
|
128 | 128 | |
|
129 | 129 | // UART settings |
|
130 | 130 | enable_apbuart_transmitter(); |
|
131 | 131 | set_apbuart_scaler_reload_register(REGS_ADDR_APBUART, APBUART_SCALER_RELOAD_VALUE); |
|
132 | 132 | |
|
133 | 133 | DEBUG_PRINTF("\n\n\n\n\nIn INIT *** Now the console is on port COM1\n") |
|
134 | 134 | |
|
135 | 135 | |
|
136 | 136 | PRINTF("\n\n\n\n\n") |
|
137 | 137 | |
|
138 | 138 | initCache(); |
|
139 | 139 | |
|
140 | 140 | PRINTF("*************************\n") |
|
141 | 141 | PRINTF("** LFR Flight Software **\n") |
|
142 | 142 | PRINTF1("** %d.", SW_VERSION_N1) |
|
143 | 143 | PRINTF1("%d." , SW_VERSION_N2) |
|
144 | 144 | PRINTF1("%d." , SW_VERSION_N3) |
|
145 | 145 | PRINTF1("%d **\n", SW_VERSION_N4) |
|
146 | 146 | |
|
147 | 147 | vhdlVersion = (unsigned char *) (REGS_ADDR_VHDL_VERSION); |
|
148 | 148 | PRINTF("** VHDL **\n") |
|
149 | 149 | PRINTF1("** %d.", vhdlVersion[1]) |
|
150 | 150 | PRINTF1("%d." , vhdlVersion[2]) |
|
151 | 151 | PRINTF1("%d **\n", vhdlVersion[3]) |
|
152 | 152 | PRINTF("*************************\n") |
|
153 | 153 | PRINTF("\n\n") |
|
154 | 154 | |
|
155 | 155 | init_parameter_dump(); |
|
156 | 156 | init_kcoefficients_dump(); |
|
157 | 157 | init_local_mode_parameters(); |
|
158 | 158 | init_housekeeping_parameters(); |
|
159 | 159 | init_k_coefficients_prc0(); |
|
160 | 160 | init_k_coefficients_prc1(); |
|
161 | 161 | init_k_coefficients_prc2(); |
|
162 | 162 | pa_bia_status_info = 0x00; |
|
163 | 163 | cp_rpw_sc_rw_f_flags = 0x00; |
|
164 | 164 | cp_rpw_sc_rw1_f1 = 0.0; |
|
165 | 165 | cp_rpw_sc_rw1_f2 = 0.0; |
|
166 | 166 | cp_rpw_sc_rw2_f1 = 0.0; |
|
167 | 167 | cp_rpw_sc_rw2_f2 = 0.0; |
|
168 | 168 | cp_rpw_sc_rw3_f1 = 0.0; |
|
169 | 169 | cp_rpw_sc_rw3_f2 = 0.0; |
|
170 | 170 | cp_rpw_sc_rw4_f1 = 0.0; |
|
171 | 171 | cp_rpw_sc_rw4_f2 = 0.0; |
|
172 | sy_lfr_sc_rw_delta_f = 0.0; | |
|
172 | // initialize filtering parameters | |
|
173 | filterPar.spare_sy_lfr_pas_filter_enabled = DEFAULT_SY_LFR_PAS_FILTER_ENABLED; | |
|
174 | filterPar.sy_lfr_pas_filter_modulus = DEFAULT_SY_LFR_PAS_FILTER_MODULUS; | |
|
175 | filterPar.sy_lfr_pas_filter_tbad = DEFAULT_SY_LFR_PAS_FILTER_TBAD; | |
|
176 | filterPar.sy_lfr_pas_filter_offset = DEFAULT_SY_LFR_PAS_FILTER_OFFSET; | |
|
177 | filterPar.sy_lfr_pas_filter_shift = DEFAULT_SY_LFR_PAS_FILTER_SHIFT; | |
|
178 | filterPar.sy_lfr_sc_rw_delta_f = DEFAULT_SY_LFR_SC_RW_DELTA_F; | |
|
173 | 179 | update_last_valid_transition_date( DEFAULT_LAST_VALID_TRANSITION_DATE ); |
|
174 | 180 | |
|
175 | 181 | // waveform picker initialization |
|
176 | 182 | WFP_init_rings(); |
|
177 | 183 | LEON_Clear_interrupt( IRQ_SPARC_GPTIMER_WATCHDOG ); // initialize the waveform rings |
|
178 | 184 | WFP_reset_current_ring_nodes(); |
|
179 | 185 | reset_waveform_picker_regs(); |
|
180 | 186 | |
|
181 | 187 | // spectral matrices initialization |
|
182 | 188 | SM_init_rings(); // initialize spectral matrices rings |
|
183 | 189 | SM_reset_current_ring_nodes(); |
|
184 | 190 | reset_spectral_matrix_regs(); |
|
185 | 191 | |
|
186 | 192 | // configure calibration |
|
187 | 193 | configureCalibration( false ); // true means interleaved mode, false is for normal mode |
|
188 | 194 | |
|
189 | 195 | updateLFRCurrentMode( LFR_MODE_STANDBY ); |
|
190 | 196 | |
|
191 | 197 | BOOT_PRINTF1("in INIT *** lfrCurrentMode is %d\n", lfrCurrentMode) |
|
192 | 198 | |
|
193 | 199 | create_names(); // create all names |
|
194 | 200 | |
|
195 | 201 | status = create_timecode_timer(); // create the timer used by timecode_irq_handler |
|
196 | 202 | if (status != RTEMS_SUCCESSFUL) |
|
197 | 203 | { |
|
198 | 204 | PRINTF1("in INIT *** ERR in create_timer_timecode, code %d", status) |
|
199 | 205 | } |
|
200 | 206 | |
|
201 | 207 | status = create_message_queues(); // create message queues |
|
202 | 208 | if (status != RTEMS_SUCCESSFUL) |
|
203 | 209 | { |
|
204 | 210 | PRINTF1("in INIT *** ERR in create_message_queues, code %d", status) |
|
205 | 211 | } |
|
206 | 212 | |
|
207 | 213 | status = create_all_tasks(); // create all tasks |
|
208 | 214 | if (status != RTEMS_SUCCESSFUL) |
|
209 | 215 | { |
|
210 | 216 | PRINTF1("in INIT *** ERR in create_all_tasks, code %d\n", status) |
|
211 | 217 | } |
|
212 | 218 | |
|
213 | 219 | // ************************** |
|
214 | 220 | // <SPACEWIRE INITIALIZATION> |
|
215 | 221 | status_spw = spacewire_open_link(); // (1) open the link |
|
216 | 222 | if ( status_spw != RTEMS_SUCCESSFUL ) |
|
217 | 223 | { |
|
218 | 224 | PRINTF1("in INIT *** ERR spacewire_open_link code %d\n", status_spw ) |
|
219 | 225 | } |
|
220 | 226 | |
|
221 | 227 | if ( status_spw == RTEMS_SUCCESSFUL ) // (2) configure the link |
|
222 | 228 | { |
|
223 | 229 | status_spw = spacewire_configure_link( fdSPW ); |
|
224 | 230 | if ( status_spw != RTEMS_SUCCESSFUL ) |
|
225 | 231 | { |
|
226 | 232 | PRINTF1("in INIT *** ERR spacewire_configure_link code %d\n", status_spw ) |
|
227 | 233 | } |
|
228 | 234 | } |
|
229 | 235 | |
|
230 | 236 | if ( status_spw == RTEMS_SUCCESSFUL) // (3) start the link |
|
231 | 237 | { |
|
232 | 238 | status_spw = spacewire_start_link( fdSPW ); |
|
233 | 239 | if ( status_spw != RTEMS_SUCCESSFUL ) |
|
234 | 240 | { |
|
235 | 241 | PRINTF1("in INIT *** ERR spacewire_start_link code %d\n", status_spw ) |
|
236 | 242 | } |
|
237 | 243 | } |
|
238 | 244 | // </SPACEWIRE INITIALIZATION> |
|
239 | 245 | // *************************** |
|
240 | 246 | |
|
241 | 247 | status = start_all_tasks(); // start all tasks |
|
242 | 248 | if (status != RTEMS_SUCCESSFUL) |
|
243 | 249 | { |
|
244 | 250 | PRINTF1("in INIT *** ERR in start_all_tasks, code %d", status) |
|
245 | 251 | } |
|
246 | 252 | |
|
247 | 253 | // start RECV and SEND *AFTER* SpaceWire Initialization, due to the timeout of the start call during the initialization |
|
248 | 254 | status = start_recv_send_tasks(); |
|
249 | 255 | if ( status != RTEMS_SUCCESSFUL ) |
|
250 | 256 | { |
|
251 | 257 | PRINTF1("in INIT *** ERR start_recv_send_tasks code %d\n", status ) |
|
252 | 258 | } |
|
253 | 259 | |
|
254 | 260 | // suspend science tasks, they will be restarted later depending on the mode |
|
255 | 261 | status = suspend_science_tasks(); // suspend science tasks (not done in stop_current_mode if current mode = STANDBY) |
|
256 | 262 | if (status != RTEMS_SUCCESSFUL) |
|
257 | 263 | { |
|
258 | 264 | PRINTF1("in INIT *** in suspend_science_tasks *** ERR code: %d\n", status) |
|
259 | 265 | } |
|
260 | 266 | |
|
261 | 267 | // configure IRQ handling for the waveform picker unit |
|
262 | 268 | status = rtems_interrupt_catch( waveforms_isr, |
|
263 | 269 | IRQ_SPARC_WAVEFORM_PICKER, |
|
264 | 270 | &old_isr_handler) ; |
|
265 | 271 | // configure IRQ handling for the spectral matrices unit |
|
266 | 272 | status = rtems_interrupt_catch( spectral_matrices_isr, |
|
267 | 273 | IRQ_SPARC_SPECTRAL_MATRIX, |
|
268 | 274 | &old_isr_handler) ; |
|
269 | 275 | |
|
270 | 276 | // if the spacewire link is not up then send an event to the SPIQ task for link recovery |
|
271 | 277 | if ( status_spw != RTEMS_SUCCESSFUL ) |
|
272 | 278 | { |
|
273 | 279 | status = rtems_event_send( Task_id[TASKID_SPIQ], SPW_LINKERR_EVENT ); |
|
274 | 280 | if ( status != RTEMS_SUCCESSFUL ) { |
|
275 | 281 | PRINTF1("in INIT *** ERR rtems_event_send to SPIQ code %d\n", status ) |
|
276 | 282 | } |
|
277 | 283 | } |
|
278 | 284 | |
|
279 | 285 | BOOT_PRINTF("delete INIT\n") |
|
280 | 286 | |
|
281 | 287 | set_hk_lfr_sc_potential_flag( true ); |
|
282 | 288 | |
|
283 | 289 | // start the timer to detect a missing spacewire timecode |
|
284 | 290 | // the timeout is larger because the spw IP needs to receive several valid timecodes before generating a tickout |
|
285 | 291 | // if a tickout is generated, the timer is restarted |
|
286 | 292 | status = rtems_timer_fire_after( timecode_timer_id, TIMECODE_TIMER_TIMEOUT_INIT, timecode_timer_routine, NULL ); |
|
287 | 293 | |
|
288 | 294 | grspw_timecode_callback = &timecode_irq_handler; |
|
289 | 295 | |
|
290 | 296 | status = rtems_task_delete(RTEMS_SELF); |
|
291 | 297 | |
|
292 | 298 | } |
|
293 | 299 | |
|
294 | 300 | void init_local_mode_parameters( void ) |
|
295 | 301 | { |
|
296 | 302 | /** This function initialize the param_local global variable with default values. |
|
297 | 303 | * |
|
298 | 304 | */ |
|
299 | 305 | |
|
300 | 306 | unsigned int i; |
|
301 | 307 | |
|
302 | 308 | // LOCAL PARAMETERS |
|
303 | 309 | |
|
304 | 310 | BOOT_PRINTF1("local_sbm1_nb_cwf_max %d \n", param_local.local_sbm1_nb_cwf_max) |
|
305 | 311 | BOOT_PRINTF1("local_sbm2_nb_cwf_max %d \n", param_local.local_sbm2_nb_cwf_max) |
|
306 | 312 | BOOT_PRINTF1("nb_interrupt_f0_MAX = %d\n", param_local.local_nb_interrupt_f0_MAX) |
|
307 | 313 | |
|
308 | 314 | // init sequence counters |
|
309 | 315 | |
|
310 | 316 | for(i = 0; i<SEQ_CNT_NB_DEST_ID; i++) |
|
311 | 317 | { |
|
312 | 318 | sequenceCounters_TC_EXE[i] = 0x00; |
|
313 | 319 | sequenceCounters_TM_DUMP[i] = 0x00; |
|
314 | 320 | } |
|
315 | 321 | sequenceCounters_SCIENCE_NORMAL_BURST = 0x00; |
|
316 | 322 | sequenceCounters_SCIENCE_SBM1_SBM2 = 0x00; |
|
317 | 323 | sequenceCounterHK = TM_PACKET_SEQ_CTRL_STANDALONE << 8; |
|
318 | 324 | } |
|
319 | 325 | |
|
320 | 326 | void reset_local_time( void ) |
|
321 | 327 | { |
|
322 | 328 | time_management_regs->ctrl = time_management_regs->ctrl | 0x02; // [0010] software reset, coarse time = 0x80000000 |
|
323 | 329 | } |
|
324 | 330 | |
|
325 | 331 | void create_names( void ) // create all names for tasks and queues |
|
326 | 332 | { |
|
327 | 333 | /** This function creates all RTEMS names used in the software for tasks and queues. |
|
328 | 334 | * |
|
329 | 335 | * @return RTEMS directive status codes: |
|
330 | 336 | * - RTEMS_SUCCESSFUL - successful completion |
|
331 | 337 | * |
|
332 | 338 | */ |
|
333 | 339 | |
|
334 | 340 | // task names |
|
335 | 341 | Task_name[TASKID_RECV] = rtems_build_name( 'R', 'E', 'C', 'V' ); |
|
336 | 342 | Task_name[TASKID_ACTN] = rtems_build_name( 'A', 'C', 'T', 'N' ); |
|
337 | 343 | Task_name[TASKID_SPIQ] = rtems_build_name( 'S', 'P', 'I', 'Q' ); |
|
338 | 344 | Task_name[TASKID_LOAD] = rtems_build_name( 'L', 'O', 'A', 'D' ); |
|
339 | 345 | Task_name[TASKID_AVF0] = rtems_build_name( 'A', 'V', 'F', '0' ); |
|
340 | 346 | Task_name[TASKID_SWBD] = rtems_build_name( 'S', 'W', 'B', 'D' ); |
|
341 | 347 | Task_name[TASKID_WFRM] = rtems_build_name( 'W', 'F', 'R', 'M' ); |
|
342 | 348 | Task_name[TASKID_DUMB] = rtems_build_name( 'D', 'U', 'M', 'B' ); |
|
343 | 349 | Task_name[TASKID_HOUS] = rtems_build_name( 'H', 'O', 'U', 'S' ); |
|
344 | 350 | Task_name[TASKID_PRC0] = rtems_build_name( 'P', 'R', 'C', '0' ); |
|
345 | 351 | Task_name[TASKID_CWF3] = rtems_build_name( 'C', 'W', 'F', '3' ); |
|
346 | 352 | Task_name[TASKID_CWF2] = rtems_build_name( 'C', 'W', 'F', '2' ); |
|
347 | 353 | Task_name[TASKID_CWF1] = rtems_build_name( 'C', 'W', 'F', '1' ); |
|
348 | 354 | Task_name[TASKID_SEND] = rtems_build_name( 'S', 'E', 'N', 'D' ); |
|
349 | 355 | Task_name[TASKID_LINK] = rtems_build_name( 'L', 'I', 'N', 'K' ); |
|
350 | 356 | Task_name[TASKID_AVF1] = rtems_build_name( 'A', 'V', 'F', '1' ); |
|
351 | 357 | Task_name[TASKID_PRC1] = rtems_build_name( 'P', 'R', 'C', '1' ); |
|
352 | 358 | Task_name[TASKID_AVF2] = rtems_build_name( 'A', 'V', 'F', '2' ); |
|
353 | 359 | Task_name[TASKID_PRC2] = rtems_build_name( 'P', 'R', 'C', '2' ); |
|
354 | 360 | |
|
355 | 361 | // rate monotonic period names |
|
356 | 362 | name_hk_rate_monotonic = rtems_build_name( 'H', 'O', 'U', 'S' ); |
|
357 | 363 | |
|
358 | 364 | misc_name[QUEUE_RECV] = rtems_build_name( 'Q', '_', 'R', 'V' ); |
|
359 | 365 | misc_name[QUEUE_SEND] = rtems_build_name( 'Q', '_', 'S', 'D' ); |
|
360 | 366 | misc_name[QUEUE_PRC0] = rtems_build_name( 'Q', '_', 'P', '0' ); |
|
361 | 367 | misc_name[QUEUE_PRC1] = rtems_build_name( 'Q', '_', 'P', '1' ); |
|
362 | 368 | misc_name[QUEUE_PRC2] = rtems_build_name( 'Q', '_', 'P', '2' ); |
|
363 | 369 | |
|
364 | 370 | timecode_timer_name = rtems_build_name( 'S', 'P', 'T', 'C' ); |
|
365 | 371 | } |
|
366 | 372 | |
|
367 | 373 | int create_all_tasks( void ) // create all tasks which run in the software |
|
368 | 374 | { |
|
369 | 375 | /** This function creates all RTEMS tasks used in the software. |
|
370 | 376 | * |
|
371 | 377 | * @return RTEMS directive status codes: |
|
372 | 378 | * - RTEMS_SUCCESSFUL - task created successfully |
|
373 | 379 | * - RTEMS_INVALID_ADDRESS - id is NULL |
|
374 | 380 | * - RTEMS_INVALID_NAME - invalid task name |
|
375 | 381 | * - RTEMS_INVALID_PRIORITY - invalid task priority |
|
376 | 382 | * - RTEMS_MP_NOT_CONFIGURED - multiprocessing not configured |
|
377 | 383 | * - RTEMS_TOO_MANY - too many tasks created |
|
378 | 384 | * - RTEMS_UNSATISFIED - not enough memory for stack/FP context |
|
379 | 385 | * - RTEMS_TOO_MANY - too many global objects |
|
380 | 386 | * |
|
381 | 387 | */ |
|
382 | 388 | |
|
383 | 389 | rtems_status_code status; |
|
384 | 390 | |
|
385 | 391 | //********** |
|
386 | 392 | // SPACEWIRE |
|
387 | 393 | // RECV |
|
388 | 394 | status = rtems_task_create( |
|
389 | 395 | Task_name[TASKID_RECV], TASK_PRIORITY_RECV, RTEMS_MINIMUM_STACK_SIZE, |
|
390 | 396 | RTEMS_DEFAULT_MODES, |
|
391 | 397 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_RECV] |
|
392 | 398 | ); |
|
393 | 399 | if (status == RTEMS_SUCCESSFUL) // SEND |
|
394 | 400 | { |
|
395 | 401 | status = rtems_task_create( |
|
396 | 402 | Task_name[TASKID_SEND], TASK_PRIORITY_SEND, RTEMS_MINIMUM_STACK_SIZE * 2, |
|
397 | 403 | RTEMS_DEFAULT_MODES, |
|
398 | 404 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_SEND] |
|
399 | 405 | ); |
|
400 | 406 | } |
|
401 | 407 | if (status == RTEMS_SUCCESSFUL) // LINK |
|
402 | 408 | { |
|
403 | 409 | status = rtems_task_create( |
|
404 | 410 | Task_name[TASKID_LINK], TASK_PRIORITY_LINK, RTEMS_MINIMUM_STACK_SIZE, |
|
405 | 411 | RTEMS_DEFAULT_MODES, |
|
406 | 412 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_LINK] |
|
407 | 413 | ); |
|
408 | 414 | } |
|
409 | 415 | if (status == RTEMS_SUCCESSFUL) // ACTN |
|
410 | 416 | { |
|
411 | 417 | status = rtems_task_create( |
|
412 | 418 | Task_name[TASKID_ACTN], TASK_PRIORITY_ACTN, RTEMS_MINIMUM_STACK_SIZE, |
|
413 | 419 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, |
|
414 | 420 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_ACTN] |
|
415 | 421 | ); |
|
416 | 422 | } |
|
417 | 423 | if (status == RTEMS_SUCCESSFUL) // SPIQ |
|
418 | 424 | { |
|
419 | 425 | status = rtems_task_create( |
|
420 | 426 | Task_name[TASKID_SPIQ], TASK_PRIORITY_SPIQ, RTEMS_MINIMUM_STACK_SIZE, |
|
421 | 427 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, |
|
422 | 428 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SPIQ] |
|
423 | 429 | ); |
|
424 | 430 | } |
|
425 | 431 | |
|
426 | 432 | //****************** |
|
427 | 433 | // SPECTRAL MATRICES |
|
428 | 434 | if (status == RTEMS_SUCCESSFUL) // AVF0 |
|
429 | 435 | { |
|
430 | 436 | status = rtems_task_create( |
|
431 | 437 | Task_name[TASKID_AVF0], TASK_PRIORITY_AVF0, RTEMS_MINIMUM_STACK_SIZE, |
|
432 | 438 | RTEMS_DEFAULT_MODES, |
|
433 | 439 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF0] |
|
434 | 440 | ); |
|
435 | 441 | } |
|
436 | 442 | if (status == RTEMS_SUCCESSFUL) // PRC0 |
|
437 | 443 | { |
|
438 | 444 | status = rtems_task_create( |
|
439 | 445 | Task_name[TASKID_PRC0], TASK_PRIORITY_PRC0, RTEMS_MINIMUM_STACK_SIZE * 2, |
|
440 | 446 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, |
|
441 | 447 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_PRC0] |
|
442 | 448 | ); |
|
443 | 449 | } |
|
444 | 450 | if (status == RTEMS_SUCCESSFUL) // AVF1 |
|
445 | 451 | { |
|
446 | 452 | status = rtems_task_create( |
|
447 | 453 | Task_name[TASKID_AVF1], TASK_PRIORITY_AVF1, RTEMS_MINIMUM_STACK_SIZE, |
|
448 | 454 | RTEMS_DEFAULT_MODES, |
|
449 | 455 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF1] |
|
450 | 456 | ); |
|
451 | 457 | } |
|
452 | 458 | if (status == RTEMS_SUCCESSFUL) // PRC1 |
|
453 | 459 | { |
|
454 | 460 | status = rtems_task_create( |
|
455 | 461 | Task_name[TASKID_PRC1], TASK_PRIORITY_PRC1, RTEMS_MINIMUM_STACK_SIZE * 2, |
|
456 | 462 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, |
|
457 | 463 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_PRC1] |
|
458 | 464 | ); |
|
459 | 465 | } |
|
460 | 466 | if (status == RTEMS_SUCCESSFUL) // AVF2 |
|
461 | 467 | { |
|
462 | 468 | status = rtems_task_create( |
|
463 | 469 | Task_name[TASKID_AVF2], TASK_PRIORITY_AVF2, RTEMS_MINIMUM_STACK_SIZE, |
|
464 | 470 | RTEMS_DEFAULT_MODES, |
|
465 | 471 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF2] |
|
466 | 472 | ); |
|
467 | 473 | } |
|
468 | 474 | if (status == RTEMS_SUCCESSFUL) // PRC2 |
|
469 | 475 | { |
|
470 | 476 | status = rtems_task_create( |
|
471 | 477 | Task_name[TASKID_PRC2], TASK_PRIORITY_PRC2, RTEMS_MINIMUM_STACK_SIZE * 2, |
|
472 | 478 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, |
|
473 | 479 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_PRC2] |
|
474 | 480 | ); |
|
475 | 481 | } |
|
476 | 482 | |
|
477 | 483 | //**************** |
|
478 | 484 | // WAVEFORM PICKER |
|
479 | 485 | if (status == RTEMS_SUCCESSFUL) // WFRM |
|
480 | 486 | { |
|
481 | 487 | status = rtems_task_create( |
|
482 | 488 | Task_name[TASKID_WFRM], TASK_PRIORITY_WFRM, RTEMS_MINIMUM_STACK_SIZE, |
|
483 | 489 | RTEMS_DEFAULT_MODES, |
|
484 | 490 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_WFRM] |
|
485 | 491 | ); |
|
486 | 492 | } |
|
487 | 493 | if (status == RTEMS_SUCCESSFUL) // CWF3 |
|
488 | 494 | { |
|
489 | 495 | status = rtems_task_create( |
|
490 | 496 | Task_name[TASKID_CWF3], TASK_PRIORITY_CWF3, RTEMS_MINIMUM_STACK_SIZE, |
|
491 | 497 | RTEMS_DEFAULT_MODES, |
|
492 | 498 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF3] |
|
493 | 499 | ); |
|
494 | 500 | } |
|
495 | 501 | if (status == RTEMS_SUCCESSFUL) // CWF2 |
|
496 | 502 | { |
|
497 | 503 | status = rtems_task_create( |
|
498 | 504 | Task_name[TASKID_CWF2], TASK_PRIORITY_CWF2, RTEMS_MINIMUM_STACK_SIZE, |
|
499 | 505 | RTEMS_DEFAULT_MODES, |
|
500 | 506 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF2] |
|
501 | 507 | ); |
|
502 | 508 | } |
|
503 | 509 | if (status == RTEMS_SUCCESSFUL) // CWF1 |
|
504 | 510 | { |
|
505 | 511 | status = rtems_task_create( |
|
506 | 512 | Task_name[TASKID_CWF1], TASK_PRIORITY_CWF1, RTEMS_MINIMUM_STACK_SIZE, |
|
507 | 513 | RTEMS_DEFAULT_MODES, |
|
508 | 514 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF1] |
|
509 | 515 | ); |
|
510 | 516 | } |
|
511 | 517 | if (status == RTEMS_SUCCESSFUL) // SWBD |
|
512 | 518 | { |
|
513 | 519 | status = rtems_task_create( |
|
514 | 520 | Task_name[TASKID_SWBD], TASK_PRIORITY_SWBD, RTEMS_MINIMUM_STACK_SIZE, |
|
515 | 521 | RTEMS_DEFAULT_MODES, |
|
516 | 522 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_SWBD] |
|
517 | 523 | ); |
|
518 | 524 | } |
|
519 | 525 | |
|
520 | 526 | //***** |
|
521 | 527 | // MISC |
|
522 | 528 | if (status == RTEMS_SUCCESSFUL) // LOAD |
|
523 | 529 | { |
|
524 | 530 | status = rtems_task_create( |
|
525 | 531 | Task_name[TASKID_LOAD], TASK_PRIORITY_LOAD, RTEMS_MINIMUM_STACK_SIZE, |
|
526 | 532 | RTEMS_DEFAULT_MODES, |
|
527 | 533 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_LOAD] |
|
528 | 534 | ); |
|
529 | 535 | } |
|
530 | 536 | if (status == RTEMS_SUCCESSFUL) // DUMB |
|
531 | 537 | { |
|
532 | 538 | status = rtems_task_create( |
|
533 | 539 | Task_name[TASKID_DUMB], TASK_PRIORITY_DUMB, RTEMS_MINIMUM_STACK_SIZE, |
|
534 | 540 | RTEMS_DEFAULT_MODES, |
|
535 | 541 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_DUMB] |
|
536 | 542 | ); |
|
537 | 543 | } |
|
538 | 544 | if (status == RTEMS_SUCCESSFUL) // HOUS |
|
539 | 545 | { |
|
540 | 546 | status = rtems_task_create( |
|
541 | 547 | Task_name[TASKID_HOUS], TASK_PRIORITY_HOUS, RTEMS_MINIMUM_STACK_SIZE, |
|
542 | 548 | RTEMS_DEFAULT_MODES, |
|
543 | 549 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_HOUS] |
|
544 | 550 | ); |
|
545 | 551 | } |
|
546 | 552 | |
|
547 | 553 | return status; |
|
548 | 554 | } |
|
549 | 555 | |
|
550 | 556 | int start_recv_send_tasks( void ) |
|
551 | 557 | { |
|
552 | 558 | rtems_status_code status; |
|
553 | 559 | |
|
554 | 560 | status = rtems_task_start( Task_id[TASKID_RECV], recv_task, 1 ); |
|
555 | 561 | if (status!=RTEMS_SUCCESSFUL) { |
|
556 | 562 | BOOT_PRINTF("in INIT *** Error starting TASK_RECV\n") |
|
557 | 563 | } |
|
558 | 564 | |
|
559 | 565 | if (status == RTEMS_SUCCESSFUL) // SEND |
|
560 | 566 | { |
|
561 | 567 | status = rtems_task_start( Task_id[TASKID_SEND], send_task, 1 ); |
|
562 | 568 | if (status!=RTEMS_SUCCESSFUL) { |
|
563 | 569 | BOOT_PRINTF("in INIT *** Error starting TASK_SEND\n") |
|
564 | 570 | } |
|
565 | 571 | } |
|
566 | 572 | |
|
567 | 573 | return status; |
|
568 | 574 | } |
|
569 | 575 | |
|
570 | 576 | int start_all_tasks( void ) // start all tasks except SEND RECV and HOUS |
|
571 | 577 | { |
|
572 | 578 | /** This function starts all RTEMS tasks used in the software. |
|
573 | 579 | * |
|
574 | 580 | * @return RTEMS directive status codes: |
|
575 | 581 | * - RTEMS_SUCCESSFUL - ask started successfully |
|
576 | 582 | * - RTEMS_INVALID_ADDRESS - invalid task entry point |
|
577 | 583 | * - RTEMS_INVALID_ID - invalid task id |
|
578 | 584 | * - RTEMS_INCORRECT_STATE - task not in the dormant state |
|
579 | 585 | * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot start remote task |
|
580 | 586 | * |
|
581 | 587 | */ |
|
582 | 588 | // starts all the tasks fot eh flight software |
|
583 | 589 | |
|
584 | 590 | rtems_status_code status; |
|
585 | 591 | |
|
586 | 592 | //********** |
|
587 | 593 | // SPACEWIRE |
|
588 | 594 | status = rtems_task_start( Task_id[TASKID_SPIQ], spiq_task, 1 ); |
|
589 | 595 | if (status!=RTEMS_SUCCESSFUL) { |
|
590 | 596 | BOOT_PRINTF("in INIT *** Error starting TASK_SPIQ\n") |
|
591 | 597 | } |
|
592 | 598 | |
|
593 | 599 | if (status == RTEMS_SUCCESSFUL) // LINK |
|
594 | 600 | { |
|
595 | 601 | status = rtems_task_start( Task_id[TASKID_LINK], link_task, 1 ); |
|
596 | 602 | if (status!=RTEMS_SUCCESSFUL) { |
|
597 | 603 | BOOT_PRINTF("in INIT *** Error starting TASK_LINK\n") |
|
598 | 604 | } |
|
599 | 605 | } |
|
600 | 606 | |
|
601 | 607 | if (status == RTEMS_SUCCESSFUL) // ACTN |