diff options
author | Jay Monkman <jtm@smoothsmoothie.com> | 2005-03-11 07:27:56 +0000 |
---|---|---|
committer | Jay Monkman <jtm@smoothsmoothie.com> | 2005-03-11 07:27:56 +0000 |
commit | e8c785c68aeb6565c1cd56fcefd8edb1163f4894 (patch) | |
tree | dd3954615862f25cf1a9e81e455f37f730af7074 /c | |
parent | 2005-03-11 Philippe Simons <loki_666@fastmail.fm> (diff) | |
download | rtems-e8c785c68aeb6565c1cd56fcefd8edb1163f4894.tar.bz2 |
2005-03-11 Philippe Simons <loki_666@fastmail.fm>
* acinclude.m4: Added gp32 BSP.
* gp32/.cvsignore, gp32/Makefile.am, gp32/README, gp32/bsp_specs,
gp32/configure.ac, gp32/console/.cvsignore, gp32/console/conio.c,
gp32/console/console.c, gp32/console/defaultfont.c,
gp32/include/.cvsignore, gp32/include/bsp.h, gp32/include/conio.h,
gp32/include/tm27.h, gp32/start/.cvsignore, gp32/start/start.S,
gp32/startup/.cvsignore, gp32/startup/bspstart.c,
gp32/startup/exit.c, gp32/startup/linkcmds, gp32/startup/memmap.c: New files.
Diffstat (limited to 'c')
22 files changed, 2254 insertions, 0 deletions
diff --git a/c/src/lib/libbsp/arm/ChangeLog b/c/src/lib/libbsp/arm/ChangeLog index 41eedc8cfb..80c12cebc7 100644 --- a/c/src/lib/libbsp/arm/ChangeLog +++ b/c/src/lib/libbsp/arm/ChangeLog @@ -1,3 +1,14 @@ +2005-03-11 Philippe Simons <loki_666@fastmail.fm> + + * acinclude.m4: Added gp32 BSP. + * gp32/.cvsignore, gp32/Makefile.am, gp32/README, gp32/bsp_specs, + gp32/configure.ac, gp32/console/.cvsignore, gp32/console/conio.c, + gp32/console/console.c, gp32/console/defaultfont.c, + gp32/include/.cvsignore, gp32/include/bsp.h, gp32/include/conio.h, + gp32/include/tm27.h, gp32/start/.cvsignore, gp32/start/start.S, + gp32/startup/.cvsignore, gp32/startup/bspstart.c, + gp32/startup/exit.c, gp32/startup/linkcmds, gp32/startup/memmap.c: New files. + 2005-03-03 Ralf Corsepius <ralf.corsepius@rtems.org> * acinclude.m4: Remove arm_bare_bsp. diff --git a/c/src/lib/libbsp/arm/acinclude.m4 b/c/src/lib/libbsp/arm/acinclude.m4 index 9896b0e088..51bcf2e812 100644 --- a/c/src/lib/libbsp/arm/acinclude.m4 +++ b/c/src/lib/libbsp/arm/acinclude.m4 @@ -10,6 +10,8 @@ AC_DEFUN([RTEMS_CHECK_BSPDIR], AC_CONFIG_SUBDIRS([csb337]);; edb7312 ) AC_CONFIG_SUBDIRS([edb7312]);; + gp32 ) + AC_CONFIG_SUBDIRS([gp32]);; vegaplus ) AC_CONFIG_SUBDIRS([vegaplus]);; *) diff --git a/c/src/lib/libbsp/arm/gp32/.cvsignore b/c/src/lib/libbsp/arm/gp32/.cvsignore new file mode 100644 index 0000000000..d29e5050f5 --- /dev/null +++ b/c/src/lib/libbsp/arm/gp32/.cvsignore @@ -0,0 +1,14 @@ +Makefile +Makefile.in +aclocal.m4 +autom4te.cache +config.cache +config.guess +config.log +config.status +config.sub +configure +depcomp +install-sh +missing +mkinstalldirs diff --git a/c/src/lib/libbsp/arm/gp32/Makefile.am b/c/src/lib/libbsp/arm/gp32/Makefile.am new file mode 100644 index 0000000000..b6ee4af724 --- /dev/null +++ b/c/src/lib/libbsp/arm/gp32/Makefile.am @@ -0,0 +1,103 @@ +## +## $Id$ +## + +ACLOCAL_AMFLAGS = -I ../../../../aclocal + +include $(top_srcdir)/../../../../automake/compile.am +include $(top_srcdir)/../../bsp.am + +dist_project_lib_DATA = bsp_specs + +include_HEADERS = include/bsp.h +include_HEADERS += include/conio.h +include_HEADERS += include/tm27.h + +nodist_include_HEADERS = include/bspopts.h +DISTCLEANFILES = include/bspopts.h + +noinst_PROGRAMS = + +nodist_include_HEADERS += ../../shared/include/coverhd.h + +EXTRA_DIST = start/start.S +start.$(OBJEXT): start/start.S + $(CPPASCOMPILE) -DASM -o $@ -c $< +project_lib_DATA = start.$(OBJEXT) + +dist_project_lib_DATA += startup/linkcmds + +noinst_PROGRAMS += startup.rel +startup_rel_SOURCES = ../../shared/bsplibc.c ../../shared/bsppost.c \ + startup/bspstart.c startup/exit.c startup/memmap.c \ + ../../shared/bootcard.c ../../shared/main.c ../../shared/sbrk.c \ + ../../shared/gnatinstallhandler.c +startup_rel_CPPFLAGS = $(AM_CPPFLAGS) +startup_rel_LDFLAGS = $(RTEMS_RELLDFLAGS) + +noinst_PROGRAMS += console.rel +console_rel_SOURCES = console/conio.c console/defaultfont.c console/console.c +console_rel_CPPFLAGS = $(AM_CPPFLAGS) +console_rel_LDFLAGS = $(RTEMS_RELLDFLAGS) + +noinst_LIBRARIES = libbsp.a +libbsp_a_SOURCES = +libbsp_a_LIBADD = startup.rel console.rel +libbsp_a_LIBADD += ../../../libcpu/@RTEMS_CPU@/shared/arm920.rel \ + ../../../libcpu/@RTEMS_CPU@/@RTEMS_CPU_MODEL@/clock.rel \ + ../../../libcpu/@RTEMS_CPU@/@RTEMS_CPU_MODEL@/timer.rel \ + ../../../libcpu/@RTEMS_CPU@/@RTEMS_CPU_MODEL@/irq.rel + +all-local: $(PREINSTALL_FILES) $(TMPINSTALL_FILES) + +PREINSTALL_DIRS = +PREINSTALL_FILES = +TMPINSTALL_FILES = + +$(PROJECT_INCLUDE)/$(dirstamp): + @$(mkdir_p) $(PROJECT_INCLUDE) + @: > $(PROJECT_INCLUDE)/$(dirstamp) +PREINSTALL_DIRS += $(PROJECT_INCLUDE)/$(dirstamp) + +$(PROJECT_LIB)/$(dirstamp): + @$(mkdir_p) $(PROJECT_LIB) + @: > $(PROJECT_LIB)/$(dirstamp) +PREINSTALL_DIRS += $(PROJECT_LIB)/$(dirstamp) + +$(PROJECT_LIB)/bsp_specs: bsp_specs $(PROJECT_LIB)/$(dirstamp) + $(INSTALL_DATA) $< $(PROJECT_LIB)/bsp_specs +PREINSTALL_FILES += $(PROJECT_LIB)/bsp_specs + +$(PROJECT_INCLUDE)/bsp.h: include/bsp.h $(PROJECT_INCLUDE)/$(dirstamp) + $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp.h +PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp.h + +$(PROJECT_INCLUDE)/conio.h: include/conio.h $(PROJECT_INCLUDE)/$(dirstamp) + $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/conio.h +PREINSTALL_FILES += $(PROJECT_INCLUDE)/conio.h + +$(PROJECT_INCLUDE)/tm27.h: include/tm27.h $(PROJECT_INCLUDE)/$(dirstamp) + $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/tm27.h +PREINSTALL_FILES += $(PROJECT_INCLUDE)/tm27.h + +$(PROJECT_INCLUDE)/bspopts.h: include/bspopts.h $(PROJECT_INCLUDE)/$(dirstamp) + $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bspopts.h +PREINSTALL_FILES += $(PROJECT_INCLUDE)/bspopts.h + +$(PROJECT_INCLUDE)/coverhd.h: ../../shared/include/coverhd.h $(PROJECT_INCLUDE)/$(dirstamp) + $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/coverhd.h +PREINSTALL_FILES += $(PROJECT_INCLUDE)/coverhd.h + +$(PROJECT_LIB)/start.$(OBJEXT): start.$(OBJEXT) $(PROJECT_LIB)/$(dirstamp) + $(INSTALL_DATA) $< $(PROJECT_LIB)/start.$(OBJEXT) +TMPINSTALL_FILES += $(PROJECT_LIB)/start.$(OBJEXT) + +$(PROJECT_LIB)/linkcmds: startup/linkcmds $(PROJECT_LIB)/$(dirstamp) + $(INSTALL_DATA) $< $(PROJECT_LIB)/linkcmds +PREINSTALL_FILES += $(PROJECT_LIB)/linkcmds + +CLEANFILES = $(PREINSTALL_FILES) +DISTCLEANFILES += $(PREINSTALL_DIRS) +CLEANFILES += $(TMPINSTALL_FILES) + +include $(top_srcdir)/../../../../automake/local.am diff --git a/c/src/lib/libbsp/arm/gp32/README b/c/src/lib/libbsp/arm/gp32/README new file mode 100644 index 0000000000..0189a3e9b2 --- /dev/null +++ b/c/src/lib/libbsp/arm/gp32/README @@ -0,0 +1,3 @@ +This is the BSP for GamePark's GP32, a single board +computer using the Samsung S3C2400 SoC CPU. + diff --git a/c/src/lib/libbsp/arm/gp32/bsp_specs b/c/src/lib/libbsp/arm/gp32/bsp_specs new file mode 100644 index 0000000000..2309f0e53b --- /dev/null +++ b/c/src/lib/libbsp/arm/gp32/bsp_specs @@ -0,0 +1,23 @@ +%rename cpp old_cpp +%rename lib old_lib +%rename endfile old_endfile +%rename startfile old_startfile +%rename link old_link + +*cpp: +%(old_cpp) %{qrtems: -D__embedded__ -DUSE_ENHANCED_INTR_API} -Asystem(embedded) + +*lib: +%{!qrtems: %(old_lib)} %{qrtems: --start-group \ +%{!qrtems_debug: -lrtemsbsp -lrtemscpu} %{qrtems_debug: -lrtemsbsp_g -lrtemscpu_g} \ +-lc -lgcc --end-group \ +%{!qnolinkcmds: -T linkcmds%s}} + +*startfile: +%{!qrtems: %(old_startfile)} %{qrtems: \ +%{!qrtems_debug: start.o%s crtbegin.o%s} \ +%{qrtems_debug: start_g.o%s crtbegin.o%s}} + +*link: +%{!qrtems: %(old_link)} %{qrtems: -Qy -dp -Bstatic -N -e _start} + diff --git a/c/src/lib/libbsp/arm/gp32/configure.ac b/c/src/lib/libbsp/arm/gp32/configure.ac new file mode 100644 index 0000000000..0ed4aa60dc --- /dev/null +++ b/c/src/lib/libbsp/arm/gp32/configure.ac @@ -0,0 +1,24 @@ +## Process this file with autoconf to produce a configure script. +## +## configure.ac,v 1.5 2003/03/11 09:39:07 ralf Exp + +AC_PREREQ(2.57) +AC_INIT([rtems-c-src-lib-libbsp-arm-gp32],[_RTEMS_VERSION],[rtems-bugs@OARcorp.com]) +AC_CONFIG_SRCDIR([bsp_specs]) +RTEMS_TOP(../../../../../..) + +RTEMS_CANONICAL_TARGET_CPU +AM_INIT_AUTOMAKE([no-define foreign 1.9]) +RTEMS_BSP_CONFIGURE + +RTEMS_PROG_CC_FOR_TARGET([-ansi -fasm]) +RTEMS_CANONICALIZE_TOOLS +RTEMS_PROG_CCAS + +RTEMS_CHECK_NETWORKING +AM_CONDITIONAL(HAS_NETWORKING,test "$HAS_NETWORKING" = "yes") + +# Explicitly list all Makefiles here +AC_CONFIG_FILES([Makefile]) +AC_OUTPUT + diff --git a/c/src/lib/libbsp/arm/gp32/console/.cvsignore b/c/src/lib/libbsp/arm/gp32/console/.cvsignore new file mode 100644 index 0000000000..d29e5050f5 --- /dev/null +++ b/c/src/lib/libbsp/arm/gp32/console/.cvsignore @@ -0,0 +1,14 @@ +Makefile +Makefile.in +aclocal.m4 +autom4te.cache +config.cache +config.guess +config.log +config.status +config.sub +configure +depcomp +install-sh +missing +mkinstalldirs diff --git a/c/src/lib/libbsp/arm/gp32/console/conio.c b/c/src/lib/libbsp/arm/gp32/console/conio.c new file mode 100644 index 0000000000..3455d09c07 --- /dev/null +++ b/c/src/lib/libbsp/arm/gp32/console/conio.c @@ -0,0 +1,357 @@ +/* + * conio.c : ARM GBA BSP + * + * This file contains the GBA conio I/O package. + * + * + * Copyright (c) 2004 Markku Puro <markku.puro@kopteri.net> + * + * This source file is based on work by Rafael Vuijk (aka Dark Fader) + * MyLib by Rafael Vuijk (aka Dark Fader) + * + * The license and distribution terms for this file may be + * found in found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + * + * $Id$ +*/ + + +/*---------------------------------------------------------------------------* + * Includes * + *---------------------------------------------------------------------------*/ +#include <rtems/score/types.h> +#include <s3c2400.h> +#include <conio.h> +#include <stdio.h> +#include <stdarg.h> + +#define gp_initButtons() {rPBCON=0x0;} +#define gp_getButtons() ((((~rPEDAT >> 6) & 0x3) << 8) | \ + ((~rPBDAT >> 8) & 0xFF)) + +/*---------------------------------------------------------------------------* + * Defines * + *---------------------------------------------------------------------------*/ +#define LCD_WIDTH 240 +#define LCD_HEIGHT 320 +#define DEFAULT_FONT_WIDTH 4 +#define DEFAULT_FONT_HEIGHT 6 +#define W (LCD_WIDTH/DEFAULT_FONT_WIDTH) +#define H (LCD_HEIGHT/DEFAULT_FONT_HEIGHT) + +typedef unsigned char Bitmap[LCD_HEIGHT][LCD_WIDTH]; +#define GP32_VRAM 0x0c7b4000 +#define bg_bitmap (*(Bitmap *)GP32_VRAM) + +/* color conversion */ +#define RGB(r,g,b) ( (r)<<11 | (g)<<6 | (b)<<1 ) + +int _wherex; +int _wherey; +int _textattr; + + +/*---------------------------------------------------------------------------* + * Defaultfont * + *---------------------------------------------------------------------------*/ +#include "defaultfont.c" + +/*---------------------------------------------------------------------------* + * gp32_gotoxy * + *---------------------------------------------------------------------------*/ +void gpconio_gotoxy(int _x, int _y) +{ + _wherex = _x; + _wherey = _y; +} + + +/*---------------------------------------------------------------------------* + * PutChar * + *---------------------------------------------------------------------------*/ +void PutChar(char c, int textattr, int x, int y) +{ + int f = textattr & 0x0F; + int b = textattr >> 4; + uint32_t fmask = f | (f << 8) | (f << 16) | (f << 24); + uint32_t bmask = b | (b << 8) | (b << 16) | (b << 24); + uint32_t *dest = (uint32_t *)&bg_bitmap[((y << 1) + y) << 1][x << 2]; + const uint32_t *src = (uint32_t *)&(font3x5[(int)c]); + uint32_t s; + + s = *src++; + *dest = (fmask&s) | (bmask&~s); + dest += LCD_WIDTH / sizeof(uint32_t); + + s = *src++; + *dest = (fmask&s) | (bmask&~s); + dest += LCD_WIDTH / sizeof(uint32_t); + + s = *src++; + *dest = (fmask&s) | (bmask&~s); + dest += LCD_WIDTH / sizeof(uint32_t); + + s = *src++; + *dest = (fmask&s) | (bmask&~s); + dest += LCD_WIDTH / sizeof(uint32_t); + + s = *src++; + *dest = (fmask&s) | (bmask&~s); + dest += LCD_WIDTH / sizeof(uint32_t); + + s = *src++; + *dest = (fmask&s) | (bmask&~s); + dest += LCD_WIDTH / sizeof(uint32_t); +} + + +/*---------------------------------------------------------------------------* + * gp32_textattr * + *---------------------------------------------------------------------------*/ +void gpconio_textattr(int _attr) +{ + _textattr = _attr; +} + +/*---------------------------------------------------------------------------* + * gp32_textbackground * + *---------------------------------------------------------------------------*/ +void gpconio_textbackground(int _color) +{ + _textattr = (_textattr & 0x0F) | (_color << 4); +} + +/*---------------------------------------------------------------------------* + * gp32_textcolor * + *---------------------------------------------------------------------------*/ +void gpconio_textcolor(int _color) +{ + _textattr = (_textattr & 0xF0) | (_color); +} + + +/*---------------------------------------------------------------------------* + * ClrLine * + *---------------------------------------------------------------------------*/ +void ClrLine(int y) +{ + int x; + + for(x=0 ; x<=W ; x++) PutChar(0, _textattr, x, y); +} + +/*---------------------------------------------------------------------------* + * NextLine * + *---------------------------------------------------------------------------*/ +void NextLine() +{ + _wherex = 0; + + if (++_wherey >= H) { + _wherey = 0; + } + + ClrLine(_wherey); +} + +/*---------------------------------------------------------------------------* + * clrscr * + *---------------------------------------------------------------------------*/ +void gpconio_clrscr() +{ + int y; + + for(y=0 ; y<=H ; y++) { + ClrLine(y); + } + + gpconio_gotoxy(0,0); +} + +/*---------------------------------------------------------------------------* + * gp32_put * + *---------------------------------------------------------------------------*/ +void gpconio_put(char _c) +{ + /* We have save some memory with fonts */ + _c = _c & 0x7F; /* no extened chars */ + _c = _c - 0x20; /* no cntr chars */ + PutChar(_c, _textattr, _wherex, _wherey); +} + +/*---------------------------------------------------------------------------* + * gp32_putch * + *---------------------------------------------------------------------------*/ +void gpconio_putch(char _c) +{ + switch (_c) { + case ASCII_LF: + NextLine(); + break; + case ASCII_CR: + gpconio_gotoxy(0, _wherey); + break; + default: + gpconio_put(_c); + if (++_wherex >= W) { + NextLine(); + } + break; + } + return; +} + +/*---------------------------------------------------------------------------* + * gp32_puts * + *---------------------------------------------------------------------------*/ +void gpconio_puts(const char *_str) +{ + while (*_str) { + gpconio_putch(*_str++); + } + return; +} + +/*---------------------------------------------------------------------------* + * gp32_printf * + *---------------------------------------------------------------------------*/ +int gpconio_printf(const char *_format, ...) +{ + char s[256]; + va_list marker; + va_start(marker, _format); + int r = vsprintf(s, _format, marker); + + va_end(marker); + gpconio_puts(s); + return r; +} + + +/*---------------------------------------------------------------------------* + * InitConIO * + *---------------------------------------------------------------------------*/ +void InitConIO() +{ + uint32_t GPHCLK = 66750000; + unsigned short BPPMODE = 11; + unsigned short CLKVAL = (GPHCLK/(83385*2*60))-1; + uint32_t LCDBANK = GP32_VRAM >> 22; + uint32_t LCDBASEU = (GP32_VRAM & 0x3FFFFF) >> 1; + uint32_t LCDBASEL; + unsigned short OFFSIZE = 0; + unsigned short PAGEWIDTH; + + rLCDCON1 = (CLKVAL<<8) | (0<<7) | (3<<5) | (BPPMODE<<1) | (1<<0) ; + rLCDCON2 = 0; + rLCDCON2 = (1<<24) | (319<<14) | (2<<6) | (1<<0) ; + rLCDCON3 = 0; + rLCDCON3 = (6<<19) | (239<<8) | (2<<0) ; + rLCDCON4 = 0; + rLCDCON4 = (0<<24) | (0<<16) | (0<<8) | (4<<0) ; + rLCDCON5 = 0; + rLCDCON5 = ((1<<10) | (1<<9) | (1<<8) | (0<<7) | + (0<<6) | (0<<4) | (0<<2) | (1<<1) | (0<<0)) ; + + LCDBASEL = LCDBASEU + 320*120; + PAGEWIDTH = 120; + + rLCDSADDR1 = (LCDBANK<<21) | (LCDBASEU<<0) ; + rLCDSADDR2 = (LCDBASEL<<0) ; + rLCDSADDR3 = (OFFSIZE<<11) | (PAGEWIDTH<<0) ; + + gp_initButtons(); + gpconio_textattr(0); + gpconio_textcolor(DEF_TEXTCOLOR); + gpconio_textbackground(DEF_TEXTBACKGROUND); + gpconio_clrscr(); +} + + +static void delay_loop(unsigned int count) +{ + int i; + + for(i = 0; i < count; i++) { + i = i; + } + +} + +/*---------------------------------------------------------------------------* + * gp32_getch * + *---------------------------------------------------------------------------*/ +static unsigned char inputch = ASCII_CR; +char gpconio_getch(void) +{ + int keyx; + int key = 0; + + while(1) { + key = gp_getButtons(); + + do { + keyx = gp_getButtons(); + } while (keyx == key); + + switch (key) { + case GP32_KEY_SELECT: + gpconio_put(inputch); + return inputch; + break; + + case GP32_KEY_START: + gpconio_put(' '); + inputch = ASCII_CR; + return inputch; + break; + + case GP32_KEY_A: + inputch = 'A'; + break; + + case GP32_KEY_B: + inputch = 'Z'; + break; + + case GP32_KEY_UP: + if ((inputch-1) >= 0x20) { + inputch--; + } + break; + + case GP32_KEY_DOWN: + if ((inputch+1) <= 0x7E) { + inputch++; + } + break; + + case GP32_KEY_LEFT: + if ((inputch - 0x20) >= 0x20) { + inputch -= 0x20; + } + break; + + case GP32_KEY_RIGHT: + if ((inputch + 0x20) <= 0x7E) { + inputch += 0x20; + } + break; + + case GP32_KEY_R: + inputch = '1'; + break; + + case GP32_KEY_L: + inputch = '9'; + break; + + default: + break; + } + + gpconio_put(inputch); + delay_loop(10000); + } +} diff --git a/c/src/lib/libbsp/arm/gp32/console/console.c b/c/src/lib/libbsp/arm/gp32/console/console.c new file mode 100644 index 0000000000..d0fc3fef30 --- /dev/null +++ b/c/src/lib/libbsp/arm/gp32/console/console.c @@ -0,0 +1,176 @@ +/* + * console.c : ARM GBA BSP + * + * This file contains the GBA console I/O package. + * + * + * Copyright (c) 2004 Markku Puro <markku.puro@kopteri.net> + * + * The license and distribution terms for this file may be + * found in found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + * + * $Id$ +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <assert.h> +#include <unistd.h> + +#include <bsp.h> +#include <rtems/bspIo.h> +#include <rtems/libio.h> +#include <rtems/termiostypes.h> +#include <termios.h> +#include <irq.h> +#include <s3c2400.h> +#include <conio.h> + +/* + * BSP initialization + */ + +static int gp32_pollRead(int minor) +{ + return(gpconio_getch()); +} + +static int gp32_write(int minor, const char *buf, int len) +{ + int i; + + for(i = 0; i < len; i++) { + gpconio_putch((unsigned short)buf[i]); + } + + return len; +} + + +/* for printk support */ +BSP_output_char_function_type BSP_output_char = (BSP_output_char_function_type) gpconio_putch; +BSP_polling_getchar_function_type BSP_poll_char = (BSP_polling_getchar_function_type) gpconio_getch; + +/*-------------------------------------------------------------------------+ +| Console device driver INITIALIZE entry point. ++--------------------------------------------------------------------------+ +| Initilizes the I/O console (keyboard + VGA display) driver. ++--------------------------------------------------------------------------*/ +rtems_device_driver +console_initialize(rtems_device_major_number major, + rtems_device_minor_number minor, + void *arg) +{ + rtems_status_code status; + + /* + * Set up TERMIOS + */ + rtems_termios_initialize (); + + /* + * Do device-specific initialization + */ + InitConIO(); + + /* + * Register the device + */ + status = rtems_io_register_name ("/dev/console", major, 0); + if (status != RTEMS_SUCCESSFUL) { + printk("Error registering console device!\n"); + rtems_fatal_error_occurred (status); + } + + return RTEMS_SUCCESSFUL; +} + + +/*-------------------------------------------------------------------------+ +| Console device driver OPEN entry point ++--------------------------------------------------------------------------*/ +rtems_device_driver +console_open(rtems_device_major_number major, + rtems_device_minor_number minor, + void *arg) +{ + rtems_status_code status; + static rtems_termios_callbacks cb = + { + NULL, /* firstOpen */ + NULL, /* lastClose */ + gp32_pollRead, /* pollRead */ + gp32_write, /* write */ + NULL, /* setAttributes */ + NULL, /* stopRemoteTx */ + NULL, /* startRemoteTx */ + TERMIOS_POLLED /* 1 = outputUsesInterrupts */ + }; + + status = rtems_termios_open (major, minor, arg, &cb); + + if(status != RTEMS_SUCCESSFUL) { + printk("Error openning console device\n"); + return status; + } + + return RTEMS_SUCCESSFUL; +} + +/*-------------------------------------------------------------------------+ +| Console device driver CLOSE entry point ++--------------------------------------------------------------------------*/ +rtems_device_driver +console_close(rtems_device_major_number major, + rtems_device_minor_number minor, + void *arg) +{ + rtems_device_driver res = RTEMS_SUCCESSFUL; + + res = rtems_termios_close (arg); + return res; +} + + +/*-------------------------------------------------------------------------+ +| Console device driver READ entry point. ++--------------------------------------------------------------------------+ +| Read characters from the I/O console. We only have stdin. ++--------------------------------------------------------------------------*/ +rtems_device_driver +console_read(rtems_device_major_number major, + rtems_device_minor_number minor, + void *arg) +{ + return rtems_termios_read (arg); + +} + + +/*-------------------------------------------------------------------------+ +| Console device driver WRITE entry point. ++--------------------------------------------------------------------------+ +| Write characters to the I/O console. Stderr and stdout are the same. ++--------------------------------------------------------------------------*/ +rtems_device_driver +console_write(rtems_device_major_number major, + rtems_device_minor_number minor, + void * arg) +{ + return rtems_termios_write (arg); +} + + + +/* + * Handle ioctl request. + */ +rtems_device_driver +console_control(rtems_device_major_number major, + rtems_device_minor_number minor, + void * arg +) +{ + return rtems_termios_ioctl (arg); +} diff --git a/c/src/lib/libbsp/arm/gp32/console/defaultfont.c b/c/src/lib/libbsp/arm/gp32/console/defaultfont.c new file mode 100644 index 0000000000..a4a5082e03 --- /dev/null +++ b/c/src/lib/libbsp/arm/gp32/console/defaultfont.c @@ -0,0 +1,600 @@ +/* + * defaultfont.c : ARM GBA BSP + * + * This file contains default font definitions + * + * + * Copyright (c) 2004 Markku Puro <markku.puro@kopteri.net> + * + * The license and distribution terms for this file may be + * found in found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + * + * $Id$ +*/ + +#define X 255 +#define GEN_FONT_DATA(a,b,c,d) ( ((d) << 24) | \ + ((c) << 16) | \ + ((b) << 8) | \ + ((a) << 0) ) + +static const unsigned long font3x5[256][6] = { + { /* ' ' - ascii:0x20 font:0x00 */ + GEN_FONT_DATA( 0,0,0,0 ), + GEN_FONT_DATA( 0,0,0,0 ), + GEN_FONT_DATA( 0,0,0,0 ), + GEN_FONT_DATA( 0,0,0,0 ), + GEN_FONT_DATA( 0,0,0,0 ) + },{ /* '!' - ascii:0x21 font:0x01 */ + GEN_FONT_DATA( 0,0,X,0 ), + GEN_FONT_DATA( 0,0,X,0 ), + GEN_FONT_DATA( 0,0,X,0 ), + GEN_FONT_DATA( 0,0,0,0 ), + GEN_FONT_DATA( 0,0,X,0 ) + },{ /* '"' - ascii:0x22 font:0x02 */ + GEN_FONT_DATA( 0,X,0,X ), + GEN_FONT_DATA( 0,X,0,X ), + GEN_FONT_DATA( 0,0,0,0 ), + GEN_FONT_DATA( 0,0,0,0 ), + GEN_FONT_DATA( 0,0,0,0 ) + },{ /* '#' - ascii:0x23 font:0x03 */ + GEN_FONT_DATA( 0,X,0,X ), + GEN_FONT_DATA( 0,X,X,X ), + GEN_FONT_DATA( 0,X,0,X ), + GEN_FONT_DATA( 0,X,X,X ), + GEN_FONT_DATA( 0,X,0,X ) + },{ /* '$' - ascii:0x24 font:0x04 */ + GEN_FONT_DATA( 0,0,X,X ), + GEN_FONT_DATA( 0,X,X,0 ), + GEN_FONT_DATA( 0,0,X,X ), + GEN_FONT_DATA( 0,X,X,0 ), + GEN_FONT_DATA( 0,0,X,0 ) + },{ /* '%' - ascii:0x25 font:0x05 */ + GEN_FONT_DATA( 0,0,0,X ), + GEN_FONT_DATA( 0,X,0,X ), + GEN_FONT_DATA( 0,0,X,0 ), + GEN_FONT_DATA( 0,X,0,X ), + GEN_FONT_DATA( 0,X,0,0 ) + },{ /* '&' - ascii:0x26 font:0x06 */ + GEN_FONT_DATA( 0,0,X,X ), + GEN_FONT_DATA( 0,X,0,0 ), + GEN_FONT_DATA( 0,0,X,0 ), + GEN_FONT_DATA( 0,X,0,X ), + GEN_FONT_DATA( 0,0,X,0 ) + },{ /* ''' - ascii:0x27 font:0x07 */ + GEN_FONT_DATA( 0,0,X,0 ), + GEN_FONT_DATA( 0,0,X,0 ), + GEN_FONT_DATA( 0,0,0,0 ), + GEN_FONT_DATA( 0,0,0,0 ), + GEN_FONT_DATA( 0,0,0,0 ) + },{ /* '(' - ascii:0x28 font:0x08 */ + GEN_FONT_DATA( 0,0,0,X ), + GEN_FONT_DATA( 0,0,X,0 ), + GEN_FONT_DATA( 0,0,X,0 ), + GEN_FONT_DATA( 0,0,X,0 ), + GEN_FONT_DATA( 0,0,0,X ) + },{ /* ')' - ascii:0x29 font:0x09 */ + GEN_FONT_DATA( 0,X,0,0 ), + GEN_FONT_DATA( 0,0,X,0 ), + GEN_FONT_DATA( 0,0,X,0 ), + GEN_FONT_DATA( 0,0,X,0 ), + GEN_FONT_DATA( 0,X,0,0 ) + },{ /* '*' - ascii:0x2A font:0x0A */ + GEN_FONT_DATA( 0,0,0,0 ), + GEN_FONT_DATA( 0,X,0,X ), + GEN_FONT_DATA( 0,0,X,0 ), + GEN_FONT_DATA( 0,X,0,X ), + GEN_FONT_DATA( 0,0,0,0 ) + },{ /* '+' - ascii:0x2B font:0x0B */ + GEN_FONT_DATA( 0,0,0,0 ), + GEN_FONT_DATA( 0,0,X,0 ), + GEN_FONT_DATA( 0,X,X,X ), + GEN_FONT_DATA( 0,0,X,0 ), + GEN_FONT_DATA( 0,0,0,0 ) + },{ /* '´' - ascii:0x2C font:0x0C */ + GEN_FONT_DATA( 0,0,0,X ), + GEN_FONT_DATA( 0,0,X,0 ), + GEN_FONT_DATA( 0,0,0,0 ), + GEN_FONT_DATA( 0,0,0,0 ), + GEN_FONT_DATA( 0,0,0,0 ) + },{ /* '-' - ascii:0x2D font:0x0D */ + GEN_FONT_DATA( 0,0,0,0 ), + GEN_FONT_DATA( 0,0,0,0 ), + GEN_FONT_DATA( 0,X,X,X ), + GEN_FONT_DATA( 0,0,0,0 ), + GEN_FONT_DATA( 0,0,0,0 ) + },{ /* '.' - ascii:0x2E font:0x0E */ + GEN_FONT_DATA( 0,0,0,0 ), + GEN_FONT_DATA( 0,0,0,0 ), + GEN_FONT_DATA( 0,0,0,0 ), + GEN_FONT_DATA( 0,0,0,0 ), + GEN_FONT_DATA( 0,0,X,0 ), + },{ /* '/' - ascii:0x2F font:0x0F */ + GEN_FONT_DATA( 0,0,0,0 ), + GEN_FONT_DATA( 0,0,0,X ), + GEN_FONT_DATA( 0,0,X,0 ), + GEN_FONT_DATA( 0,X,0,0 ), + GEN_FONT_DATA( X,0,0,0 ) + },{ /* '0' - ascii:0x30 font:0x10 */ + GEN_FONT_DATA( 0,X,X,X ), + GEN_FONT_DATA( 0,X,0,X ), + GEN_FONT_DATA( 0,X,0,X ), + GEN_FONT_DATA( 0,X,0,X ), + GEN_FONT_DATA( 0,X,X,X ) + },{ /* '1' - ascii:0x31 font:0x11 */ + GEN_FONT_DATA( 0,0,X,0 ), + GEN_FONT_DATA( 0,X,X,0 ), + GEN_FONT_DATA( 0,0,X,0 ), + GEN_FONT_DATA( 0,0,X,0 ), + GEN_FONT_DATA( 0,X,X,X ) + },{ /* '2' - ascii:0x32 font:0x12 */ + GEN_FONT_DATA( 0,X,X,X ), + GEN_FONT_DATA( 0,0,0,X ), + GEN_FONT_DATA( 0,X,X,X ), + GEN_FONT_DATA( 0,X,0,0 ), + GEN_FONT_DATA( 0,X,X,X ) + },{ /* '3' - ascii:0x33 font:0x13 */ + GEN_FONT_DATA( 0,X,X,X ), + GEN_FONT_DATA( 0,0,0,X ), + GEN_FONT_DATA( 0,0,X,X ), + GEN_FONT_DATA( 0,0,0,X ), + GEN_FONT_DATA( 0,X,X,X ) + },{ /* '4' - ascii:0x34 font:0x14 */ + GEN_FONT_DATA( 0,X,0,X ), + GEN_FONT_DATA( 0,X,0,X ), + GEN_FONT_DATA( 0,X,X,X ), + GEN_FONT_DATA( 0,0,0,X ), + GEN_FONT_DATA( 0,0,0,X ) + },{ /* '5' - ascii:0x35 font:0x15 */ + GEN_FONT_DATA( 0,X,X,X ), + GEN_FONT_DATA( 0,X,0,0 ), + GEN_FONT_DATA( 0,X,X,X ), + GEN_FONT_DATA( 0,0,0,X ), + GEN_FONT_DATA( 0,X,X,X ) + },{ /* '6' - ascii:0x36 font:0x16 */ + GEN_FONT_DATA( 0,X,X,X ), + GEN_FONT_DATA( 0,X,0,0 ), + GEN_FONT_DATA( 0,X,X,X ), + GEN_FONT_DATA( 0,X,0,X ), + GEN_FONT_DATA( 0,X,X,X ) + },{ /* '7' - ascii:0x37 font:0x17 */ + GEN_FONT_DATA( 0,X,X,X ), + GEN_FONT_DATA( 0,0,0,X ), + GEN_FONT_DATA( 0,0,X,X ), + GEN_FONT_DATA( 0,0,X,0 ), + GEN_FONT_DATA( 0,0,X,0 ) + },{ /* '8' - ascii:0x38 font:0x18 */ + GEN_FONT_DATA( 0,X,X,X ), + GEN_FONT_DATA( 0,X,0,X ), + GEN_FONT_DATA( 0,X,X,X ), + GEN_FONT_DATA( 0,X,0,X ), + GEN_FONT_DATA( 0,X,X,X ) + },{ /* '9' - ascii:0x39 font:0x19 */ + GEN_FONT_DATA( 0,X,X,X ), + GEN_FONT_DATA( 0,X,0,X ), + GEN_FONT_DATA( 0,X,X,X ), + GEN_FONT_DATA( 0,0,0,X ), + GEN_FONT_DATA( 0,X,X,X ) + },{ /* ':' - ascii:0x3A font:0x1A */ + GEN_FONT_DATA( 0,0,0,0 ), + GEN_FONT_DATA( 0,0,X,0 ), + GEN_FONT_DATA( 0,0,0,0 ), + GEN_FONT_DATA( 0,0,X,0 ), + GEN_FONT_DATA( 0,0,0,0 ), + },{ /* ';' - ascii:0x3B font:0x1B */ + GEN_FONT_DATA( 0,0,0,0 ), + GEN_FONT_DATA( 0,0,X,0 ), + GEN_FONT_DATA( 0,0,0,0 ), + GEN_FONT_DATA( 0,0,X,0 ), + GEN_FONT_DATA( 0,X,0,0 ), + },{ /* '<' - ascii:0x3C font:0x1C */ + GEN_FONT_DATA( 0,0,0,X ), + GEN_FONT_DATA( 0,0,X,0 ), + GEN_FONT_DATA( 0,X,0,0 ), + GEN_FONT_DATA( 0,0,X,0 ), + GEN_FONT_DATA( 0,0,0,X ) + },{ /* '=' - ascii:0x3D font:0x1D */ + GEN_FONT_DATA( 0,0,0,0 ), + GEN_FONT_DATA( 0,X,X,X ), + GEN_FONT_DATA( 0,0,0,0 ), + GEN_FONT_DATA( 0,X,X,X ), + GEN_FONT_DATA( 0,0,0,0 ) + },{ /* '>' - ascii:0x3E font:0x1E */ + GEN_FONT_DATA( 0,X,0,0 ), + GEN_FONT_DATA( 0,0,X,0 ), + GEN_FONT_DATA( 0,0,0,X ), + GEN_FONT_DATA( 0,0,X,0 ), + GEN_FONT_DATA( 0,X,0,0 ) + },{ /* '?' - ascii:0x3F font:0x1F */ + GEN_FONT_DATA( 0,X,X,X ), + GEN_FONT_DATA( 0,0,0,X ), + GEN_FONT_DATA( 0,0,X,X ), + GEN_FONT_DATA( 0,0,0,0 ), + GEN_FONT_DATA( 0,0,X,0 ) + },{ /* '@' - ascii:0x40 font:0x20 */ + GEN_FONT_DATA( 0,0,X,X ), + GEN_FONT_DATA( 0,X,0,X ), + GEN_FONT_DATA( 0,X,0,X ), + GEN_FONT_DATA( 0,X,0,0 ), + GEN_FONT_DATA( 0,0,X,X ) + },{ /* 'A' - ascii:0x41 font:0x21 */ + GEN_FONT_DATA( 0,0,X,0 ), + GEN_FONT_DATA( 0,X,0,X ), + GEN_FONT_DATA( 0,X,X,X ), + GEN_FONT_DATA( 0,X,0,X ), + GEN_FONT_DATA( 0,X,0,X ) + },{ /* 'B' - ascii:0x42 font:0x22 */ + GEN_FONT_DATA( 0,X,X,0 ), + GEN_FONT_DATA( 0,X,0,X ), + GEN_FONT_DATA( 0,X,X,0 ), + GEN_FONT_DATA( 0,X,0,X ), + GEN_FONT_DATA( 0,X,X,0 ) + },{ /* 'C' - ascii:0x43 font:0x23 */ + GEN_FONT_DATA( 0,0,X,X ), + GEN_FONT_DATA( 0,X,0,0 ), + GEN_FONT_DATA( 0,X,0,0 ), + GEN_FONT_DATA( 0,X,0,0 ), + GEN_FONT_DATA( 0,0,X,X ) + },{ /* 'D' - ascii:0x44 font:0x24 */ + GEN_FONT_DATA( 0,X,X,0 ), + GEN_FONT_DATA( 0,X,0,X ), + GEN_FONT_DATA( 0,X,0,X ), + GEN_FONT_DATA( 0,X,0,X ), + GEN_FONT_DATA( 0,X,X,0 ), + },{ /* 'E' - ascii:0x45 font:0x25 */ + GEN_FONT_DATA( 0,X,X,X ), + GEN_FONT_DATA( 0,X,0,0 ), + GEN_FONT_DATA( 0,X,X,X ), + GEN_FONT_DATA( 0,X,0,0 ), + GEN_FONT_DATA( 0,X,X,X ) + },{ /* 'F' - ascii:0x46 font:0x26 */ + GEN_FONT_DATA( 0,X,X,X ), + GEN_FONT_DATA( 0,X,0,0 ), + GEN_FONT_DATA( 0,X,X,0 ), + GEN_FONT_DATA( 0,X,0,0 ), + GEN_FONT_DATA( 0,X,0,0 ), + },{ /* 'G' - ascii:0x47 font:0x27 */ + GEN_FONT_DATA( 0,0,X,X ), + GEN_FONT_DATA( 0,X,0,0 ), + GEN_FONT_DATA( 0,X,0,X ), + GEN_FONT_DATA( 0,X,0,X ), + GEN_FONT_DATA( 0,0,X,X ) + },{ /* 'H' - ascii:0x48 font:0x28 */ + GEN_FONT_DATA( 0,X,0,X ), + GEN_FONT_DATA( 0,X,0,X ), + GEN_FONT_DATA( 0,X,X,X ), + GEN_FONT_DATA( 0,X,0,X ), + GEN_FONT_DATA( 0,X,0,X ) + },{ /* 'I' - ascii:0x49 font:0x29 */ + GEN_FONT_DATA( 0,0,X,0 ), + GEN_FONT_DATA( 0,0,X,0 ), + GEN_FONT_DATA( 0,0,X,0 ), + GEN_FONT_DATA( 0,0,X,0 ), + GEN_FONT_DATA( 0,0,X,0 ) + },{ /* 'J' - ascii:0x4A font:0x2A */ + GEN_FONT_DATA( 0,0,0,X ), + GEN_FONT_DATA( 0,0,0,X ), + GEN_FONT_DATA( 0,0,0,X ), + GEN_FONT_DATA( 0,X,0,X ), + GEN_FONT_DATA( 0,0,X,0 ) + },{ /* 'K' - ascii:0x4B font:0x2B */ + GEN_FONT_DATA( 0,X,0,X ), + GEN_FONT_DATA( 0,X,X,0 ), + GEN_FONT_DATA( 0,X,0,0 ), + GEN_FONT_DATA( 0,X,X,0 ), + GEN_FONT_DATA( 0,X,0,X ) + },{ /* 'L' - ascii:0x4C font:0x2C */ + GEN_FONT_DATA( 0,X,0,0 ), + GEN_FONT_DATA( 0,X,0,0 ), + GEN_FONT_DATA( 0,X,0,0 ), + GEN_FONT_DATA( 0,X,0,0 ), + GEN_FONT_DATA( 0,X,X,X ) + },{ /* 'M' - ascii:0x4D font:0x2D */ + GEN_FONT_DATA( 0,X,0,X ), + GEN_FONT_DATA( 0,X,X,X ), + GEN_FONT_DATA( 0,X,0,X ), + GEN_FONT_DATA( 0,X,0,X ), + GEN_FONT_DATA( 0,X,0,X ) + },{ /* 'N' - ascii:0x4E font:0x2E */ + GEN_FONT_DATA( 0,X,0,X ), + GEN_FONT_DATA( 0,X,X,X ), + GEN_FONT_DATA( 0,X,X,X ), + GEN_FONT_DATA( 0,X,0,X ), + GEN_FONT_DATA( 0,X,0,X ) + },{ /* 'O' - ascii:0x4F font:0x2F */ + GEN_FONT_DATA( 0,0,X,0 ), + GEN_FONT_DATA( 0,X,0,X ), + GEN_FONT_DATA( 0,X,0,X ), + GEN_FONT_DATA( 0,X,0,X ), + GEN_FONT_DATA( 0,0,X,0 ) + },{ /* 'P' - ascii:0x50 font:0x30 */ + GEN_FONT_DATA( 0,X,X,0 ), + GEN_FONT_DATA( 0,X,0,X ), + GEN_FONT_DATA( 0,X,X,0 ), + GEN_FONT_DATA( 0,X,0,0 ), + GEN_FONT_DATA( 0,X,0,0 ), + },{ /* 'Q' - ascii:0x51 font:0x31 */ + GEN_FONT_DATA( 0,0,X,0 ), + GEN_FONT_DATA( 0,X,0,X ), + GEN_FONT_DATA( 0,X,0,X ), + GEN_FONT_DATA( 0,X,0,X ), + GEN_FONT_DATA( 0,0,X,X ) + },{ /* 'R' - ascii:0x52 font:0x33 */ + GEN_FONT_DATA( 0,X,X,0 ), + GEN_FONT_DATA( 0,X,0,X ), + GEN_FONT_DATA( 0,X,X,0 ), + GEN_FONT_DATA( 0,X,0,X ), + GEN_FONT_DATA( 0,X,0,X ) + },{ /* 'S' - ascii:0x53 font:0x33 */ + GEN_FONT_DATA( 0,0,X,X ), + GEN_FONT_DATA( 0,X,0,0 ), + GEN_FONT_DATA( 0,0,X,0 ), + GEN_FONT_DATA( 0,0,0,X ), + GEN_FONT_DATA( 0,X,X,0 ) + },{ /* 'T' - ascii:0x54 font:0x34 */ + GEN_FONT_DATA( 0,X,X,X ), + GEN_FONT_DATA( 0,0,X,0 ), + GEN_FONT_DATA( 0,0,X,0 ), + GEN_FONT_DATA( 0,0,X,0 ), + GEN_FONT_DATA( 0,0,X,0 ), + },{ /* 'U' - ascii:0x55 font:0x35 */ + GEN_FONT_DATA( 0,X,0,X ), + GEN_FONT_DATA( 0,X,0,X ), + GEN_FONT_DATA( 0,X,0,X ), + GEN_FONT_DATA( 0,X,0,X ), + GEN_FONT_DATA( 0,X,X,X ) + },{ /* 'V' - ascii:0x56 font:0x36 */ + GEN_FONT_DATA( 0,X,0,X ), + GEN_FONT_DATA( 0,X,0,X ), + GEN_FONT_DATA( 0,X,0,X ), + GEN_FONT_DATA( 0,X,0,X ), + GEN_FONT_DATA( 0,0,X,0 ), + },{ /* 'W' - ascii:0x57 font:0x37 */ + GEN_FONT_DATA( 0,X,0,X ), + GEN_FONT_DATA( 0,X,0,X ), + GEN_FONT_DATA( 0,X,0,X ), + GEN_FONT_DATA( 0,X,X,X ), + GEN_FONT_DATA( 0,X,0,X ), + },{ /* 'X' - ascii:0x58 font:0x38 */ + GEN_FONT_DATA( 0,X,0,X ), + GEN_FONT_DATA( 0,X,0,X ), + GEN_FONT_DATA( 0,0,X,0 ), + GEN_FONT_DATA( 0,X,0,X ), + GEN_FONT_DATA( 0,X,0,X ) + },{ /* 'Y' - ascii:0x59 font:0x39 */ + GEN_FONT_DATA( 0,X,0,X ), + GEN_FONT_DATA( 0,X,0,X ), + GEN_FONT_DATA( 0,0,X,0 ), + GEN_FONT_DATA( 0,0,X,0 ), + GEN_FONT_DATA( 0,0,X,0 ), + },{ /* 'Z' - ascii:0x5A font:0x3A */ + GEN_FONT_DATA( 0,X,X,X ), + GEN_FONT_DATA( 0,0,0,X ), + GEN_FONT_DATA( 0,0,X,0 ), + GEN_FONT_DATA( 0,X,0,0 ), + GEN_FONT_DATA( 0,X,X,X ) + },{ /* '[' - ascii:0x5B font:0x3B */ + GEN_FONT_DATA( 0,X,X,X ), + GEN_FONT_DATA( 0,X,0,0 ), + GEN_FONT_DATA( 0,X,0,0 ), + GEN_FONT_DATA( 0,X,0,0 ), + GEN_FONT_DATA( 0,X,X,X ) + },{ /* '\' - ascii:0x5C font:0x3C */ + GEN_FONT_DATA( X,0,0,0 ), + GEN_FONT_DATA( 0,X,0,0 ), + GEN_FONT_DATA( 0,0,X,0 ), + GEN_FONT_DATA( 0,0,0,X ), + GEN_FONT_DATA( 0,0,0,0 ) + },{ /* ']' - ascii:0x5D font:0x3D */ + GEN_FONT_DATA( 0,X,X,X ), + GEN_FONT_DATA( 0,0,0,X ), + GEN_FONT_DATA( 0,0,0,X ), + GEN_FONT_DATA( 0,0,0,X ), + GEN_FONT_DATA( 0,X,X,X ) + },{ /* '^' - ascii:0x5E font:0x3E */ + GEN_FONT_DATA( 0,0,X,0 ), + GEN_FONT_DATA( 0,X,0,X ), + GEN_FONT_DATA( 0,0,0,0 ), + GEN_FONT_DATA( 0,0,0,0 ), + GEN_FONT_DATA( 0,0,0,0 ) + },{ /* '_' - ascii:0x5F font:0x3F */ + GEN_FONT_DATA( 0,0,0,0 ), + GEN_FONT_DATA( 0,0,0,0 ), + GEN_FONT_DATA( 0,0,0,0 ), + GEN_FONT_DATA( 0,0,0,0 ), + GEN_FONT_DATA( 0,X,X,X ) + },{ /* '´' - ascii:0x60 font:0x30 */ + GEN_FONT_DATA( 0,0,X,0 ), + GEN_FONT_DATA( 0,0,0,X ), + GEN_FONT_DATA( 0,0,0,0 ), + GEN_FONT_DATA( 0,0,0,0 ), + GEN_FONT_DATA( 0,0,0,0 ) + },{ /* 'a' - ascii:0x31 font:0x31 */ + GEN_FONT_DATA( 0,0,0,0 ), + GEN_FONT_DATA( 0,X,X,0 ), + GEN_FONT_DATA( 0,0,X,X ), + GEN_FONT_DATA( 0,X,0,X ), + GEN_FONT_DATA( 0,X,X,X ) + },{ /* 'b' - ascii:0x62 font:0x32 */ + GEN_FONT_DATA( 0,X,0,0 ), + GEN_FONT_DATA( 0,X,0,0 ), + GEN_FONT_DATA( 0,X,X,0 ), + GEN_FONT_DATA( 0,X,0,X ), + GEN_FONT_DATA( 0,X,X,0 ) + },{ /* 'c' - ascii:0x63 font:0x33 */ + GEN_FONT_DATA( 0,0,0,0 ), + GEN_FONT_DATA( 0,0,X,X ), + GEN_FONT_DATA( 0,X,0,0 ), + GEN_FONT_DATA( 0,X,0,0 ), + GEN_FONT_DATA( 0,0,X,X ) + },{ /* 'd' - ascii:0x64 font:0x34 */ + GEN_FONT_DATA( 0,0,0,X ), + GEN_FONT_DATA( 0,0,0,X ), + GEN_FONT_DATA( 0,0,X,X ), + GEN_FONT_DATA( 0,X,0,X ), + GEN_FONT_DATA( 0,0,X,X ), + },{ /* 'e' - ascii:0x65 font:0x35 */ + GEN_FONT_DATA( 0,0,0,0 ), + GEN_FONT_DATA( 0,0,X,0 ), + GEN_FONT_DATA( 0,X,0,X ), + GEN_FONT_DATA( 0,X,X,0 ), + GEN_FONT_DATA( 0,0,X,X ) + },{ /* 'f' - ascii:0x66 font:0x36 */ + GEN_FONT_DATA( 0,0,0,0 ), + GEN_FONT_DATA( 0,0,X,X ), + GEN_FONT_DATA( 0,X,0,0 ), + GEN_FONT_DATA( 0,X,X,X ), + GEN_FONT_DATA( 0,X,0,0 ), + },{ /* 'g' - ascii:0x67 font:0x37 */ + GEN_FONT_DATA( 0,0,0,0 ), + GEN_FONT_DATA( 0,0,X,0 ), + GEN_FONT_DATA( 0,X,0,X ), + GEN_FONT_DATA( 0,0,X,X ), + GEN_FONT_DATA( 0,X,X,0 ) + },{ /* 'h' - ascii:0x68 font:0x38 */ + GEN_FONT_DATA( 0,X,0,0 ), + GEN_FONT_DATA( 0,X,0,0 ), + GEN_FONT_DATA( 0,X,X,X ), + GEN_FONT_DATA( 0,X,0,X ), + GEN_FONT_DATA( 0,X,0,X ) + },{ /* 'i' - ascii:0x69 font:0x39 */ + GEN_FONT_DATA( 0,0,X,0 ), + GEN_FONT_DATA( 0,0,0,0 ), + GEN_FONT_DATA( 0,0,X,0 ), + GEN_FONT_DATA( 0,0,X,0 ), + GEN_FONT_DATA( 0,0,X,0 ) + },{ /* 'j' - ascii:0x6A font:0x3A */ + GEN_FONT_DATA( 0,0,0,X ), + GEN_FONT_DATA( 0,0,0,0 ), + GEN_FONT_DATA( 0,0,0,X ), + GEN_FONT_DATA( 0,X,0,X ), + GEN_FONT_DATA( 0,0,X,0 ) + },{ /* 'k' - ascii:0x6B font:0x3B */ + GEN_FONT_DATA( 0,X,0,0 ), + GEN_FONT_DATA( 0,X,0,0 ), + GEN_FONT_DATA( 0,X,0,X ), + GEN_FONT_DATA( 0,X,X,0 ), + GEN_FONT_DATA( 0,X,0,X ) + },{ /* 'l' - ascii:0x6C font:0x3C */ + GEN_FONT_DATA( 0,X,X,0 ), + GEN_FONT_DATA( 0,0,X,0 ), + GEN_FONT_DATA( 0,0,X,0 ), + GEN_FONT_DATA( 0,0,X,0 ), + GEN_FONT_DATA( 0,X,X,X ) + },{ /* 'm' - ascii:0x6D font:0x3D */ + GEN_FONT_DATA( 0,0,0,0 ), + GEN_FONT_DATA( 0,X,0,X ), + GEN_FONT_DATA( 0,X,X,X ), + GEN_FONT_DATA( 0,X,0,X ), + GEN_FONT_DATA( 0,X,0,X ) + },{ /* 'n' - ascii:0x6E font:0x3E */ + GEN_FONT_DATA( 0,0,0,0 ), + GEN_FONT_DATA( 0,X,X,0 ), + GEN_FONT_DATA( 0,X,0,X ), + GEN_FONT_DATA( 0,X,0,X ), + GEN_FONT_DATA( 0,X,0,X ) + },{ /* 'o' - ascii:0x6F font:0x6F */ + GEN_FONT_DATA( 0,0,0,0 ), + GEN_FONT_DATA( 0,0,X,0 ), + GEN_FONT_DATA( 0,X,0,X ), + GEN_FONT_DATA( 0,X,0,X ), + GEN_FONT_DATA( 0,0,X,0 ) + },{ /* 'p' - ascii:0x70 font:0x40 */ + GEN_FONT_DATA( 0,0,0,0 ), + GEN_FONT_DATA( 0,X,X,0 ), + GEN_FONT_DATA( 0,X,0,X ), + GEN_FONT_DATA( 0,X,X,0 ), + GEN_FONT_DATA( 0,X,0,0 ), + },{ /* 'q' - ascii:0x71 font:0x41 */ + GEN_FONT_DATA( 0,0,0,0 ), + GEN_FONT_DATA( 0,0,X,X ), + GEN_FONT_DATA( 0,X,0,X ), + GEN_FONT_DATA( 0,0,X,X ), + GEN_FONT_DATA( 0,0,0,X ) + },{ /* 'r' - ascii:0x72 font:0x43 */ + GEN_FONT_DATA( 0,0,0,0 ), + GEN_FONT_DATA( 0,X,0,X ), + GEN_FONT_DATA( 0,X,X,0 ), + GEN_FONT_DATA( 0,X,0,0 ), + GEN_FONT_DATA( 0,X,0,0 ) + },{ /* 's' - ascii:0x73 font:0x43 */ + GEN_FONT_DATA( 0,0,0,0 ), + GEN_FONT_DATA( 0,0,X,X ), + GEN_FONT_DATA( 0,X,X,0 ), + GEN_FONT_DATA( 0,0,X,X ), + GEN_FONT_DATA( 0,X,X,0 ) + },{ /* 't' - ascii:0x74 font:0x44 */ + GEN_FONT_DATA( 0,0,0,0 ), + GEN_FONT_DATA( 0,0,X,0 ), + GEN_FONT_DATA( 0,X,X,X ), + GEN_FONT_DATA( 0,0,X,0 ), + GEN_FONT_DATA( 0,0,X,X ), + },{ /* 'u' - ascii:0x75 font:0x45 */ + GEN_FONT_DATA( 0,0,0,0 ), + GEN_FONT_DATA( 0,X,0,X ), + GEN_FONT_DATA( 0,X,0,X ), + GEN_FONT_DATA( 0,X,0,X ), + GEN_FONT_DATA( 0,0,X,X ) + },{ /* 'v' - ascii:0x76 font:0x46 */ + GEN_FONT_DATA( 0,0,0,0 ), + GEN_FONT_DATA( 0,X,0,X ), + GEN_FONT_DATA( 0,X,0,X ), + GEN_FONT_DATA( 0,X,0,X ), + GEN_FONT_DATA( 0,0,X,0 ), + },{ /* 'w' - ascii:0x77 font:0x47 */ + GEN_FONT_DATA( 0,0,0,0 ), + GEN_FONT_DATA( 0,X,0,X ), + GEN_FONT_DATA( 0,X,0,X ), + GEN_FONT_DATA( 0,X,X,X ), + GEN_FONT_DATA( 0,X,0,X ), + },{ /* 'x' - ascii:0x78 font:0x48 */ + GEN_FONT_DATA( 0,0,0,0 ), + GEN_FONT_DATA( 0,X,0,X ), + GEN_FONT_DATA( 0,0,X,0 ), + GEN_FONT_DATA( 0,0,X,0 ), + GEN_FONT_DATA( 0,X,0,X ) + },{ /* 'y' - ascii:0x79 font:0x49 */ + GEN_FONT_DATA( 0,0,0,0 ), + GEN_FONT_DATA( 0,X,0,X ), + GEN_FONT_DATA( 0,0,X,0 ), + GEN_FONT_DATA( 0,0,X,0 ), + GEN_FONT_DATA( 0,X,0,0 ), + },{ /* 'z' - ascii:0x7A font:0x4A */ + GEN_FONT_DATA( 0,0,0,0 ), + GEN_FONT_DATA( 0,X,X,X ), + GEN_FONT_DATA( 0,0,0,X ), + GEN_FONT_DATA( 0,0,X,0 ), + GEN_FONT_DATA( 0,X,X,X ) + },{ /* '{' - ascii:0x7B font:0x4B */ + GEN_FONT_DATA( 0,0,X,X ), + GEN_FONT_DATA( 0,0,X,0 ), + GEN_FONT_DATA( 0,X,0,0 ), + GEN_FONT_DATA( 0,0,X,0 ), + GEN_FONT_DATA( 0,0,X,X ) + },{ /* '\' - ascii:0x7C font:0x4C */ + GEN_FONT_DATA( 0,0,0,0 ), + GEN_FONT_DATA( 0,X,0,0 ), + GEN_FONT_DATA( 0,0,X,0 ), + GEN_FONT_DATA( 0,0,0,X ), + GEN_FONT_DATA( 0,0,0,0 ) + },{ /* '}' - ascii:0x7D font:0x4D */ + GEN_FONT_DATA( 0,X,X,0 ), + GEN_FONT_DATA( 0,0,X,0 ), + GEN_FONT_DATA( 0,0,0,X ), + GEN_FONT_DATA( 0,0,X,0 ), + GEN_FONT_DATA( 0,X,X,0 ) + },{ /* '~' - ascii:0x7E font:0x4E */ + GEN_FONT_DATA( 0,0,0,0 ), + GEN_FONT_DATA( 0,X,0,0 ), + GEN_FONT_DATA( 0,X,X,X ), + GEN_FONT_DATA( 0,0,0,X ), + GEN_FONT_DATA( 0,0,0,0 ) + },{ /* DEL - ascii:0x7F font:0x4F */ + GEN_FONT_DATA( X,X,X,X ), + GEN_FONT_DATA( X,X,X,X ), + GEN_FONT_DATA( X,X,X,X ), + GEN_FONT_DATA( X,X,X,X ), + GEN_FONT_DATA( X,X,X,X ) + } +}; diff --git a/c/src/lib/libbsp/arm/gp32/include/.cvsignore b/c/src/lib/libbsp/arm/gp32/include/.cvsignore new file mode 100644 index 0000000000..34cf1342d5 --- /dev/null +++ b/c/src/lib/libbsp/arm/gp32/include/.cvsignore @@ -0,0 +1,7 @@ +Makefile +Makefile.in +coverhd.h +bspopts.h +bspopts.h.in +stamp-h +stamp-h.in diff --git a/c/src/lib/libbsp/arm/gp32/include/bsp.h b/c/src/lib/libbsp/arm/gp32/include/bsp.h new file mode 100644 index 0000000000..3b5b57ce55 --- /dev/null +++ b/c/src/lib/libbsp/arm/gp32/include/bsp.h @@ -0,0 +1,55 @@ +/*-------------------------------------------------------------------------+ +| bsp.h - ARM BSP ++--------------------------------------------------------------------------+ +| This include file contains definitions related to the ARM BSP. ++--------------------------------------------------------------------------+ +| +| Copyright (c) Canon Research France SA.] +| Emmanuel Raguet, mailto:raguet@crf.canon.fr +| +| The license and distribution terms for this file may be +| found in found in the file LICENSE in this distribution or at +| http://www.rtems.com/license/LICENSE. +| +| $Id$ ++--------------------------------------------------------------------------*/ + + +#ifndef __BSP_H_ +#define __BSP_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <bspopts.h> + +#include <rtems.h> +#include <rtems/iosupp.h> +#include <rtems/console.h> +#include <rtems/clockdrv.h> +#include <s3c2400.h> + +extern rtems_configuration_table BSP_Configuration; + +void LCD_BREAK(); + +/* What is the input clock freq in hertz? */ +#define BSP_OSC_FREQ 12000000 /* 12 MHz oscillator */ +#define M_MDIV 81 +#define M_PDIV 2 +#define M_SDIV 1 + +/* How many serial ports? */ +#define CONFIGURE_NUMBER_OF_TERMIOS_PORTS 1 + +/* How big should the interrupt stack be? */ +#define CONFIGURE_INTERRUPT_STACK_MEMORY (16 * 1024) + +#ifdef __cplusplus +} +#endif + +#endif /* __BSP_H_ */ +/* end of include file */ + diff --git a/c/src/lib/libbsp/arm/gp32/include/conio.h b/c/src/lib/libbsp/arm/gp32/include/conio.h new file mode 100644 index 0000000000..784e0d69a7 --- /dev/null +++ b/c/src/lib/libbsp/arm/gp32/include/conio.h @@ -0,0 +1,79 @@ +/* + * conio.h : ARM GP32 BSP + * + * This file contains the GP32 conio I/O package. + * + * + * Copyright (c) 2004 Markku Puro <markku.puro@kopteri.net> + * + * The license and distribution terms for this file may be + * found in found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + * + * $Id$ + */ + +#ifndef _CONIO_H +#define _CONIO_H + +#ifdef __cplusplus +extern "C" { +#endif + +/*---------------------------------------------------------------------------* + * Defines * + *---------------------------------------------------------------------------*/ +#define ASCII_BEL 0x07 /* bell */ +#define ASCII_BS 0x08 /* backspace */ +#define ASCII_TAB 0x09 /* horizontal tab */ +#define ASCII_LF 0x0A /* line feed */ +#define ASCII_CR 0x0D /* carriage return */ +#define ASCII_XON 0x11 /* control-Q */ +#define ASCII_XOFF 0x13 /* control-S */ +#define ASCII_ESC 0x1B /* escape */ + +enum COLORS +{ + BLACK, + BLUE, + GREEN, + CYAN, + RED, + MAGENTA, + BROWN, + LIGHTGRAY, + DARKGRAY, + LIGHTBLUE, + LIGHTGREEN, + LIGHTCYAN, + LIGHTRED, + LIGHTMAGENTA, + YELLOW, + WHITE, + MAXCOLORS +}; + +#define DEF_TEXTCOLOR BLACK +#define DEF_TEXTBACKGROUND WHITE + +/*---------------------------------------------------------------------------* + * Prototypes * + *---------------------------------------------------------------------------*/ +void gpconio_clrscr(); +void gpconio_textattr(int _attr); +void gpconio_textbackground(int _color); +void gpconio_textcolor(int _color); +void gpconio_putch(char _c); +void gpconio_puts(const char *_str); +int gpconio_printf(const char *_format, ...); +void gpconio_gotoxy(int _x, int _y); + +char gpconio_getch(void); +char gpconio_getch_noblock(void); + + +#ifdef __cplusplus +} +#endif + +#endif // _CONIO_H diff --git a/c/src/lib/libbsp/arm/gp32/include/tm27.h b/c/src/lib/libbsp/arm/gp32/include/tm27.h new file mode 100644 index 0000000000..b417668d83 --- /dev/null +++ b/c/src/lib/libbsp/arm/gp32/include/tm27.h @@ -0,0 +1,32 @@ +/* + * tm27.h + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + * + * $Id$ + */ + +#ifndef _RTEMS_TMTEST27 +#error "This is an RTEMS internal file you must not include directly." +#endif + +#ifndef __tm27_h +#define __tm27_h + +/* + * Define the interrupt mechanism for Time Test 27 + */ + +#define MUST_WAIT_FOR_INTERRUPT 0 + +#define Install_tm27_vector( handler ) /* empty */ + +#define Cause_tm27_intr() /* empty */ + +#define Clear_tm27_intr() /* empty */ + +#define Lower_tm27_intr() /* empty */ + +#endif diff --git a/c/src/lib/libbsp/arm/gp32/start/.cvsignore b/c/src/lib/libbsp/arm/gp32/start/.cvsignore new file mode 100644 index 0000000000..d29e5050f5 --- /dev/null +++ b/c/src/lib/libbsp/arm/gp32/start/.cvsignore @@ -0,0 +1,14 @@ +Makefile +Makefile.in +aclocal.m4 +autom4te.cache +config.cache +config.guess +config.log +config.status +config.sub +configure +depcomp +install-sh +missing +mkinstalldirs diff --git a/c/src/lib/libbsp/arm/gp32/start/start.S b/c/src/lib/libbsp/arm/gp32/start/start.S new file mode 100644 index 0000000000..3d4ca73375 --- /dev/null +++ b/c/src/lib/libbsp/arm/gp32/start/start.S @@ -0,0 +1,199 @@ +/* + * GP32 startup code + * + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * + * http://www.OARcorp.com/rtems/license.html. + * + * + * $Id$ + */ + + +/* Some standard definitions...*/ +.equ PSR_MODE_USR, 0x10 +.equ PSR_MODE_FIQ, 0x11 +.equ PSR_MODE_IRQ, 0x12 +.equ PSR_MODE_SVC, 0x13 +.equ PSR_MODE_ABT, 0x17 +.equ PSR_MODE_UNDEF, 0x1B +.equ PSR_MODE_SYS, 0x1F + +.equ PSR_I, 0x80 +.equ PSR_F, 0x40 +.equ PSR_T, 0x20 + +.text +.globl _start +_start: + b _start2 + +@--------------------------------------------------------------------------------- +@ AXF addresses +@--------------------------------------------------------------------------------- + .word _axf_text_start + .word _axf_ro_end + .word _axf_data_start + .word _axf_bss_end + .word _axf_bss_start + .word _axf_bss_end + +@--------------------------------------------------------------------------------- +@ GamePark magic sequence +@--------------------------------------------------------------------------------- + .word 0x44450011 + .word 0x44450011 + .word 0x01234567 + .word 0x12345678 + .word 0x23456789 + .word 0x34567890 + .word 0x45678901 + .word 0x56789012 + .word 0x23456789 + .word 0x34567890 + .word 0x45678901 + .word 0x56789012 + .word 0x23456789 + .word 0x34567890 + .word 0x45678901 + .word 0x56789012 + +@--------------------------------------------------------------------------------- +_start2: +@--------------------------------------------------------------------------------- + + /* + * Since I don't plan to return to the bootloader, + * I don't have to save the registers. + * + * I'll just set the CPSR for SVC mode, interrupts + * off, and ARM instructions. + */ + mov r0, #(PSR_MODE_SVC | PSR_I | PSR_F) + msr cpsr, r0 + + /* --- Initialize stack pointer registers */ + /* Enter IRQ mode and set up the IRQ stack pointer */ + mov r0, #(PSR_MODE_IRQ | PSR_I | PSR_F) /* No interrupts */ + msr cpsr, r0 + ldr r1, =_irq_stack_size + ldr sp, =_irq_stack + add sp, sp, r1 + + /* Enter FIQ mode and set up the FIQ stack pointer */ + mov r0, #(PSR_MODE_FIQ | PSR_I | PSR_F) /* No interrupts */ + msr cpsr, r0 + ldr r1, =_fiq_stack_size + ldr sp, =_fiq_stack + add sp, sp, r1 + + /* Enter ABT mode and set up the ABT stack pointer */ + mov r0, #(PSR_MODE_ABT | PSR_I | PSR_F) /* No interrupts */ + msr cpsr, r0 + ldr r1, =_abt_stack_size + ldr sp, =_abt_stack + add sp, sp, r1 + + /* Set up the SVC stack pointer last and stay in SVC mode */ + mov r0, #(PSR_MODE_SVC | PSR_I | PSR_F) /* No interrupts */ + msr cpsr, r0 + ldr r1, =_svc_stack_size + ldr sp, =_svc_stack + add sp, sp, r1 + sub sp, sp, #0x64 + + + /* disable mmu, I and D caches*/ + nop + nop + mrc p15, 0, r0, c1, c0, 0 + bic r0, r0, #0x01 + bic r0, r0, #0x04 + bic r0, r0, #0x01000 + mcr p15, 0, r0, c1, c0, 0 + nop + nop + + /* clean data cache */ + mov r1,#0x00 +Loop1: + mov r2,#0x00 +Loop2: + mov r3, r2, lsl#26 + orr r3, r3, r1, lsl#5 + mcr p15, 0, r3, c7, c14, 2 + add r2, r2, #0x01 + cmp r2, #64 + bne Loop2 + add r1, r1, #0x01 + cmp r1, #8 + bne Loop1 + + + /* + * Initialize the MMU. After we return, the MMU is enabled, + * and memory may be remapped. I hope we don't remap this + * memory away. + */ + ldr r0, =mem_map + bl mmu_init + + /* + * Initialize the exception vectors. This includes the + * exceptions vectors (0x00000000-0x0000001c), and the + * pointers to the exception handlers (0x00000020-0x0000003c). + */ + mov r0, #0 + adr r1, vector_block + ldmia r1!, {r2-r9} + stmia r0!, {r2-r9} + ldmia r1!, {r2-r9} + stmia r0!, {r2-r9} + + /* Now we are prepared to start the BSP's C code */ + bl boot_card + + /* + * Theoretically, we could return to what started us up, + * but we'd have to have saved the registers and stacks. + * Instead, we'll just reset. + */ + bl bsp_reset + + /* We shouldn't get here. If we do, hang */ +_hang: b _hang + + +/* + * This is the exception vector table and the pointers to + * the functions that handle the exceptions. It's a total + * of 16 words (64 bytes) + */ +vector_block: + ldr pc, Reset_Handler + ldr pc, Undefined_Handler + ldr pc, SWI_Handler + ldr pc, Prefetch_Handler + ldr pc, Abort_Handler + nop + ldr pc, IRQ_Handler + ldr pc, FIQ_Handler + +Reset_Handler: b bsp_reset +Undefined_Handler: b Undefined_Handler +SWI_Handler: b SWI_Handler +Prefetch_Handler: b Prefetch_Handler +Abort_Handler: b Abort_Handler + nop +IRQ_Handler: b IRQ_Handler +FIQ_Handler: b FIQ_Handler + +.globl Reset_Handler +.globl Undefined_Handler +.globl SWI_Handler +.globl Prefetch_Handler +.globl Abort_Handler +.globl IRQ_Handler +.globl FIQ_Handler diff --git a/c/src/lib/libbsp/arm/gp32/startup/.cvsignore b/c/src/lib/libbsp/arm/gp32/startup/.cvsignore new file mode 100644 index 0000000000..d29e5050f5 --- /dev/null +++ b/c/src/lib/libbsp/arm/gp32/startup/.cvsignore @@ -0,0 +1,14 @@ +Makefile +Makefile.in +aclocal.m4 +autom4te.cache +config.cache +config.guess +config.log +config.status +config.sub +configure +depcomp +install-sh +missing +mkinstalldirs diff --git a/c/src/lib/libbsp/arm/gp32/startup/bspstart.c b/c/src/lib/libbsp/arm/gp32/startup/bspstart.c new file mode 100644 index 0000000000..48f04fa75b --- /dev/null +++ b/c/src/lib/libbsp/arm/gp32/startup/bspstart.c @@ -0,0 +1,195 @@ +/*-------------------------------------------------------------------------+ +| This file contains the ARM BSP startup package. It includes application, +| board, and monitor specific initialization and configuration. The generic CPU +| dependent initialization has been performed before this routine is invoked. ++--------------------------------------------------------------------------+ +| +| Copyright (c) 2000 Canon Research Centre France SA. +| Emmanuel Raguet, mailto:raguet@crf.canon.fr +| +| The license and distribution terms for this file may be +| found in found in the file LICENSE in this distribution or at +| http://www.rtems.com/license/LICENSE. +| ++--------------------------------------------------------------------------*/ + + +#include <bsp.h> +#include <rtems/libcsupport.h> +#include <rtems/libio.h> +#include <s3c2400.h> + +/*-------------------------------------------------------------------------+ +| Global Variables ++--------------------------------------------------------------------------*/ + +extern void *_sdram_size; +extern void *_sdram_base; +extern void *_bss_free_start; + +unsigned long free_mem_start; +unsigned long free_mem_end; + +/* The original BSP configuration table from the application and our copy of it + with some changes. */ + +extern rtems_configuration_table Configuration; + rtems_configuration_table BSP_Configuration; + +rtems_cpu_table Cpu_table; /* CPU configuration table. */ +char *rtems_progname = "RTEMS"; /* Program name - from main(). */ + +/*-------------------------------------------------------------------------+ +| External Prototypes ++--------------------------------------------------------------------------*/ +extern void rtems_irq_mngt_init(void); +void bsp_libc_init( void *, uint32_t, int ); +void bsp_postdriver_hook(void); + +/*-------------------------------------------------------------------------+ +| Function: bsp_pretasking_hook +| Description: BSP pretasking hook. Called just before drivers are +| initialized. Used to setup libc and install any BSP +| extensions. NOTE: Must not use libc (to do io) from here, +| since drivers are not yet initialized. +| Global Variables: None. +| Arguments: None. +| Returns: Nothing. ++--------------------------------------------------------------------------*/ +void bsp_pretasking_hook(void) +{ + uint32_t heap_start; + uint32_t heap_size; + + /* + * Set up the heap. + */ + heap_start = free_mem_start; + heap_size = free_mem_end - free_mem_start; + + /* call rtems lib init - malloc stuff */ + bsp_libc_init((void *)heap_start, heap_size, 0); + +#ifdef RTEMS_DEBUG + + rtems_debug_enable(RTEMS_DEBUG_ALL_MASK); + +#endif /* RTEMS_DEBUG */ + +} /* bsp_pretasking_hook */ + +/*-------------------------------------------------------------------------+ +| Function: bsp_start +| Description: Called before main is invoked. +| Global Variables: None. +| Arguments: None. +| Returns: Nothing. ++--------------------------------------------------------------------------*/ +void bsp_start_default( void ) +{ + uint32_t cr; + /* If we don't have command line arguments set default program name. */ + + Cpu_table.pretasking_hook = bsp_pretasking_hook; /* init libc, etc. */ + Cpu_table.predriver_hook = NULL; /* use system's */ + Cpu_table.postdriver_hook = bsp_postdriver_hook; + Cpu_table.idle_task = NULL; + + Cpu_table.do_zero_of_workspace = TRUE; + Cpu_table.interrupt_stack_size = 4096; + Cpu_table.extra_mpci_receive_server_stack = 0; + + /* stop all timers */ + rTCON=0x0; + + /* disable interrupts */ + rINTMOD=0x0; + rINTMSK=BIT_ALLMSK; /* unmasked by drivers */ + rSRCPND=BIT_ALLMSK; + rINTMSK=BIT_ALLMSK; + rINTPND=BIT_ALLMSK; + + /* setup clocks 133/66/33) */ + rCLKDIVN=3; + rMPLLCON=((M_MDIV<<12)+(M_PDIV<<4)+M_SDIV); + + /* set prescaler for timers 2,3,4 to 16(15+1) */ + cr=rTCFG0 & 0xFFFF00FF; + rTCFG0=(cr | (15<<8)); + + /* set prescaler for timers 0,1 to 1(0+1) */ + cr=rTCFG0 & 0xFFFFFF00; + rTCFG0=(cr | (0<<0)); + + /* Place RTEMS workspace at beginning of free memory. */ + BSP_Configuration.work_space_start = (void *)&_bss_free_start; + + free_mem_start = ((uint32_t)&_bss_free_start + BSP_Configuration.work_space_size); + + free_mem_end = ((uint32_t)&_sdram_base + (uint32_t)&_sdram_size); + + /* + * Init rtems exceptions management + */ + rtems_exception_init_mngt(); + + /* + * Init rtems interrupt management + */ + rtems_irq_mngt_init(); + /* + * The following information is very useful when debugging. + */ + +#if 0 + printk( "work_space_size = 0x%x\n", BSP_Configuration.work_space_size ); + printk( "maximum_extensions = 0x%x\n", BSP_Configuration.maximum_extensions ); + printk( "microseconds_per_tick = 0x%x\n", + BSP_Configuration.microseconds_per_tick ); + printk( "ticks_per_timeslice = 0x%x\n", + BSP_Configuration.ticks_per_timeslice ); + printk( "maximum_devices = 0x%x\n", BSP_Configuration.maximum_devices ); + printk( "number_of_device_drivers = 0x%x\n", + BSP_Configuration.number_of_device_drivers ); + printk( "Device_driver_table = 0x%x\n", + BSP_Configuration.Device_driver_table ); + + printk( "_heap_size = 0x%x\n", _heap_size ); + /* printk( "_stack_size = 0x%x\n", _stack_size );*/ + printk( "rtemsFreeMemStart = 0x%x\n", rtemsFreeMemStart ); + printk( "work_space_start = 0x%x\n", BSP_Configuration.work_space_start ); + printk( "work_space_size = 0x%x\n", BSP_Configuration.work_space_size ); +#endif + +} + +/* + * By making this a weak alias for bsp_start_default, a brave soul + * can override the actual bsp_start routine used. + */ + +void bsp_start (void) __attribute__ ((weak, alias("bsp_start_default"))); + +void bsp_reset(void) +{ + rtems_interrupt_level level; + _CPU_ISR_Disable(level); + printk("bsp_reset.....\n"); + while(1); +} + +void LCD_BREAK() +{ + int x,y; + unsigned short color=0; + volatile unsigned char* framebuffer = (unsigned char*) 0x0C7B4000; + while(1) { + for(y = 0; y < 240; y++) { + for(x = 0; x < 320; x++) { + *(framebuffer + (239 - y) + (240 * x)) = color; + } + } + color++; + } +} + diff --git a/c/src/lib/libbsp/arm/gp32/startup/exit.c b/c/src/lib/libbsp/arm/gp32/startup/exit.c new file mode 100644 index 0000000000..3683f06803 --- /dev/null +++ b/c/src/lib/libbsp/arm/gp32/startup/exit.c @@ -0,0 +1,29 @@ +/*-------------------------------------------------------------------------+ +| exit.c - ARM BSP ++--------------------------------------------------------------------------+ +| Routines to shutdown and reboot the BSP. ++--------------------------------------------------------------------------+ +| +| Copyright (c) 2000 Canon Research Centre France SA. +| Emmanuel Raguet, mailto:raguet@crf.canon.fr +| +| The license and distribution terms for this file may be +| found in found in the file LICENSE in this distribution or at +| http://www.rtems.com/license/LICENSE. +| ++--------------------------------------------------------------------------*/ + + +#include <stdio.h> +#include <bsp.h> +#include <rtems/bspIo.h> +#include <rtems/libio.h> + +void bsp_reset(); + +void bsp_cleanup(void) +{ + bsp_reset(); +} + + diff --git a/c/src/lib/libbsp/arm/gp32/startup/linkcmds b/c/src/lib/libbsp/arm/gp32/startup/linkcmds new file mode 100644 index 0000000000..098fa28ddd --- /dev/null +++ b/c/src/lib/libbsp/arm/gp32/startup/linkcmds @@ -0,0 +1,275 @@ +/* + * GP32 Linker script + * + * Written by Philippe Simons <loki_666@fastmail.fm> + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ +OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm","elf32-littlearm") +OUTPUT_ARCH(arm) +ENTRY(_start) +/* SEARCH_DIR(/usr/local/rtems-arm-dev-tools/arm-rtems/lib); */ + + +MEMORY { + sdram : ORIGIN = 0xc000000, LENGTH = 7M +} + +/* + * Declare some sizes. + */ + +/* The base for SDRAM is set to umon's APPRAMBASE */ +_sdram_base = DEFINED(_sdram_base) ? _sdram_base : 0xc000000; +_sdram_size = DEFINED(_sdram_size) ? _sdram_size : 7M; + + +_irq_stack_size = DEFINED(_irq_stack_size) ? _irq_stack_size : 0x1000; +_fiq_stack_size = DEFINED(_fiq_stack_size) ? _fiq_stack_size : 0x400; +_abt_stack_size = DEFINED(_abt_stack_size) ? _abt_stack_size : 0x100; +_svc_stack_size = DEFINED(_svc_stack_size) ? _svc_stack_size : 0x1000; + + + +/* Do we need any of these for elf? + __DYNAMIC = 0; */ + +SECTIONS +{ + .base : + { + arm_exception_table = .; + + arm_reset_vect = .; /* 0x00 */ + . += 4; + + arm_undef_vect = .; /* 0x04 */ + . += 4; + + arm_swi_vect = .; /* 0x08 */ + . += 4; + + arm_iabrt_vect = .; /* 0x0c */ + . += 4; + + arm_dabrt_vect = .; /* 0x10 */ + . += 4; + + /* no vector here */ + . += 4; + + arm_irq_vect = .; /* 0x18 */ + . += 4; + + arm_fiq_vect = .; /* 0x1c */ + . += 4; + /* FIXME: */ + + rtems_vector_table = .; + . += (8 * 4); /* 8 ARM interrupts */ + + bsp_vector_table = .; + . += (32 * 4); /* 32 S3C2400 interrupts */ + + . = ALIGN (0x100); + + + } > sdram + + + .text : + { + _axf_text_start = . ; + *(EXCLUDE_FILE (*text.iwram*) .text) + *(.text.*) + *(.stub) + + /* + * Special FreeBSD sysctl sections. + */ + . = ALIGN (16); + __start_set_sysctl_set = .; + *(set_sysctl_*); + __stop_set_sysctl_set = ABSOLUTE(.); + *(set_domain_*); + *(set_pseudo_*); + + /* .gnu.warning sections are handled specially by elf32.em. */ + *(.gnu.warning) + *(.gnu.linkonce.t*) + *(.glue_7) + *(.glue_7t) + + . = ALIGN(4); /* REQUIRED. LD is flaky without it. */ + } > sdram + + __text_end = . ; + + .init : + { + *(.init) + } > sdram /*=0*/ + + .jcr : + { + *(.jcr) + } > sdram + + + .fini : + { + *(.fini) + } > sdram /*=0*/ + + .rodata : + { + *(.rodata) + *all.rodata*(*) + *(.roda) + *(.rodata.*) + *(.gnu.linkonce.r*) + SORT(CONSTRUCTORS) + . = ALIGN(4); /* REQUIRED. LD is flaky without it. */ + } > sdram = 0xff + + .ctors : + { + /* gcc uses crtbegin.o to find the start of the constructors, so + we make sure it is first. Because this is a wildcard, it + doesn't matter if the user does not actually link against + crtbegin.o; the linker won't look for a file to match a + wildcard. The wildcard also means that it doesn't matter which + directory crtbegin.o is in. */ + KEEP (*crtbegin.o(.ctors)) + KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors)) + KEEP (*(SORT(.ctors.*))) + KEEP (*(.ctors)) + . = ALIGN(4); /* REQUIRED. LD is flaky without it. */ + } >sdram = 0 + + .dtors : + { + KEEP (*crtbegin.o(.dtors)) + KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors)) + KEEP (*(SORT(.dtors.*))) + KEEP (*(.dtors)) + . = ALIGN(4); /* REQUIRED. LD is flaky without it. */ + } >sdram = 0 + + + .eh_frame : + { + KEEP (*(.eh_frame)) + . = ALIGN(4); /* REQUIRED. LD is flaky without it. */ + } >sdram = 0 + + .gcc_except_table : + { + *(.gcc_except_table) + . = ALIGN(4); /* REQUIRED. LD is flaky without it. */ + } >sdram = 0 + _axf_ro_end = . ; + + .data ALIGN(4) : + { + _axf_data_start = ABSOLUTE(.); + *(.data) + *(.data.*) + *(.gnu.linkonce.d*) + CONSTRUCTORS + . = ALIGN(4); /* REQUIRED. LD is flaky without it. */ + } >sdram = 0xff + + __data_end = . ; + + .bss ALIGN(4): + { + _axf_bss_start = ABSOLUTE(.); + _clear_start = .; + *(.bss) + *(.bss.*) + *(.gnu.linkonce.b.*) + *(COMMON) + . = ALIGN(64); + _clear_end = .; + + . = ALIGN (256); + _abt_stack = .; + . += _abt_stack_size; + + . = ALIGN (256); + _irq_stack = .; + . += _irq_stack_size; + + . = ALIGN (256); + _fiq_stack = .; + . += _fiq_stack_size; + + . = ALIGN (256); + _svc_stack = .; + . += _svc_stack_size; + +/* + * Ideally, the MMU's translation table would be in SRAM. But we + * don't have any. If we don't use more regions than TLB entries (64), + * the lookup will only happen once for each region. + */ + . = ALIGN (16 * 1024); + _ttbl_base = .; + . += (16 * 1024); + + . = ALIGN (1024); + _bss_free_start = .; + + } > sdram + _axf_bss_end = . ; + + _end = . ; + __end__ = . ; + PROVIDE (end = _end); + + +/* Debugging stuff follows? */ + + /* Stabs debugging sections. */ + .stab 0 : { *(.stab) } + .stabstr 0 : { *(.stabstr) } + .stab.excl 0 : { *(.stab.excl) } + .stab.exclstr 0 : { *(.stab.exclstr) } + .stab.index 0 : { *(.stab.index) } + .stab.indexstr 0 : { *(.stab.indexstr) } + .comment 0 : { *(.comment) } + /* DWARF debug sections. + Symbols in the DWARF debugging sections are relative to the beginning + of the section so we begin them at 0. */ + /* DWARF 1 */ + .debug 0 : { *(.debug) } + .line 0 : { *(.line) } + /* GNU DWARF 1 extensions */ + .debug_srcinfo 0 : { *(.debug_srcinfo) } + .debug_sfnames 0 : { *(.debug_sfnames) } + /* DWARF 1.1 and DWARF 2 */ + .debug_aranges 0 : { *(.debug_aranges) } + .debug_pubnames 0 : { *(.debug_pubnames) } + /* DWARF 2 */ + .debug_info 0 : { *(.debug_info) } + .debug_abbrev 0 : { *(.debug_abbrev) } + .debug_line 0 : { *(.debug_line) } + .debug_frame 0 : { *(.debug_frame) } + .debug_str 0 : { *(.debug_str) } + .debug_loc 0 : { *(.debug_loc) } + .debug_macinfo 0 : { *(.debug_macinfo) } + /* SGI/MIPS DWARF 2 extensions */ + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } + /*.stack 0x80000 : { _stack = .; *(.stack) }*/ + /* These must appear regardless of . */ +} + diff --git a/c/src/lib/libbsp/arm/gp32/startup/memmap.c b/c/src/lib/libbsp/arm/gp32/startup/memmap.c new file mode 100644 index 0000000000..50492c56b4 --- /dev/null +++ b/c/src/lib/libbsp/arm/gp32/startup/memmap.c @@ -0,0 +1,28 @@ +/* + * GP32 Memory Map + * + * Copyright (c) 2004 by Cogent Computer Systems + * Written by Jay Monkman <jtm@lopingdog.com> + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ +#include <rtems.h> +#include <libcpu/mmu.h> + +/* Remember, the ARM920 has 64 TLBs. If you have more 1MB sections than + * that, you'll have TLB lookups, which could hurt performance. + */ +mmu_sect_map_t mem_map[] = { +/* <phys addr> <virt addr> <size> <flags> */ + {0x0c000000, 0x00000000, 1, MMU_CACHE_NONE}, /* SDRAM for vectors */ + {0x0c000000, 0x0c000000, 7, MMU_CACHE_WTHROUGH}, /* SDRAM W cache */ + {0x0c700000, 0x0c700000, 1, MMU_CACHE_NONE}, /* SDRAM W/O cache */ + {0x14000000, 0x14000000, 16, MMU_CACHE_NONE}, /* Internals Regs - */ + {0x15000000, 0x15000000, 16, MMU_CACHE_NONE}, /* Internal Regs - */ + {0x00000000, 0x00000000, 0, 0} /* The end */ +}; |