Date: Thu, 07 Mar 2019 18:43:07 +0000 From: bugzilla-noreply@freebsd.org To: ports-bugs@FreeBSD.org Subject: [Bug 236373] mmio doesn't work on mmio Message-ID: <bug-236373-7788@https.bugs.freebsd.org/bugzilla/>
next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D236373 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@FreeBSD.org Reporter: ralfpeg@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 regist= er volatile uint32_t *gposr0; //general purpose output set register volatile uint32_t *gpocr0; //general purpose output clear register //open fd to physical memory memfd =3D open("/dev/mem", O_RDWR|O_SYNC); if(memfd =3D=3D -1) { printf("error opening /dev/mem\n"); return 1; } //mapping into memory gpfs0 =3D mmap(NULL, sysconf(_SC_PAGE_SIZE), PROT_READ | PROT_WRITE, MAP_SHARED, memfd, 0x7e200000); if(gpfs0 =3D=3D MAP_FAILED) { printf("map failed: %d\n", errno); return 1; }=20=20=20=20=20=20=20 gpfsr0 =3D gpfs0; //GPIO Function select 0=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20 gposr0 =3D gpfs0 + 0x1c; //GPIO Output Set 0 //gposr1 =3D gpfs0 + 32; //GPIO Output Set 0 gpocr0 =3D gpfs0 + 0x28; //GPIO Output Clear 0 // gpocr1 =3D gpfs0 + 44; //GPIO Output Clear 0 *gpfsr0 =3D 0111111111; *gposr0 =3D 0xffffffff; munmap((void *) gpfs0, sysconf(_SC_PAGE_SIZE)); //printf("%ld\n", sysconf(_SC_PAGE_SIZE)); printf("finish\n"); return 0; } --=20 You are receiving this mail because: You are the assignee for the bug.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-236373-7788>