@@ -0,0 +1,31 | |||
|
1 | import time | |
|
2 | ||
|
3 | proxy.loadSysDriver("SpwPlugin","SpwPlugin0") | |
|
4 | SpwPlugin0.selectBridge("STAR-Dundee Spw USB Brick") | |
|
5 | ||
|
6 | proxy.loadSysDriverToParent("dsu3plugin","SpwPlugin0") | |
|
7 | proxy.loadSysDriverToParent("LFRControlPlugin","SpwPlugin0") | |
|
8 | ||
|
9 | availableBrickCount = SpwPlugin0.StarDundeeGetAvailableBrickCount() | |
|
10 | print str(availableBrickCount) + " SpaceWire brick(s) found" | |
|
11 | ||
|
12 | SpwPlugin0.StarDundeeSelectBrick(1) | |
|
13 | SpwPlugin0.StarDundeeSetBrickAsARouter(1) | |
|
14 | SpwPlugin0.StarDundeeSelectLinkNumber( 1 ) | |
|
15 | SpwPlugin0.connectBridge() | |
|
16 | ||
|
17 | #SpwPlugin0.TCPServerSetIP("127.0.0.1") | |
|
18 | SpwPlugin0.TCPServerConnect() | |
|
19 | ||
|
20 | # OPEN SPACEWIRE SERVER | |
|
21 | #LFRControlPlugin0.SetSpwServerIP(129,104,27,164) | |
|
22 | LFRControlPlugin0.TCPServerConnect() | |
|
23 | ||
|
24 | # OPEN TM ECHO BRIDGE SERVER | |
|
25 | LFRControlPlugin0.TMEchoBridgeOpenPort() | |
|
26 | ||
|
27 | # START SENDING TIMECODES AT 1 Hz | |
|
28 | SpwPlugin0.StarDundeeStartTimecodes( 1 ) | |
|
29 | ||
|
30 | # it is possible to change the time code frequency | |
|
31 | #RMAPPlugin0.changeTimecodeFrequency(2) |
@@ -0,0 +1,14 | |||
|
1 | # LOAD FSW USING LINK 1 | |
|
2 | SpwPlugin0.StarDundeeSelectLinkNumber( 1 ) | |
|
3 | ||
|
4 | dsu3plugin0.openFile("/opt/DEV_PLE/FSW-qt/bin/fsw") | |
|
5 | #dsu3plugin0.openFile("/opt/LFR/LFR-FSW/2.0.2.3/fsw") | |
|
6 | dsu3plugin0.loadFile() | |
|
7 | ||
|
8 | dsu3plugin0.run() | |
|
9 | ||
|
10 | # START SENDING TIMECODES AT 1 Hz | |
|
11 | #SpwPlugin0.StarDundeeStartTimecodes( 1 ) | |
|
12 | ||
|
13 | # it is possible to change the time code frequency | |
|
14 | #RMAPPlugin0.changeTimecodeFrequency(2) |
@@ -0,0 +1,13 | |||
|
1 | # LOAD FSW USING LINK 1 | |
|
2 | SpwPlugin0.StarDundeeSelectLinkNumber( 1 ) | |
|
3 | ||
|
4 | dsu3plugin0.openFile("/opt/LFR/LFR-FSW/3.0.0.10/fsw") | |
|
5 | dsu3plugin0.loadFile() | |
|
6 | ||
|
7 | dsu3plugin0.run() | |
|
8 | ||
|
9 | # START SENDING TIMECODES AT 1 Hz | |
|
10 | SpwPlugin0.StarDundeeStartTimecodes( 1 ) | |
|
11 | ||
|
12 | # it is possible to change the time code frequency | |
|
13 | #RMAPPlugin0.changeTimecodeFrequency(2) |
@@ -1,2 +1,2 | |||
|
1 | 1 | 3081d1f9bb20b2b64a192585337a292a9804e0c5 LFR_basic-parameters |
|
2 | 1ffa3d630b9ced4a87a362dafb10d9838e9cc0d9 header/lfr_common_headers | |
|
2 | 94f0f2fccbcb8030d9437ffbb69ee0eefaaea188 header/lfr_common_headers |
@@ -16,8 +16,8 | |||
|
16 | 16 | #include "avf1_prc1.h" |
|
17 | 17 | #include "avf2_prc2.h" |
|
18 | 18 | |
|
19 |
extern rtems_name Task_name[ |
|
|
20 |
extern rtems_id Task_id[ |
|
|
19 | extern rtems_name Task_name[]; /* array of task names */ | |
|
20 | extern rtems_id Task_id[]; /* array of task ids */ | |
|
21 | 21 | extern rtems_name timecode_timer_name; |
|
22 | 22 | extern rtems_id timecode_timer_id; |
|
23 | 23 | extern unsigned char pa_bia_status_info; |
@@ -28,6 +28,8 extern void CCR_getInstructionAndDataErr | |||
|
28 | 28 | |
|
29 | 29 | rtems_name name_hk_rate_monotonic; // name of the HK rate monotonic |
|
30 | 30 | rtems_id HK_id; // id of the HK rate monotonic period |
|
31 | rtems_name name_avgv_rate_monotonic; // name of the AVGV rate monotonic | |
|
32 | rtems_id AVGV_id; // id of the AVGV rate monotonic period | |
|
31 | 33 | |
|
32 | 34 | void timer_configure( unsigned char timer, unsigned int clock_divider, |
|
33 | 35 | unsigned char interrupt_level, rtems_isr (*timer_isr)() ); |
@@ -50,6 +52,7 void set_apbuart_scaler_reload_register( | |||
|
50 | 52 | // RTEMS TASKS |
|
51 | 53 | rtems_task load_task( rtems_task_argument argument ); |
|
52 | 54 | rtems_task hous_task( rtems_task_argument argument ); |
|
55 | rtems_task avgv_task( rtems_task_argument argument ); | |
|
53 | 56 | rtems_task dumb_task( rtems_task_argument unused ); |
|
54 | 57 | |
|
55 | 58 | void init_housekeeping_parameters( void ); |
@@ -26,7 +26,7 | |||
|
26 | 26 | #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER |
|
27 | 27 | #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER |
|
28 | 28 | |
|
29 | #define CONFIGURE_MAXIMUM_TASKS 20 | |
|
29 | #define CONFIGURE_MAXIMUM_TASKS 21 // number of tasks concurrently active including INIT | |
|
30 | 30 | #define CONFIGURE_RTEMS_INIT_TASKS_TABLE |
|
31 | 31 | #define CONFIGURE_EXTRA_TASK_STACKS (3 * RTEMS_MINIMUM_STACK_SIZE) |
|
32 | 32 | #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 32 |
@@ -34,7 +34,7 | |||
|
34 | 34 | #define CONFIGURE_INIT_TASK_MODE (RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT) |
|
35 | 35 | #define CONFIGURE_INIT_TASK_ATTRIBUTES (RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT) |
|
36 | 36 | #define CONFIGURE_MAXIMUM_DRIVERS 16 |
|
37 | #define CONFIGURE_MAXIMUM_PERIODS 5 | |
|
37 | #define CONFIGURE_MAXIMUM_PERIODS 5 // [hous] [load] [avgv] | |
|
38 | 38 | #define CONFIGURE_MAXIMUM_TIMERS 5 // [spiq] [link] [spacewire_reset_link] |
|
39 | 39 | #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 5 |
|
40 | 40 | #ifdef PRINT_STACK_REPORT |
@@ -143,10 +143,10 rtems_task Init( rtems_task_argument ign | |||
|
143 | 143 | |
|
144 | 144 | PRINTF("*************************\n") |
|
145 | 145 | PRINTF("** LFR Flight Software **\n") |
|
146 |
PRINTF1("** %d |
|
|
147 |
PRINTF1("%d |
|
|
148 |
PRINTF1("%d |
|
|
149 | PRINTF1("%d **\n", SW_VERSION_N4) | |
|
146 | PRINTF1("** %d-", SW_VERSION_N1) | |
|
147 | PRINTF1("%d-" , SW_VERSION_N2) | |
|
148 | PRINTF1("%d-" , SW_VERSION_N3) | |
|
149 | PRINTF1("%d **\n", SW_VERSION_N4) | |
|
150 | 150 | |
|
151 | 151 | vhdlVersion = (unsigned char *) (REGS_ADDR_VHDL_VERSION); |
|
152 | 152 | PRINTF("** VHDL **\n") |
@@ -342,6 +342,7 void create_names( void ) // create all | |||
|
342 | 342 | */ |
|
343 | 343 | |
|
344 | 344 | // task names |
|
345 | Task_name[TASKID_AVGV] = rtems_build_name( 'A', 'V', 'G', 'V' ); | |
|
345 | 346 | Task_name[TASKID_RECV] = rtems_build_name( 'R', 'E', 'C', 'V' ); |
|
346 | 347 | Task_name[TASKID_ACTN] = rtems_build_name( 'A', 'C', 'T', 'N' ); |
|
347 | 348 | Task_name[TASKID_SPIQ] = rtems_build_name( 'S', 'P', 'I', 'Q' ); |
@@ -364,6 +365,7 void create_names( void ) // create all | |||
|
364 | 365 | |
|
365 | 366 | // rate monotonic period names |
|
366 | 367 | name_hk_rate_monotonic = rtems_build_name( 'H', 'O', 'U', 'S' ); |
|
368 | name_avgv_rate_monotonic = rtems_build_name( 'A', 'V', 'G', 'V' ); | |
|
367 | 369 | |
|
368 | 370 | misc_name[QUEUE_RECV] = rtems_build_name( 'Q', '_', 'R', 'V' ); |
|
369 | 371 | misc_name[QUEUE_SEND] = rtems_build_name( 'Q', '_', 'S', 'D' ); |
@@ -553,6 +555,14 int create_all_tasks( void ) // create a | |||
|
553 | 555 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_HOUS] |
|
554 | 556 | ); |
|
555 | 557 | } |
|
558 | if (status == RTEMS_SUCCESSFUL) // AVGV | |
|
559 | { | |
|
560 | status = rtems_task_create( | |
|
561 | Task_name[TASKID_AVGV], TASK_PRIORITY_AVGV, RTEMS_MINIMUM_STACK_SIZE, | |
|
562 | RTEMS_DEFAULT_MODES, | |
|
563 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVGV] | |
|
564 | ); | |
|
565 | } | |
|
556 | 566 | |
|
557 | 567 | return status; |
|
558 | 568 | } |
@@ -708,6 +718,13 int start_all_tasks( void ) // start all | |||
|
708 | 718 | BOOT_PRINTF("in INIT *** Error starting TASK_HOUS\n") |
|
709 | 719 | } |
|
710 | 720 | } |
|
721 | if (status == RTEMS_SUCCESSFUL) // AVGV | |
|
722 | { | |
|
723 | status = rtems_task_start( Task_id[TASKID_AVGV], avgv_task, 1 ); | |
|
724 | if (status!=RTEMS_SUCCESSFUL) { | |
|
725 | BOOT_PRINTF("in INIT *** Error starting TASK_AVGV\n") | |
|
726 | } | |
|
727 | } | |
|
711 | 728 | if (status == RTEMS_SUCCESSFUL) // DUMB |
|
712 | 729 | { |
|
713 | 730 | status = rtems_task_start( Task_id[TASKID_DUMB], dumb_task, 1 ); |
@@ -335,6 +335,91 rtems_task hous_task(rtems_task_argument | |||
|
335 | 335 | return; |
|
336 | 336 | } |
|
337 | 337 | |
|
338 | rtems_task avgv_task(rtems_task_argument argument) | |
|
339 | { | |
|
340 | #define MOVING_AVERAGE 16 | |
|
341 | rtems_status_code status; | |
|
342 | unsigned int v[MOVING_AVERAGE]; | |
|
343 | unsigned int e1[MOVING_AVERAGE]; | |
|
344 | unsigned int e2[MOVING_AVERAGE]; | |
|
345 | float average_v; | |
|
346 | float average_e1; | |
|
347 | float average_e2; | |
|
348 | unsigned char k; | |
|
349 | unsigned char indexOfOldValue; | |
|
350 | ||
|
351 | BOOT_PRINTF("in AVGV ***\n"); | |
|
352 | ||
|
353 | if (rtems_rate_monotonic_ident( name_avgv_rate_monotonic, &HK_id) != RTEMS_SUCCESSFUL) { | |
|
354 | status = rtems_rate_monotonic_create( name_avgv_rate_monotonic, &AVGV_id ); | |
|
355 | if( status != RTEMS_SUCCESSFUL ) { | |
|
356 | PRINTF1( "rtems_rate_monotonic_create failed with status of %d\n", status ); | |
|
357 | } | |
|
358 | } | |
|
359 | ||
|
360 | status = rtems_rate_monotonic_cancel(AVGV_id); | |
|
361 | if( status != RTEMS_SUCCESSFUL ) { | |
|
362 | PRINTF1( "ERR *** in AVGV *** rtems_rate_monotonic_cancel(AVGV_id) ***code: %d\n", status ); | |
|
363 | } | |
|
364 | else { | |
|
365 | DEBUG_PRINTF("OK *** in AVGV *** rtems_rate_monotonic_cancel(AVGV_id)\n"); | |
|
366 | } | |
|
367 | ||
|
368 | // initialize values | |
|
369 | k = 0; | |
|
370 | indexOfOldValue = MOVING_AVERAGE - 1; | |
|
371 | for (k = 0; k < MOVING_AVERAGE; k++) | |
|
372 | { | |
|
373 | v[k] = 0; | |
|
374 | e1[k] = 0; | |
|
375 | e2[k] = 0; | |
|
376 | average_v = 0.; | |
|
377 | average_e1 = 0.; | |
|
378 | average_e2 = 0.; | |
|
379 | } | |
|
380 | ||
|
381 | k = 0; | |
|
382 | ||
|
383 | while(1){ // launch the rate monotonic task | |
|
384 | status = rtems_rate_monotonic_period( AVGV_id, AVGV_PERIOD ); | |
|
385 | if ( status != RTEMS_SUCCESSFUL ) { | |
|
386 | PRINTF1( "in AVGV *** ERR period: %d\n", status); | |
|
387 | } | |
|
388 | else { | |
|
389 | // store new value in buffer | |
|
390 | v[k] = waveform_picker_regs->v; | |
|
391 | e1[k] = waveform_picker_regs->e1; | |
|
392 | e2[k] = waveform_picker_regs->e2; | |
|
393 | if (k == (MOVING_AVERAGE - 1)) | |
|
394 | { | |
|
395 | indexOfOldValue = 0; | |
|
396 | } | |
|
397 | else | |
|
398 | { | |
|
399 | indexOfOldValue = k + 1; | |
|
400 | } | |
|
401 | average_v = average_v + v[k] - v[indexOfOldValue]; | |
|
402 | average_e1 = average_e1 + e1[k] - e1[indexOfOldValue]; | |
|
403 | average_e2 = average_e2 + e2[k] - e2[indexOfOldValue]; | |
|
404 | } | |
|
405 | if (k == (MOVING_AVERAGE-1)) | |
|
406 | { | |
|
407 | k = 0; | |
|
408 | printf("tick\n"); | |
|
409 | } | |
|
410 | else | |
|
411 | { | |
|
412 | k++; | |
|
413 | } | |
|
414 | } | |
|
415 | ||
|
416 | PRINTF("in AVGV *** deleting task\n") | |
|
417 | ||
|
418 | status = rtems_task_delete( RTEMS_SELF ); // should not return | |
|
419 | ||
|
420 | return; | |
|
421 | } | |
|
422 | ||
|
338 | 423 | rtems_task dumb_task( rtems_task_argument unused ) |
|
339 | 424 | { |
|
340 | 425 | /** This RTEMS taks is used to print messages without affecting the general behaviour of the software. |
General Comments 0
You need to be logged in to leave comments.
Login now