#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <string.h>
#include <sys/types.h>
#include <sys/mman.h>

// Include the timing library
#include <time.h>
#include <sys/time.h>

/******************************** DEFINES ***********************************/
// GPIO 0
#define GPIO_0_BASE_ADDR 0x41200000


/****************************************************************************/
/********************************** MAIN ************************************/
/****************************************************************************/

int main(int argc, char *argv[])
   {
   volatile unsigned int *InReg;
   volatile unsigned int *OutReg;

// ======================================================================
// Open up the memory mapped device so we can access the GPIO registers.
   int fd = open("/dev/mem", O_RDWR|O_SYNC);

   if (fd < 0) 
      { fprintf(stderr, "Error: /dev/mem could NOT be opened!\n"); exit(EXIT_FAILURE); }

// Add 2 for the DataReg (for an offset of 8 bytes for 32-bit integer variables)
   InReg = mmap(0, getpagesize(), PROT_READ|PROT_WRITE, MAP_SHARED, fd, GPIO_0_BASE_ADDR);
   OutReg = InReg + 2;

// ADD CODE HERE
   }
