ip_route_t get_top_interface_route(const self_ip_routing_tree_t* tree, const node_id_t node) { ip_route_t result; rank_t node_rank; assert(tree); assert(tree->ip_type); assert_valid_node_id_for_tree(node, *tree); /* Make sure node contains a valid value for this tree */ node_rank = node_id_to_rank(tree, node); result.ip_type = tree->ip_type; #ifdef IPV6_SUPPORT if (tree->ip_type == IPV6) { if (node_rank == 1) { /* Root of tree has no specific route for top interface (only default) */ return no_interface_route(); } else { uint128_t_to_ipv6( get_reference_ipv6_network(tree, get_parent_node_id(tree, (uint128_t)node) ), &(result.in_addr.__ipv6_in6_addr) ); /* We add a route to the parent node's reference network or interface */ result.prefix = 128 - tree->hostA; /* But we only create a route for this host */ } } else #endif #ifdef IPV4_SUPPORT #warning IPv4 support is not implemented if (tree->ip_type == IPV4) { assert(0); /* Not implemented yet */ //TODO: support IPv4 trees for routes } else #endif assert(0); /* Force fail */ return result; }
static int init_common(void) { struct module_item_t *module_item; struct device_node *fdt_node; int i2c_adap_id = 0; struct dts_regulator *dr = &g_isp_ir.avdd.regul; int i = 0; int value = 0; // get i2c adapter fdt_node = of_find_compatible_node(NULL, NULL, CAMERA_COMMON_NAME); if (NULL == fdt_node) { DBG_ERR("err: no ["CAMERA_COMMON_NAME"] in dts"); return -1; } i2c_adap_id = get_parent_node_id(fdt_node, "i2c_adapter", "i2c"); g_adap = i2c_get_adapter(i2c_adap_id); // get sens channel if(of_property_read_u32(fdt_node, "channel", &g_sens_channel)) { g_sens_channel = 0; } #if 1 // get detect sensor list fdt_node = of_find_compatible_node(NULL, NULL, CAMERA_DETECT_NAME); if (NULL == fdt_node) { DBG_ERR("err: no ["CAMERA_DETECT_NAME"] in dts"); return -1; } if(of_property_read_u32(fdt_node, "hot_plugin_enable", &hot_plug_enable)) { DBG_ERR("no hot_plugin_enable node"); hot_plug_enable = 0; } fdt_node = of_get_child_by_name(fdt_node, CFG_CAMERA_DETECT_LIST); if (NULL == fdt_node) { DBG_ERR("err: no ["CFG_CAMERA_DETECT_LIST"] in dts"); return -1; } #endif for (i = 0; i < ARRAY_SIZE(g_module_list); i++) { module_item = &g_module_list[i]; if(of_property_read_u32(fdt_node, module_item->name, &value)) continue; module_item->need_detect = (bool)value; } g_spinfo.flag = 0; g_spinfo.gpio_rear.num = -1; g_spinfo.gpio_front.num = -1; g_spinfo.gpio_reset.num = -1; g_spinfo.ch_clk[ISP_CHANNEL_0] = NULL; g_spinfo.ch_clk[ISP_CHANNEL_1] = NULL; dr->regul = NULL; g_isp_ir.avdd_use_gpio = 0; g_isp_ir.dvdd_use_gpio = 0; g_isp_ir.dvdd.regul = NULL; return 0; }