OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [branches/] [stable_0_2_x/] [or1ksim/] [peripheral/] [gpio.c] - Diff between revs 499 and 502

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 499 Rev 502
Line 92... Line 92...
    printf( "RGPIO_OE     : 0x%08lX\n", gpio->curr.oe );
    printf( "RGPIO_OE     : 0x%08lX\n", gpio->curr.oe );
    printf( "RGPIO_INTE   : 0x%08lX\n", gpio->curr.inte );
    printf( "RGPIO_INTE   : 0x%08lX\n", gpio->curr.inte );
    printf( "RGPIO_PTRIG  : 0x%08lX\n", gpio->curr.ptrig );
    printf( "RGPIO_PTRIG  : 0x%08lX\n", gpio->curr.ptrig );
    printf( "RGPIO_AUX    : 0x%08lX\n", gpio->curr.aux );
    printf( "RGPIO_AUX    : 0x%08lX\n", gpio->curr.aux );
    printf( "RGPIO_CTRL   : 0x%08lX\n", gpio->curr.ctrl );
    printf( "RGPIO_CTRL   : 0x%08lX\n", gpio->curr.ctrl );
 
    printf( "RGPIO_INTS   : 0x%08lX\n", gpio->curr.ints );
  }
  }
}
}
 
 
 
 
/* Convert a memory address to a device struct and relative address.
/* Convert a memory address to a device struct and relative address.
Line 146... Line 147...
    debug( 2, "gpio_read32( 0x%08lX ): Not in registered range(s)\n", addr );
    debug( 2, "gpio_read32( 0x%08lX ): Not in registered range(s)\n", addr );
    return 0;
    return 0;
  }
  }
 
 
  switch( addr ) {
  switch( addr ) {
  case RGPIO_IN:
  case RGPIO_IN: return gpio->curr.in | gpio->curr.out;
    gpio->next.ctrl &= ~RGPIO_CTRL_INT;
 
    return gpio->curr.in | gpio->curr.out;
 
  case RGPIO_OUT: return gpio->curr.out;
  case RGPIO_OUT: return gpio->curr.out;
  case RGPIO_OE: return gpio->curr.oe;
  case RGPIO_OE: return gpio->curr.oe;
  case RGPIO_INTE: return gpio->curr.inte;
  case RGPIO_INTE: return gpio->curr.inte;
  case RGPIO_PTRIG: return gpio->curr.ptrig;
  case RGPIO_PTRIG: return gpio->curr.ptrig;
  case RGPIO_AUX: return gpio->curr.aux;
  case RGPIO_AUX: return gpio->curr.aux;
  case RGPIO_CTRL: return gpio->curr.ctrl;
  case RGPIO_CTRL: return gpio->curr.ctrl;
 
  case RGPIO_INTS: return gpio->curr.ints;
  }
  }
}
}
 
 
 
 
/* Wishbone write */
/* Wishbone write */
Line 176... Line 176...
  case RGPIO_OE: gpio->next.oe = value; break;
  case RGPIO_OE: gpio->next.oe = value; break;
  case RGPIO_INTE: gpio->next.inte = value; break;
  case RGPIO_INTE: gpio->next.inte = value; break;
  case RGPIO_PTRIG: gpio->next.ptrig = value; break;
  case RGPIO_PTRIG: gpio->next.ptrig = value; break;
  case RGPIO_AUX: gpio->next.aux = value; break;
  case RGPIO_AUX: gpio->next.aux = value; break;
  case RGPIO_CTRL: gpio->next.ctrl = value; break;
  case RGPIO_CTRL: gpio->next.ctrl = value; break;
 
  case RGPIO_INTS: gpio->next.ints = value; break;
  }
  }
}
}
 
 
 
 
/* Input from "outside world" */
/* Input from "outside world" */
Line 283... Line 284...
      unsigned relevant_bits = (gpio->next.ptrig & set_bits) | (~gpio->next.ptrig & cleared_bits);
      unsigned relevant_bits = (gpio->next.ptrig & set_bits) | (~gpio->next.ptrig & cleared_bits);
 
 
      if ( relevant_bits & gpio->next.inte ) {
      if ( relevant_bits & gpio->next.inte ) {
        debug( 3, "GPIO: Reporting interrupt %d\n", gpio->irq );
        debug( 3, "GPIO: Reporting interrupt %d\n", gpio->irq );
        report_interrupt( gpio->irq );
        report_interrupt( gpio->irq );
        gpio->next.ctrl |= RGPIO_CTRL_INT;
        gpio->next.ctrl |= RGPIO_CTRL_INTS;
 
        gpio->next.ints |= relevant_bits & gpio->next.inte;
      }
      }
    }
    }
  }
  }
 
 
  /* Switch to values for next clock */
  /* Switch to values for next clock */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.