summaryrefslogtreecommitdiffstats
path: root/ucs2-interface/ucs-xml
diff options
context:
space:
mode:
authorTobias Jahnke <tobias.jahnke@microchip.com>2018-05-15 16:21:11 +0200
committerWalt Miner <walt@linux.com>2018-06-08 12:16:09 +0000
commit8cc415c1706f340e2997270f8a040474681e451e (patch)
treec754343afb20ef13744ec01a06d75a93a735e573 /ucs2-interface/ucs-xml
parent4bef7c90b9ca764ac38e4e31a9fc59b1c5389d59 (diff)
agl-service-unicens: robustess measure for tx msg
- implement asynchronous message transmission via queue - set message buffer to 512 bytes payload consistently - xml parsing robustness improvement - fix error 7 caused by unnecessary gpio port initialization Bug-AGL: SPEC-1177 Change-Id: I8f494288d03d60d7a0a147f0e25ceb3665731782 Signed-off-by: Tobias Jahnke <tobias.jahnke@microchip.com> (cherry picked from commit a85efd7f8f33e04c82e44675e126089a9adbd5e3)
Diffstat (limited to 'ucs2-interface/ucs-xml')
-rw-r--r--ucs2-interface/ucs-xml/UcsXml.c49
-rw-r--r--ucs2-interface/ucs-xml/UcsXml_Private.c6
2 files changed, 39 insertions, 16 deletions
diff --git a/ucs2-interface/ucs-xml/UcsXml.c b/ucs2-interface/ucs-xml/UcsXml.c
index 2360c7a..7715cd4 100644
--- a/ucs2-interface/ucs-xml/UcsXml.c
+++ b/ucs2-interface/ucs-xml/UcsXml.c
@@ -42,6 +42,7 @@
#define RETURN_ASSERT(result) { UcsXml_CB_OnError("Assertion in file=%s, line=%d", 2, __FILE__, __LINE__); return result; }
#define MISC_HB(value) ((uint8_t)((uint16_t)(value) >> 8))
#define MISC_LB(value) ((uint8_t)((uint16_t)(value) & (uint16_t)0xFF))
+#define ROUTE_AUTO_ID_START (0x8000)
struct UcsXmlRoute
{
@@ -260,6 +261,7 @@ static ParseResult_t ParseScriptPortWrite(xmlNode *act, Ucs_Ns_Script_t *scr, Pr
static ParseResult_t ParseScriptPortRead(xmlNode *act, Ucs_Ns_Script_t *scr, PrivateData_t *priv);
static ParseResult_t ParseScriptPause(xmlNode *act, Ucs_Ns_Script_t *scr, PrivateData_t *priv);
static ParseResult_t ParseRoutes(UcsXmlVal_t *ucs, PrivateData_t *priv);
+static bool IsAutoRouteId(uint16_t id, PrivateData_t *priv);
/************************************************************************/
/* Public Functions */
@@ -708,7 +710,7 @@ static ParseResult_t ParseAll(xmlNode *tree, UcsXmlVal_t *ucs, PrivateData_t *pr
uint32_t nodeCount;
xmlNode *sub;
ParseResult_t result;
- priv->autoRouteId = 0x8000;
+ priv->autoRouteId = ROUTE_AUTO_ID_START;
if (!GetCount(tree, NODE, &nodeCount, true))
RETURN_ASSERT(Parse_XmlError);
@@ -1535,9 +1537,19 @@ static ParseResult_t ParseRoutes(UcsXmlVal_t *ucs, PrivateData_t *priv)
sourceRoute = priv->pRtLst;
while (NULL != sourceRoute)
{
- if (!sourceRoute->isSource) /*There can be more sinks than sources, so count them*/
+ if (sourceRoute->isSource)
{
- ++routeAmount;
+ struct UcsXmlRoute *sinkRoute = priv->pRtLst;
+ while (NULL != sinkRoute)
+ {
+ if (sourceRoute != sinkRoute
+ && !sinkRoute->isSource
+ && (0 == strncmp(sourceRoute->routeName, sinkRoute->routeName, sizeof(sourceRoute->routeName))))
+ {
+ routeAmount++;
+ }
+ sinkRoute = sinkRoute->next;
+ }
}
sourceRoute = sourceRoute->next;
}
@@ -1559,22 +1571,30 @@ static ParseResult_t ParseRoutes(UcsXmlVal_t *ucs, PrivateData_t *priv)
&& !sinkRoute->isSource
&& (0 == strncmp(sourceRoute->routeName, sinkRoute->routeName, sizeof(sourceRoute->routeName))))
{
- Ucs_Rm_Route_t *route = &ucs->pRoutes[ucs->routesSize++];
+ Ucs_Rm_Route_t *route;
+ if(ucs->routesSize >= routeAmount)
+ {
+ RETURN_ASSERT(Parse_MemoryError);
+ }
+ route = &ucs->pRoutes[ucs->routesSize++];
route->source_endpoint_ptr = sourceRoute->ep;
route->sink_endpoint_ptr = sinkRoute->ep;
- route->active = sinkRoute->isActive;
- route->route_id = sinkRoute->routeId;
+ if (!IsAutoRouteId(sourceRoute->routeId, priv))
+ {
+ route->active = sourceRoute->isActive;
+ route->route_id = sourceRoute->routeId;
+ }
+ else
+ {
+ route->active = sinkRoute->isActive;
+ route->route_id = sinkRoute->routeId;
+ }
}
sinkRoute = sinkRoute->next;
}
}
sourceRoute = sourceRoute->next;
}
- if (routeAmount != ucs->routesSize)
- {
- UcsXml_CB_OnError("At least one sink (num=%d) is not connected, because of wrong Route name!", 2, (routeAmount - ucs->routesSize));
- RETURN_ASSERT(Parse_XmlError);
- }
#ifdef DEBUG
/* Third perform checks when running in debug mode*/
@@ -1610,3 +1630,10 @@ static ParseResult_t ParseRoutes(UcsXmlVal_t *ucs, PrivateData_t *priv)
#endif
return Parse_Success;
}
+
+static bool IsAutoRouteId(uint16_t id, PrivateData_t *priv)
+{
+ assert(NULL != priv);
+ return (id >= ROUTE_AUTO_ID_START && id <= priv->autoRouteId);
+}
+
diff --git a/ucs2-interface/ucs-xml/UcsXml_Private.c b/ucs2-interface/ucs-xml/UcsXml_Private.c
index 743598f..4fb4e0c 100644
--- a/ucs2-interface/ucs-xml/UcsXml_Private.c
+++ b/ucs2-interface/ucs-xml/UcsXml_Private.c
@@ -65,10 +65,6 @@ static const char* I2S_PIN_SRXB1 = "SRXB1";
static const char* MUTE_OFF = "NoMuting";
static const char* MUTE_SIGNAL = "MuteSignal";
-/*
-static const char* VAL_TRUE = "true";
-static const char* VAL_FALSE = "false";
- */
#define ASSERT_FALSE(func, par) { UcsXml_CB_OnError("Parameter error in attribute=%s value=%s, file=%s, line=%d", 4, func, par, __FILE__, __LINE__); return false; }
#define CHECK_POINTER(PTR) if (NULL == PTR) { ASSERT_FALSE(PTR, "NULL pointer"); }
@@ -508,4 +504,4 @@ bool GetAvpCon(Ucs_Xrm_AvpCon_t **avpCon, struct AvpConParameters *param)
con->isoc_packet_size = UCS_ISOC_PCKT_SIZE_188;
}
return true;
-} \ No newline at end of file
+}