##// END OF EJS Templates
Bug 976 HK_LFR_SC_V_F3 is erroneous
paul -
r349:da15683fb282 R3++ draft
parent child
Show More
@@ -3,6 +3,8
3 3
4 4 #define NB_GPTIMER 3
5 5
6 #include <stdint.h>
7
6 8 struct apbuart_regs_str{
7 9 volatile unsigned int data;
8 10 volatile unsigned int status;
@@ -173,9 +175,12 typedef struct{
173 175 //
174 176 unsigned int buffer_length; // 0x8c = buffer length in burst 2688 / 16 = 168
175 177 //
176 volatile unsigned int v; // 0x90
177 volatile unsigned int e1; // 0x94
178 volatile unsigned int e2; // 0x98
178 volatile int16_t v_dummy; // 0x90
179 volatile int16_t v; // 0x90
180 volatile int16_t e1_dummy; // 0x94
181 volatile int16_t e1; // 0x94
182 volatile int16_t e2_dummy; // 0x98
183 volatile int16_t e2; // 0x98
179 184 } waveform_picker_regs_0_1_18_t;
180 185
181 186 //*********************
@@ -351,21 +351,21 rtems_task avgv_task(rtems_task_argument
351 351 {
352 352 #define MOVING_AVERAGE 16
353 353 rtems_status_code status;
354 static unsigned int v[MOVING_AVERAGE] = {0};
355 static unsigned int e1[MOVING_AVERAGE] = {0};
356 static unsigned int e2[MOVING_AVERAGE] = {0};
357 float average_v;
358 float average_e1;
359 float average_e2;
360 float newValue_v;
361 float newValue_e1;
362 float newValue_e2;
354 static int32_t v[MOVING_AVERAGE] = {0};
355 static int32_t e1[MOVING_AVERAGE] = {0};
356 static int32_t e2[MOVING_AVERAGE] = {0};
357 int32_t average_v;
358 int32_t average_e1;
359 int32_t average_e2;
360 int32_t newValue_v;
361 int32_t newValue_e1;
362 int32_t newValue_e2;
363 363 unsigned char k;
364 364 unsigned char indexOfOldValue;
365 365
366 366 BOOT_PRINTF("in AVGV ***\n");
367 367
368 if (rtems_rate_monotonic_ident( name_avgv_rate_monotonic, &HK_id) != RTEMS_SUCCESSFUL) {
368 if (rtems_rate_monotonic_ident( name_avgv_rate_monotonic, &AVGV_id) != RTEMS_SUCCESSFUL) {
369 369 status = rtems_rate_monotonic_create( name_avgv_rate_monotonic, &AVGV_id );
370 370 if( status != RTEMS_SUCCESSFUL ) {
371 371 PRINTF1( "rtems_rate_monotonic_create failed with status of %d\n", status );
@@ -382,12 +382,12 rtems_task avgv_task(rtems_task_argument
382 382
383 383 // initialize values
384 384 indexOfOldValue = MOVING_AVERAGE - 1;
385 average_v = INIT_FLOAT;
386 average_e1 = INIT_FLOAT;
387 average_e2 = INIT_FLOAT;
388 newValue_v = INIT_FLOAT;
389 newValue_e1 = INIT_FLOAT;
390 newValue_e2 = INIT_FLOAT;
385 average_v = 0;
386 average_e1 = 0;
387 average_e2 = 0;
388 newValue_v = 0;
389 newValue_e1 = 0;
390 newValue_e2 = 0;
391 391
392 392 k = INIT_CHAR;
393 393
@@ -401,9 +401,9 rtems_task avgv_task(rtems_task_argument
401 401 else
402 402 {
403 403 // get new values
404 newValue_v = waveform_picker_regs->v;
405 newValue_e1 = waveform_picker_regs->e1;
406 newValue_e2 = waveform_picker_regs->e2;
404 newValue_v = (int32_t) waveform_picker_regs->v;
405 newValue_e1 = (int32_t) waveform_picker_regs->e1;
406 newValue_e2 = (int32_t) waveform_picker_regs->e2;
407 407
408 408 // compute the moving average
409 409 average_v = average_v + newValue_v - v[k];
@@ -424,9 +424,9 rtems_task avgv_task(rtems_task_argument
424 424 k++;
425 425 }
426 426 //update int16 values
427 hk_lfr_sc_v_f3_as_int16 = (int16_t) (average_v / ((float) MOVING_AVERAGE) );
428 hk_lfr_sc_e1_f3_as_int16 = (int16_t) (average_e1 / ((float) MOVING_AVERAGE) );
429 hk_lfr_sc_e2_f3_as_int16 = (int16_t) (average_e2 / ((float) MOVING_AVERAGE) );
427 hk_lfr_sc_v_f3_as_int16 = (int16_t) (average_v / MOVING_AVERAGE );
428 hk_lfr_sc_e1_f3_as_int16 = (int16_t) (average_e1 / MOVING_AVERAGE );
429 hk_lfr_sc_e2_f3_as_int16 = (int16_t) (average_e2 / MOVING_AVERAGE );
430 430 }
431 431
432 432 PRINTF("in AVGV *** deleting task\n");
General Comments 0
You need to be logged in to leave comments. Login now