MMAP and MUNMAP
Mmap() is a system call to map a file content in application address space. This are needed if we want to read or write file content directly from memory instead of file read/write.
Mapping file content using mmap and reading content by dereferencing pointer is very common example. We are doing something different here. We are mapping MMIO memory using /dev/mem device. Linux has memory device to map system and MMIO memory address space. Once address range is mapped to user space then we can alter MMIO register with simple pointer operations. This mechanism is very common for accessing in embedded system for accessing GPIO and MMIO registers directly from user mode. We have used a ARM9 board and figured out GPIO pin which can be set to high or low. We connected a LED with 1K resistor to ground. We are toggling MMIO register bit and LED will blink as we are altering the bits.
About our authors: Team EQA
You have viewed 1 page out of 248. Your C learning is 0.00% complete. Login to check your learning progress.
Questions index C Questions C++ Questions Win32 MFC COM/DCOM DLL Questions
Compilers & Editors
Download Visual Studio Download XCode Download Visual Studio Code Android studio install sdk Eclipse installer Best C compilers IDEs
Development system setup
Windows media creation tool MSDN subscription Ubuntu virtualbox
New updated posts
Why learn C? Draw on printer Free alt softwares