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