fsw_processing.h
123 lines
| 4.2 KiB
| text/x-c
|
CLexer
/ header / fsw_processing.h
paul
|
r45 | #ifndef FSW_PROCESSING_H_INCLUDED | ||
#define FSW_PROCESSING_H_INCLUDED | ||||
paul@pc-solar1.lab-lpp.local
|
r5 | |||
paul
|
r45 | #include <rtems.h> | ||
#include <grspw.h> | ||||
#include <math.h> | ||||
#include <stdlib.h> // abs() is in the stdlib | ||||
#include <stdio.h> // printf() | ||||
paul
|
r56 | #include <math.h> | ||
paul
|
r45 | |||
#include "fsw_params.h" | ||||
paul
|
r56 | #include "fsw_spacewire.h" | ||
paul
|
r45 | |||
paul
|
r116 | typedef struct ring_node_sm | ||
{ | ||||
struct ring_node_sm *previous; | ||||
paul
|
r117 | struct ring_node_sm *next; | ||
paul
|
r116 | int buffer_address; | ||
unsigned int status; | ||||
unsigned int coarseTime; | ||||
unsigned int fineTime; | ||||
} ring_node_sm; | ||||
paul
|
r117 | typedef struct ring_node_asm | ||
paul
|
r116 | { | ||
paul
|
r117 | struct ring_node_asm *previous; | ||
struct ring_node_asm *next; | ||||
paul
|
r118 | float matrix[ TOTAL_SIZE_SM ]; | ||
paul
|
r116 | unsigned int status; | ||
paul
|
r117 | } ring_node_asm; | ||
paul
|
r116 | |||
paul
|
r117 | typedef struct bp_packet | ||
paul
|
r116 | { | ||
paul
|
r117 | Header_TM_LFR_SCIENCE_BP_t header; | ||
unsigned char data[ 30 * 22 ]; // MAX size is 22 * 30 [TM_LFR_SCIENCE_BURST_BP2_F1] | ||||
} bp_packet; | ||||
typedef struct bp_packet_with_spare | ||||
{ | ||||
paul
|
r116 | Header_TM_LFR_SCIENCE_BP_with_spare_t header; | ||
paul
|
r117 | unsigned char data[ 9 * 13 ]; // only for TM_LFR_SCIENCE_NORMAL_BP1_F0 and F1 | ||
} bp_packet_with_spare; | ||||
paul
|
r118 | typedef struct asm_msg | ||
{ | ||||
paul
|
r119 | ring_node_asm *norm; | ||
ring_node_asm *burst_sbm; | ||||
paul
|
r118 | rtems_event_set event; | ||
unsigned int coarseTime; | ||||
unsigned int fineTime; | ||||
} asm_msg; | ||||
paul
|
r117 | extern nb_sm_t nb_sm; | ||
paul
|
r119 | extern nb_sm_before_bp_asm_f0 nb_sm_before_f0; | ||
extern nb_sm_before_bp_asm_f1 nb_sm_before_f1; | ||||
extern nb_sm_before_bp_asm_f2 nb_sm_before_f2; | ||||
paul
|
r116 | |||
paul
|
r106 | extern volatile int sm_f0[ ]; | ||
extern volatile int sm_f1[ ]; | ||||
extern volatile int sm_f2[ ]; | ||||
paul
|
r32 | |||
// parameters | ||||
extern struct param_local_str param_local; | ||||
// registers | ||||
paul
|
r31 | extern time_management_regs_t *time_management_regs; | ||
extern spectral_matrix_regs_t *spectral_matrix_regs; | ||||
paul
|
r45 | extern rtems_name misc_name[5]; | ||
extern rtems_id Task_id[20]; /* array of task ids */ | ||||
paul@pc-solar1.lab-lpp.local
|
r5 | // ISR | ||
paul
|
r117 | void reset_nb_sm_f0( unsigned char lfrMode ); | ||
paul
|
r31 | rtems_isr spectral_matrices_isr( rtems_vector_number vector ); | ||
paul
|
r34 | rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector ); | ||
paul
|
r31 | |||
paul@pc-solar1.lab-lpp.local
|
r5 | // RTEMS TASKS | ||
paul
|
r117 | rtems_task smiq_task( rtems_task_argument argument ); // added to test the spectral matrix simulator | ||
rtems_task avf0_task( rtems_task_argument lfrRequestedMode ); | ||||
paul
|
r119 | rtems_task prc0_task( rtems_task_argument lfrRequestedMode ); | ||
paul@pc-solar1.lab-lpp.local
|
r17 | |||
paul
|
r117 | //****************** | ||
// Spectral Matrices | ||||
void SM_init_rings( void ); | ||||
paul
|
r118 | void ASM_init_rings( void ); | ||
paul
|
r117 | void SM_reset_current_ring_nodes( void ); | ||
void ASM_reset_current_ring_node( void ); | ||||
void ASM_init_header( Header_TM_LFR_SCIENCE_ASM_t *header); | ||||
paul
|
r116 | void SM_average(float *averaged_spec_mat_f0, float *averaged_spec_mat_f1, | ||
paul
|
r113 | ring_node_sm *ring_node_tab[], | ||
unsigned int firstTimeF0, unsigned int firstTimeF1 ); | ||||
paul
|
r115 | void ASM_reorganize_and_divide(float *averaged_spec_mat, float *averaged_spec_mat_reorganized, | ||
float divider ); | ||||
void ASM_compress_reorganize_and_divide(float *averaged_spec_mat, float *compressed_spec_mat, | ||||
float divider, | ||||
unsigned char nbBinsCompressedMatrix, unsigned char nbBinsToAverage , unsigned char ASMIndexStart); | ||||
paul
|
r103 | void ASM_convert(volatile float *input_matrix, char *output_matrix); | ||
void ASM_send(Header_TM_LFR_SCIENCE_ASM_t *header, char *spectral_matrix, | ||||
paul
|
r35 | unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send, rtems_id queue_id); | ||
paul
|
r115 | |||
paul
|
r117 | //***************** | ||
// Basic Parameters | ||||
void BP_reset_current_ring_nodes( void ); | ||||
void BP_init_header(Header_TM_LFR_SCIENCE_BP_t *header, | ||||
unsigned int apid, unsigned char sid, | ||||
unsigned int packetLength , unsigned char blkNr); | ||||
void BP_init_header_with_spare(Header_TM_LFR_SCIENCE_BP_with_spare_t *header, | ||||
unsigned int apid, unsigned char sid, | ||||
unsigned int packetLength, unsigned char blkNr ); | ||||
paul
|
r116 | void BP_send(char *data, | ||
rtems_id queue_id , | ||||
unsigned int nbBytesToSend ); | ||||
paul
|
r115 | |||
paul
|
r117 | //****************** | ||
// general functions | ||||
paul
|
r115 | void reset_spectral_matrix_regs( void ); | ||
paul
|
r117 | void set_time(unsigned char *time, unsigned char *timeInBuffer ); | ||
paul
|
r116 | |||
paul
|
r119 | extern rtems_status_code get_message_queue_id_prc0( rtems_id *queue_id ); | ||
extern rtems_status_code get_message_queue_id_prc1( rtems_id *queue_id ); | ||||
paul
|
r118 | |||
paul
|
r45 | #endif // FSW_PROCESSING_H_INCLUDED | ||