示例#1
0
文件: pipe.c 项目: BruceYi/okl4
void
unblock_thread(L4_ThreadId_t tid)
{
    L4_MsgTag_t tag;

    tag = L4_Notify(tid, NOTIFY_MASK);
}
示例#2
0
文件: main.c 项目: BreezeWu/okl4_3.0
static void
signal_event(int i){
    struct listener * l;
    
    for (l = events[i].l ; l; l = l->next){
        DEBUG_TRACE(2,
                    "SERVER: pinging %08lx on %08lx\n",
                    l->tid.raw,
                    l->mask);
        L4_Notify(l->tid, l->mask);
    }
}
示例#3
0
static void
ping_thread_async (void)
{
    L4_MsgTag_t tag;
    //tag.raw = 0;
    //tag.X.u = 1;      //Untyped item number
    //tag.X.flags = (4 | 8 | 2);  //SRBLOCK, notify

    //L4_ThreadId_t from;

    for (int i=0; i < num_iterations; i++)
    {
        //L4_LoadMR(1, 0xffff1234UL);
        //tag = L4_Ipc(dest, L4_nilthread, tag, &from);
        tag = L4_Notify(pong_tid, 0xffff1234UL);
        //if (getTagE(tag))
        //    printf("Open L4_call error %lx\n", L4_ErrorCode());
        /*
        tag.raw = 0;
        tag.X.flags = (4 | 8);
        tag = L4_Ipc(dest, L4_nilthread, tag, &from);
        */
        //if (getTagE(tag))
        //    printf("Open L4_call error %lx\n", L4_ErrorCode());

        //return tag.raw;
    }
    
    /* Tell master that we're finished */
    L4_Set_MsgTag (L4_Niltag);
    L4_Send (master_tid);

    for (;;)
        L4_WaitForever();

    /* NOTREACHED */
}
示例#4
0
static irqreturn_t 
ig_input_interrupt(int irq, void *dev_id)
{
	struct stream_packet *packet;
	uintptr_t next;
	int i;
	int data = 0;
	int kick = 0;

//	packet = ig_input->rx_complete;
        packet = memsect_to_vaddr(ig_input, ig_input->control->rx);	
	while(packet) {
		int new_q = 0;
		uint16_t *keys;
		next = packet->next;
		if ((packet->status & COMPLETED) == 0) {
			break;
		}
		packet->status = 0;
                ig_input->control->rx = next;


		/* Append to free list */
		data = 1;
		keys = (uint16_t*)packet->data;
		for (i=0; i < (packet->xferred/2); i++) {
			if (keys[i] & 0x4000) {
				//printk("Mouse %x, %d\n", keys[i] & 0xff, (keys[i] & 0x100) ? -1 : 1);
				if (keys[i] & 0x8000) {
					input_report_rel(ig_input->input_dev, keys[i] & 0x0ff,
							(keys[i] & 0x100) ? -1 : 1);
				}
			} else {
				//printk("Key %s: %x\n", (keys[i] & 0x8000) ? "down" : "up", keys[i] & 0x01ff);
				input_report_key(ig_input->input_dev, keys[i] & 0x01ff, ((keys[i] & 0x8000) != 0));
			}
		}
		
		packet->next = ~0;
		packet->size = PACKET_SIZE;
		packet->xferred = 0;
		
		if (ig_input->rx_last != NULL) {
			ig_input->rx_last->next = vaddr_to_memsect(ig_input, packet);
			if (ig_input->rx_last->status & TERMINATED) {
				new_q = 1;
			}
		} else {
			new_q = 1;
		}
		if (new_q) {
			ig_input->control->rx = vaddr_to_memsect(ig_input, packet);
			kick = 1;
		}
		ig_input->rx_last = packet;

		if (next == ~0) {
			packet = NULL;
		} else {
			packet = memsect_to_vaddr(ig_input, next);
		}
	}

	if (data) {
		input_sync(ig_input->input_dev);
	}

	if (kick) {
		L4_Notify(ig_input->server, 0x1);
	}

    return IRQ_HANDLED;
}
示例#5
0
文件: main.c 项目: BreezeWu/okl4_3.0
static void
timer_callback(callback_data_t data, int ignored, struct data *ignored_data,
               uintptr_t key)
{
    struct timer *timer = (struct timer *)key;
    struct timer *next_timer;
    struct driver *device = timer->timer_service->device;

    do {
        L4_Notify(timer->thread, timer->mask);

        /* The timer should be at the start of the list! */
        assert(timer->timer_service->active == timer);
        assert(timer->prev == NULL);

        if (timer->state == timer_oneshot_e) {
            /* Remove timer from active list */
            next_timer = timer->next;
            deactivate_timer(timer);
        } else {
            /*
             * Period timer -- needs to be put straight back in the active
             * queue
             */
            timer->timeout += timer->period;
            if (timer->next == NULL || timer->next->timeout > timer->timeout) {
                /*
                 * Special case -- we are still at the front of the list so we
                 * don't need to do very much... XXX: Periodic timers should
                 * cost a lot of quota, this could easily DOS a system if
                 * someone request a short periodic timeout
                 */
                next_timer = timer;
            } else {
                /* Ok, so we are not going to be at the front this time */
                struct timer *back = timer->timer_service->active_end;

                next_timer = timer->next;
                timer->timer_service->active = next_timer;
                next_timer->prev = NULL;
                while (back->timeout > timer->timeout) {
                    back = back->prev;
                    assert(back != NULL);
                    /*
                     * This could only happen if we are next, which we can't be
                     * because we already checked that!
                     */
                }
                /* Now we insert behind back */
                timer->next = back->next;
                timer->prev = back;
                back->next = timer;
                if (timer->next) {
                    timer->next->prev = timer;
                }
                if (timer->timer_service->active_end == back) {
                    timer->timer_service->active_end = timer;
                }
            }
        }

        timer = NULL;
        if (next_timer) {
            /* We need to add the next timer */
            if (timer_timeout
                (device, next_timer->timeout, timer_callback, 0,
                 (uintptr_t)next_timer)) {
                timer = next_timer;
            }
        }
    } while (timer);
}