diff options
Diffstat (limited to 'c/src/lib/libbsp/i386/pc386')
39 files changed, 0 insertions, 6518 deletions
diff --git a/c/src/lib/libbsp/i386/pc386/HOWTO b/c/src/lib/libbsp/i386/pc386/HOWTO deleted file mode 100644 index 9c7a9af2b4..0000000000 --- a/c/src/lib/libbsp/i386/pc386/HOWTO +++ /dev/null @@ -1,308 +0,0 @@ - -+-----------------------------------------------------------------------------+ -| RTEMS 4.0.0 PC386 BSP HOWTO - 1998/04/21 | -+-----------------------------------------------------------------------------+ -| (C) Copyright 1998 - | -| - NavIST Group - Real-Time Distributed Systems and Industrial Automation | -| | -| http://pandora.ist.utl.pt | -| | -| Instituto Superior Tecnico * Lisboa * PORTUGAL | -+-----------------------------------------------------------------------------+ -| Disclaimer: | -| | -| This file is provided "AS IS" without warranty of any kind, either | -| expressed or implied. | -+-----------------------------------------------------------------------------+ - - -1. Introduction ---------------- - - This tries to explain how to setup the RTEMS host environment so -that RTEMS applications can be built for and run in a bare PC 386 or -above. - - It covers essentially the aspects of loading images, since -information concerning other issues such as building the development -tools and the RTEMS distribution can be found in the 'RTEMS 4.0.0 -On-Line Library' under 'Getting Started with RTEMS for C/C++ Users'. - - Please note that everything in the following text using the -notation '<...>' is just an alias to something and should always be -substituted by the real thing! - - -2. Building the GNU C/C++ Cross Compiler Toolset ------------------------------------------------- - - Obtaining, building and installing the tools for building the -PC386 BSP of RTEMS is covered in detail in the 'RTEMS 4.0.0 On-Line -Library' -> 'Getting Started with RTEMS for C/C++ Users' -> 'Building -the GNU C/C++ Cross Compiler Toolset'. - - When running the 'bit' script you should specift the argumetn as -either: - - + 'i386-elf' to indicate an 'i386-rtemself' toolset, or - + 'i386' to indicate an 'i386-rtems' toolset. - - -4. Building RTEMS ------------------ - Obtaining, building and installing the tools for building the -PC386 BSP is covered in detail in the 'RTEMS 4.0.0 On-Line Library' -> -'Getting Started with RTEMS for C/C++ Users' -> 'Building RTEMS'. - - When running configure, use the following values for the listed -options: - - + with an i386-rtemself toolset - --target=i386-rtemself - --enable-rtemsbsp=pc386 - - + with an i386-rtems toolset - --target=i386-rtems - --enable-rtemsbsp=pc386 - - -5. RTEMS Tests --------------- - - If you've completed the last step successfully, you'll find the -RTEMS sample and test files that can be loaded with GRUB in the -'<build_point>/pc386/tests' directory, RTEMS sample and test files in -a format suitable for use with NetBoot in the -'<build_point>/pc386/BootImgs' directory. - - -6. Loading RTEMS PC386 applications ------------------------------------ - -6.1. Unarchiving ----------------- - - Files which have been "tarred, gzipped" (i.e. .tar.gz or .tgz -extension) may be unarchived with a command similar to one of the -following: - - zcat <file>.tgz | tar xvof - - - OR - - gunzip -c <file>.tgz | tar xvof - - - OR - - tar xzvf <file>.tgz - - NOTE: gunzip -c is equivalent to zcat. On commercial (non-Linux) -Unices, since the GNU utilities are not the standard 'tar' will be -gtar (GNU tar) and 'zcat' will be 'gzcat'. - - Given that the necessary utility programs are installed, any of -the above commands will extract the contents of <file>.tar.gz into the -current directory. To view the contents of an archive without -restoring any files, use a command similar to the following: - - zcat <file>.tgz | tar tvf - - - -6.2 Using GRUB to load RTEMS PC386 applications ------------------------------------------------ - - Using GRUB (GRand Unified Bootloader) is the simplest way to load -and run your PC386 BSP samples, tests and programs. - - You can get the latest release of GRUB from its homepage: - - - http://www.uruk.org/grub/ - -or alternatively by ftp from: - - - ftp://ftp.uruk.org/public/grub/ - - Once you obtain the .tar.gz archive 'grub-0.4.tar.gz', change to a -temporary directory (you won't need the grub files after this and can -just go ahead and delete the whole directory structure that was -generated) and unarchive 'grub-0.4.tar.gz' following the instructions -given above in [2. Unarchiving]. - - After this is done change the directory to: - - grub-0.4/bin_std - -and there you'll find the two files you'll need from this archive: -'stage1' and 'stage2'. - - You should have two (2) formatted diskettes available. One of -these will only be used temporarily to create the other one, and we'll -refer to it as 'RAW GRUB' diskette (you can label it accordingly if -you wish). The other diskette, which we will refer to as 'GRUB FS' -should be high-level formatted with one of GRUB's supported file -systems, which are: DOS FAT, BSD FFS, and Linux ext2fs. - - A DOS FAT diskette can, obviously, be created under DOS with the -'FORMAT' command. Under Linux, the following commands are available to -add file systems to low-level formatted diskettes: - - 1. To add a DOS FAT file system to a low-level formatted diskette: - - a) If you have mtools installed: - - 'mformat a:'. - - b) Assuming that you are formatting the diskette in the first - floppy disk drive ('/dev/fd0' under Linux): - - 'mkdosfs /dev/fd0' or - - 'mkfs.msdos /dev/fd0'. - - 2. To add a Linux ext2fs file system to a low-level formatted - diskette, assuming that you are formatting the diskette in the - first floppy disk drive ('/dev/fd0' under Linux): - - 'mke2fs /dev/fd0' or - - 'mkfs.ext2 /dev/fd0'. - - Next we will install using 'rawrite' or 'dd' to the 'GRUB RAW' -diskette. - - NOTE: This will destroy any data currently on the diskette. - - Execute your OS's equivalent of (this should work for recent -FreeBSD versions and Linux just fine): - - dd if=stage1 of=/dev/fd0 bs=512 count=1 - dd if=stage2 of=/dev/fd0 bs=512 seek=1 - - Under DOS/Windows/NT, courtesy of Eric Hanchrow (erich@microsoft.com): - - * Use the copy /b command to binary concatenate the stage1 and - stage2 files together via: - - copy /b stage1 stage2 grub.raw - - * Use rawrite.exe (which is available in many places on the net and - in some Linux distributions) to write grub.raw to a diskette. - - Next stage: copy the 'stage1' and 'stage2' files to the 'GRUB FS' -diskette (if you are using Linux you can mount the diskette in an -appropriate mount point and then 'cp' the files to it, if it is either -a DOS FAT or an EXT2FS diskette, or in the case of a DOS FAT diskette -you can use 'mcopy' from 'mtools'.) - - After this is done boot a PC using the 'GRUB RAW' diskette. After -this is done, you will get GRUB's command line interface. Exchange -'GRUB RAW' with the 'GRUB FS' diskette in the drive and issue the -following command from GRUB's prompt: - - install=(fd0)/stage1 (fd0) (fd0)/stage2 0x8000 (fd0)/grubmenu - - This command will make the 'GRUB FS' diskette bootable. After this -is done, you won't require the 'GRUB RAW' diskette anymore and you can -delete the 'stage1' file from the 'GRUB FS' diskette. - - Next copy all the files you wish to load to the diskette. The GRUB -loadable test and sample files in the RTEMS distribution have '.exe' -extension and can be found under the build point in the 'pc386/tests' -directory. You can compress this files with gzip to save space if you -wish. GRUB loads 'gzipped' files transparently. - - Finally you have to create a GRUB menu configuration file. We will -call this file 'grubmenu'. You can call it anything as long as you use -the correct name in the 'install' command where we used 'grubmenu'. - - The 'grubmenu' file, as far as we are interested has the following -syntax: - - title= Hello World Test - kernel= (fd0)/hello.exe.gz - - You can add as many of this entries as you want to the 'grubmenu' -file. There should be one for each program you wish to load. The -'title=' line provides a description for the program that will appear -after boot in the GRUB menu for the user to choose and the 'kernel=' -line describes where the file can be found by GRUB (you should leave -the '(fd0)/' part and just substitute the rest if you've copied the -files to the root directory of the diskette. - - Just boot the PC with the 'GRUB FS' diskette and you will be able -to choose which program you want to load from GRUB's menu. - - The GRUB documentation is available in HTML format in the 'docs' -directory of the GRUB tree starting with the 'index.html' file. - - -6.3 Using NetBoot to load RTEMS PC386 applications ---------------------------------------------------- - - To load the '*.bt' files you can - - Alternatively, if you have a PC connected to a network with a -BOOTP server and a TFTP server (this can very well be you're Linux -RTEMS host system), you can use Gero Kuhlmann's NetBoot loader, to -load RTEMS to a diskless PC across a network. You can get it from: - - ftp://sunsite.unc.edu/pub/Linux/system/boot/ethernet/netboot-0.7.3.tar.gz - -or in any of Sunsite's mirrors. It is also available from NetBoot's -homepage: - - http://www.han.de/~gero/netboot - - After unarchiving 'netboot-0.7.3.tar.gz' you should change to the -base directory of this and run: - - ./configure --disable-mknbi-dos --disable-mknbi-linux --disable-mknbi-mgl - - Afterwards, you should follow the instructions contained in the -'INSTALL' file also contained in the base directory, on how to setup the -server(s) and to build a boot ROM for the client PC network card, or a -boot diskette, and the PC client should be able to load the '*.bt' files -from the server. - - The important sections to check in the 'INSTALL FILE' are the last two: - - - Setup of the server (only the BOOTP and TFTP parts - ignore NFS). - =================== - - - Setup of the client including building the bootrom - ================================================== - -all the rest can be safely ignored if you don't care to examine it. - - -7. Technical Information ------------------------- - - NOTE: All the following paths are relative to the base directory -of the RTEMS distribution. - - As of the writing of this HOWTO, PC386 images can be loaded either -in low memory 0x10000 (64KB) until 0x97C00 (607K) using NetBoot or in -high memory from 0x100000 (1024KB) until the top of the available -memory using either NetBoot or GRUB. - - If you want to change the default loading address from 1024KB to -something else, just change the value of the variable RELOCADDR in the -'make/custom/pc386.cfg' file to the new value you want (make sure you -follow the instructions indicated before the definition of RELOCADDR). - - Remember that GRUB restricts the loading addresses to values above -0x100000 (1024KB), only NetBoot can load images in low memory. - - After you make any changes to RELOCADDR and if you are using -NetLoader, you'll have to recompile the -'c/src/lib/libbsp/i386/pc386/start/start16.s' file. The easiest way to -achieve this is just to 'make clean' and the 'make all' again. The -quickest way is to change to -'<build_point>/c/src/lib/libbsp/i386/pc386/start' and 'make -RTEMS_BSP=pc386 clean all'. - - When programming interrupt handlers take into account that the PIC -is reprogrammed and so you should use the interface functions provided -in '<build_point>/pc386/lib/include/irq.h> to guarantee that everything -works ok. diff --git a/c/src/lib/libbsp/i386/pc386/Makefile.in b/c/src/lib/libbsp/i386/pc386/Makefile.in deleted file mode 100644 index 68582b5145..0000000000 --- a/c/src/lib/libbsp/i386/pc386/Makefile.in +++ /dev/null @@ -1,21 +0,0 @@ -# -# $Id$ -# - -@SET_MAKE@ -srcdir = @srcdir@ -VPATH = @srcdir@ -RTEMS_ROOT = @top_srcdir@ -PROJECT_ROOT = @PROJECT_ROOT@ - -include $(RTEMS_ROOT)/make/custom/$(RTEMS_BSP).cfg -include $(RTEMS_ROOT)/make/directory.cfg - -# We only build the Network library if HAS_NETWORKING was defined -NETWORK_yes_V = network -NETWORK = $(NETWORK_$(HAS_NETWORKING)_V) - -# wrapup is the one that actually builds and installs the library -# from the individual .rel files built in other directories -SUB_DIRS=include tools start startup clock console timer $(NETWORK) \ - wrapup diff --git a/c/src/lib/libbsp/i386/pc386/README b/c/src/lib/libbsp/i386/pc386/README deleted file mode 100644 index 00f3263a99..0000000000 --- a/c/src/lib/libbsp/i386/pc386/README +++ /dev/null @@ -1,64 +0,0 @@ -# -# $Id$ -# - -# -# This board support package works with a target PC -# -# Decisions to be made a link-edit time are: -# - The size of the memory allocator heap. The default value is -# 64 kbytes. If the network package is used the heap -# should be at least 256 kbytes. If your network is large, or -# busy, the heap should be even larger. -# To choose a heap size of 256 kbytes, -# CFLAGS_LD += -Wl,--defsym -Wl,HeapSize=0x40000 - -BSP NAME: pc386 -BOARD: PC -BUS: none -CPU FAMILY: 386, 486, 586, 686 -COPROCESSORS: none -MODE: not applicable - -DEBUG MONITOR: - -PERIPHERALS -=========== -TIMERS: 8254 Programmable Interval Timer -RESOLUTION: -SERIAL PORTS: COM1, COM2 -REAL-TIME CLOCK: -DMA: -VIDEO: VGA -SCSI: -NETWORKING: external Ethernet controller based on WD8003. - -DRIVER INFORMATION -================== -CLOCK DRIVER: 8254 Programmable Interval Timer -IOSUPP DRIVER: -SHMSUPP: -TIMER DRIVER: - -STDIO -===== -PORT: -ELECTRICAL: -BAUD: -BITS PER CHARACTER: -PARITY: -STOP BITS: - -NOTES -===== - -Board description ------------------ -clock rate: -bus width: -ROM: -RAM: - -Host System ------------ -Linux diff --git a/c/src/lib/libbsp/i386/pc386/STATUS b/c/src/lib/libbsp/i386/pc386/STATUS deleted file mode 100644 index d2a1960f72..0000000000 --- a/c/src/lib/libbsp/i386/pc386/STATUS +++ /dev/null @@ -1,25 +0,0 @@ -# -# $Id$ -# - - -There are a wide range of PC configurations. This BSP has been tested -on only a handful. There are configurations which do not yet work. The -failure is suspected to be video card related. Here is a list of -successes and failures. - -SUCCESSES -========= - GRUB - AMD K6 MMX 200Mhz + S3 ViRGE - GRUB - 486 DX 33Mhz + Cirrus Logic CL-GD540x/542x - GRUB - Pentium MMX 166Mhz + S3 Trio 64V2 - GRUB - Pentium (P54C) 120Mhz + S3 Trio 64V+ - GRUB - Pentium-S 133Mhz + S3 Trio 64V2 - -FAILURES -======== - GRUB - 486 DX2 66Mhz + Cirrus Logic CL-GD5428 - reset - GRUB - PII 333 Mhz + STB Vision 128 - reset - GRUB - PII 300 Mhz + Permedia - reset - GRUB - Pentium 60 Mhz + Mach 32/64 - reset - diff --git a/c/src/lib/libbsp/i386/pc386/bsp_specs b/c/src/lib/libbsp/i386/pc386/bsp_specs deleted file mode 100644 index 61dac86b53..0000000000 --- a/c/src/lib/libbsp/i386/pc386/bsp_specs +++ /dev/null @@ -1,23 +0,0 @@ -%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__} -Asystem(embedded) - -*lib: -%{!qrtems: %(old_lib)} %{qrtems: --start-group \ -%{!qrtems_debug: -lrtemsall} %{qrtems_debug: -lrtemsall_g} \ --lc -lgcc --end-group \ -%{!qnolinkcmds: -T linkcmds%s}} - -*startfile: -%{!qrtems: %(old_startfile)} %{qrtems: \ -%{!qrtems_debug: start.o%s} \ -%{qrtems_debug: start_g.o%s}} - -*link: -%{!qrtems: %(old_link)} %{qrtems: -dc -dp -N -e start} - diff --git a/c/src/lib/libbsp/i386/pc386/clock/Makefile.in b/c/src/lib/libbsp/i386/pc386/clock/Makefile.in deleted file mode 100644 index c8c96b56d2..0000000000 --- a/c/src/lib/libbsp/i386/pc386/clock/Makefile.in +++ /dev/null @@ -1,55 +0,0 @@ -# -# $Id$ -# - -@SET_MAKE@ -srcdir = @srcdir@ -VPATH = @srcdir@ -RTEMS_ROOT = @top_srcdir@ -PROJECT_ROOT = @PROJECT_ROOT@ - -PGM=${ARCH}/clock.rel - -# C source names, if any, go here -- minus the .c -C_PIECES=ckinit rtc -C_FILES=$(C_PIECES:%=%.c) -C_O_FILES=$(C_PIECES:%=${ARCH}/%.o) - -H_FILES= - -SRCS=$(C_FILES) $(H_FILES) -OBJS=$(C_O_FILES) - -include $(RTEMS_ROOT)/make/custom/$(RTEMS_BSP).cfg -include $(RTEMS_ROOT)/make/leaf.cfg - - -# -# (OPTIONAL) Add local stuff here using += -# - -DEFINES += -CPPFLAGS += -CFLAGS += - -LD_PATHS += -LD_LIBS += -LDFLAGS += - -# -# Add your list of files to delete here. The config files -# already know how to delete some stuff, so you may want -# to just run 'make clean' first to see what gets missed. -# 'make clobber' already includes 'make clean' -# - -CLEAN_ADDITIONS += -CLOBBER_ADDITIONS += - -${PGM}: ${SRCS} ${OBJS} - $(make-rel) - -all: ${ARCH} $(SRCS) $(PGM) - -# the .rel file built here will be put into libbsp.a by ../wrapup/Makefile -install: all diff --git a/c/src/lib/libbsp/i386/pc386/clock/ckinit.c b/c/src/lib/libbsp/i386/pc386/clock/ckinit.c deleted file mode 100644 index ee252a1e44..0000000000 --- a/c/src/lib/libbsp/i386/pc386/clock/ckinit.c +++ /dev/null @@ -1,281 +0,0 @@ -/*-------------------------------------------------------------------------+ -| ckinit.c v1.1 - PC386 BSP - 1997/08/07 -+--------------------------------------------------------------------------+ -| This file contains the PC386 clock package. -+--------------------------------------------------------------------------+ -| (C) Copyright 1997 - -| - NavIST Group - Real-Time Distributed Systems and Industrial Automation -| -| http://pandora.ist.utl.pt -| -| Instituto Superior Tecnico * Lisboa * PORTUGAL -+--------------------------------------------------------------------------+ -| Disclaimer: -| -| This file is provided "AS IS" without warranty of any kind, either -| expressed or implied. -+--------------------------------------------------------------------------+ -| This code is based on: -| ckinit.c,v 1.4 1995/12/19 20:07:13 joel Exp - go32 BSP -| With the following copyright notice: -| ************************************************************************** -| * COPYRIGHT (c) 1989-1998. -| * On-Line Applications Research Corporation (OAR). -| * Copyright assigned to U.S. Government, 1994. -| * -| * The license and distribution terms for this file may be -| * found in found in the file LICENSE in this distribution or at -| * http://www.OARcorp.com/rtems/license.html. -| ************************************************************************** -| -| $Id$ -+--------------------------------------------------------------------------*/ - - -#include <stdlib.h> - -#include <bsp.h> -#include <irq.h> -#include <rtems/libio.h> - -/*-------------------------------------------------------------------------+ -| Macros -+--------------------------------------------------------------------------*/ -#if 0 -/* This was dropped in the last revision. Its a nice thing to know. */ -#define TICKS_PER_SECOND() \ - (1000000 / (Clock_isrs_per_tick * microseconds_per_isr)) -#endif /* 0 */ - -/*-------------------------------------------------------------------------+ -| Global Variables -+--------------------------------------------------------------------------*/ - -volatile rtems_unsigned32 Clock_driver_ticks; /* Tick (interrupt) counter. */ - rtems_unsigned32 Clock_isrs_per_tick; /* ISRs per tick. */ - rtems_unsigned32 Clock_isrs; /* ISRs until next tick. */ - -/* The following variables are set by the clock driver during its init */ - -rtems_device_major_number rtems_clock_major = ~0; -rtems_device_minor_number rtems_clock_minor; - -/*-------------------------------------------------------------------------+ -| Function: clockIsr -| Description: Interrupt Service Routine for clock (0h) interruption. -| Global Variables: Clock_driver_ticks, Clock_isrs. -| Arguments: vector - standard RTEMS argument - see documentation. -| Returns: standard return value - see documentation. -+--------------------------------------------------------------------------*/ -static void clockIsr() -{ - /*-------------------------------------------------------------------------+ - | PLEASE NOTE: The following is directly transcribed from the go32 BSP for - | those who wish to use it with PENTIUM based machine. It needs - | to be correctly integrated with the rest of the code!!! - +--------------------------------------------------------------------------*/ - -#if 0 && defined(pentium) /* more accurate clock for PENTIUMs (not supported) */ - { - extern long long Last_RDTSC; - __asm __volatile(".byte 0x0F, 0x31" : "=A" (Last_RDTSC)); - } -#endif /* 0 && pentium */ - - Clock_driver_ticks++; - - if ( Clock_isrs == 1 ) - { - rtems_clock_tick(); - Clock_isrs = Clock_isrs_per_tick; - } - else - Clock_isrs--; - -} /* clockIsr */ - -/*-------------------------------------------------------------------------+ -| Function: Clock_exit -| Description: Clock cleanup routine at RTEMS exit. NOTE: This routine is -| not really necessary, since there will be a reset at exit. -| Global Variables: None. -| Arguments: None. -| Returns: Nothing. -+--------------------------------------------------------------------------*/ -void clockOff(const rtems_irq_connect_data* unused) -{ - if (BSP_Configuration.ticks_per_timeslice) - { - /* reset timer mode to standard (BIOS) value */ - outport_byte(TIMER_MODE, TIMER_SEL0 | TIMER_16BIT | TIMER_RATEGEN); - outport_byte(TIMER_CNTR0, 0); - outport_byte(TIMER_CNTR0, 0); - } -} /* Clock_exit */ - - -/*-------------------------------------------------------------------------+ -| Function: Install_clock -| Description: Initialize and install clock interrupt handler. -| Global Variables: None. -| Arguments: None. -| Returns: Nothing. -+--------------------------------------------------------------------------*/ -static void clockOn(const rtems_irq_connect_data* unused) -{ - rtems_unsigned32 microseconds_per_isr; - -#if 0 - /* Initialize clock from on-board real time clock. This breaks the */ - /* test code which assumes which assumes the application will do it. */ - { - rtems_time_of_day now; - - /* External Prototypes */ - extern void init_rtc(void); /* defined in 'rtc.c' */ - extern long rtc_read(rtems_time_of_day *); /* defined in 'rtc.c' */ - - init_rtc(); - if (rtc_read(&now) >= 0) - clock_set(&now); - } -#endif /* 0 */ - - /* Start by assuming hardware counter is large enough, then scale it until - it actually fits. */ - - Clock_driver_ticks = 0; - Clock_isrs_per_tick = 1; - - if (BSP_Configuration.microseconds_per_tick == 0) - microseconds_per_isr = 10000; /* default 10 ms */ - else - microseconds_per_isr = BSP_Configuration.microseconds_per_tick; - while (US_TO_TICK(microseconds_per_isr) > 65535) - { - Clock_isrs_per_tick *= 10; - microseconds_per_isr /= 10; - } - - Clock_isrs = Clock_isrs_per_tick; /* Initialize Clock_isrs */ - - if (BSP_Configuration.ticks_per_timeslice) - { - /* 105/88 approximates TIMER_TICK * 1e-6 */ - rtems_unsigned32 count = US_TO_TICK(microseconds_per_isr); - - outport_byte(TIMER_MODE, TIMER_SEL0|TIMER_16BIT|TIMER_RATEGEN); - outport_byte(TIMER_CNTR0, count >> 0 & 0xff); - outport_byte(TIMER_CNTR0, count >> 8 & 0xff); - } - -} - -int clockIsOn(const rtems_irq_connect_data* unused) -{ - return ((i8259s_cache & 0x1) == 0); -} - -static rtems_irq_connect_data clockIrqData = {BSP_PERIODIC_TIMER, - clockIsr, - clockOn, - clockOff, - clockIsOn}; - - - -/*-------------------------------------------------------------------------+ -| Clock device driver INITIALIZE entry point. -+--------------------------------------------------------------------------+ -| Initilizes the clock driver. -+--------------------------------------------------------------------------*/ -rtems_device_driver -Clock_initialize(rtems_device_major_number major, - rtems_device_minor_number minor, - void *pargp) -{ - - if (!BSP_install_rtems_irq_handler (&clockIrqData)) { - printk("Unable to initialize system clock\n"); - rtems_fatal_error_occurred(1); - } - /* make major/minor avail to others such as shared memory driver */ - - rtems_clock_major = major; - rtems_clock_minor = minor; - - return RTEMS_SUCCESSFUL; -} /* Clock_initialize */ - - -/*-------------------------------------------------------------------------+ -| Console device driver CONTROL entry point -+--------------------------------------------------------------------------*/ -rtems_device_driver -Clock_control(rtems_device_major_number major, - rtems_device_minor_number minor, - void *pargp) -{ - if (pargp != NULL) - { - rtems_libio_ioctl_args_t *args = pargp; - - /*-------------------------------------------------------------------------+ - | This is hokey, but until we get a defined interface to do this, it will - | just be this simple... - +-------------------------------------------------------------------------*/ - - if (args->command == rtems_build_name('I', 'S', 'R', ' ')) - clockIsr(); - else if (args->command == rtems_build_name('N', 'E', 'W', ' ')) - { - if (!BSP_install_rtems_irq_handler (&clockIrqData)) { - printk("Error installing clock interrupt handler!\n"); - rtems_fatal_error_occurred(1); - } - } - } - - return RTEMS_SUCCESSFUL; -} /* Clock_control */ - -void Clock_exit() -{ - BSP_remove_rtems_irq_handler (&clockIrqData); -} - -/*-------------------------------------------------------------------------+ -| PLEASE NOTE: The following is directly transcribed from the go32 BSP for -| those who wish to use it with PENTIUM based machine. It needs -| to be correctly integrated with the rest of the code!!! -+--------------------------------------------------------------------------*/ - - -#if 0 && defined(pentium) - -/* This can be used to get extremely accurate timing on a pentium. */ -/* It isn't supported. [bryce] */ - -#define HZ 90.0 - -volatile long long Last_RDTSC; - -#define RDTSC()\ - ({ long long _now; __asm __volatile (".byte 0x0F,0x31":"=A"(_now)); _now; }) - -long long Kernel_Time_ns( void ) -{ - extern rtems_unsigned32 _TOD_Ticks_per_second; - - unsigned isrs_per_second = Clock_isrs_per_tick * _TOD_Ticks_per_second; - long long now; - int flags; - - disable_intr(flags); - now = 1e9 * Clock_driver_ticks / isrs_per_second + - (RDTSC() - Last_RDTSC) * (1000.0/HZ); - enable_intr(flags); - return now; -} /* Kernel_Time_ns */ - -#endif /* 0 && pentium */ diff --git a/c/src/lib/libbsp/i386/pc386/clock/rtc.c b/c/src/lib/libbsp/i386/pc386/clock/rtc.c deleted file mode 100644 index 14a20e5f3f..0000000000 --- a/c/src/lib/libbsp/i386/pc386/clock/rtc.c +++ /dev/null @@ -1,226 +0,0 @@ -/*-------------------------------------------------------------------------+ -| rtc.c v1.1 - PC386 BSP - 1997/08/07 -+--------------------------------------------------------------------------+ -| This file contains the real time clock manipulation package for the -| PC386 board. -+--------------------------------------------------------------------------+ -| (C) Copyright 1997 - -| - NavIST Group - Real-Time Distributed Systems and Industrial Automation -| -| http://pandora.ist.utl.pt -| -| Instituto Superior Tecnico * Lisboa * PORTUGAL -+--------------------------------------------------------------------------+ -| Disclaimer: -| -| This file is provided "AS IS" without warranty of any kind, either -| expressed or implied. -+--------------------------------------------------------------------------+ -| This code is based on: -| rtc.c,v 1.4 1995/12/19 20:07:15 joel Exp - go32 BSP -| With the following copyright notice: -| ************************************************************************** -| * COPYRIGHT (c) 1989-1998. -| * On-Line Applications Research Corporation (OAR). -| * Copyright assigned to U.S. Government, 1994. -| * -| * The license and distribution terms for this file may be -| * found in found in the file LICENSE in this distribution or at -| * http://www.OARcorp.com/rtems/license.html. -| ************************************************************************** -| -| $Id$ -+--------------------------------------------------------------------------*/ - - -#include <string.h> - -#include <bsp.h> - -/*-------------------------------------------------------------------------+ -| Constants -+--------------------------------------------------------------------------*/ -#define IO_RTC 0x70 /* RTC */ - -#define RTC_SEC 0x00 /* seconds */ -#define RTC_SECALRM 0x01 /* seconds alarm */ -#define RTC_MIN 0x02 /* minutes */ -#define RTC_MINALRM 0x03 /* minutes alarm */ -#define RTC_HRS 0x04 /* hours */ -#define RTC_HRSALRM 0x05 /* hours alarm */ -#define RTC_WDAY 0x06 /* week day */ -#define RTC_DAY 0x07 /* day of month */ -#define RTC_MONTH 0x08 /* month of year */ -#define RTC_YEAR 0x09 /* month of year */ -#define RTC_STATUSA 0x0a /* status register A */ -#define RTCSA_TUP 0x80 /* time update, don't look now */ - -#define RTC_STATUSB 0x0b /* status register B */ - -#define RTC_INTR 0x0c /* status register C (R) interrupt source */ -#define RTCIR_UPDATE 0x10 /* update intr */ -#define RTCIR_ALARM 0x20 /* alarm intr */ -#define RTCIR_PERIOD 0x40 /* periodic intr */ -#define RTCIR_INT 0x80 /* interrupt output signal */ - -#define RTC_STATUSD 0x0d /* status register D (R) Lost Power */ -#define RTCSD_PWR 0x80 /* clock lost power */ - -#define RTC_DIAG 0x0e /* status register E - bios diagnostic */ -#define RTCDG_BITS "\020\010clock_battery\007ROM_cksum\006config_unit\005memory_size\004fixed_disk\003invalid_time" - -#define RTC_CENTURY 0x32 /* current century - increment in Dec99 */ - - -/*-------------------------------------------------------------------------+ -| Auxiliary Functions -+--------------------------------------------------------------------------*/ -/*-------------------------------------------------------------------------+ -| Function: bcd -| Description: Convert 2 digit number to its BCD representation. -| Global Variables: None. -| Arguments: i - Number to convert. -| Returns: BCD representation of number. -+--------------------------------------------------------------------------*/ -static inline rtems_unsigned8 -bcd(rtems_unsigned8 i) -{ - return ((i / 16) * 10 + (i % 16)); -} /* bcd */ - -#define QUICK_READ /* Quick read of the RTC: don't return number of seconds. */ - -#ifndef QUICK_READ - -#define SECS_PER_DAY (24 * 60 * 60) -#define SECS_PER_REG_YEAR (365 * SECS_PER_DAY) - -/*-------------------------------------------------------------------------+ -| Function: ytos -| Description: Convert years to seconds (since 1970). -| Global Variables: None. -| Arguments: y - year to convert (1970 <= y <= 2100). -| Returns: number of seconds since 1970. -+--------------------------------------------------------------------------*/ -static inline rtems_unsigned32 -ytos(rtems_unsigned16 y) -{ /* v NUM LEAP YEARS v */ - return ((y - 1970) * SECS_PER_REG_YEAR + (y - 1970 + 1) / 4 * SECS_PER_DAY); -} /* ytos */ - - -/*-------------------------------------------------------------------------+ -| Function: mtos -| Description: Convert months to seconds since January. -| Global Variables: None. -| Arguments: m - month to convert, leap - is this a month of a leap year. -| Returns: number of seconds since January. -+--------------------------------------------------------------------------*/ -static inline rtems_unsigned32 -mtos(rtems_unsigned8 m, rtems_boolean leap) -{ - static rtems_unsigned16 daysMonth[] = { 0, 0, 31, 59, 90, 120, 151, 181, - 212, 243, 273, 304, 334, 365 }; - /* Days since beginning of year until beginning of month. */ - - return ((daysMonth[m] + (leap ? 1 : 0)) * SECS_PER_DAY); -} /* mtos */ - -#endif /* QUICK_READ */ - -/*-------------------------------------------------------------------------+ -| Function: rtcin -| Description: Perform action on RTC and return its result. -| Global Variables: None. -| Arguments: what - what to write to RTC port (what to do). -| Returns: result received from RTC port after action performed. -+--------------------------------------------------------------------------*/ -static inline rtems_unsigned8 -rtcin(rtems_unsigned8 what) -{ - rtems_unsigned8 r; - - outport_byte(IO_RTC, what); - inport_byte (IO_RTC+1, r); - return r; -} /* rtcin */ - - -/*-------------------------------------------------------------------------+ -| Functions -+--------------------------------------------------------------------------*/ -/*-------------------------------------------------------------------------+ -| Function: init_rtc -| Description: Initialize real-time clock (RTC). -| Global Variables: None. -| Arguments: None. -| Returns: Nothing. -+--------------------------------------------------------------------------*/ -void -init_rtc(void) -{ - rtems_unsigned8 s; - - /* initialize brain-dead battery powered clock */ - outport_byte(IO_RTC, RTC_STATUSA); - outport_byte(IO_RTC+1, 0x26); - outport_byte(IO_RTC, RTC_STATUSB); - outport_byte(IO_RTC+1, 2); - - outport_byte(IO_RTC, RTC_DIAG); - inport_byte (IO_RTC+1, s); - if (s) - printk("RTC BIOS diagnostic error %b\n", s); - - /* FIXME: This was last line's original version. How was it supposed to work? - printf("RTC BIOS diagnostic error %b\n", s, RTCDG_BITS); */ -} /* init_rtc */ - - -/*-------------------------------------------------------------------------+ -| Function: rtc_read -| Description: Read present time from RTC and return it. -| Global Variables: None. -| Arguments: tod - to return present time in 'rtems_time_of_day' format. -| Returns: number of seconds from 1970/01/01 corresponding to 'tod'. -+--------------------------------------------------------------------------*/ -long int -rtc_read(rtems_time_of_day *tod) -{ - rtems_unsigned8 sa; - rtems_unsigned32 sec = 0; - - memset(tod, 0, sizeof *tod); /* zero tod structure */ - - /* do we have a realtime clock present? (otherwise we loop below) */ - sa = rtcin(RTC_STATUSA); - if (sa == 0xff || sa == 0) - return -1; - - /* ready for a read? */ - while ((sa&RTCSA_TUP) == RTCSA_TUP) - sa = rtcin(RTC_STATUSA); - - tod->year = bcd(rtcin(RTC_YEAR)) + 1900; /* year */ - if (tod->year < 1970) tod->year += 100; - tod->month = bcd(rtcin(RTC_MONTH)); /* month */ - tod->day = bcd(rtcin(RTC_DAY)); /* day */ - (void) bcd(rtcin(RTC_WDAY)); /* weekday */ - tod->hour = bcd(rtcin(RTC_HRS)); /* hour */ - tod->minute = bcd(rtcin(RTC_MIN)); /* minutes */ - tod->second = bcd(rtcin(RTC_SEC)); /* seconds */ - tod->ticks = 0; - -#ifndef QUICK_READ /* Quick read of the RTC: don't return number of seconds. */ - sec = ytos(tod->year); - sec += mtos(tod->month, (tod->year % 4) == 0); - sec += tod->day * SECS_PER_DAY; - sec += tod->hour * 60 * 60; /* hour */ - sec += tod->minute * 60; /* minutes */ - sec += tod->second; /* seconds */ -#endif /* QUICK_READ */ - - return (long int)sec; -} /* rtc_read */ - - diff --git a/c/src/lib/libbsp/i386/pc386/console/Makefile.in b/c/src/lib/libbsp/i386/pc386/console/Makefile.in deleted file mode 100644 index fa09ab4c80..0000000000 --- a/c/src/lib/libbsp/i386/pc386/console/Makefile.in +++ /dev/null @@ -1,59 +0,0 @@ -# -# $Id$ -# - -@SET_MAKE@ -srcdir = @srcdir@ -VPATH = @srcdir@:@srcdir@/../../shared/io -RTEMS_ROOT = @top_srcdir@ -PROJECT_ROOT = @PROJECT_ROOT@ - -PGM=${ARCH}/console.rel - -# C source names, if any, go here -- minus the .c -C_PIECES=console inch outch printk -C_FILES=$(C_PIECES:%=%.c) -C_O_FILES=$(C_PIECES:%=${ARCH}/%.o) - -H_FILES= - -# Assembly source names, if any, go here -- minus the .s -S_PIECES=videoAsm -S_FILES=$(S_PIECES:%=%.s) -S_O_FILES=$(S_FILES:%.s=${ARCH}/%.o) - -SRCS=$(C_FILES) $(H_FILES) -OBJS=$(C_O_FILES) $(S_O_FILES) - -include $(RTEMS_ROOT)/make/custom/$(RTEMS_BSP).cfg -include $(RTEMS_ROOT)/make/leaf.cfg - -# -# (OPTIONAL) Add local stuff here using += -# - -DEFINES += -CPPFLAGS += -CFLAGS += - -LD_PATHS += -LD_LIBS += -LDFLAGS += - -# -# Add your list of files to delete here. The config files -# already know how to delete some stuff, so you may want -# to just run 'make clean' first to see what gets missed. -# 'make clobber' already includes 'make clean' -# - -CLEAN_ADDITIONS += -CLOBBER_ADDITIONS += - -${PGM}: ${SRCS} ${OBJS} - $(make-rel) - -all: ${ARCH} $(SRCS) $(PGM) - -# the .rel file built here will be put into libbsp.a by ../wrapup/Makefile -install: all diff --git a/c/src/lib/libbsp/i386/pc386/console/console.c b/c/src/lib/libbsp/i386/pc386/console/console.c deleted file mode 100644 index 7a07a6ca3f..0000000000 --- a/c/src/lib/libbsp/i386/pc386/console/console.c +++ /dev/null @@ -1,507 +0,0 @@ -/*-------------------------------------------------------------------------+ -| console.c v1.1 - PC386 BSP - 1997/08/07 -+--------------------------------------------------------------------------+ -| This file contains the PC386 console I/O package. -+--------------------------------------------------------------------------+ -| (C) Copyright 1997 - -| - NavIST Group - Real-Time Distributed Systems and Industrial Automation -| -| http://pandora.ist.utl.pt -| -| Instituto Superior Tecnico * Lisboa * PORTUGAL -+--------------------------------------------------------------------------+ -| Disclaimer: -| -| This file is provided "AS IS" without warranty of any kind, either -| expressed or implied. -+--------------------------------------------------------------------------+ -| This code is based on: -| console.c,v 1.4 1995/12/19 20:07:23 joel Exp - go32 BSP -| With the following copyright notice: -| ************************************************************************** -| * COPYRIGHT (c) 1989-1998. -| * On-Line Applications Research Corporation (OAR). -| * Copyright assigned to U.S. Government, 1994. -| * -| * The license and distribution terms for this file may be -| * found in found in the file LICENSE in this distribution or at -| * http://www.OARcorp.com/rtems/license.html. -| ************************************************************************** -| -| $Id$ -+--------------------------------------------------------------------------*/ - -#include <stdio.h> -#include <stdlib.h> -#include <assert.h> -#undef __assert -void __assert (const char *file, int line, const char *msg); - -#include <bsp.h> -#include <irq.h> -#include <rtems/libio.h> -#include <termios.h> -#include <uart.h> -#include <libcpu/cpuModel.h> - -/* - * Possible value for console input/output : - * BSP_CONSOLE_PORT_CONSOLE - * BSP_UART_COM1 - * BSP_UART_COM2 - */ - -/* - * Possible value for console input/output : - * BSP_CONSOLE_PORT_CONSOLE - * BSP_UART_COM1 - * BSP_UART_COM2 - */ - -int BSPConsolePort = BSP_CONSOLE_PORT_CONSOLE; - -/* int BSPConsolePort = BSP_UART_COM2; */ -int BSPBaseBaud = 115200; - -extern BSP_polling_getchar_function_type BSP_poll_char; - -/*-------------------------------------------------------------------------+ -| External Prototypes -+--------------------------------------------------------------------------*/ -extern void _IBMPC_keyboard_isr(void); -extern rtems_boolean _IBMPC_scankey(char *); /* defined in 'inch.c' */ -extern char BSP_wait_polled_input(void); -extern void _IBMPC_initVideo(void); - -static int conSetAttr(int minor, const struct termios *); -static void isr_on(const rtems_irq_connect_data *); -static void isr_off(const rtems_irq_connect_data *); -static int isr_is_on(const rtems_irq_connect_data *); - - -static rtems_irq_connect_data console_isr_data = {BSP_KEYBOARD, - _IBMPC_keyboard_isr, - isr_on, - isr_off, - isr_is_on}; - -static void -isr_on(const rtems_irq_connect_data *unused) -{ - return; -} - -static void -isr_off(const rtems_irq_connect_data *unused) -{ - return; -} - -static int -isr_is_on(const rtems_irq_connect_data *irq) -{ - return BSP_irq_enabled_at_i8259s(irq->name); -} - -void console_reserve_resources(rtems_configuration_table *conf) -{ - if(BSPConsolePort != BSP_CONSOLE_PORT_CONSOLE) - { - rtems_termios_reserve_resources(conf, 1); - } - - return; -} - -void __assert (const char *file, int line, const char *msg) -{ - static char exit_msg[] = "EXECUTIVE SHUTDOWN! Any key to reboot..."; - unsigned char ch; - - /* - * Note we cannot call exit or printf from here, - * assert can fail inside ISR too - */ - - /* - * Close console - */ - __rtems_close(2); - __rtems_close(1); - __rtems_close(0); - - printk("\nassert failed: %s: ", file); - printk("%d: ", line); - printk("%s\n\n", msg); - printk(exit_msg); - ch = BSP_poll_char(); - printk("\n\n"); - rtemsReboot(); - -} - - -/*-------------------------------------------------------------------------+ -| 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; - - /* - * The video was initialized in the start.s code and does not need - * to be reinitialized. - */ - - - if(BSPConsolePort == BSP_CONSOLE_PORT_CONSOLE) - { - /* Install keyboard interrupt handler */ - status = BSP_install_rtems_irq_handler(&console_isr_data); - - if (!status) - { - printk("Error installing keyboard interrupt handler!\n"); - rtems_fatal_error_occurred(status); - } - - status = rtems_io_register_name("/dev/console", major, 0); - if (status != RTEMS_SUCCESSFUL) - { - printk("Error registering console device!\n"); - rtems_fatal_error_occurred(status); - } - printk("Initialized console on port CONSOLE\n\n"); - } - else - { - /* - * Set up TERMIOS - */ - rtems_termios_initialize (); - - /* - * Do device-specific initialization - */ - - /* 9600-8-N-1 */ - BSP_uart_init(BSPConsolePort, 9600, 0); - - - /* Set interrupt handler */ - if(BSPConsolePort == BSP_UART_COM1) - { - console_isr_data.name = BSP_UART_COM1_IRQ; - console_isr_data.hdl = BSP_uart_termios_isr_com1; - - } - else - { - assert(BSPConsolePort == BSP_UART_COM2); - console_isr_data.name = BSP_UART_COM2_IRQ; - console_isr_data.hdl = BSP_uart_termios_isr_com2; - } - - status = BSP_install_rtems_irq_handler(&console_isr_data); - - if (!status){ - printk("Error installing serial console interrupt handler!\n"); - rtems_fatal_error_occurred(status); - } - /* - * 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); - } - - if(BSPConsolePort == BSP_UART_COM1) - { - printk("Initialized console on port COM1 9600-8-N-1\n\n"); - } - else - { - printk("Initialized console on port COM2 9600-8-N-1\n\n"); - } -#define PRINTK_ON_SERIAL -#ifdef PRINTK_ON_SERIAL - /* - * You can remove the follwoing tree lines if you want to have printk - * using the video console for output while printf use serial line. - * This may be convenient to debug the serial line driver itself... - */ - /* printk("Warning : This will be the last message displayed on console\n");*/ - BSP_output_char = (BSP_output_char_function_type) BSP_output_char_via_serial; - BSP_poll_char = (BSP_polling_getchar_function_type) BSP_poll_char_via_serial; -#endif - } - return RTEMS_SUCCESSFUL; -} /* console_initialize */ - - -static int console_open_count = 0; - -static int console_last_close(int major, int minor, void *arg) -{ - BSP_remove_rtems_irq_handler (&console_isr_data); - - return 0; -} - -/*-------------------------------------------------------------------------+ -| 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 */ - console_last_close, /* lastClose */ - NULL, /* pollRead */ - BSP_uart_termios_write_com1, /* write */ - conSetAttr, /* setAttributes */ - NULL, /* stopRemoteTx */ - NULL, /* startRemoteTx */ - 1 /* outputUsesInterrupts */ - }; - - if(BSPConsolePort == BSP_CONSOLE_PORT_CONSOLE) - { - ++console_open_count; - return RTEMS_SUCCESSFUL; - } - - if(BSPConsolePort == BSP_UART_COM2) - { - cb.write = BSP_uart_termios_write_com2; - } - - status = rtems_termios_open (major, minor, arg, &cb); - - if(status != RTEMS_SUCCESSFUL) - { - printk("Error openning console device\n"); - return status; - } - - /* - * Pass data area info down to driver - */ - BSP_uart_termios_set(BSPConsolePort, - ((rtems_libio_open_close_args_t *)arg)->iop->data1); - - /* Enable interrupts on channel */ - BSP_uart_intr_ctrl(BSPConsolePort, BSP_UART_INTR_CTRL_TERMIOS); - - 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; - - if(BSPConsolePort != BSP_CONSOLE_PORT_CONSOLE) - { - res = rtems_termios_close (arg); - } - else { - if (--console_open_count == 0) { - console_last_close(major, minor, arg); - } - } - - return res; -} /* console_close */ - - -/*-------------------------------------------------------------------------+ -| 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) -{ - rtems_libio_rw_args_t *rw_args = (rtems_libio_rw_args_t *)arg; - char *buffer = rw_args->buffer; - int count, maximum = rw_args->count; - - if(BSPConsolePort != BSP_CONSOLE_PORT_CONSOLE) - { - return rtems_termios_read (arg); - } - - for (count = 0; count < maximum; count++) - { - /* Get character */ - buffer[count] = _IBMPC_inch_sleep(); - - /* Echo character to screen */ - _IBMPC_outch(buffer[count]); - if (buffer[count] == '\r') - { - _IBMPC_outch('\n'); /* CR = CR + LF */ - } - - if (buffer[count] == '\n' || buffer[count] == '\r') - { - /* What if this goes past the end of the buffer? We're hosed. [bhc] */ - buffer[count++] = '\n'; - buffer[count] = '\0'; - break; - } - } - - rw_args->bytes_moved = count; - return ((count >= 0) ? RTEMS_SUCCESSFUL : RTEMS_UNSATISFIED); -} /* console_read */ - - -/*-------------------------------------------------------------------------+ -| 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) -{ - rtems_libio_rw_args_t *rw_args = (rtems_libio_rw_args_t *)arg; - char *buffer = rw_args->buffer; - int count, maximum = rw_args->count; - - if(BSPConsolePort != BSP_CONSOLE_PORT_CONSOLE) - { - return rtems_termios_write (arg); - } - - for (count = 0; count < maximum; count++) - { - _IBMPC_outch(buffer[count]); - if (buffer[count] == '\n') - _IBMPC_outch('\r'); /* LF = LF + CR */ - } - - rw_args->bytes_moved = maximum; - return RTEMS_SUCCESSFUL; -} /* console_write */ - - - -/* - * Handle ioctl request. - */ -rtems_device_driver -console_control(rtems_device_major_number major, - rtems_device_minor_number minor, - void * arg -) -{ - if(BSPConsolePort != BSP_CONSOLE_PORT_CONSOLE) - { - return rtems_termios_ioctl (arg); - } - - return RTEMS_SUCCESSFUL; -} - -static int -conSetAttr(int minor, const struct termios *t) -{ - int baud; - - switch (t->c_cflag & CBAUD) - { - case B50: - baud = 50; - break; - case B75: - baud = 75; - break; - case B110: - baud = 110; - break; - case B134: - baud = 134; - break; - case B150: - baud = 150; - break; - case B200: - baud = 200; - break; - case B300: - baud = 300; - break; - case B600: - baud = 600; - break; - case B1200: - baud = 1200; - break; - case B1800: - baud = 1800; - break; - case B2400: - baud = 2400; - break; - case B4800: - baud = 4800; - break; - case B9600: - baud = 9600; - break; - case B19200: - baud = 19200; - break; - case B38400: - baud = 38400; - break; - case B57600: - baud = 57600; - break; - case B115200: - baud = 115200; - break; - default: - baud = 0; - rtems_fatal_error_occurred (RTEMS_INTERNAL_ERROR); - return 0; - } - - BSP_uart_set_baud(BSPConsolePort, baud); - - return 0; -} - -/* - * BSP initialization - */ - -BSP_output_char_function_type BSP_output_char = - (BSP_output_char_function_type) _IBMPC_outch; - -BSP_polling_getchar_function_type BSP_poll_char = BSP_wait_polled_input; - - diff --git a/c/src/lib/libbsp/i386/pc386/console/inch.c b/c/src/lib/libbsp/i386/pc386/console/inch.c deleted file mode 100644 index 6783e79ba0..0000000000 --- a/c/src/lib/libbsp/i386/pc386/console/inch.c +++ /dev/null @@ -1,333 +0,0 @@ -/*-------------------------------------------------------------------------+ -| inch.c v1.1 - PC386 BSP - 1997/08/07 -+--------------------------------------------------------------------------+ -| (C) Copyright 1997 - -| - NavIST Group - Real-Time Distributed Systems and Industrial Automation -| -| http://pandora.ist.utl.pt -| -| Instituto Superior Tecnico * Lisboa * PORTUGAL -+--------------------------------------------------------------------------+ -| Disclaimer: -| -| This file is provided "AS IS" without warranty of any kind, either -| expressed or implied. -+--------------------------------------------------------------------------+ -| This code is based on: -| inch.c,v 1.3 1995/12/19 20:07:25 joel Exp - go32 BSP -| With the following copyright notice: -| With the following copyright notice: -| ************************************************************************** -| * COPYRIGHT (c) 1989-1998. -| * On-Line Applications Research Corporation (OAR). -| * Copyright assigned to U.S. Government, 1994. -| * -| * The license and distribution terms for this file may be -| * found in found in the file LICENSE in this distribution or at -| * http://www.OARcorp.com/rtems/license.html. -| ************************************************************************** -| -| $Id$ -+--------------------------------------------------------------------------*/ - -#include <bsp.h> -#include <irq.h> - -/*-------------------------------------------------------------------------+ -| Constants -+--------------------------------------------------------------------------*/ -#define KBD_CTL 0x61 /* -------------------------------- */ -#define KBD_DATA 0x60 /* Ports for PC keyboard controller */ -#define KBD_STATUS 0x64 /* -------------------------------- */ - -#define KBD_BUF_SIZE 256 - -/*-------------------------------------------------------------------------+ -| Global Variables -+--------------------------------------------------------------------------*/ -static char key_map[] = -{ - 0,033,'1','2','3','4','5','6','7','8','9','0','-','=','\b','\t', - 'q','w','e','r','t','y','u','i','o','p','[',']',015,0x80, - 'a','s','d','f','g','h','j','k','l',';',047,0140,0x80, - 0134,'z','x','c','v','b','n','m',',','.','/',0x80, - '*',0x80,' ',0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, - 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, - 0x80,0x80,0x80,'0',0177 -}; /* Keyboard scancode -> character map with no modifiers. */ - -static char shift_map[] = -{ - 0,033,'!','@','#','$','%','^','&','*','(',')','_','+','\b','\t', - 'Q','W','E','R','T','Y','U','I','O','P','{','}',015,0x80, - 'A','S','D','F','G','H','J','K','L',':',042,'~',0x80, - '|','Z','X','C','V','B','N','M','<','>','?',0x80, - '*',0x80,' ',0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, - 0x80,0x80,0x80,0x80,'7','8','9',0x80,'4','5','6',0x80, - '1','2','3','0',177 -}; /* Keyboard scancode -> character map with SHIFT key modifier. */ - -static char kbd_buffer[KBD_BUF_SIZE]; -static rtems_unsigned16 kbd_first = 0; -static rtems_unsigned16 kbd_last = 0; -static rtems_unsigned16 kbd_end = KBD_BUF_SIZE - 1; - -/*-------------------------------------------------------------------------+ -| Function: rtemsReboot -| Description: Reboot the PC. -| Global Variables: None. -| Arguments: None. -| Returns: Nothing. -+--------------------------------------------------------------------------*/ -void rtemsReboot(void) -{ - /* shutdown and reboot */ - outport_byte(0x64, 0xFE); /* use keyboard controler to do the job... */ -} /* rtemsReboot */ - -/*-------------------------------------------------------------------------+ -| Function: _IBMPC_scankey -| Description: This function can be called during a poll for input, or by -| an ISR. Basically any time you want to process a keypress. -| Global Variables: key_map, shift_map. -| Arguments: outChar - character read in case of a valid reading, -| otherwise unchanged. -| Returns: TRUE in case a valid character has been read, -| FALSE otherwise. -+--------------------------------------------------------------------------*/ -rtems_boolean -_IBMPC_scankey(char *outChar) -{ - unsigned char inChar; - static int alt_pressed = 0; - static int ctrl_pressed = 0; - static int shift_pressed = 0; - static int caps_pressed = 0; - static int extended = 0; - - *outChar = NULL; /* default value if we return FALSE */ - - /* Read keyboard controller, toggle enable */ - inport_byte(KBD_CTL, inChar); - outport_byte(KBD_CTL, inChar & ~0x80); - outport_byte(KBD_CTL, inChar | 0x80); - outport_byte(KBD_CTL, inChar & ~0x80); - - /* See if it has data */ - inport_byte(KBD_STATUS, inChar); - if ((inChar & 0x01) == 0) - return FALSE; - - /* Read the data. Handle nonsense with shift, control, etc. */ - inport_byte(KBD_DATA, inChar); - - if (extended) - extended--; - - switch (inChar) - { - case 0xe0: - extended = 2; - return FALSE; - break; - - case 0x38: - alt_pressed = 1; - return FALSE; - break; - case 0xb8: - alt_pressed = 0; - return FALSE; - break; - - case 0x1d: - ctrl_pressed = 1; - return FALSE; - break; - case 0x9d: - ctrl_pressed = 0; - return FALSE; - break; - - case 0x2a: - if (extended) - return FALSE; - case 0x36: - shift_pressed = 1; - return FALSE; - break; - case 0xaa: - if (extended) - return FALSE; - case 0xb6: - shift_pressed = 0; - return FALSE; - break; - - case 0x3a: - caps_pressed = 1; - return FALSE; - break; - case 0xba: - caps_pressed = 0; - return FALSE; - break; - - case 0x53: - if (ctrl_pressed && alt_pressed) - rtemsReboot(); /* ctrl+alt+del -> reboot */ - break; - - /* - * Ignore unrecognized keys--usually arrow and such - */ - default: - if ((inChar & 0x80) || (inChar > 0x39)) - /* High-bit on means key is being released, not pressed */ - return FALSE; - break; - } /* switch */ - - /* Strip high bit, look up in our map */ - inChar &= 0x7f; - if (ctrl_pressed) - { - *outChar = key_map[inChar]; - *outChar &= 037; - } - else - { - *outChar = shift_pressed ? shift_map[inChar] : key_map[inChar]; - if (caps_pressed) - { - if (*outChar >= 'A' && *outChar <= 'Z') - *outChar += 'a' - 'A'; - else if (*outChar >= 'a' && *outChar <= 'z') - *outChar -= 'a' - 'A'; - } - } - - return TRUE; -} /* _IBMPC_scankey */ - -/*-------------------------------------------------------------------------+ -| Function: _IBMPC_keyboard_isr -| Description: Interrupt Service Routine for keyboard (0x01) IRQ. -| Global Variables: kbd_buffer, kbd_first, kbd_last. -| Arguments: vector - standard RTEMS argument - see documentation. -| Returns: standard return value - see documentation. -+--------------------------------------------------------------------------*/ -void _IBMPC_keyboard_isr() -{ - if (_IBMPC_scankey(&kbd_buffer[kbd_last])) - { - /* Got one; save it if there is enough room in buffer. */ - unsigned int next = (kbd_last == kbd_end) ? 0 : kbd_last + 1; - - if (next != kbd_first) - { - kbd_last = next; - } - } -} /* _IBMPC_keyboard_isr */ - - -/*-------------------------------------------------------------------------+ -| Function: _IBMPC_chrdy -| Description: Check keyboard ISR buffer and return character if not empty. -| Global Variables: kbd_buffer, kbd_first, kbd_last. -| Arguments: c - character read if keyboard buffer not empty, otherwise -| unchanged. -| Returns: TRUE if keyboard buffer not empty, FALSE otherwise. -+--------------------------------------------------------------------------*/ -rtems_boolean -_IBMPC_chrdy(char *c) -{ - /* FIX ME!!! It doesn't work without something like the following line. - Find out why! */ - printk(""); - - /* Check buffer our ISR builds */ - if (kbd_first != kbd_last) - { - *c = kbd_buffer[kbd_first]; - - kbd_first = (kbd_first + 1) % KBD_BUF_SIZE; - return TRUE; - } - else - return FALSE; -} /* _IBMPC_chrdy */ - - -/*-------------------------------------------------------------------------+ -| Function: _IBMPC_inch -| Description: Poll keyboard until a character is ready and return it. -| Global Variables: None. -| Arguments: None. -| Returns: character read from keyboard. -+--------------------------------------------------------------------------*/ -char -_IBMPC_inch(void) -{ - char c; - while (!_IBMPC_chrdy(&c)) - continue; - - return c; -} /* _IBMPC_inch */ - - - /* - * Routine that can be used before interrupt management is initialized. - */ - -char -BSP_wait_polled_input(void) -{ - char c; - while (!_IBMPC_scankey(&c)) - continue; - - return c; -} - -/*-------------------------------------------------------------------------+ -| Function: _IBMPC_inch_sleep -| Description: If charcter is ready return it, otherwise sleep until -| it is ready -| Global Variables: None. -| Arguments: None. -| Returns: character read from keyboard. -+--------------------------------------------------------------------------*/ -char -_IBMPC_inch_sleep(void) -{ - char c; - rtems_interval ticks_per_second; - - ticks_per_second = 0; - - for(;;) - { - if(_IBMPC_chrdy(&c)) - { - return c; - } - - if(ticks_per_second == 0) - { - rtems_clock_get(RTEMS_CLOCK_GET_TICKS_PER_SECOND, - &ticks_per_second); - } - rtems_task_wake_after((ticks_per_second+24)/25); - } - - return c; -} /* _IBMPC_inch */ - - - - - - diff --git a/c/src/lib/libbsp/i386/pc386/console/outch.c b/c/src/lib/libbsp/i386/pc386/console/outch.c deleted file mode 100644 index 1d5c1f9c38..0000000000 --- a/c/src/lib/libbsp/i386/pc386/console/outch.c +++ /dev/null @@ -1,181 +0,0 @@ -/* - * outch.c - This file contains code for displaying characters - * on the console uisng information that should be - * maintained by the BIOS in its data Area. - * - * Copyright (C) 1998 Eric Valette (valette@crf.canon.fr) - * Canon Centre Recherche France. - * - * The license and distribution terms for this file may be - * found in found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - - -#include <bsp.h> - -#include <stdlib.h> -#include <string.h> - -#include <crt.h> - -extern void wr_cursor(int, unsigned short); - -#define TAB_SPACE 4 -static unsigned short *bitMapBaseAddr; -static unsigned short ioCrtBaseAddr; -static unsigned short maxCol; -static unsigned short maxRow; -static unsigned char row; -static unsigned char column; -static unsigned short attribute; -static unsigned int nLines; - -static void -scroll(void) -{ - int i, j; /* Counters */ - unsigned short *pt_scroll, *pt_bitmap; /* Pointers on the bit-map */ - - pt_bitmap = bitMapBaseAddr; - j = 0; - pt_bitmap = pt_bitmap + j; - pt_scroll = pt_bitmap + maxCol; - for (i = j; i < (maxRow - 1) * maxCol; i++) { - *pt_bitmap++ = *pt_scroll++; - } - - /* - * Blank characters are displayed on the last line. - */ - for (i = 0; i < maxCol; i++) { - *pt_bitmap++ = (short) (' ' | attribute); - } -} - -static void -endColumn(void) -{ - if (++row == maxRow) { - scroll(); /* Scroll the screen now */ - row = maxRow - 1; - } - column = 0; - nLines++; - /* Move cursor on the next location */ - wr_cursor(row * maxCol + column, ioCrtBaseAddr); -} - - - -static void -videoPutChar(char car) -{ - unsigned short *pt_bitmap = bitMapBaseAddr + row * maxCol; - - switch (car) { - case '\b': { - if (column) column--; - /* Move cursor on the previous location */ - wr_cursor(row * maxCol + column, ioCrtBaseAddr); - return; - } - case '\t': { - int i; - - i = TAB_SPACE - (column & (TAB_SPACE - 1)); - pt_bitmap += column; - column += i; - if (column >= maxCol) { - endColumn(); - return; - } - while (i--) *pt_bitmap++ = ' ' | attribute; - wr_cursor(row * maxCol + column, ioCrtBaseAddr); - return; - } - case '\n': { - endColumn(); - return; - } - case 7: { /* Bell code must be inserted here */ - return; - } - case '\r' : { /* Already handled via \n */ - return; - } - default: { - pt_bitmap += column; - *pt_bitmap = car | attribute; - if (++column == maxCol) endColumn(); - else wr_cursor(row * maxCol + column, - ioCrtBaseAddr); - return; - } - } -} - -void -clear_screen(void) -{ - int i,j; - - for (j = 0; j <= maxRow; j++) { - for (i = 0; i <= maxCol; i++) { - videoPutChar(' '); - } - } - column = 0; - row = 0; -} - -/*-------------------------------------------------------------------------+ -| Function: _IBMPC_outch -| Description: Higher level (console) interface to consPutc. -| Global Variables: None. -| Arguments: c - character to write to console. -| Returns: Nothing. -+--------------------------------------------------------------------------*/ -void -_IBMPC_outch(char c) -{ - videoPutChar(c); -} /* _IBMPC_outch */ - - -/*-------------------------------------------------------------------------+ -| Function: _IBMPC_initVideo -| Description: Video system initialization. Hook for any early setup. -| Global Variables: bitMapBaseAddr, ioCrtBaseAddr, maxCol, maxRow, row -| column, attribute, nLines; -| Arguments: None. -| Returns: Nothing. -+--------------------------------------------------------------------------*/ -void -_IBMPC_initVideo(void) -{ - unsigned char* pt = (unsigned char*) (VIDEO_MODE_ADDR); - - if (*pt == VGAMODE7) { - bitMapBaseAddr = (unsigned short*) V_MONO; - } - else { - bitMapBaseAddr = (unsigned short*) V_COLOR; - } - ioCrtBaseAddr = *(unsigned short*) DISPLAY_CRT_BASE_IO_ADDR; - maxCol = * (unsigned short*) NB_MAX_COL_ADDR; - maxRow = * (unsigned char*) NB_MAX_ROW_ADDR; - column = 0; - row = 0; - attribute = ((BLACK << 4) | WHITE)<<8; - nLines = 0; - clear_screen(); -#ifdef DEBUG_EARLY_STAGE - printk("bitMapBaseAddr = %X, display controller base IO = %X\n", - (unsigned) bitMapBaseAddr, - (unsigned) ioCrtBaseAddr); - videoPrintf("maxCol = %d, maxRow = %d\n", (unsigned) maxCol, (unsigned) maxRow); -#endif -} /* _IBMPC_initVideo */ diff --git a/c/src/lib/libbsp/i386/pc386/console/videoAsm.s b/c/src/lib/libbsp/i386/pc386/console/videoAsm.s deleted file mode 100644 index a8f5cb3156..0000000000 --- a/c/src/lib/libbsp/i386/pc386/console/videoAsm.s +++ /dev/null @@ -1,51 +0,0 @@ -/* - * videoAsm.S - This file contains code for displaying cursor on the console - * - * Copyright (C) 1998 valette@crf.canon.fr - * - * This code is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This code is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - */ - - .file "videoAsm.s" - -#include <crt.h> - - .text - .align 4 - .globl wr_cursor /* Move cursor position */ - -/* - * void wr_cursor(newPosition, ioBaseAddr) - */ - -wr_cursor: pushl %ecx - movl 8(%esp), %ecx /* Get new cursor position */ - movb $CC_CURSHIGH, %al /* Cursor high location */ - movl 12(%esp), %edx /* Get IO base address */ - outb (%dx) - incw %dx /* Program Data register */ - movb %ch, %al - outb (%dx) /* Update high location cursor */ - decw %dx /* Program Index Register */ - movb $CC_CURSLOW, %al /* Cursor low location */ - outb (%dx) - incw %dx /* Program Data Register */ - movb %cl, %al - outb (%dx) /* Update low location cursor */ - popl %ecx - ret - diff --git a/c/src/lib/libbsp/i386/pc386/include/Makefile.in b/c/src/lib/libbsp/i386/pc386/include/Makefile.in deleted file mode 100644 index d5864f9419..0000000000 --- a/c/src/lib/libbsp/i386/pc386/include/Makefile.in +++ /dev/null @@ -1,39 +0,0 @@ -# -# $Id$ -# - -@SET_MAKE@ -srcdir = @srcdir@ -VPATH = @srcdir@ -RTEMS_ROOT = @top_srcdir@ -PROJECT_ROOT = @PROJECT_ROOT@ - -# This driver needs to be reworked for the BSD stack. -# We only install wd80x3.h if HAS_NETWORKING was defined -WD80X3_yes_V = $(srcdir)/wd80x3.h -WD80X3 = $(WD80X3_$(HAS_NETWORKING)_V) - -H_FILES = $(srcdir)/bsp.h $(srcdir)/coverhd.h $(srcdir)/crt.h \ - $(WD80X3) - -# -# Equate files are for including from assembly preprocessed by -# gm4 or gasp. No examples are provided except for those for -# other CPUs. The best way to generate them would be to -# provide a program which generates the constants used based -# on the C equivalents. -# - -EQ_FILES = - -SRCS=$(H_FILES) $(EQ_FILES) - -include $(RTEMS_ROOT)/make/custom/$(RTEMS_BSP).cfg -include $(RTEMS_ROOT)/make/leaf.cfg - -CLEAN_ADDITIONS += -CLOBBER_ADDITIONS += - -all: $(SRCS) - $(INSTALL) -m 444 $(H_FILES) $(PROJECT_INCLUDE) - $(INSTALL) -m 444 $(EQ_FILES) $(PROJECT_INCLUDE) diff --git a/c/src/lib/libbsp/i386/pc386/include/bsp.h b/c/src/lib/libbsp/i386/pc386/include/bsp.h deleted file mode 100644 index fde80f9711..0000000000 --- a/c/src/lib/libbsp/i386/pc386/include/bsp.h +++ /dev/null @@ -1,195 +0,0 @@ -/*-------------------------------------------------------------------------+ -| bsp.h v1.1 - PC386 BSP - 1997/08/07 -+--------------------------------------------------------------------------+ -| This include file contains definitions related to the PC386 BSP. -+--------------------------------------------------------------------------+ -| (C) Copyright 1997 - -| - NavIST Group - Real-Time Distributed Systems and Industrial Automation -| -| http://pandora.ist.utl.pt -| -| Instituto Superior Tecnico * Lisboa * PORTUGAL -+--------------------------------------------------------------------------+ -| Modified by Eric Valette the 20/05/98 in order to add definitions used -| to enhance video putchar capabilities. -| -| Copyright (C) 1998 valette@crf.canon.fr -| -| Canon Centre Recherche France. -| -+--------------------------------------------------------------------------+ -| Disclaimer: -| -| This file is provided "AS IS" without warranty of any kind, either -| expressed or implied. -+--------------------------------------------------------------------------+ -| This code is based on: -| bsp.h,v 1.5 1995/12/19 20:07:30 joel Exp - go32 BSP -| With the following copyright notice: -| ************************************************************************** -| * COPYRIGHT (c) 1989-1998. -| * On-Line Applications Research Corporation (OAR). -| * Copyright assigned to U.S. Government, 1994. -| * -| * The license and distribution terms for this file may be -| * found in found in the file LICENSE in this distribution or at -| * http://www.OARcorp.com/rtems/license.html. -| ************************************************************************** -| -| $Id$ -+--------------------------------------------------------------------------*/ - - -#ifndef __BSP_H_ -#define __BSP_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include <rtems.h> -#include <iosupp.h> -#include <console.h> -#include <clockdrv.h> -#include <libcpu/cpu.h> -#include <bspIo.h> - -/* - * Network driver configuration - */ - -struct rtems_bsdnet_ifconfig; -extern int rtems_wd_driver_attach (struct rtems_bsdnet_ifconfig *config); - -#define RTEMS_BSP_NETWORK_DRIVER_NAME "wd1" -#define RTEMS_BSP_NETWORK_DRIVER_ATTACH rtems_wd_driver_attach - -/*-------------------------------------------------------------------------+ -| Constants -+--------------------------------------------------------------------------*/ -#define BSP_LIBIO_MAX_FDS 20 /* Number of libio files we want. */ - -/*-------------------------------------------------------------------------+ -| Video (console) related constants. -+--------------------------------------------------------------------------*/ - -#include <crt.h> - -/*-------------------------------------------------------------------------+ -| Constants relating to the 8254 (or 8253) programmable interval timers. -+--------------------------------------------------------------------------*/ -#define IO_TIMER1 0x40 - /* Port address of the control port and timer channels */ -#define TIMER_CNTR0 (IO_TIMER1 + 0) /* timer 0 counter port */ -#define TIMER_CNTR1 (IO_TIMER1 + 1) /* timer 1 counter port */ -#define TIMER_CNTR2 (IO_TIMER1 + 2) /* timer 2 counter port */ -#define TIMER_MODE (IO_TIMER1 + 3) /* timer mode port */ -#define TIMER_SEL0 0x00 /* select counter 0 */ -#define TIMER_SEL1 0x40 /* select counter 1 */ -#define TIMER_SEL2 0x80 /* select counter 2 */ -#define TIMER_INTTC 0x00 /* mode 0, intr on terminal cnt */ -#define TIMER_ONESHOT 0x02 /* mode 1, one shot */ -#define TIMER_RATEGEN 0x04 /* mode 2, rate generator */ -#define TIMER_SQWAVE 0x06 /* mode 3, square wave */ -#define TIMER_SWSTROBE 0x08 /* mode 4, s/w triggered strobe */ -#define TIMER_HWSTROBE 0x0a /* mode 5, h/w triggered strobe */ -#define TIMER_LATCH 0x00 /* latch counter for reading */ -#define TIMER_LSB 0x10 /* r/w counter LSB */ -#define TIMER_MSB 0x20 /* r/w counter MSB */ -#define TIMER_16BIT 0x30 /* r/w counter 16 bits, LSB first */ -#define TIMER_BCD 0x01 /* count in BCD */ - -#define TIMER_TICK 1193182 /* The internal tick rate in ticks per second */ - -/*-------------------------------------------------------------------------+ -| Define the time limits for RTEMS Test Suite test durations. Long test and -| short test duration limits are provided. These values are in seconds and -| need to be converted to ticks for the application. -+--------------------------------------------------------------------------*/ -#define MAX_LONG_TEST_DURATION 300 /* 5 minutes = 300 seconds */ -#define MAX_SHORT_TEST_DURATION 3 /* 3 seconds */ - -/*-------------------------------------------------------------------------+ -| Macros -+--------------------------------------------------------------------------*/ -/*-------------------------------------------------------------------------+ -| Define the interrupt mechanism for Time Test 27. -| NOTE: Use a software interrupt for the i386 family. -+--------------------------------------------------------------------------*/ -#define MUST_WAIT_FOR_INTERRUPT 0 -#define Install_tm27_vector(handler) \ -{ \ - rtems_isr_entry dummy; \ - rtems_interrupt_catch(handler, 0x90, &dummy); \ -} -#define Cause_tm27_intr() asm volatile("int $0x90" : :); -#define Clear_tm27_intr() -#define Lower_tm27_intr() - -/*-------------------------------------------------------------------------+ -| Simple spin delay in microsecond units for device drivers. -| This is very dependent on the clock speed of the target. -+--------------------------------------------------------------------------*/ -#define delay(_microseconds) \ -{ \ - rtems_unsigned32 _cnt = _microseconds; \ - asm volatile ("0: nop; mov %0,%0; loop 0b" : "=c"(_cnt) : "0"(_cnt)); \ -} - -/*-------------------------------------------------------------------------+ -| Convert microseconds to ticks and ticks to microseconds. -+--------------------------------------------------------------------------*/ -#define US_TO_TICK(us) (((us)*105+44)/88) -#define TICK_TO_US(tk) (((tk)*88+52)/105) - -/*-------------------------------------------------------------------------+ -| External Variables. -+--------------------------------------------------------------------------*/ -#define IDT_SIZE 256 -#define GDT_SIZE 3 - -extern interrupt_gate_descriptor Interrupt_descriptor_table[IDT_SIZE]; -extern segment_descriptors Global_descriptor_table [GDT_SIZE]; - -extern rtems_configuration_table BSP_Configuration; - /* User provided BSP configuration table. */ -extern rtems_unsigned32 rtemsFreeMemStart; - /* Address of start of free memory - should be used when creating new - partitions or regions and updated afterwards. */ - -/*-------------------------------------------------------------------------+ -| Function Prototypes. -+--------------------------------------------------------------------------*/ -void _IBMPC_initVideo(void); /* from 'outch.c' */ -void _IBMPC_outch (char); /* from 'outch.c' */ -rtems_boolean _IBMPC_chrdy (char *); /* from 'inch.c' */ -char _IBMPC_inch (void); /* from 'inch.c' */ -char _IBMPC_inch_sleep (void); /* from 'inch.c' */ - -void printk(char *fmt, ...); /* from 'printk.c' */ - -void rtemsReboot(void); /* from 'exit.c' */ - -/* Definitions for BSPConsolePort */ -#define BSP_CONSOLE_PORT_CONSOLE (-1) -#define BSP_CONSOLE_PORT_COM1 (BSP_UART_COM1) -#define BSP_CONSOLE_PORT_COM2 (BSP_UART_COM2) - -/* GDB stub stuff */ -void i386_stub_glue_init(int uart); -void i386_stub_glue_init_breakin(void); -void set_debug_traps(void); -void breakpoint(void); - -#ifdef __cplusplus -} -#endif - -#endif /* __BSP_H_ */ -/* end of include file */ - - - - - - diff --git a/c/src/lib/libbsp/i386/pc386/include/coverhd.h b/c/src/lib/libbsp/i386/pc386/include/coverhd.h deleted file mode 100644 index e4e5514c3e..0000000000 --- a/c/src/lib/libbsp/i386/pc386/include/coverhd.h +++ /dev/null @@ -1,104 +0,0 @@ -/* coverhd.h - * - * This include file has defines to represent the overhead associated - * with calling a particular directive from C on this target. - * - * COPYRIGHT (c) 1989-1998. - * On-Line Applications Research Corporation (OAR). - * Copyright assigned to U.S. Government, 1994. - * - * The license and distribution terms for this file may be - * found in found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#ifndef __COVERHD_h -#define __COVERHD_h - -#ifdef __cplusplus -extern "C" { -#endif - -#define CALLING_OVERHEAD_INITIALIZE_EXECUTIVE 0 -#define CALLING_OVERHEAD_SHUTDOWN_EXECUTIVE 0 -#define CALLING_OVERHEAD_TASK_CREATE 0 -#define CALLING_OVERHEAD_TASK_IDENT 0 -#define CALLING_OVERHEAD_TASK_START 0 -#define CALLING_OVERHEAD_TASK_RESTART 0 -#define CALLING_OVERHEAD_TASK_DELETE 0 -#define CALLING_OVERHEAD_TASK_SUSPEND 0 -#define CALLING_OVERHEAD_TASK_RESUME 0 -#define CALLING_OVERHEAD_TASK_SET_PRIORITY 0 -#define CALLING_OVERHEAD_TASK_MODE 0 -#define CALLING_OVERHEAD_TASK_GET_NOTE 0 -#define CALLING_OVERHEAD_TASK_SET_NOTE 0 -#define CALLING_OVERHEAD_TASK_WAKE_WHEN 0 -#define CALLING_OVERHEAD_TASK_WAKE_AFTER 0 -#define CALLING_OVERHEAD_INTERRUPT_CATCH 0 -#define CALLING_OVERHEAD_CLOCK_GET 0 -#define CALLING_OVERHEAD_CLOCK_SET 0 -#define CALLING_OVERHEAD_CLOCK_TICK 0 - -#define CALLING_OVERHEAD_TIMER_CREATE 0 -#define CALLING_OVERHEAD_TIMER_IDENT 0 -#define CALLING_OVERHEAD_TIMER_DELETE 0 -#define CALLING_OVERHEAD_TIMER_FIRE_AFTER 0 -#define CALLING_OVERHEAD_TIMER_FIRE_WHEN 0 -#define CALLING_OVERHEAD_TIMER_RESET 0 -#define CALLING_OVERHEAD_TIMER_CANCEL 0 -#define CALLING_OVERHEAD_SEMAPHORE_CREATE 0 -#define CALLING_OVERHEAD_SEMAPHORE_DELETE 0 -#define CALLING_OVERHEAD_SEMAPHORE_IDENT 0 -#define CALLING_OVERHEAD_SEMAPHORE_OBTAIN 0 -#define CALLING_OVERHEAD_SEMAPHORE_RELEASE 0 -#define CALLING_OVERHEAD_MESSAGE_QUEUE_CREATE 0 -#define CALLING_OVERHEAD_MESSAGE_QUEUE_IDENT 0 -#define CALLING_OVERHEAD_MESSAGE_QUEUE_DELETE 0 -#define CALLING_OVERHEAD_MESSAGE_QUEUE_SEND 0 -#define CALLING_OVERHEAD_MESSAGE_QUEUE_URGENT 0 -#define CALLING_OVERHEAD_MESSAGE_QUEUE_BROADCAST 0 -#define CALLING_OVERHEAD_MESSAGE_QUEUE_RECEIVE 0 -#define CALLING_OVERHEAD_MESSAGE_QUEUE_FLUSH 0 - -#define CALLING_OVERHEAD_EVENT_SEND 0 -#define CALLING_OVERHEAD_EVENT_RECEIVE 0 -#define CALLING_OVERHEAD_SIGNAL_CATCH 0 -#define CALLING_OVERHEAD_SIGNAL_SEND 0 -#define CALLING_OVERHEAD_PARTITION_CREATE 0 -#define CALLING_OVERHEAD_PARTITION_IDENT 0 -#define CALLING_OVERHEAD_PARTITION_DELETE 0 -#define CALLING_OVERHEAD_PARTITION_GET_BUFFER 0 -#define CALLING_OVERHEAD_PARTITION_RETURN_BUFFER 0 -#define CALLING_OVERHEAD_REGION_CREATE 0 -#define CALLING_OVERHEAD_REGION_IDENT 0 -#define CALLING_OVERHEAD_REGION_DELETE 0 -#define CALLING_OVERHEAD_REGION_GET_SEGMENT 0 -#define CALLING_OVERHEAD_REGION_RETURN_SEGMENT 0 -#define CALLING_OVERHEAD_PORT_CREATE 0 -#define CALLING_OVERHEAD_PORT_IDENT 0 -#define CALLING_OVERHEAD_PORT_DELETE 0 -#define CALLING_OVERHEAD_PORT_EXTERNAL_TO_INTERNAL 0 -#define CALLING_OVERHEAD_PORT_INTERNAL_TO_EXTERNAL 0 - -#define CALLING_OVERHEAD_IO_INITIALIZE 0 -#define CALLING_OVERHEAD_IO_OPEN 0 -#define CALLING_OVERHEAD_IO_CLOSE 0 -#define CALLING_OVERHEAD_IO_READ 0 -#define CALLING_OVERHEAD_IO_WRITE 0 -#define CALLING_OVERHEAD_IO_CONTROL 0 -#define CALLING_OVERHEAD_FATAL_ERROR_OCCURRED 0 -#define CALLING_OVERHEAD_RATE_MONOTONIC_CREATE 0 -#define CALLING_OVERHEAD_RATE_MONOTONIC_IDENT 0 -#define CALLING_OVERHEAD_RATE_MONOTONIC_DELETE 0 -#define CALLING_OVERHEAD_RATE_MONOTONIC_CANCEL 0 -#define CALLING_OVERHEAD_RATE_MONOTONIC_PERIOD 0 -#define CALLING_OVERHEAD_MULTIPROCESSING_ANNOUNCE 0 - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ diff --git a/c/src/lib/libbsp/i386/pc386/include/crt.h b/c/src/lib/libbsp/i386/pc386/include/crt.h deleted file mode 100644 index b0cf87fc06..0000000000 --- a/c/src/lib/libbsp/i386/pc386/include/crt.h +++ /dev/null @@ -1,90 +0,0 @@ -/* - * crt.h - This file contains definitions for constants related to PC console. - * More information can be found at - * <http://millenium.atcg.com/~taco/helppc/tables.html> - * - * Copyright (C) 1998 Eric Valette (valette@crf.canon.fr) - * Canon Centre Recherche France. - * - * The license and distribution terms for this file may be - * found in found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#ifndef _CRT_H -#define _CRT_H - -/* - * Bitmap video origins in text mode. - */ - - /* In monochrome */ -#define V_MONO 0xb0000 - /* In color */ -#define V_COLOR 0xb8000 - - -/* - * Video Option Byte location. It must be maintained - * by the BIOS. - */ -#define VIDEO_MODE_ADDR 0x449 -/* - * Video controller base IO address location in - * BIOS data area - */ -#define DISPLAY_CRT_BASE_IO_ADDR 0x463 -/* - * Number of collums and lines locations for the - * actual video Configuration - */ -#define NB_MAX_COL_ADDR 0x44a -#define NB_MAX_ROW_ADDR 0x484 - - /* - * Miscellaneous information set by the BIOS in offset video_mode, - */ - -# define VGAMODE7 0x7 /* VGA mode 7 */ - - /* Color codes in text mode for background and foreground. */ -#define BLACK 0x0 -#define BLUE 0x1 -#define GREEN 0x2 -#define CYAN 0x3 -#define RED 0x4 -#define MAGENTA 0x5 -#define BROWN 0x6 -#define WHITE 0x7 - -#define GRAY 0x8 -#define LT_BLUE 0x9 -#define LT_GREEN 0xa -#define LT_CYAN 0xb -#define LT_RED 0xc -#define LT_MAGENTA 0xd -#define YELLOW 0xe -#define LT_WHITE 0xf - -#define BLINK 0x8 /* Mask used to determine blinking */ -#define OFF 0 -#define ON 1 - - -/* - * CRT Controller register offset definitions - */ - -# define CC_CURSSTART 0x0a /* Cursor start scan line */ -# define CC_CURSEND 0x0b /* Cursor end scan line */ -# define CC_STARTADDRHI 0x0c /* start video ram addr msb */ -# define CC_STARTADDRLO 0x0d /* start video ram lsb */ -# define CC_CURSHIGH 0x0e /* Cursor high location (8 msb) */ -# define CC_CURSLOW 0x0f /* Cursor low location (8 msb) */ -# define CC_VRETSTART 0x10 /* vertical synchro start lsb */ -# define CC_VRETEND 0x11 /* vertical syn end (also it control) */ -# define CC_VDISPEND 0x12 /* vertical display end lsb register */ - -#endif /* _CRT_H */ diff --git a/c/src/lib/libbsp/i386/pc386/include/wd80x3.h b/c/src/lib/libbsp/i386/pc386/include/wd80x3.h deleted file mode 100644 index 4bad00993c..0000000000 --- a/c/src/lib/libbsp/i386/pc386/include/wd80x3.h +++ /dev/null @@ -1,123 +0,0 @@ - -/* Register descriptions */ -/* Controller DP8390. */ - -#define DATAPORT 0x10 /* Port Window. */ -#define RESET 0x1f /* Issue a read for reset */ -#define W83CREG 0x00 /* I/O port definition */ -#define ADDROM 0x08 - -/* page 0 read or read/write registers */ - -#define CMDR 0x00+RO -#define CLDA0 0x01+RO /* current local dma addr 0 for read */ -#define CLDA1 0x02+RO /* current local dma addr 1 for read */ -#define BNRY 0x03+RO /* boundary reg for rd and wr */ -#define TSR 0x04+RO /* tx status reg for rd */ -#define NCR 0x05+RO /* number of collision reg for rd */ -#define FIFO 0x06+RO /* FIFO for rd */ -#define ISR 0x07+RO /* interrupt status reg for rd and wr */ -#define CRDA0 0x08+RO /* current remote dma address 0 for rd */ -#define CRDA1 0x09+RO /* current remote dma address 1 for rd */ -#define RSR 0x0C+RO /* rx status reg for rd */ -#define CNTR0 0x0D+RO /* tally cnt 0 for frm alg err for rd */ -#define CNTR1 RO+0x0E /* tally cnt 1 for crc err for rd */ -#define CNTR2 0x0F+RO /* tally cnt 2 for missed pkt for rd */ - -/* page 0 write registers */ - -#define PSTART 0x01+RO /* page start register */ -#define PSTOP 0x02+RO /* page stop register */ -#define TPSR 0x04+RO /* tx start page start reg */ -#define TBCR0 0x05+RO /* tx byte count 0 reg */ -#define TBCR1 0x06+RO /* tx byte count 1 reg */ -#define RSAR0 0x08+RO /* remote start address reg 0 */ -#define RSAR1 0x09+RO /* remote start address reg 1 */ -#define RBCR0 0x0A+RO /* remote byte count reg 0 */ -#define RBCR1 0x0B+RO /* remote byte count reg 1 */ -#define RCR 0x0C+RO /* rx configuration reg */ -#define TCR 0x0D+RO /* tx configuration reg */ -#define DCR RO+0x0E /* data configuration reg */ -#define IMR 0x0F+RO /* interrupt mask reg */ - -/* page 1 registers */ - -#define PAR 0x01+RO /* physical addr reg base for rd and wr */ -#define CURR 0x07+RO /* current page reg for rd and wr */ -#define MAR 0x08+RO /* multicast addr reg base fro rd and WR */ -#define MARsize 8 /* size of multicast addr space */ - -/*-----W83CREG command bits-----*/ -#define MSK_RESET 0x80 /* W83CREG masks */ -#define MSK_ENASH 0x40 -#define MSK_DECOD 0x3F /* memory decode bits, corresponding */ - /* to SA 18-13. SA 19 assumed to be 1 */ - -/*-----CMDR command bits-----*/ -#define MSK_STP 0x01 /* stop the chip */ -#define MSK_STA 0x02 /* start the chip */ -#define MSK_TXP 0x04 /* initial txing of a frm */ -#define MSK_RRE 0x08 /* remote read */ -#define MSK_RWR 0x10 /* remote write */ -#define MSK_RD2 0x20 /* no DMA used */ -#define MSK_PG0 0x00 /* select register page 0 */ -#define MSK_PG1 0x40 /* select register page 1 */ -#define MSK_PG2 0x80 /* select register page 2 */ - -/*-----ISR and TSR status bits-----*/ -#define MSK_PRX 0x01 /* rx with no error */ -#define MSK_PTX 0x02 /* tx with no error */ -#define MSK_RXE 0x04 /* rx with error */ -#define MSK_TXE 0x08 /* tx with error */ -#define MSK_OVW 0x10 /* overwrite warning */ -#define MSK_CNT 0x20 /* MSB of one of the tally counters is set */ -#define MSK_RDC 0x40 /* remote dma completed */ -#define MSK_RST 0x80 /* reset state indicator */ - -/*-----DCR command bits-----*/ -#define MSK_WTS 0x01 /* word transfer mode selection */ -#define MSK_BOS 0x02 /* byte order selection */ -#define MSK_LAS 0x04 /* long addr selection */ -#define MSK_BMS 0x08 /* burst mode selection */ -#define MSK_ARM 0x10 /* autoinitialize remote */ -#define MSK_FT00 0x00 /* burst lrngth selection */ -#define MSK_FT01 0x20 /* burst lrngth selection */ -#define MSK_FT10 0x40 /* burst lrngth selection */ -#define MSK_FT11 0x60 /* burst lrngth selection */ - -/*-----RCR command bits-----*/ -#define MSK_SEP 0x01 /* save error pkts */ -#define MSK_AR 0x02 /* accept runt pkt */ -#define MSK_AB 0x04 /* 8390 RCR */ -#define MSK_AM 0x08 /* accept multicast */ -#define MSK_PRO 0x10 /* accept all pkt with physical adr */ -#define MSK_MON 0x20 /* monitor mode */ - -/*-----TCR command bits-----*/ -#define MSK_CRC 0x01 /* inhibit CRC, do not append crc */ -#define MSK_LOOP 0x02 /* set loopback mode */ -#define MSK_BCST 0x04 /* Accept broadcasts */ -#define MSK_LB01 0x06 /* encoded loopback control */ -#define MSK_ATD 0x08 /* auto tx disable */ -#define MSK_OFST 0x10 /* collision offset enable */ - -/*-----receive status bits-----*/ -#define SMK_PRX 0x01 /* rx without error */ -#define SMK_CRC 0x02 /* CRC error */ -#define SMK_FAE 0x04 /* frame alignment error */ -#define SMK_FO 0x08 /* FIFO overrun */ -#define SMK_MPA 0x10 /* missed pkt */ -#define SMK_PHY 0x20 /* physical/multicase address */ -#define SMK_DIS 0x40 /* receiver disable. set in monitor mode */ -#define SMK_DEF 0x80 /* deferring */ - -/*-----transmit status bits-----*/ -#define SMK_PTX 0x01 /* tx without error */ -#define SMK_DFR 0x02 /* non deferred tx */ -#define SMK_COL 0x04 /* tx collided */ -#define SMK_ABT 0x08 /* tx abort because of excessive collisions */ -#define SMK_CRS 0x10 /* carrier sense lost */ -#define SMK_FU 0x20 /* FIFO underrun */ -#define SMK_CDH 0x40 /* collision detect heartbeat */ -#define SMK_OWC 0x80 /* out of window collision */ - diff --git a/c/src/lib/libbsp/i386/pc386/network/Makefile.in b/c/src/lib/libbsp/i386/pc386/network/Makefile.in deleted file mode 100644 index 59728b648d..0000000000 --- a/c/src/lib/libbsp/i386/pc386/network/Makefile.in +++ /dev/null @@ -1,55 +0,0 @@ -# -# $Id$ -# - -@SET_MAKE@ -srcdir = @srcdir@ -VPATH = @srcdir@ -RTEMS_ROOT = @top_srcdir@ -PROJECT_ROOT = @PROJECT_ROOT@ - -PGM=${ARCH}/network.rel - -# C source names, if any, go here -- minus the .c -C_PIECES=network -C_FILES=$(C_PIECES:%=%.c) -C_O_FILES=$(C_PIECES:%=${ARCH}/%.o) - -H_FILES= - -SRCS=$(C_FILES) $(H_FILES) -OBJS=$(C_O_FILES) - -include $(RTEMS_ROOT)/make/custom/$(RTEMS_BSP).cfg -include $(RTEMS_ROOT)/make/leaf.cfg - -# -# (OPTIONAL) Add local stuff here using += -# - -DEFINES += -D_COMPILING_BSD_KERNEL_ -DKERNEL -DINET -DNFS \ - -DDIAGNOSTIC -DBOOTP_COMPAT -CPPFLAGS += -CFLAGS += - -LD_PATHS += -LD_LIBS += -LDFLAGS += - -# -# Add your list of files to delete here. The config files -# already know how to delete some stuff, so you may want -# to just run 'make clean' first to see what gets missed. -# 'make clobber' already includes 'make clean' -# - -CLEAN_ADDITIONS += -CLOBBER_ADDITIONS += - -${PGM}: ${SRCS} ${OBJS} - $(make-rel) - -all: ${ARCH} $(SRCS) $(PGM) - -# the .rel file built here will be put into libbsp.a by ../wrapup/Makefile -install: all diff --git a/c/src/lib/libbsp/i386/pc386/network/network.c b/c/src/lib/libbsp/i386/pc386/network/network.c deleted file mode 100644 index 7afab2f9de..0000000000 --- a/c/src/lib/libbsp/i386/pc386/network/network.c +++ /dev/null @@ -1,657 +0,0 @@ -/* - * RTEMS driver for M68360 WD1 Ethernet - * - * W. Eric Norum - * Saskatchewan Accelerator Laboratory - * University of Saskatchewan - * Saskatoon, Saskatchewan, CANADA - * eric@skatter.usask.ca - * - * $Id$ - */ - -#include <bsp.h> -#include <wd80x3.h> - -#include <stdio.h> -#include <stdarg.h> -#include <rtems/error.h> -#include <rtems/rtems_bsdnet.h> - -#include <sys/param.h> -#include <sys/mbuf.h> -#include <sys/socket.h> -#include <sys/sockio.h> - -#include <net/if.h> - -#include <netinet/in.h> -#include <netinet/if_ether.h> - -#include <irq.h> - -#define ET_MINLEN 60 /* minimum message length */ - -/* - * Number of WDs supported by this driver - */ -#define NWDDRIVER 1 - -/* - * Default number of buffer descriptors set aside for this driver. - * The number of transmit buffer descriptors has to be quite large - * since a single frame often uses four or more buffer descriptors. - */ -#define RX_BUF_COUNT 15 -#define TX_BUF_COUNT 4 -#define TX_BD_PER_BUF 4 - -/* - * RTEMS event used by interrupt handler to signal driver tasks. - * This must not be any of the events used by the network task synchronization. - */ -#define INTERRUPT_EVENT RTEMS_EVENT_1 - -/* - * RTEMS event used to start transmit daemon. - * This must not be the same as INTERRUPT_EVENT. - */ -#define START_TRANSMIT_EVENT RTEMS_EVENT_2 - -/* - * Receive buffer size -- Allow for a full ethernet packet including CRC - */ -#define RBUF_SIZE 1520 - -#if (MCLBYTES < RBUF_SIZE) -# error "Driver must have MCLBYTES > RBUF_SIZE" -#endif - -/* - * Per-device data - */ -struct wd_softc { - struct arpcom arpcom; - rtems_irq_connect_data irqInfo; - struct mbuf **rxMbuf; - struct mbuf **txMbuf; - int acceptBroadcast; - int rxBdCount; - int txBdCount; - int txBdHead; - int txBdTail; - int txBdActiveCount; - rtems_id rxDaemonTid; - rtems_id txDaemonTid; - - unsigned int port; - unsigned char *base; - unsigned long bpar; - - /* - * Statistics - */ - unsigned long rxInterrupts; - unsigned long rxNotFirst; - unsigned long rxNotLast; - unsigned long rxGiant; - unsigned long rxNonOctet; - unsigned long rxRunt; - unsigned long rxBadCRC; - unsigned long rxOverrun; - unsigned long rxCollision; - - unsigned long txInterrupts; - unsigned long txDeferred; - unsigned long txHeartbeat; - unsigned long txLateCollision; - unsigned long txRetryLimit; - unsigned long txUnderrun; - unsigned long txLostCarrier; - unsigned long txRawWait; -}; - -#define RO 0x10 - -#define SHATOT (8*1024) /* size of shared memory */ -#define SHAPAGE 256 /* shared memory information */ -#define MAXSIZ 1536 /*(MAXBUF - MESSH_SZ)*/ -#define OUTPAGE ((SHATOT-(MAXSIZ+SHAPAGE-1))/SHAPAGE) - -static unsigned long loopc; -static volatile unsigned long overrun; -static volatile unsigned long resend; -static struct wd_softc wd_softc[NWDDRIVER]; - -/* - * WD interrupt handler - */ -static rtems_isr -wd8003Enet_interrupt_handler (rtems_vector_number v) -{ - unsigned int tport; - unsigned char status, status2; - - tport = wd_softc[0].port ; - - /* - * Read status - */ - inport_byte(tport+ISR, status); - outport_byte(tport+IMR, 0x00); - - /* - * Ring overwrite - */ - - if (status & MSK_OVW){ - outport_byte(tport+CMDR, MSK_STP + MSK_RD2); /* stop 8390 */ - Wait_X_ms(2); - outport_byte(tport+RBCR0, 0); /* clear byte count */ - outport_byte(tport+RBCR1, 0); - inport_byte(tport+ISR, status2); - status |= (status2 & (MSK_PTX+MSK_TXE)) ; /* TX status */ - outport_byte(tport+TCR, MSK_LOOP); /* loopback mode */ - outport_byte(tport+CMDR, MSK_STA + MSK_RD2); /* start */ - overrun = 1 ; - if ((status & (MSK_PTX+MSK_TXE)) == 0) - resend = 1; - } - - /* - * Frame received? - */ - if (status & (MSK_PRX+MSK_RXE)) { - outport_byte(tport+ISR, status & (MSK_PRX+MSK_RXE)); - wd_softc[0].rxInterrupts++; - rtems_event_send (wd_softc[0].rxDaemonTid, INTERRUPT_EVENT); - } - -} - -static void nopOn(const rtems_irq_connect_data* notUsed) -{ - /* - * code should be moved from wd8003Enet_initialize_hardware - * to this location - */ -} - -static int wdIsOn(const rtems_irq_connect_data* irq) -{ - return BSP_irq_enabled_at_i8259s (irq->name); -} - -/* - * Initialize the ethernet hardware - */ -static void -wd8003Enet_initialize_hardware (struct wd_softc *sc) -{ - int i1, ultra; - char cc1, cc2; - unsigned char temp; - rtems_status_code st; - unsigned int tport; - unsigned char *hwaddr; - - tport = sc->port; - - /* address from board ROM */ - inport_byte(tport+0x04, temp); - outport_byte(tport+0x04, temp & 0x7f); - - hwaddr = sc->arpcom.ac_enaddr; - for (i1=cc2=0; i1<8; i1++) { - inport_byte(tport + ADDROM + i1, cc1); - cc2 += cc1; - if (i1 < 6) - hwaddr[i1] = cc1; - } - - inport_byte(tport+0x04, temp); - outport_byte(tport+0x04, temp | 0x80); /* alternate registers */ - outport_byte(tport+W83CREG, MSK_RESET); /* reset board, set buffer */ - outport_byte(tport+W83CREG, 0); - outport_byte(tport+W83CREG, MSK_ENASH + (int)((sc->bpar>>13)&0x3f)); - - outport_byte(tport+CMDR, MSK_PG0 + MSK_RD2); - cc1 = MSK_BMS + MSK_FT10; /* configure 8 or 16 bits */ - - inport_byte(tport+0x07, temp) ; - - ultra = ((temp & 0xf0) == 0x20 || (temp & 0xf0) == 0x40); - if (ultra) - cc1 = MSK_WTS + MSK_BMS + MSK_FT10; - outport_byte(tport+DCR, cc1); - outport_byte(tport+RBCR0, 0); - outport_byte(tport+RBCR1, 0); - outport_byte(tport+RCR, MSK_MON); /* disable the rxer */ - outport_byte(tport+TCR, 0); /* normal operation */ - outport_byte(tport+PSTOP, OUTPAGE); /* init PSTOP */ - outport_byte(tport+PSTART, 0); /* init PSTART */ - outport_byte(tport+BNRY, -1); /* init BNRY */ - outport_byte(tport+ISR, -1); /* clear IR's */ - outport_byte(tport+IMR, 0x15); /* enable interrupt */ - - outport_byte(tport+CMDR, MSK_PG1 + MSK_RD2); - - for (i1=0; i1<6; i1++) /* initial physical addr */ - outport_byte(tport+PAR+i1, hwaddr[i1]); - - for (i1=0; i1<MARsize; i1++) /* clear multicast */ - outport_byte(tport+MAR+i1, 0); - outport_byte(tport+CURR, 0); /* init current packet */ - - outport_byte(tport+CMDR, MSK_PG0 + MSK_RD2); - outport_byte(tport+CMDR, MSK_STA + MSK_RD2); /* put 8390 on line */ - outport_byte(tport+RCR, MSK_AB); /* MSK_AB accept broadcast */ - - if (ultra) { - inport_byte(tport+0x0c, temp); - outport_byte(tport+0x0c, temp | 0x80); - outport_byte(tport+0x05, 0x80); - outport_byte(tport+0x06, 0x01); - } - - /* - * Set up interrupts - */ - sc->irqInfo.hdl = wd8003Enet_interrupt_handler; - sc->irqInfo.on = nopOn; - sc->irqInfo.off = nopOn; - sc->irqInfo.isOn = wdIsOn; - - st = BSP_install_rtems_irq_handler (&sc->irqInfo); - if (!st) - rtems_panic ("Can't attach WD interrupt handler for irq %d\n", - sc->irqInfo.name); -} - -static void -wd_rxDaemon (void *arg) -{ - unsigned int tport; - struct ether_header *eh; - struct wd_softc *dp = (struct wd_softc *)&wd_softc[0]; - struct ifnet *ifp = &dp->arpcom.ac_if; - struct mbuf *m; - unsigned int i2; - unsigned int len; - volatile unsigned char start, next, current; - char *shp, *temp; - rtems_event_set events; - - tport = wd_softc[0].port ; - - for (;;){ - - - rtems_bsdnet_event_receive (INTERRUPT_EVENT, - RTEMS_WAIT|RTEMS_EVENT_ANY, - RTEMS_NO_TIMEOUT, - &events); - - for (;;){ - inport_byte(tport+BNRY, start); - - outport_byte(tport+CMDR, MSK_PG1 + MSK_RD2); - inport_byte(tport+CURR, current); - outport_byte(tport+CMDR, MSK_PG0 + MSK_RD2); - - start += 1; - if (start >= OUTPAGE){ - start = 0; - } - - if (current == start) - break; - - shp = dp->base + 1 + (SHAPAGE * start); - next = *shp++; - len = *((short *)shp)++ - 4; - - if (next >= OUTPAGE){ - next = 0; - } - - MGETHDR (m, M_WAIT, MT_DATA); - MCLGET (m, M_WAIT); - m->m_pkthdr.rcvif = ifp; - - temp = m->m_data; - m->m_len = m->m_pkthdr.len = len - sizeof(struct ether_header); - - if ((i2 = (OUTPAGE - start) * SHAPAGE - 4) < len){ - memcpy(temp, shp, i2); - len -= i2; - temp += i2; - shp = dp->base; - } - memcpy(temp, shp, len); - - eh = mtod (m, struct ether_header *); - m->m_data += sizeof(struct ether_header); - ether_input (ifp, eh, m); - - outport_byte(tport+BNRY, next-1); - } - - /* - * Ring overwrite - */ - if (overrun){ - outport_byte(tport+ISR, MSK_OVW); /* reset IR */ - outport_byte(tport+TCR, 0); /* out of loopback */ - if (resend == 1) - outport_byte(tport+CMDR, MSK_TXP + MSK_RD2); /* resend */ - resend = 0; - overrun = 0; - } - - outport_byte(tport+IMR, 0x15); /* re-enable IT rx */ - } -} - -static void -sendpacket (struct ifnet *ifp, struct mbuf *m) -{ - struct wd_softc *dp = ifp->if_softc; - struct mbuf *n; - unsigned int len, tport; - char *shp, txReady; - - tport = dp->port; - - /* - * Waiting for Transmitter ready - */ - inport_byte(tport+CMDR, txReady); - while(txReady & MSK_TXP) - inport_byte(tport+CMDR, txReady); - - len = 0; - shp = dp->base + (SHAPAGE * OUTPAGE); - - n = m; - - for (;;){ - len += m->m_len; - memcpy(shp, (char *)m->m_data, m->m_len); - shp += m->m_len ; - if ((m = m->m_next) == NULL) - break; - } - - m_freem(n); - - if (len < ET_MINLEN) len = ET_MINLEN; - outport_byte(tport+TBCR0, len); - outport_byte(tport+TBCR1, (len >> 8) ); - outport_byte(tport+TPSR, OUTPAGE); - outport_byte(tport+CMDR, MSK_TXP + MSK_RD2); -} - -/* - * Driver transmit daemon - */ -void -wd_txDaemon (void *arg) -{ - struct wd_softc *sc = (struct wd_softc *)arg; - struct ifnet *ifp = &sc->arpcom.ac_if; - struct mbuf *m; - rtems_event_set events; - - for (;;) { - /* - * Wait for packet - */ - rtems_bsdnet_event_receive (START_TRANSMIT_EVENT, RTEMS_EVENT_ANY | RTEMS_WAIT, RTEMS_NO_TIMEOUT, &events); - - /* - * Send packets till queue is empty - */ - for (;;) { - /* - * Get the next mbuf chain to transmit. - */ - IF_DEQUEUE(&ifp->if_snd, m); - if (!m) - break; - sendpacket (ifp, m); - } - ifp->if_flags &= ~IFF_OACTIVE; - } -} - -/* - * Send packet (caller provides header). - */ -static void -wd_start (struct ifnet *ifp) -{ - struct wd_softc *sc = ifp->if_softc; - - rtems_event_send (sc->txDaemonTid, START_TRANSMIT_EVENT); - ifp->if_flags |= IFF_OACTIVE; -} - -/* - * Initialize and start the device - */ -static void -wd_init (void *arg) -{ - struct wd_softc *sc = arg; - struct ifnet *ifp = &sc->arpcom.ac_if; - - if (sc->txDaemonTid == 0) { - - /* - * Set up WD hardware - */ - wd8003Enet_initialize_hardware (sc); - - /* - * Start driver tasks - */ - sc->txDaemonTid = rtems_bsdnet_newproc ("SCtx", 4096, wd_txDaemon, sc); - sc->rxDaemonTid = rtems_bsdnet_newproc ("SCrx", 4096, wd_rxDaemon, sc); - } - - /* - * Tell the world that we're running. - */ - ifp->if_flags |= IFF_RUNNING; - -} - -/* - * Stop the device - */ -static void -wd_stop (struct wd_softc *sc) -{ - unsigned int tport; - unsigned char temp; - struct ifnet *ifp = &sc->arpcom.ac_if; - - ifp->if_flags &= ~IFF_RUNNING; - - /* - * Stop the transmitter - */ - tport=wd_softc[0].port ; - inport_byte(tport+0x04,temp); - outport_byte(tport+0x04, temp & 0x7f); - outport_byte(tport + CMDR, MSK_STP + MSK_RD2); - -} - - -/* - * Show interface statistics - */ -static void -wd_stats (struct wd_softc *sc) -{ - printf (" Rx Interrupts:%-8lu", sc->rxInterrupts); - printf (" Not First:%-8lu", sc->rxNotFirst); - printf (" Not Last:%-8lu\n", sc->rxNotLast); - printf (" Giant:%-8lu", sc->rxGiant); - printf (" Runt:%-8lu", sc->rxRunt); - printf (" Non-octet:%-8lu\n", sc->rxNonOctet); - printf (" Bad CRC:%-8lu", sc->rxBadCRC); - printf (" Overrun:%-8lu", sc->rxOverrun); - printf (" Collision:%-8lu\n", sc->rxCollision); - - printf (" Tx Interrupts:%-8lu", sc->txInterrupts); - printf (" Deferred:%-8lu", sc->txDeferred); - printf (" Missed Hearbeat:%-8lu\n", sc->txHeartbeat); - printf (" No Carrier:%-8lu", sc->txLostCarrier); - printf ("Retransmit Limit:%-8lu", sc->txRetryLimit); - printf (" Late Collision:%-8lu\n", sc->txLateCollision); - printf (" Underrun:%-8lu", sc->txUnderrun); - printf (" Raw output wait:%-8lu\n", sc->txRawWait); -} - -/* - * Driver ioctl handler - */ -static int -wd_ioctl (struct ifnet *ifp, int command, caddr_t data) -{ - struct wd_softc *sc = ifp->if_softc; - int error = 0; - - switch (command) { - case SIOCGIFADDR: - case SIOCSIFADDR: - ether_ioctl (ifp, command, data); - break; - - case SIOCSIFFLAGS: - switch (ifp->if_flags & (IFF_UP | IFF_RUNNING)) { - case IFF_RUNNING: - wd_stop (sc); - break; - - case IFF_UP: - wd_init (sc); - break; - - case IFF_UP | IFF_RUNNING: - wd_stop (sc); - wd_init (sc); - break; - - default: - break; - } - break; - - case SIO_RTEMS_SHOW_STATS: - wd_stats (sc); - break; - - /* - * FIXME: All sorts of multicast commands need to be added here! - */ - default: - error = EINVAL; - break; - } - return error; -} - -/* - * Attach an WD driver to the system - */ -int -rtems_wd_driver_attach (struct rtems_bsdnet_ifconfig *config) -{ - struct wd_softc *sc; - struct ifnet *ifp; - int mtu; - int i; - - /* - * Find a free driver - */ - for (i = 0 ; i < NWDDRIVER ; i++) { - sc = &wd_softc[i]; - ifp = &sc->arpcom.ac_if; - if (ifp->if_softc == NULL) - break; - } - if (i >= NWDDRIVER) { - printf ("Too many WD drivers.\n"); - return 0; - } - - /* - * Process options - */ - if (config->hardware_address) { - memcpy (sc->arpcom.ac_enaddr, config->hardware_address, - ETHER_ADDR_LEN); - } - else { - memset (sc->arpcom.ac_enaddr, 0x08,ETHER_ADDR_LEN); - } - if (config->mtu) - mtu = config->mtu; - else - mtu = ETHERMTU; - - - if (config->irno) - sc->irqInfo.name = config->irno; - else - sc->irqInfo.name = 5; - - if (config->port) - sc->port = config->port; - else - sc->port = 0x240; - - if (config->bpar) { - sc->bpar = config->bpar; - sc->base = (unsigned char*) config->bpar; - } - else { - sc->bpar = 0xD0000; - sc->base = (unsigned char*) 0xD0000; - } - - sc->acceptBroadcast = !config->ignore_broadcast; - - /* - * Set up network interface values - */ - ifp->if_softc = sc; - ifp->if_unit = i + 1; - ifp->if_name = "wd"; - ifp->if_mtu = mtu; - ifp->if_init = wd_init; - ifp->if_ioctl = wd_ioctl; - ifp->if_start = wd_start; - ifp->if_output = ether_output; - ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX; - if (ifp->if_snd.ifq_maxlen == 0) - ifp->if_snd.ifq_maxlen = ifqmaxlen; - - /* - * init some variables - */ - overrun = 0; - resend = 0; - - /* - * Attach the interface - */ - if_attach (ifp); - ether_ifattach (ifp); - return 1; -}; diff --git a/c/src/lib/libbsp/i386/pc386/start/Makefile.in b/c/src/lib/libbsp/i386/pc386/start/Makefile.in deleted file mode 100644 index b5ea51fd71..0000000000 --- a/c/src/lib/libbsp/i386/pc386/start/Makefile.in +++ /dev/null @@ -1,72 +0,0 @@ -# -# $Id$ -# - -@SET_MAKE@ -srcdir = @srcdir@ -VPATH = @srcdir@ -RTEMS_ROOT = @top_srcdir@ -PROJECT_ROOT = @PROJECT_ROOT@ -RTEMS_GAS_CODE16 = @RTEMS_GAS_CODE16@ - -PGMS=${ARCH}/start.o ${ARCH}/start16.bin - -# C source names, if any, go here -- minus the .c -C_PIECES= -C_FILES=$(C_PIECES:%=%.c) -C_O_FILES=$(C_PIECES:%=${ARCH}/%.o) - -H_FILES= - -# Assembly source names, if any, go here -- minus the .s -S_PIECES=start16 start -S_FILES=$(S_PIECES:%=%.s) -S_O_FILES=$(S_FILES:%.s=${ARCH}/%.o) - -SRCS=$(C_FILES) $(H_FILES) $(S_FILES) -OBJS=$(C_O_FILES) $(S_O_FILES) - -include $(RTEMS_ROOT)/make/custom/$(RTEMS_BSP).cfg -include $(RTEMS_ROOT)/make/leaf.cfg - -# -# (OPTIONAL) Add local stuff here using += -# - -ifeq ($(RTEMS_GAS_CODE16),yes) -DEFINES += -DNEW_GAS -endif -CPPFLAGS += -CFLAGS += - -LD_PATHS += -LD_LIBS += -LDFLAGS += - -# -# Add your list of files to delete here. The config files -# already know how to delete some stuff, so you may want -# to just run 'make clean' first to see what gets missed. -# 'make clobber' already includes 'make clean' -# - -CLEAN_ADDITIONS += -CLOBBER_ADDITIONS += - -all: ${ARCH} $(SRCS) $(OBJS) $(PGMS) - $(INSTALL_VARIANT) -m 555 ${PGMS} ${PROJECT_RELEASE}/lib - -# Install the program(s), appending _g or _p as appropriate. -# for include files, just use $(INSTALL) - -LINKCMDS=$(srcdir)/../startup/linkcmds - -${ARCH}/start16.o: start16.s - sed -e 's/\/\/.*$$//' < $< | $(CPP) $(ASMFLAGS) -I. -I$(srcdir) \ - -DASM -DHEADERADDR=$(HEADERADDR) - > $*.i - $(AS) $(ASFLAGS) -o $@ $*.i - -${ARCH}/start16.bin: ${ARCH}/start16.o - $(LD) -N -T $(LINKCMDS) -Ttext $(START16ADDR) -e start16 -nostdlib \ - --oformat=elf32-i386 -o $(basename $@).obj $(basename $@).o - $(OBJCOPY) -O binary $(basename $@).obj $@ diff --git a/c/src/lib/libbsp/i386/pc386/start/start.s b/c/src/lib/libbsp/i386/pc386/start/start.s deleted file mode 100644 index 323aa3d088..0000000000 --- a/c/src/lib/libbsp/i386/pc386/start/start.s +++ /dev/null @@ -1,202 +0,0 @@ -/*-------------------------------------------------------------------------+ -| start.s v1.1 - PC386 BSP - 1997/08/07 -+--------------------------------------------------------------------------+ -| This file contains the entry point for the application. -| The name of this entry point is compiler dependent. -| It jumps to the BSP which is responsible for performing all initialization. -+--------------------------------------------------------------------------+ -| (C) Copyright 1997 - -| - NavIST Group - Real-Time Distributed Systems and Industrial Automation -| -| http://pandora.ist.utl.pt -| -| Instituto Superior Tecnico * Lisboa * PORTUGAL -+--------------------------------------------------------------------------+ -| Modified the 20/05/1998 by valette@crf.canon.fr in order to give a working -| example of eraly stage debugging via the DEBUG_EARLY_START define. -+--------------------------------------------------------------------------+ -| Disclaimer: -| -| This file is provided "AS IS" without warranty of any kind, either -| expressed or implied. -+--------------------------------------------------------------------------+ -| This code is based on an earlier generation RTEMS i386 start.s and the -| following copyright applies: -| -| ************************************************************************** -| * COPYRIGHT (c) 1989-1998. -| * On-Line Applications Research Corporation (OAR). -| * Copyright assigned to U.S. Government, 1994. -| * -| * 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$ -+--------------------------------------------------------------------------*/ - -/* - * The most trivial start.s possible. It does not know anything - * about system it is running on, so it will jump to appropriate - * place in BSP specific place to do things it knows nothing about - */ - -#include "asm.h" - -/*----------------------------------------------------------------------------+ -| Size of heap and stack: -+----------------------------------------------------------------------------*/ - -.set STACK_SIZE, 0x1000 - -/*----------------------------------------------------------------------------+ -| CODE section -+----------------------------------------------------------------------------*/ - -BEGIN_CODE - - PUBLIC (start) # GNU default entry point - - EXTERN (boot_card) - EXTERN (_load_segments) - EXTERN (_return_to_monitor) - EXTERN (_IBMPC_initVideo) - EXTERN (debugPollingGetChar) - EXTERN (checkCPUtypeSetCr0) - - -/* - * In case this crashes on your machine and this is not due - * to video mode set by the loader, you may try to define - * the following variable: - */ -/* #define DEBUG_EARLY_START */ - -SYM (start): - /* - * When things are really, REALLY!, bad -- turn on the speaker and - * lock up. This shows whether or not we make it to a certain - * location. - */ -#if 0 - inb $0x61, al - orb $0x03, al - outb al, $0x61 # enable the speaker -speakl: jmp speakl # and SPIN!!! -#endif - - nop - cli # DISABLE INTERRUPTS!!! - cld -#ifdef DEBUG_EARLY_START - /* - * Must get video attribute to have a working printk. - * Note that the following code assume we already have - * valid segments and a stack. It should be true for - * any loader starting RTEMS in protected mode (or - * at least I hope so : -)). - */ - call _IBMPC_initVideo - /* - * try printk and a getchar in polling mode ASAP - */ - pushl $welcome_msg - call printk - addl $4, esp - - /* call debugPollingGetChar */ - -#endif - -/*----------------------------------------------------------------------------+ -| Load the segment registers (this is done by the board's BSP) and perform any -| other board specific initialization procedures, this piece of code -| does not know anything about -| -| NOTE: Upon return, gs will contain the segment descriptor for a segment which -| maps directly to all of physical memory. -+----------------------------------------------------------------------------*/ - - jmp SYM (_load_segments) # load board dependent segments - -/*----------------------------------------------------------------------------+ -| Set up the stack -+----------------------------------------------------------------------------*/ - - PUBLIC (_establish_stack) -SYM (_establish_stack): - - movl $_end, eax # eax = end of bss/start of heap - addl $STACK_SIZE, eax # make room for stack - andl $0xffffffc0, eax # align it on 16 byte boundary - movl eax, esp # set stack pointer - movl eax, ebp # set base pointer - -/*----------------------------------------------------------------------------+ -| Zero out the BSS segment -+----------------------------------------------------------------------------*/ - -SYM (zero_bss): - cld # make direction flag count up - movl $ SYM (_end), ecx # find end of .bss - movl $ SYM (_bss_start), edi # edi = beginning of .bss - subl edi, ecx # ecx = size of .bss in bytes - shrl ecx # size of .bss in longs - shrl ecx - xorl eax, eax # value to clear out memory - repne # while ecx != 0 - stosl # clear a long in the bss - -/*---------------------------------------------------------------------+ -| Check CPU type. Enable Cache and init coprocessor if needed. -+---------------------------------------------------------------------*/ - call checkCPUtypeSetCr0 -/*---------------------------------------------------------------------+ -| Transfer control to User's Board Support Package -+---------------------------------------------------------------------*/ - - pushl $0 # environp - pushl $0 # argv - pushl $0 # argc - call SYM (boot_card) - addl $12, esp - -/*---------------------------------------------------------------------+ -| Clean up - we do not know anything about it, so we will -| jump to BSP specific code to do cleanup -+---------------------------------------------------------------------*/ - - jmp SYM (_return_to_monitor) - -END_CODE - -BEGIN_DATA - - PUBLIC(_stack_size) -SYM(_stack_size): - .long STACK_SIZE - -#ifdef DEBUG_EARLY_START - - PUBLIC (welcome_msg) -SYM (welcome_msg) : - .string "Ready to debug RTEMS ?\nEnter <CR>\n" - - PUBLIC (hex_msg) -SYM (hex_msg) : - .string "0x%x\n" - - PUBLIC (made_it_msg) -SYM (made_it_msg) : - .string "made it to %d\n" - -#endif - -END_DATA - -END - - - - diff --git a/c/src/lib/libbsp/i386/pc386/start/start16.s b/c/src/lib/libbsp/i386/pc386/start/start16.s deleted file mode 100644 index 4b12408cd6..0000000000 --- a/c/src/lib/libbsp/i386/pc386/start/start16.s +++ /dev/null @@ -1,183 +0,0 @@ -/*-------------------------------------------------------------------------+ -| start16.s v1.0 - PC386 BSP - 1998/04/13 -+--------------------------------------------------------------------------+ -| This file contains the entry point for the application. -| The name of this entry point is compiler dependent. -| It jumps to the BSP which is responsible for performing all initialization. -+--------------------------------------------------------------------------+ -| (C) Copyright 1997 - -| - NavIST Group - Real-Time Distributed Systems and Industrial Automation -| -| http://pandora.ist.utl.pt -| -| Instituto Superior Tecnico * Lisboa * PORTUGAL -+--------------------------------------------------------------------------+ -| Disclaimer: -| -| This file is provided "AS IS" without warranty of any kind, either -| expressed or implied. -+--------------------------------------------------------------------------+ -| This code is partly based on (from the Linux source tree): -| video.S - Copyright (C) 1995, 1996 Martin Mares <mj@k332.feld.cvut.cz> -+--------------------------------------------------------------------------*/ - - -/*----------------------------------------------------------------------------+ -| Constants -+----------------------------------------------------------------------------*/ - -.set PROT_CODE_SEG, 0x08 # offset of code segment descriptor into GDT -.set PROT_DATA_SEG, 0x10 # offset of code segment descriptor into GDT -.set CR0_PE, 1 # protected mode flag on CR0 register -.set HDRSTART, HEADERADDR # address of start of bin2boot header -.set HDROFF, 0x24 # offset into bin2boot header of start32 addr -.set STACKOFF, 0x200-0x10 # offset to load into %esp, from start of image - - /* #define NEW_GAS */ -/*----------------------------------------------------------------------------+ -| CODE section -+----------------------------------------------------------------------------*/ - -.text - - .globl _start16 # entry point - .globl start16 -start16: -_start16: - -.code16 - - cli # DISABLE INTERRUPTS!!! - - movw %cs, %ax # - movw %ax, %ds # set the rest of real mode registers - movw %ax, %es # - movw %ax, %ss # - -#if defined(RTEMS_VIDEO_80x50) - - /*---------------------------------------------------------------------+ - | Switch VGA video to 80 lines x 50 columns mode. Has to be done before - | turning protected mode on since it uses BIOS int 10h (video) services. - +---------------------------------------------------------------------*/ - - movw $0x0003, %ax # forced set - int $0x10 - movw $0x1112, %ax # use 8x8 font - xorb %bl, %bl - int $0x10 - movw $0x1201, %ax # turn off cursor emulation - movb $0x34, %bl - int $0x10 - movb $0x01, %ah # define cursor (scan lines 0 to 7) - movw $0x0007, %cx - int $0x10 - -#endif /* RTEMS_VIDEO_80x50 */ - - /*---------------------------------------------------------------------+ - | Bare PC machines boot in real mode! We have to turn protected mode on. - +---------------------------------------------------------------------*/ -#ifdef NEW_GAS - data32 - addr32 -#endif - lgdt gdtptr - start16 # load Global Descriptor Table - movl %cr0, %eax - orl $CR0_PE, %eax - movl %eax, %cr0 # turn on protected mode - -#ifdef NEW_GAS - ljmpl $PROT_CODE_SEG, $1f # flush prefetch queue, and reload %cs -#else - ljmp $PROT_CODE_SEG, $1f # flush prefetch queue, and reload %cs -#endif -.code32 -1: - /*---------------------------------------------------------------------+ - | load the other segment registers - +---------------------------------------------------------------------*/ - movl $PROT_DATA_SEG, %eax - movl %ax, %ds - movl %ax, %es - movl %ax, %ss - movl $start16 + STACKOFF, %esp # set up stack pointer - addl $start16 + STACKOFF, %ebp # set up stack pointer - - /*---------------------------------------------------------------------+ - | we have to enable A20 in order to access memory above 1MByte - +---------------------------------------------------------------------*/ - call empty_8042 - movb $0xD1, %al # command write - outb %al, $0x64 - call empty_8042 - movb $0xDF, %al # A20 on - outb %al, $0x60 - call empty_8042 - - movl %cs:HDRSTART + HDROFF, %eax # - pushl %eax # jump to start of 32 bit code - ret # - -/*----------------------------------------------------------------------------+ -| delay -+------------------------------------------------------------------------------ -| Delay is needed after doing I/O. We do it by writing to a non-existent port. -+----------------------------------------------------------------------------*/ - .globl _delay - .globl delay -delay: -_delay: - outb %al, $0xED # about 1uS delay - ret - -/*----------------------------------------------------------------------------+ -| empty_8042 -+------------------------------------------------------------------------------ -| This routine checks that the keyboard command queue is empty (after emptying -| the output buffers). -| No timeout is used - if this hangs there is something wrong with the machine, -| and we probably couldn't proceed anyway. -+----------------------------------------------------------------------------*/ - .globl _empty_8042 - .globl empty_8042 -empty_8042: -_empty_8042: - call delay - inb $0x64, %al # 8042 status port - testb $0x01, %al # output buffer? - jz no_output - call delay - in $0x60, %al # read it - jmp empty_8042 -no_output: - test $0x02, %al # is input buffer full? - jnz empty_8042 # yes - loop - ret - -/*----------------------------------------------------------------------------+ -| DATA section -+----------------------------------------------------------------------------*/ - -/************************** -* GLOBAL DESCRIPTOR TABLE * -**************************/ - - .p2align 4 -gdtptr: - /* we use the NULL descriptor to store the GDT pointer - a trick quite - nifty due to: Robert Collins (rcollins@x86.org) */ - .word gdtlen - 1 - .long gdtptr - .word 0x0000 - - /* code segment */ - .word 0xffff, 0 - .byte 0, 0x9f, 0xcf, 0 - - /* data segment */ - .word 0xffff, 0 - .byte 0, 0x93, 0xcf, 0 - - .set gdtlen, . - gdtptr # length of GDT - diff --git a/c/src/lib/libbsp/i386/pc386/startup/Makefile.in b/c/src/lib/libbsp/i386/pc386/startup/Makefile.in deleted file mode 100644 index c0da505e2d..0000000000 --- a/c/src/lib/libbsp/i386/pc386/startup/Makefile.in +++ /dev/null @@ -1,59 +0,0 @@ -# -# $Id$ -# - -@SET_MAKE@ -srcdir = @srcdir@ -VPATH = @srcdir@:@srcdir@/../../../shared:@srcdir@/../../shared/irq:@srcdir@/../../shared/comm:@srcdir@/../../shared/pci -RTEMS_ROOT = @top_srcdir@ -PROJECT_ROOT = @PROJECT_ROOT@ - -PGM=${ARCH}/startup.rel - -# C source names, if any, go here -- minus the .c -C_PIECES=bsplibc bsppost bspstart exit irq irq_init main sbrk i386-stub i386-stub-glue uart pcibios -C_FILES=$(C_PIECES:%=%.c) -C_O_FILES=$(C_PIECES:%=${ARCH}/%.o) - -H_FILES= - -# Assembly source names, if any, go here -- minus the .s -S_PIECES=ldsegs irq_asm -S_FILES=$(S_PIECES:%=%.s) -S_O_FILES=$(S_FILES:%.s=${ARCH}/%.o) - -SRCS=$(srcdir)/linkcmds $(C_FILES) $(H_FILES) $(S_FILES) -OBJS=$(C_O_FILES) $(S_O_FILES) - -include $(RTEMS_ROOT)/make/custom/$(RTEMS_BSP).cfg -include $(RTEMS_ROOT)/make/leaf.cfg - -# -# (OPTIONAL) Add local stuff here using += -# - -DEFINES += -CPPFLAGS += -CFLAGS += - -LD_PATHS += -LD_LIBS += -LDFLAGS += - -# -# Add your list of files to delete here. The config files -# already know how to delete some stuff, so you may want -# to just run 'make clean' first to see what gets missed. -# 'make clobber' already includes 'make clean' -# - -CLEAN_ADDITIONS += -CLOBBER_ADDITIONS += - -${PGM}: ${SRCS} ${OBJS} - $(make-rel) -all: ${ARCH} $(SRCS) $(PGM) - $(INSTALL) $(srcdir)/linkcmds ${PROJECT_RELEASE}/lib - -# the .rel file built here will be put into libbsp.a by ../wrapup/Makefile - diff --git a/c/src/lib/libbsp/i386/pc386/startup/bspstart.c b/c/src/lib/libbsp/i386/pc386/startup/bspstart.c deleted file mode 100644 index a14ff0521f..0000000000 --- a/c/src/lib/libbsp/i386/pc386/startup/bspstart.c +++ /dev/null @@ -1,209 +0,0 @@ -/*-------------------------------------------------------------------------+ -| This file contains the PC386 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. -+--------------------------------------------------------------------------+ -| (C) Copyright 1997 - -| - NavIST Group - Real-Time Distributed Systems and Industrial Automation -| -| http://pandora.ist.utl.pt -| -| Instituto Superior Tecnico * Lisboa * PORTUGAL -+--------------------------------------------------------------------------+ -| Disclaimer: -| -| This file is provided "AS IS" without warranty of any kind, either -| expressed or implied. -+--------------------------------------------------------------------------+ -| This code is based on: -| bspstart.c,v 1.8 1996/05/28 13:12:40 joel Exp - go32 BSP -| With the following copyright notice: -| ************************************************************************** -| * COPYRIGHT (c) 1989-1998. -| * On-Line Applications Research Corporation (OAR). -| * Copyright assigned to U.S. Government, 1994. -| * -| * The license and distribution terms for this file may be -| * found in found in the file LICENSE in this distribution or at -| * http://www.OARcorp.com/rtems/license.html. -| ************************************************************************** -| -| $Id$ -+--------------------------------------------------------------------------*/ - - -#include <bsp.h> -#include <libcsupport.h> -#include <rtems/libio.h> -#include <libcpu/cpuModel.h> - -/*-------------------------------------------------------------------------+ -| Global Variables -+--------------------------------------------------------------------------*/ -extern rtems_unsigned32 _end; /* End of BSS. Defined in 'linkcmds'. */ -/* - * Size of heap if it is 0 it will be dynamically defined by memory size, - * otherwise the value should be changed by binary patch - */ -rtems_unsigned32 _heap_size = 0; - -/* Size of stack used during initialization. Defined in 'start.s'. */ -extern rtems_unsigned32 _stack_size; - -rtems_unsigned32 rtemsFreeMemStart; - /* Address of start of free memory - should be updated - after creating new partitions or regions. */ - -/* 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; /* Program name - from main(). */ - -/*-------------------------------------------------------------------------+ -| External Prototypes -+--------------------------------------------------------------------------*/ -extern void rtems_irq_mngt_init(void); -void bsp_libc_init( void *, unsigned32, 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) -{ - rtems_unsigned32 topAddr, val; - int i; - - - if (rtemsFreeMemStart & (CPU_ALIGNMENT - 1)) /* not aligned => align it */ - rtemsFreeMemStart = (rtemsFreeMemStart+CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1); - - if(_heap_size == 0) - { - /* - * We have to dynamically size memory. Memory size can be anything - * between 2M and 2048M. - * let us first write - */ - for(i=2048; i>=2; i--) - { - topAddr = i*1024*1024 - 4; - *(volatile rtems_unsigned32 *)topAddr = topAddr; - } - - for(i=2; i<=2048; i++) - { - topAddr = i*1024*1024 - 4; - val = *(rtems_unsigned32 *)topAddr; - if(val != topAddr) - { - break; - } - } - - topAddr = (i-1)*1024*1024 - 4; - - _heap_size = topAddr - rtemsFreeMemStart; - } - - bsp_libc_init((void *)rtemsFreeMemStart, _heap_size, 0); - rtemsFreeMemStart += _heap_size; /* HEAP_SIZE in KBytes */ - - -#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( void ) -{ - /* - * Calibrate variable for 1ms-loop (see timer.c) - */ - Calibrate_loop_1ms(); - - /* - * Initialize printk channel - */ - - _IBMPC_initVideo(); - - rtemsFreeMemStart = (rtems_unsigned32)&_end + _stack_size; - /* set the value of start of free memory. */ - - /* 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; - /* do not override system IDLE task */ - Cpu_table.do_zero_of_workspace = TRUE; - Cpu_table.interrupt_table_segment = get_ds(); - Cpu_table.interrupt_table_offset = (void *)Interrupt_descriptor_table; - Cpu_table.interrupt_stack_size = 4096; - Cpu_table.extra_mpci_receive_server_stack = 0; - - /* Place RTEMS workspace at beginning of free memory. */ - - if (rtemsFreeMemStart & (CPU_ALIGNMENT - 1)) /* not aligned => align it */ - rtemsFreeMemStart = (rtemsFreeMemStart+CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1); - - BSP_Configuration.work_space_start = (void *)rtemsFreeMemStart; - rtemsFreeMemStart += BSP_Configuration.work_space_size; - - console_reserve_resources(&BSP_Configuration); - - /* - * Init rtems interrupt management - */ - rtems_irq_mngt_init(); - /* - * Init rtems exceptions management - */ - rtems_exception_init_mngt(); - /* - * 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 -} /* bsp_start */ diff --git a/c/src/lib/libbsp/i386/pc386/startup/exit.c b/c/src/lib/libbsp/i386/pc386/startup/exit.c deleted file mode 100644 index c37888f003..0000000000 --- a/c/src/lib/libbsp/i386/pc386/startup/exit.c +++ /dev/null @@ -1,61 +0,0 @@ -/*-------------------------------------------------------------------------+ -| exit.c v1.1 - PC386 BSP - 1997/08/07 -+--------------------------------------------------------------------------+ -| Routines to shutdown and reboot the PC. -+--------------------------------------------------------------------------+ -| (C) Copyright 1997 - -| - NavIST Group - Real-Time Distributed Systems and Industrial Automation -| -| http://pandora.ist.utl.pt -| -| Instituto Superior Tecnico * Lisboa * PORTUGAL -+--------------------------------------------------------------------------+ -| Disclaimer: -| -| This file is provided "AS IS" without warranty of any kind, either -| expressed or implied. -+--------------------------------------------------------------------------+ -| This code is based on: -| exit.c,v 1.2 1995/12/19 20:07:36 joel Exp - go32 BSP -| With the following copyright notice: -| ************************************************************************** -| * COPYRIGHT (c) 1989-1998. -| * On-Line Applications Research Corporation (OAR). -| * Copyright assigned to U.S. Government, 1994. -| * -| * The license and distribution terms for this file may be -| * found in found in the file LICENSE in this distribution or at -| * http://www.OARcorp.com/rtems/license.html. -| ************************************************************************** -| -| $Id$ -+--------------------------------------------------------------------------*/ - - -#include <stdio.h> -#include <bsp.h> -#include <rtems/libio.h> -#include <uart.h> - -void bsp_cleanup(void) -{ - unsigned char ch; - static char line[]="EXECUTIVE SHUTDOWN! Any key to reboot..."; - /* - * AT this point, the console driver is disconnected => we must - * use polled output/input. This is exactly what printk - * does. - */ - printk("\n"); - printk(line); - ch = BSP_poll_char(); - rtemsReboot(); -} - - - - - - - - diff --git a/c/src/lib/libbsp/i386/pc386/startup/ldsegs.s b/c/src/lib/libbsp/i386/pc386/startup/ldsegs.s deleted file mode 100644 index 8805128e69..0000000000 --- a/c/src/lib/libbsp/i386/pc386/startup/ldsegs.s +++ /dev/null @@ -1,222 +0,0 @@ -/*-------------------------------------------------------------------------+ -| ldsegs.s v1.1 - PC386 BSP - 1997/08/07 -+--------------------------------------------------------------------------+ -| This file assists the board independent startup code by loading the proper -| segment register values. The values loaded are board dependent. In addition -| it contains code to enable the A20 line and to reprogram the PIC to relocate -| the IRQ interrupt vectors to 0x20 -> 0x2f. -| NOTE: No stack has been established when this routine is invoked. -| It returns by jumping back to bspentry. -+--------------------------------------------------------------------------+ -| (C) Copyright 1997 - -| - NavIST Group - Real-Time Distributed Systems and Industrial Automation -| -| http://pandora.ist.utl.pt -| -| Instituto Superior Tecnico * Lisboa * PORTUGAL -+--------------------------------------------------------------------------+ -| Disclaimer: -| -| This file is provided "AS IS" without warranty of any kind, either -| expressed or implied. -+--------------------------------------------------------------------------+ -| This code is base on: -| ldsegs.s,v 1.4 1996/04/20 16:48:30 joel Exp - go32 BSP -| With the following copyright notice: -| ************************************************************************** -| * COPYRIGHT (c) 1989-1998. -| * On-Line Applications Research Corporation (OAR). -| * Copyright assigned to U.S. Government, 1994. -| * -| * The license and distribution terms for this file may be -| * found in found in the file LICENSE in this distribution or at -| * http://www.OARcorp.com/rtems/license.html. -| ************************************************************************** -| -| $Id$ -| -| Also based on (from the Linux source tree): -| setup.S - Copyright (C) 1991, 1992 Linus Torvalds -+--------------------------------------------------------------------------*/ - - -#include "asm.h" - -/*----------------------------------------------------------------------------+ -| CODE section -+----------------------------------------------------------------------------*/ -EXTERN (rtems_i8259_masks) - -BEGIN_CODE - - EXTERN (_establish_stack) - EXTERN (Timer_exit) - EXTERN (clockOff) - - .p2align 4 -/*----------------------------------------------------------------------------+ -| delay -+------------------------------------------------------------------------------ -| Delay is needed after doing I/O. We do it by writing to a non-existent port. -+----------------------------------------------------------------------------*/ -SYM(delay): - outb al, $0xED # about 1uS delay - ret - -/*-------------------------------------------------------------------------+ -| Function: _load_segments -| Description: Current environment is standard PC booted by grub. -| So, there is no value in saving current GDT and IDT -| settings we have to set it up ourseves. (Naturally -| it will be not so in case we are booted by some -| boot monitor, however, then it will be different -| BSP). After that we have to load board segment registers -| with apropriate values + reprogram PIC. -| Global Variables: None. -| Arguments: None. -| Returns: Nothing. -+--------------------------------------------------------------------------*/ - .p2align 4 - - PUBLIC (_load_segments) -SYM (_load_segments): - - lgdt SYM(gdtdesc) - lidt SYM(idtdesc) - - /* Load CS, flush prefetched queue */ - ljmp $0x8, $next_step - -next_step: - /* Load segment registers */ - movw $0x10, ax - movw ax, ss - movw ax, ds - movw ax, es - movw ax, fs - movw ax, gs - -/*---------------------------------------------------------------------+ -| Now we have to reprogram the interrupts :-(. We put them right after -| the intel-reserved hardware interrupts, at int 0x20-0x2F. There they -| won't mess up anything. Sadly IBM really messed this up with the -| original PC, and they haven't been able to rectify it afterwards. Thus -| the bios puts interrupts at 0x08-0x0f, which is used for the internal -| hardware interrupts as well. We just have to reprogram the 8259's, and -| it isn't fun. -+---------------------------------------------------------------------*/ - - movb $0x11, al /* initialization sequence */ - outb al, $0x20 /* send it to 8259A-1 */ - call SYM(delay) - outb al, $0xA0 /* and to 8259A-2 */ - call SYM(delay) - - movb $0x20, al /* start of hardware int's (0x20) */ - outb al, $0x21 - call SYM(delay) - movb $0x28, al /* start of hardware int's 2 (0x28) */ - outb al, $0xA1 - call SYM(delay) - - movb $0x04, al /* 8259-1 is master */ - outb al, $0x21 - call SYM(delay) - movb $0x02, al /* 8259-2 is slave */ - outb al, $0xA1 - call SYM(delay) - - movb $0x01, al /* 8086 mode for both */ - outb al, $0x21 - call SYM(delay) - outb al, $0xA1 - call SYM(delay) - - movb $0xFF, al /* mask off all interrupts for now */ - outb al, $0xA1 - call SYM(delay) - movb $0xFB, al /* mask all irq's but irq2 which */ - outb al, $0x21 /* is cascaded */ - call SYM(delay) - - movw $0xFFFB, SYM(i8259s_cache) /* set up same values in cache */ - - jmp SYM (_establish_stack) # return to the bsp entry code - -/*-------------------------------------------------------------------------+ -| Function: _return_to_monitor -| Description: Return to board's monitor (we have none so simply restart). -| Global Variables: None. -| Arguments: None. -| Returns: Nothing. -+--------------------------------------------------------------------------*/ - - .p2align 4 - - PUBLIC (_return_to_monitor) -SYM (_return_to_monitor): - - call SYM (Timer_exit) - call SYM (Clock_exit) - jmp SYM (start) - -/*-------------------------------------------------------------------------+ -| Function: _default_int_handler -| Description: default interrupt handler -| Global Variables: None. -| Arguments: None. -| Returns: Nothing. -+--------------------------------------------------------------------------*/ - .p2align 4 - -/*---------------------------------------------------------------------------+ -| GDT itself -+--------------------------------------------------------------------------*/ - - .p2align 4 - - PUBLIC (_Global_descriptor_table) -SYM (_Global_descriptor_table): - - /* NULL segment */ - .word 0, 0 - .byte 0, 0, 0, 0 - - /* code segment */ - .word 0xffff, 0 - .byte 0, 0x9e, 0xcf, 0 - - /* data segment */ - .word 0xffff, 0 - .byte 0, 0x92, 0xcf, 0 - - -/*---------------------------------------------------------------------------+ -| Descriptor of GDT -+--------------------------------------------------------------------------*/ -SYM (gdtdesc): - .word (3*8 - 1) - .long SYM (_Global_descriptor_table) - - -/*---------------------------------------------------------------------------+ -| IDT itself -+---------------------------------------------------------------------------*/ - .p2align 4 - - PUBLIC(Interrupt_descriptor_table) -SYM(Interrupt_descriptor_table): - .rept 256 - .word 0,0,0,0 - .endr - -/*---------------------------------------------------------------------------+ -| Descriptor of IDT -+--------------------------------------------------------------------------*/ -SYM(idtdesc): - .word (256*8 - 1) - .long SYM (Interrupt_descriptor_table) - -END_CODE - -END diff --git a/c/src/lib/libbsp/i386/pc386/startup/linkcmds b/c/src/lib/libbsp/i386/pc386/startup/linkcmds deleted file mode 100644 index 5dd7a675a3..0000000000 --- a/c/src/lib/libbsp/i386/pc386/startup/linkcmds +++ /dev/null @@ -1,87 +0,0 @@ -/*-------------------------------------------------------------------------+ -| linkcmds v1.1 - PC386 BSP - 1997/08/07 -+--------------------------------------------------------------------------+ -| This file contains directives for the GNU linker which are specific to the -| PC386 bsp. -+--------------------------------------------------------------------------+ -| (C) Copyright 1997 - -| - NavIST Group - Real-Time Distributed Systems and Industrial Automation -| -| http://pandora.ist.utl.pt -| -| Instituto Superior Tecnico * Lisboa * PORTUGAL -+--------------------------------------------------------------------------+ -| Disclaimer: -| -| This file is provided "AS IS" without warranty of any kind, either -| expressed or implied. -+--------------------------------------------------------------------------+ -| This code is based on: -| linkcmds,v 1.3 1995/12/19 20:06:58 joel Exp - FORCE CPU386 BSP -| With the following copyright notice: -| ************************************************************************** -| * COPYRIGHT (c) 1989-1998. -| * On-Line Applications Research Corporation (OAR). -| * Copyright assigned to U.S. Government, 1994. -| * -| * The license and distribution terms for this file may be -| * found in found in the file LICENSE in this distribution or at -| * http://www.OARcorp.com/rtems/license.html. -| ************************************************************************** -| -| $Id$ -+--------------------------------------------------------------------------*/ - - -SECTIONS -{ - .text : - { - _text_start = . ; - *(.text) - . = ALIGN (16); - - *(.eh_frame) - . = ALIGN (16); - - *(.gnu.linkonce.t*) - - /* - * C++ constructors - */ - __CTOR_LIST__ = .; - LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2) - *(.ctors) - LONG(0) - __CTOR_END__ = .; - __DTOR_LIST__ = .; - LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2) - *(.dtors) - LONG(0) - __DTOR_END__ = .; - - _rodata_start = . ; - *(.rodata) - *(.gnu.linkonce.r*) - _erodata = ALIGN( 0x10 ) ; - - _etext = ALIGN( 0x10 ) ; - } - .data ADDR( .text ) + SIZEOF( .text ): - { - _data_start = . ; - *(.data) - *(.gnu.linkonce.d*) - *(.gcc_except_table) - _edata = ALIGN( 0x10 ) ; - } - - .bss ADDR( .data ) + SIZEOF( .data ): - { - _bss_start = . ; - *(.bss) - *(COMMON) - _end = . ; - __end = . ; - } -} diff --git a/c/src/lib/libbsp/i386/pc386/startup/sbrk.c b/c/src/lib/libbsp/i386/pc386/startup/sbrk.c deleted file mode 100644 index 36f0573159..0000000000 --- a/c/src/lib/libbsp/i386/pc386/startup/sbrk.c +++ /dev/null @@ -1,52 +0,0 @@ -/*-------------------------------------------------------------------------+ -| sbrk.c v1.1 - PC386 BSP - 1997/08/07 -+--------------------------------------------------------------------------+ -| If the BSP wants to dynamically allocate the memory for the C Library heap -| (malloc) and/or be able to extend the heap, then this routine must be -| functional. RTEMS newlib suppport has an implementation of malloc using -| RTEMS regions => the user can do mallocs. -+--------------------------------------------------------------------------+ -| (C) Copyright 1997 - -| - NavIST Group - Real-Time Distributed Systems and Industrial Automation -| -| http://pandora.ist.utl.pt -| -| Instituto Superior Tecnico * Lisboa * PORTUGAL -+--------------------------------------------------------------------------+ -| Disclaimer: -| -| This file is provided "AS IS" without warranty of any kind, either -| expressed or implied. -+--------------------------------------------------------------------------+ -| This code is based on: -| sbrk.c,v 1.2 1995/12/19 20:07:38 joel Exp - go32 BSP -| With the following copyright notice: -| ************************************************************************** -| * COPYRIGHT (c) 1989-1998. -| * On-Line Applications Research Corporation (OAR). -| * Copyright assigned to U.S. Government, 1994. -| * -| * The license and distribution terms for this file may be -| * found in found in the file LICENSE in this distribution or at -| * http://www.OARcorp.com/rtems/license.html. -| ************************************************************************** -| -| $Id$ -+--------------------------------------------------------------------------*/ - - -#include <errno.h> -#include <sys/types.h> - -/*-------------------------------------------------------------------------+ -| Function: sbrk -| Description: Stub for sbrk. -| Global Variables: None. -| Arguments: Not relevant. -| Returns: Not relevant. -+--------------------------------------------------------------------------*/ -void *sbrk(size_t incr) -{ - errno = EINVAL; - return (void *)NULL; -} /* sbrk */ diff --git a/c/src/lib/libbsp/i386/pc386/timer/Makefile.in b/c/src/lib/libbsp/i386/pc386/timer/Makefile.in deleted file mode 100644 index 24809cbed8..0000000000 --- a/c/src/lib/libbsp/i386/pc386/timer/Makefile.in +++ /dev/null @@ -1,59 +0,0 @@ -# -# $Id$ -# - -@SET_MAKE@ -srcdir = @srcdir@ -VPATH = @srcdir@ -RTEMS_ROOT = @top_srcdir@ -PROJECT_ROOT = @PROJECT_ROOT@ - -PGM=${ARCH}/timer.rel - -# C source names, if any, go here -- minus the .c -C_PIECES=timer -C_FILES=$(C_PIECES:%=%.c) -C_O_FILES=$(C_PIECES:%=${ARCH}/%.o) - -H_FILES= - -# Assembly source names, if any, go here -- minus the .s -S_PIECES=timerisr -S_FILES=$(S_PIECES:%=%.s) -S_O_FILES=$(S_FILES:%.s=${ARCH}/%.o) - -SRCS=$(C_FILES) $(H_FILES) $(S_FILES) -OBJS=$(C_O_FILES) $(S_O_FILES) - -include $(RTEMS_ROOT)/make/custom/$(RTEMS_BSP).cfg -include $(RTEMS_ROOT)/make/leaf.cfg - -# -# (OPTIONAL) Add local stuff here using += -# - -DEFINES += -CPPFLAGS += -CFLAGS += - -LD_PATHS += -LD_LIBS += -LDFLAGS += - -# -# Add your list of files to delete here. The config files -# already know how to delete some stuff, so you may want -# to just run 'make clean' first to see what gets missed. -# 'make clobber' already includes 'make clean' -# - -CLEAN_ADDITIONS += -CLOBBER_ADDITIONS += - -${PGM}: ${SRCS} ${OBJS} - $(make-rel) - -all: ${ARCH} $(SRCS) $(PGM) - -# the .rel file built here will be put into libbsp.a by ../wrapup/Makefile -install: all diff --git a/c/src/lib/libbsp/i386/pc386/timer/timer.c b/c/src/lib/libbsp/i386/pc386/timer/timer.c deleted file mode 100644 index 4c83b309dd..0000000000 --- a/c/src/lib/libbsp/i386/pc386/timer/timer.c +++ /dev/null @@ -1,394 +0,0 @@ -/*-------------------------------------------------------------------------+ -| timer.c v1.1 - PC386 BSP - 1997/08/07 -+--------------------------------------------------------------------------+ -| This file contains the PC386 timer package. -+--------------------------------------------------------------------------+ -| NOTE: It is important that the timer start/stop overhead be determined -| when porting or modifying this code. -+--------------------------------------------------------------------------+ -| (C) Copyright 1997 - -| - NavIST Group - Real-Time Distributed Systems and Industrial Automation -| -| http://pandora.ist.utl.pt -| -| Instituto Superior Tecnico * Lisboa * PORTUGAL -+--------------------------------------------------------------------------+ -| Disclaimer: -| -| This file is provided "AS IS" without warranty of any kind, either -| expressed or implied. -+--------------------------------------------------------------------------+ -| This code is base on: -| timer.c,v 1.7 1995/12/19 20:07:43 joel Exp - go32 BSP -| With the following copyright notice: -| ************************************************************************** -| * COPYRIGHT (c) 1989-1998. -| * On-Line Applications Research Corporation (OAR). -| * Copyright assigned to U.S. Government, 1994. -| * -| * The license and distribution terms for this file may be -| * found in found in the file LICENSE in this distribution or at -| * http://www.OARcorp.com/rtems/license.html. -| ************************************************************************** -| -| $Id$ -+--------------------------------------------------------------------------*/ - - -#include <stdlib.h> - -#include <bsp.h> -#include <irq.h> - -/*-------------------------------------------------------------------------+ -| Constants -+--------------------------------------------------------------------------*/ -#define AVG_OVERHEAD 0 /* 0.1 microseconds to start/stop timer. */ -#define LEAST_VALID 1 /* Don't trust a value lower than this. */ -#define SLOW_DOWN_IO 0x80 /* io which does nothing */ - -#define TWO_MS (rtems_unsigned32)(2000) /* TWO_MS = 2000us (sic!) */ - -#define MSK_NULL_COUNT 0x40 /* bit counter available for reading */ - -#define CMD_READ_BACK_STATUS 0xE2 /* command read back status */ -/*-------------------------------------------------------------------------+ -| Global Variables -+--------------------------------------------------------------------------*/ -volatile rtems_unsigned32 Ttimer_val; - rtems_boolean Timer_driver_Find_average_overhead = TRUE; - unsigned int loop1ms; - -/*-------------------------------------------------------------------------+ -| External Prototypes -+--------------------------------------------------------------------------*/ -extern void timerisr(void); - /* timer (int 08h) Interrupt Service Routine (defined in 'timerisr.s') */ - -/*-------------------------------------------------------------------------+ -| Pentium optimized timer handling. -+--------------------------------------------------------------------------*/ -#if defined(pentium) - -/*-------------------------------------------------------------------------+ -| Function: rdtsc -| Description: Read the value of PENTIUM on-chip cycle counter. -| Global Variables: None. -| Arguments: None. -| Returns: Value of PENTIUM on-chip cycle counter. -+--------------------------------------------------------------------------*/ -static inline unsigned long long -rdtsc(void) -{ - /* Return the value of the on-chip cycle counter. */ - unsigned long long result; - asm volatile(".byte 0x0F, 0x31" : "=A" (result)); - return result; -} /* rdtsc */ - - -/*-------------------------------------------------------------------------+ -| Function: Timer_exit -| Description: Timer cleanup routine at RTEMS exit. NOTE: This routine is -| not really necessary, since there will be a reset at exit. -| Global Variables: None. -| Arguments: None. -| Returns: Nothing. -+--------------------------------------------------------------------------*/ -void -Timer_exit(void) -{ -} /* Timer_exit */ - - -/*-------------------------------------------------------------------------+ -| Function: Timer_initialize -| Description: Timer initialization routine. -| Global Variables: Ttimer_val. -| Arguments: None. -| Returns: Nothing. -+--------------------------------------------------------------------------*/ -void -Timer_initialize(void) -{ - static rtems_boolean First = TRUE; - - if (First) - { - First = FALSE; - - atexit(Timer_exit); /* Try not to hose the system at exit. */ - } - Ttimer_val = rdtsc(); /* read starting time */ -} /* Timer_initialize */ - - -/*-------------------------------------------------------------------------+ -| Function: Read_timer -| Description: Read hardware timer value. -| Global Variables: Ttimer_val, Timer_driver_Find_average_overhead. -| Arguments: None. -| Returns: Nothing. -+--------------------------------------------------------------------------*/ -rtems_unsigned32 -Read_timer(void) -{ - register rtems_unsigned32 total; - - total = (rtems_unsigned32)(rdtsc() - Ttimer_val); - - if (Timer_driver_Find_average_overhead) - return total; - else if (total < LEAST_VALID) - return 0; /* below timer resolution */ - else - return (total - AVG_OVERHEAD); -} /* Read_timer */ - -#else /* pentium */ - -/*-------------------------------------------------------------------------+ -| Non-Pentium timer handling. -+--------------------------------------------------------------------------*/ -#define US_PER_ISR 250 /* Number of micro-seconds per timer interruption */ - - -/*-------------------------------------------------------------------------+ -| Function: Timer_exit -| Description: Timer cleanup routine at RTEMS exit. NOTE: This routine is -| not really necessary, since there will be a reset at exit. -| Global Variables: None. -| Arguments: None. -| Returns: Nothing. -+--------------------------------------------------------------------------*/ -static void -timerOff(const rtems_raw_irq_connect_data* used) -{ - /* - * disable interrrupt at i8259 level - */ - BSP_irq_disable_at_i8259s(used->idtIndex - BSP_IRQ_VECTOR_BASE); - /* reset timer mode to standard (DOS) value */ - outport_byte(TIMER_MODE, TIMER_SEL0|TIMER_16BIT|TIMER_RATEGEN); - outport_byte(TIMER_CNTR0, 0); - outport_byte(TIMER_CNTR0, 0); -} /* Timer_exit */ - - -static void -timerOn(const rtems_raw_irq_connect_data* used) -{ - /* load timer for US_PER_ISR microsecond period */ - outport_byte(TIMER_MODE, TIMER_SEL0|TIMER_16BIT|TIMER_RATEGEN); - outport_byte(TIMER_CNTR0, US_TO_TICK(US_PER_ISR) >> 0 & 0xff); - outport_byte(TIMER_CNTR0, US_TO_TICK(US_PER_ISR) >> 8 & 0xff); - /* - * enable interrrupt at i8259 level - */ - BSP_irq_enable_at_i8259s(used->idtIndex - BSP_IRQ_VECTOR_BASE); -} - -static int -timerIsOn(const rtems_raw_irq_connect_data *used) -{ - return BSP_irq_enabled_at_i8259s(used->idtIndex - BSP_IRQ_VECTOR_BASE);} - -static rtems_raw_irq_connect_data timer_raw_irq_data = { - BSP_PERIODIC_TIMER + BSP_IRQ_VECTOR_BASE, - timerisr, - timerOn, - timerOff, - timerIsOn -}; - -/*-------------------------------------------------------------------------+ -| Function: Timer_exit -| Description: Timer cleanup routine at RTEMS exit. NOTE: This routine is -| not really necessary, since there will be a reset at exit. -| Global Variables: None. -| Arguments: None. -| Returns: Nothing. -+--------------------------------------------------------------------------*/ -void -Timer_exit(void) -{ - i386_delete_idt_entry (&timer_raw_irq_data); -} /* Timer_exit */ - -/*-------------------------------------------------------------------------+ -| Function: Timer_initialize -| Description: Timer initialization routine. -| Global Variables: Ttimer_val. -| Arguments: None. -| Returns: Nothing. -+--------------------------------------------------------------------------*/ -void -Timer_initialize(void) -{ - static rtems_boolean First = TRUE; - - if (First) - { - First = FALSE; - - atexit(Timer_exit); /* Try not to hose the system at exit. */ - if (!i386_set_idt_entry (&timer_raw_irq_data)) { - printk("raw handler connexion failed\n"); - rtems_fatal_error_occurred(1); - } - } - /* wait for ISR to be called at least once */ - Ttimer_val = 0; - while (Ttimer_val == 0) - continue; - Ttimer_val = 0; -} /* Timer_initialize */ - - -/*-------------------------------------------------------------------------+ -| Function: Read_timer -| Description: Read hardware timer value. -| Global Variables: Ttimer_val, Timer_driver_Find_average_overhead. -| Arguments: None. -| Returns: Nothing. -+--------------------------------------------------------------------------*/ -rtems_unsigned32 -Read_timer(void) -{ - register rtems_unsigned32 total, clicks; - register rtems_unsigned8 lsb, msb; - - outport_byte(TIMER_MODE, TIMER_SEL0|TIMER_LATCH); - inport_byte(TIMER_CNTR0, lsb); - inport_byte(TIMER_CNTR0, msb); - clicks = (msb << 8) | lsb; - total = (Ttimer_val * US_PER_ISR) + (US_PER_ISR - TICK_TO_US(clicks)); - - if (Timer_driver_Find_average_overhead) - return total; - else if (total < LEAST_VALID) - return 0; /* below timer resolution */ - else - return (total - AVG_OVERHEAD); -} - -#endif /* pentium */ - - -/*-------------------------------------------------------------------------+ -| Function: Empty_function -| Description: Empty function used in time tests. -| Global Variables: None. -| Arguments: None. -| Returns: Nothing. -+--------------------------------------------------------------------------*/ -rtems_status_code Empty_function(void) -{ - return RTEMS_SUCCESSFUL; -} /* Empty function */ - - -/*-------------------------------------------------------------------------+ -| Function: Set_find_average_overhead -| Description: Set internal Timer_driver_Find_average_overhead flag value. -| Global Variables: Timer_driver_Find_average_overhead. -| Arguments: find_flag - new value of the flag. -| Returns: Nothing. -+--------------------------------------------------------------------------*/ -void -Set_find_average_overhead(rtems_boolean find_flag) -{ - Timer_driver_Find_average_overhead = find_flag; -} /* Set_find_average_overhead */ - -/*-------------------------------------------------------------------------+ -| Function: Calibrate_loop_1ms -| Description: Set loop variable to calibrate a 1ms loop -| Global Variables: loop1ms -| Arguments: none -| Returns: Nothing. -+--------------------------------------------------------------------------*/ -void -Calibrate_loop_1ms(void){ - unsigned int i; - unsigned short loadedValue, offset; - unsigned int timerValue; - rtems_interrupt_level level; - unsigned short lsb, msb; - unsigned char status; - - - loop1ms = 100 ; - timerValue = 2000; - loadedValue = US_TO_TICK(2000); - - rtems_interrupt_disable(level); - - /* - * Compute the offset to apply due to read counter register - */ - outport_byte(TIMER_MODE, TIMER_SEL0|TIMER_16BIT|TIMER_RATEGEN); - outport_byte(TIMER_CNTR0, loadedValue >> 0 & 0xff); - outport_byte(TIMER_CNTR0, loadedValue >> 8 & 0xff); - - outport_byte(TIMER_MODE, CMD_READ_BACK_STATUS); /* read Status counter 0 */ - inport_byte(TIMER_CNTR0, status); - while (status & MSK_NULL_COUNT){ /* wait for counter ready */ - outport_byte(TIMER_MODE, CMD_READ_BACK_STATUS); - inport_byte(TIMER_CNTR0, status); - } - - outport_byte(TIMER_MODE, TIMER_SEL0|TIMER_LATCH); - inport_byte(TIMER_CNTR0, lsb); - inport_byte(TIMER_CNTR0, msb); - offset = loadedValue - (unsigned short)((msb << 8) | lsb); - - while (timerValue > 1000){ - loop1ms++; - - /* load timer for 2ms+offset period */ - outport_byte(TIMER_MODE, TIMER_SEL0|TIMER_16BIT|TIMER_RATEGEN); - outport_byte(TIMER_CNTR0, (loadedValue+offset) >> 0 & 0xff); - outport_byte(TIMER_CNTR0, (loadedValue+offset) >> 8 & 0xff); - - outport_byte(TIMER_MODE, CMD_READ_BACK_STATUS); /* read Status counter 0 */ - inport_byte(TIMER_CNTR0, status); - while (status & MSK_NULL_COUNT) { /* wait for counter ready */ - outport_byte(TIMER_MODE, CMD_READ_BACK_STATUS); - inport_byte(TIMER_CNTR0, status); - } - - for (i=0; i<loop1ms; i++) - outport_byte(SLOW_DOWN_IO, 0); /* write is # 1us */ - - outport_byte(TIMER_MODE, TIMER_SEL0|TIMER_LATCH); - inport_byte(TIMER_CNTR0, lsb); - inport_byte(TIMER_CNTR0, msb); - timerValue = TICK_TO_US((msb << 8) | lsb); - } - - rtems_interrupt_enable(level); -} - -/*-------------------------------------------------------------------------+ -| Function: Wait_X_1ms -| Description: loop which waits at least timeToWait ms -| Global Variables: loop1ms -| Arguments: timeToWait -| Returns: Nothing. -+--------------------------------------------------------------------------*/ -void -Wait_X_ms( unsigned int timeToWait){ - - unsigned int i, j; - - for (j=0; j<timeToWait ; j++) - for (i=0; i<loop1ms; i++) - outport_byte(SLOW_DOWN_IO, 0); /* write is # 1us */ -} - - - - - - diff --git a/c/src/lib/libbsp/i386/pc386/timer/timerisr.s b/c/src/lib/libbsp/i386/pc386/timer/timerisr.s deleted file mode 100644 index f6670efdc1..0000000000 --- a/c/src/lib/libbsp/i386/pc386/timer/timerisr.s +++ /dev/null @@ -1,61 +0,0 @@ -/*-------------------------------------------------------------------------+ -| timerisr.s v1.1 - PC386 BSP - 1997/08/07 -+--------------------------------------------------------------------------+ -| This file contains the PC386 timer interrupt handler. -+--------------------------------------------------------------------------+ -| (C) Copyright 1997 - -| - NavIST Group - Real-Time Distributed Systems and Industrial Automation -| -| http://pandora.ist.utl.pt -| -| Instituto Superior Tecnico * Lisboa * PORTUGAL -+--------------------------------------------------------------------------+ -| Disclaimer: -| -| This file is provided "AS IS" without warranty of any kind, either -| expressed or implied. -+--------------------------------------------------------------------------+ -| This code is base on: -| timerisr.s,v 1.5 1995/12/19 20:07:45 joel Exp - go32 BSP -| With the following copyright notice: -| ************************************************************************** -| * COPYRIGHT (c) 1989-1998. -| * On-Line Applications Research Corporation (OAR). -| * Copyright assigned to U.S. Government, 1994. -| * -| * The license and distribution terms for this file may be -| * found in found in the file LICENSE in this distribution or at -| * http://www.OARcorp.com/rtems/license.html. -| ************************************************************************** -| -| $Id$ -+--------------------------------------------------------------------------*/ - - -#include "asm.h" - -BEGIN_CODE - - EXTERN(Ttimer_val) - -/*-------------------------------------------------------------------------+ -| Function: rtems_isr timerisr(rtems_vector_number); -| Description: ISR for the timer. The timer is set up to generate an -| interrupt at maximum intervals. -| Global Variables: None. -| Arguments: standard - see RTEMS documentation. -| Returns: standard return value - see RTEMS documentation. -+--------------------------------------------------------------------------*/ - PUBLIC(timerisr) -SYM (timerisr): - incl Ttimer_val # another tick - pushl eax - movb $0x20, al - outb al, $0x20 # signal generic End Of Interrupt (EOI) to PIC - popl eax - iret - -END_CODE - -END - diff --git a/c/src/lib/libbsp/i386/pc386/times_i486dx b/c/src/lib/libbsp/i386/pc386/times_i486dx deleted file mode 100644 index 49601b31d0..0000000000 --- a/c/src/lib/libbsp/i386/pc386/times_i486dx +++ /dev/null @@ -1,191 +0,0 @@ -# -# Timing Test Suite Results for the go32 BSP using an i486DX -# -# $Id$ -# - -Board: PC/AT clone -CPU: Intel i486DX -Clock Speed: 33 Mhz -Memory Configuration: DRAM w/256K cache -Wait States: unknown - -Times Reported in: microseconds -Timer Source: i8254 - -Column A: 3.5.1 pre-release -Column B: 3.5.17 pre-release - -# DESCRIPTION A B -== ================================================================= ==== ==== - 1 rtems_semaphore_create 57 66 - rtems_semaphore_delete 59 61 - rtems_semaphore_obtain: available 9 7 - rtems_semaphore_obtain: not available -- NO_WAIT 8 7 - rtems_semaphore_release: no waiting tasks 9 8 - - 2 rtems_semaphore_obtain: not available -- caller blocks 39 37 - - 3 rtems_semaphore_release: task readied -- preempts caller 25 24 - - 4 rtems_task_restart: blocked task -- preempts caller 124 102 - rtems_task_restart: ready task -- preempts caller 55 111 - rtems_semaphore_release: task readied -- returns to caller 16 15 - rtems_task_create 31 30 - rtems_task_start 19 18 - rtems_task_restart: suspended task -- returns to caller 20 19 - rtems_task_delete: suspended task 28 26 - rtems_task_restart: ready task -- returns to caller 20 19 - rtems_task_restart: blocked task -- returns to caller 28 26 - rtems_task_delete: blocked task 34 28 - - 5 rtems_task_suspend: calling task 26 23 - rtems_task_resume: task readied -- preempts caller 17 15 - - 6 rtems_task_restart: calling task 22 19 - rtems_task_suspend: returns to caller 10 8 - rtems_task_resume: task readied -- returns to caller 10 8 - rtems_task_delete: ready task 34 33 - - 7 rtems_task_restart: suspended task -- preempts caller 37 34 - - 8 rtems_task_set_priority: obtain current priority 7 5 - rtems_task_set_priority: returns to caller 13 12 - rtems_task_mode: obtain current mode 3 3 - rtems_task_mode: no reschedule 4 4 - rtems_task_mode: reschedule -- returns to caller 20 17 - rtems_task_mode: reschedule -- preempts caller 39 37 - rtems_task_set_note 7 5 - rtems_task_get_note 7 5 - rtems_clock_set 17 16 - rtems_clock_get 2 1 - - 9 rtems_message_queue_create 117 113 - rtems_message_queue_send: no waiting tasks 22 19 - rtems_message_queue_urgent: no waiting tasks 22 19 - rtems_message_queue_receive: available 18 16 - rtems_message_queue_flush: no messages flushed 15 14 - rtems_message_queue_flush: messages flushed 17 17 - rtems_message_queue_delete 63 63 - -10 rtems_message_queue_receive: not available -- NO_WAIT 10 8 - rtems_message_queue_receive: not available -- caller blocks 42 40 - -11 rtems_message_queue_send: task readied -- preempts caller 38 37 - -12 rtems_message_queue_send: task readied -- returns to caller 27 24 - -13 rtems_message_queue_urgent: task readied -- preempts caller 38 36 - -14 rtems_message_queue_urgent: task readied -- returns to caller 26 24 - -15 rtems_event_receive: obtain current events 0 0 - rtems_event_receive: not available -- NO_WAIT 6 5 - rtems_event_receive: not available -- caller blocks 34 33 - rtems_event_send: no task readied 6 5 - rtems_event_receive: available 21 19 - rtems_event_send: task readied -- returns to caller 19 15 - -16 rtems_event_send: task readied -- preempts caller 26 24 - -17 rtems_task_set_priority: preempts caller 36 33 - -18 rtems_task_delete: calling task 51 52 - -19 rtems_signal_catch 17 18 - rtems_signal_send: returns to caller 38 39 - rtems_signal_send: signal to self 46 62 - exit ASR overhead: returns to calling task 20 25 - exit ASR overhead: returns to preempting task 29 29 - -20 rtems_partition_create 65 67 - rtems_region_create 59 54 - rtems_partition_get_buffer: available 39 35 - rtems_partition_get_buffer: not available 18 16 - rtems_partition_return_buffer 36 30 - rtems_partition_delete 32 30 - rtems_region_get_segment: available 22 21 - rtems_region_get_segment: not available -- NO_WAIT 29 25 - rtems_region_return_segment: no waiting tasks 24 22 - rtems_region_get_segment: not available -- caller blocks 83 81 - rtems_region_return_segment: task readied -- preempts caller 85 84 - rtems_region_return_segment: task readied -- returns to caller 39 41 - rtems_region_delete 30 30 - rtems_io_initialize 1 1 - rtems_io_open 0 0 - rtems_io_close 0 0 - rtems_io_read 0 0 - rtems_io_write 0 0 - rtems_io_control 0 1 - -21 rtems_task_ident 116 114 - rtems_message_queue_ident 113 111 - rtems_semaphore_ident 122 120 - rtems_partition_ident 113 110 - rtems_region_ident 115 111 - rtems_port_ident 113 109 - rtems_timer_ident 113 109 - rtems_rate_monotonic_ident 113 111 - -22 rtems_message_queue_broadcast: task readied -- returns to caller 82 85 - rtems_message_queue_broadcast: no waiting tasks 11 9 - rtems_message_queue_broadcast: task readied -- preempts caller 51 56 - -23 rtems_timer_create 8 7 - rtems_timer_fire_after: inactive 14 12 - rtems_timer_fire_after: active 13 12 - rtems_timer_cancel: active 8 7 - rtems_timer_cancel: inactive 7 6 - rtems_timer_reset: inactive 11 10 - rtems_timer_reset: active 11 11 - rtems_timer_fire_when: inactive 17 16 - rtems_timer_fire_when: active 17 17 - rtems_timer_delete: active 10 9 - rtems_timer_delete: inactive 9 8 - rtems_task_wake_when 36 34 - -24 rtems_task_wake_after: yield -- returns to caller 5 3 - rtems_task_wake_after: yields -- preempts caller 22 19 - -25 rtems_clock_tick 31 31 - -26 _ISR_Disable 11 12 - _ISR_Flash 9 9 - _ISR_Enable 31 67 - _Thread_Disable_dispatch 11 10 - _Thread_Enable_dispatch 18 18 - _Thread_Set_state 20 22 - _Thread_Disptach (NO FP) 37 41 - context switch: no floating point contexts 29 26 - context switch: self 14 10 - context switch: to another task 12 12 - context switch: restore 1st FP task 54 54 - fp context switch: save idle, restore idle 47 46 - fp context switch: save idle, restore initialized 25 25 - fp context switch: save initialized, restore initialized 24 25 - _Thread_Resume 23 24 - _Thread_Unblock 14 14 - _Thread_Ready 16 24 - _Thread_Get 2 2 - _Semaphore_Get 1 1 - _Thread_Get: invalid id 0 0 - -27 interrupt entry overhead: returns to interrupted task 25 23 - interrupt exit overhead: returns to interrupted task 14 15 - interrupt entry overhead: returns to nested interrupt 12 12 - interrupt exit overhead: returns to nested interrupt 14 14 - interrupt entry overhead: returns to preempting task 14 16 - interrupt exit overhead: returns to preempting task 42 38 - -28 rtems_port_create 43 42 - rtems_port_external_to_internal 6 4 - rtems_port_internal_to_external 6 4 - rtems_port_delete 39 33 - -29 rtems_rate_monotonic_create 48 42 - rtems_rate_monotonic_period: initiate period -- returns to caller 61 65 - rtems_rate_monotonic_period: obtain status 23 21 - rtems_rate_monotonic_cancel 38 35 - rtems_rate_monotonic_delete: inactive 32 32 - rtems_rate_monotonic_delete: active 22 22 - rtems_rate_monotonic_period: conclude periods -- caller blocks 24 19 diff --git a/c/src/lib/libbsp/i386/pc386/times_p5 b/c/src/lib/libbsp/i386/pc386/times_p5 deleted file mode 100644 index 977c4ec482..0000000000 --- a/c/src/lib/libbsp/i386/pc386/times_p5 +++ /dev/null @@ -1,196 +0,0 @@ -# -# Timing Test Suite Results for the go32 BSP using a Pentium -# -# $Id$ -# - -NOTE: To obtain the execution time in microseconds, divide the number of - cycles by the clock speed. For example, if rtems_semaphore create - is reported to be 1164 cycles, then at 66 Mhz it takes 17.64 - microseconds or 8.75 microseconds at 133 Mhz. - -Board: PC/AT clone -CPU: Intel Pentium -Clock Speed: 66 Mhz -Memory Configuration: DRAM w/512 Kb cache -Wait States: unknown - -Times Reported in: cycles -Timer Source: on-CPU cycle counter - -Column A: 3.5.1 pre-release -Column Y: unused - -# DESCRIPTION A B -== ================================================================= ==== ==== - 1 rtems_semaphore_create 1164 - rtems_semaphore_delete 976 - rtems_semaphore_obtain: available 300 - rtems_semaphore_obtain: not available -- NO_WAIT 300 - rtems_semaphore_release: no waiting tasks 291 - - 2 rtems_semaphore_obtain: not available -- caller blocks 1182 - - 3 rtems_semaphore_release: task readied -- preempts caller 716 - - 4 rtems_task_restart: blocked task -- preempts caller 2130 - rtems_task_restart: ready task -- preempts caller 1861 - rtems_semaphore_release: task readied -- returns to caller 491 - rtems_task_create 1017 - rtems_task_start 965 - rtems_task_restart: suspended task -- returns to caller 816 - rtems_task_delete: suspended task 926 - rtems_task_restart: ready task -- returns to caller 850 - rtems_task_restart: blocked task -- returns to caller 1076 - rtems_task_delete: blocked task 927 - - 5 rtems_task_suspend: calling task 714 - rtems_task_resume: task readied -- preempts caller 575 - - 6 rtems_task_restart: calling task 646 - rtems_task_suspend: returns to caller 309 - rtems_task_resume: task readied -- returns to caller 320 - rtems_task_delete: ready task 994 - - 7 rtems_task_restart: suspended task -- preempts caller 1025 - - 8 rtems_task_set_priority: obtain current priority 223 - rtems_task_set_priority: returns to caller 468 - rtems_task_mode: obtain current mode 99 - rtems_task_mode: no reschedule 114 - rtems_task_mode: reschedule -- returns to caller 264 - rtems_task_mode: reschedule -- preempts caller 836 - rtems_task_set_note 236 - rtems_task_get_note 232 - rtems_clock_set 569 - rtems_clock_get 107 - - 9 rtems_message_queue_create 3287 - rtems_message_queue_send: no waiting tasks 613 - rtems_message_queue_urgent: no waiting tasks 615 - rtems_message_queue_receive: available 534 - rtems_message_queue_flush: no messages flushed 252 - rtems_message_queue_flush: messages flushed 335 - rtems_message_queue_delete 1195 - -10 rtems_message_queue_receive: not available -- NO_WAIT 333 - rtems_message_queue_receive: not available -- caller blocks 1194 - -11 rtems_message_queue_send: task readied -- preempts caller 957 - -12 rtems_message_queue_send: task readied -- returns to caller 700 - -13 rtems_message_queue_urgent: task readied -- preempts caller 1261 - -14 rtems_message_queue_urgent: task readied -- returns to caller 697 - -15 rtems_event_receive: obtain current events 27 - rtems_event_receive: not available -- NO_WAIT 226 - rtems_event_receive: not available -- caller blocks 888 - rtems_event_send: no task readied 221 - rtems_event_receive: available 393 - rtems_event_send: task readied -- returns to caller 496 - -16 rtems_event_send: task readied -- preempts caller 719 - -17 rtems_task_set_priority: preempts caller 959 - -18 rtems_task_delete: calling task 1295 - -19 rtems_signal_catch 223 - rtems_signal_send: returns to caller 628 - rtems_signal_send: signal to self 821 - exit ASR overhead: returns to calling task 401 - exit ASR overhead: returns to preempting task 482 - -20 rtems_partition_create 1337 - rtems_region_create 1031 - rtems_partition_get_buffer: available 680 - rtems_partition_get_buffer: not available 303 - rtems_partition_return_buffer 617 - rtems_partition_delete 523 - rtems_region_get_segment: available 458 - rtems_region_get_segment: not available -- NO_WAIT 565 - rtems_region_return_segment: no waiting tasks 388 - rtems_region_get_segment: not available -- caller blocks 1683 - rtems_region_return_segment: task readied -- preempts caller 1476 - rtems_region_return_segment: task readied -- returns to caller 818 - rtems_region_delete 477 - rtems_io_initialize 48 - rtems_io_open 22 - rtems_io_close 22 - rtems_io_read 22 - rtems_io_write 22 - rtems_io_control 23 - -21 rtems_task_ident 3381 - rtems_message_queue_ident 3328 - rtems_semaphore_ident 3593 - rtems_partition_ident 3286 - rtems_region_ident 3343 - rtems_port_ident 3278 - rtems_timer_ident 3282 - rtems_rate_monotonic_ident 3287 - -22 rtems_message_queue_broadcast: task readied -- returns to caller 1322 - rtems_message_queue_broadcast: no waiting tasks 347 - rtems_message_queue_broadcast: task readied -- preempts caller 1385 - -23 rtems_timer_create 306 - rtems_timer_fire_after: inactive 475 - rtems_timer_fire_after: active 475 - rtems_timer_cancel: active 277 - rtems_timer_cancel: inactive 251 - rtems_timer_reset: inactive 391 - rtems_timer_reset: active 465 - rtems_timer_fire_when: inactive 577 - rtems_timer_fire_when: active 578 - rtems_timer_delete: active 377 - rtems_timer_delete: inactive 350 - rtems_task_wake_when 1080 - -24 rtems_task_wake_after: yield -- returns to caller 159 - rtems_task_wake_after: yields -- preempts caller 574 - -25 rtems_clock_tick 505 - -26 _ISR_Disable 33 - _ISR_Flash 33 - _ISR_Enable 26 - _Thread_Disable_dispatch 36 - _Thread_Enable_dispatch 240 - _Thread_Set_state 315 - _Thread_Disptach (NO FP) 623 - context switch: no floating point contexts 594 - context switch: self 89 - context switch: to another task 122 - context switch: restore 1st FP task 1043 - fp context switch: save idle, restore idle 978 - fp context switch: save idle, restore initialized 390 - fp context switch: save initialized, restore initialized 392 - _Thread_Resume 238 - _Thread_Unblock 171 - _Thread_Ready 176 - _Thread_Get 71 - _Semaphore_Get 61 - _Thread_Get: invalid id 10 - -27 interrupt entry overhead: returns to interrupted task 391 - interrupt exit overhead: returns to interrupted task 110 - interrupt entry overhead: returns to nested interrupt 167 - interrupt exit overhead: returns to nested interrupt 120 - interrupt entry overhead: returns to preempting task 193 - interrupt exit overhead: returns to preempting task 961 - -28 rtems_port_create 668 - rtems_port_external_to_internal 215 - rtems_port_internal_to_external 211 - rtems_port_delete 491 - -29 rtems_rate_monotonic_create 823 - rtems_rate_monotonic_period: initiate period -- returns to caller 1094 - rtems_rate_monotonic_period: obtain status 345 - rtems_rate_monotonic_cancel 602 - rtems_rate_monotonic_delete: inactive 553 - rtems_rate_monotonic_delete: active 528 - rtems_rate_monotonic_period: conclude periods -- caller blocks 672 diff --git a/c/src/lib/libbsp/i386/pc386/tools/Makefile.in b/c/src/lib/libbsp/i386/pc386/tools/Makefile.in deleted file mode 100644 index 0924a4afca..0000000000 --- a/c/src/lib/libbsp/i386/pc386/tools/Makefile.in +++ /dev/null @@ -1,75 +0,0 @@ -# -# $Id$ -# - -@SET_MAKE@ -srcdir = @srcdir@ -VPATH = @srcdir@ -RTEMS_ROOT = @top_srcdir@ -PROJECT_ROOT = @PROJECT_ROOT@ -exec_prefix = @exec_prefix@ -bindir = @bindir@ -libdir = @libdir@ -includedir = @includedir@ -manext = 1 -mandir = @mandir@/man$(manext) - - -VPATH=@srcdir@ - - -# we use host compiler in this directory -USE_HOST_COMPILER=yes - -# C source names, if any, go here -- minus the .c -C_PIECES= bin2boot binpatch -C_FILES=$(C_PIECES:%=%.c) -C_O_FILES=$(C_PIECES:%=$(ARCH)/%.o) - -CC_PIECES= -CC_FILES=$(CC_PIECES:%=%.cc) -CC_O_FILES=$(CC_PIECES:%=$(ARCH)/%.o) - -H_FILES= - -SRCS=$(C_FILES) $(CC_FILES) $(H_FILES) -OBJS=$(C_O_FILES) $(CC_O_FILES) $(S_O_FILES) - -PGMS=$(ARCH)/bin2boot $(ARCH)/binpatch - -include $(RTEMS_ROOT)/make/custom/$(RTEMS_BSP).cfg -include $(RTEMS_ROOT)/make/leaf.cfg - -# -# (OPTIONAL) Add local stuff here using += -# - -DEFINES += -CPPFLAGS += -CFLAGS += -g -Wall -CXXFLAGS += - -LD_PATHS += -LD_LIBS += -LDFLAGS += -g - -# -# Add your list of files to delete here. The config files -# already know how to delete some stuff, so you may want -# to just run 'make clean' first to see what gets missed. -# 'make clobber' already includes 'make clean' -# - -CLEAN_ADDITIONS += $(HOST_ARCH) -CLOBBER_ADDITIONS += - -all: $(ARCH) $(SRCS) $(PGMS) - $(INSTALL) -m 555 $(PGMS) ${PROJECT_RELEASE}/build-tools - -$(ARCH)/bin2boot: $(srcdir)/bin2boot.c - $(CC) $(LDFLAGS) -o $@ $(srcdir)/bin2boot.c $(LD_LIBS) - -$(ARCH)/binpatch: $(srcdir)/binpatch.c - $(CC) $(LDFLAGS) -o $@ $(srcdir)/binpatch.c $(LD_LIBS) - - diff --git a/c/src/lib/libbsp/i386/pc386/tools/Spec.doc b/c/src/lib/libbsp/i386/pc386/tools/Spec.doc deleted file mode 100644 index ea66a7eb3d..0000000000 --- a/c/src/lib/libbsp/i386/pc386/tools/Spec.doc +++ /dev/null @@ -1,357 +0,0 @@ -# -# $Id$ -# - - 2-28-1995 GK - -In order to provide more functionality to the boot rom code I changed -Jamie's draft a little bit. All my changes have a bar sign (|) in the -79th column. - -Gero Kuhlmann - -=============================================================================== - - -0. Numbering - -This is Draft Net Boot Image Proposal 0.2, February 28, 1995 | - - -1. Preamble - the why - -Whilst researching what other boot proms do (at least those implementing -TCP/IP protocols) it is clear that each 'does their own thing' in -terms of what they expect in a boot image. - -If we could all agree on working toward an open standard, O/S suppliers -and boot rom suppliers can build their products to this norm, and be confident -that they will work with each other. - -This is a description of how I will implement the boot rom for -Linux. I believe it to be flexible enough for any OS that will be loaded -when a PC boots from a network in the TCP/IP environment. - -It would be good if this could be turned into some form of standard. - -This is very much a first draft. I am inviting comment. - -The ideas presented here should be independant of any implementation. -In the end, where there is a conflict between the final of this draft, and an -implementation, this description should prevail. - -The terms I use are defined at the end. - - -2. The target - -The target is to have a PC retrieve a boot image from a network in the TCP/IP -environment. - -The boot may take place from a network adaptor rom, from a boot floppy, or -from a program in MSDOS. - - -3. Net Boot Process Description. - -The net boot process can be started either as a result of the PC -boot process, or through normal DOS execution of a program. The net boot -program can reside on a rom, e.g. on an adaptor card, or in ram, either -as a result of reading off disk or transferred from ram. - -The boot process may execute in any mode (e.g. 8086, 80386) it desires. -When it jumps to the start location in the boot image, it must be in -8086 mode and be capable of going into any mode supported by the -underlying processor. - -The image cannot be loaded into address spaces below 10000h, or between -A0000h through FFFFFh, or between 98000h through 9FFFFh. Once the image -starts executing, all the memory is available to it, so it can relocate -parts of itself to these areas. - -The boot process must be capable of loading the image into all other -memory locations. Specifically, where the machine supports this, this means -memory over 100000h. - -The net boot process must execute the bootp protocol, followed by -the tftp protocol, as defined in the relevant rfc's. - -The file name used in the tftp protocol must be that given by the bootp -record. - -If less than 512 bytes are loaded, the net boot process attempts to display -on the screen any ascii data at the start of the image. The net boot -process then exits in the normal manner. For a boot prom, this will -allow normal disk booting. For DOS programs, this will mean a normal return -to DOS. - -When the first 512 bytes have been loaded, the boot process checks -for an initial magic number, which is defined later. If this number -is present, the net process continues loading under the control -of the image format. The image, which is described later, tells the -net boot process where to put this record and all subsequent data. - -If no initial magic number is present the net boot process checks for a second -magic number at offset 510. If the magic number 510 = 55h, 511 = AAh, -then the net process continues. If this second magic number is not -present, then the net boot process terminates the tftp protocol, displays -an error message and exits in the normal manner. - -If no initial magic number is present and the second one is, the net boot -process relocates the 512 bytes to location 7c00h. The net boot process -continues to load any further image data to 10000h up. This data can overwrite -the first 512 boot bytes. If the image reaches 98000h, then any further data is -continued to be loaded above 100000h. When all the data has been loaded, the -net boot process jumps to location 0:7c00. - -When the net boot process calls the image, it places 2 far pointers onto | -the stack, in standard intel order (e.g. segment:offset representation). | -The first far pointer which immediately follows the return address on | -the stack, points to the loaded boot image header. The second far pointer | -which is placed above the first one, shows to the memory area where the | -net boot process saved the bootp reply. | - - -4. Image Format with Initial Magic Number. - -The first 512 bytes of the image file contain the image header, -and image loading information records. This contains all the -information needed by the net boot process as to where data -is to be loaded. - -The magic number (in time-honoured tradition (well why not?)) is: - - 0 = 36h - 1 = 13h - 2 = 03h - 3 = 1Bh - -Apart from the two magic numbers, all words and double words are in PC -native endian. - -Including the initial magic number the header record is: - - +---------------------+ - | | - | Initial Magic No. | 4 bytes - +---------------------+ - | | - | Flags and length | double word - +---------------------+ - | | - | Location Address | double word in ds:bx format - +---------------------+ - | | - | Execute Address | double word in cs:ip format - +---------------------+ - -The Location address is where to place the 512 bytes. The net boot -process does this before loading the rest of the image. The location -address cannot be one of the reserved locations mentioned above, but -must be an address lower than 100000h. - -The rest of the image must not overwrite these initial 512 bytes, placed -at the required location. The writing of data by the net boot process -into these 512 bytes is deprecated. These 512 bytes must be available for -the image to interogate once it is loaded and running. - -The execute address is the location in cs:ip of the initial instruction -once the full image has been loaded. This must be lower than 100000h, -since the initial instructions will be executed in 8086 mode. When the -jump (actaully a far call) is made to the boot image, the stack contains a -far return address, with a far pointer parameter above that, pointing -to the location of this header. - -The flags and length field is broken up in the following way: - -Bits 0 to 3 (lowest 4 bits) define the length of the non vendor header in -double words. Currently the value is 4. - -Bits 4 to 7 define the length required by the vendor extra information -in double words. A value of zero indicates no extra vendor information. - -Bits 8 to 31 are reserved for future use and must be set to zero. - -After this header, and any vendor header, come the image loading information -records. These specify where data is to be loaded, how long it is, and -communicates to the loaded image what sort of data it is. - -The format of each image loading information record is : - - - +---------------------+ - | Flags, tags and | double word - | lengths | - +---------------------+ - | | - | Load Address | double word - +---------------------+ - | | - | Image Length | double word - +---------------------+ - | | - | Memory Length | double word - +---------------------+ - -Each image loading information record follows the previous, or the header. - -The memory length, image length and load address fields are unsigned 32 -numbers. They do not have the segment:offset format used by the 8086. - -The flags, tags and lengths field is broken up as follows: - -Bits 0 to 3 (lowest 4 bits) are the length of the non vendor part of this -header in double words. Currently this value is 4. - -Bits 4 to 7 indicate the length of any vendor information, in double words. - -Bits 8 to 15 are for vendor's tags. The vendor tag is a private number that -the loaded image can use to determine what sort of image is at this particular -location. - -Bits 16 to 23 are for future expansion and should be set to zero. - -Bits 24 to 31 are for flags, which are defined later. - -Vendors may place further information after this information record, and -before the next. Each information record may have a different vendor -length. - -There are two restrictions on vendor information. - -One is that the header and all information records that the net boot process -is to use fall within the first 512 bytes. - -The second restriction is that the net boot process must ignore all -vendor additions. The net boot process may not overwrite vendor supplied -information, or other undefined data in the initial 512 bytes. - -The flags are used to modify the load address field, and to indicate -that this is the last information record that the net boot process should -use. - -Bit 24 works in conjunction with bit 25 to specify the meaning of the -load address. - - B24 B25 - - 0 0 load address is an absolute 32 number - - 1 0 add the load address to the location one past the last byte - of the memory area required by the last image loaded. - If the first image, then add to 512 plus the location - where the 512 bytes were placed - - 0 1 subtract the load address from the one past the - last writeable location in memory. Thus 1 would - be the last location one could write in memory. - - 1 1 load address is subtracted from the start of - the last image loaded. If the first image, then - subtract from the start of where the 512 bytes were - placed - -(For convenience bit 24 is byte 0 of the flag field) - -Bit 26 is the end marker for the net boot process. It is set when -this is the last information record the net boot process should -look at. More records may be present, but the net boot process will not -look at them. (Vendors can continue information records out past the 512 -boundary for private use in this manner). - -The image length tells the net boot process how many bytes are to be loaded. -Zero is a valid value. This can be used to mark memory areas such as -shared memory for interprocessor communication, flash eproms, data in eproms. - -The image length can also be different from the memory length. This allows -decompression programs to fluff up the kernel image. It also allows a file -system to be larger then the loaded file system image. - -Bits 27 through 31 are not defined as yet and must be set to zero until -they are. - - -6. Boot prom entry points. - -I have not defined boot entry points, and means of obtaining them. -It could be useful to down load part of an image, and have that image -load more of itself by using handy parts of the net boot program. - -This can be considered 'for further study'. - - -7. Example of a boot image. - -Here is an example of how the boot image would look for Linux: - - 0x1B031336, /* magic number */ - 0x4, /* length of header is 16 bytes, no vendor info */ - 0x90000000, /* location in ds:bx format */ - 0x90000200, /* execute address in cs:ip format */ - - /* 2048 setup.S bytes */ - 0x4, /* flags, not end, absolute address, 16 bytes this - record, no vendor info */ - 0x90200, /* load address - note format */ - 0x800, /* 4 8 512 byte blocks for linux */ - 0x800, - - /* kernel image */ - 0x4, /* flags, not end, absolute address, 16 bytes this - record, no vendor info */ - 0x10000, /* load address - note format */ - 0x80000, /* 512K (this could be shorter */ - 0x80000, - - /* ramdisk for root file system */ - 0x04000004, /* flags = last, absolute address, 16 bytes this - record, no vendor info *// - 0x100000, /* load address - in extended memory */ - 0x80000, /* 512K for instance */ - 0x80000, - - /* Then follows linux specific information */ - - -8. Terms - -When I say 'the net boot process', I mean the act of loading the image into -memory, setting up any tables, up until the jump to the required location -in the image. - -The net booting program executes the net boot process. The net boot program -may be a rom, but not neccassarily. It is a set of instructions and data -residing on the booting machine. - -The image, or boot image, consists of the data loaded by the net boot process. - -When I say 'the PC boot process', I mean the general PC rom bios boot process, -the setting up of hardware, the scanning for adaptor roms, the execution -of adaptor roms, the loading in of the initial boot track. The PC boot -process will include the net boot process, if one is present. - -When I say client, I mean the PC booting up. - -When I say 'image host', I mean the host where the boot image is comming from. -This may not have the same architecture as the client. - -The bootp protocol is defined in RFC951 and RFC1084. The tftp protocol -is defined in RFC783. These are available on many sites. -See Comer 1991 for details on how to obtain them. - -A bootp server is the machine that answers the bootp request. It is not -neccassarily the image host. - -'Can' and 'may' means doesn't have to, but is allowed to and might. -'Must' means just that. 'Cannot' means must not. - - -9 References - -Comer, D.E. 1991, Internetworking with TCP/IP Vol I: Principles, Protocols, -and Architecture Second Edition, Prentice Hall, Englewood Cliffs, N.J., 1991 - -Stevens, W.R 1990, Unix Network Programming, Prentice Hall, -Englewood Cliffs, N.J., 1990 - - diff --git a/c/src/lib/libbsp/i386/pc386/tools/bin2boot.c b/c/src/lib/libbsp/i386/pc386/tools/bin2boot.c deleted file mode 100644 index a47ca2cee3..0000000000 --- a/c/src/lib/libbsp/i386/pc386/tools/bin2boot.c +++ /dev/null @@ -1,414 +0,0 @@ - -/* - * Simplyfied version of original bin2boot - */ - -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <memory.h> - - -static unsigned char buf[512]; - -static void usage(void) -{ - printf("usage: bin2boot [-h][-v] <outFile> <headerAddr> \n"); - printf("<imFile1> <imAddr1> <imSize1> [<imFile2> <imAddr2> <imSize2>]\n"); - printf("this function makes image bootable by netboot\n"); - printf("from one or two binary images\n"); - printf("-h - prints this message\n"); - printf("-v - verbose output\n"); - printf("outFile - output file\n"); - printf("headerAddr - address to place header in memory\n"); - printf(" it should be below or equal 0x97e00\n"); - printf("imFile1 - first image\n"); - printf("imAddr1 - its start address, image has to be placed whole\n"); - printf(" below 0x98000 and should not overlap with header\n"); - printf("imSize1 - actual size of compressed image, 0 for uncompressed\n"); - printf("imFile2 - second image\n"); - printf("imAddr2 - its start address\n"); - printf("imSize2 - actual size of compressed image, 0 for uncompressed\n"); - - return; -} - - -int main(int argc, char* argv[]) -{ - int c, verbose; - extern int optind; - FILE *ofp, *ifp; - unsigned long headerAddr, addr1, addr2; - int size1, size2, len1, len2, len, imageCnt, cnt; - char *ofile, *ifile, *end; - - verbose = 0; - - /* parse command line options */ - while ((c = getopt(argc, argv, "hv")) >= 0) - { - switch (c) - { - case 'v': - verbose = 1; - break; - case 'h': - usage(); - return 0; - default: - usage(); - return 1; - } - } - - if((argc - optind) != 8 && (argc - optind) != 5) - { - usage(); - return 1; - } - - ofile = argv[optind]; - ofp = fopen(ofile, "w"); - if(ofp == NULL) - { - fprintf(stderr, "unable to open file %s\n", ofile); - return 1; - } - - /* - * Layout is very simple first 512 is header shared by all - * images, then images at 512 bytes border - */ - - /* Fill buffer with 0's */ - memset(buf, 0, sizeof(buf)); - - fwrite(buf, 1, sizeof(buf), ofp); - - optind++; - headerAddr = strtoul(argv[optind], &end, 0); - if(end == argv[optind]) - { - fprintf(stderr, "bad headerAddr %s\n", argv[optind]); - fclose(ofp); - return 1; - } - - if(headerAddr > 0x97e00) - { - fprintf(stderr, "headerAddr is too high 0x%08lx\n", headerAddr); - fclose(ofp); - return 1; - } - - /* Copy the first image */ - optind++; - ifile = argv[optind]; - ifp = fopen(ifile,"r"); - if(ifp == NULL) - { - fprintf(stderr, "unable to open output file %s\n", ifile); - fclose(ofp); - return 1; - } - - optind++; - addr1 = strtoul(argv[optind], &end, 0); - if(end == argv[optind]) - { - fprintf(stderr, "bad image address %s\n", argv[optind]); - fclose(ofp); - return 1; - } - - optind++; - size1 = strtoul(argv[optind], &end, 0); - if(end == argv[optind]) - { - fprintf(stderr, "bad image size %s\n", argv[optind]); - fclose(ofp); - return 1; - } - - - /* Copy first image out and remember its length */ - cnt = 0; - for(;;) - { - len = fread(buf, 1, sizeof(buf), ifp); - - if(len != 0) - { - fwrite(buf, 1, len, ofp); - cnt += sizeof(buf); - - if(len != sizeof(buf)) - { - memset(buf, 0, sizeof(buf) - len); - fwrite(buf, 1, sizeof(buf) - len, ofp); - break; - } - - } - else - { - break; - } - } - - fclose(ifp); - - len1 = cnt; - - if(size1 == 0) - { - size1 = cnt; - } - else - { - memset(buf, 0, sizeof(buf)); - - while(cnt < size1) - { - fwrite(buf, 1, sizeof(buf), ofp); - cnt += sizeof(buf); - } - - size1 = cnt; - } - - - /* Let us check agains overlapping */ - if(!(addr1 >= (headerAddr + sizeof(buf)) || (headerAddr >= addr1+size1))) - { - /* Areas overlapped */ - printf("area overlapping: \n"); - printf("header address 0x%08lx, its memory size 0x%08x\n", - headerAddr, sizeof(buf)); - printf("first image address 0x%08lx, its memory size 0x%08x\n", - addr1, size1); - - fclose(ofp); - return 1; - } - - if((addr1 + size1) > 0x98000) - { - fprintf(stderr, "imAddr1 is too high 0x%08lx\n", addr1); - fclose(ofp); - return 1; - } - - - if(optind == (argc - 1)) - { - imageCnt = 1; - goto writeHeader; - } - - imageCnt = 2; - - /* Copy Second Image */ - optind++; - ifile = argv[optind]; - ifp = fopen(ifile,"r"); - if(ifp == NULL) - { - fprintf(stderr, "unable to open output file %s\n", ifile); - fclose(ofp); - return 1; - } - - optind++; - addr2 = strtoul(argv[optind], &end, 0); - if(end == argv[optind]) - { - fprintf(stderr, "bad image address %s\n", argv[optind]); - fclose(ofp); - return 1; - } - - optind++; - size2 = strtoul(argv[optind], &end, 0); - if(end == argv[optind]) - { - fprintf(stderr, "bad image size %s\n", argv[optind]); - fclose(ofp); - return 1; - } - - /* Copy second image out and remember its length */ - cnt = 0; - for(;;) - { - len = fread(buf, 1, sizeof(buf), ifp); - - if(len != 0) - { - fwrite(buf, len, 1, ofp); - cnt += sizeof(buf); - - if(len != sizeof(buf)) - { - memset(buf, 0, sizeof(buf) - len); - fwrite(buf, 1, sizeof(buf) - len, ofp); - break; - } - } - else - { - break; - } - } - - fclose(ifp); - - len2 = cnt; - - if(size2 == 0) - { - size2 = cnt; - } - else - { - memset(buf, 0, sizeof(buf)); - - while(cnt < size2) - { - fwrite(buf, 1, sizeof(buf), ofp); - cnt += sizeof(buf); - } - - size2 = cnt; - } - - /* Let us check against overlapping */ - if(!((addr2 >= (addr1 + size1) && addr2 >= (headerAddr + sizeof(buf))) || - (addr2 < addr1 && addr2 < headerAddr) || - (addr1 > headerAddr && addr2 > (headerAddr + sizeof(buf)) && - (addr2 + size2) <= addr1) || - (addr1 < headerAddr && addr2 > (addr1 + size1) && - (addr2 + size2) <= headerAddr))) - - { - /* Areas overlapped */ - printf("area overlapping: \n"); - printf("header address 0x%08lx, its memory size 0x%08x\n", - headerAddr, sizeof(buf)); - printf("first image address 0x%08lx, its memory size 0x%08x\n", - addr1, size1); - printf("second image address 0x%08lx, its memory size 0x%08x\n", - addr2, size2); - - fclose(ofp); - return 1; - } - -writeHeader: - - /* We know everything so it is time to write buffer */ - memset(buf, 0, 0x30); - - buf[0x0] = 0x36; - buf[0x1] = 0x13; - buf[0x2] = 0x03; - buf[0x3] = 0x1b; - - buf[0x4] = 4; - - /* Header address in ds:bx format */ - buf[0x8] = headerAddr & 0xf; - buf[0x9] = 0; - buf[0xa] = (headerAddr >> 4) & 0xff; - buf[0xb] = (headerAddr >> 12) & 0xff; - - /* - * Execute address in cs:ip format, which addr1 - */ - buf[0xc] = addr1 & 0xf; - buf[0xd] = 0; - buf[0xe] = (addr1 >> 4) & 0xff; - buf[0xf] = (addr1 >> 12) & 0xff; - - /* Flags, tags and lengths */ - buf[0x10] = 4; - - if(imageCnt == 1) - { - buf[0x13] = 4; - } - - /* Load address */ - buf[0x14] = addr1 & 0xff; - buf[0x15] = (addr1 >> 8) & 0xff; - buf[0x16] = (addr1 >> 16) & 0xff; - buf[0x17] = (addr1 >> 24) & 0xff; - - /* Image Length */ - buf[0x18] = len1 & 0xff; - buf[0x19] = (len1 >> 8) & 0xff; - buf[0x1a] = (len1 >> 16) & 0xff; - buf[0x1b] = (len1 >> 24) & 0xff; - - /* Memory Size */ - buf[0x1c] = size1 & 0xff; - buf[0x1d] = (size1 >> 8) & 0xff; - buf[0x1e] = (size1 >> 16) & 0xff; - buf[0x1f] = (size1 >> 24) & 0xff; - - if(imageCnt != 1) - { - - /* Flags, tags and lengths */ - buf[0x20] = 4; - - buf[0x23] = 4; - - - /* Load address */ - buf[0x24] = addr2 & 0xff; - buf[0x25] = (addr2 >> 8) & 0xff; - buf[0x26] = (addr2 >> 16) & 0xff; - buf[0x27] = (addr2 >> 24) & 0xff; - - /* Image Length */ - buf[0x28] = len2 & 0xff; - buf[0x29] = (len2 >> 8) & 0xff; - buf[0x2a] = (len2 >> 16) & 0xff; - buf[0x2b] = (len2 >> 24) & 0xff; - - /* Memory Size */ - buf[0x2c] = size2 & 0xff; - buf[0x2d] = (size2 >> 8) & 0xff; - buf[0x2e] = (size2 >> 16) & 0xff; - buf[0x2f] = (size2 >> 24) & 0xff; - } - - rewind(ofp); - - fwrite(buf, 1, 0x30, ofp); - - fclose(ofp); - - if(verbose) - { - printf("header address 0x%08lx, its memory size 0x%08x\n", - headerAddr, sizeof(buf)); - printf("first image address 0x%08lx, its memory size 0x%08x\n", - addr1, size1); - printf("second image address 0x%08lx, its memory size 0x%08x\n", - addr2, size2); - } - - return 0; -} - - - - - - - - - diff --git a/c/src/lib/libbsp/i386/pc386/tools/binpatch.c b/c/src/lib/libbsp/i386/pc386/tools/binpatch.c deleted file mode 100644 index ab0900702a..0000000000 --- a/c/src/lib/libbsp/i386/pc386/tools/binpatch.c +++ /dev/null @@ -1,168 +0,0 @@ -/* - * $Id$ - */ - - -#include <stdio.h> -#include <stdlib.h> - -/* - * This function will patch binary file - */ - - -static char buf[512]; - -static void -usage(void) -{ - printf("usage: binpatch [-h] <ofile> <ifile> <reloc> <off> <byte0> " - "[<byte1> [<byte2> [<byte3>]]]\n"); - printf("this function patches binary file at specified offset with\n"); - printf("up to 4 bytes provided on command line \n"); - printf("-h - prints this message\n\n"); - printf("<ofile> - output file\n"); - printf("<ifile> - input ifile\n"); - printf("<reloc> - relocation address of image\n"); - printf("<off> - offset of patch, offset in file is at off - reloc\n"); - printf("<byte0> - byte 0 of patch\n"); - printf("<byte1> - byte 1 of patch\n"); - printf("<byte2> - byte 1 of patch\n"); - printf("<byte3> - byte 1 of patch\n"); - - return; -} - -int -main(int argc, char **argv) -{ - int c; - FILE *ofp, *ifp; - char patch[4], *end; - int patchLen, tmp, i, off, cnt, patched, len, reloc; - - - /* parse command line options */ - while ((c = getopt(argc, argv, "h")) >= 0) - { - switch (c) - { - case 'h': - usage(); - return 0; - default: - usage(); - return 1; - } - } - - if(argc < 6) - { - usage(); - return 1; - } - - /* Let us get offset in file */ - reloc = strtol(argv[3], &end, 0); - if(end == argv[3] || off < 0) - { - fprintf(stderr, "bad reloc value %s\n", argv[3]); - return 1; - } - - off = strtol(argv[4], &end, 0); - if(end == argv[4] || off < 0 || off < reloc) - { - fprintf(stderr, "bad offset value %s\n", argv[4]); - return 1; - } - - off -= reloc; - - /* Let us get patch */ - patchLen = argc - 5; - - for(i=0; i<patchLen; i++) - { - tmp = strtol(argv[5+i], &end, 0); - - if(end == argv[4+i] || tmp < 0 || tmp > 0xff) - { - fprintf(stderr, "bad byte value %s\n", argv[5+i]); - return 1; - } - patch[i] = tmp; - } - - ifp = fopen(argv[2], "r"); - if(ifp == NULL) - { - fprintf(stderr, "unable to open file %s\n", argv[2]); - return 1; - } - - ofp = fopen(argv[1], "w"); - if(ofp == NULL) - { - fprintf(stderr, "unable to open file %s\n", argv[1]); - return 1; - } - - cnt = 0; - patched = 0; - for(;;) - { - len = fread(buf, 1, sizeof(buf), ifp); - - if(len == 0) - { - break; - } - - if(cnt <= off && (cnt + len) > off) - { - /* Perform patch */ - for(i=0; i<patchLen && (off+i)<(cnt+len); i++) - { - buf[off-cnt+i] = patch[i]; - } - patched = 1; - } - else if(cnt > off && cnt < (off + patchLen)) - { - /* Perform patch */ - for(i=cnt-off; i<patchLen; i++) - { - buf[off-cnt+i] = patch[i]; - } - patched = 1; - } - - fwrite(buf, 1, len, ofp); - - cnt += len; - } - - fclose(ifp); - fclose(ofp); - - if(!patched) - { - fprintf(stderr, "warning: offset is beyond input file length\n"); - fprintf(stderr, " no patch is performed\n"); - } - - return 0; -} - - - - - - - - - - - - diff --git a/c/src/lib/libbsp/i386/pc386/wrapup/Makefile.in b/c/src/lib/libbsp/i386/pc386/wrapup/Makefile.in deleted file mode 100644 index 86462939cf..0000000000 --- a/c/src/lib/libbsp/i386/pc386/wrapup/Makefile.in +++ /dev/null @@ -1,59 +0,0 @@ -# -# $Id$ -# - -@SET_MAKE@ -srcdir = @srcdir@ -VPATH = @srcdir@ -RTEMS_ROOT = @top_srcdir@ -PROJECT_ROOT = @PROJECT_ROOT@ - -# We only build the Network library if HAS_NETWORKING was defined -NETWORK_yes_V = network -NETWORK = $(NETWORK_$(HAS_NETWORKING)_V) - -BSP_PIECES=startup clock console timer $(NETWORK) -GENERIC_PIECES= - -# bummer; have to use $foreach since % pattern subst rules only replace 1x -OBJS=$(foreach piece, $(BSP_PIECES), ../$(piece)/$(ARCH)/$(piece).rel) \ - $(foreach piece, $(GENERIC_PIECES), ../../../$(piece)/$(ARCH)/$(piece).rel) -LIB=$(ARCH)/libbsp.a - -include $(RTEMS_ROOT)/make/custom/$(RTEMS_BSP).cfg -include $(RTEMS_ROOT)/make/lib.cfg - -# -# (OPTIONAL) Add local stuff here using += -# - -DEFINES += -CPPFLAGS += -CFLAGS += - -LD_PATHS += -LD_LIBS += -LDFLAGS += - -# -# Add your list of files to delete here. The config files -# already know how to delete some stuff, so you may want -# to just run 'make clean' first to see what gets missed. -# 'make clobber' already includes 'make clean' -# - -CLEAN_ADDITIONS += -CLOBBER_ADDITIONS += - -$(LIB): ${OBJS} - $(make-library) - -all: ${ARCH} $(SRCS) $(LIB) - $(INSTALL_VARIANT) -m 644 $(LIB) ${PROJECT_RELEASE}/lib -# we create here a directory specific to the PC386 BSP to store the BootImage -# files so they can be easily found - mkdir -p ${PROJECT_RELEASE}/BootImgs - - - - |