Exemple #1
0
void producer_task (u_long a0, u_long a1, u_long a2, u_long a3)

{
    u_long err, tmid, events, msg[4];
    int next_msg = 0;
    u_long qid = a0;
    const char *s;

    err = tm_evevery(PRODUCER_TRIG,PERIODIC_EVENT,&tmid);

    if (err != SUCCESS)
	xnpod_fatal("tm_evevery() failed, errno %lu",err);

    for (;;)
	{
	err = ev_receive(PERIODIC_EVENT,EV_ANY,0,&events);

	if (err != SUCCESS)
	    xnpod_fatal("ev_receive() failed, errno %lu",err);

	s = satch_s_tunes[next_msg++];
	next_msg %= (sizeof(satch_s_tunes) / sizeof(satch_s_tunes[0]));

	msg[0] = (u_long)s;
	msg[1] = 0x0;
	msg[2] = 0x0;
	msg[3] = 0x0;

	err = q_send(qid,msg);

	if (err != SUCCESS)
	    xnpod_fatal("q_send() failed, errno %lu",err);
	}
}
Exemple #2
0
void xnmod_alloc_glinks(xnqueue_t *freehq)
{
	xngholder_t *sholder, *eholder;

	sholder = xnheap_alloc(&kheap,
			       sizeof(xngholder_t) * XNMOD_GHOLDER_REALLOC);

	if (!sholder) {
		/* If we are running out of memory but still have some free
		   holders, just return silently, hoping that the contention
		   will disappear before we have no other choice than
		   allocating memory eventually. Otherwise, we have to raise a
		   fatal error right now. */

		if (emptyq_p(freehq))
			xnpod_fatal("cannot allocate generic holders");

		return;
	}

	for (eholder = sholder + XNMOD_GHOLDER_REALLOC;
	     sholder < eholder; sholder++) {
		inith(&sholder->glink.plink);
		appendq(freehq, &sholder->glink.plink);
	}
}
Exemple #3
0
void consumer_task (u_long a0, u_long a1, u_long a2, u_long a3)

{
    u_long err, qid = a0, msg[4];

    for (;;)
	{
	tm_wkafter(CONSUMER_WAIT);

	while ((err = q_receive(qid,Q_NOWAIT,0,msg)) == SUCCESS)
	    xnprintf("Now playing %s...\n",(const char *)msg[0]);

	if (err != ERR_NOMSG)
	    xnpod_fatal("q_receive() failed, errno %lu",err);
	}
}
Exemple #4
0
struct xnpholder *getheadmlq(struct xnsched_mlq *q)
{
	struct xnqueue *queue;
	struct xnpholder *h;

	if (emptymlq_p(q))
		return NULL;

	queue = &q->queue[ffsmlq(q)];
	h = (struct xnpholder *)getheadq(queue);

	XENO_ASSERT(QUEUES, h,
		    xnpod_fatal
		    ("corrupted multi-level queue, qslot=%p at %s:%d", q,
		     __FILE__, __LINE__);
		);
Exemple #5
0
void initmlq(struct xnsched_mlq *q, int loprio, int hiprio)
{
	int prio;

	q->elems = 0;
	q->loprio = loprio;
	q->hiprio = hiprio;
	q->himap = 0;
	memset(&q->lomap, 0, sizeof(q->lomap));

	for (prio = 0; prio < XNSCHED_MLQ_LEVELS; prio++)
		initq(&q->queue[prio]);

	XENO_ASSERT(QUEUES, 
		    hiprio - loprio + 1 < XNSCHED_MLQ_LEVELS,
		    xnpod_fatal("priority range [%d..%d] is beyond multi-level "
				"queue indexing capabilities",
				loprio, hiprio));
}
Exemple #6
0
void k_fatal(u_long err_code, u_long flags)
{
	xnpod_fatal("pSOS skin: fatal error, code 0x%x", err_code);
}