lpcmanager

Fixed previous commit side effects

2014-12-08, Edouard Tisserant
dad562d1bab4
Parents acee64d7456d
Children 0b384140bc8b
Fixed previous commit side effects
  • +22 -4
    LPCBus.py
  • +2 -0
    LPCManager.py
  • --- a/LPCBus.py Mon Dec 08 17:02:35 2014 +0100
    +++ b/LPCBus.py Mon Dec 08 17:24:59 2014 +0100
    @@ -1,3 +1,4 @@
    +
    bus_template_code = {"MC8":"""
    /* Code generated by LPCBus confnode */
    @@ -181,8 +182,25 @@
    "cleanup":"""
    """,
    },
    + "MC9:Devices": {
    + "decl" : """
    +""",
    + "init":"""
    +""",
    + "retrieve":"""
    +""",
    + "publish":"""
    +""",
    + "cleanup":"""
    +""",
    + },
    }
    +
    +# to be overloaded at import
    +LPCarch = None
    +
    +import os
    from plcopen.structures import LOCATIONDATATYPES
    from PLCControler import LOCATION_CONFNODE, LOCATION_MODULE, LOCATION_GROUP,\
    LOCATION_VAR_INPUT, LOCATION_VAR_OUTPUT, LOCATION_VAR_MEMORY
    @@ -364,7 +382,7 @@
    # define a unique name for the generated C file
    location_str = "_".join(map(str, current_location))
    - BusName = arch + ":" + self.BaseParams.getName()
    + BusName = LPCarch + ":" + self.BaseParams.getName()
    bcode = bus_code.get(BusName,{"decl":"",
    "init":"",
    @@ -430,12 +448,12 @@
    if var["Publish"] != "":
    code_str["publish_code"] += " " + var["Publish"] % ("*" + var["location"]) + "\n"
    - if arch not in bus_template_code:
    + if LPCarch not in bus_template_code:
    raise Exception, "Unknown arch %s. Please use %s"%(
    - arch,repr(bus_template_code.keys()))
    + LPCarch,repr(bus_template_code.keys()))
    Gen_Module_path = os.path.join(buildpath, "Bus_%s.c"%location_str)
    module = open(Gen_Module_path,'w')
    - module.write(bus_template_code[arch] % code_str)
    + module.write(bus_template_code[LPCarch] % code_str)
    module.close()
    matiec_flags = '"-I%s" -Wno-unused-function'%os.path.abspath(self.GetCTRoot().GetIECLibPath())
    --- a/LPCManager.py Mon Dec 08 17:02:35 2014 +0100
    +++ b/LPCManager.py Mon Dec 08 17:24:59 2014 +0100
    @@ -141,6 +141,8 @@
    #
    # canfestival.local_canfestival_config = LPC_canfestival_config()
    +import LPCBus as LPCBus_mod
    +LPCBus_mod.LPCarch = arch
    from LPCBus import *
    #-------------------------------------------------------------------------------