Commit 13f11673 authored by jdelange's avatar jdelange

* src/po_hi_transport.c

   include/po_hi_transport.h
   - Introduce __po_hi_transport_share_bus
     to check if two devices share the same bus



git-svn-id: https://tecsw.estec.esa.int/svn/taste/trunk/po-hi-c@4883 129961e7-ef38-4bb5-a8f7-c9a525a55882
parent 8476501a
......@@ -54,6 +54,14 @@ uint32_t __po_hi_transport_get_n_accessed_buses (const __po_hi_device_id device)
*/
__po_hi_bus_id* __po_hi_transport_get_accessed_buses (const __po_hi_device_id device);
/**
* \fn __po_hi_transport_share_bus
*
* \brief Returns 1 if two devices share a common bus, 0 otherwise.
*/
int __po_hi_transport_share_bus (const __po_hi_device_id, const __po_hi_device_id);
/**
* \fn __po_hi_get_node_from_entity
*
......
......@@ -192,6 +192,36 @@ __po_hi_uint8_t __po_hi_get_endianness (const __po_hi_node_t node)
}
#if __PO_HI_NB_DEVICES > 0
int __po_hi_transport_share_bus (const __po_hi_device_id first, const __po_hi_device_id second)
{
__po_hi_uint32_t i;
__po_hi_uint32_t j;
__po_hi_uint32_t first_n_buses;
__po_hi_uint32_t second_n_buses;
__po_hi_bus_id* first_buses;
__po_hi_bus_id* second_buses;
first_buses = __po_hi_transport_get_accessed_buses (first);
second_buses = __po_hi_transport_get_accessed_buses (second);
first_n_buses = __po_hi_transport_get_n_accessed_buses (first);
second_n_buses = __po_hi_transport_get_n_accessed_buses (second);
for (i = 0 ; i < first_n_buses ; i++)
{
for (j = 0 ; j < second_n_buses ; j++)
{
if (first_buses[i] == second_buses[j])
{
return 1;
}
}
}
return 0;
}
__po_hi_bus_id* __po_hi_transport_get_accessed_buses (const __po_hi_device_id device)
{
if ((device < 0) || (device >= __PO_HI_NB_DEVICES))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment