##// END OF EJS Templates
rev 3.0.0.0
paul -
r198:c53fb904ef31 R3
parent child
Show More
@@ -1,81 +1,72
1 1 #include <stdio.h>
2 2
3 3 #include "grspw.h"
4 4 #include "fsw_params.h"
5 5
6 6 #define DSU_TIME_TAG_COUNTER 0x90000008
7 7
8 8 //**********
9 9 // IRQ LINES
10 10 #define IRQ_GRSPW 11
11 11 #define IRQ_SPARC_GRSPW 0x1b // see sparcv8.pdf p.76 for interrupt levels
12 12
13 13 extern void *catch_interrupt(void func(), int irq);
14 14 int *lreg = (int *) 0x80000000;
15 15
16 16 #define ICLEAR 0x20c
17 17 #define IMASK 0x240
18 18 #define IFORCE 0x208
19 19
20 20 void enable_irq (int irq)
21 21 {
22 22 lreg[ICLEAR/4] = (1 << irq); // clear any pending irq
23 23 lreg[IMASK/4] |= (1 << irq); // unmaks irq
24 24 }
25 25
26 26 void disable_irq (int irq) { lreg[IMASK/4] &= ~(1 << irq); } // mask irq
27 27
28 28 void force_irq (int irq) { lreg[IFORCE/4] = (1 << irq); } // force irq
29 29
30 30 /* NOTE: NEVER put printf() or other stdio routines in interrupt handlers,
31 31 they are not re-entrant. This (bad) example is just a demo */
32 32
33 unsigned char processTimecode = 0;
33 volatile unsigned char processTimecode = 0;
34 unsigned int counter = 0;
34 35
35 36 void irqhandler(int irq)
36 37 {
37 38 processTimecode = 1;
39 counter ++;
38 40 }
39 41
40 42 int main( void )
41 43 {
42 44 unsigned int *grspwCtrlReg;
43 45 unsigned int k;
44 46 volatile unsigned int *reg;
45 47 float aux;
46 unsigned int counter = 0;
47 48
48 49 printf("hello world!\n");
49 50
50 51 grspwCtrlReg = (unsigned int*) REGS_ADDR_GRSPW;
51 52 grspw_set_ie( 1, grspwCtrlReg );
52 53 grspw_set_tq( 1, grspwCtrlReg );
53 54 grspw_set_tr( 1, grspwCtrlReg );
54 55
55 56 catch_interrupt(irqhandler, IRQ_GRSPW);
56 57 enable_irq( IRQ_GRSPW );
57 58 force_irq( IRQ_GRSPW );
58 59
59 60 reg = (volatile unsigned int *) DSU_TIME_TAG_COUNTER;
60 61
61 62 while(1)
62 63 {
63 if (processTimecode == 1)
64 {
65 counter ++;
66 printf("timecode counter = %d\n", counter);
67 processTimecode = 0;
68 }
69 else
70 {
71 printf(".");
72 }
73
74 // for (k=0; k<100000;k++)
64 // if (processTimecode == 1)
75 65 // {
76 // aux = aux + *reg ;
66 // printf("timecode counter = %d\n", counter);
67 // processTimecode = 0;
77 68 // }
78 69 }
79 70
80 71 return 0;
81 72 }
@@ -1,17 +1,13
1 1 # LOAD FSW USING LINK 1
2 2 SpwPlugin0.StarDundeeSelectLinkNumber( 1 )
3 3
4 APB_UART_PLUGIN0.setFifoDebugEnabled( 0 )
5
6 4 dsu3plugin0.openFile("/opt/DEV_PLE/EQM/bin/eqm")
7 5 dsu3plugin0.loadFile()
8 6
9 7 dsu3plugin0.run()
10 8
11 APB_UART_PLUGIN0.setFifoDebugEnabled( 1 )
12
13 9 # START SENDING TIMECODES AT 1 Hz
14 10 SpwPlugin0.StarDundeeStartTimecodes( 1 )
15 11
16 12 # it is possible to change the time code frequency
17 13 #RMAPPlugin0.changeTimecodeFrequency(2)
@@ -1,34 +1,31
1 1 import time
2 2
3 3 proxy.loadSysDriver("SpwPlugin","SpwPlugin0")
4 4 SpwPlugin0.selectBridge("STAR-Dundee Spw USB Brick")
5 5
6 6 proxy.loadSysDriverToParent("dsu3plugin","SpwPlugin0")
7 7 proxy.loadSysDriverToParent("LFRControlPlugin","SpwPlugin0")
8 8
9 proxy.loadSysDriverToParent("APB_UART_PLUGIN","SpwPlugin0")
10 APB_UART_PLUGIN0.setFifoDebugEnabled( 1 )
11
12 9 availableBrickCount = SpwPlugin0.StarDundeeGetAvailableBrickCount()
13 10 print str(availableBrickCount) + " SpaceWire brick(s) found"
14 11
15 12 SpwPlugin0.StarDundeeSelectBrick(1)
16 13 SpwPlugin0.StarDundeeSetBrickAsARouter(1)
17 14 SpwPlugin0.StarDundeeSelectLinkNumber( 1 )
18 15 SpwPlugin0.connectBridge()
19 16
20 17 #SpwPlugin0.TCPServerSetIP("127.0.0.1")
21 18 SpwPlugin0.TCPServerConnect()
22 19
23 20 # OPEN SPACEWIRE SERVER
24 21 #LFRControlPlugin0.SetSpwServerIP(129,104,27,164)
25 22 LFRControlPlugin0.TCPServerConnect()
26 23
27 24 # OPEN TM ECHO BRIDGE SERVER
28 25 LFRControlPlugin0.TMEchoBridgeOpenPort()
29 26
30 27 # START SENDING TIMECODES AT 1 Hz
31 28 SpwPlugin0.StarDundeeStartTimecodes( 1 )
32 29
33 30 # it is possible to change the time code frequency
34 31 #RMAPPlugin0.changeTimecodeFrequency(2)
General Comments 0
You need to be logged in to leave comments. Login now