[Bug 236373] mmio doesn't work on mmio
bugzilla-noreply at freebsd.org
bugzilla-noreply at freebsd.org
Thu Mar 7 18:43:10 UTC 2019
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=236373
Bug ID: 236373
Summary: mmio doesn't work on mmio
Product: Ports & Packages
Version: Latest
Hardware: arm
OS: Any
Status: New
Severity: Affects Only Me
Priority: ---
Component: Individual Port(s)
Assignee: ports-bugs at FreeBSD.org
Reporter: ralfpeg at hotmail.de
this test program should set all gpio pins to high level. it does, with
different memory address, on raspbian. i guess there's something wrong with the
port.
#include <unistd.h>
#include <fcntl.h>
#include <stdio.h>
#include <sys/mman.h>
#include <errno.h>
#include <stdint.h>
int main()
{
volatile void *gpfs0; //general purpose function select 0
int memfd;
volatile uint32_t *gpfsr0; //general purpose function select register
volatile uint32_t *gposr0; //general purpose output set
register
volatile uint32_t *gpocr0; //general purpose output clear
register
//open fd to physical memory
memfd = open("/dev/mem", O_RDWR|O_SYNC);
if(memfd == -1)
{
printf("error opening /dev/mem\n");
return 1;
}
//mapping into memory
gpfs0 = mmap(NULL, sysconf(_SC_PAGE_SIZE), PROT_READ | PROT_WRITE,
MAP_SHARED, memfd, 0x7e200000);
if(gpfs0 == MAP_FAILED)
{
printf("map failed: %d\n", errno);
return 1;
}
gpfsr0 = gpfs0; //GPIO Function select 0
gposr0 = gpfs0 + 0x1c; //GPIO Output Set 0
//gposr1 = gpfs0 + 32; //GPIO Output Set 0
gpocr0 = gpfs0 + 0x28; //GPIO Output Clear 0
// gpocr1 = gpfs0 + 44; //GPIO Output Clear 0
*gpfsr0 = 0111111111;
*gposr0 = 0xffffffff;
munmap((void *) gpfs0, sysconf(_SC_PAGE_SIZE));
//printf("%ld\n", sysconf(_SC_PAGE_SIZE));
printf("finish\n");
return 0;
}
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the freebsd-ports-bugs
mailing list