This project was developed as part of the IF817 - Interface Hardware-Software course at UFPE, consisting of implementing an interactive game running on a DE2i-150 (Intel/Altera) development board, including the complete development of device drivers necessary for communication with the board's peripherals.
- Artur Vinicius Pereira Fernandes - (arturvpf)
- Felipe Mateus FalcΓ£o Barreto - (felipemfb)
- JoΓ£o Victor da Silva Nascimento - (jvsn2)
- Felipe Torres - (felipetmacedo)
- Matheus Ayres dos Santos - (mas11)
The project implements a complete system that includes:
- Game developed to run directly on the DE2i-150 board
- Uses available peripherals on the board for user interaction
- Interface through buttons, switches, LEDs, and 7-segment displays
- PCI Driver: Communication with DE2i-150 board via PCI bus
- Char Driver: Character device driver for basic operations
- Complete implementation of read/write operations and ioctl
The DE2i-150 board has several peripherals controlled through the drivers:
- Switches: Slide switches for data input
- Push Buttons: Buttons for commands and control
- Red/Green LEDs: Visual indicators and feedback
- 7-Segment Displays: Numeric display (left and right)
- PCI Interface: High-speed communication with the system
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β Application βββββΊβ Drivers βββββΊβ DE2i-150 β
β (Game) β β (PCI + Char) β β Board β
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β β β
β ββββββββββΌβββββββββ β
ββββββββββββββββΊβ Linux Kernel βββββββββββββββ
βββββββββββββββββββ
pci/de2i-150.c
: Main PCI driver for board communication- Implements memory-mapped I/O (MMIO) operations
- Controls all peripherals via ioctl commands
- Supports read/write operations for devices
char/dummy.c
: Example character device driver- Basic file operations implementation
- Used for testing and development
ioctl_cmds.h
: ioctl command definitions for peripheral controldisplay.h
: Constants for 7-segment display control
main.cpp
: Main game application (under development)
c/
: C examples for driver testingapp-pci.c
: Demonstrates PCI driver usageapp-char.c
: Demonstrates character driver usage
python/
: Python versions of examples
- Directory for main game implementation
The driver supports the following commands for peripheral control:
#define RD_SWITCHES _IO('a', 'a') // Read switches
#define RD_PBUTTONS _IO('a', 'b') // Read push buttons
#define WR_L_DISPLAY _IO('a', 'c') // Write to left display
#define WR_R_DISPLAY _IO('a', 'd') // Write to right display
#define WR_RED_LEDS _IO('a', 'e') // Control red LEDs
#define WR_GREEN_LEDS _IO('a', 'f') // Control green LEDs
- Linux system with kernel headers
- DE2i-150 board connected via PCI
- Superuser permissions
# Compile main application
make
# Compile PCI driver
cd driver/pci
make
# Or use the complete setup script
./setup.sh
# Load module into kernel
sudo insmod driver/pci/de2i-150.ko
# Configure device permissions
sudo chmod 666 /dev/mydev
- Useful Commands: Complete list of development commands
- Makefile: Simplified build system
- setup.sh: Automated environment setup script
This project demonstrates fundamental concepts of:
- Systems Programming: Kernel-level development
- Device Drivers: Linux module implementation
- Hardware/Software Interface: Direct peripheral interfacing
- PCI Communication: High-speed bus protocols
- Embedded Programming: Platform-specific development
NOTE: This project structure is provided as a development base. The build system is simplified but can be adapted as needed. The driver/
directory contains essential Makefiles that should not be removed.
.
βββ src
β βββ main.cpp
βββ include
βΒ Β βββ display.h
βΒ Β βββ ioctl_cmds.h
βββ driver
βΒ Β βββ char
βΒ Β βΒ Β βββ dummy.c
βΒ Β βΒ Β βββ Makefile
βΒ Β βββ pci
βΒ Β βββ de2i-150.c
βΒ Β βββ Makefile
βββ exemples
βΒ Β βββ c
βΒ Β βΒ Β βββ app-char.c
βΒ Β βΒ Β βββ app-pci.c
βΒ Β βββ python
βΒ Β βββ app-char.py
βΒ Β βββ app-pci.py
βββ docs
βΒ Β βββ commands.md
βββ LICENSE
βββ Makefile
βββ README.md
βββ setup.sh