4 * @brief global data used from different modules in frescan
15 * In frescan_data module we store global data to FRESCAN to make the protocol
16 * easier and efficient to implement.
20 * See MaRTE OS license
24 #include "frescan_data.h"
25 #include "frescan_debug.h"
27 frescan_network_data_t the_networks[FRESCAN_MX_NETWORKS];
28 frescan_server_data_t the_servers_pool[FRESCAN_MX_NETWORKS][FRESCAN_MX_IDS];
29 freelist_t the_servers_pool_freelist[FRESCAN_MX_NETWORKS];
30 frescan_server_data_t the_active_servers[FRESCAN_MX_NETWORKS];
33 * frescan_data_init() - init the data global variables
37 int frescan_data_init(int fd, frescan_init_params_t *params)
43 the_networks[params->net].fd = fd;
44 the_networks[params->net].local_node = params->node;
45 the_networks[params->net].last_packet = NULL;
46 the_networks[params->net].last_packet_prio = 0;
48 FRESCAN_CREATE_LOCK(&the_networks[params->net].lock);
50 for(id=0; id<FRESCAN_MX_IDS; id++) {
51 for(src=0; src<FRESCAN_MX_NODES; src++) {
52 the_networks[params->net].id_queues[src][id] = NULL;
56 for(prio=0; prio<FRESCAN_MX_PRIOS; prio++) {
57 for(src=0; src<FRESCAN_MX_NODES; src++) {
58 the_networks[params->net].id_fp_queues[src][prio] = NULL;