This is a framebuffer driver and usage, tested on the DE2 board.
1. download the DE2 demo disc,
DE2 System CD v. 1.5—ZIP 2. download the
Avalon_VGA_Controller.zip (you must join Nios Forum to access the "Post Your Own IP")
and
PS/2 component3. unzip the DE2 demo disc, in project dir, DE2_System_v1.5/DE2_demonstrations/DE2_NIOS_HOST_MOUSE_VGA
unzip the VGA controller and PS/2.
4. in the same project dir, unzip the attached
de2_vga.zip . I have included ptf and sof in it. I delete the binary VGA, add the new VGA at 640x480 16bits 565, add PS/2, and change the SDRAM clock from 50MHz to 100MHz. Now the SDRAM have 200MByte/s bandwidth, and the VGA will use 50MByte/s. ( If you ever want to use 24bits color, you will need to swap RED and BLUE outputs at the top level, as to make it compatible with Microwin. )
5. in uClinux-dist kernel config,
Processor type and features -->
--- Platform drivers Options
[*] Avalon VGA controller support
[*] PS2 controller
Device Drivers --> Character devices --->
[*] Virtual terminal
[ ] Support for console on virtual terminal # YOU SHOULD NOT SELECT THISselect the frame buffer driver,
Device Drivers --> Graphics support --->
Console display driver support --->
[ ] VGA text console # YOU MUST UNSELECT THIS< > Framebuffer Console support select input device drivers,
Device Drivers --> Input device support
[*] Generic input layer (needed for keyboard, mouse, ...)
--- Userland interfaces
[*] Mouse interface
[ ] Provide legacy /dev/psaux device
(1024) Horizontal screen resolution
(768) Vertical screen resolution
if you will use PS/2 mouse or keyboard,
--- Input Device Drivers
[*] Keyboard --->
<*> AT keyboard
[*] Mouse --->
<*> PS/2 mouse
Hardware I/O ports --->
--- Serial I/O support
[ ] i8042 PC Keyboard controller
[ ] Serial port line disciplineif you will use USB mouse or keyboard, select ISP1362 USB host driver (see
UsbHost ) and,
Device Drivers --> USB support -->
--- USB Input Devices
[*] USB Human Interface Device (full HID) support
[*] HID input layer support
6. in uClinux-dist user config,
Library Configuration-->
[*] Build libZ
[*] Build libjpeg
MicroWindows --->
[*] MicroWindows
--- Compiling Options
[*] Optimize
--- Libraries
[*] NanoX
--- Demos
[*] NanoXDemo
--- Applications
[*] NanoWM
--- Settings
(Packed-16bit-5/6/5) Screeen PixType
[ ] Link App into server
[*] Have File IO
[*] Have JPEG Support # if you want JPEG, and then libjpeg will be selected
--- Display Config
[*] Frame Buffer Display
--- Mouse/Touch Screen
[*] Serial Mouse
--- Keyboard
[*] Scan Keyboard
--- Install These Applications
[*] Nano-X
[*] NanoWM
[*] NXclock
[*] NXterm
[*] NXView
7. Build and boot uClinux,
It will show,
io scheduler noop registered
io scheduler deadline registered (default)
fb0: Altera frame buffer device, using 600K of video memory
Serial: JTAG UART driver $Revision: 1.1 $
ttyJ0 at MMIO 0x806810f0 (irq = 1) is a jtag_uart
Then it will detect the USB mouse,
/> input: CHESEN USB MOUSE as /class/input/input0
input: USB HID v1.10 Mouse [CHESEN USB MOUSE] on usb-isp1362-hcd-2
Last, run the nano-X server,
/> nano-X &
/> nanowm &
/> nxclock &
/> nxterm &
It should display a arrow cursor, round clock and shell terminal.
OR, try the attached
zImage_de2_vga,
nano-X &
nxview /home/ftp/rhino.jpg &
The 8M memory on DE2 is very tight. So you should not add too many features/drivers in kernel , or user apps. Otherwise it will run out of memory and crash.
LCD frame buffer on NEEK
This is driver is available only in the v2.6.26-nios2 branch of uClinux-dist.git.
In uClinux-dist kernel config,
Processor type and features -->
Platform (Altera Nios II Embedded Evaluation Kit support) -->
Device Drivers --> Character devices --->
[*] Virtual terminal
[ ] Support for console on virtual terminal # YOU MUST UNSELECT THISselect the frame buffer driver,
Device Drivers --> Graphics support --->
[*] Support for frame buffer devices ---> [*] Altera framebuffer support
Console display driver support --->
[ ] VGA text console # YOU MUST UNSELECT THIS< > Framebuffer Console support select the SPI driver for touch panel,
Device Drivers --> [*] SPI support ---> [*] Altera SPI Controller
select input device drivers,
Device Drivers --> Input device support
[*] Generic input layer (needed for keyboard, mouse, ...)
--- Userland interfaces
[*] Mouse interface
[ ] Provide legacy /dev/psaux device
(800) Horizontal screen resolution
(480) Vertical screen resolution
[*] Event interface # You must select this to use touch panelif you will use PS/2 mouse or keyboard,
--- Input Device Drivers
[*] Keyboard ---> <*> AT keyboard
[*] Mouse ---> <*> PS/2 mouse
[*] Touchscreens ---> [*] ADS7846/TSC2046 and ADS7843 based touchscreens
Hardware I/O ports --->
--- Serial I/O support
[ ] i8042 PC Keyboard controller # YOU MUST UNSELECT THIS
[ ] Serial port line discipline # YOU MUST UNSELECT THIS[*] Altera UP PS2 controller
6. in uClinux-dist user config,
MicroWindows --->
[*] MicroWindows
--- Compiling Options
[*] Optimize
--- Libraries
[*] NanoX
--- Demos
[*] NanoXDemo
--- Applications
[*] NanoWM
--- Settings
(Packed-32bit-8/8/8) Screeen PixType
[ ] Link App into server
[*] Have File IO
[*] Have JPEG Support
--- Display Config
[*] Frame Buffer Display
--- Mouse/Touch Screen
[ ] Serial Mouse # only if you have ps2 mouse
[*] Common touchscreen using tslib
[ ] No Mouse--- Keyboard
[*] Scan Keyboard # only if you have a ps2 keyboard
[ ] No Keyboard # only if you don't have a keyboard
--- Install These Applications
[*] Nano-X
[*] NanoWM
[*] NTetris
[*] NXclock
[*] NXView
Build and boot, you should see the fb0 and input device.
io scheduler noop registered
io scheduler deadline registered (default)
fb0: Altera FB frame buffer devicettyJ0 at MMIO 0x8002000 (irq = 10) is a Altera JTAG UART
console [ttyJ0] enabled
altps2 : base 88009280 irq 9
mice: PS/2 mouse device common for all mice
ads7846 spi0.0: touchscreen, irq 14
input: ADS784x Touchscreen as /class/input/input0input: AT Raw Set 2 keyboard as /class/input/input1
Calibrate the touch screen.
/> TSLIB_FBDEVICE=/dev/fb0
/> TSLIB_CONSOLEDEVICE=none
/> TSLIB_CALIBFILE=/etc/pointercl
/> TSLIB_TSDEVICE=/dev/input/event0 // your touchscreen device
/> ts_calibrate
You could save the file of TSLIB_CALIBFILE to a flash filesystem, so that you
don't have to run ts_calibrate each time.
Run the nano-X server,
/> CONSOLE=/dev/tty1 # only if you have keyboard
/> nano-X &
/> nanowm &
/> nxclock &It should display a round clock.
Then you can try out nxview and display jpeg picture. eg,
/> nxview /home/ftp/rhino.jpg &Or plag a game,
/> ntetris &
drunken79 posted SDL sources at
SDL for Nios2look
in the file CONFIGURE.NIOS for ./configure options. After compiling,
the library is in /src/.libs/ or in the directory you specified with
--prefix.
Some small example programms from :
Example SDL ProgrammsAnd a thread at gmane about uclinux and libsdl :
Gmane SDL on uClinuxThe Nano-X Window System previously named
Microwindows
Linux Framebuffer Driver Writing HOWTOHow to use framebuffer devices
Writting Linux Frame Buffer Driver fo LCD Device - China Linux Forum [ 簡體 ]
Introduction to Microwindows Programming | Linux Journal
Embedded GUI: FLTK SDL
How to write a framebuffer driver using the
new api.
Input APIThe Linux USB Input Subsystem, Part I
Changelog of de2_vga.zip,
ver 2. add PS/2.