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

Subversion Repositories or1k_old

[/] [or1k_old/] [trunk/] [or1ksim/] [testbench/] [acv_gpio.c] - Rev 478

Go to most recent revision | Compare with Previous | Blame | View Log

/* GPIO test */
 
#include "support.h"
 
/* Relative Register Addresses */
#define RGPIO_IN        (4 * 0x00)
#define RGPIO_OUT       (4 * 0x01)
#define RGPIO_OE        (4 * 0x02)
#define RGPIO_INTE      (4 * 0x03)
#define RGPIO_PTRIG     (4 * 0x04)
#define RGPIO_AUX       (4 * 0x05)
#define RGPIO_CTRL      (4 * 0x06)
 
/* Fields inside RGPIO_CTRL */
#define RGPIO_CTRL_ECLK      0x00000001
#define RGPIO_CTRL_NEC       0x00000002
#define RGPIO_CTRL_INTE      0x00000004
#define RGPIO_CTRL_INT       0x00000008
 
#define GPIO_BASE 0xB0000000LU
 
typedef volatile unsigned long *GPIO_REG;
 
GPIO_REG rgpio_in = (unsigned long *)(GPIO_BASE + RGPIO_IN),
  rgpio_out = (unsigned long *)(GPIO_BASE + RGPIO_OUT),
  rgpio_oe = (unsigned long *)(GPIO_BASE + RGPIO_OE),
  rgpio_inte = (unsigned long *)(GPIO_BASE + RGPIO_INTE),
  rgpio_ptrig = (unsigned long *)(GPIO_BASE + RGPIO_PTRIG),
  rgpio_aux = (unsigned long *)(GPIO_BASE + RGPIO_AUX),
  rgpio_ctrl = (unsigned long *)(GPIO_BASE + RGPIO_CTRL);
 
int main()
{
  printf( "Starting GPIO test\n" );
 
  while ( *rgpio_in != 0x01234567 )
    ;
  *rgpio_oe = 0xffffffff;
  *rgpio_out = 0x89abcdef;
 
  printf( "Ending GPIO test\n" );
 
  report (0xdeaddead);
  return 0;
}
 
 
 

Go to most recent revision | Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

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