From 69d1994f373207da231b4eb571cc1eab0aab6083 Mon Sep 17 00:00:00 2001 From: patacongo Date: Fri, 15 Feb 2008 22:10:33 +0000 Subject: Add support for the TRS-80 Model 3 via xtrs git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@689 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/configs/xtrs/README.txt | 75 ++++ nuttx/configs/xtrs/include/README.txt | 1 + nuttx/configs/xtrs/include/board.h | 68 ++++ nuttx/configs/xtrs/include/trs80-m3.h | 185 ++++++++++ nuttx/configs/xtrs/nsh/Make.defs | 94 +++++ nuttx/configs/xtrs/nsh/defconfig | 311 +++++++++++++++++ nuttx/configs/xtrs/nsh/setenv.sh | 45 +++ nuttx/configs/xtrs/ostest/Make.defs | 94 +++++ nuttx/configs/xtrs/ostest/defconfig | 311 +++++++++++++++++ nuttx/configs/xtrs/ostest/setenv.sh | 45 +++ nuttx/configs/xtrs/pashello/Make.defs | 94 +++++ nuttx/configs/xtrs/pashello/defconfig | 312 +++++++++++++++++ nuttx/configs/xtrs/pashello/setenv.sh | 45 +++ nuttx/configs/xtrs/sdcc-2.6.0-asz80-symlen.patch | 11 + nuttx/configs/xtrs/src/Makefile | 77 +++++ nuttx/configs/xtrs/src/README.txt | 1 + nuttx/configs/xtrs/src/xtr_irq.c | 117 +++++++ nuttx/configs/xtrs/src/xtr_lowputc.c | 106 ++++++ nuttx/configs/xtrs/src/xtr_serial.c | 420 +++++++++++++++++++++++ nuttx/configs/xtrs/src/xtr_timerisr.c | 95 +++++ 20 files changed, 2507 insertions(+) create mode 100644 nuttx/configs/xtrs/README.txt create mode 100644 nuttx/configs/xtrs/include/README.txt create mode 100644 nuttx/configs/xtrs/include/board.h create mode 100644 nuttx/configs/xtrs/include/trs80-m3.h create mode 100644 nuttx/configs/xtrs/nsh/Make.defs create mode 100644 nuttx/configs/xtrs/nsh/defconfig create mode 100755 nuttx/configs/xtrs/nsh/setenv.sh create mode 100644 nuttx/configs/xtrs/ostest/Make.defs create mode 100644 nuttx/configs/xtrs/ostest/defconfig create mode 100755 nuttx/configs/xtrs/ostest/setenv.sh create mode 100644 nuttx/configs/xtrs/pashello/Make.defs create mode 100644 nuttx/configs/xtrs/pashello/defconfig create mode 100755 nuttx/configs/xtrs/pashello/setenv.sh create mode 100644 nuttx/configs/xtrs/sdcc-2.6.0-asz80-symlen.patch create mode 100644 nuttx/configs/xtrs/src/Makefile create mode 100644 nuttx/configs/xtrs/src/README.txt create mode 100644 nuttx/configs/xtrs/src/xtr_irq.c create mode 100644 nuttx/configs/xtrs/src/xtr_lowputc.c create mode 100644 nuttx/configs/xtrs/src/xtr_serial.c create mode 100644 nuttx/configs/xtrs/src/xtr_timerisr.c diff --git a/nuttx/configs/xtrs/README.txt b/nuttx/configs/xtrs/README.txt new file mode 100644 index 000000000..72ef1d29b --- /dev/null +++ b/nuttx/configs/xtrs/README.txt @@ -0,0 +1,75 @@ +xtrs README +^^^^^^^^^^^^^ + +TRS80 Model 3. This port uses a vintage computer based on the Z80. +An emulator for this computer is available to run TRS80 programs on a +linux platform (http://www.tim-mann.org/xtrs.html). + +The SDCC toolchain is available from http://sdcc.sourceforge.net/. All +testing has been performed using version 2.6.0 of the SDCC toolchain. + +Configuring NuttX +^^^^^^^^^^^^^^^^^ + + ostest + This configuration performs a simple, minimal OS test using + examples/ostest. This can be configurated as follows: + + cd tools + ./configure.sh xtrs/ostest + cd - + . ./setenv.sh + + + nsh + This configuration file builds NSH (examples/nsh). This + configuration is not functional due to issues with use of the + simulated serial driver (see the TODO list). + + This configuration can be selected by: + + cd tools + ./configure.sh xtrs/nsh + cd - + . ./setenv.sh + + pashello + Configures to use examples/pashello for execution from FLASH + See examples/README.txt for information about pashello. + + This configuration is not usable because the resulting binary + is too large for the z80 address space. + + This configuration can be selected by: + + cd tools + ./configure.sh xtrs/pashello + cd - + . ./setenv.sh + +Building the SDCC toolchain +^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The SDCC toolchain is built with the standard configure/make/make install +sequence. However, some special actions are required to generate libraries +compatible with this build. First start with the usual steps + + download + unpack + cd sdcc + ./configure + +But before making, we need to apply a patch to the SDCC 2.6.0 source +so that the z80 assembler can handle long symbol names + + Apply sdcc-2.6.0-asz80-symlen.patch + cd sdcc/device/lib + +Then make the SDCC binaries + + cd sdcc + make + +and install SDCC: + + sudo make install diff --git a/nuttx/configs/xtrs/include/README.txt b/nuttx/configs/xtrs/include/README.txt new file mode 100644 index 000000000..dfd9f734b --- /dev/null +++ b/nuttx/configs/xtrs/include/README.txt @@ -0,0 +1 @@ +This directory contains header files unique to the xtrs80 emulator diff --git a/nuttx/configs/xtrs/include/board.h b/nuttx/configs/xtrs/include/board.h new file mode 100644 index 000000000..97282fe55 --- /dev/null +++ b/nuttx/configs/xtrs/include/board.h @@ -0,0 +1,68 @@ +/************************************************************ + * board/board.h + * + * Copyright (C) 2008 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ************************************************************/ + +#ifndef __ARCH_BOARD_BOARD_H +#define __ARCH_BOARD_BOARD_H + +/************************************************************ + * Included Files + ************************************************************/ + +/* Adresses of BIOS routines */ + +#include "trs80-m3.h" + +/************************************************************ + * Definitions + ************************************************************/ + +/************************************************************ + * Public Functions + ************************************************************/ + +#undef EXTERN +#if defined(__cplusplus) +#define EXTERN extern "C" +extern "C" { +#else +#define EXTERN extern +#endif + +#undef EXTERN +#if defined(__cplusplus) +} +#endif + +#endif /* __ARCH_BOARD_BOARD_H */ diff --git a/nuttx/configs/xtrs/include/trs80-m3.h b/nuttx/configs/xtrs/include/trs80-m3.h new file mode 100644 index 000000000..4a2a45332 --- /dev/null +++ b/nuttx/configs/xtrs/include/trs80-m3.h @@ -0,0 +1,185 @@ +/**************************************************************************** + * board/trs80-m3.h + * + * Copyright (C) 2008 Jacques Pelletier. All rights reserved. + * Author: Jacques Pelletier + * + * This file is a part of NuttX and hence + * + * Copyright (C) 2008 Gregory Nutt. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/* Information from http://www.trs-80.com */ + +#ifndef __TRS80_M3_H +#define __TRS80_M3_H + +/* Outputs a byte to a logical device or FCB. DE = FCB and A = byte. + * Don't confuse with CTL at 0023. + */ + +#define _TRS80_M3_PUT 0x001B + +/* Outputs a control byte to a logical device or FCB. DE = FCB and A = control byte. */ + +#define _TRS80_M3_CTL 0x0023 + +/* Scan keyboard and return with accumulator containing result. DE is used. */ + +#define _TRS80_M3_KBDSCN 0x002B + +/* Displays a character at current cursor location. */ + +#define _TRS80_M3_VDCHAR 0x0033 + +/* "Waits until printer is ready then prints character. A = ASCII character. + * If BREAK is pressed, a return to caller is made." + */ + +#define _TRS80_M3_PRCHAR 0x003B + +/* Call Input a line from the keyboard. B = max length of line. HL points at buffer. + * Buffer should be the length of B plus 1. To terminate, hit BREAK or ENTER. + * On exit, HL points at buffer and B = number of characters entered. + * Carry will be set if BREAK was pressed. + */ + +#define _TRS80_M3_KBLINE 0x0040 + +/* "Scans the keyboard until a key is pressed. If BREAK is pressed, it is returned + * like other keys." + */ + +#define _TRS80_M3_KBWAIT 0x0049 + +/* "Receive a character from RS-232. No entry conditions. On exit, memory location + * 16872 contains character received. DE is altered. This routine honors wait status." + */ + +#define _TRS80_M3_RSRCV 0x0050 + +/* "Transmit character to RS-232. On entry, Accumulator or memory location 16880 + * contains character. On exit, 16880 = 0 if no character sent. Wait status honored." + */ + +#define _TRS80_M3_RSTX 0x0055 + +/* Initialize RS-232 interface. On entry, memory location 16888 = send/receive baud + * rate code, location 16890 = wait/don't wait switch, location 16889 = RS-232 + * characteristics switch. On exit, DE is altered. For more detail, consult Model 3 + * reference manual. + */ + +#define _TRS80_M3_RSINIT 0x005A + +/* This is the routine that is Basic's SET, RESET, and POINT functions. Here's how + * to use it. Load HL with return address and push. Load register A with one of the + * following: 00H = POINT, 01H = RESET, and 80H = SET. Push AF onto stack. Load A with + * X coordinate and push onto stack. Load A with Y coordinate and JP GRAPH. + */ + +#define _TRS80_M3_GRAPH 0x0150 + +/* Clear screen. */ + +#define _TRS80_M3_CLS 0x01C9 + +/* Randomize. */ + +#define _TRS80_M3_RANDOM 0x01D3 + +/* This routine turns off the cassette drive. */ + +#define _TRS80_M3_CSOFF 0x01F8 + +#ifdef TRS80_MODEL1 + +/* A register contains a 0 or 1 which is the cassette number. This routine defines + * cassette number and turns on cassette. Model I only. + */ + +#define _TRS80_M3_DEFCAS 0x0212 + +#endif /* TRS80_MODEL1 */ + +/* Inputs data one byte at a time from cassette after you use CSHIN. A = the data + * byte. + */ + +#define _TRS80_M3_CSIN 0x0235 + +/* Outputs data one byte at a time to cassette after you use CSHWR. A = the + * output byte. + */ + +#define _TRS80_M3_CSOUT 0x0264 + +/* Turns on the cassette and writes the header. */ + +#define _TRS80_M3_CSHWR 0x0287 + +/* Finds the cassette header info at the beggining of cassette file. */ + +#define _TRS80_M3_CSHIN 0x0296 + +/* Ouput character in register A; OUTSEL (409CH) selects device. See OUTSEL for + * device values. + */ + +#define _TRS80_M3_OUTCHR 0x032A + +/* Displays character in A on screen at next print position. Uses AF. */ + +#define _TRS80_M3_DISPA 0x033A + +/* Calls keyboard scan routine. */ + +#define _TRS80_M3_keyb_scan 0x0358 + +/* Reads keyboard into buffer until a carriage return is entered. 40A7H contains + * the address of the buffer. + */ + +#define _TRS80_M3_KIBUFF 0x0361 + +/* Same as KBLINE. See 0040. */ + +#define _TRS80_M3_KLINE 0x05D9 + +/* "Get date in ASCII format. Mod III TRSDOS, LDOS, & MULTIDOS." */ + +#define _TRS80_M3_GETDAT 0x3033 + +/* "Get time in ASCII format. Mod III TRSDOS, LDOS, & MULTIDOS." */ + +#define _TRS80_M3_GETTIM 0x3036 + +#endif /* __TRS80_M3_H */ diff --git a/nuttx/configs/xtrs/nsh/Make.defs b/nuttx/configs/xtrs/nsh/Make.defs new file mode 100644 index 000000000..92d1e3738 --- /dev/null +++ b/nuttx/configs/xtrs/nsh/Make.defs @@ -0,0 +1,94 @@ +############################################################################ +# configs/xtrs/Make.defs +# +# Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +include ${TOPDIR}/.config + +ifeq ("${CONFIG_DEBUG}","y") + ARCHOPTIMIZATION = --debug +else + ARCHOPTIMIZATION = +endif + +ARCHCPUFLAGS = -mz80 --stack-auto --int-long-reent --float-reent +ARCHPICFLAGS = +ARCHWARNINGS = +ARCHDEFINES = +ARCHINCLUDES = -I. -I$(TOPDIR)/include + +CROSSDEV = +CC = sdcc +CPP = sdcpp +LD = link-z80 +AS = as-z80 +AR = sdcclib -a + +CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \ + $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) +CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) +ASFLAGS = -x -a -l -o -s + +SDCCLIBDIR = /usr/local/share/sdcc/lib/z80 +SDCCLIB = z80.lib + +ASMEXT = .asm +OBJEXT = .o +LIBEXT = .lib +EXEEXT = .hex + +define COMPILE + @echo "CC: $1" + @$(CC) -c $(CFLAGS) $1 -o $2 +endef + +define ASSEMBLE + @echo "AS: $1" + @$(AS) $(ASFLAGS) $2 $1 +endef + +define ARCHIVE + echo "AR: $2"; \ + $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; } +endef + +define CLEAN + @rm -f *.o *.asm *.rel *.lst *.rst *.sym *.adb *.lnk *.map *.mem *.ihx *.hex +endef + +MKDEP = $(TOPDIR)/tools/mkdeps.sh + +HOSTCC = gcc +HOSTINCLUDES = -I. +HOSTCFLAGS = -Wall -wstrict-prototypes -Wshadow -g -pipe +HOSTLDFLAGS = diff --git a/nuttx/configs/xtrs/nsh/defconfig b/nuttx/configs/xtrs/nsh/defconfig new file mode 100644 index 000000000..62d4047b3 --- /dev/null +++ b/nuttx/configs/xtrs/nsh/defconfig @@ -0,0 +1,311 @@ +############################################################ +# defconfig +# +# Copyright (C) 2007 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name Gregory Nutt nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################ +# +# Architecture selection +# +# CONFIG_ARCH - identifies the arch subdirectory and, hence, the +# processor architecture. +# CONFIG_ARCH_Z80 - Set if processor is Z80 +# CONFIG_ARCH_CHIP - Identifies the specific chip +# CONFIG_ARCH_CHIP_Z80 - Set if this the class Z80 +# CONFIG_ARCH_BOARD - identifies the configs subdirectory and, hence, +# the board that supports the particular chip or SoC. +# CONFIG_ARCH_BOARD_name - for use in C code +# CONFIG_DRAM_SIZE - Describes the installed DRAM. +# +CONFIG_ARCH=z80 +CONFIG_ARCH_Z80=y +CONFIG_ARCH_CHIP=z80 +CONFIG_ARCH_CHIP_Z80=y +CONFIG_ARCH_BOARD=xtrs +CONFIG_ARCH_BOARD_XTRS=y +CONFIG_DRAM_SIZE=65536 + +# +# Z80sim specific device driver settings +# +# CONFIG_UART_RXBUFSIZE - Characters are buffered as received. +# This specific the size of the receive buffer +# CONFIG_UART_TXBUFSIZE - Characters are buffered before +# being sent. This specific the size of the transmit buffer +# +CONFIG_UART_RXBUFSIZE=256 +CONFIG_UART_TXBUFSIZE=256 + +# +# General build options +# +# CONFIG_RRLOAD_BINARY - make the rrload binary format used with +# BSPs from www.ridgerun.com +# CONFIG_HAVE_LIBM - toolchain supports libm.a +# +# CONFIG_LINKER_START_AREA - Start of START area +# CONFIG_LINKER_CODE_AREA - Start of _CODE area +# + +CONFIG_RRLOAD_BINARY=n +CONFIG_HAVE_LIBM=n + +CONFIG_LINKER_START_AREA=0x5200 +CONFIG_LINKER_CODE_AREA=0x5300 + +# +# General OS setup +# +# CONFIG_EXAMPLE - identifies the subdirectory in examples +# that will be used in the build +# CONFIG_DEBUG - enables built-in debug options +# CONFIG_DEBUG_VERBOSE - enables verbose debug output +# CONFIG_MM_REGIONS - If the architecture includes multiple +# regions of memory to allocate from, this specifies the +# number of memory regions that the memory manager must +# handle and enables the API mm_addregion(start, end); +# CONFIG_HAVE_LOWPUTC - architecture supports low-level, boot +# time console output +# CONFIG_TICKS_PER_MSEC - The default system timer is 100Hz +# or TICKS_PER_MSEC=10. This setting may be defined to +# inform NuttX that the processor hardware is providing +# system timer interrupts at some interrupt interval other +# than 10 msec. +# CONFIG_RR_INTERVAL - The round robin timeslice will be set +# this number of milliseconds; Round robin scheduling can +# be disabled by setting this value to zero. +# CONFIG_SCHED_INSTRUMENTATION - enables instrumentation in +# scheduler to monitor system performance +# CONFIG_TASK_NAME_SIZE - Spcifies that maximum size of a +# task name to save in the TCB. Useful if scheduler +# instrumentation is selected. Set to zero to disable. +# CONFIG_JULIAN_TIME - Enables Julian time conversions +# CONFIG_START_YEAR, CONFIG_START_MONTH, CONFIG_START_DAY - +# Used to initialize the internal time logic. +# CONFIG_DEV_CONSOLE - Set if architecture-specific logic +# provides /dev/console. Enables stdout, stderr, stdin. +# +CONFIG_EXAMPLE=nsh +CONFIG_DEBUG=n +CONFIG_DEBUG_VERBOSE=n +CONFIG_MM_REGIONS=1 +CONFIG_ARCH_LOWPUTC=y +CONFIG_RR_INTERVAL=0 +CONFIG_SCHED_INSTRUMENTATION=n +CONFIG_TASK_NAME_SIZE=0 +CONFIG_START_YEAR=2007 +CONFIG_START_MONTH=2 +CONFIG_START_DAY=21 +CONFIG_JULIAN_TIME=n +CONFIG_DEV_CONSOLE=n + +# +# The following can be used to disable categories of +# APIs supported by the OS. If the compiler supports +# weak functions, then it should not be necessary to +# disable functions unless you want to restrict usage +# of those APIs. +# +# There are certain dependency relationships in these +# features. +# +# o mq_notify logic depends on signals to awaken tasks +# waiting for queues to become full or empty. +# o pthread_condtimedwait() depends on signals to wake +# up waiting tasks. +# +CONFIG_DISABLE_CLOCK=n +CONFIG_DISABLE_POSIX_TIMERS=y +CONFIG_DISABLE_PTHREAD=y +CONFIG_DISABLE_SIGNALS=n +CONFIG_DISABLE_MQUEUE=y +CONFIG_DISABLE_MOUNTPOINT=y +CONFIG_DISABLE_ENVIRON=y + +# +# Misc libc settings +# +# CONFIG_NOPRINTF_FIELDWIDTH - sprintf-related logic is a +# little smaller if we do not support fieldwidthes +# +CONFIG_NOPRINTF_FIELDWIDTH=y + +# +# Allow for architecture optimized implementations +# +# The architecture can provide optimized versions of the +# following to improve sysem performance +# +CONFIG_ARCH_MEMCPY=n +CONFIG_ARCH_MEMCMP=n +CONFIG_ARCH_MEMMOVE=n +CONFIG_ARCH_MEMSET=n +CONFIG_ARCH_STRCMP=n +CONFIG_ARCH_STRCPY=n +CONFIG_ARCH_STRNCPY=n +CONFIG_ARCH_STRLEN=n +CONFIG_ARCH_BZERO=n +CONFIG_ARCH_KMALLOC=n +CONFIG_ARCH_KZMALLOC=n +CONFIG_ARCH_KFREE=n + +# +# Sizes of configurable things (0 disables) +# +# CONFIG_MAX_TASKS - The maximum number of simultaneously +# actived tasks. This value must be a power of two. +# CONFIG_MAX_TASK_ARGS - This controls the maximum number of +# of parameters that a task may receive (i.e., maxmum value +# of 'argc') +# CONFIG_NPTHREAD_KEYS - The number of items of thread- +# specific data that can be retained +# CONFIG_NFILE_DESCRIPTORS - The maximum number of file +# descriptors (one for each open) +# CONFIG_NFILE_STREAMS - The maximum number of streams that +# can be fopen'ed +# CONFIG_NAME_MAX - The maximum size of a file name. +# CONFIG_STDIO_BUFFER_SIZE - Size of the buffer to allocate +# on fopen. (Only if CONFIG_NFILE_STREAMS > 0) +# CONFIG_NUNGET_CHARS - Number of characters that can be +# buffered by ungetc() (Only if CONFIG_NFILE_STREAMS > 0) +# CONFIG_PREALLOC_MQ_MSGS - The number of pre-allocated message +# structures. The system manages a pool of preallocated +# message structures to minimize dynamic allocations +# CONFIG_MQ_MAXMSGSIZE - Message structures are allocated with +# a fixed payload size given by this settin (does not include +# other message structure overhead. +# CONFIG_MAX_WDOGPARMS - Maximum number of parameters that +# can be passed to a watchdog handler +# CONFIG_PREALLOC_WDOGS - The number of pre-allocated watchdog +# structures. The system manages a pool of preallocated +# watchdog structures to minimize dynamic allocations +# CONFIG_PREALLOC_TIMERS - The number of pre-allocated POSIX +# timer structures. The system manages a pool of preallocated +# timer structures to minimize dynamic allocations. Set to +# zero for all dynamic allocations. +# +CONFIG_MAX_TASKS=8 +CONFIG_MAX_TASK_ARGS=4 +CONFIG_NPTHREAD_KEYS=0 +CONFIG_NFILE_DESCRIPTORS=6 +CONFIG_NFILE_STREAMS=6 +CONFIG_NAME_MAX=32 +CONFIG_STDIO_BUFFER_SIZE=0 +CONFIG_NUNGET_CHARS=0 +CONFIG_PREALLOC_MQ_MSGS=0 +CONFIG_MQ_MAXMSGSIZE=0 +CONFIG_MAX_WDOGPARMS=2 +CONFIG_PREALLOC_WDOGS=4 +CONFIG_PREALLOC_TIMERS=0 + +# +# TCP/IP and UDP support via uIP +# CONFIG_NET - Enable or disable all network features +# CONFIG_NET_IPv6 - Build in support for IPv6 +# CONFIG_NSOCKET_DESCRIPTORS - Maximum number of socket descriptors per task/thread. +# CONFIG_NET_SOCKOPTS - Enable or disable support for socket options +# CONFIG_NET_BUFSIZE - uIP buffer size +# CONFIG_NET_TCP - TCP support on or off +# CONFIG_NET_TCP_CONNS - Maximum number of TCP connections (all tasks) +# CONFIG_NET_TCP_READAHEAD_BUFSIZE - Size of TCP read-ahead buffers +# CONFIG_NET_NTCP_READAHEAD_BUFFERS - Number of TCP read-ahead buffers (may be zero) +# CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports (all tasks) +# CONFIG_NET_UDP - UDP support on or off +# CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off +# CONFIG_NET_UDP_CONNS - The maximum amount of concurrent UDP connections +# CONFIG_NET_ICMP - ICMP ping support on or off +# CONFIG_NET_PINGADDRCONF - Use "ping" packet for setting IP address +# CONFIG_NET_STATISTICS - uIP statistics on or off +# CONFIG_NET_RECEIVE_WINDOW - The size of the advertised receiver's window +# CONFIG_NET_ARPTAB_SIZE - The size of the ARP table +# CONFIG_NET_BROADCAST - Broadcast support +# CONFIG_NET_LLH_LEN - The link level header length +# CONFIG_NET_FWCACHE_SIZE - number of packets to remember when looking for duplicates +CONFIG_NET=n +CONFIG_NET_IPv6=n +CONFIG_NSOCKET_DESCRIPTORS=0 +CONFIG_NET_SOCKOPTS=y +CONFIG_NET_BUFSIZE=420 +CONFIG_NET_TCP=n +CONFIG_NET_TCP_CONNS=40 +CONFIG_NET_MAX_LISTENPORTS=40 +CONFIG_NET_UDP=n +CONFIG_NET_UDP_CHECKSUMS=y +#CONFIG_NET_UDP_CONNS=10 +CONFIG_NET_ICMP=n +#CONFIG_NET_PINGADDRCONF=0 +CONFIG_NET_STATISTICS=y +#CONFIG_NET_RECEIVE_WINDOW= +#CONFIG_NET_ARPTAB_SIZE=8 +CONFIG_NET_BROADCAST=n +#CONFIG_NET_LLH_LEN=14 +#CONFIG_NET_FWCACHE_SIZE=2 + +# +# UIP Network Utilities +# CONFIG_NET_DHCP_LIGHT - Reduces size of DHCP +# CONFIG_NET_RESOLV_ENTRIES - Number of resolver entries +CONFIG_NET_DHCP_LIGHT=n +CONFIG_NET_RESOLV_ENTRIES=4 + +# +# Settings for examples/nsh +CONFIG_EXAMPLES_NSH_TELNET=n +CONFIG_EXAMPLES_NSH_IOBUFFER_SIZE=512 +CONFIG_EXAMPLES_NSH_CMD_SIZE=40 +CONFIG_EXAMPLES_NSH_STACKSIZE=1024 +CONFIG_EXAMPLES_NSH_DHCPC=n +CONFIG_EXAMPLES_NSH_NOMAC=n +CONFIG_EXAMPLES_NSH_IPADDR=(10<<24|0<<16|0<<8|2) +CONFIG_EXAMPLES_NSH_DRIPADDR=(10<<24|0<<16|0<<8|1) +CONFIG_EXAMPLES_NSH_NETMASK=(255<<24|255<<16|255<<8|0) + +# +# Stack and heap information +# +# CONFIG_BOOT_FROM_FLASH - Some configurations support XIP +# operation from FLASH. +# CONFIG_CUSTOM_STACK - The up_ implementation will handle +# all stack operations outside of the nuttx model. +# CONFIG_STACK_POINTER - The initial stack pointer +# CONFIG_PROC_STACK_SIZE - The size of the initial stack +# CONFIG_PTHREAD_STACK_MIN - Minimum pthread stack size +# CONFIG_PTHREAD_STACK_DEFAULT - Default pthread stack size +# CONFIG_HEAP_BASE - The beginning of the heap +# CONFIG_HEAP_SIZE - The size of the heap +# +CONFIG_BOOT_FROM_FLASH=n +CONFIG_CUSTOM_STACK=n +CONFIG_PROC_STACK_SIZE=1024 +CONFIG_PTHREAD_STACK_MIN=256 +CONFIG_PTHREAD_STACK_DEFAULT=1024 +CONFIG_HEAP_SIZE= +CONFIG_HEAP_BASE= diff --git a/nuttx/configs/xtrs/nsh/setenv.sh b/nuttx/configs/xtrs/nsh/setenv.sh new file mode 100755 index 000000000..5fb1d66d6 --- /dev/null +++ b/nuttx/configs/xtrs/nsh/setenv.sh @@ -0,0 +1,45 @@ +#!/bin/sh +# xtrs/setenv.sh +# +# Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# + +if [ "$(basename $0)" = "setenv.sh" ] ; then + echo "You must source this script, not run it!" 1>&2 + exit 1 +fi + +if [ -z ${PATH_ORIG} ]; then export PATH_ORIG=${PATH}; fi + +export SDCC_BIN=/usr/local/bin +export PATH=${SDCC_BIN}:/sbin:/usr/sbin:${PATH_ORIG} + +echo "PATH : ${PATH}" diff --git a/nuttx/configs/xtrs/ostest/Make.defs b/nuttx/configs/xtrs/ostest/Make.defs new file mode 100644 index 000000000..48bae8743 --- /dev/null +++ b/nuttx/configs/xtrs/ostest/Make.defs @@ -0,0 +1,94 @@ +############################################################################ +# configs/xtrs/Make.defs +# +# Copyright (C) 2008 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +include ${TOPDIR}/.config + +ifeq ("${CONFIG_DEBUG}","y") + ARCHOPTIMIZATION = --debug +else + ARCHOPTIMIZATION = +endif + +ARCHCPUFLAGS = -mz80 --stack-auto --int-long-reent --float-reent +ARCHPICFLAGS = +ARCHWARNINGS = +ARCHDEFINES = +ARCHINCLUDES = -I. -I$(TOPDIR)/include + +CROSSDEV = +CC = sdcc +CPP = sdcpp +LD = link-z80 +AS = as-z80 +AR = sdcclib -a + +CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \ + $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) +CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) +ASFLAGS = -x -a -l -o -s + +SDCCLIBDIR = /usr/local/share/sdcc/lib/z80 +SDCCLIB = z80.lib + +ASMEXT = .asm +OBJEXT = .o +LIBEXT = .lib +EXEEXT = .hex + +define COMPILE + @echo "CC: $1" + @$(CC) -c $(CFLAGS) $1 -o $2 +endef + +define ASSEMBLE + @echo "AS: $1" + @$(AS) $(ASFLAGS) $2 $1 +endef + +define ARCHIVE + echo "AR: $2"; \ + $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; } +endef + +define CLEAN + @rm -f *.o *.asm *.rel *.lst *.rst *.sym *.adb *.lnk *.map *.mem *.ihx *.hex +endef + +MKDEP = $(TOPDIR)/tools/mkdeps.sh + +HOSTCC = gcc +HOSTINCLUDES = -I. +HOSTCFLAGS = -Wall -wstrict-prototypes -Wshadow -g -pipe +HOSTLDFLAGS = diff --git a/nuttx/configs/xtrs/ostest/defconfig b/nuttx/configs/xtrs/ostest/defconfig new file mode 100644 index 000000000..4561837e0 --- /dev/null +++ b/nuttx/configs/xtrs/ostest/defconfig @@ -0,0 +1,311 @@ +############################################################ +# configs/z80/defconfig +# +# Copyright (C) 2008 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################ +# +# Architecture selection +# +# CONFIG_ARCH - identifies the arch subdirectory and, hence, the +# processor architecture. +# CONFIG_ARCH_Z80 - Set if processor is Z80 +# CONFIG_ARCH_CHIP - Identifies the specific chip +# CONFIG_ARCH_CHIP_Z80 - Set if this the class Z80 +# CONFIG_ARCH_BOARD - identifies the configs subdirectory and, hence, +# the board that supports the particular chip or SoC. +# CONFIG_ARCH_BOARD_name - for use in C code +# CONFIG_DRAM_SIZE - Describes the installed DRAM. +# +CONFIG_ARCH=z80 +CONFIG_ARCH_Z80=y +CONFIG_ARCH_CHIP=z80 +CONFIG_ARCH_CHIP_Z80=y +CONFIG_ARCH_BOARD=xtrs +CONFIG_ARCH_BOARD_XTRS=y +CONFIG_DRAM_SIZE=65536 + +# +# xtrs specific device driver settings +# +# CONFIG_UART_RXBUFSIZE - Characters are buffered as received. +# This specific the size of the receive buffer +# CONFIG_UART_TXBUFSIZE - Characters are buffered before +# being sent. This specific the size of the transmit buffer +# +CONFIG_UART_RXBUFSIZE=256 +CONFIG_UART_TXBUFSIZE=256 + +# +# General build options +# +# CONFIG_RRLOAD_BINARY - make the rrload binary format used with +# BSPs from www.ridgerun.com +# CONFIG_HAVE_LIBM - toolchain supports libm.a +# +# CONFIG_LINKER_START_AREA - Start of START area +# CONFIG_LINKER_CODE_AREA - Start of _CODE area +# + +CONFIG_RRLOAD_BINARY=n +CONFIG_HAVE_LIBM=n + +CONFIG_LINKER_START_AREA=0x5200 +CONFIG_LINKER_CODE_AREA=0x5300 + +# +# General OS setup +# +# CONFIG_EXAMPLE - identifies the subdirectory in examples +# that will be used in the build +# CONFIG_DEBUG - enables built-in debug options +# CONFIG_DEBUG_VERBOSE - enables verbose debug output +# CONFIG_MM_REGIONS - If the architecture includes multiple +# regions of memory to allocate from, this specifies the +# number of memory regions that the memory manager must +# handle and enables the API mm_addregion(start, end); +# CONFIG_HAVE_LOWPUTC - architecture supports low-level, boot +# time console output +# CONFIG_TICKS_PER_MSEC - The default system timer is 100Hz +# or TICKS_PER_MSEC=10. This setting may be defined to +# inform NuttX that the processor hardware is providing +# system timer interrupts at some interrupt interval other +# than 10 msec. +# CONFIG_RR_INTERVAL - The round robin timeslice will be set +# this number of milliseconds; Round robin scheduling can +# be disabled by setting this value to zero. +# CONFIG_SCHED_INSTRUMENTATION - enables instrumentation in +# scheduler to monitor system performance +# CONFIG_TASK_NAME_SIZE - Spcifies that maximum size of a +# task name to save in the TCB. Useful if scheduler +# instrumentation is selected. Set to zero to disable. +# CONFIG_JULIAN_TIME - Enables Julian time conversions +# CONFIG_START_YEAR, CONFIG_START_MONTH, CONFIG_START_DAY - +# Used to initialize the internal time logic. +# CONFIG_DEV_CONSOLE - Set if architecture-specific logic +# provides /dev/console. Enables stdout, stderr, stdin. +# +CONFIG_EXAMPLE=ostest +CONFIG_DEBUG=n +CONFIG_DEBUG_VERBOSE=n +CONFIG_MM_REGIONS=1 +CONFIG_ARCH_LOWPUTC=y +CONFIG_RR_INTERVAL=0 +CONFIG_SCHED_INSTRUMENTATION=n +CONFIG_TASK_NAME_SIZE=0 +CONFIG_START_YEAR=2008 +CONFIG_START_MONTH=2 +CONFIG_START_DAY=21 +CONFIG_JULIAN_TIME=n +CONFIG_DEV_CONSOLE=n + +# +# The following can be used to disable categories of +# APIs supported by the OS. If the compiler supports +# weak functions, then it should not be necessary to +# disable functions unless you want to restrict usage +# of those APIs. +# +# There are certain dependency relationships in these +# features. +# +# o mq_notify logic depends on signals to awaken tasks +# waiting for queues to become full or empty. +# o pthread_condtimedwait() depends on signals to wake +# up waiting tasks. +# +CONFIG_DISABLE_CLOCK=y +CONFIG_DISABLE_POSIX_TIMERS=y +CONFIG_DISABLE_PTHREAD=y +CONFIG_DISABLE_SIGNALS=y +CONFIG_DISABLE_MQUEUE=y +CONFIG_DISABLE_MOUNTPOINT=y +CONFIG_DISABLE_ENVIRON=y + +# +# Misc libc settings +# +# CONFIG_NOPRINTF_FIELDWIDTH - sprintf-related logic is a +# little smaller if we do not support fieldwidthes +# +CONFIG_NOPRINTF_FIELDWIDTH=y + +# +# Allow for architecture optimized implementations +# +# The architecture can provide optimized versions of the +# following to improve sysem performance +# +CONFIG_ARCH_MEMCPY=n +CONFIG_ARCH_MEMCMP=n +CONFIG_ARCH_MEMMOVE=n +CONFIG_ARCH_MEMSET=n +CONFIG_ARCH_STRCMP=n +CONFIG_ARCH_STRCPY=n +CONFIG_ARCH_STRNCPY=n +CONFIG_ARCH_STRLEN=n +CONFIG_ARCH_BZERO=n +CONFIG_ARCH_KMALLOC=n +CONFIG_ARCH_KZMALLOC=n +CONFIG_ARCH_KFREE=n + +# +# Sizes of configurable things (0 disables) +# +# CONFIG_MAX_TASKS - The maximum number of simultaneously +# actived tasks. This value must be a power of two. +# CONFIG_MAX_TASK_ARGS - This controls the maximum number of +# of parameters that a task may receive (i.e., maxmum value +# of 'argc') +# CONFIG_NPTHREAD_KEYS - The number of items of thread- +# specific data that can be retained +# CONFIG_NFILE_DESCRIPTORS - The maximum number of file +# descriptors (one for each open) +# CONFIG_NFILE_STREAMS - The maximum number of streams that +# can be fopen'ed +# CONFIG_NAME_MAX - The maximum size of a file name. +# CONFIG_STDIO_BUFFER_SIZE - Size of the buffer to allocate +# on fopen. (Only if CONFIG_NFILE_STREAMS > 0) +# CONFIG_NUNGET_CHARS - Number of characters that can be +# buffered by ungetc() (Only if CONFIG_NFILE_STREAMS > 0) +# CONFIG_PREALLOC_MQ_MSGS - The number of pre-allocated message +# structures. The system manages a pool of preallocated +# message structures to minimize dynamic allocations +# CONFIG_MQ_MAXMSGSIZE - Message structures are allocated with +# a fixed payload size given by this settin (does not include +# other message structure overhead. +# CONFIG_MAX_WDOGPARMS - Maximum number of parameters that +# can be passed to a watchdog handler +# CONFIG_PREALLOC_WDOGS - The number of pre-allocated watchdog +# structures. The system manages a pool of preallocated +# watchdog structures to minimize dynamic allocations +# CONFIG_PREALLOC_TIMERS - The number of pre-allocated POSIX +# timer structures. The system manages a pool of preallocated +# timer structures to minimize dynamic allocations. Set to +# zero for all dynamic allocations. +# +CONFIG_MAX_TASKS=8 +CONFIG_MAX_TASK_ARGS=4 +CONFIG_NPTHREAD_KEYS=0 +CONFIG_NFILE_DESCRIPTORS=0 +CONFIG_NFILE_STREAMS=0 +CONFIG_NAME_MAX=32 +CONFIG_STDIO_BUFFER_SIZE=0 +CONFIG_NUNGET_CHARS=0 +CONFIG_PREALLOC_MQ_MSGS=0 +CONFIG_MQ_MAXMSGSIZE=0 +CONFIG_MAX_WDOGPARMS=2 +CONFIG_PREALLOC_WDOGS=4 +CONFIG_PREALLOC_TIMERS=0 + +# +# TCP/IP and UDP support via uIP +# CONFIG_NET - Enable or disable all network features +# CONFIG_NET_IPv6 - Build in support for IPv6 +# CONFIG_NSOCKET_DESCRIPTORS - Maximum number of socket descriptors per task/thread. +# CONFIG_NET_SOCKOPTS - Enable or disable support for socket options +# CONFIG_NET_BUFSIZE - uIP buffer size +# CONFIG_NET_TCP - TCP support on or off +# CONFIG_NET_TCP_CONNS - Maximum number of TCP connections (all tasks) +# CONFIG_NET_TCP_READAHEAD_BUFSIZE - Size of TCP read-ahead buffers +# CONFIG_NET_NTCP_READAHEAD_BUFFERS - Number of TCP read-ahead buffers (may be zero) +# CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports (all tasks) +# CONFIG_NET_UDP - UDP support on or off +# CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off +# CONFIG_NET_UDP_CONNS - The maximum amount of concurrent UDP connections +# CONFIG_NET_ICMP - ICMP ping support on or off +# CONFIG_NET_PINGADDRCONF - Use "ping" packet for setting IP address +# CONFIG_NET_STATISTICS - uIP statistics on or off +# CONFIG_NET_RECEIVE_WINDOW - The size of the advertised receiver's window +# CONFIG_NET_ARPTAB_SIZE - The size of the ARP table +# CONFIG_NET_BROADCAST - Broadcast support +# CONFIG_NET_LLH_LEN - The link level header length +# CONFIG_NET_FWCACHE_SIZE - number of packets to remember when looking for duplicates +CONFIG_NET=n +CONFIG_NET_IPv6=n +CONFIG_NSOCKET_DESCRIPTORS=0 +CONFIG_NET_SOCKOPTS=y +CONFIG_NET_BUFSIZE=420 +CONFIG_NET_TCP=n +CONFIG_NET_TCP_CONNS=40 +CONFIG_NET_MAX_LISTENPORTS=40 +CONFIG_NET_UDP=n +CONFIG_NET_UDP_CHECKSUMS=y +#CONFIG_NET_UDP_CONNS=10 +CONFIG_NET_ICMP=n +#CONFIG_NET_PINGADDRCONF=0 +CONFIG_NET_STATISTICS=y +#CONFIG_NET_RECEIVE_WINDOW= +#CONFIG_NET_ARPTAB_SIZE=8 +CONFIG_NET_BROADCAST=n +#CONFIG_NET_LLH_LEN=14 +#CONFIG_NET_FWCACHE_SIZE=2 + +# +# UIP Network Utilities +# CONFIG_NET_DHCP_LIGHT - Reduces size of DHCP +# CONFIG_NET_RESOLV_ENTRIES - Number of resolver entries +CONFIG_NET_DHCP_LIGHT=n +CONFIG_NET_RESOLV_ENTRIES=4 + +# +# Settings for examples/nsh +CONFIG_EXAMPLES_NSH_TELNET=n +CONFIG_EXAMPLES_NSH_IOBUFFER_SIZE=512 +CONFIG_EXAMPLES_NSH_CMD_SIZE=40 +CONFIG_EXAMPLES_NSH_STACKSIZE=4096 +CONFIG_EXAMPLES_NSH_DHCPC=n +CONFIG_EXAMPLES_NSH_NOMAC=n +CONFIG_EXAMPLES_NSH_IPADDR=(10<<24|0<<16|0<<8|2) +CONFIG_EXAMPLES_NSH_DRIPADDR=(10<<24|0<<16|0<<8|1) +CONFIG_EXAMPLES_NSH_NETMASK=(255<<24|255<<16|255<<8|0) + +# +# Stack and heap information +# +# CONFIG_BOOT_FROM_FLASH - Some configurations support XIP +# operation from FLASH. +# CONFIG_CUSTOM_STACK - The up_ implementation will handle +# all stack operations outside of the nuttx model. +# CONFIG_STACK_POINTER - The initial stack pointer +# CONFIG_PROC_STACK_SIZE - The size of the initial stack +# CONFIG_PTHREAD_STACK_MIN - Minimum pthread stack size +# CONFIG_PTHREAD_STACK_DEFAULT - Default pthread stack size +# CONFIG_HEAP_BASE - The beginning of the heap +# CONFIG_HEAP_SIZE - The size of the heap +# +CONFIG_BOOT_FROM_FLASH=n +CONFIG_CUSTOM_STACK=n +CONFIG_PROC_STACK_SIZE=1024 +CONFIG_PTHREAD_STACK_MIN=256 +CONFIG_PTHREAD_STACK_DEFAULT=1024 +CONFIG_HEAP_SIZE= +CONFIG_HEAP_BASE= diff --git a/nuttx/configs/xtrs/ostest/setenv.sh b/nuttx/configs/xtrs/ostest/setenv.sh new file mode 100755 index 000000000..0eedee334 --- /dev/null +++ b/nuttx/configs/xtrs/ostest/setenv.sh @@ -0,0 +1,45 @@ +#!/bin/sh +# xtrs/setenv.sh +# +# Copyright (C) 2008 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# + +if [ "$(basename $0)" = "setenv.sh" ] ; then + echo "You must source this script, not run it!" 1>&2 + exit 1 +fi + +if [ -z ${PATH_ORIG} ]; then export PATH_ORIG=${PATH}; fi + +export SDCC_BIN=/usr/local/bin +export PATH=${SDCC_BIN}:/sbin:/usr/sbin:${PATH_ORIG} + +echo "PATH : ${PATH}" diff --git a/nuttx/configs/xtrs/pashello/Make.defs b/nuttx/configs/xtrs/pashello/Make.defs new file mode 100644 index 000000000..48bae8743 --- /dev/null +++ b/nuttx/configs/xtrs/pashello/Make.defs @@ -0,0 +1,94 @@ +############################################################################ +# configs/xtrs/Make.defs +# +# Copyright (C) 2008 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +include ${TOPDIR}/.config + +ifeq ("${CONFIG_DEBUG}","y") + ARCHOPTIMIZATION = --debug +else + ARCHOPTIMIZATION = +endif + +ARCHCPUFLAGS = -mz80 --stack-auto --int-long-reent --float-reent +ARCHPICFLAGS = +ARCHWARNINGS = +ARCHDEFINES = +ARCHINCLUDES = -I. -I$(TOPDIR)/include + +CROSSDEV = +CC = sdcc +CPP = sdcpp +LD = link-z80 +AS = as-z80 +AR = sdcclib -a + +CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \ + $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) +CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) +ASFLAGS = -x -a -l -o -s + +SDCCLIBDIR = /usr/local/share/sdcc/lib/z80 +SDCCLIB = z80.lib + +ASMEXT = .asm +OBJEXT = .o +LIBEXT = .lib +EXEEXT = .hex + +define COMPILE + @echo "CC: $1" + @$(CC) -c $(CFLAGS) $1 -o $2 +endef + +define ASSEMBLE + @echo "AS: $1" + @$(AS) $(ASFLAGS) $2 $1 +endef + +define ARCHIVE + echo "AR: $2"; \ + $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; } +endef + +define CLEAN + @rm -f *.o *.asm *.rel *.lst *.rst *.sym *.adb *.lnk *.map *.mem *.ihx *.hex +endef + +MKDEP = $(TOPDIR)/tools/mkdeps.sh + +HOSTCC = gcc +HOSTINCLUDES = -I. +HOSTCFLAGS = -Wall -wstrict-prototypes -Wshadow -g -pipe +HOSTLDFLAGS = diff --git a/nuttx/configs/xtrs/pashello/defconfig b/nuttx/configs/xtrs/pashello/defconfig new file mode 100644 index 000000000..824f86d02 --- /dev/null +++ b/nuttx/configs/xtrs/pashello/defconfig @@ -0,0 +1,312 @@ +############################################################ +# configs/z80/defconfig +# +# Copyright (C) 2008 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################ +# +# Architecture selection +# +# CONFIG_ARCH - identifies the arch subdirectory and, hence, the +# processor architecture. +# CONFIG_ARCH_Z80 - Set if processor is Z80 +# CONFIG_ARCH_CHIP - Identifies the specific chip +# CONFIG_ARCH_CHIP_Z80 - Set if this the class Z80 +# CONFIG_ARCH_BOARD - identifies the configs subdirectory and, hence, +# the board that supports the particular chip or SoC. +# CONFIG_ARCH_BOARD_name - for use in C code +# CONFIG_DRAM_SIZE - Describes the installed DRAM. +# +CONFIG_ARCH=z80 +CONFIG_ARCH_Z80=y +CONFIG_ARCH_CHIP=z80 +CONFIG_ARCH_CHIP_Z80=y +CONFIG_ARCH_BOARD=xtrs +CONFIG_ARCH_BOARD_XTRS=y +CONFIG_DRAM_SIZE=65536 + +# +# xtrs specific device driver settings +# +# CONFIG_UART_RXBUFSIZE - Characters are buffered as received. +# This specific the size of the receive buffer +# CONFIG_UART_TXBUFSIZE - Characters are buffered before +# being sent. This specific the size of the transmit buffer +# +CONFIG_UART_RXBUFSIZE=256 +CONFIG_UART_TXBUFSIZE=256 + +# +# General build options +# +# CONFIG_RRLOAD_BINARY - make the rrload binary format used with +# BSPs from www.ridgerun.com +# CONFIG_HAVE_LIBM - toolchain supports libm.a +# +# CONFIG_LINKER_START_AREA - Start of START area +# CONFIG_LINKER_CODE_AREA - Start of _CODE area +# + +CONFIG_RRLOAD_BINARY=n +CONFIG_HAVE_LIBM=n + +CONFIG_LINKER_START_AREA=0x5200 +CONFIG_LINKER_CODE_AREA=0x5300 + +# +# General OS setup +# +# CONFIG_EXAMPLE - identifies the subdirectory in examples +# that will be used in the build +# CONFIG_DEBUG - enables built-in debug options +# CONFIG_DEBUG_VERBOSE - enables verbose debug output +# CONFIG_MM_REGIONS - If the architecture includes multiple +# regions of memory to allocate from, this specifies the +# number of memory regions that the memory manager must +# handle and enables the API mm_addregion(start, end); +# CONFIG_HAVE_LOWPUTC - architecture supports low-level, boot +# time console output +# CONFIG_TICKS_PER_MSEC - The default system timer is 100Hz +# or TICKS_PER_MSEC=10. This setting may be defined to +# inform NuttX that the processor hardware is providing +# system timer interrupts at some interrupt interval other +# than 10 msec. +# CONFIG_RR_INTERVAL - The round robin timeslice will be set +# this number of milliseconds; Round robin scheduling can +# be disabled by setting this value to zero. +# CONFIG_SCHED_INSTRUMENTATION - enables instrumentation in +# scheduler to monitor system performance +# CONFIG_TASK_NAME_SIZE - Spcifies that maximum size of a +# task name to save in the TCB. Useful if scheduler +# instrumentation is selected. Set to zero to disable. +# CONFIG_JULIAN_TIME - Enables Julian time conversions +# CONFIG_START_YEAR, CONFIG_START_MONTH, CONFIG_START_DAY - +# Used to initialize the internal time logic. +# CONFIG_DEV_CONSOLE - Set if architecture-specific logic +# provides /dev/console. Enables stdout, stderr, stdin. +# +CONFIG_EXAMPLE=pashello +CONFIG_DEBUG=n +CONFIG_DEBUG_VERBOSE=n +CONFIG_MM_REGIONS=1 +CONFIG_ARCH_LOWPUTC=y +CONFIG_RR_INTERVAL=0 +CONFIG_SCHED_INSTRUMENTATION=n +CONFIG_TASK_NAME_SIZE=0 +CONFIG_START_YEAR=2008 +CONFIG_START_MONTH=2 +CONFIG_START_DAY=21 +CONFIG_JULIAN_TIME=n +CONFIG_DEV_CONSOLE=n +CONFIG_DEV_LOWCONSOLE=n + +# +# The following can be used to disable categories of +# APIs supported by the OS. If the compiler supports +# weak functions, then it should not be necessary to +# disable functions unless you want to restrict usage +# of those APIs. +# +# There are certain dependency relationships in these +# features. +# +# o mq_notify logic depends on signals to awaken tasks +# waiting for queues to become full or empty. +# o pthread_condtimedwait() depends on signals to wake +# up waiting tasks. +# +CONFIG_DISABLE_CLOCK=y +CONFIG_DISABLE_POSIX_TIMERS=y +CONFIG_DISABLE_PTHREAD=y +CONFIG_DISABLE_SIGNALS=y +CONFIG_DISABLE_MQUEUE=y +CONFIG_DISABLE_MOUNTPOINT=y +CONFIG_DISABLE_ENVIRON=y + +# +# Misc libc settings +# +# CONFIG_NOPRINTF_FIELDWIDTH - sprintf-related logic is a +# little smaller if we do not support fieldwidthes +# +CONFIG_NOPRINTF_FIELDWIDTH=y + +# +# Allow for architecture optimized implementations +# +# The architecture can provide optimized versions of the +# following to improve sysem performance +# +CONFIG_ARCH_MEMCPY=n +CONFIG_ARCH_MEMCMP=n +CONFIG_ARCH_MEMMOVE=n +CONFIG_ARCH_MEMSET=n +CONFIG_ARCH_STRCMP=n +CONFIG_ARCH_STRCPY=n +CONFIG_ARCH_STRNCPY=n +CONFIG_ARCH_STRLEN=n +CONFIG_ARCH_BZERO=n +CONFIG_ARCH_KMALLOC=n +CONFIG_ARCH_KZMALLOC=n +CONFIG_ARCH_KFREE=n + +# +# Sizes of configurable things (0 disables) +# +# CONFIG_MAX_TASKS - The maximum number of simultaneously +# actived tasks. This value must be a power of two. +# CONFIG_MAX_TASK_ARGS - This controls the maximum number of +# of parameters that a task may receive (i.e., maxmum value +# of 'argc') +# CONFIG_NPTHREAD_KEYS - The number of items of thread- +# specific data that can be retained +# CONFIG_NFILE_DESCRIPTORS - The maximum number of file +# descriptors (one for each open) +# CONFIG_NFILE_STREAMS - The maximum number of streams that +# can be fopen'ed +# CONFIG_NAME_MAX - The maximum size of a file name. +# CONFIG_STDIO_BUFFER_SIZE - Size of the buffer to allocate +# on fopen. (Only if CONFIG_NFILE_STREAMS > 0) +# CONFIG_NUNGET_CHARS - Number of characters that can be +# buffered by ungetc() (Only if CONFIG_NFILE_STREAMS > 0) +# CONFIG_PREALLOC_MQ_MSGS - The number of pre-allocated message +# structures. The system manages a pool of preallocated +# message structures to minimize dynamic allocations +# CONFIG_MQ_MAXMSGSIZE - Message structures are allocated with +# a fixed payload size given by this settin (does not include +# other message structure overhead. +# CONFIG_MAX_WDOGPARMS - Maximum number of parameters that +# can be passed to a watchdog handler +# CONFIG_PREALLOC_WDOGS - The number of pre-allocated watchdog +# structures. The system manages a pool of preallocated +# watchdog structures to minimize dynamic allocations +# CONFIG_PREALLOC_TIMERS - The number of pre-allocated POSIX +# timer structures. The system manages a pool of preallocated +# timer structures to minimize dynamic allocations. Set to +# zero for all dynamic allocations. +# +CONFIG_MAX_TASKS=8 +CONFIG_MAX_TASK_ARGS=4 +CONFIG_NPTHREAD_KEYS=0 +CONFIG_NFILE_DESCRIPTORS=4 +CONFIG_NFILE_STREAMS=4 +CONFIG_NAME_MAX=32 +CONFIG_STDIO_BUFFER_SIZE=0 +CONFIG_NUNGET_CHARS=0 +CONFIG_PREALLOC_MQ_MSGS=0 +CONFIG_MQ_MAXMSGSIZE=0 +CONFIG_MAX_WDOGPARMS=2 +CONFIG_PREALLOC_WDOGS=4 +CONFIG_PREALLOC_TIMERS=0 + +# +# TCP/IP and UDP support via uIP +# CONFIG_NET - Enable or disable all network features +# CONFIG_NET_IPv6 - Build in support for IPv6 +# CONFIG_NSOCKET_DESCRIPTORS - Maximum number of socket descriptors per task/thread. +# CONFIG_NET_SOCKOPTS - Enable or disable support for socket options +# CONFIG_NET_BUFSIZE - uIP buffer size +# CONFIG_NET_TCP - TCP support on or off +# CONFIG_NET_TCP_CONNS - Maximum number of TCP connections (all tasks) +# CONFIG_NET_TCP_READAHEAD_BUFSIZE - Size of TCP read-ahead buffers +# CONFIG_NET_NTCP_READAHEAD_BUFFERS - Number of TCP read-ahead buffers (may be zero) +# CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports (all tasks) +# CONFIG_NET_UDP - UDP support on or off +# CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off +# CONFIG_NET_UDP_CONNS - The maximum amount of concurrent UDP connections +# CONFIG_NET_ICMP - ICMP ping support on or off +# CONFIG_NET_PINGADDRCONF - Use "ping" packet for setting IP address +# CONFIG_NET_STATISTICS - uIP statistics on or off +# CONFIG_NET_RECEIVE_WINDOW - The size of the advertised receiver's window +# CONFIG_NET_ARPTAB_SIZE - The size of the ARP table +# CONFIG_NET_BROADCAST - Broadcast support +# CONFIG_NET_LLH_LEN - The link level header length +# CONFIG_NET_FWCACHE_SIZE - number of packets to remember when looking for duplicates +CONFIG_NET=n +CONFIG_NET_IPv6=n +CONFIG_NSOCKET_DESCRIPTORS=0 +CONFIG_NET_SOCKOPTS=y +CONFIG_NET_BUFSIZE=420 +CONFIG_NET_TCP=n +CONFIG_NET_TCP_CONNS=40 +CONFIG_NET_MAX_LISTENPORTS=40 +CONFIG_NET_UDP=n +CONFIG_NET_UDP_CHECKSUMS=y +#CONFIG_NET_UDP_CONNS=10 +CONFIG_NET_ICMP=n +#CONFIG_NET_PINGADDRCONF=0 +CONFIG_NET_STATISTICS=y +#CONFIG_NET_RECEIVE_WINDOW= +#CONFIG_NET_ARPTAB_SIZE=8 +CONFIG_NET_BROADCAST=n +#CONFIG_NET_LLH_LEN=14 +#CONFIG_NET_FWCACHE_SIZE=2 + +# +# UIP Network Utilities +# CONFIG_NET_DHCP_LIGHT - Reduces size of DHCP +# CONFIG_NET_RESOLV_ENTRIES - Number of resolver entries +CONFIG_NET_DHCP_LIGHT=n +CONFIG_NET_RESOLV_ENTRIES=4 + +# +# Settings for examples/nsh +CONFIG_EXAMPLES_NSH_TELNET=n +CONFIG_EXAMPLES_NSH_IOBUFFER_SIZE=512 +CONFIG_EXAMPLES_NSH_CMD_SIZE=40 +CONFIG_EXAMPLES_NSH_STACKSIZE=4096 +CONFIG_EXAMPLES_NSH_DHCPC=n +CONFIG_EXAMPLES_NSH_NOMAC=n +CONFIG_EXAMPLES_NSH_IPADDR=(10<<24|0<<16|0<<8|2) +CONFIG_EXAMPLES_NSH_DRIPADDR=(10<<24|0<<16|0<<8|1) +CONFIG_EXAMPLES_NSH_NETMASK=(255<<24|255<<16|255<<8|0) + +# +# Stack and heap information +# +# CONFIG_BOOT_FROM_FLASH - Some configurations support XIP +# operation from FLASH. +# CONFIG_CUSTOM_STACK - The up_ implementation will handle +# all stack operations outside of the nuttx model. +# CONFIG_STACK_POINTER - The initial stack pointer +# CONFIG_PROC_STACK_SIZE - The size of the initial stack +# CONFIG_PTHREAD_STACK_MIN - Minimum pthread stack size +# CONFIG_PTHREAD_STACK_DEFAULT - Default pthread stack size +# CONFIG_HEAP_BASE - The beginning of the heap +# CONFIG_HEAP_SIZE - The size of the heap +# +CONFIG_BOOT_FROM_FLASH=n +CONFIG_CUSTOM_STACK=n +CONFIG_PROC_STACK_SIZE=1024 +CONFIG_PTHREAD_STACK_MIN=256 +CONFIG_PTHREAD_STACK_DEFAULT=1024 +CONFIG_HEAP_SIZE= +CONFIG_HEAP_BASE= diff --git a/nuttx/configs/xtrs/pashello/setenv.sh b/nuttx/configs/xtrs/pashello/setenv.sh new file mode 100755 index 000000000..0eedee334 --- /dev/null +++ b/nuttx/configs/xtrs/pashello/setenv.sh @@ -0,0 +1,45 @@ +#!/bin/sh +# xtrs/setenv.sh +# +# Copyright (C) 2008 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# + +if [ "$(basename $0)" = "setenv.sh" ] ; then + echo "You must source this script, not run it!" 1>&2 + exit 1 +fi + +if [ -z ${PATH_ORIG} ]; then export PATH_ORIG=${PATH}; fi + +export SDCC_BIN=/usr/local/bin +export PATH=${SDCC_BIN}:/sbin:/usr/sbin:${PATH_ORIG} + +echo "PATH : ${PATH}" diff --git a/nuttx/configs/xtrs/sdcc-2.6.0-asz80-symlen.patch b/nuttx/configs/xtrs/sdcc-2.6.0-asz80-symlen.patch new file mode 100644 index 000000000..d91c18d98 --- /dev/null +++ b/nuttx/configs/xtrs/sdcc-2.6.0-asz80-symlen.patch @@ -0,0 +1,11 @@ +--- sdcc/as/z80/asm.h 2007-12-30 16:49:53.000000000 -0600 ++++ sdcc.orig/as/z80/asm.h 2007-12-30 16:49:14.000000000 -0600 +@@ -65,7 +65,7 @@ + #define RTTERM ')' /* Right expression delimeter */ + + #ifdef SDK +-#define NCPS 80 /* characters per symbol */ ++#define NCPS 32 /* characters per symbol */ + #else /* SDK */ + #define NCPS 8 /* Chars. per symbol */ + #endif /* SDK */ diff --git a/nuttx/configs/xtrs/src/Makefile b/nuttx/configs/xtrs/src/Makefile new file mode 100644 index 000000000..ca08c9a33 --- /dev/null +++ b/nuttx/configs/xtrs/src/Makefile @@ -0,0 +1,77 @@ +############################################################################ +# configs/xtrs/src/Makefile +# +# Copyright (C) 2008 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +-include $(TOPDIR)/Make.defs + +CFLAGS += -I$(TOPDIR)/sched -I$(TOPDIR)/arch/z80/src/common -I$(TOPDIR)/arch/z80/src/z80 + +ASRCS = +AOBJS = $(ASRCS:$(ASMEXT)=$(OBJEXT)) +CSRCS = xtr_irq.c xtr_serial.c xtr_timerisr.c xtr_lowputc.c +COBJS = $(CSRCS:.c=$(OBJEXT)) + +SRCS = $(ASRCS) $(CSRCS) +OBJS = $(AOBJS) $(COBJS) + +CFLAGS += -I $(TOPDIR)/arch/$(CONFIG_ARCH)/src +CFLAGS += -I $(TOPDIR)/arch/$(CONFIG_ARCH)/include + +all: libboard$(LIBEXT) + +$(AOBJS): %$(OBJEXT): %$(ASMEXT) + $(call ASSEMBLE, $<, $@) + +$(COBJS) $(LINKOBJS): %$(OBJEXT): %.c + $(call COMPILE, $<, $@) + +libboard$(LIBEXT): $(OBJS) + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $@, $${obj}); \ + done ; ) + +.depend: Makefile $(SRCS) + @$(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep + @touch $@ + +depend: .depend + +clean: + @rm -f libboard$(LIBEXT) *~ .*.swp + $(call CLEAN) + +distclean: clean + @rm -f Make.dep .depend + +-include Make.dep diff --git a/nuttx/configs/xtrs/src/README.txt b/nuttx/configs/xtrs/src/README.txt new file mode 100644 index 000000000..d733b60bd --- /dev/null +++ b/nuttx/configs/xtrs/src/README.txt @@ -0,0 +1 @@ +This directory contains drivers unique to the xtrs80 emulation diff --git a/nuttx/configs/xtrs/src/xtr_irq.c b/nuttx/configs/xtrs/src/xtr_irq.c new file mode 100644 index 000000000..44df0fe4d --- /dev/null +++ b/nuttx/configs/xtrs/src/xtr_irq.c @@ -0,0 +1,117 @@ +/**************************************************************************** + * board/xtr_irq.c + * + * Copyright (C) 2008 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include + +#include "up_arch.h" +#include "os_internal.h" +#include "up_internal.h" + +/**************************************************************************** + * Definitions + ****************************************************************************/ + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: up_irqinitialize + ****************************************************************************/ + +void up_irqinitialize(void) +{ + /* Attach the timer interrupt -- There is not special timer interrupt + * enable in the simulation so it must be enabled here before interrupts + * are enabled. + * + * NOTE: Normally, there are seperate enables for "global" interrupts + * and specific device interrupts. In such a "normal" case, the timer + * interrupt should be attached and enabled in the the function up_timerinit() + */ + + irq_attach(Z80_IRQ_SYSTIMER, (xcpt_t)up_timerisr); + + /* And finally, enable interrupts (including the timer) */ + +#ifndef CONFIG_SUPPRESS_INTERRUPTS + irqrestore(Z80_C_FLAG); +#endif +} + +/**************************************************************************** + * Name: up_disable_irq + * + * Description: + * Disable the IRQ specified by 'irq' + * + ****************************************************************************/ + +void up_disable_irq(int irq) +{ + irqrestore(0); +} + +/**************************************************************************** + * Name: up_enable_irq + * + * Description: + * Enable the IRQ specified by 'irq' + * + ****************************************************************************/ + +void up_enable_irq(int irq) +{ + irqrestore(TRUE); +} diff --git a/nuttx/configs/xtrs/src/xtr_lowputc.c b/nuttx/configs/xtrs/src/xtr_lowputc.c new file mode 100644 index 000000000..be1628444 --- /dev/null +++ b/nuttx/configs/xtrs/src/xtr_lowputc.c @@ -0,0 +1,106 @@ +/******************************************************************************** + * board/xtr_lowputc.c + * + * Copyright (C) 2008 Jacques Pelletier. All rights reserved. + * Author: Jacques Pelletier + * + * This file is a part of NuttX and hence + * + * Copyright (C) 2008 Gregory Nutt. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ********************************************************************************/ + +/******************************************************************************** + * Included Files + ********************************************************************************/ + +#include + +#include +#include +#include +#include +#include + +#include "os_internal.h" +#include "up_internal.h" + +/* Includes trs80-m3.h for assembler call addresses */ + +#include + +/******************************************************************************** + * Definitions + ********************************************************************************/ + +/******************************************************************************** + * Public Data + ********************************************************************************/ + +/******************************************************************************** + * Private Data + ********************************************************************************/ + +/******************************************************************************** + * Private Functions + ********************************************************************************/ + +/******************************************************************************** + * Public Functions + ********************************************************************************/ + +/******************************************************************************** + * Name: up_lowputc + ********************************************************************************/ + +void up_lowputc(char ch) __naked +{ + _asm + ld hl, #2 + add hl, sp + ld a, (hl) + call _TRS80_M3_VDCHAR ;0x0033 + ret + _endasm; +} + +/******************************************************************************** + * Name: up_lowgetc + ********************************************************************************/ + +char up_lowgetc(void) __naked +{ + _asm + call _TRS80_M3_KBDSCN ;0x002b + ld l, a + ld h, #0 + ret + _endasm; +} diff --git a/nuttx/configs/xtrs/src/xtr_serial.c b/nuttx/configs/xtrs/src/xtr_serial.c new file mode 100644 index 000000000..06a38058a --- /dev/null +++ b/nuttx/configs/xtrs/src/xtr_serial.c @@ -0,0 +1,420 @@ +/**************************************************************************** + * board/xtr_serial.c + * + * Copyright (C) 2008 Jacques Pelletier. All rights reserved. + * Author: Jacques Pelletier + * + * This file is a part of NuttX and hence + * + * Copyright (C) 2008 Gregory Nutt. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include "up_arch.h" +#include "os_internal.h" +#include "up_internal.h" + +/* Defined in drivers/dev_lowconsole.c */ + +#ifdef CONFIG_USE_LOWCONSOLE +extern void lowconsole_init(void); +#endif + +#if CONFIG_NFILE_DESCRIPTORS > 0 +#if defined(CONFIG_DEV_CONSOLE) && !defined(CONFIG_DEV_LOWCONSOLE) +/**************************************************************************** + * Definitions + ****************************************************************************/ +#define TRSDOS 0 /* TRSDOS 1.3 */ +#define LDOS 1 /* LDOS 5.3.1 */ + +#define MODEM_STATUS 0xe8 +#define RESET 0xe8 +#define BAUD 0xe9 +#define STATUS 0xea +#define CONTROL 0xea +#define RECV_REG 0xeb +#define XMIT_REG 0xeb + +#define XMIT_REG_EMPTY 0x40 + +#define WRINTMASK 0xe0 + +#define MASK_XMIT_INT 0x10 +#define MASK_RECV_INT 0x20 +#define MASK_ERR_INT 0x40 + +#if TRSDOS +#define WRINTMASK_SHADOW 0x4213 +#define XMIT_INT_VECTOR 0x4207 +#define RECV_INT_VECTOR 0x420a +#endif + +#if LDOS +#define WRINTMASK_SHADOW 0x4474 +#define XMIT_INT_VECTOR 0x447D +#define RECV_INT_VECTOR 0x447F +#endif + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +/**************************************************************************** + * Private Function Prototypes + ****************************************************************************/ + +static int up_setup(struct uart_dev_s *dev); +static void up_shutdown(struct uart_dev_s *dev); +static int up_attach(struct uart_dev_s *dev); +static void up_detach(struct uart_dev_s *dev); +static int up_ioctl(struct file *filep, int cmd, unsigned long arg); +static int up_receive(struct uart_dev_s *dev, uint32 *status); +static void up_rxint(struct uart_dev_s *dev, boolean enable); +static boolean up_rxavailable(struct uart_dev_s *dev); +static void up_send(struct uart_dev_s *dev, int ch); +static void up_txint(struct uart_dev_s *dev, boolean enable); +static boolean up_txready(struct uart_dev_s *dev); +static boolean up_txempty(struct uart_dev_s *dev); + +/**************************************************************************** + * Private Variables + ****************************************************************************/ + +struct uart_ops_s g_uart_ops = +{ + up_setup, /* setup */ + up_shutdown, /* shutdown */ + up_attach, /* attach */ + up_detach, /* detach */ + up_ioctl, /* ioctl */ + up_receive, /* receive */ + up_rxint, /* rxint */ + up_rxavailable, /* rxavailable */ + up_send, /* send */ + up_txint, /* txint */ + up_txready, /* txready */ + up_txempty, /* txempty */ +}; + +/* I/O buffers */ + +static char g_uartrxbuffer[CONFIG_UART_RXBUFSIZE]; +static char g_uarttxbuffer[CONFIG_UART_TXBUFSIZE]; + +/* This describes the state of the fake UART port. */ + +static uart_dev_t g_uartport = +{ + 0, /* open_count */ + FALSE, /* xmitwaiting */ + FALSE, /* recvwaiting */ + FALSE, /* isconsole */ + { 1 }, /* closesem */ + { 0 }, /* xmitsem */ + { 0 }, /* recvsem */ + { /* xmit */ + { 1 }, /* sem */ + 0, /* head */ + 0, /* tail */ + CONFIG_UART_TXBUFSIZE, /* size */ + g_uarttxbuffer, /* buffer */ + }, + { /* recv */ + { 1 }, /* sem */ + 0, /* head */ + 0, /* tail */ + CONFIG_UART_RXBUFSIZE, /* size */ + g_uartrxbuffer, /* buffer */ + }, + &g_uart_ops, /* ops */ + NULL, /* priv */ +}; + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: up_setup + * + * Description: + * Configure the UART baud, bits, parity, fifos, etc. This + * method is called the first time that the serial port is + * opened. + * + ****************************************************************************/ + +static int up_setup(struct uart_dev_s *dev) +{ + outp(RESET, 0); + outp(CONTROL, ctrl); + outp(BAUD, baud); + + return OK; +} + +/**************************************************************************** + * Name: up_shutdown + * + * Description: + * Disable the UART. This method is called when the serial + * port is closed + * + ****************************************************************************/ + +static void up_shutdown(struct uart_dev_s *dev) +{ +} + +/**************************************************************************** + * Name: up_attach + * + * Description: + * Configure the UART to operation in interrupt driven mode. This method is + * called when the serial port is opened. Normally, this is just after the + * the setup() method is called, however, the serial console may operate in + * a non-interrupt driven mode during the boot phase. + * + * RX and TX interrupts are not enabled when by the attach method (unless the + * hardware supports multiple levels of interrupt enabling). The RX and TX + * interrupts are not enabled until the txint() and rxint() methods are called. + * + ****************************************************************************/ + +static int up_attach(struct uart_dev_s *dev) +{ +// SDCC complains here +// *((void (*)()) XMIT_INT_VECTOR) = rs232_xmitisr; +// *((void (*)()) RECV_INT_VECTOR) = rs232_recvisr; + *((int *) XMIT_INT_VECTOR) = (int) rs232_xmitisr; + *((int *) RECV_INT_VECTOR) = (int) rs232_recvisr; + + *(char *)WRINTMASK_SHADOW &= ~(MASK_ERR_INT | MASK_XMIT_INT); + outp(WRINTMASK, *(char *)WRINTMASK_SHADOW |= MASK_RECV_INT); + + return OK; +} + +/**************************************************************************** + * Name: up_detach + * + * Description: + * Detach UART interrupts. This method is called when the serial port is + * closed normally just before the shutdown method is called. The exception is + * the serial console which is never shutdown. + * + ****************************************************************************/ + +static void up_detach(struct uart_dev_s *dev) +{ + outp(WRINTMASK, *(char *)WRINTMASK_SHADOW &= ~(MASK_ERR_INT | MASK_RECV_INT | MASK_XMIT_INT)); + *((int *) XMIT_INT_VECTOR) = 0x35fa; + *((int *) RECV_INT_VECTOR) = 0x35fa; +} + +/**************************************************************************** + * Name: up_ioctl + * + * Description: + * All ioctl calls will be routed through this method + * + ****************************************************************************/ + +static int up_ioctl(struct file *filep, int cmd, unsigned long arg) +{ + *get_errno_ptr() = ENOTTY; + return ERROR; +} + +/**************************************************************************** + * Name: up_receive + * + * Description: + * Called (usually) from the interrupt level to receive one + * character from the UART. Error bits associated with the + * receipt are provided in the the return 'status'. + * + ****************************************************************************/ + +static int up_receive(struct uart_dev_s *dev, uint32 *status) +{ +// uint8 ch = up_lowgetc(); + + *status = 0; + return ch; +} + +/**************************************************************************** + * Name: up_rxint + * + * Description: + * Call to enable or disable RX interrupts + * + ****************************************************************************/ + +static void up_rxint(struct uart_dev_s *dev, boolean enable) +{ +} + +/**************************************************************************** + * Name: up_rxavailable + * + * Description: + * Return TRUE if the receive fifo is not empty + * + ****************************************************************************/ + +static boolean up_rxavailable(struct uart_dev_s *dev) +{ + return TRUE; +} + +/**************************************************************************** + * Name: up_send + * + * Description: + * This method will send one byte on the UART + * + ****************************************************************************/ + +static void up_send(struct uart_dev_s *dev, int ch) +{ + up_lowputc(ch); +} + +/**************************************************************************** + * Name: up_txint + * + * Description: + * Call to enable or disable TX interrupts + * + ****************************************************************************/ + +static void up_txint(struct uart_dev_s *dev, boolean enable) +{ +} + +/**************************************************************************** + * Name: up_txready + * + * Description: + * Return TRUE if the transmit fifo is not full + * + ****************************************************************************/ + +static boolean up_txready(struct uart_dev_s *dev) +{ + return TRUE; +} + +/**************************************************************************** + * Name: up_txempty + * + * Description: + * Return TRUE if the transmit fifo is empty + * + ****************************************************************************/ + +static boolean up_txempty(struct uart_dev_s *dev) +{ + return TRUE; +} + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: up_serialinit + * + * Description: + * Performs the low level UART initialization early in + * debug so that the serial console will be available + * during bootup. This must be called before up_serialinit. + * + ****************************************************************************/ + +void up_earlyserialinit(void) +{ +} +#endif /* CONFIG_DEV_CONSOLE && !CONFIG_DEV_LOWCONSOLE */ + +/**************************************************************************** + * Name: up_serialinit + * + * Description: + * Register serial ports. This assumes + * that up_earlyserialinit was called previously. + * + ****************************************************************************/ + +void up_serialinit(void) +{ +#if defined(CONFIG_DEV_LOWCONSOLE) + (void)lowconsole_init(); +#elif defined(CONFIG_DEV_CONSOLE) + (void)uart_register("/dev/console", &g_uartport); + (void)uart_register("/dev/ttyS0", &g_uartport); +#endif +} +#endif /* CONFIG_NFILE_DESCRIPTORS */ + +/**************************************************************************** + * Name: up_putc + * + * Description: + * Provide priority, low-level access to support OS debug + * writes + * + ****************************************************************************/ + +int up_putc(int ch) +{ + up_lowputc(ch); + return 0; +} diff --git a/nuttx/configs/xtrs/src/xtr_timerisr.c b/nuttx/configs/xtrs/src/xtr_timerisr.c new file mode 100644 index 000000000..cd0757f58 --- /dev/null +++ b/nuttx/configs/xtrs/src/xtr_timerisr.c @@ -0,0 +1,95 @@ +/**************************************************************************** + * board/xtr_timerisr.c + * + * Copyright (C) 2008 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include + +#include + +#include "clock_internal.h" +#include "up_internal.h" + +/**************************************************************************** + * Definitions + ****************************************************************************/ + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +/**************************************************************************** + * Private Function Prototypes + ****************************************************************************/ + +/**************************************************************************** + * Global Functions + ****************************************************************************/ + +/**************************************************************************** + * Function: up_timerisr + * + * Description: + * The timer ISR will perform a variety of services for various portions of + * the system. + * + ****************************************************************************/ + +int up_timerisr(int irq, FAR chipreg_t *regs) +{ + /* Process timer interrupt */ + + sched_process_timer(); + return 0; +} + +/**************************************************************************** + * Function: up_timerinit + * + * Description: + * This function is called during start-up to initialize the timer + * interrupt. + * + ****************************************************************************/ + +void up_timerinit(void) +{ + /* The timer interrupt was attached in up_irqinitialize -- see comments there */ +} -- cgit v1.2.3