示例#1
0
static void channel_continue(struct fs_dma_ctrl *ctrl, int c)
{
	if (!channel_en(ctrl, c) 
	    || channel_stopped(ctrl, c)
	    || ctrl->channels[c].state != RUNNING
	    /* Only reload the current data descriptor if it has eol set.  */
	    || !ctrl->channels[c].current_d.eol) {
		D(printf("continue failed ch=%d state=%d stopped=%d en=%d eol=%d\n", 
			 c, ctrl->channels[c].state,
			 channel_stopped(ctrl, c),
			 channel_en(ctrl,c),
			 ctrl->channels[c].eol));
		D(dump_d(c, &ctrl->channels[c].current_d));
		return;
	}

	/* Reload the current descriptor.  */
	channel_load_d(ctrl, c);

	/* If the current descriptor cleared the eol flag and we had already
	   reached eol state, do the continue.  */
	if (!ctrl->channels[c].current_d.eol && ctrl->channels[c].eol) {
		D(printf("continue %d ok %x\n", c,
			 ctrl->channels[c].current_d.next));
		ctrl->channels[c].regs[RW_SAVED_DATA] =
			(uint32_t) ctrl->channels[c].current_d.next;
		channel_load_d(ctrl, c);
		channel_start(ctrl, c);
	}
}
示例#2
0
static void channel_new_connection(ChannelServer * serv, Channel * c) {
    c->protocol = protocol_alloc();
    c->connecting = channel_server_connecting;
    c->connected = channel_server_connected;
    c->disconnected = channel_server_disconnected;
    channel_start(c);
}
示例#3
0
文件: main_lua.c 项目: eswartz/emul
static int lua_channel_start(lua_State *L)
{
    struct channel_extra *ce = NULL;

    assert(L == luastate);
    if(lua_gettop(L) != 1 || (ce = lua2channel(L, 1)) == NULL) {
        luaL_error(L, "wrong number or type of arguments");
    }
    if(ce->c == NULL) luaL_error(L, "disconnected channel");
    trace(LOG_LUA, "lua_channel_start %p", ce->c);
    channel_start(ce->c);
    return 0;
}
示例#4
0
void proxy_create(Channel * c1, Channel * c2) {
    TCFSuspendGroup * spg = suspend_group_alloc();
    Proxy * proxy = loc_alloc_zero(2 * sizeof *proxy);
    int i;

    static int instance;

    assert(c1->hello_received);

    proxy[0].c = c1;
    proxy[0].proto = protocol_alloc();
    proxy[0].other = 1;
    proxy[0].state = ProxyStateConnected;
    proxy[0].instance = instance;

    proxy[1].c = c2;
    proxy[1].proto = protocol_alloc();
    proxy[1].other = -1;
    proxy[1].state = ProxyStateInitial;
    proxy[1].instance = instance++;

    trace(LOG_PROXY, "Proxy created, host services:");
    for (i = 0; i < c1->peer_service_cnt; i++) {
        trace(LOG_PROXY, "    %s", c1->peer_service_list[i]);
        protocol_get_service(proxy[1].proto, c1->peer_service_list[i]);
    }
    notify_channel_closed(c1);
    protocol_release(c1->client_data);
    c1->client_data = NULL;
    c1->hello_received = 1;

    c1->connecting = proxy_connecting;
    c1->connected = proxy_connected;
    c1->receive = proxy_receive;
    c1->disconnected = proxy_disconnected;
    c1->client_data = proxy;
    set_default_message_handler(proxy[0].proto, proxy_default_message_handler);

    c2->connecting = proxy_connecting;
    c2->connected = proxy_connected;
    c2->receive = proxy_receive;
    c2->disconnected = proxy_disconnected;
    c2->client_data = proxy + 1;
    set_default_message_handler(proxy[1].proto, proxy_default_message_handler);

    channel_set_suspend_group(c1, spg);
    channel_set_suspend_group(c2, spg);
    channel_start(c2);
 }
示例#5
0
static void channel_stream_cmd(struct fs_dma_ctrl *ctrl, int c, uint32_t v)
{
	unsigned int cmd = v & ((1 << 10) - 1);

	D(printf("%s cmd=%x\n", __func__, cmd));
	if (cmd & regk_dma_load_d) {
		channel_load_d(ctrl, c);
		if (cmd & regk_dma_burst)
			channel_start(ctrl, c);
	}

	if (cmd & regk_dma_load_c) {
		channel_load_c(ctrl, c);
	}
}
示例#6
0
static void channel_new_connection(ChannelServer * serv, Channel * c) {
    protocol_reference(proto);
    c->protocol = proto;
    channel_set_broadcast_group(c, bcg);
    channel_start(c);
}