![]() Seeing the same code in both assembly language and C++ should make the code easy to follow.īoth countmain.cpp and muxmain.cpp print a lot of output to the console however, I didn't bother with that in the assembly language versions. ![]() Both gpiocount.asm and gpiomux.asm have main functions, but they can be conditionally compiled to replace these functions with countmain.cpp and muxmain.cpp (the default in Makefile). Those two functions are also placed in libgpio.Įach of the three GPIO programs is placed in a separate ARM64 assembly language file. The gpiocount program creates a shared memory space and gpiomux reads the address of this shared memory. Mapping the GPIO's hardware registers into the memory spaces of gpiocount and gpiomux is another operation performed by libgpio. That takes care of the reading, writing, and arithmetic.īoth gpiocount and gpiomux need to use the basic GPIO functions, so these functions have been placed into a shared library, libgpio.asm, which is assembled and linked to libgpio.so created by Makefile.Įach separate GPIO operation – reading a GPIO pin, writing a pin, setting a pin to input mode or output mode – is a function in libgpio. All segment lines of the four displays are wired together inside the chip so that, to see the separate digits, you must turn on the four displays one at a time, faster than the eye can detect. The gpiocount program writes its values to 4 bytes of memory that is shared with gpiomux.asm, which runs in the background, reads the 4 bytes written by gpiocount, and writes the bytes into a four-digit, seven-segment display. ![]() That's the arithmetic portion of the project. The count mode is changed with a switch that causes an interrupt to a loadable kernel module. The first program, gpiocount.asm, counts up or down in various number systems: binary, octal, decimal, and hexadecimal – or really, any number system up to base 16.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |