##// END OF EJS Templates
timecode handling modified:...
paul -
r248:c648c60c0eef R3a
parent child
Show More
@@ -1,2 +1,2
1 3081d1f9bb20b2b64a192585337a292a9804e0c5 LFR_basic-parameters
1 3081d1f9bb20b2b64a192585337a292a9804e0c5 LFR_basic-parameters
2 ce0c2f17257170a8529605f68687c18f23973087 header/lfr_common_headers
2 084fd0db5e4139a1096789935e32ef498192f395 header/lfr_common_headers
@@ -1,51 +1,54
1 #ifndef FSW_INIT_H_INCLUDED
1 #ifndef FSW_INIT_H_INCLUDED
2 #define FSW_INIT_H_INCLUDED
2 #define FSW_INIT_H_INCLUDED
3
3
4 #include <rtems.h>
4 #include <rtems.h>
5 #include <leon.h>
5 #include <leon.h>
6
6
7 #include "fsw_params.h"
7 #include "fsw_params.h"
8 #include "fsw_misc.h"
8 #include "fsw_misc.h"
9 #include "fsw_processing.h"
9 #include "fsw_processing.h"
10
10
11 #include "tc_handler.h"
11 #include "tc_handler.h"
12 #include "wf_handler.h"
12 #include "wf_handler.h"
13 #include "fsw_spacewire.h"
13 #include "fsw_spacewire.h"
14
14
15 #include "avf0_prc0.h"
15 #include "avf0_prc0.h"
16 #include "avf1_prc1.h"
16 #include "avf1_prc1.h"
17 #include "avf2_prc2.h"
17 #include "avf2_prc2.h"
18
18
19 extern rtems_name Task_name[20]; /* array of task names */
19 extern rtems_name Task_name[20]; /* array of task names */
20 extern rtems_id Task_id[20]; /* array of task ids */
20 extern rtems_id Task_id[20]; /* array of task ids */
21 extern rtems_name timecode_timer_name;
22 extern rtems_id timecode_timer_id;
21 extern unsigned char pa_bia_status_info;
23 extern unsigned char pa_bia_status_info;
22
24
23 // RTEMS TASKS
25 // RTEMS TASKS
24 rtems_task Init( rtems_task_argument argument);
26 rtems_task Init( rtems_task_argument argument);
25
27
26 // OTHER functions
28 // OTHER functions
27 void create_names( void );
29 void create_names( void );
28 int create_all_tasks( void );
30 int create_all_tasks( void );
29 int start_all_tasks( void );
31 int start_all_tasks( void );
30 //
32 //
31 rtems_status_code create_message_queues( void );
33 rtems_status_code create_message_queues( void );
34 rtems_status_code create_timecode_timer( void );
32 rtems_status_code get_message_queue_id_send( rtems_id *queue_id );
35 rtems_status_code get_message_queue_id_send( rtems_id *queue_id );
33 rtems_status_code get_message_queue_id_recv( rtems_id *queue_id );
36 rtems_status_code get_message_queue_id_recv( rtems_id *queue_id );
34 rtems_status_code get_message_queue_id_prc0( rtems_id *queue_id );
37 rtems_status_code get_message_queue_id_prc0( rtems_id *queue_id );
35 rtems_status_code get_message_queue_id_prc1( rtems_id *queue_id );
38 rtems_status_code get_message_queue_id_prc1( rtems_id *queue_id );
36 rtems_status_code get_message_queue_id_prc2( rtems_id *queue_id );
39 rtems_status_code get_message_queue_id_prc2( rtems_id *queue_id );
37 void update_queue_max_count( rtems_id queue_id, unsigned char*fifo_size_max );
40 void update_queue_max_count( rtems_id queue_id, unsigned char*fifo_size_max );
38 void init_ring(ring_node ring[], unsigned char nbNodes, volatile int buffer[], unsigned int bufferSize );
41 void init_ring(ring_node ring[], unsigned char nbNodes, volatile int buffer[], unsigned int bufferSize );
39 //
42 //
40 int start_recv_send_tasks( void );
43 int start_recv_send_tasks( void );
41 //
44 //
42 void init_local_mode_parameters( void );
45 void init_local_mode_parameters( void );
43 void reset_local_time( void );
46 void reset_local_time( void );
44
47
45 extern void rtems_cpu_usage_report( void );
48 extern void rtems_cpu_usage_report( void );
46 extern void rtems_cpu_usage_reset( void );
49 extern void rtems_cpu_usage_reset( void );
47 extern void rtems_stack_checker_report_usage( void );
50 extern void rtems_stack_checker_report_usage( void );
48
51
49 extern int sched_yield( void );
52 extern int sched_yield( void );
50
53
51 #endif // FSW_INIT_H_INCLUDED
54 #endif // FSW_INIT_H_INCLUDED
@@ -1,50 +1,56
1 #ifndef FSW_SPACEWIRE_H_INCLUDED
1 #ifndef FSW_SPACEWIRE_H_INCLUDED
2 #define FSW_SPACEWIRE_H_INCLUDED
2 #define FSW_SPACEWIRE_H_INCLUDED
3
3
4 #include <rtems.h>
4 #include <rtems.h>
5 #include <grspw.h>
5 #include <grspw.h>
6
6
7 #include <fcntl.h> // for O_RDWR
7 #include <fcntl.h> // for O_RDWR
8 #include <unistd.h> // for the read call
8 #include <unistd.h> // for the read call
9 #include <sys/ioctl.h> // for the ioctl call
9 #include <sys/ioctl.h> // for the ioctl call
10 #include <errno.h>
10 #include <errno.h>
11
11
12 #include "fsw_params.h"
12 #include "fsw_params.h"
13 #include "tc_handler.h"
13 #include "tc_handler.h"
14 #include "fsw_init.h"
14 #include "fsw_init.h"
15
15
16 extern spw_stats spacewire_stats;
16 extern spw_stats spacewire_stats;
17 extern spw_stats spacewire_stats_backup;
17 extern spw_stats spacewire_stats_backup;
18 extern rtems_name timecode_timer_name;
19 extern rtems_id timecode_timer_id;
18
20
19 // RTEMS TASK
21 // RTEMS TASK
20 rtems_task spiq_task( rtems_task_argument argument );
22 rtems_task spiq_task( rtems_task_argument argument );
21 rtems_task recv_task( rtems_task_argument unused );
23 rtems_task recv_task( rtems_task_argument unused );
22 rtems_task send_task( rtems_task_argument argument );
24 rtems_task send_task( rtems_task_argument argument );
23 rtems_task wtdg_task( rtems_task_argument argument );
25 rtems_task wtdg_task( rtems_task_argument argument );
24
26
25 int spacewire_open_link( void );
27 int spacewire_open_link( void );
26 int spacewire_start_link( int fd );
28 int spacewire_start_link( int fd );
27 int spacewire_stop_and_start_link( int fd );
29 int spacewire_stop_and_start_link( int fd );
28 int spacewire_configure_link(int fd );
30 int spacewire_configure_link(int fd );
29 int spacewire_reset_link( void );
31 int spacewire_reset_link( void );
30 void spacewire_set_NP( unsigned char val, unsigned int regAddr ); // No Port force
32 void spacewire_set_NP( unsigned char val, unsigned int regAddr ); // No Port force
31 void spacewire_set_RE( unsigned char val, unsigned int regAddr ); // RMAP Enable
33 void spacewire_set_RE( unsigned char val, unsigned int regAddr ); // RMAP Enable
32 void spacewire_compute_stats_offsets( void );
34 void spacewire_compute_stats_offsets( void );
33 void spacewire_update_statistics( void );
35 void spacewire_update_statistics( void );
36 void increase_an_unsigned_char_counter( unsigned char *counter );
34
37
35 void init_header_cwf( Header_TM_LFR_SCIENCE_CWF_t *header );
38 void init_header_cwf( Header_TM_LFR_SCIENCE_CWF_t *header );
36 void init_header_swf( Header_TM_LFR_SCIENCE_SWF_t *header );
39 void init_header_swf( Header_TM_LFR_SCIENCE_SWF_t *header );
37 void init_header_asm( Header_TM_LFR_SCIENCE_ASM_t *header );
40 void init_header_asm( Header_TM_LFR_SCIENCE_ASM_t *header );
38 int spw_send_waveform_CWF( ring_node *ring_node_to_send, Header_TM_LFR_SCIENCE_CWF_t *header );
41 int spw_send_waveform_CWF( ring_node *ring_node_to_send, Header_TM_LFR_SCIENCE_CWF_t *header );
39 int spw_send_waveform_SWF( ring_node *ring_node_to_send, Header_TM_LFR_SCIENCE_SWF_t *header );
42 int spw_send_waveform_SWF( ring_node *ring_node_to_send, Header_TM_LFR_SCIENCE_SWF_t *header );
40 int spw_send_waveform_CWF3_light( ring_node *ring_node_to_send, Header_TM_LFR_SCIENCE_CWF_t *header );
43 int spw_send_waveform_CWF3_light( ring_node *ring_node_to_send, Header_TM_LFR_SCIENCE_CWF_t *header );
41 void spw_send_asm_f0( ring_node *ring_node_to_send, Header_TM_LFR_SCIENCE_ASM_t *header );
44 void spw_send_asm_f0( ring_node *ring_node_to_send, Header_TM_LFR_SCIENCE_ASM_t *header );
42 void spw_send_asm_f1( ring_node *ring_node_to_send, Header_TM_LFR_SCIENCE_ASM_t *header );
45 void spw_send_asm_f1( ring_node *ring_node_to_send, Header_TM_LFR_SCIENCE_ASM_t *header );
43 void spw_send_asm_f2( ring_node *ring_node_to_send, Header_TM_LFR_SCIENCE_ASM_t *header );
46 void spw_send_asm_f2( ring_node *ring_node_to_send, Header_TM_LFR_SCIENCE_ASM_t *header );
44 void spw_send_k_dump( ring_node *ring_node_to_send );
47 void spw_send_k_dump( ring_node *ring_node_to_send );
45
48
49 rtems_timer_service_routine timecode_timer_routine( rtems_id timer_id, void *user_data );
50 unsigned int check_timecode_and_previous_timecode_coherency(unsigned char currentTimecodeCtr);
51 unsigned int check_timecode_and_internal_time_coherency(unsigned char timecode, unsigned char internalTime);
46 void timecode_irq_handler( void *pDev, void *regs, int minor, unsigned int tc );
52 void timecode_irq_handler( void *pDev, void *regs, int minor, unsigned int tc );
47
53
48 void (*grspw_timecode_callback) ( void *pDev, void *regs, int minor, unsigned int tc );
54 void (*grspw_timecode_callback) ( void *pDev, void *regs, int minor, unsigned int tc );
49
55
50 #endif // FSW_SPACEWIRE_H_INCLUDED
56 #endif // FSW_SPACEWIRE_H_INCLUDED
@@ -1,80 +1,82
1 /** Global variables of the LFR flight software.
1 /** Global variables of the LFR flight software.
2 *
2 *
3 * @file
3 * @file
4 * @author P. LEROY
4 * @author P. LEROY
5 *
5 *
6 * Among global variables, there are:
6 * Among global variables, there are:
7 * - RTEMS names and id.
7 * - RTEMS names and id.
8 * - APB configuration registers.
8 * - APB configuration registers.
9 * - waveforms global buffers, used by the waveform picker hardware module to store data.
9 * - waveforms global buffers, used by the waveform picker hardware module to store data.
10 * - spectral matrices buffesr, used by the hardware module to store data.
10 * - spectral matrices buffesr, used by the hardware module to store data.
11 * - variable related to LFR modes parameters.
11 * - variable related to LFR modes parameters.
12 * - the global HK packet buffer.
12 * - the global HK packet buffer.
13 * - the global dump parameter buffer.
13 * - the global dump parameter buffer.
14 *
14 *
15 */
15 */
16
16
17 #include <rtems.h>
17 #include <rtems.h>
18 #include <grspw.h>
18 #include <grspw.h>
19
19
20 #include "ccsds_types.h"
20 #include "ccsds_types.h"
21 #include "grlib_regs.h"
21 #include "grlib_regs.h"
22 #include "fsw_params.h"
22 #include "fsw_params.h"
23 #include "fsw_params_wf_handler.h"
23 #include "fsw_params_wf_handler.h"
24
24
25 // RTEMS GLOBAL VARIABLES
25 // RTEMS GLOBAL VARIABLES
26 rtems_name misc_name[5];
26 rtems_name misc_name[5];
27 rtems_name Task_name[20]; /* array of task names */
27 rtems_name Task_name[20]; /* array of task names */
28 rtems_id Task_id[20]; /* array of task ids */
28 rtems_id Task_id[20]; /* array of task ids */
29 rtems_name timecode_timer_name;
30 rtems_id timecode_timer_id;
29 int fdSPW = 0;
31 int fdSPW = 0;
30 int fdUART = 0;
32 int fdUART = 0;
31 unsigned char lfrCurrentMode;
33 unsigned char lfrCurrentMode;
32 unsigned char pa_bia_status_info;
34 unsigned char pa_bia_status_info;
33
35
34 // WAVEFORMS GLOBAL VARIABLES // 2048 * 3 * 4 + 2 * 4 = 24576 + 8 bytes = 24584
36 // WAVEFORMS GLOBAL VARIABLES // 2048 * 3 * 4 + 2 * 4 = 24576 + 8 bytes = 24584
35 // 97 * 256 = 24832 => delta = 248 bytes = 62 words
37 // 97 * 256 = 24832 => delta = 248 bytes = 62 words
36 // WAVEFORMS GLOBAL VARIABLES // 2688 * 3 * 4 + 2 * 4 = 32256 + 8 bytes = 32264
38 // WAVEFORMS GLOBAL VARIABLES // 2688 * 3 * 4 + 2 * 4 = 32256 + 8 bytes = 32264
37 // 127 * 256 = 32512 => delta = 248 bytes = 62 words
39 // 127 * 256 = 32512 => delta = 248 bytes = 62 words
38 // F0 F1 F2 F3
40 // F0 F1 F2 F3
39 volatile int wf_buffer_f0[ NB_RING_NODES_F0 * WFRM_BUFFER ] __attribute__((aligned(0x100)));
41 volatile int wf_buffer_f0[ NB_RING_NODES_F0 * WFRM_BUFFER ] __attribute__((aligned(0x100)));
40 volatile int wf_buffer_f1[ NB_RING_NODES_F1 * WFRM_BUFFER ] __attribute__((aligned(0x100)));
42 volatile int wf_buffer_f1[ NB_RING_NODES_F1 * WFRM_BUFFER ] __attribute__((aligned(0x100)));
41 volatile int wf_buffer_f2[ NB_RING_NODES_F2 * WFRM_BUFFER ] __attribute__((aligned(0x100)));
43 volatile int wf_buffer_f2[ NB_RING_NODES_F2 * WFRM_BUFFER ] __attribute__((aligned(0x100)));
42 volatile int wf_buffer_f3[ NB_RING_NODES_F3 * WFRM_BUFFER ] __attribute__((aligned(0x100)));
44 volatile int wf_buffer_f3[ NB_RING_NODES_F3 * WFRM_BUFFER ] __attribute__((aligned(0x100)));
43
45
44 //***********************************
46 //***********************************
45 // SPECTRAL MATRICES GLOBAL VARIABLES
47 // SPECTRAL MATRICES GLOBAL VARIABLES
46
48
47 // alignment constraints for the spectral matrices buffers => the first data after the time (8 bytes) shall be aligned on 0x00
49 // alignment constraints for the spectral matrices buffers => the first data after the time (8 bytes) shall be aligned on 0x00
48 volatile int sm_f0[ NB_RING_NODES_SM_F0 * TOTAL_SIZE_SM ] __attribute__((aligned(0x100)));
50 volatile int sm_f0[ NB_RING_NODES_SM_F0 * TOTAL_SIZE_SM ] __attribute__((aligned(0x100)));
49 volatile int sm_f1[ NB_RING_NODES_SM_F1 * TOTAL_SIZE_SM ] __attribute__((aligned(0x100)));
51 volatile int sm_f1[ NB_RING_NODES_SM_F1 * TOTAL_SIZE_SM ] __attribute__((aligned(0x100)));
50 volatile int sm_f2[ NB_RING_NODES_SM_F2 * TOTAL_SIZE_SM ] __attribute__((aligned(0x100)));
52 volatile int sm_f2[ NB_RING_NODES_SM_F2 * TOTAL_SIZE_SM ] __attribute__((aligned(0x100)));
51
53
52 // APB CONFIGURATION REGISTERS
54 // APB CONFIGURATION REGISTERS
53 time_management_regs_t *time_management_regs = (time_management_regs_t*) REGS_ADDR_TIME_MANAGEMENT;
55 time_management_regs_t *time_management_regs = (time_management_regs_t*) REGS_ADDR_TIME_MANAGEMENT;
54 gptimer_regs_t *gptimer_regs = (gptimer_regs_t *) REGS_ADDR_GPTIMER;
56 gptimer_regs_t *gptimer_regs = (gptimer_regs_t *) REGS_ADDR_GPTIMER;
55 waveform_picker_regs_0_1_18_t *waveform_picker_regs = (waveform_picker_regs_0_1_18_t*) REGS_ADDR_WAVEFORM_PICKER;
57 waveform_picker_regs_0_1_18_t *waveform_picker_regs = (waveform_picker_regs_0_1_18_t*) REGS_ADDR_WAVEFORM_PICKER;
56 spectral_matrix_regs_t *spectral_matrix_regs = (spectral_matrix_regs_t*) REGS_ADDR_SPECTRAL_MATRIX;
58 spectral_matrix_regs_t *spectral_matrix_regs = (spectral_matrix_regs_t*) REGS_ADDR_SPECTRAL_MATRIX;
57
59
58 // MODE PARAMETERS
60 // MODE PARAMETERS
59 Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet;
61 Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet;
60 struct param_local_str param_local;
62 struct param_local_str param_local;
61 unsigned int lastValidEnterModeTime;
63 unsigned int lastValidEnterModeTime;
62
64
63 // HK PACKETS
65 // HK PACKETS
64 Packet_TM_LFR_HK_t housekeeping_packet;
66 Packet_TM_LFR_HK_t housekeeping_packet;
65 // message queues occupancy
67 // message queues occupancy
66 unsigned char hk_lfr_q_sd_fifo_size_max;
68 unsigned char hk_lfr_q_sd_fifo_size_max;
67 unsigned char hk_lfr_q_rv_fifo_size_max;
69 unsigned char hk_lfr_q_rv_fifo_size_max;
68 unsigned char hk_lfr_q_p0_fifo_size_max;
70 unsigned char hk_lfr_q_p0_fifo_size_max;
69 unsigned char hk_lfr_q_p1_fifo_size_max;
71 unsigned char hk_lfr_q_p1_fifo_size_max;
70 unsigned char hk_lfr_q_p2_fifo_size_max;
72 unsigned char hk_lfr_q_p2_fifo_size_max;
71 // sequence counters are incremented by APID (PID + CAT) and destination ID
73 // sequence counters are incremented by APID (PID + CAT) and destination ID
72 unsigned short sequenceCounters_SCIENCE_NORMAL_BURST;
74 unsigned short sequenceCounters_SCIENCE_NORMAL_BURST;
73 unsigned short sequenceCounters_SCIENCE_SBM1_SBM2;
75 unsigned short sequenceCounters_SCIENCE_SBM1_SBM2;
74 unsigned short sequenceCounters_TC_EXE[SEQ_CNT_NB_DEST_ID];
76 unsigned short sequenceCounters_TC_EXE[SEQ_CNT_NB_DEST_ID];
75 unsigned short sequenceCounters_TM_DUMP[SEQ_CNT_NB_DEST_ID];
77 unsigned short sequenceCounters_TM_DUMP[SEQ_CNT_NB_DEST_ID];
76 unsigned short sequenceCounterHK;
78 unsigned short sequenceCounterHK;
77 spw_stats spacewire_stats;
79 spw_stats spacewire_stats;
78 spw_stats spacewire_stats_backup;
80 spw_stats spacewire_stats_backup;
79
81
80
82
@@ -1,865 +1,891
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 // [spiq] [wtdg] [spacewire_reset_link]
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 initCache()
65 void initCache()
66 {
66 {
67 unsigned int cacheControlRegister;
67 unsigned int cacheControlRegister;
68
68
69 cacheControlRegister = getCacheControlRegister();
69 cacheControlRegister = getCacheControlRegister();
70 PRINTF1("(0) cacheControlRegister = %x\n", cacheControlRegister)
70 PRINTF1("(0) cacheControlRegister = %x\n", cacheControlRegister)
71
71
72 resetCacheControlRegister();
72 resetCacheControlRegister();
73
73
74 enableInstructionCache();
74 enableInstructionCache();
75 enableDataCache();
75 enableDataCache();
76 enableInstructionBurstFetch();
76 enableInstructionBurstFetch();
77
77
78 cacheControlRegister = getCacheControlRegister();
78 cacheControlRegister = getCacheControlRegister();
79 PRINTF1("(1) cacheControlRegister = %x\n", cacheControlRegister)
79 PRINTF1("(1) cacheControlRegister = %x\n", cacheControlRegister)
80 }
80 }
81
81
82 rtems_task Init( rtems_task_argument ignored )
82 rtems_task Init( rtems_task_argument ignored )
83 {
83 {
84 /** 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.
85 *
85 *
86 * @param unused is the starting argument of the RTEMS task
86 * @param unused is the starting argument of the RTEMS task
87 *
87 *
88 * The INIT task create and run all other RTEMS tasks.
88 * The INIT task create and run all other RTEMS tasks.
89 *
89 *
90 */
90 */
91
91
92 //***********
92 //***********
93 // INIT CACHE
93 // INIT CACHE
94
94
95 unsigned char *vhdlVersion;
95 unsigned char *vhdlVersion;
96
96
97 reset_lfr();
97 reset_lfr();
98
98
99 reset_local_time();
99 reset_local_time();
100
100
101 rtems_cpu_usage_reset();
101 rtems_cpu_usage_reset();
102
102
103 rtems_status_code status;
103 rtems_status_code status;
104 rtems_status_code status_spw;
104 rtems_status_code status_spw;
105 rtems_isr_entry old_isr_handler;
105 rtems_isr_entry old_isr_handler;
106
106
107 // UART settings
107 // UART settings
108 send_console_outputs_on_apbuart_port();
108 send_console_outputs_on_apbuart_port();
109 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);
110 enable_apbuart_transmitter();
110 enable_apbuart_transmitter();
111
111
112 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")
113
113
114
114
115 PRINTF("\n\n\n\n\n")
115 PRINTF("\n\n\n\n\n")
116
116
117 initCache();
117 initCache();
118
118
119 PRINTF("*************************\n")
119 PRINTF("*************************\n")
120 PRINTF("** LFR Flight Software **\n")
120 PRINTF("** LFR Flight Software **\n")
121 PRINTF1("** %d.", SW_VERSION_N1)
121 PRINTF1("** %d.", SW_VERSION_N1)
122 PRINTF1("%d." , SW_VERSION_N2)
122 PRINTF1("%d." , SW_VERSION_N2)
123 PRINTF1("%d." , SW_VERSION_N3)
123 PRINTF1("%d." , SW_VERSION_N3)
124 PRINTF1("%d **\n", SW_VERSION_N4)
124 PRINTF1("%d **\n", SW_VERSION_N4)
125
125
126 vhdlVersion = (unsigned char *) (REGS_ADDR_VHDL_VERSION);
126 vhdlVersion = (unsigned char *) (REGS_ADDR_VHDL_VERSION);
127 PRINTF("** VHDL **\n")
127 PRINTF("** VHDL **\n")
128 PRINTF1("** %d.", vhdlVersion[1])
128 PRINTF1("** %d.", vhdlVersion[1])
129 PRINTF1("%d." , vhdlVersion[2])
129 PRINTF1("%d." , vhdlVersion[2])
130 PRINTF1("%d **\n", vhdlVersion[3])
130 PRINTF1("%d **\n", vhdlVersion[3])
131 PRINTF("*************************\n")
131 PRINTF("*************************\n")
132 PRINTF("\n\n")
132 PRINTF("\n\n")
133
133
134 init_parameter_dump();
134 init_parameter_dump();
135 init_kcoefficients_dump();
135 init_kcoefficients_dump();
136 init_local_mode_parameters();
136 init_local_mode_parameters();
137 init_housekeeping_parameters();
137 init_housekeeping_parameters();
138 init_k_coefficients_prc0();
138 init_k_coefficients_prc0();
139 init_k_coefficients_prc1();
139 init_k_coefficients_prc1();
140 init_k_coefficients_prc2();
140 init_k_coefficients_prc2();
141 pa_bia_status_info = 0x00;
141 pa_bia_status_info = 0x00;
142 update_last_valid_transition_date( DEFAULT_LAST_VALID_TRANSITION_DATE );
142 update_last_valid_transition_date( DEFAULT_LAST_VALID_TRANSITION_DATE );
143
143
144 // waveform picker initialization
144 // waveform picker initialization
145 WFP_init_rings(); LEON_Clear_interrupt( IRQ_SPARC_GPTIMER_WATCHDOG ); // initialize the waveform rings
145 WFP_init_rings(); LEON_Clear_interrupt( IRQ_SPARC_GPTIMER_WATCHDOG ); // initialize the waveform rings
146 WFP_reset_current_ring_nodes();
146 WFP_reset_current_ring_nodes();
147 reset_waveform_picker_regs();
147 reset_waveform_picker_regs();
148
148
149 // spectral matrices initialization
149 // spectral matrices initialization
150 SM_init_rings(); // initialize spectral matrices rings
150 SM_init_rings(); // initialize spectral matrices rings
151 SM_reset_current_ring_nodes();
151 SM_reset_current_ring_nodes();
152 reset_spectral_matrix_regs();
152 reset_spectral_matrix_regs();
153
153
154 // configure calibration
154 // configure calibration
155 configureCalibration( false ); // true means interleaved mode, false is for normal mode
155 configureCalibration( false ); // true means interleaved mode, false is for normal mode
156
156
157 updateLFRCurrentMode();
157 updateLFRCurrentMode();
158
158
159 BOOT_PRINTF1("in INIT *** lfrCurrentMode is %d\n", lfrCurrentMode)
159 BOOT_PRINTF1("in INIT *** lfrCurrentMode is %d\n", lfrCurrentMode)
160
160
161 create_names(); // create all names
161 create_names(); // create all names
162
162
163 status = create_timecode_timer(); // create the timer used by timecode_irq_handler
164 if (status != RTEMS_SUCCESSFUL)
165 {
166 PRINTF1("in INIT *** ERR in create_timer_timecode, code %d", status)
167 }
168
163 status = create_message_queues(); // create message queues
169 status = create_message_queues(); // create message queues
164 if (status != RTEMS_SUCCESSFUL)
170 if (status != RTEMS_SUCCESSFUL)
165 {
171 {
166 PRINTF1("in INIT *** ERR in create_message_queues, code %d", status)
172 PRINTF1("in INIT *** ERR in create_message_queues, code %d", status)
167 }
173 }
168
174
169 status = create_all_tasks(); // create all tasks
175 status = create_all_tasks(); // create all tasks
170 if (status != RTEMS_SUCCESSFUL)
176 if (status != RTEMS_SUCCESSFUL)
171 {
177 {
172 PRINTF1("in INIT *** ERR in create_all_tasks, code %d\n", status)
178 PRINTF1("in INIT *** ERR in create_all_tasks, code %d\n", status)
173 }
179 }
174
180
175 // **************************
181 // **************************
176 // <SPACEWIRE INITIALIZATION>
182 // <SPACEWIRE INITIALIZATION>
177 grspw_timecode_callback = &timecode_irq_handler;
183 grspw_timecode_callback = &timecode_irq_handler;
178
184
179 status_spw = spacewire_open_link(); // (1) open the link
185 status_spw = spacewire_open_link(); // (1) open the link
180 if ( status_spw != RTEMS_SUCCESSFUL )
186 if ( status_spw != RTEMS_SUCCESSFUL )
181 {
187 {
182 PRINTF1("in INIT *** ERR spacewire_open_link code %d\n", status_spw )
188 PRINTF1("in INIT *** ERR spacewire_open_link code %d\n", status_spw )
183 }
189 }
184
190
185 if ( status_spw == RTEMS_SUCCESSFUL ) // (2) configure the link
191 if ( status_spw == RTEMS_SUCCESSFUL ) // (2) configure the link
186 {
192 {
187 status_spw = spacewire_configure_link( fdSPW );
193 status_spw = spacewire_configure_link( fdSPW );
188 if ( status_spw != RTEMS_SUCCESSFUL )
194 if ( status_spw != RTEMS_SUCCESSFUL )
189 {
195 {
190 PRINTF1("in INIT *** ERR spacewire_configure_link code %d\n", status_spw )
196 PRINTF1("in INIT *** ERR spacewire_configure_link code %d\n", status_spw )
191 }
197 }
192 }
198 }
193
199
194 if ( status_spw == RTEMS_SUCCESSFUL) // (3) start the link
200 if ( status_spw == RTEMS_SUCCESSFUL) // (3) start the link
195 {
201 {
196 status_spw = spacewire_start_link( fdSPW );
202 status_spw = spacewire_start_link( fdSPW );
197 if ( status_spw != RTEMS_SUCCESSFUL )
203 if ( status_spw != RTEMS_SUCCESSFUL )
198 {
204 {
199 PRINTF1("in INIT *** ERR spacewire_start_link code %d\n", status_spw )
205 PRINTF1("in INIT *** ERR spacewire_start_link code %d\n", status_spw )
200 }
206 }
201 }
207 }
202 // </SPACEWIRE INITIALIZATION>
208 // </SPACEWIRE INITIALIZATION>
203 // ***************************
209 // ***************************
204
210
205 status = start_all_tasks(); // start all tasks
211 status = start_all_tasks(); // start all tasks
206 if (status != RTEMS_SUCCESSFUL)
212 if (status != RTEMS_SUCCESSFUL)
207 {
213 {
208 PRINTF1("in INIT *** ERR in start_all_tasks, code %d", status)
214 PRINTF1("in INIT *** ERR in start_all_tasks, code %d", status)
209 }
215 }
210
216
211 // start RECV and SEND *AFTER* SpaceWire Initialization, due to the timeout of the start call during the initialization
217 // start RECV and SEND *AFTER* SpaceWire Initialization, due to the timeout of the start call during the initialization
212 status = start_recv_send_tasks();
218 status = start_recv_send_tasks();
213 if ( status != RTEMS_SUCCESSFUL )
219 if ( status != RTEMS_SUCCESSFUL )
214 {
220 {
215 PRINTF1("in INIT *** ERR start_recv_send_tasks code %d\n", status )
221 PRINTF1("in INIT *** ERR start_recv_send_tasks code %d\n", status )
216 }
222 }
217
223
218 // suspend science tasks, they will be restarted later depending on the mode
224 // suspend science tasks, they will be restarted later depending on the mode
219 status = suspend_science_tasks(); // suspend science tasks (not done in stop_current_mode if current mode = STANDBY)
225 status = suspend_science_tasks(); // suspend science tasks (not done in stop_current_mode if current mode = STANDBY)
220 if (status != RTEMS_SUCCESSFUL)
226 if (status != RTEMS_SUCCESSFUL)
221 {
227 {
222 PRINTF1("in INIT *** in suspend_science_tasks *** ERR code: %d\n", status)
228 PRINTF1("in INIT *** in suspend_science_tasks *** ERR code: %d\n", status)
223 }
229 }
224
230
225 // configure IRQ handling for the waveform picker unit
231 // configure IRQ handling for the waveform picker unit
226 status = rtems_interrupt_catch( waveforms_isr,
232 status = rtems_interrupt_catch( waveforms_isr,
227 IRQ_SPARC_WAVEFORM_PICKER,
233 IRQ_SPARC_WAVEFORM_PICKER,
228 &old_isr_handler) ;
234 &old_isr_handler) ;
229 // configure IRQ handling for the spectral matrices unit
235 // configure IRQ handling for the spectral matrices unit
230 status = rtems_interrupt_catch( spectral_matrices_isr,
236 status = rtems_interrupt_catch( spectral_matrices_isr,
231 IRQ_SPARC_SPECTRAL_MATRIX,
237 IRQ_SPARC_SPECTRAL_MATRIX,
232 &old_isr_handler) ;
238 &old_isr_handler) ;
233
239
234 // 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
235 if ( status_spw != RTEMS_SUCCESSFUL )
241 if ( status_spw != RTEMS_SUCCESSFUL )
236 {
242 {
237 status = rtems_event_send( Task_id[TASKID_SPIQ], SPW_LINKERR_EVENT );
243 status = rtems_event_send( Task_id[TASKID_SPIQ], SPW_LINKERR_EVENT );
238 if ( status != RTEMS_SUCCESSFUL ) {
244 if ( status != RTEMS_SUCCESSFUL ) {
239 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 )
240 }
246 }
241 }
247 }
242
248
243 BOOT_PRINTF("delete INIT\n")
249 BOOT_PRINTF("delete INIT\n")
244
250
245 set_hk_lfr_sc_potential_flag( true );
251 set_hk_lfr_sc_potential_flag( true );
246
252
247 status = rtems_task_delete(RTEMS_SELF);
253 status = rtems_task_delete(RTEMS_SELF);
248
254
249 }
255 }
250
256
251 void init_local_mode_parameters( void )
257 void init_local_mode_parameters( void )
252 {
258 {
253 /** This function initialize the param_local global variable with default values.
259 /** This function initialize the param_local global variable with default values.
254 *
260 *
255 */
261 */
256
262
257 unsigned int i;
263 unsigned int i;
258
264
259 // LOCAL PARAMETERS
265 // LOCAL PARAMETERS
260
266
261 BOOT_PRINTF1("local_sbm1_nb_cwf_max %d \n", param_local.local_sbm1_nb_cwf_max)
267 BOOT_PRINTF1("local_sbm1_nb_cwf_max %d \n", param_local.local_sbm1_nb_cwf_max)
262 BOOT_PRINTF1("local_sbm2_nb_cwf_max %d \n", param_local.local_sbm2_nb_cwf_max)
268 BOOT_PRINTF1("local_sbm2_nb_cwf_max %d \n", param_local.local_sbm2_nb_cwf_max)
263 BOOT_PRINTF1("nb_interrupt_f0_MAX = %d\n", param_local.local_nb_interrupt_f0_MAX)
269 BOOT_PRINTF1("nb_interrupt_f0_MAX = %d\n", param_local.local_nb_interrupt_f0_MAX)
264
270
265 // init sequence counters
271 // init sequence counters
266
272
267 for(i = 0; i<SEQ_CNT_NB_DEST_ID; i++)
273 for(i = 0; i<SEQ_CNT_NB_DEST_ID; i++)
268 {
274 {
269 sequenceCounters_TC_EXE[i] = 0x00;
275 sequenceCounters_TC_EXE[i] = 0x00;
270 sequenceCounters_TM_DUMP[i] = 0x00;
276 sequenceCounters_TM_DUMP[i] = 0x00;
271 }
277 }
272 sequenceCounters_SCIENCE_NORMAL_BURST = 0x00;
278 sequenceCounters_SCIENCE_NORMAL_BURST = 0x00;
273 sequenceCounters_SCIENCE_SBM1_SBM2 = 0x00;
279 sequenceCounters_SCIENCE_SBM1_SBM2 = 0x00;
274 sequenceCounterHK = TM_PACKET_SEQ_CTRL_STANDALONE << 8;
280 sequenceCounterHK = TM_PACKET_SEQ_CTRL_STANDALONE << 8;
275 }
281 }
276
282
277 void reset_local_time( void )
283 void reset_local_time( void )
278 {
284 {
279 time_management_regs->ctrl = time_management_regs->ctrl | 0x02; // [0010] software reset, coarse time = 0x80000000
285 time_management_regs->ctrl = time_management_regs->ctrl | 0x02; // [0010] software reset, coarse time = 0x80000000
280 }
286 }
281
287
282 void create_names( void ) // create all names for tasks and queues
288 void create_names( void ) // create all names for tasks and queues
283 {
289 {
284 /** This function creates all RTEMS names used in the software for tasks and queues.
290 /** This function creates all RTEMS names used in the software for tasks and queues.
285 *
291 *
286 * @return RTEMS directive status codes:
292 * @return RTEMS directive status codes:
287 * - RTEMS_SUCCESSFUL - successful completion
293 * - RTEMS_SUCCESSFUL - successful completion
288 *
294 *
289 */
295 */
290
296
291 // task names
297 // task names
292 Task_name[TASKID_RECV] = rtems_build_name( 'R', 'E', 'C', 'V' );
298 Task_name[TASKID_RECV] = rtems_build_name( 'R', 'E', 'C', 'V' );
293 Task_name[TASKID_ACTN] = rtems_build_name( 'A', 'C', 'T', 'N' );
299 Task_name[TASKID_ACTN] = rtems_build_name( 'A', 'C', 'T', 'N' );
294 Task_name[TASKID_SPIQ] = rtems_build_name( 'S', 'P', 'I', 'Q' );
300 Task_name[TASKID_SPIQ] = rtems_build_name( 'S', 'P', 'I', 'Q' );
295 Task_name[TASKID_LOAD] = rtems_build_name( 'L', 'O', 'A', 'D' );
301 Task_name[TASKID_LOAD] = rtems_build_name( 'L', 'O', 'A', 'D' );
296 Task_name[TASKID_AVF0] = rtems_build_name( 'A', 'V', 'F', '0' );
302 Task_name[TASKID_AVF0] = rtems_build_name( 'A', 'V', 'F', '0' );
297 Task_name[TASKID_SWBD] = rtems_build_name( 'S', 'W', 'B', 'D' );
303 Task_name[TASKID_SWBD] = rtems_build_name( 'S', 'W', 'B', 'D' );
298 Task_name[TASKID_WFRM] = rtems_build_name( 'W', 'F', 'R', 'M' );
304 Task_name[TASKID_WFRM] = rtems_build_name( 'W', 'F', 'R', 'M' );
299 Task_name[TASKID_DUMB] = rtems_build_name( 'D', 'U', 'M', 'B' );
305 Task_name[TASKID_DUMB] = rtems_build_name( 'D', 'U', 'M', 'B' );
300 Task_name[TASKID_HOUS] = rtems_build_name( 'H', 'O', 'U', 'S' );
306 Task_name[TASKID_HOUS] = rtems_build_name( 'H', 'O', 'U', 'S' );
301 Task_name[TASKID_PRC0] = rtems_build_name( 'P', 'R', 'C', '0' );
307 Task_name[TASKID_PRC0] = rtems_build_name( 'P', 'R', 'C', '0' );
302 Task_name[TASKID_CWF3] = rtems_build_name( 'C', 'W', 'F', '3' );
308 Task_name[TASKID_CWF3] = rtems_build_name( 'C', 'W', 'F', '3' );
303 Task_name[TASKID_CWF2] = rtems_build_name( 'C', 'W', 'F', '2' );
309 Task_name[TASKID_CWF2] = rtems_build_name( 'C', 'W', 'F', '2' );
304 Task_name[TASKID_CWF1] = rtems_build_name( 'C', 'W', 'F', '1' );
310 Task_name[TASKID_CWF1] = rtems_build_name( 'C', 'W', 'F', '1' );
305 Task_name[TASKID_SEND] = rtems_build_name( 'S', 'E', 'N', 'D' );
311 Task_name[TASKID_SEND] = rtems_build_name( 'S', 'E', 'N', 'D' );
306 Task_name[TASKID_WTDG] = rtems_build_name( 'W', 'T', 'D', 'G' );
312 Task_name[TASKID_WTDG] = rtems_build_name( 'W', 'T', 'D', 'G' );
307 Task_name[TASKID_AVF1] = rtems_build_name( 'A', 'V', 'F', '1' );
313 Task_name[TASKID_AVF1] = rtems_build_name( 'A', 'V', 'F', '1' );
308 Task_name[TASKID_PRC1] = rtems_build_name( 'P', 'R', 'C', '1' );
314 Task_name[TASKID_PRC1] = rtems_build_name( 'P', 'R', 'C', '1' );
309 Task_name[TASKID_AVF2] = rtems_build_name( 'A', 'V', 'F', '2' );
315 Task_name[TASKID_AVF2] = rtems_build_name( 'A', 'V', 'F', '2' );
310 Task_name[TASKID_PRC2] = rtems_build_name( 'P', 'R', 'C', '2' );
316 Task_name[TASKID_PRC2] = rtems_build_name( 'P', 'R', 'C', '2' );
311
317
312 // rate monotonic period names
318 // rate monotonic period names
313 name_hk_rate_monotonic = rtems_build_name( 'H', 'O', 'U', 'S' );
319 name_hk_rate_monotonic = rtems_build_name( 'H', 'O', 'U', 'S' );
314
320
315 misc_name[QUEUE_RECV] = rtems_build_name( 'Q', '_', 'R', 'V' );
321 misc_name[QUEUE_RECV] = rtems_build_name( 'Q', '_', 'R', 'V' );
316 misc_name[QUEUE_SEND] = rtems_build_name( 'Q', '_', 'S', 'D' );
322 misc_name[QUEUE_SEND] = rtems_build_name( 'Q', '_', 'S', 'D' );
317 misc_name[QUEUE_PRC0] = rtems_build_name( 'Q', '_', 'P', '0' );
323 misc_name[QUEUE_PRC0] = rtems_build_name( 'Q', '_', 'P', '0' );
318 misc_name[QUEUE_PRC1] = rtems_build_name( 'Q', '_', 'P', '1' );
324 misc_name[QUEUE_PRC1] = rtems_build_name( 'Q', '_', 'P', '1' );
319 misc_name[QUEUE_PRC2] = rtems_build_name( 'Q', '_', 'P', '2' );
325 misc_name[QUEUE_PRC2] = rtems_build_name( 'Q', '_', 'P', '2' );
326
327 timecode_timer_name = rtems_build_name( 'S', 'P', 'T', 'C' );
320 }
328 }
321
329
322 int create_all_tasks( void ) // create all tasks which run in the software
330 int create_all_tasks( void ) // create all tasks which run in the software
323 {
331 {
324 /** This function creates all RTEMS tasks used in the software.
332 /** This function creates all RTEMS tasks used in the software.
325 *
333 *
326 * @return RTEMS directive status codes:
334 * @return RTEMS directive status codes:
327 * - RTEMS_SUCCESSFUL - task created successfully
335 * - RTEMS_SUCCESSFUL - task created successfully
328 * - RTEMS_INVALID_ADDRESS - id is NULL
336 * - RTEMS_INVALID_ADDRESS - id is NULL
329 * - RTEMS_INVALID_NAME - invalid task name
337 * - RTEMS_INVALID_NAME - invalid task name
330 * - RTEMS_INVALID_PRIORITY - invalid task priority
338 * - RTEMS_INVALID_PRIORITY - invalid task priority
331 * - RTEMS_MP_NOT_CONFIGURED - multiprocessing not configured
339 * - RTEMS_MP_NOT_CONFIGURED - multiprocessing not configured
332 * - RTEMS_TOO_MANY - too many tasks created
340 * - RTEMS_TOO_MANY - too many tasks created
333 * - RTEMS_UNSATISFIED - not enough memory for stack/FP context
341 * - RTEMS_UNSATISFIED - not enough memory for stack/FP context
334 * - RTEMS_TOO_MANY - too many global objects
342 * - RTEMS_TOO_MANY - too many global objects
335 *
343 *
336 */
344 */
337
345
338 rtems_status_code status;
346 rtems_status_code status;
339
347
340 //**********
348 //**********
341 // SPACEWIRE
349 // SPACEWIRE
342 // RECV
350 // RECV
343 status = rtems_task_create(
351 status = rtems_task_create(
344 Task_name[TASKID_RECV], TASK_PRIORITY_RECV, RTEMS_MINIMUM_STACK_SIZE,
352 Task_name[TASKID_RECV], TASK_PRIORITY_RECV, RTEMS_MINIMUM_STACK_SIZE,
345 RTEMS_DEFAULT_MODES,
353 RTEMS_DEFAULT_MODES,
346 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_RECV]
354 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_RECV]
347 );
355 );
348 if (status == RTEMS_SUCCESSFUL) // SEND
356 if (status == RTEMS_SUCCESSFUL) // SEND
349 {
357 {
350 status = rtems_task_create(
358 status = rtems_task_create(
351 Task_name[TASKID_SEND], TASK_PRIORITY_SEND, RTEMS_MINIMUM_STACK_SIZE * 2,
359 Task_name[TASKID_SEND], TASK_PRIORITY_SEND, RTEMS_MINIMUM_STACK_SIZE * 2,
352 RTEMS_DEFAULT_MODES,
360 RTEMS_DEFAULT_MODES,
353 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_SEND]
361 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_SEND]
354 );
362 );
355 }
363 }
356 if (status == RTEMS_SUCCESSFUL) // WTDG
364 if (status == RTEMS_SUCCESSFUL) // WTDG
357 {
365 {
358 status = rtems_task_create(
366 status = rtems_task_create(
359 Task_name[TASKID_WTDG], TASK_PRIORITY_WTDG, RTEMS_MINIMUM_STACK_SIZE,
367 Task_name[TASKID_WTDG], TASK_PRIORITY_WTDG, RTEMS_MINIMUM_STACK_SIZE,
360 RTEMS_DEFAULT_MODES,
368 RTEMS_DEFAULT_MODES,
361 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_WTDG]
369 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_WTDG]
362 );
370 );
363 }
371 }
364 if (status == RTEMS_SUCCESSFUL) // ACTN
372 if (status == RTEMS_SUCCESSFUL) // ACTN
365 {
373 {
366 status = rtems_task_create(
374 status = rtems_task_create(
367 Task_name[TASKID_ACTN], TASK_PRIORITY_ACTN, RTEMS_MINIMUM_STACK_SIZE,
375 Task_name[TASKID_ACTN], TASK_PRIORITY_ACTN, RTEMS_MINIMUM_STACK_SIZE,
368 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
376 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
369 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_ACTN]
377 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_ACTN]
370 );
378 );
371 }
379 }
372 if (status == RTEMS_SUCCESSFUL) // SPIQ
380 if (status == RTEMS_SUCCESSFUL) // SPIQ
373 {
381 {
374 status = rtems_task_create(
382 status = rtems_task_create(
375 Task_name[TASKID_SPIQ], TASK_PRIORITY_SPIQ, RTEMS_MINIMUM_STACK_SIZE,
383 Task_name[TASKID_SPIQ], TASK_PRIORITY_SPIQ, RTEMS_MINIMUM_STACK_SIZE,
376 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
384 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
377 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SPIQ]
385 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SPIQ]
378 );
386 );
379 }
387 }
380
388
381 //******************
389 //******************
382 // SPECTRAL MATRICES
390 // SPECTRAL MATRICES
383 if (status == RTEMS_SUCCESSFUL) // AVF0
391 if (status == RTEMS_SUCCESSFUL) // AVF0
384 {
392 {
385 status = rtems_task_create(
393 status = rtems_task_create(
386 Task_name[TASKID_AVF0], TASK_PRIORITY_AVF0, RTEMS_MINIMUM_STACK_SIZE,
394 Task_name[TASKID_AVF0], TASK_PRIORITY_AVF0, RTEMS_MINIMUM_STACK_SIZE,
387 RTEMS_DEFAULT_MODES,
395 RTEMS_DEFAULT_MODES,
388 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF0]
396 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF0]
389 );
397 );
390 }
398 }
391 if (status == RTEMS_SUCCESSFUL) // PRC0
399 if (status == RTEMS_SUCCESSFUL) // PRC0
392 {
400 {
393 status = rtems_task_create(
401 status = rtems_task_create(
394 Task_name[TASKID_PRC0], TASK_PRIORITY_PRC0, RTEMS_MINIMUM_STACK_SIZE * 2,
402 Task_name[TASKID_PRC0], TASK_PRIORITY_PRC0, RTEMS_MINIMUM_STACK_SIZE * 2,
395 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
403 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
396 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_PRC0]
404 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_PRC0]
397 );