Ejemplo n.º 1
0
ptptr getproc(void)
{
	ptptr p = udata.u_ptab;

#ifdef DEBUGREALLYHARD
	kputs("getproc(");
	if (udata.u_ininterrupt)
		kputs("[IRQ]");
#endif
	while (1) {
		switch (p->p_status) {
		case P_ZOMBIE:
			/* If we died go to our parent */
#ifdef DEBUGREALLYHARD
			kprintf("Zombie: move from %x to %x\n", p,
				p->p_pptr);
#endif
			p = p->p_pptr;
		case P_READY:
			/* If we are ready run us */
			p->p_status = P_RUNNING;
		case P_RUNNING:
			/* If we are running keep running */
#ifdef DEBUGREALLYHARD
			kprintf("%x:%s:%d)\n", p, p->p_name, p->p_page);
#endif
			return p;
		default:
			/* Wait for an I/O operation to let us run, don't run
			   other tasks */
			ei();
			platform_idle();
		}
	}
}
Ejemplo n.º 2
0
static void devide_delay(void)
{
    timer_t timeout;

    timeout = set_timer_ms(25);

    while(!timer_expired(timeout))
       platform_idle();
}
Ejemplo n.º 3
0
/*
 *	Wait for a DMA devices to complete by watching a GPIO
 */
int dma_wait(uint16_t wait)
{
	timer_t x = set_timer_duration(wait);
	while (!timer_expired(x)) {
		uint8_t status = *(volatile uint8_t *)0xFFFA01;
		if (!(status & 0x20))
			return 0;
		platform_idle();
	}
	return -1;
}
Ejemplo n.º 4
0
void cpu_idle(void)
{
  	local_irq_enable();

	/* endless idle loop with no priority at all */
	while (1) {
		rcu_idle_enter();
		while (!need_resched())
			platform_idle();
		rcu_idle_exit();
		schedule_preempt_disabled();
	}
}
Ejemplo n.º 5
0
ptptr getproc(void)
{
	ptptr haltafter;
#ifdef DEBUG
#ifdef DEBUGREALLYHARD
	ptptr pp;
	kputs("getproc start ... ");
	for (pp = ptab; pp < ptab_end; pp++)
		kprintf("ptab[0x%x]: pid=%d uid=%d status=%d, page=0x%x\n",
			pp, pp->p_pid, pp->p_uid, pp->p_status,
			pp->p_page);
#endif
#endif

	haltafter = getproc_nextp;

	for (;;) {
		getproc_nextp++;
		if (getproc_nextp >= ptab_end) {
			getproc_nextp = ptab;
		}

		switch (getproc_nextp->p_status) {
		case P_RUNNING:
			panic("getproc: extra running");
		case P_READY:
#ifdef DEBUG
			kprintf("[getproc returning %x pid=%d]\n",
				getproc_nextp, getproc_nextp->p_pid);
#endif
			return getproc_nextp;
		}
		/* Take a nap: not that it makes much difference to power on most
		   Z80 type devices */
		if (getproc_nextp == haltafter) {
			/* we have only one interrupt stack so we can't take interrupts */
			if(udata.u_ininterrupt)
				panic("getproc: cannot ei");
			/* yes please, interrupts on (WRS: they probably are already on?) */
			ei();
			platform_idle();
		}
	}
}
Ejemplo n.º 6
0
/*
 * Powermanagement idle function, if any is provided by the platform.
 */
void arch_cpu_idle(void)
{
	platform_idle();
}