diff --git a/FSW-qt/Leon3_sparc_sim.ld b/FSW-qt/Leon3_sparc_sim.ld deleted file mode 100644 --- a/FSW-qt/Leon3_sparc_sim.ld +++ /dev/null @@ -1,185 +0,0 @@ -/* linkcmds - * - * $Id: linkcmds,v 1.8.2.1 2000/05/24 17:06:38 joel Exp $ - */ - -OUTPUT_ARCH(sparc) -__DYNAMIC = 0; - -/* - * The memory map looks like this: - * +--------------------+ <- low memory - * | .text | - * | etext | - * | ctor list | the ctor and dtor lists are for - * | dtor list | C++ support - * | _endtext | - * +--------------------+ - * | .data | initialized data goes here - * | _sdata | - * | _edata | - * +--------------------+ - * | .bss | - * | __bss_start | start of bss, cleared by crt0 - * | _end | start of heap, used by sbrk() - * +--------------------+ - * | heap space | - * | _ENDHEAP | - * | stack space | - * | __stack | top of stack - * +--------------------+ <- high memory - */ - - -/* - * User modifiable values: - * - * _CLOCK_SPEED in Mhz (used to program the counter/timers) - * - * _PROM_SIZE size of PROM (permissible values are 128K, 256K, - * 512K, 1M, 2M, 4M, 8M and 16M) - * _RAM_SIZE size of RAM (permissible values are 256K, 512K, - * 1M, 2M, 4M, 8M, 16M, and 32M) - * - */ - -/* Default values, can be overridden */ - -_PROM_SIZE = 2M; -_RAM_SIZE = 4M; - -_RAM_START = 0x02000000; -_RAM_END = _RAM_START + _RAM_SIZE; - -_PROM_START = 0x00000000; -_PROM_END = _PROM_START + _PROM_SIZE; - -/* - * Alternate names without leading _. - */ - -PROM_START = _PROM_START; -PROM_SIZE = _PROM_SIZE; -PROM_END = _PROM_END; - -RAM_START = _RAM_START; -RAM_SIZE = _RAM_SIZE; -RAM_END = _RAM_END; - -_LEON_REG = 0x80000000; -LEON_REG = 0x80000000; -_ERC32_MEC = 0x1f80000; -ERC32_MEC = 0x1f80000; - -/* these are the maximum values */ - -MEMORY -{ - rom : ORIGIN = 0x00000000, LENGTH = 16M - ram : ORIGIN = 0x40000000, LENGTH = 1024M -} - -/* - * stick everything in ram (of course) - */ -SECTIONS -{ - .text : - { - CREATE_OBJECT_SYMBOLS - text_start = .; - _text_start = .; - *(.text) - *(.text.*) - . = ALIGN (16); - - *(.eh_frame) - . = ALIGN (16); - - *(.gnu.linkonce.t*) - - /* - * C++ constructors - */ - __CTOR_LIST__ = .; - LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2) - *(.ctors) - *(.ctors.*) - LONG(0) - __CTOR_END__ = .; - __DTOR_LIST__ = .; - LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2) - *(.dtors) - *(.dtors.*) - LONG(0) - __DTOR_END__ = .; - - _rodata_start = . ; - *(.rodata*) - *(.fixup) - *(.gnu.linkonce.r*) - _erodata = ALIGN( 0x10 ) ; - - etext = ALIGN(0x10); - _etext = .; - *(.init) - *(.fini) - *(.lit) - *(.shdata) - . = ALIGN (16); - _endtext = .; - } > rom - .dynamic : { *(.dynamic) } >ram - .got : { *(.got) } >ram - .plt : { *(.plt) } >ram - .hash : { *(.hash) } >ram - .dynrel : { *(.dynrel) } >ram - .dynsym : { *(.dynsym) } >ram - .dynstr : { *(.dynstr) } >ram - .hash : { *(.hash) } >ram - .data : - { - data_start = .; - _data_start = .; - _sdata = . ; - - KEEP (*(.vectors)) - - *(.data) - *(.data.*) - *(.gnu.linkonce.d*) - *(.gcc_except_table) - KEEP(*( SORT (.ecos.table.*))) ; - . = ALIGN(0x10); - edata = .; - _edata = .; - } > ram - .shbss : - { - *(.shbss) - } > ram - .bss : - { - __bss_start = ALIGN(0x8); - _bss_start = .; - bss_start = .; - *(.bss) - *(.bss.*) - *(COMMON) - end = .; - _end = ALIGN(0x8); - __end = ALIGN(0x8); - __bss_end = ALIGN(0x8); - __heap1 = .; - } > ram - .jcr . (NOLOAD) : { *(.jcr) } - .stab . (NOLOAD) : - { - [ .stab ] - } - .stabstr . (NOLOAD) : - { - [ .stabstr ] - } -} - diff --git a/FSW-qt/Leon3_startup_sim.S b/FSW-qt/Leon3_startup_sim.S deleted file mode 100644 --- a/FSW-qt/Leon3_startup_sim.S +++ /dev/null @@ -1,220 +0,0 @@ - -/* Template boot-code for LEON3 test benches */ - - -#ifndef STACKSIZE -#define STACKSIZE 0x00020000 -#endif - - - .seg "text" - .proc 0 - .align 4 - .global start -start: - - flush - set 0x10e0, %g1 ! init IU - mov %g1, %psr - mov %g0, %wim - mov %g0, %tbr - mov %g0, %y - mov %g0, %asr16 - nop - set 0x81000f, %g1 - sta %g1, [%g0] 2 - mov %g0, %g2 - nop - nop - nop - nop - nop - or %g2, %g2, %g0 - nop - nop - nop - nop - nop -#ifdef DSUADDR - set DSUADDR, %g2 - st %g0, [%g2] - st %g0, [%g2+0x08] - st %g0, [%g2+0x20] - st %g0, [%g2+0x24] - st %g0, [%g2+0x40] - st %g0, [%g2+0x44] - st %g0, [%g2+0x50] - st %g0, [%g2+0x54] - st %g0, [%g2+0x58] - st %g0, [%g2+0x5C] - st %g0, [%g2+0x54] -#endif - -2: - mov %asr17, %g3 - and %g3, 0x1f, %g3 - mov %g0, %g4 - mov %g0, %g5 - mov %g0, %g6 - mov %g0, %g7 -1: - mov %g0, %l0 - mov %g0, %l1 - mov %g0, %l2 - mov %g0, %l3 - mov %g0, %l4 - mov %g0, %l5 - mov %g0, %l6 - mov %g0, %l7 - mov %g0, %o0 - mov %g0, %o1 - mov %g0, %o2 - mov %g0, %o3 - mov %g0, %o4 - mov %g0, %o5 - mov %g0, %o6 - mov %g0, %o7 - subcc %g3, 1, %g3 - bge 1b - save - - mov 2, %g1 - mov %g1, %wim - set 0x10e0, %g1 ! enable traps - mov %g1, %psr - nop; nop; nop; - - mov %psr, %g1 - srl %g1, 12, %g1 - andcc %g1, 1, %g0 - be 1f - nop - - set _fsrxx, %g3 - ld [%g3], %fsr - ldd [%g3], %f0 - ldd [%g3], %f2 - ldd [%g3], %f4 - ldd [%g3], %f6 - ldd [%g3], %f8 - ldd [%g3], %f10 - ldd [%g3], %f12 - ldd [%g3], %f14 - ldd [%g3], %f16 - ldd [%g3], %f18 - ldd [%g3], %f20 - ldd [%g3], %f22 - ldd [%g3], %f24 - ldd [%g3], %f26 - ldd [%g3], %f28 - ldd [%g3], %f30 - nop - nop - nop - nop - nop - faddd %f0, %f2, %f4 - nop - nop - nop - nop - ba 1f - nop - - -.align 8 -_fsrxx: - .word 0 - .word 0 - -1: - mov %asr17, %g3 - srl %g3, 28, %g3 - andcc %g3, 0x0f, %g3 - bne 1f - - set L2MCTRLIO, %g1 - set MCFG1, %g2 - st %g2, [%g1] - set MCFG2, %g2 - st %g2, [%g1+4] - set MCFG3, %g2 - st %g2, [%g1+8] -! set IRQCTRL, %g1 -! set 0x0ffff, %g2 -! st %g2, [%g1+0x10] - -#ifdef DDR2CTRLIO - set DDR2CTRLIO, %g1 - set DDR2CFG4, %g2 - st %g2, [%g1+12] -#endif - -#ifdef ASDCFG -#ifndef SDCTRLPNP -#define SDCTRLPNP 0xFFFFF860 -#endif - set SDCTRLPNP, %g1 - ld [%g1], %g2 - srl %g2, 12, %g2 - set 0x01009, %g1 - subcc %g1, %g2, %g0 - bne 1f - - set ASDCFG, %g1 - set DSDCFG, %g2 - st %g2, [%g1] -#endif - - ! %g3 = cpu index -1: set STACKSIZE, %g2 - mov %g0, %g1 -2: subcc %g3, 0, %g0 - be 3f - nop - add %g1, %g2, %g1 - ba 2b - sub %g3, 1, %g3 - - -3: set RAMSTART+ RAMSIZE-32, %fp - sub %fp, %g1, %fp - sub %fp, 96, %sp - - set main, %g1 - call %g1 - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop -inf_loop: - ta 0x20 - jmp inf_loop -.align 32 - diff --git a/FSW-qt/bin/LEON3_LOAD.py b/FSW-qt/bin/LEON3_LOAD.py new file mode 100644 --- /dev/null +++ b/FSW-qt/bin/LEON3_LOAD.py @@ -0,0 +1,9 @@ +#!/usr/bin/lppmon -e + +proxy.loadSysDriver("AHBUARTplugin","AHBUART"); +proxy.loadSysDriverToParent("dsu3plugin","AHBUART"); +proxy.loadSysDriverToParent("APB UART PLUGIN","AHBUART"); +AHBUART.open("/dev/ttyUSB0",30000000) +dsu3plugin0.openFile("/opt/DEV_PLE/FSW-qt/bin/fsw-vhdl-dev") +dsu3plugin0.loadFile() +dsu3plugin0.run() diff --git a/FSW-qt/bin/LEON3_LOAD_SPW.py b/FSW-qt/bin/LEON3_LOAD_SPW.py new file mode 100644 --- /dev/null +++ b/FSW-qt/bin/LEON3_LOAD_SPW.py @@ -0,0 +1,13 @@ +#!/usr/bin/lppmon -e + +proxy.loadSysDriver("RMAPPlugin","RMAPplugin0"); +proxy.loadSysDriverToParent("dsu3plugin","RMAPplugin0"); + +#BUTTON_selectStarDundee.click() +BUTTON_selectGRESB.click() + +BUTTON_rmapOpenCommunication.click() +dsu3plugin0.openFile("/opt/DEV_PLE/FSW-qt/bin/fsw-vhdl-dev") +dsu3plugin0.loadFile() +dsu3plugin0.run() + diff --git a/FSW-qt/bin/LEON3_RELOAD_SPW.py b/FSW-qt/bin/LEON3_RELOAD_SPW.py new file mode 100644 --- /dev/null +++ b/FSW-qt/bin/LEON3_RELOAD_SPW.py @@ -0,0 +1,6 @@ +#!/usr/bin/lppmon -e + +dsu3plugin0.openFile("/opt/DEV_PLE/FSW-qt/bin/fsw-vhdl-dev") +dsu3plugin0.loadFile() +dsu3plugin0.run() + diff --git a/header/fsw_misc.h b/header/fsw_misc.h --- a/header/fsw_misc.h +++ b/header/fsw_misc.h @@ -23,6 +23,7 @@ void timer_set_clock_divider(gptimer_reg // SERIAL LINK int send_console_outputs_on_apbuart_port( void ); +int enable_apbuart_transmitter( void ); void set_apbuart_scaler_reload_register(unsigned int regs, unsigned int value); // RTEMS TASKS diff --git a/header/fsw_params.h b/header/fsw_params.h --- a/header/fsw_params.h +++ b/header/fsw_params.h @@ -46,12 +46,15 @@ typedef struct ring_node #define LFR_MODE_SBM2 4 #define LFR_MODE_NORMAL_CWF_F3 5 -#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_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_MODE_NORMAL_SWF_F0 RTEMS_EVENT_6 +#define RTEMS_EVENT_MODE_NORMAL_SWF_F1 RTEMS_EVENT_7 +#define RTEMS_EVENT_MODE_NORMAL_SWF_F2 RTEMS_EVENT_8 //**************************** // LFR DEFAULT MODE PARAMETERS @@ -99,6 +102,7 @@ typedef struct ring_node #endif #define APBUART_CTRL_REG_MASK_DB 0xfffff7ff +#define APBUART_CTRL_REG_MASK_TE 0x00000002 #define APBUART_SCALER_RELOAD_VALUE 0x00000050 // 25 MHz => about 38400 (0x50) //********** diff --git a/src/fsw_init.c b/src/fsw_init.c --- a/src/fsw_init.c +++ b/src/fsw_init.c @@ -76,8 +76,10 @@ rtems_task Init( rtems_task_argument ign rtems_isr_entry old_isr_handler; // UART settings + set_apbuart_scaler_reload_register(REGS_ADDR_APBUART, APBUART_SCALER_RELOAD_VALUE); send_console_outputs_on_apbuart_port(); - set_apbuart_scaler_reload_register(REGS_ADDR_APBUART, APBUART_SCALER_RELOAD_VALUE); + enable_apbuart_transmitter(); + PRINTF("\n\n\n\n\nIn INIT *** Now the console is on port COM1\n") BOOT_PRINTF("\n\n\n\n\n") BOOT_PRINTF("***************************\n") diff --git a/src/fsw_misc.c b/src/fsw_misc.c --- a/src/fsw_misc.c +++ b/src/fsw_misc.c @@ -7,15 +7,6 @@ #include "fsw_misc.h" -//char *DumbMessages[7] = {"in DUMB *** default", // RTEMS_EVENT_0 -// "in DUMB *** timecode_irq_handler", // RTEMS_EVENT_1 -// "in DUMB *** waveforms_isr", // RTEMS_EVENT_2 -// "in DUMB *** in SMIQ *** Error sending event to AVF0", // RTEMS_EVENT_3 -// "in DUMB *** spectral_matrices_isr *** Error sending event to SMIQ", // RTEMS_EVENT_4 -// "in DUMB *** waveforms_simulator_isr", // RTEMS_EVENT_5 -// "ERR HK" // RTEMS_EVENT_6 -//}; - void configure_timer(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider, unsigned char interrupt_level, rtems_isr (*timer_isr)() ) { @@ -91,7 +82,15 @@ int send_console_outputs_on_apbuart_port struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) REGS_ADDR_APBUART; apbuart_regs->ctrl = apbuart_regs->ctrl & APBUART_CTRL_REG_MASK_DB; - PRINTF("\n\n\n\n\nIn INIT *** Now the console is on port COM1\n") + + return 0; +} + +int enable_apbuart_transmitter( void ) // set the bit 1, TE Transmitter Enable to 1 in the APBUART control register +{ + struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) REGS_ADDR_APBUART; + + apbuart_regs->ctrl = apbuart_regs->ctrl | APBUART_CTRL_REG_MASK_TE; return 0; } @@ -255,6 +254,7 @@ rtems_task dumb_task( rtems_task_argumen coarse_time = time_management_regs->coarse_time; fine_time = time_management_regs->fine_time; printf("in DUMB *** coarse: %x, fine: %x, %s\n", coarse_time, fine_time, DumbMessages[i]); + PRINTF1("status = %x\n", waveform_picker_regs->status) } } } diff --git a/src/wf_handler.c b/src/wf_handler.c --- a/src/wf_handler.c +++ b/src/wf_handler.c @@ -46,8 +46,6 @@ rtems_isr waveforms_isr( rtems_vector_nu * */ - static unsigned char nb_swf = 0; - if ( (lfrCurrentMode == LFR_MODE_NORMAL) || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) { // in modes other than STANDBY and BURST, send the CWF_F3 data @@ -77,7 +75,12 @@ rtems_isr waveforms_isr( rtems_vector_nu //****** // NORMAL case(LFR_MODE_NORMAL): - if ( (waveform_picker_regs->status & 0x7) == 0x7 ){ // f2 f1 and f0 are full + if ( (waveform_picker_regs->status & 0xff8) != 0x00) // [1000] check the error bits + { + rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); + } + if ( (waveform_picker_regs->status & 0x07) == 0x07) // [0111] check the f2, f1, f0 full bits + { // change F0 ring node ring_node_to_send_swf_f0 = current_ring_node_f0; current_ring_node_f0 = current_ring_node_f0->next; @@ -90,20 +93,13 @@ rtems_isr waveforms_isr( rtems_vector_nu ring_node_to_send_swf_f2 = current_ring_node_f2; current_ring_node_f2 = current_ring_node_f2->next; waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address; - // send an event to the WFRM task + // if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) { rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); } -// nb_swf = nb_swf + 1; -// if (nb_swf == 2) -// { -// reset_wfp_burst_enable(); -// } -// else -// { - waveform_picker_regs->status = waveform_picker_regs->status & 0xfffff888; // [1000 1000 1000] -// } + waveform_picker_regs->status = waveform_picker_regs->status & 0xfffff888; // [1000 1000 1000] } + break; //****** @@ -213,19 +209,28 @@ rtems_task wfrm_task(rtems_task_argument while(1){ // wait for an RTEMS_EVENT rtems_event_receive(RTEMS_EVENT_MODE_NORMAL | RTEMS_EVENT_MODE_SBM1 - | RTEMS_EVENT_MODE_SBM2 | RTEMS_EVENT_MODE_SBM2_WFRM, + | RTEMS_EVENT_MODE_SBM2 | RTEMS_EVENT_MODE_SBM2_WFRM + | RTEMS_EVENT_MODE_NORMAL_SWF_F0 + | RTEMS_EVENT_MODE_NORMAL_SWF_F1 + | RTEMS_EVENT_MODE_NORMAL_SWF_F2, RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); if (event_out == RTEMS_EVENT_MODE_NORMAL) { - PRINTF1("status %x\n", waveform_picker_regs->status ) send_waveform_SWF((volatile int*) ring_node_to_send_swf_f0->buffer_address, SID_NORM_SWF_F0, headerSWF_F0, queue_id); send_waveform_SWF((volatile int*) ring_node_to_send_swf_f1->buffer_address, SID_NORM_SWF_F1, headerSWF_F1, queue_id); send_waveform_SWF((volatile int*) ring_node_to_send_swf_f2->buffer_address, SID_NORM_SWF_F2, headerSWF_F2, queue_id); - waveform_picker_regs->status = waveform_picker_regs->status & 0xfffff888; // [1000 1000 1000] + } + if ( (event_out & RTEMS_EVENT_MODE_NORMAL_SWF_F0) == RTEMS_EVENT_MODE_NORMAL_SWF_F0) + { + send_waveform_SWF((volatile int*) ring_node_to_send_swf_f0->buffer_address, SID_NORM_SWF_F0, headerSWF_F0, queue_id); } - else + if ( (event_out & RTEMS_EVENT_MODE_NORMAL_SWF_F1) == RTEMS_EVENT_MODE_NORMAL_SWF_F1) { - PRINTF("in WFRM *** unexpected event") + send_waveform_SWF((volatile int*) ring_node_to_send_swf_f1->buffer_address, SID_NORM_SWF_F1, headerSWF_F1, queue_id); + } + if ( (event_out & RTEMS_EVENT_MODE_NORMAL_SWF_F2) == RTEMS_EVENT_MODE_NORMAL_SWF_F2) + { + send_waveform_SWF((volatile int*) ring_node_to_send_swf_f2->buffer_address, SID_NORM_SWF_F2, headerSWF_F2, queue_id); } } } @@ -1126,17 +1131,23 @@ void reset_waveform_picker_regs() waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_a); // 0x14 waveform_picker_regs->status = 0x00; // 0x18 // -// waveform_picker_regs->delta_snapshot = 0x1000; // 0x1c *** 4096 = 16 * 256 -// waveform_picker_regs->delta_f0 = 0xc0b; // 0x20 *** 3083 = 4096 - 1013 -// waveform_picker_regs->delta_f0_2 = 0x7; // 0x24 *** 7 [7 bits] -// waveform_picker_regs->delta_f1 = 0xc40; // 0x28 *** 3136 = 4096 - 960 -// waveform_picker_regs->delta_f2 = 0xc00; // 0x2c *** 3072 = 12 * 256 + waveform_picker_regs->delta_snapshot = 0x1000; // 0x1c *** 4096 = 16 * 256 + waveform_picker_regs->delta_f0 = 0xc0b; // 0x20 *** 3083 = 4096 - 1013 + waveform_picker_regs->delta_f0_2 = 0x7; // 0x24 *** 7 [7 bits] + waveform_picker_regs->delta_f1 = 0xc40; // 0x28 *** 3136 = 4096 - 960 + waveform_picker_regs->delta_f2 = 0xc00; // 0x2c *** 3072 = 12 * 256 // - waveform_picker_regs->delta_snapshot = 0x1000; // 0x1c *** 4096 = 16 * 256 - waveform_picker_regs->delta_f0 = 0x1; // 0x20 *** - waveform_picker_regs->delta_f0_2 = 0x7; // 0x24 *** 7 [7 bits] - waveform_picker_regs->delta_f1 = 0x1; // 0x28 *** - waveform_picker_regs->delta_f2 = 0x1; // 0x2c *** +// waveform_picker_regs->delta_snapshot = 0x1000; // 0x1c *** 4096 = 16 * 256 +// waveform_picker_regs->delta_f0 = 0x1; // 0x20 *** +// waveform_picker_regs->delta_f0_2 = 0x7; // 0x24 *** 7 [7 bits] +// waveform_picker_regs->delta_f1 = 0x1; // 0x28 *** +// waveform_picker_regs->delta_f2 = 0x1; // 0x2c *** + // +// waveform_picker_regs->delta_snapshot = 0x1000; // 0x1c *** 4096 = 16 * 256 +// waveform_picker_regs->delta_f0 = 0x0fff; // 0x20 *** +// waveform_picker_regs->delta_f0_2 = 0x7; // 0x24 *** 7 [7 bits] +// waveform_picker_regs->delta_f1 = 0x0fff; // 0x28 *** +// waveform_picker_regs->delta_f2 = 0x1; // 0x2c *** // 2048 // waveform_picker_regs->nb_data_by_buffer = 0x7ff; // 0x30 *** 2048 -1 => nb samples -1 // waveform_picker_regs->snapshot_param = 0x800; // 0x34 *** 2048 => nb samples