예제 #1
0
파일: lab0.c 프로젝트: eriknore/il2206
// The interrupt service routine
static void Key_InterruptHandler(void* context, alt_u32 id)
{
    pollkey();
    /* Write to the edge capture register to reset it. */
    IOWR_ALTERA_AVALON_PIO_EDGE_CAP(DE2_PIO_KEYS4_BASE, 0);
    /* reset interrupt capability for the Button PIO. */
    IOWR_ALTERA_AVALON_PIO_IRQ_MASK(DE2_PIO_KEYS4_BASE, 0xf);
}
예제 #2
0
파일: vtclock.c 프로젝트: yyolk/vtclock
void
mydelay_half()
     /* sleep until the half-second mark.  also works via polling.
        also close enough for government work. */
{
  static struct timeval curr;
  while (1) {
    gettimeofday(&curr, NULL);
    if (curr.tv_usec >= 500000)
      return;
    pollkey();
  }
}
예제 #3
0
파일: vtclock.c 프로젝트: yyolk/vtclock
void
mydelay()
     /* sleep until second changes.  works via polling.  close enough
        for government work. */
{
  static struct timeval prev;
  static struct timeval curr;
  gettimeofday(&prev, NULL);
  while (1) {
    gettimeofday(&curr, NULL);
    if (curr.tv_sec > prev.tv_sec)
      return;
    pollkey();
    prev = curr;
  }
}