diff --git a/src/Packetizer/PassthroughPacketizer.c b/src/Packetizer/PassthroughPacketizer.c index c67276a..dd72ee4 100644 --- a/src/Packetizer/PassthroughPacketizer.c +++ b/src/Packetizer/PassthroughPacketizer.c @@ -38,7 +38,7 @@ PassthroughPacketizer_init(Packetizer* const self, const enum SystemBus busId, s *headerSize = 0; - if(bus_to_unique_port_map[busId] == INTERFACE_INVALID_ID) { + if(bus_to_unique_port_map[busId] == INTERFACE_INVALID_ID && bus_has_any_destination_port[busId] != 0) { // Passthrough Packetizer requires an unique interface on bus. abort(); } diff --git a/src/RuntimeCommon/RoutingHelper.c b/src/RuntimeCommon/RoutingHelper.c index 85ac4f0..5f7056a 100644 --- a/src/RuntimeCommon/RoutingHelper.c +++ b/src/RuntimeCommon/RoutingHelper.c @@ -44,3 +44,18 @@ find_unique_destination(const enum SystemBus bus) return (enum RemoteInterface)found_interface; } + +int +check_bus_has_any_destination_port(const enum SystemBus bus) +{ + size_t index; + int result = 0; + for(index = 0; index < INTERFACE_MAX_ID; ++index) { + if(port_to_partition_bus_map[index].partition != PARTITION_NAME + && port_to_partition_bus_map[index].bus == bus) { + result = 1; + } + } + + return result; +} diff --git a/src/RuntimeCommon/RoutingHelper.h b/src/RuntimeCommon/RoutingHelper.h index 66d7cca..9514afe 100644 --- a/src/RuntimeCommon/RoutingHelper.h +++ b/src/RuntimeCommon/RoutingHelper.h @@ -39,4 +39,11 @@ */ enum RemoteInterface find_unique_destination(const enum SystemBus bus); +/** @brief Check if bus has any destination port. + * + * @param[bus] system bus + * @return 0 if bus does not have any destination port, otherwise non-zero value + */ +int check_bus_has_any_destination_port(const enum SystemBus bus); + #endif diff --git a/src/RuntimeMocks/routing.c b/src/RuntimeMocks/routing.c index 6e7a20c..eb22699 100644 --- a/src/RuntimeMocks/routing.c +++ b/src/RuntimeMocks/routing.c @@ -1,3 +1,4 @@ #include "routing.h" enum RemoteInterface bus_to_unique_port_map[] = { INTERFACE_INVALID_ID }; +int bus_has_any_destination_port[] = { 0 }; diff --git a/src/RuntimeMocks/routing.h b/src/RuntimeMocks/routing.h index 19e1255..8894a50 100644 --- a/src/RuntimeMocks/routing.h +++ b/src/RuntimeMocks/routing.h @@ -3,3 +3,4 @@ #define PARTITION_NAME X86_PARTITION extern enum RemoteInterface bus_to_unique_port_map[]; +extern int bus_has_any_destination_port[];