Set error_handling true for e2eStatus signals

Change-Id: I352c11535bd4542c4d98d3c25f0d51e882c32cc1
This commit is contained in:
Henrik Wahlqvist 2025-04-23 18:12:25 +02:00
parent 01534e022f
commit 8db817c5c3
10 changed files with 110 additions and 51 deletions

View File

@ -3,8 +3,10 @@
"""Python module used for handling zone controller specifications"""
from ruamel.yaml import YAML
from powertrain_build.lib import logger
from powertrain_build.interface.base import BaseApplication
from powertrain_build.lib import logger
from powertrain_build.lib.helper_functions import deep_dict_update
LOGGER = logger.create_logger("base")
@ -152,7 +154,7 @@ class ZCAL(BaseApplication):
for element_name, element_data in signal_struct.items():
self.populate_signal_translations(port_name, element_name, element_data)
# Loop inside function to make sure direction is consistent
ports_info[port_name].update(self.get_port_info(port_name, direction, signal_struct))
deep_dict_update(ports_info[port_name], self.get_port_info(port_name, direction, signal_struct))
self.composition_spec["ports"] = ports_info
@staticmethod
@ -165,36 +167,42 @@ class ZCAL(BaseApplication):
direction (str): Direction of the port.
signal_struct (dict): Signal dict containing list of signal elements.
Returns:
port_info (dict): Dict containing information if any elements
should have an update bit associated with them.
port_info (dict): Dict containing port information.
"""
if direction is None:
raise BadYamlFormat(f'Port {port_name} is missing required property "direction".')
port_info = {}
supported_directions = {
"IN": "IN",
"OUT": "OUT",
"CLIENT": "IN",
"SERVER": "OUT",
}
direction = supported_directions[direction]
supported_direction = supported_directions[direction]
api_options = {}
update_elements = set()
for element_name, element_data in signal_struct.items():
for element in element_data:
if "insignal" in element:
temp_dir = "IN"
tmp_direction = "IN"
elif "outsignal" in element:
temp_dir = "OUT"
tmp_direction = "OUT"
else:
raise BadYamlFormat(f"in-/out-signal for element in { element_name } is missing.")
if direction != temp_dir:
if supported_direction != tmp_direction:
raise BadYamlFormat(f"Signal { element_name } has both in and out elements.")
if element.get("updateBit", False):
update_elements.add(element_name)
if element.get("e2eStatus", False):
api_options["error_handling"] = True
if update_elements:
return {"enable_update": list(update_elements)}
return {}
port_info["enable_update"] = list(update_elements)
if api_options:
port_info["api_options"] = api_options
return port_info
def populate_signal_translations(self, port_name, element_name, element_data):
"""Populate class translations data.

View File

@ -41,10 +41,8 @@ expected_result = {
}
}
},
"ports": {
"GlobSignNme": {"direction": "IN", "interface": "PIGlobSignNme"}
},
}
"ports": composition_yaml_setup.base_ports,
},
},
"DataTypes": composition_yaml_setup.base_data_types,
"PortInterfaces": composition_yaml_setup.base_port_interfaces,
@ -88,9 +86,7 @@ expected_extra_runnable_keys_result = {
}
}
},
"ports": {
"GlobSignNme": {"direction": "IN", "interface": "PIGlobSignNme"}
}
"ports": composition_yaml_setup.base_ports
}
},
"DataTypes": composition_yaml_setup.base_data_types,
@ -134,9 +130,7 @@ expected_custom_names_result = {
}
}
},
"ports": {
"GlobSignNme": {"direction": "IN", "interface": "PIGlobSignNme"}
},
"ports": composition_yaml_setup.base_ports,
}
},
"DataTypes": composition_yaml_setup.base_data_types,
@ -189,9 +183,7 @@ expected_cal_result = {
}
}
},
"ports": {
"GlobSignNme": {"direction": "IN", "interface": "PIGlobSignNme"}
},
"ports": composition_yaml_setup.base_ports,
}
},
"DataTypes": composition_yaml_setup.base_data_types,

View File

@ -8,6 +8,32 @@ base_configuration = {
"GenerateExternalImplementationTypes": True
}
base_ports = {
"PortOne": {
"direction": "IN",
"interface": "PortInterfaceOne"
},
"PortTwo": {
"direction": "IN",
"interface": "PortInterfaceTwo",
"enable_update": ["elementOne"],
},
"PortThree": {
"direction": "IN",
"interface": "PortInterfaceThree",
"api_options": {"dummy": "dummy"},
},
"PortFour": {
"direction": "IN",
"interface": "PortInterfaceFour",
"enable_update": ["elementOne", "elementTwo"],
"api_options": {
"dummy": "dummy",
"error_handling": False
},
},
}
base_port_interfaces = {
"ExtraPortInterface": {
"type": "SENDER-RECIEVER-INTERFACE",
@ -479,15 +505,8 @@ composition_spec = {
}
}
},
"ports": {
"GlobSignNme": {"direction": "IN", "interface": "PIGlobSignNme"}
},
"port_interfaces": {
"ExtraPortInterface": {
"type": "SENDER-RECIEVER-INTERFACE",
"elements": "ExtraType"
}
},
"ports": base_ports,
"port_interfaces": base_port_interfaces,
"data_types": {
"ExtraType": {
"type": "RECORD",

View File

@ -231,9 +231,7 @@ expected_result = {
}
}
},
"ports": {
"GlobSignNme": {"direction": "IN", "interface": "PIGlobSignNme"}
},
"ports": composition_yaml_setup.base_ports,
}
},
"DataTypes": {

View File

@ -48,8 +48,33 @@ expected_result = {
}
},
"ports": {
"GlobSignNme": {"direction": "IN", "interface": "PIGlobSignNme"},
"CallOne": {"direction": "IN", "interface": "InterfaceOne"}
"PortOne": {
"direction": "IN",
"interface": "PortInterfaceOne"
},
"PortTwo": {
"direction": "IN",
"interface": "PortInterfaceTwo",
"enable_update": ["elementOne"],
},
"PortThree": {
"direction": "IN",
"interface": "PortInterfaceThree",
"api_options": {"dummy": "dummy"},
},
"PortFour": {
"direction": "IN",
"interface": "PortInterfaceFour",
"enable_update": ["elementOne", "elementTwo"],
"api_options": {
"dummy": "dummy",
"error_handling": False
},
},
"CallOne": {
"direction": "IN",
"interface": "InterfaceOne"
}
}
}
},

View File

@ -47,8 +47,33 @@ expected_result = {
}
},
"ports": {
"GlobSignNme": {"direction": "IN", "interface": "PIGlobSignNme"},
"CallOne": {"direction": "IN", "interface": "CallOne"}
"PortOne": {
"direction": "IN",
"interface": "PortInterfaceOne"
},
"PortTwo": {
"direction": "IN",
"interface": "PortInterfaceTwo",
"enable_update": ["elementOne"],
},
"PortThree": {
"direction": "IN",
"interface": "PortInterfaceThree",
"api_options": {"dummy": "dummy"},
},
"PortFour": {
"direction": "IN",
"interface": "PortInterfaceFour",
"enable_update": ["elementOne", "elementTwo"],
"api_options": {
"dummy": "dummy",
"error_handling": False
},
},
"CallOne": {
"direction": "IN",
"interface": "CallOne"
}
}
}
},

View File

@ -103,9 +103,7 @@ expected_result = {
}
}
},
"ports": {
"GlobSignNme": {"direction": "IN", "interface": "PIGlobSignNme"},
}
"ports": composition_yaml_setup.base_ports,
}
},
"DataTypes": composition_yaml_setup.base_data_types,

View File

@ -85,9 +85,7 @@ expected_result = {
}
}
},
"ports": {
"GlobSignNme": {"direction": "IN", "interface": "PIGlobSignNme"},
}
"ports": composition_yaml_setup.base_ports,
}
},
"DataTypes": composition_yaml_setup.base_data_types,

View File

@ -114,9 +114,7 @@ expected_result = {
}
}
},
"ports": {
"GlobSignNme": {"direction": "IN", "interface": "PIGlobSignNme"}
},
"ports": composition_yaml_setup.base_ports,
}
},
"DataTypes": composition_yaml_setup.base_data_types,

View File

@ -160,9 +160,7 @@ expected_result = {
}
}
},
"ports": {
"GlobSignNme": {"direction": "IN", "interface": "PIGlobSignNme"}
},
"ports": composition_yaml_setup.base_ports,
}
},
"DataTypes": {