2010-08-13 14:46:38 +03:00
|
|
|
/*
|
2010-10-22 00:26:43 +03:00
|
|
|
* f32x/gpio-s3c24xx.c - Really primitive S3C244x GPIO access. Ports B-H only.
|
2010-08-13 14:46:38 +03:00
|
|
|
*
|
2011-01-03 23:33:56 +02:00
|
|
|
* Written 2008, 2011 by Werner Almesberger
|
|
|
|
* Copyright 2008, 2011 Werner Almesberger
|
2010-08-13 14:46:38 +03:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <fcntl.h>
|
|
|
|
#include <sys/mman.h>
|
|
|
|
|
2010-10-22 02:25:17 +03:00
|
|
|
#include "gpio-s3c24xx.h"
|
|
|
|
|
2010-08-13 14:46:38 +03:00
|
|
|
|
|
|
|
#define BASE 0x56000000
|
|
|
|
|
|
|
|
|
2010-10-22 02:25:17 +03:00
|
|
|
volatile uint32_t *mem;
|
2010-08-13 14:46:38 +03:00
|
|
|
|
|
|
|
|
|
|
|
void gpio_init(void)
|
|
|
|
{
|
|
|
|
int fd;
|
|
|
|
|
2011-01-03 23:33:56 +02:00
|
|
|
fd = open("/dev/mem", O_RDWR | O_SYNC);
|
2010-08-13 14:46:38 +03:00
|
|
|
if (fd < 0) {
|
|
|
|
perror("/dev/mem");
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
mem = mmap(NULL, 0x1000, PROT_READ | PROT_WRITE, MAP_SHARED, fd, BASE);
|
|
|
|
if (mem == MAP_FAILED) {
|
|
|
|
perror("mmap");
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
}
|