Project

General

Profile

Bug #508 ยป dump_kcoeff_vs_source.py

Veronique bouzid, 29/09/2015 02:55 PM

 
1
import inspect
2
from lfrverif.common.param import *
3

    
4
# setting up LPPMON plugins
5
from __main__ import proxy
6
if not(proxy.instanceExists("SpwPlugin0")):
7
    proxy.loadSysDriver("SpwPlugin","SpwPlugin0")
8
    SpwPlugin0.selectBridge("STAR-Dundee Spw USB Brick")
9

    
10
    proxy.loadSysDriverToParent("dsu3plugin","SpwPlugin0")
11
    proxy.loadSysDriverToParent("LFRControlPlugin","SpwPlugin0")
12

    
13
    availableBrickCount = SpwPlugin0.StarDundeeGetAvailableBrickCount()
14
    print str(availableBrickCount) + " SpaceWire brick(s) found"
15

    
16
    SpwPlugin0.StarDundeeSelectBrick(1)
17
    SpwPlugin0.StarDundeeSetBrickAsARouter(1)
18
    SpwPlugin0.connectBridge()
19

    
20
    #SpwPlugin0.TCPServerSetIP("127.0.0.1")
21
    SpwPlugin0.TCPServerConnect()
22

    
23
    # OPEN SPACEWIRE SERVER
24
    #LFRControlPlugin0.SetSpwServerIP(129,104,27,164)
25
    LFRControlPlugin0.TCPServerConnect()
26

    
27
    # OPEN TM ECHO BRIDGE SERVER
28
    LFRControlPlugin0.TMEchoBridgeOpenPort()
29

    
30
    # LOAD FSW USING LINK 1
31
    SpwPlugin0.StarDundeeSelectLinkNumber( 1 )
32
    dsu3plugin0.openFile(LFR_FSW_PATH)
33
    dsu3plugin0.loadFile()
34
    dsu3plugin0.run()
35

    
36

    
37
from __main__ import SpwPlugin0
38

    
39
from lfrverif.PacketsDef.tc_def import *
40
from lfrverif.common.actions_tc_lfr_launcher import *
41

    
42
current_file = inspect.currentframe().f_code.co_filename
43

    
44
test_launcher = TestLauncher(LFRControlPlugin0)
45
test_launcher.test_monitor.progress_memo += (
46
    "SocExplorerEngine.getSocExplorer: Version = " + SocExplorerEngine.getSocExplorerVersion() +
47
    ", Branch = " + SocExplorerEngine.getSocExplorerBranch() +
48
    ", Changeset = " + SocExplorerEngine.getSocExplorerChangeset() + '\n')
49

    
50
test_launcher.test_monitor.log_memo(current_file)
51
# Gerald dit de remplacer cette code
52
#postponeNextTimeBeforeTc(1)
53
surveyAnyTmPacket(test_launcher, 1)
54

    
55
ACK_EXECUTION_COMPLETION = 1
56
ACK_ACCEPTANCE = 1
57

    
58
tc_lfr_enter_mode = TcLfrEnterMode()
59
tc_lfr_dump_kcoeff = TcLfrDumpKcoefficients()
60
tc_lfr_load_kcoeff = TcLfrLoadKcoefficients()
61
src_id = SOURCE_ID_ENUM[0]
62

    
63
# For this TC (enter_mode), Msb of byte 11 is saved (for spare)
64
spare = tc_lfr_enter_mode.SpW[SPW_HEADER_SIZE + 11] & 0xf0
65

    
66
init_tc_header([tc_lfr_dump_kcoeff, tc_lfr_load_kcoeff, tc_lfr_enter_mode],
67
    ACK_EXECUTION_COMPLETION, ACK_ACCEPTANCE, src_id)
68
surveyAnyTmPacket(test_launcher, 2)
69

    
70
# For each mode, check default values
71
#
72
for cp_lfr_mode in range(5):
73
    tc_lfr_enter_mode.SpW[SPW_HEADER_SIZE + 11] = spare | (cp_lfr_mode & 0xf)
74
    dispCrcSendSpwTcWaitVerifPkt(test_launcher, tc_lfr_enter_mode)
75
    surveyAnyTmPacket(test_launcher, 2)
76
    dispCrcSendSpwTcWaitVerifPkt(test_launcher, tc_lfr_dump_kcoeff)
77
    surveyAnyTmPacket(test_launcher, 2)
78

    
79
# LFR FSW final state: STANDBY mode.
80
tc_lfr_enter_mode.SpW[SPW_HEADER_SIZE + 11] = spare
81
dispCrcSendSpwTcWaitVerifPkt(test_launcher, tc_lfr_enter_mode)
82
surveyAnyTmPacket(test_launcher, 2)
83

    
84
test_launcher.test_monitor.log_memo("End(" + current_file + ")")
85
test_launcher.test_monitor.archivalRecord()
    (1-1/1)