Пример #1
0
void Shm_Lock(
    Shm_Locked_queue_Control *lq_cb
)
{
    uint32_t         isr_level;
    uint32_t         *lockptr = (uint32_t*) &lq_cb->lock;
    uint32_t         lock_value;

    lock_value = 0x80000000;
    rtems_interrupt_disable( isr_level );

    Shm_isrstat = isr_level;
    while ( lock_value ) {
        asm volatile( ""
                      : "=r" (lockptr), "=r" (lock_value)
                      : "0" (lockptr),  "1" (lock_value)
                    );
        /*
         *  If not available, then may want to delay to reduce load on lock.
         */

        if ( lock_value )
            rtems_bsp_delay( 10 );   /* approximately 10 microseconds */
    }
}
Пример #2
0
static void kbd_put(u_char c, int ms, int port) {
  	while (kbd_inb(KBD_STATUS_REG) & KBD_STAT_IBF) {
		if (--ms < 0) return;
#ifdef __BOOT__
		boot_udelay(1000);
#else
		rtems_bsp_delay(1000);
#endif
	}
	kbd_outb(port, c);
}
Пример #3
0
void bsp_smp_wait_for(
  volatile unsigned int *address,
  unsigned int           desired,
  int                    maximum_usecs
)
{
  int iterations;
  volatile unsigned int *p = address;

  for (iterations=0 ;  iterations < maximum_usecs ; iterations++ ) {
    if ( *p == desired )
      break;

    rtems_bsp_delay( 1 );
  }
}
Пример #4
0
static int kbd_get(int ms) {
	int status, data;
	while(1) {
		status = kbd_inb(KBD_STATUS_REG);
		if (status & KBD_STAT_OBF) {
			data = kbd_inb(KBD_DATA_REG);
			if (status & (KBD_STAT_GTO | KBD_STAT_PERR))
				return -1;
			else
				return data;
		}
		if (--ms < 0) return -1;
#ifdef __BOOT__
		boot_udelay(1000);
#else
		rtems_bsp_delay(1000);
#endif
	}
}