fsw_params.h
307 lines
| 10.0 KiB
| text/x-c
|
CLexer
/ header / fsw_params.h
|
r45 | #ifndef FSW_PARAMS_H_INCLUDED | ||
#define FSW_PARAMS_H_INCLUDED | ||||
|
r18 | |||
|
r40 | #include "grlib_regs.h" | ||
|
r37 | #include "fsw_params_processing.h" | ||
|
r104 | #include "fsw_params_nb_bytes.h" | ||
|
r40 | #include "tm_byte_positions.h" | ||
|
r37 | #include "ccsds_types.h" | ||
|
r31 | |||
|
r5 | #define GRSPW_DEVICE_NAME "/dev/grspw0" | ||
|
r18 | #define UART_DEVICE_NAME "/dev/console" | ||
|
r93 | typedef struct ring_node | ||
{ | ||||
struct ring_node *previous; | ||||
int buffer_address; | ||||
struct ring_node *next; | ||||
unsigned int status; | ||||
} ring_node; | ||||
|
r117 | typedef struct { | ||
|
r119 | // F0 | ||
|
r117 | unsigned int f0; | ||
unsigned int norm_bp1_f0; | ||||
unsigned int norm_bp2_f0; | ||||
unsigned int norm_asm_f0; | ||||
unsigned int sbm_bp1_f0; | ||||
unsigned int sbm_bp2_f0; | ||||
|
r119 | // F1 | ||
unsigned int f1; | ||||
unsigned int norm_bp1_f1; | ||||
unsigned int norm_bp2_f1; | ||||
unsigned int norm_asm_f1; | ||||
unsigned int sbm_bp1_f1; | ||||
unsigned int sbm_bp2_f1; | ||||
// F2 | ||||
unsigned int f2; | ||||
unsigned int norm_bp1_f2; | ||||
unsigned int norm_bp2_f2; | ||||
unsigned int norm_asm_f2; | ||||
unsigned int sbm_bp1_f2; | ||||
unsigned int sbm_bp2_f2; | ||||
|
r117 | } nb_sm_t; | ||
typedef struct { | ||||
unsigned int norm_bp1_f0; | ||||
unsigned int norm_bp2_f0; | ||||
unsigned int norm_asm_f0; | ||||
unsigned int burst_sbm_bp1_f0; | ||||
unsigned int burst_sbm_bp2_f0; | ||||
unsigned int burst_bp1_f0; | ||||
unsigned int burst_bp2_f0; | ||||
unsigned int sbm1_bp1_f0; | ||||
unsigned int sbm1_bp2_f0; | ||||
unsigned int sbm2_bp1_f0; | ||||
unsigned int sbm2_bp2_f0; | ||||
|
r119 | } nb_sm_before_bp_asm_f0; | ||
typedef struct { | ||||
unsigned int norm_bp1_f1; | ||||
unsigned int norm_bp2_f1; | ||||
unsigned int norm_asm_f1; | ||||
unsigned int burst_sbm_bp1_f1; | ||||
unsigned int burst_sbm_bp2_f1; | ||||
unsigned int burst_bp1_f1; | ||||
unsigned int burst_bp2_f1; | ||||
unsigned int sbm2_bp1_f1; | ||||
unsigned int sbm2_bp2_f1; | ||||
} nb_sm_before_bp_asm_f1; | ||||
typedef struct { | ||||
unsigned int norm_bp1_f2; | ||||
unsigned int norm_bp2_f2; | ||||
unsigned int norm_asm_f2; | ||||
unsigned int burst_sbm_bp1_f2; | ||||
unsigned int burst_sbm_bp2_f2; | ||||
unsigned int burst_bp1_f2; | ||||
unsigned int burst_bp2_f2; | ||||
unsigned int sbm2_bp1_f2; | ||||
unsigned int sbm2_bp2_f2; | ||||
} nb_sm_before_bp_asm_f2; | ||||
|
r117 | |||
|
r21 | //************************ | ||
// flight software version | ||||
// this parameters is handled by the Qt project options | ||||
|
r98 | #define NB_PACKETS_PER_GROUP_OF_CWF 8 // 8 packets containing 336 blk | ||
#define NB_PACKETS_PER_GROUP_OF_CWF_LIGHT 4 // 4 packets containing 672 blk | ||||
#define NB_SAMPLES_PER_SNAPSHOT 2688 // 336 * 8 = 672 * 4 = 2688 | ||||
|
r87 | #define TIME_OFFSET 2 | ||
|
r93 | #define TIME_OFFSET_IN_BYTES 8 | ||
|
r87 | #define WAVEFORM_EXTENDED_HEADER_OFFSET 22 | ||
#define NB_BYTES_SWF_BLK (2 * 6) | ||||
#define NB_WORDS_SWF_BLK 3 | ||||
#define NB_BYTES_CWF3_LIGHT_BLK 6 | ||||
#define WFRM_INDEX_OF_LAST_PACKET 6 // waveforms are transmitted in groups of 2048 blocks, 6 packets of 340 and 1 of 8 | ||||
|
r93 | #define NB_RING_NODES_F0 3 // AT LEAST 3 | ||
#define NB_RING_NODES_F1 5 // AT LEAST 3 | ||||
#define NB_RING_NODES_F2 5 // AT LEAST 3 | ||||
|
r87 | |||
|
r18 | //********** | ||
// LFR MODES | ||||
|
r104 | #define LFR_MODE_STANDBY 0 | ||
#define LFR_MODE_NORMAL 1 | ||||
#define LFR_MODE_BURST 2 | ||||
#define LFR_MODE_SBM1 3 | ||||
#define LFR_MODE_SBM2 4 | ||||
#define TDS_MODE_LFM 5 | ||||
#define TDS_MODE_STANDBY 0 | ||||
#define TDS_MODE_NORMAL 1 | ||||
#define TDS_MODE_BURST 2 | ||||
#define TDS_MODE_SBM1 3 | ||||
#define TDS_MODE_SBM2 4 | ||||
#define THR_MODE_STANDBY 0 | ||||
|
r112 | #define THR_MODE_NORMAL 1 | ||
|
r104 | #define THR_MODE_BURST 2 | ||
|
r18 | |||
|
r117 | #define RTEMS_EVENT_MODE_STANDBY RTEMS_EVENT_0 | ||
#define RTEMS_EVENT_MODE_NORMAL RTEMS_EVENT_1 | ||||
#define RTEMS_EVENT_MODE_BURST RTEMS_EVENT_2 | ||||
#define RTEMS_EVENT_MODE_SBM1 RTEMS_EVENT_3 | ||||
#define RTEMS_EVENT_MODE_SBM2 RTEMS_EVENT_4 | ||||
#define RTEMS_EVENT_MODE_SBM2_WFRM RTEMS_EVENT_5 | ||||
#define RTEMS_EVENT_NORM_BP1_F0 RTEMS_EVENT_6 | ||||
#define RTEMS_EVENT_NORM_BP2_F0 RTEMS_EVENT_7 | ||||
#define RTEMS_EVENT_NORM_ASM_F0 RTEMS_EVENT_8 | ||||
|
r119 | #define RTEMS_EVENT_NORM_BP1_F1 RTEMS_EVENT_9 | ||
#define RTEMS_EVENT_NORM_BP2_F1 RTEMS_EVENT_10 | ||||
#define RTEMS_EVENT_NORM_ASM_F1 RTEMS_EVENT_11 | ||||
#define RTEMS_EVENT_NORM_BP1_F2 RTEMS_EVENT_12 | ||||
#define RTEMS_EVENT_NORM_BP2_F2 RTEMS_EVENT_13 | ||||
#define RTEMS_EVENT_NORM_ASM_F2 RTEMS_EVENT_14 | ||||
#define RTEMS_EVENT_BURST_SBM_BP1_F0 RTEMS_EVENT_15 | ||||
#define RTEMS_EVENT_BURST_SBM_BP2_F0 RTEMS_EVENT_16 | ||||
#define RTEMS_EVENT_BURST_SBM_BP1_F1 RTEMS_EVENT_17 | ||||
#define RTEMS_EVENT_BURST_SBM_BP2_F1 RTEMS_EVENT_18 | ||||
#define RTEMS_EVENT_BURST_SBM_BP1_F2 RTEMS_EVENT_19 | ||||
#define RTEMS_EVENT_BURST_SBM_BP2_F2 RTEMS_EVENT_20 | ||||
|
r21 | |||
|
r23 | //**************************** | ||
// LFR DEFAULT MODE PARAMETERS | ||||
|
r28 | // COMMON | ||
#define DEFAULT_SY_LFR_COMMON0 0x00 | ||||
#define DEFAULT_SY_LFR_COMMON1 0x10 // default value 0 0 0 1 0 0 0 0 | ||||
|
r23 | // NORM | ||
|
r46 | #define SY_LFR_N_SWF_L 2048 // nb sample | ||
|
r97 | #define SY_LFR_N_SWF_P 300 // sec | ||
|
r46 | #define SY_LFR_N_ASM_P 3600 // sec | ||
#define SY_LFR_N_BP_P0 4 // sec | ||||
#define SY_LFR_N_BP_P1 20 // sec | ||||
|
r98 | #define SY_LFR_N_CWF_LONG_F3 0 // 0 => production of light continuous waveforms at f3 | ||
|
r32 | #define MIN_DELTA_SNAPSHOT 16 // sec | ||
|
r23 | // BURST | ||
#define DEFAULT_SY_LFR_B_BP_P0 1 // sec | ||||
#define DEFAULT_SY_LFR_B_BP_P1 5 // sec | ||||
// SBM1 | ||||
#define DEFAULT_SY_LFR_S1_BP_P0 1 // sec | ||||
#define DEFAULT_SY_LFR_S1_BP_P1 1 // sec | ||||
// SBM2 | ||||
#define DEFAULT_SY_LFR_S2_BP_P0 1 // sec | ||||
#define DEFAULT_SY_LFR_S2_BP_P1 5 // sec | ||||
|
r33 | // ADDITIONAL PARAMETERS | ||
#define TIME_BETWEEN_TWO_SWF_PACKETS 30 // nb x 10 ms => 300 ms | ||||
|
r46 | #define TIME_BETWEEN_TWO_CWF3_PACKETS 1000 // nb x 10 ms => 10 s | ||
// STATUS WORD | ||||
#define DEFAULT_STATUS_WORD_BYTE0 0x0d // [0000] [1] [101] mode 4 bits / SPW enabled 1 bit / state is run 3 bits | ||||
#define DEFAULT_STATUS_WORD_BYTE1 0x00 | ||||
|
r33 | // | ||
|
r46 | #define SY_LFR_DPU_CONNECT_TIMEOUT 100 // 100 * 10 ms = 1 s | ||
#define SY_LFR_DPU_CONNECT_ATTEMPT 3 | ||||
|
r33 | //**************************** | ||
|
r23 | |||
|
r18 | //***************************** | ||
// APB REGISTERS BASE ADDRESSES | ||||
|
r98 | #define REGS_ADDR_APBUART 0x80000100 | ||
#define REGS_ADDR_GPTIMER 0x80000300 | ||||
#define REGS_ADDR_GRSPW 0x80000500 | ||||
#define REGS_ADDR_TIME_MANAGEMENT 0x80000600 | ||||
|
r107 | #define REGS_ADDR_GRGPIO 0x80000b00 | ||
|
r106 | |||
#define REGS_ADDR_SPECTRAL_MATRIX 0x80000f00 | ||||
#define REGS_ADDR_WAVEFORM_PICKER 0x80000f40 | ||||
|
r31 | |||
|
r98 | #define APBUART_CTRL_REG_MASK_DB 0xfffff7ff | ||
#define APBUART_CTRL_REG_MASK_TE 0x00000002 | ||||
|
r25 | #define APBUART_SCALER_RELOAD_VALUE 0x00000050 // 25 MHz => about 38400 (0x50) | ||
|
r18 | |||
//********** | ||||
|
r12 | // IRQ LINES | ||
|
r99 | #define IRQ_SM_SIMULATOR 9 | ||
#define IRQ_SPARC_SM_SIMULATOR 0x19 // see sparcv8.pdf p.76 for interrupt levels | ||||
|
r18 | #define IRQ_WAVEFORM_PICKER 14 | ||
#define IRQ_SPARC_WAVEFORM_PICKER 0x1e // see sparcv8.pdf p.76 for interrupt levels | ||||
|
r31 | #define IRQ_SPECTRAL_MATRIX 6 | ||
#define IRQ_SPARC_SPECTRAL_MATRIX 0x16 // see sparcv8.pdf p.76 for interrupt levels | ||||
|
r18 | |||
//***** | ||||
// TIME | ||||
|
r117 | #define CLKDIV_SM_SIMULATOR (10416 - 1) // 10 ms => nominal is 1/96 = 0.010416667, 10417 - 1 = 10416 | ||
|
r18 | #define TIMER_SM_SIMULATOR 1 | ||
|
r104 | #define HK_PERIOD 100 // 100 * 10ms => 1s | ||
#define SY_LFR_TIME_SYN_TIMEOUT_in_ms 2000 | ||||
#define SY_LFR_TIME_SYN_TIMEOUT_in_ticks 200 // 200 * 10 ms = 2 s | ||||
|
r18 | |||
|
r21 | //********** | ||
// LPP CODES | ||||
|
r115 | #define LFR_SUCCESSFUL 0 | ||
#define LFR_DEFAULT 1 | ||||
#define LFR_EXE_ERROR 2 | ||||
|
r21 | |||
|
r18 | //****** | ||
// RTEMS | ||||
#define TASKID_RECV 1 | ||||
#define TASKID_ACTN 2 | ||||
#define TASKID_SPIQ 3 | ||||
#define TASKID_SMIQ 4 | ||||
#define TASKID_STAT 5 | ||||
#define TASKID_AVF0 6 | ||||
|
r105 | #define TASKID_SWBD 7 | ||
|
r18 | #define TASKID_WFRM 8 | ||
#define TASKID_DUMB 9 | ||||
#define TASKID_HOUS 10 | ||||
|
r119 | #define TASKID_PRC0 11 | ||
|
r32 | #define TASKID_CWF3 12 | ||
|
r33 | #define TASKID_CWF2 13 | ||
#define TASKID_CWF1 14 | ||||
#define TASKID_SEND 15 | ||||
|
r46 | #define TASKID_WTDG 16 | ||
|
r33 | |||
#define TASK_PRIORITY_SPIQ 5 | ||||
#define TASK_PRIORITY_SMIQ 10 | ||||
|
r46 | #define TASK_PRIORITY_WTDG 20 | ||
|
r50 | #define TASK_PRIORITY_HOUS 30 | ||
#define TASK_PRIORITY_CWF1 35 // CWF1 and CWF2 are never running together | ||||
#define TASK_PRIORITY_CWF2 35 // | ||||
|
r106 | #define TASK_PRIORITY_SWBD 37 // SWBD has a lower priority than WFRM, this is to extract the snapshot before sending it | ||
|
r34 | #define TASK_PRIORITY_WFRM 40 | ||
|
r50 | #define TASK_PRIORITY_CWF3 40 // there is a printf in this function, be careful with its priority wrt CWF1 | ||
#define TASK_PRIORITY_SEND 45 | ||||
|
r49 | #define TASK_PRIORITY_RECV 50 | ||
#define TASK_PRIORITY_ACTN 50 | ||||
|
r34 | #define TASK_PRIORITY_AVF0 60 | ||
#define TASK_PRIORITY_BPF0 60 | ||||
|
r119 | #define TASK_PRIORITY_PRC0 100 | ||
|
r34 | #define TASK_PRIORITY_STAT 200 | ||
#define TASK_PRIORITY_DUMB 200 | ||||
|
r18 | |||
|
r118 | #define MSG_QUEUE_COUNT_RECV 10 | ||
|
r119 | #define MSG_QUEUE_COUNT_SEND 50 | ||
#define MSG_QUEUE_COUNT_PRC0 10 | ||||
#define MSG_QUEUE_COUNT_PRC1 10 | ||||
|
r118 | //#define MSG_QUEUE_SIZE_SEND (PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES) | ||
|
r119 | #define MSG_QUEUE_SIZE_SEND 810 // 806 + 4 => TM_LFR_SCIENCE_BURST_BP2_F1 | ||
|
r116 | #define ACTION_MSG_SPW_IOCTL_SEND_SIZE 24 // hlen *hdr dlen *data sent options | ||
|
r119 | #define MSG_QUEUE_SIZE_PRC0 20 // two pointers and one rtems_event + 2 integers | ||
#define MSG_QUEUE_SIZE_PRC1 20 // two pointers and one rtems_event + 2 integers | ||||
|
r34 | |||
|
r42 | #define QUEUE_RECV 0 | ||
#define QUEUE_SEND 1 | ||||
|
r119 | #define QUEUE_PRC0 2 | ||
#define QUEUE_PRC1 3 | ||||
|
r18 | |||
//******* | ||||
// MACROS | ||||
|
r5 | #ifdef PRINT_MESSAGES_ON_CONSOLE | ||
#define PRINTF(x) printf(x); | ||||
#define PRINTF1(x,y) printf(x,y); | ||||
#define PRINTF2(x,y,z) printf(x,y,z); | ||||
#else | ||||
#define PRINTF(x) ; | ||||
#define PRINTF1(x,y) ; | ||||
#define PRINTF2(x,y,z) ; | ||||
|
r18 | #endif | ||
|
r35 | #ifdef BOOT_MESSAGES | ||
#define BOOT_PRINTF(x) printf(x); | ||||
#define BOOT_PRINTF1(x,y) printf(x,y); | ||||
#define BOOT_PRINTF2(x,y,z) printf(x,y,z); | ||||
#else | ||||
#define BOOT_PRINTF(x) ; | ||||
#define BOOT_PRINTF1(x,y) ; | ||||
#define BOOT_PRINTF2(x,y,z) ; | ||||
#endif | ||||
#ifdef DEBUG_MESSAGES | ||||
#define DEBUG_PRINTF(x) printf(x); | ||||
#define DEBUG_PRINTF1(x,y) printf(x,y); | ||||
#define DEBUG_PRINTF2(x,y,z) printf(x,y,z); | ||||
#else | ||||
#define DEBUG_PRINTF(x) ; | ||||
#define DEBUG_PRINTF1(x,y) ; | ||||
#define DEBUG_PRINTF2(x,y,z) ; | ||||
#endif | ||||
|
r33 | #define CPU_USAGE_REPORT_PERIOD 6 // * 10 s = period | ||
|
r23 | struct param_local_str{ | ||
unsigned int local_sbm1_nb_cwf_sent; | ||||
unsigned int local_sbm1_nb_cwf_max; | ||||
unsigned int local_sbm2_nb_cwf_sent; | ||||
unsigned int local_sbm2_nb_cwf_max; | ||||
|
r32 | unsigned int local_nb_interrupt_f0_MAX; | ||
|
r23 | }; | ||
|
r45 | #endif // FSW_PARAMS_H_INCLUDED | ||