Logo
UNICENS V2.1.0-3491
User Manual and API Reference
Ucs_Return_t Ucs_Rm_GetAttachedRoutes ( Ucs_Inst_t self,
Ucs_Rm_EndPoint_t ep_inst,
Ucs_Rm_Route_t ls_found_routes[],
uint16_t  ls_size 
)

Retrieves the reference(s) of the route(s) currently attached to the given endpoint and stores It into the (external) table provided by user application.

Thus, User application should provide an external reference to an empty routes table where the potential routes will be stored. That is, user application is responsible to allocate enough space to store the found routes. Refer to the Note below for more details.

Parameters
selfThe UNICENS instance pointer.
ep_instReference to the endpoint instance to be looked for.
ls_found_routesList to store references to the found routes. It should be allocated by user application.
ls_sizeSize of the provided list.
Returns
Possible return values are shown in the table below.
Value Description
UCS_RET_SUCCESS No error
UCS_RET_ERR_PARAM At least one parameter is NULL.
UCS_RET_ERR_NOT_INITIALIZED UNICENS is not initialized
Note
The function will add a NULL pointer to the external table (provided by user application) to mark the end of the found routes. This can be helpful when user application doesn't exactly known the number of routes referred to the endpoint. That is, User application should allocate enough space to store the found routes plus the NULL-terminated pointer. Otherwise, the number of associated routes found will precisely equal the size of the list.



Example

// Source and Sink Endpoints
static Ucs_Rm_EndPoint_t endpoint_src = { UCS_RM_EP_SOURCE, &xrm_job_out[0], &node_src };
static Ucs_Rm_EndPoint_t endpoint_sink_west = { UCS_RM_EP_SINK, &xrm_job_in_w[0], &node_west };
static Ucs_Rm_EndPoint_t endpoint_sink_east = { UCS_RM_EP_SINK, &xrm_job_in_e[0], &node_east };
// Routes Specification
static Ucs_Rm_Route_t route_66_west[] = { {&endpoint_src, &endpoint_sink_west, is_active, 0x066U} };
static Ucs_Rm_Route_t route_66_east[] = { {&endpoint_src, &endpoint_sink_east, is_active, 0xE66U} };
// Main function
void main(uint8_t argc, char *argv[])
{
Ucs_Rm_Route_t * found_routes_ls[3];
Ucs_Return_t ret_value;
// Starts routes processing
(void)Ucs_Rm_Start(ucs_inst_ptr, &routes_list[0], routes_list_size);
// ...
// Retrieve routes references to the given endpoint
ret_value = Ucs_Rm_GetAttachedRoutes(ucs_inst_ptr, &endpoint_src, found_routes_ls, 3U);
if (ret_value == UCS_RET_SUCCESS)
{
uint8_t k = 0U;
//printf("\rEp{0x%X}: Related route id(s) --> ", &endpoint_src);
do
{
//printf("{0x%X} ", found_routes_ls[k]->route_id);
k++;
} while ((k < 3U) && (found_routes_ls[k] != NULL));
//printf("\r\n");
}
else
{
// Do whatever is necessary to be done
}
}