u32 nodewrap_connect(union trapped_args *args, void *pr_ctxt) { int status = 0; struct dsp_strmattr attrs; struct dsp_strmattr *pattrs = NULL; u32 cb_data_size; u32 __user *psize = (u32 __user *) args->args_node_connect.conn_param; u8 *pargs = NULL; struct node_res_object *node_res1, *node_res2; struct node_object *node1 = NULL, *node2 = NULL; if ((int)args->args_node_connect.node != DSP_HGPPNODE) { find_node_handle(&node_res1, pr_ctxt, args->args_node_connect.node); if (node_res1) node1 = node_res1->node; } else { node1 = args->args_node_connect.node; } if ((int)args->args_node_connect.other_node != DSP_HGPPNODE) { find_node_handle(&node_res2, pr_ctxt, args->args_node_connect.other_node); if (node_res2) node2 = node_res2->node; } else { node2 = args->args_node_connect.other_node; } if (!node1 || !node2) return -EFAULT; if (psize) { if (get_user(cb_data_size, psize)) status = -EPERM; cb_data_size += sizeof(u32); if (!status) { pargs = kmalloc(cb_data_size, GFP_KERNEL); if (pargs == NULL) { status = -ENOMEM; goto func_cont; } } CP_FM_USR(pargs, args->args_node_connect.conn_param, status, cb_data_size); if (status) goto func_cont; } if (args->args_node_connect.attrs) { CP_FM_USR(&attrs, args->args_node_connect.attrs, status, 1); if (!status) pattrs = &attrs; } if (!status) { status = node_connect(node1, args->args_node_connect.stream_id, node2, args->args_node_connect.other_stream, pattrs, (struct dsp_cbdata *)pargs); } func_cont: kfree(pargs); return status; }
//node_t a,b,c,d,e,log1,log2a,log3; void test1_init(node_manager_t *node_manager ) { node_t *a,*b,*c,*d,*e,*log1,*log2a,*log3; node_init(&a,0,1,5,node_manager); //node_random,"a"); node_add_callback(a,10,node_random,"a",0); NODE_INIT_OUTPUT(*a,0,double,10); node_init(&b,0,1,5,node_manager);//node_random1,"b"); node_add_callback(b,10,node_random1,"b",0); NODE_INIT_OUTPUT(*b,0,double,10); node_init(&c,2,1,5,node_manager);//node_action,"+"); node_add_callback(c,10,node_action,"+",0); NODE_INIT_OUTPUT(*c,0,double,10); node_init(&d,2,1,5,node_manager);//node_action,"-"); node_add_callback(d,10,node_action,"-",0); NODE_INIT_OUTPUT(*d,0,double,10); node_init(&e,2,1,5,node_manager);//node_action,"*"); node_add_callback(e,10,node_action,"*",0); NODE_INIT_OUTPUT(*e,0,double,10); node_init(&log1 ,3,0,5,node_manager);//node_log1 ,"logger(+)"); node_add_callback(log1,10,node_log1,"logger(+)",0); node_init(&log2a,3,0,5,node_manager);//node_log2a,"logger(-)"); node_add_callback(log2a,10,node_log2a,"logger(-)",0); node_init(&log3 ,3,0,5,node_manager);//node_log3 ,"logger(*)"); node_add_callback(log3,10,node_log3,"logger(*)",0); node_connect(a,0,c,0,10); node_connect(b,0,c,1,10); node_connect(c,0,log1,0,10); node_connect(a,0,log1,1,10); node_connect(b,0,log1,2,10); node_connect(a,0,d,0,10); node_connect(b,0,d,1,10); node_connect(d,0,log2a,0,10); node_connect(a,0,log2a,1,10); node_connect(b,0,log2a,2,10); node_connect(c,0,e,0,10); node_connect(d,0,e,1,10); node_connect(e,0,log3,0,10); node_connect(a,0,log3,1,10); node_connect(b,0,log3,2,10); }
int node_meta_connect(struct node *local_node, struct node *remote_node) { return node_connect(NODE_META_LINK, local_node, remote_node); }