URL
https://opencores.org/ocsvn/or1k/or1k/trunk
Go to most recent revision |
Show entire file |
Details |
Blame |
View Log
Rev 1715 |
Rev 1724 |
Line 27... |
Line 27... |
|
|
#include "port.h"
|
#include "port.h"
|
#include "arch.h"
|
#include "arch.h"
|
#include "abstract.h"
|
#include "abstract.h"
|
#include "gpio.h"
|
#include "gpio.h"
|
#include "gpio_i.h"
|
|
#include "sim-config.h"
|
#include "sim-config.h"
|
#include "pic.h"
|
#include "pic.h"
|
#include "vapi.h"
|
#include "vapi.h"
|
#include "debug.h"
|
#include "debug.h"
|
#include "sched.h"
|
#include "sched.h"
|
|
|
DEFAULT_DEBUG_CHANNEL(gpio);
|
DEFAULT_DEBUG_CHANNEL(gpio);
|
|
|
static void gpio_vapi_read( unsigned long id, unsigned long data, void *dat );
|
|
static uint32_t gpio_read32( oraddr_t addr, void *dat );
|
|
static void gpio_write32( oraddr_t addr, uint32_t value, void *dat );
|
|
|
|
|
/*
|
|
* The various VAPI IDs each GPIO device has
|
|
*/
|
|
enum { GPIO_VAPI_DATA = 0,
|
|
GPIO_VAPI_AUX,
|
|
GPIO_VAPI_CLOCK,
|
|
GPIO_VAPI_RGPIO_OE,
|
|
GPIO_VAPI_RGPIO_INTE,
|
|
GPIO_VAPI_RGPIO_PTRIG,
|
|
GPIO_VAPI_RGPIO_AUX,
|
|
GPIO_VAPI_RGPIO_CTRL,
|
|
GPIO_NUM_VAPI_IDS };
|
|
|
|
/*
|
|
* Implementatino of GPIO Code Registers and State
|
|
*/
|
|
struct gpio_device
|
|
{
|
|
/* Is peripheral enabled */
|
|
int enabled;
|
|
|
|
/* Base address in memory */
|
|
oraddr_t baseaddr;
|
|
|
|
/* Which IRQ to generate */
|
|
int irq;
|
|
|
|
/* Which GPIO is this? */
|
|
unsigned gpio_number;
|
|
|
|
/* VAPI IDs */
|
|
unsigned long base_vapi_id;
|
|
|
|
/* Auxiliary inputs */
|
|
unsigned long auxiliary_inputs;
|
|
|
|
/* Visible registers */
|
|
struct
|
|
{
|
|
unsigned long in;
|
|
unsigned long out;
|
|
unsigned long oe;
|
|
unsigned long inte;
|
|
unsigned long ptrig;
|
|
unsigned long aux;
|
|
unsigned long ctrl;
|
|
unsigned long ints;
|
|
|
|
int external_clock;
|
|
} curr, next;
|
|
};
|
|
|
|
static void gpio_vapi_read( unsigned long id, unsigned long data, void *dat );
|
static void gpio_external_clock( unsigned long value, struct gpio_device *gpio );
|
static void gpio_external_clock( unsigned long value, struct gpio_device *gpio );
|
static void gpio_device_clock( struct gpio_device *gpio );
|
static void gpio_device_clock( struct gpio_device *gpio );
|
static void gpio_clock( void *dat );
|
static void gpio_clock( void *dat );
|
|
|
/* Initialize all parameters and state */
|
/* Initialize all parameters and state */
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.