Nano-X
From Yan-server-AMD1G
This wiki shares information on setting up and running Nano-X on Ubuntu 8.04
Contents |
[edit] Porting
[edit] Source Code
- See http://www.nano-x.org/CVS.html and using eclipse
[edit] Generating Libraries and Demo Binaries
- Modify the config file under /src
- Build Nano-X library only
MICROWIN = N
NANOX = Y
SHAREDLIBS = N
OBJFRAMEWORK = N - Build Nano-X demo only
MICROWINDEMO = N
NANOXDEMO = Y - Link application to Nano-X server (i.e. no need to run ./nano-X before running application)
LINK_APP_INTO_SERVER = Y - Disable JPEG Support
HAVE_JPEG_SUPPORT = N - Disable native .fnt loadable font support
HAVE_FNT_SUPPORT = N
HAVE_FNTGZ_SUPPORT = N - Disable Freetype Support
HAVE_FREETYPE_SUPPORT = N
HAVE_FREETYPE_2_SUPPORT = N - Disable .pcf.gz PCF font support
HAVE_PCF_SUPPORT = Y
HAVE_PCFGZ_SUPPORT = N - Enable X11 Support
X11 = Y
- Build Nano-X library only
- Compile the project under /src
make clean; make
- Test for demo under /src/bin (note, some demos may not run correctly under the above configuration)
./slider
[edit] Making Nano-X Applications
- Create your nano-X application
- Create a makefile
# Define your relative paths here -------------------------------- NANO_X := ./../../../microwin/src NANO_X_INCDIR := $(NANO_X)/include NANO_X_LIBDIR := $(NANO_X)/lib X11_LIBDIR := /usr/X11R6/lib # Complier ------------------------------------------------------- CC := gcc # Library -------------------------------------------------------- LIBS := -lnano-X -lX11 # Flags ---------------------------------------------------------- CFLAG := -I$(NANO_X_INCDIR) -L$(NANO_X_LIBDIR) -L$(X11_LIBDIR) # Target file ---------------------------------------------------- TARGET := application # Object files --------------------------------------------------- OBJECTS := application.c # Build Rule ----------------------------------------------------- all: $(TARGET) $(TARGET): $(OBJECTS) @echo 'Building target: $@' @echo 'Invoking: gcc' $(CC) $(CFLAG) $^ -o $@ $(LIBS) @echo 'Finished building target: $@' @echo ' ' # Clean Rule ----------------------------------------------------- clean: -$(RM) $(TARGET) -@echo ' '
- Execute
make clean; make; ./application
[edit] Architecture
+---------+---------+----------+
Application | App 1 | App 2 | ... |
+---------+---------+----------+
| Nano-X API |
+-------------+--------+-------+
Nano-X Drivers | Framebuffer | Keypad | Mouse |
+-------------+--------+-------+
| POSIX System Call | e.g. open(), ioctl(), mmap()
+-------------+--------+-------+
Hardware | Display | Keypad | Mouse |
+-------------+--------+-------+
[edit] Nano-X API
- See Nano-X Programming Tutorial to use Nana-X in applications.
[edit] Framebuffer
- Examples: ./src/drivers/scr_bios.c; ./src/drivers/scr_fb.c; ./src/drivers/fblin32.c; ./src/drivers/fb.c;
- Function:
- A generic interface allowing Nano-X to access different types of displays
- API (full list refers to structure SCREENDEVICE in ./src/include/device.h):
- PSD xxx_open(PSD psd);
- void xxx_close(PSD psd);
- void xxx_setportrait(PSD psd, int portraitmode);
- void xxx_setpalette(PSD psd,int first, int count, MWPALENTRY *palette);
- void xxx_getscreeninfo(PSD psd, PMWSCREENINFO psi);
- void xxx_drawpixel(PSD psd, MWCOORD x, MWCOORD y, MWPIXELVAL c);
- MWPIXELVAL xxx_readpixel(PSD psd, MWCOORD x, MWCOORD y);
- void xxx_drawhorzline(PSD psd, MWCOORD x1, MWCOORD x2, MWCOORD y, MWPIXELVAL c);
- void xxx_drawvertline(PSD psd, MWCOORD x, MWCOORD y1, MWCOORD y2, MWPIXELVAL c);
- void xxx_fillrect(PSD psd, MWCOORD x1, MWCOORD y1, MWCOORD x2, MWCOORD y2, MWPIXELVAL c);
[edit] Keypad
- Examples: ./src/drivers/kbd_ipag.c
- Function:
- A generic interface allowing Nano-X to access different types of keypads
- API (full list refers to structure KBDDEVICE in ./src/include/device.h):
- int xxx_open(KBDDEVICE *pkd);
- void xxx_close(void);
- void xxx_getmodifierinfo(MWKEYMOD *modifiers, MWKEYMOD *curmodifiers);
- int xxx_read(MWKEY *kbuf, MWKEYMOD *modifiers, MWSCANCODE *scancode);
- int xxx_poll(void);
[edit] Mouse
- Examples: ./src/drivers/mou_dos.c
- Function:
- A generic interface allowing Nano-X to access different types of pointer devices
- API (full list refers to structure MOUSEDEVICE in ./src/include/device.h):
- int xxx_open(MOUSEDEVICE *pmd);
- void xxx_close(void);
- int xxx_getbuttoninfo(void);
- void xxx_getdefaultaccel(int *pscale,int *pthresh);
- int xxx_read(MWCOORD *dx, MWCOORD *dy, MWCOORD *dz,int *bp);
- int xxx_poll(void);

