Project

General

Profile

Feature #481 » just_load_normal_par.py

Veronique bouzid, 02/10/2015 04:56 PM

 
1
# -*- coding: utf-8 *-*
2

    
3
###############################################################################
4
# tm_sequence_counter_loop
5
# SVS-0019 (REQ-LFR-SRS-5240)
6
# SSS-CP-FS-590
7
###############################################################################
8
# execfile('/opt/PYTHON/lfrverif/LFR_SVS/SVS-0019/tm_sequence_counter_loop.py')
9
# this test could be based on the  SVS-0018 implementation
10
#    (for TM_LFR_SCIENCE* packets).
11
#import sys
12

    
13
## To ensure the imported modified files are properly reloaded.
14
#for mod in sys.modules.values():
15
    #strmod = str(mod)
16
    #if not ('\'PythonQt' in strmod) and not ('\'sys\'' in strmod) and \
17
        #not ('\'pygments.' in strmod) and \
18
        #not ('\'__main__\'' in strmod) and not ('\'paste\'' in strmod) and \
19
        #not ('\'/usr/lib64/python2.7/' in strmod) and not(mod is None):
20
    ##if ('\'lfrverif' in strmod):
21
        #print mod
22
        #reload(mod)
23

    
24
import inspect
25
from lfrverif.common.param import *
26

    
27
# setting up LPPMON plugins
28
from __main__ import proxy
29
if not(proxy.instanceExists("SpwPlugin0")):
30
    proxy.loadSysDriver("SpwPlugin","SpwPlugin0")
31
    SpwPlugin0.selectBridge("STAR-Dundee Spw USB Brick")
32

    
33
    proxy.loadSysDriverToParent("dsu3plugin","SpwPlugin0")
34
    proxy.loadSysDriverToParent("LFRControlPlugin","SpwPlugin0")
35

    
36
    availableBrickCount = SpwPlugin0.StarDundeeGetAvailableBrickCount()
37
    print str(availableBrickCount) + " SpaceWire brick(s) found"
38

    
39
    SpwPlugin0.StarDundeeSelectBrick(1)
40
    SpwPlugin0.StarDundeeSetBrickAsARouter(1)
41
    SpwPlugin0.connectBridge()
42

    
43
    #SpwPlugin0.TCPServerSetIP("127.0.0.1")
44
    SpwPlugin0.TCPServerConnect()
45

    
46
    # OPEN SPACEWIRE SERVER
47
    #LFRControlPlugin0.SetSpwServerIP(129,104,27,164)
48
    LFRControlPlugin0.TCPServerConnect()
49

    
50
    # OPEN TM ECHO BRIDGE SERVER
51
    LFRControlPlugin0.TMEchoBridgeOpenPort()
52

    
53
    # LOAD FSW USING LINK 1
54
    SpwPlugin0.StarDundeeSelectLinkNumber( 1 )
55
    dsu3plugin0.openFile(LFR_FSW_PATH)
56
    dsu3plugin0.loadFile()
57
    dsu3plugin0.run()
58

    
59

    
60
from __main__ import SpwPlugin0
61

    
62
from lfrverif.PacketsDef.tc_def import *
63
from lfrverif.common.actions_tc_lfr_launcher import *
64

    
65
current_file = inspect.currentframe().f_code.co_filename
66

    
67
test_launcher = TestLauncher(LFRControlPlugin0)
68
test_launcher.test_monitor.progress_memo += (
69
    "SocExplorerEngine.getSocExplorer: Version = " + SocExplorerEngine.getSocExplorerVersion() +
70
    ", Branch = " + SocExplorerEngine.getSocExplorerBranch() +
71
    ", Changeset = " + SocExplorerEngine.getSocExplorerChangeset() + '\n')
72

    
73
test_launcher.test_monitor.log_memo(current_file)
74
# Gerald dit de remplacer cette code
75
#postponeNextTimeBeforeTc(1)
76
surveyAnyTmPacket(test_launcher, 1)
77

    
78
ACK_EXECUTION_COMPLETION = 1
79
ACK_ACCEPTANCE = 1
80

    
81
tc_lfr_dump_par = TcLfrDumpPar()
82
tc_lfr_enter_mode = TcLfrEnterMode()
83
tc_lfr_load_normal_par = TcLfrLoadNormalPar()
84

    
85
cp_lfr_mode = -1
86
spare_aux = tc_lfr_enter_mode.SpW[SPW_HEADER_SIZE + 11] & 0xf0
87
src_id = SOURCE_ID_ENUM[0]
88
for tc_id_aux in [ tc_lfr_enter_mode, tc_lfr_dump_par,tc_lfr_load_normal_par]:
89
    tc_id_aux.SpW[SPW_HEADER_SIZE + 6] =\
90
        (tc_id_aux.SpW[SPW_HEADER_SIZE + 6] & 0b11110110) |\
91
        ((ACK_EXECUTION_COMPLETION & 1) << 3) | (ACK_ACCEPTANCE & 1)
92
    tc_id_aux.SpW[SPW_HEADER_SIZE + 9] = src_id & 0xff
93

    
94
dispCrcSendSpwTcWaitVerifPkt(test_launcher, tc_lfr_dump_par)
95

    
96
# ASM à 4secondes
97
#tc_lfr_load_normal_par.SpW[SPW_HEADER_SIZE + 14:SPW_HEADER_SIZE + 16] = [0, 4]
98
#dispCrcSendSpwTcWaitVerifPkt(test_launcher, tc_lfr_load_normal_par)
99
#surveyAnyTmPacket(test_launcher, 1)
100

    
101
#dispCrcSendSpwTcWaitVerifPkt(test_launcher, tc_lfr_dump_par)
102
tc_lfr_load_normal_par.SpW[SPW_HEADER_SIZE + 16:SPW_HEADER_SIZE + 18] = [255,255]
103
dispCrcSendSpwTcWaitVerifPkt(test_launcher, tc_lfr_load_normal_par)
104
surveyAnyTmPacket(test_launcher, 5)
105

    
106
cp_lfr_mode = 1
107
tc_lfr_enter_mode.SpW[SPW_HEADER_SIZE + 11] =\
108
    (spare_aux & 0xf0) | (cp_lfr_mode & 0xf)
109
dispCrcSendSpwTcWaitVerifPkt(test_launcher, tc_lfr_enter_mode)
110
surveyAnyTmPacket(test_launcher, 20)
111

    
112
cp_lfr_mode = 3
113
tc_lfr_enter_mode.SpW[SPW_HEADER_SIZE + 11] =\
114
    (spare_aux & 0xf0) | (cp_lfr_mode & 0xf)
115
dispCrcSendSpwTcWaitVerifPkt(test_launcher, tc_lfr_enter_mode)
116
surveyAnyTmPacket(test_launcher, 20)
117

    
118
cp_lfr_mode = 4
119
tc_lfr_enter_mode.SpW[SPW_HEADER_SIZE + 11] =\
120
    (spare_aux & 0xf0) | (cp_lfr_mode & 0xf)
121
dispCrcSendSpwTcWaitVerifPkt(test_launcher, tc_lfr_enter_mode)
122
surveyAnyTmPacket(test_launcher, 20)
123

    
124
# on attend les BP
125
#surveyAnyTmPacket(test_launcher, 270)
126

    
127

    
128
# Reach STANDBY. Wait products in the fifo if generated
129
cp_lfr_mode = 0
130
tc_lfr_enter_mode.SpW[SPW_HEADER_SIZE + 11] =\
131
    (spare_aux & 0xf0) | (cp_lfr_mode & 0xf)
132
dispCrcSendSpwTcWaitVerifPkt(test_launcher, tc_lfr_enter_mode)
133
surveyAnyTmPacket(test_launcher, 24)
134

    
135
test_launcher.test_monitor.log_memo("End(" + current_file + ")")
136
test_launcher.test_monitor.archivalRecord()
    (1-1/1)