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 1358 and 1359

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

Rev 1358 Rev 1359
Line 36... Line 36...
#include "debug.h"
#include "debug.h"
 
 
static struct gpio_device gpios[MAX_GPIOS];
static struct gpio_device gpios[MAX_GPIOS];
 
 
static void gpio_vapi_read( unsigned long id, unsigned long data );
static void gpio_vapi_read( unsigned long id, unsigned long data );
static uint32_t gpio_read32( oraddr_t addr );
static uint32_t gpio_read32( oraddr_t addr, void *dat );
static void gpio_write32( oraddr_t addr, uint32_t value );
static void gpio_write32( oraddr_t addr, uint32_t value, void *dat );
 
 
static void gpio_external_clock( unsigned long value );
static void gpio_external_clock( unsigned long value );
static void gpio_device_clock( struct gpio_device *gpio );
static void gpio_device_clock( struct gpio_device *gpio );
static int gpio_find_device( oraddr_t addr, struct gpio_device **gpio, oraddr_t *reladdr );
static int gpio_find_device( oraddr_t addr, struct gpio_device **gpio, oraddr_t *reladdr );
static struct gpio_device *gpio_find_vapi_device( unsigned long id, unsigned *which_vapi );
static struct gpio_device *gpio_find_vapi_device( unsigned long id, unsigned *which_vapi );
Line 66... Line 66...
    if ( gpio->baseaddr != 0 ) {
    if ( gpio->baseaddr != 0 ) {
      /* Get IRQ */
      /* Get IRQ */
      gpio->irq = config.gpios[i].irq;
      gpio->irq = config.gpios[i].irq;
 
 
      /* Register memory range */
      /* Register memory range */
      register_memoryarea( gpio->baseaddr, GPIO_ADDR_SPACE, 4, 0, gpio_read32, gpio_write32 );
      register_memoryarea( gpio->baseaddr, GPIO_ADDR_SPACE, 4, 0, gpio_read32, gpio_write32, NULL );
 
 
      /* Possibly connect to VAPI */
      /* Possibly connect to VAPI */
      if ( config.gpios[i].base_vapi_id ) {
      if ( config.gpios[i].base_vapi_id ) {
        gpio->base_vapi_id = config.gpios[i].base_vapi_id;
        gpio->base_vapi_id = config.gpios[i].base_vapi_id;
        vapi_install_multi_handler( gpio->base_vapi_id, GPIO_NUM_VAPI_IDS, gpio_vapi_read );
        vapi_install_multi_handler( gpio->base_vapi_id, GPIO_NUM_VAPI_IDS, gpio_vapi_read );
Line 143... Line 143...
  return NULL;
  return NULL;
}
}
 
 
 
 
/* Wishbone read */
/* Wishbone read */
uint32_t gpio_read32( oraddr_t addr )
uint32_t gpio_read32( oraddr_t addr, void *dat )
{
{
  struct gpio_device *gpio;
  struct gpio_device *gpio;
  if ( !gpio_find_device( addr, &gpio, &addr ) )        {
  if ( !gpio_find_device( addr, &gpio, &addr ) )        {
    debug( 2, "gpio_read32( 0x%"PRIxADDR" ): Not in registered range(s)\n", addr );
    debug( 2, "gpio_read32( 0x%"PRIxADDR" ): Not in registered range(s)\n", addr );
    return 0;
    return 0;
Line 165... Line 165...
  }
  }
}
}
 
 
 
 
/* Wishbone write */
/* Wishbone write */
void gpio_write32( oraddr_t addr, uint32_t value )
void gpio_write32( oraddr_t addr, uint32_t value, void *dat )
{
{
  struct gpio_device *gpio;
  struct gpio_device *gpio;
  if ( !gpio_find_device( addr, &gpio, &addr ) )        {
  if ( !gpio_find_device( addr, &gpio, &addr ) )        {
    debug( 2, "gpio_write32( 0x%"PRIxADDR" ): Not in registered range(s)\n", addr );
    debug( 2, "gpio_write32( 0x%"PRIxADDR" ): Not in registered range(s)\n", addr );
    return;
    return;

powered by: WebSVN 2.1.0

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