##// END OF EJS Templates
3.2.0.11...
3.2.0.11 filter updated in AVGV

File last commit:

r361:3e73a8516099 R3++
r361:3e73a8516099 R3++
Show More
fsw_misc.c
1036 lines | 37.8 KiB | text/x-c | CLexer
paul
Minor changes in .h inclusion
r45 /** General usage functions and RTEMS tasks.
*
* @file
* @author P. LEROY
*
*/
paul
Header files inclusion reworked...
r40 #include "fsw_misc.h"
paul@pc-solar1.lab-lpp.local
Naming convention changed...
r5
paul
compliance with ICD 4.3...
r328 int16_t hk_lfr_sc_v_f3_as_int16 = 0;
int16_t hk_lfr_sc_e1_f3_as_int16 = 0;
int16_t hk_lfr_sc_e2_f3_as_int16 = 0;
paul
STAT task removec...
r239 void timer_configure(unsigned char timer, unsigned int clock_divider,
paul@pc-solar1.lab-lpp.local
Naming convention changed...
r5 unsigned char interrupt_level, rtems_isr (*timer_isr)() )
paul
Minor changes in .h inclusion
r45 {
/** This function configures a GPTIMER timer instantiated in the VHDL design.
*
* @param gptimer_regs points to the APB registers of the GPTIMER IP core.
* @param timer is the number of the timer in the IP core (several timers can be instantiated).
* @param clock_divider is the divider of the 1 MHz clock that will be configured.
* @param interrupt_level is the interrupt level that the timer drives.
* @param timer_isr is the interrupt subroutine that will be attached to the IRQ driven by the timer.
*
* Interrupt levels are described in the SPARC documentation sparcv8.pdf p.76
*
*/
paul@pc-solar1.lab-lpp.local
Current version with modes NORMAL and SBM1 operational
r21 rtems_status_code status;
paul@pc-solar1.lab-lpp.local
Naming convention changed...
r5 rtems_isr_entry old_isr_handler;
paul
Bug #801 Don_Initialisation_P2
r320 old_isr_handler = NULL;
paul
Many corrections, mainly related to #807 Don_Enumeration
r318 gptimer_regs->timer[timer].ctrl = INIT_CHAR; // reset the control register
paul
SM simulator functionnal...
r100
paul@pc-solar1.lab-lpp.local
Current version with modes NORMAL and SBM1 operational
r21 status = rtems_interrupt_catch( timer_isr, interrupt_level, &old_isr_handler) ; // see sparcv8.pdf p.76 for interrupt levels
paul
Last commit before release 0-13...
r35 if (status!=RTEMS_SUCCESSFUL)
paul
SID corrected in TM_LFR_TC_EXE packets...
r31 {
paul
Last commit before release 0-13...
r35 PRINTF("in configure_timer *** ERR rtems_interrupt_catch\n")
paul
SID corrected in TM_LFR_TC_EXE packets...
r31 }
paul@pc-solar1.lab-lpp.local
Naming convention changed...
r5
paul
STAT task removec...
r239 timer_set_clock_divider( timer, clock_divider);
paul
SID corrected in TM_LFR_TC_EXE packets...
r31 }
paul
STAT task removec...
r239 void timer_start(unsigned char timer)
paul
SID corrected in TM_LFR_TC_EXE packets...
r31 {
paul
Minor changes in .h inclusion
r45 /** This function starts a GPTIMER timer.
*
* @param gptimer_regs points to the APB registers of the GPTIMER IP core.
* @param timer is the number of the timer in the IP core (several timers can be instantiated).
*
*/
paul
Many corrections, mainly related to #807 Don_Enumeration
r318 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | GPTIMER_CLEAR_IRQ;
gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | GPTIMER_LD;
gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | GPTIMER_EN;
gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | GPTIMER_RS;
gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | GPTIMER_IE;
paul@pc-solar1.lab-lpp.local
Naming convention changed...
r5 }
paul
STAT task removec...
r239 void timer_stop(unsigned char timer)
paul
SID corrected in TM_LFR_TC_EXE packets...
r31 {
paul
Minor changes in .h inclusion
r45 /** This function stops a GPTIMER timer.
*
* @param gptimer_regs points to the APB registers of the GPTIMER IP core.
* @param timer is the number of the timer in the IP core (several timers can be instantiated).
*
*/
paul
Many corrections, mainly related to #807 Don_Enumeration
r318 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl & GPTIMER_EN_MASK;
gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl & GPTIMER_IE_MASK;
gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | GPTIMER_CLEAR_IRQ;
paul
SID corrected in TM_LFR_TC_EXE packets...
r31 }
paul
STAT task removec...
r239 void timer_set_clock_divider(unsigned char timer, unsigned int clock_divider)
paul
SID corrected in TM_LFR_TC_EXE packets...
r31 {
paul
Minor changes in .h inclusion
r45 /** This function sets the clock divider of a GPTIMER timer.
*
* @param gptimer_regs points to the APB registers of the GPTIMER IP core.
* @param timer is the number of the timer in the IP core (several timers can be instantiated).
* @param clock_divider is the divider of the 1 MHz clock that will be configured.
*
*/
paul
SID corrected in TM_LFR_TC_EXE packets...
r31 gptimer_regs->timer[timer].reload = clock_divider; // base clock frequency is 1 MHz
}
paul
STAT task removec...
r239 // WATCHDOG
rtems_isr watchdog_isr( rtems_vector_number vector )
{
rtems_status_code status_code;
status_code = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_12 );
paul
sy_lfr_watchdog_enabled handled...
r262
PRINTF("watchdog_isr *** this is the end, exit(0)\n");
exit(0);
paul
STAT task removec...
r239 }
void watchdog_configure(void)
{
/** This function configure the watchdog.
*
* @param gptimer_regs points to the APB registers of the GPTIMER IP core.
* @param timer is the number of the timer in the IP core (several timers can be instantiated).
*
* The watchdog is a timer provided by the GPTIMER IP core of the GRLIB.
*
*/
LEON_Mask_interrupt( IRQ_GPTIMER_WATCHDOG ); // mask gptimer/watchdog interrupt during configuration
timer_configure( TIMER_WATCHDOG, CLKDIV_WATCHDOG, IRQ_SPARC_GPTIMER_WATCHDOG, watchdog_isr );
LEON_Clear_interrupt( IRQ_GPTIMER_WATCHDOG ); // clear gptimer/watchdog interrupt
}
void watchdog_stop(void)
{
LEON_Mask_interrupt( IRQ_GPTIMER_WATCHDOG ); // mask gptimer/watchdog interrupt line
timer_stop( TIMER_WATCHDOG );
LEON_Clear_interrupt( IRQ_GPTIMER_WATCHDOG ); // clear gptimer/watchdog interrupt
}
void watchdog_reload(void)
{
/** This function reloads the watchdog timer counter with the timer reload value.
*
paul
EDAC information fetching functions added.
r251 * @param void
*
* @return void
paul
STAT task removec...
r239 *
*/
paul
Many corrections, mainly related to #807 Don_Enumeration
r318 gptimer_regs->timer[TIMER_WATCHDOG].ctrl = gptimer_regs->timer[TIMER_WATCHDOG].ctrl | GPTIMER_LD;
paul
STAT task removec...
r239 }
void watchdog_start(void)
{
/** This function starts the watchdog timer.
*
* @param gptimer_regs points to the APB registers of the GPTIMER IP core.
* @param timer is the number of the timer in the IP core (several timers can be instantiated).
*
*/
LEON_Clear_interrupt( IRQ_GPTIMER_WATCHDOG );
paul
Many corrections, mainly related to #807 Don_Enumeration
r318 gptimer_regs->timer[TIMER_WATCHDOG].ctrl = gptimer_regs->timer[TIMER_WATCHDOG].ctrl | GPTIMER_CLEAR_IRQ;
gptimer_regs->timer[TIMER_WATCHDOG].ctrl = gptimer_regs->timer[TIMER_WATCHDOG].ctrl | GPTIMER_LD;
gptimer_regs->timer[TIMER_WATCHDOG].ctrl = gptimer_regs->timer[TIMER_WATCHDOG].ctrl | GPTIMER_EN;
gptimer_regs->timer[TIMER_WATCHDOG].ctrl = gptimer_regs->timer[TIMER_WATCHDOG].ctrl | GPTIMER_IE;
paul
STAT task removec...
r239
LEON_Unmask_interrupt( IRQ_GPTIMER_WATCHDOG );
}
paul
Snapshot resynchro rewritten, drift is measured one snapshot in two...
r253 int enable_apbuart_transmitter( void ) // set the bit 1, TE Transmitter Enable to 1 in the APBUART control register
paul@pc-solar1.lab-lpp.local
Naming convention changed...
r5 {
paul@pc-solar1.lab-lpp.local
Updates of the ICD taken into account...
r18 struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) REGS_ADDR_APBUART;
paul@pc-solar1.lab-lpp.local
Current version with modes NORMAL and SBM1 operational
r21
paul
Sync
r95 apbuart_regs->ctrl = APBUART_CTRL_REG_MASK_TE;
paul
Minor changes
r94
return 0;
}
paul
Header files inclusion reworked...
r40 void set_apbuart_scaler_reload_register(unsigned int regs, unsigned int value)
paul@pc-solar1.lab-lpp.local
automatic reconnexion of the spacewire link...
r17 {
paul
Header files inclusion reworked...
r40 /** This function sets the scaler reload register of the apbuart module
*
* @param regs is the address of the apbuart registers in memory
* @param value is the value that will be stored in the scaler register
*
* The value shall be set by the software to get data on the serial interface.
*
*/
paul@pc-solar1.lab-lpp.local
Updates of the ICD taken into account...
r18 struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) regs;
paul@pc-solar1.lab-lpp.local
Current version with modes NORMAL and SBM1 operational
r21
apbuart_regs->scaler = value;
paul
Snapshot resynchro rewritten, drift is measured one snapshot in two...
r253
paul
Last commit before release 0-13...
r35 BOOT_PRINTF1("OK *** apbuart port scaler reload register set to 0x%x\n", value)
paul@pc-solar1.lab-lpp.local
automatic reconnexion of the spacewire link...
r17 }
//************
// RTEMS TASKS
paul
STAT task removec...
r239 rtems_task load_task(rtems_task_argument argument)
paul@pc-solar1.lab-lpp.local
Current version with modes NORMAL and SBM1 operational
r21 {
paul
STAT task removec...
r239 BOOT_PRINTF("in LOAD *** \n")
rtems_status_code status;
unsigned int i;
unsigned int j;
rtems_name name_watchdog_rate_monotonic; // name of the watchdog rate monotonic
rtems_id watchdog_period_id; // id of the watchdog rate monotonic period
paul
Bug #801 Don_Initialisation_P2
r320 watchdog_period_id = RTEMS_ID_NONE;
paul
STAT task removec...
r239 name_watchdog_rate_monotonic = rtems_build_name( 'L', 'O', 'A', 'D' );
status = rtems_rate_monotonic_create( name_watchdog_rate_monotonic, &watchdog_period_id );
if( status != RTEMS_SUCCESSFUL ) {
PRINTF1( "in LOAD *** rtems_rate_monotonic_create failed with status of %d\n", status )
}
paul@pc-solar1.lab-lpp.local
automatic reconnexion of the spacewire link...
r17 i = 0;
paul@pc-solar1.lab-lpp.local
Current version with modes NORMAL and SBM1 operational
r21 j = 0;
paul
STAT task removec...
r239
watchdog_configure();
watchdog_start();
paul
sy_lfr_watchdog_enabled handled...
r262 set_sy_lfr_watchdog_enabled( true );
paul@pc-solar1.lab-lpp.local
Current version with modes NORMAL and SBM1 operational
r21 while(1){
paul
STAT task removec...
r239 status = rtems_rate_monotonic_period( watchdog_period_id, WATCHDOG_PERIOD );
watchdog_reload();
i = i + 1;
paul
Many corrections, mainly related to #807 Don_Enumeration
r318 if ( i == WATCHDOG_LOOP_PRINTF )
paul
STAT task removec...
r239 {
paul@pc-solar1.lab-lpp.local
Current version with modes NORMAL and SBM1 operational
r21 i = 0;
paul
STAT task removec...
r239 j = j + 1;
PRINTF1("%d\n", j)
paul@pc-solar1.lab-lpp.local
Current version with modes NORMAL and SBM1 operational
r21 }
paul
sync before modifying the snapshot resynchronization
r246 #ifdef DEBUG_WATCHDOG
paul
Many corrections, mainly related to #807 Don_Enumeration
r318 if (j == WATCHDOG_LOOP_DEBUG )
paul
STAT task removec...
r239 {
status = rtems_task_delete(RTEMS_SELF);
}
paul
sync before modifying the snapshot resynchronization
r246 #endif
paul@pc-solar1.lab-lpp.local
Current version with modes NORMAL and SBM1 operational
r21 }
paul@pc-solar1.lab-lpp.local
Naming convention changed...
r5 }
paul@pc-solar1.lab-lpp.local
Current version with modes NORMAL and SBM1 operational
r21
rtems_task hous_task(rtems_task_argument argument)
paul@pc-solar1.lab-lpp.local
automatic reconnexion of the spacewire link...
r17 {
paul@pc-solar1.lab-lpp.local
Updates of the ICD taken into account...
r18 rtems_status_code status;
paul
Many corrections done after Logiscope analysis
r166 rtems_status_code spare_status;
paul
Last commit before release 0-13...
r35 rtems_id queue_id;
paul
rev 1.0.0.2...
r104 rtems_rate_monotonic_period_status period_status;
paul
Bug #803 Tr_BoucleSortie...
r319 bool isSynchronized;
paul
Bug #801 Don_Initialisation_P2
r320 queue_id = RTEMS_ID_NONE;
memset(&period_status, 0, sizeof(rtems_rate_monotonic_period_status));
paul
Bug #803 Tr_BoucleSortie...
r319 isSynchronized = false;
paul
packet emission task added...
r33
paul
fsw-1-0...
r82 status = get_message_queue_id_send( &queue_id );
paul
Last commit before release 0-13...
r35 if (status != RTEMS_SUCCESSFUL)
{
paul
fsw-1-0...
r82 PRINTF1("in HOUS *** ERR get_message_queue_id_send %d\n", status)
paul
Last commit before release 0-13...
r35 }
paul
ASM restart sequence updated at the interrupt service routine level...
r259 BOOT_PRINTF("in HOUS ***\n");
paul@pc-solar1.lab-lpp.local
automatic reconnexion of the spacewire link...
r17
paul
Ignore doc files...
r46 if (rtems_rate_monotonic_ident( name_hk_rate_monotonic, &HK_id) != RTEMS_SUCCESSFUL) {
status = rtems_rate_monotonic_create( name_hk_rate_monotonic, &HK_id );
paul@pc-solar1.lab-lpp.local
Updates of the ICD taken into account...
r18 if( status != RTEMS_SUCCESSFUL ) {
paul
ASM restart sequence updated at the interrupt service routine level...
r259 PRINTF1( "rtems_rate_monotonic_create failed with status of %d\n", status );
paul@pc-solar1.lab-lpp.local
Updates of the ICD taken into account...
r18 }
paul@pc-solar1.lab-lpp.local
automatic reconnexion of the spacewire link...
r17 }
status = rtems_rate_monotonic_cancel(HK_id);
paul@pc-solar1.lab-lpp.local
All modes implemented for the waveforms...
r23 if( status != RTEMS_SUCCESSFUL ) {
paul
ASM restart sequence updated at the interrupt service routine level...
r259 PRINTF1( "ERR *** in HOUS *** rtems_rate_monotonic_cancel(HK_id) ***code: %d\n", status );
paul@pc-solar1.lab-lpp.local
All modes implemented for the waveforms...
r23 }
else {
paul
ASM restart sequence updated at the interrupt service routine level...
r259 DEBUG_PRINTF("OK *** in HOUS *** rtems_rate_monotonic_cancel(HK_id)\n");
paul@pc-solar1.lab-lpp.local
All modes implemented for the waveforms...
r23 }
paul@pc-solar1.lab-lpp.local
Current version with modes NORMAL and SBM1 operational
r21
paul
rev 1.0.0.2...
r104 // startup phase
status = rtems_rate_monotonic_period( HK_id, SY_LFR_TIME_SYN_TIMEOUT_in_ticks );
status = rtems_rate_monotonic_get_status( HK_id, &period_status );
DEBUG_PRINTF1("startup HK, HK_id status = %d\n", period_status.state)
paul
Bug #803 Tr_BoucleSortie...
r319 while( (period_status.state != RATE_MONOTONIC_EXPIRED)
&& (isSynchronized == false) ) // after SY_LFR_TIME_SYN_TIMEOUT ms, starts HK anyway
paul
rev 1.0.0.2...
r104 {
paul
Many corrections, mainly related to #807 Don_Enumeration
r318 if ((time_management_regs->coarse_time & VAL_LFR_SYNCHRONIZED) == INT32_ALL_0) // check time synchronization
paul
rev 1.0.0.2...
r104 {
paul
Bug #803 Tr_BoucleSortie...
r319 isSynchronized = true;
paul
rev 1.0.0.2...
r104 }
else
{
status = rtems_rate_monotonic_get_status( HK_id, &period_status );
paul
Many corrections, mainly related to #807 Don_Enumeration
r318
status = rtems_task_wake_after( HK_SYNC_WAIT ); // wait HK_SYNCH_WAIT 100 ms = 10 * 10 ms
paul
rev 1.0.0.2...
r104 }
}
status = rtems_rate_monotonic_cancel(HK_id);
DEBUG_PRINTF1("startup HK, HK_id status = %d\n", period_status.state)
paul
reset cause set to POWER_ON, no other value
r280 set_hk_lfr_reset_cause( POWER_ON );
paul
correction de Bug #514, lfr_reset_cause = power_on
r226
paul@pc-solar1.lab-lpp.local
automatic reconnexion of the spacewire link...
r17 while(1){ // launch the rate monotonic task
paul@pc-solar1.lab-lpp.local
Current version with modes NORMAL and SBM1 operational
r21 status = rtems_rate_monotonic_period( HK_id, HK_PERIOD );
paul@pc-solar1.lab-lpp.local
All modes implemented for the waveforms...
r23 if ( status != RTEMS_SUCCESSFUL ) {
paul
priority modifications...
r50 PRINTF1( "in HOUS *** ERR period: %d\n", status);
paul
Many corrections done after Logiscope analysis
r166 spare_status = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_6 );
paul@pc-solar1.lab-lpp.local
automatic reconnexion of the spacewire link...
r17 }
paul@pc-solar1.lab-lpp.local
All modes implemented for the waveforms...
r23 else {
paul
Many corrections, mainly related to #807 Don_Enumeration
r318 housekeeping_packet.packetSequenceControl[BYTE_0] = (unsigned char) (sequenceCounterHK >> SHIFT_1_BYTE);
housekeeping_packet.packetSequenceControl[BYTE_1] = (unsigned char) (sequenceCounterHK );
paul
Bug #117
r149 increment_seq_counter( &sequenceCounterHK );
paul
Many corrections, mainly related to #807 Don_Enumeration
r318 housekeeping_packet.time[BYTE_0] = (unsigned char) (time_management_regs->coarse_time >> SHIFT_3_BYTES);
housekeeping_packet.time[BYTE_1] = (unsigned char) (time_management_regs->coarse_time >> SHIFT_2_BYTES);
housekeeping_packet.time[BYTE_2] = (unsigned char) (time_management_regs->coarse_time >> SHIFT_1_BYTE);
housekeeping_packet.time[BYTE_3] = (unsigned char) (time_management_regs->coarse_time);
housekeeping_packet.time[BYTE_4] = (unsigned char) (time_management_regs->fine_time >> SHIFT_1_BYTE);
housekeeping_packet.time[BYTE_5] = (unsigned char) (time_management_regs->fine_time);
paul@pc-solar1.lab-lpp.local
All modes implemented for the waveforms...
r23
paul
modifications following #634:...
r279 spacewire_update_hk_lfr_link_state( &housekeeping_packet.lfr_status_word[0] );
paul
spacewire statistics management modified...
r264 spacewire_read_statistics();
paul@pc-solar1.lab-lpp.local
All modes implemented for the waveforms...
r23
paul
spacewire statistics management modified...
r264 update_hk_with_grspw_stats();
paul
snapshot synchronization slightly upgraded...
r263
paul
hk_lfr_time_not_synchro is updated each time the synchro is lost....
r249 set_hk_lfr_time_not_synchro();
paul
fifo occupation reported in the HK packet
r197 housekeeping_packet.hk_lfr_q_sd_fifo_size_max = hk_lfr_q_sd_fifo_size_max;
housekeeping_packet.hk_lfr_q_rv_fifo_size_max = hk_lfr_q_rv_fifo_size_max;
housekeeping_packet.hk_lfr_q_p0_fifo_size_max = hk_lfr_q_p0_fifo_size_max;
housekeeping_packet.hk_lfr_q_p1_fifo_size_max = hk_lfr_q_p1_fifo_size_max;
housekeeping_packet.hk_lfr_q_p2_fifo_size_max = hk_lfr_q_p2_fifo_size_max;
paul
R2 parameter added to TC_LFR_LOAD_COMMON_PAR...
r195 housekeeping_packet.sy_lfr_common_parameters_spare = parameter_dump_packet.sy_lfr_common_parameters_spare;
housekeeping_packet.sy_lfr_common_parameters = parameter_dump_packet.sy_lfr_common_parameters;
paul
2.0.2.1
r185 get_temperatures( housekeeping_packet.hk_lfr_temp_scm );
get_v_e1_e2_f3( housekeeping_packet.hk_lfr_sc_v_f3 );
paul
cpu_load added to the housekeeping packets
r134 get_cpu_load( (unsigned char *) &housekeeping_packet.hk_lfr_cpu_load );
paul
The HK packet contains v, e1 and e2 valid data at f3....
r129
paul
#601 corrected: hk_lfr_le_me_he_update moved
r261 hk_lfr_le_me_he_update();
paul
SID corrected in TM_LFR_TC_EXE packets...
r31 // SEND PACKET
paul
New version of the waveform picker packet transmission...
r172 status = rtems_message_queue_send( queue_id, &housekeeping_packet,
paul
Ignore doc files...
r46 PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES);
paul
packet emission task added...
r33 if (status != RTEMS_SUCCESSFUL) {
paul
priority modifications...
r50 PRINTF1("in HOUS *** ERR send: %d\n", status)
paul@pc-solar1.lab-lpp.local
automatic reconnexion of the spacewire link...
r17 }
paul@pc-solar1.lab-lpp.local
Current version with modes NORMAL and SBM1 operational
r21 }
}
paul@pc-solar1.lab-lpp.local
Naming convention changed...
r5
paul@pc-solar1.lab-lpp.local
automatic reconnexion of the spacewire link...
r17 PRINTF("in HOUS *** deleting task\n")
paul@pc-solar1.lab-lpp.local
Current version with modes NORMAL and SBM1 operational
r21
status = rtems_task_delete( RTEMS_SELF ); // should not return
paul
printf removed or replaced by PRINTF macros...
r227
paul
Minor changes in .h inclusion
r45 return;
paul@pc-solar1.lab-lpp.local
fsw-0-2 delivery to LESIA...
r16 }
paul
3.2.0.10...
r360 int filter( int x, filter_ctx* ctx )
{
static const int b[NB_COEFFS][NB_COEFFS]={ {B00, B01, B02}, {B10, B11, B12}, {B20, B21, B22} };
static const int a[NB_COEFFS][NB_COEFFS]={ {A00, A01, A02}, {A10, A11, A12}, {A20, A21, A22} };
paul
3.2.0.11...
r361 static const int b_gain[NB_COEFFS]={GAIN_B0, GAIN_B1, GAIN_B2};
static const int a_gain[NB_COEFFS]={GAIN_A0, GAIN_A1, GAIN_A2};
paul
3.2.0.10...
r360
paul
3.2.0.11...
r361 int_fast32_t W;
paul
3.2.0.10...
r360 int i;
W = INIT_INT;
i = INIT_INT;
//Direct-Form-II
for ( i = 0; i < NB_COEFFS; i++ )
{
paul
3.2.0.11...
r361 x = x << a_gain[i];
W = (x - ( a[i][COEFF1] * ctx->W[i][COEFF0] )
- ( a[i][COEFF2] * ctx->W[i][COEFF1] ) ) >> a_gain[i];
paul
3.2.0.10...
r360 x = ( b[i][COEFF0] * W )
+ ( b[i][COEFF1] * ctx->W[i][COEFF0] )
+ ( b[i][COEFF2] * ctx->W[i][COEFF1] );
paul
3.2.0.11...
r361 x = x >> b_gain[i];
ctx->W[i][1] = ctx->W[i][0];
ctx->W[i][0] = W;
paul
3.2.0.10...
r360 }
return x;
}
paul
AVGV task added...
r298 rtems_task avgv_task(rtems_task_argument argument)
{
#define MOVING_AVERAGE 16
rtems_status_code status;
paul
Bug #976 HK_LFR_SC_V_F3 is erroneous
r349 static int32_t v[MOVING_AVERAGE] = {0};
static int32_t e1[MOVING_AVERAGE] = {0};
static int32_t e2[MOVING_AVERAGE] = {0};
paul
3.2.0.7...
r357 static int old_v = 0;
static int old_e1 = 0;
static int old_e2 = 0;
paul
3.2.0.9...
r359 int32_t current_v;
int32_t current_e1;
int32_t current_e2;
paul
Bug #976 HK_LFR_SC_V_F3 is erroneous
r349 int32_t average_v;
int32_t average_e1;
int32_t average_e2;
int32_t newValue_v;
int32_t newValue_e1;
int32_t newValue_e2;
paul
AVGV task added...
r298 unsigned char k;
unsigned char indexOfOldValue;
paul
3.2.0.10...
r360 static filter_ctx ctx_v = { { {0,0,0}, {0,0,0}, {0,0,0} } };
static filter_ctx ctx_e1 = { { {0,0,0}, {0,0,0}, {0,0,0} } };
static filter_ctx ctx_e2 = { { {0,0,0}, {0,0,0}, {0,0,0} } };
paul
AVGV task added...
r298 BOOT_PRINTF("in AVGV ***\n");
paul
Bug #976 HK_LFR_SC_V_F3 is erroneous
r349 if (rtems_rate_monotonic_ident( name_avgv_rate_monotonic, &AVGV_id) != RTEMS_SUCCESSFUL) {
paul
AVGV task added...
r298 status = rtems_rate_monotonic_create( name_avgv_rate_monotonic, &AVGV_id );
if( status != RTEMS_SUCCESSFUL ) {
PRINTF1( "rtems_rate_monotonic_create failed with status of %d\n", status );
}
}
status = rtems_rate_monotonic_cancel(AVGV_id);
if( status != RTEMS_SUCCESSFUL ) {
PRINTF1( "ERR *** in AVGV *** rtems_rate_monotonic_cancel(AVGV_id) ***code: %d\n", status );
}
else {
DEBUG_PRINTF("OK *** in AVGV *** rtems_rate_monotonic_cancel(AVGV_id)\n");
}
// initialize values
indexOfOldValue = MOVING_AVERAGE - 1;
paul
3.2.0.7...
r357 current_v = 0;
current_e1 = 0;
current_e2 = 0;
paul
Bug #976 HK_LFR_SC_V_F3 is erroneous
r349 average_v = 0;
average_e1 = 0;
average_e2 = 0;
newValue_v = 0;
newValue_e1 = 0;
newValue_e2 = 0;
paul
AVGV task added...
r298
paul
compliance with ICD 4.3...
r328 k = INIT_CHAR;
paul
AVGV task added...
r298
paul
compliance with ICD 4.3...
r328 while(1)
{ // launch the rate monotonic task
paul
AVGV task added...
r298 status = rtems_rate_monotonic_period( AVGV_id, AVGV_PERIOD );
paul
compliance with ICD 4.3...
r328 if ( status != RTEMS_SUCCESSFUL )
{
paul
AVGV task added...
r298 PRINTF1( "in AVGV *** ERR period: %d\n", status);
}
paul
compliance with ICD 4.3...
r328 else
{
paul
3.2.0.7...
r357 current_v = waveform_picker_regs->v;
current_e1 = waveform_picker_regs->e1;
current_e2 = waveform_picker_regs->e2;
paul
3.2.0.9...
r359 if ( (current_v != old_v)
|| (current_e1 != old_e1)
|| (current_e2 != old_e2))
{
paul
3.2.0.10...
r360 average_v = filter( current_v, &ctx_v );
average_e1 = filter( current_e1, &ctx_e1 );
average_e2 = filter( current_e2, &ctx_e2 );
paul
3.2.0.9...
r359
paul
3.2.0.7...
r357 //update int16 values
hk_lfr_sc_v_f3_as_int16 = (int16_t) (average_v / MOVING_AVERAGE );
hk_lfr_sc_e1_f3_as_int16 = (int16_t) (average_e1 / MOVING_AVERAGE );
hk_lfr_sc_e2_f3_as_int16 = (int16_t) (average_e2 / MOVING_AVERAGE );
paul
3.2.0.9...
r359 }
paul
3.2.0.7...
r357 old_v = current_v;
old_e1 = current_e1;
old_e2 = current_e2;
paul
AVGV task added...
r298 }
}
paul
compliance with ICD 4.3...
r328 PRINTF("in AVGV *** deleting task\n");
paul
AVGV task added...
r298
paul
compliance with ICD 4.3...
r328 status = rtems_task_delete( RTEMS_SELF ); // should not return
paul
AVGV task added...
r298
return;
}
paul
Minor changes in .h inclusion
r45 rtems_task dumb_task( rtems_task_argument unused )
paul
packet emission task added...
r33 {
paul
Minor changes in .h inclusion
r45 /** This RTEMS taks is used to print messages without affecting the general behaviour of the software.
*
* @param unused is the starting argument of the RTEMS task
*
* The DUMB taks waits for RTEMS events and print messages depending on the incoming events.
*
*/
paul
Last commit before release 0-13...
r35
paul
Minor changes in .h inclusion
r45 unsigned int i;
unsigned int intEventOut;
unsigned int coarse_time = 0;